Changeset 1498:6d67bea812f3 for inc/admin/class.dc.list.php
- Timestamp:
- 08/20/13 16:32:39 (12 years ago)
- Branch:
- twig
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inc/admin/class.dc.list.php
r1491 r1498 14 14 15 15 protected $columns; 16 protected $columns_combo; 16 17 protected $entries; 17 18 protected $filterset; … … 54 55 @param form_prefix <b>string</b> form prefix to use for parameters 55 56 */ 56 public function __construct($core,$name,$f ilterset,$fetcher,$action,$form_prefix="f_") {57 public function __construct($core,$name,$fetcher,$action,$form_prefix="f_") { 57 58 parent::__construct($core,$name,$action,'POST'); 58 59 $this->entries = array(); … … 60 61 $this->selection = new dcFieldCheckbox('entries',NULL,array('multiple' => true)); 61 62 $this->addField($this->selection); 62 $this->filterset = $filterset;63 63 $this->fetcher = $fetcher; 64 } 65 66 public function setup() { 67 $this 68 ->addField(new dcFieldCombo('action','',array(), array( 69 'label' => __('Selected entries action:')))) 70 ->addField(new dcFieldSubmit('ok',__('ok'), array())); 71 $columns_combo = array(); 72 foreach ($this->columns as $c) { 73 $columns_combo[$c->getID()] = $c->getName(); 74 } 64 $this->filterset = null; 65 } 66 67 protected function setupFilterset() { 75 68 $this->sortby = new dcFilterCombo( 76 69 'sortby', 77 70 __('Sort By'), 78 __('Sort by'), 'sortby', $ columns_combo,array('singleval'=> true,'static' => true));71 __('Sort by'), 'sortby', $this->columns_combo,array('singleval'=> true,'static' => true)); 79 72 $this->filterset->addFilter($this->sortby); 80 73 $order_combo = array('asc' => __('Ascending'),'desc' => __('Descending')); … … 88 81 $this->filterset->addFilter($this->order); 89 82 $this->filterset->addFilter($limit); 90 $this->filterset->setup(); 83 $this->filterset->setup(); 84 $this->nb_items_per_page = $limit->getFields()->getValue(); 85 86 } 87 88 public function setup() { 89 $this 90 ->addField(new dcFieldCombo('action','',array(), array( 91 'label' => __('Selected entries action:')))) 92 ->addField(new dcFieldSubmit('ok',__('ok'), array())); 93 $this->columns_combo = array(); 94 foreach ($this->columns as $c) { 95 $this->columns_combo[$c->getID()] = $c->getName(); 96 } 97 if ($this->filterset !== null) { 98 $this->setupFilterset(); 99 } 91 100 parent::setup(); 92 $this->nb_items_per_page = $limit->getFields()->getValue();93 101 if ($this->nb_items_per_page == 0) 94 102 $this->nb_items_per_page = 10; … … 99 107 protected function fetchEntries() { 100 108 $params = new ArrayObject(); 101 $this->filterset->applyFilters($params); 109 if ($this->filterset != null) { 110 $this->filterset->applyFilters($params); 111 } 102 112 $this->nb_items = $this->fetcher->getEntriesCount($params); 103 113 $this->nb_pages = round($this->nb_items / $this->nb_items_per_page) + 1;
Note: See TracChangeset
for help on using the changeset viewer.