Pluf Framework

Pluf Framework Commit Details


Date:2009-07-08 07:22:11 (15 years 5 months ago)
Author:Loic d'Anterroches
Branch:develop, master
Commit:955e2dd713ad17a8d00f18660fc024360d213c28
Parents: ac2602dca45a26a961880d43a96f816b00465314
Message:Added the ability to have the sort order on the header directly.

Changes:

File differences

src/Pluf/Paginator.php
164164
165165
166166
167
168
169
170
171
172
173
167174
168175
169176
......
567574
568575
569576
570
577
578
579
580
581
571582
572583
573584
......
578589
579590
580591
592
593
581594
595
582596
583597
584598
585
599
586600
587601
588
602
589603
590604
591605
......
594608
595609
596610
597
598
611
612
599613
600
601
614
615
616
617
618
619
620
621
622
602623
603624
604625
public $sort_reverse_order = array();
/**
*
* Do not add the little sort links but directly make the title of
* the column a link to sort.
*/
public $sort_link_title = false;
/**
* Edit action.
*
*/
$name = $col;
$field = $key;
}
$out .= '<th><span class="px-header-title">'.Pluf_esc(ucfirst($name)).'</span>'.$this->headerSortLinks($field).'</th>';
if (!$this->sort_link_title) {
$out .= '<th><span class="px-header-title">'.Pluf_esc(ucfirst($name)).'</span>'.$this->headerSortLinks($field).'</th>';
} else {
$out .= '<th><span class="px-header-title">'.$this->headerSortLinks($field, Pluf_esc(ucfirst($name))).'</span></th>';
}
}
$out .= '</tr>'."\n";
return $out;
* Generate the little text on the header to allow sorting if
* available.
*
* If the title is set, the link is directly made on the title.
*
* @param string Name of the field
* @param string Title ('')
* @return string HTML fragment with the links to
* sort ASC/DESC on this field.
*/
function headerSortLinks($field)
function headerSortLinks($field, $title='')
{
if (!in_array($field, $this->sort_fields)) {
return '';
return $title;
}
$params = array();
if (!empty($this->search_fields)) {
$params['_px_sk'] = $field;
$out = '<span class="px-sort">'.__('Sort').' %s/%s</span>';
$params['_px_so'] = 'a';
$url = $this->getUrl($params);
$asc = '<a href="'.$url.'" >'.__('asc').'</a>';
$aurl = $this->getUrl($params);
$asc = '<a href="'.$aurl.'" >'.__('asc').'</a>';
$params['_px_so'] = 'd';
$url = $this->getUrl($params);
$desc = '<a href="'.$url.'" >'.__('desc').'</a>';
$durl = $this->getUrl($params);
$desc = '<a href="'.$durl.'" >'.__('desc').'</a>';
if (strlen($title)) {
if ($this->sort_order[0] == $field
and $this->sort_order[1] == 'ASC') {
return '<a href="'.$durl.'" >'.$title.'</a>';
}
return '<a href="'.$aurl.'" >'.$title.'</a>';
}
return sprintf($out, $asc, $desc);
}

Archive Download the corresponding diff file

Branches

Tags

Number of commits:
Page rendered in 0.06150s using 13 queries.