Changeset 1524:913f5a36bbb0 for inc/admin/class.dc.list.php
- Timestamp:
- 08/22/13 16:37:27 (12 years ago)
- Branch:
- twig
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inc/admin/class.dc.list.php
r1507 r1524 66 66 67 67 protected function setupFilterset() { 68 foreach ($this->columns as $c) { 69 $this->filterset->addfilter($c->getFilter()); 70 } 68 71 $this->sortby = new dcFilterCombo( 69 72 'sortby', … … 134 137 } 135 138 } 136 139 137 140 public function getContext() { 138 141 $ccontext = new ArrayObject(); 139 142 foreach ($this->columns as $c) { 140 $c->appendEditLines($ccontext); 143 if ($c->isEnabled()) { 144 $c->appendEditLines($ccontext); 145 } 141 146 } 142 147 $page = $this->page; … … 166 171 } 167 172 168 public function addColumn( $c) {173 public function addColumn(dcColumn $c) { 169 174 $this->columns[$c->getID()] = $c; 170 175 $c->setForm($this); … … 189 194 protected $sortable; 190 195 protected $col_id; 196 protected $filter; 197 protected $locked; 191 198 192 199 public function __construct($id, $name, $col_id,$attributes=array()) { … … 194 201 $this->name = $name; 195 202 $this->col_id = $col_id; 196 } 197 203 $this->locked = isset($attributes['locked']) && $attributes['locked']; 204 $this->filter = new dcFilterCheckbox('col'.$id,$name,$name,'',array('static'=>true,'locked'=>$this->locked)); 205 } 206 207 public function getFilter () { 208 return $this->filter; 209 } 198 210 public function getName() { 199 211 return $this->name; … … 212 224 } 213 225 226 public function isEnabled() { 227 $v = $this->filter->getAppliedValues(); 228 return $v['values']['1']==1; 229 } 214 230 public function appendEditLines($line) { 215 231 $line[] = array ( … … 231 247 } 232 248 249 /** 250 * dcFilterText - basic single field text filter 251 * 252 * @uses dcFilter 253 * 254 */ 255 class dcFilterCheckbox extends dcFilter { 256 257 /** 258 * @see dcFilter::init() 259 */ 260 public function init() { 261 $foptions = array('label' => $this->name); 262 if (isset($this->options['locked']) && $this->options['locked']){ 263 $foptions['read_only']= true; 264 } 265 $this->field = new dcFieldCheckbox($this->filter_id,false,$foptions); 266 $this->filterset->addField($this->field); 267 $this->multiple = false; 268 } 269 270 protected function parseData($data) { 271 return parent::parseData($data); 272 } 273 /** 274 * @see dcFilter::appendContextLine() 275 */ 276 public function appendContextLine($line,$pos) { 277 /* 278 Extra data provided by this filter : 279 * ffield : field name 280 * display_inline : true if the field is static 281 * fwidget : name of the widget (filter_text) 282 * desc : filter description 283 */ 284 $line['ffield'] = $this->field->getName(); 285 if ($this->static) { 286 $line['display_inline'] = true; 287 } 288 if ($pos == 0) { 289 290 $line['fwidget']='filter_boolean'; 291 $line['desc']=$this->desc; 292 }; 293 } 294 295 /** 296 * @see dcFilter::addValue() 297 */ 298 protected function addValue($value=NULL) { 299 $this->field->addValue($value,true); 300 } 301 302 /** 303 * @see dcFilter::applyFilter() 304 */ 305 public function applyFilter($params) { 306 } 307 308 public function getAppliedFilterText() { 309 return ""; 310 } 311 } 312 233 313 dcItemList::__init__($GLOBALS['core']->tpl); 234 314
Note: See TracChangeset
for help on using the changeset viewer.