Changeset 1498:6d67bea812f3 for inc/admin/class.dc.filter.php
- Timestamp:
- 08/20/13 16:32:39 (12 years ago)
- Branch:
- twig
- File:
-
- 1 edited
-
inc/admin/class.dc.filter.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
inc/admin/class.dc.filter.php
r1491 r1498 382 382 $fcontext = new ArrayObject(); 383 383 $sfcontext = new ArrayObject(); 384 $afcontext = new ArrayObject(); 384 385 foreach ($this->filters as $f) { 385 386 if($f->isEnabled()) { … … 390 391 $f->appendFilterContext($sfcontext); 391 392 } 393 foreach ($this->filters as $f) { 394 if ($f->isApplied()) { 395 $afcontext[] = $f->getAppliedFilterText(); 396 } 397 } 392 398 return array( 393 399 'active_filters' => $fcontext, 394 400 'static_filters' => $sfcontext, 401 'applied_filters' => $afcontext, 395 402 'hide_filters' => $this->hide_filterset, 396 403 'prefix' => $this->form_prefix); … … 635 642 636 643 protected abstract function addValue($value=NULL); 637 644 protected abstract function getAppliedFilterText(); 645 638 646 /** 639 647 * add -- adds a value for the filter … … 832 840 $params[$this->request_param]=$this->avalues['values'][0]; 833 841 } 842 843 public function getAppliedFilterText() { 844 if ($this->isApplied()) { 845 return sprintf(__('%s contains : "%s"'),$this->desc,$this->avalues['values'][0]); 846 } 847 } 834 848 } 835 849 … … 860 874 */ 861 875 public function init() { 876 echo $this->name.":".($this->multiple?"MULTIPLE":"SIMPLE"); 862 877 $this->field = new dcFieldCombo( 863 878 $this->filter_id, 864 879 NULL, 865 $this->combo); 880 $this->combo,array( 881 'multiple' => $this->multiple)); 866 882 $this->filterset->addField($this->field); 867 883 } … … 913 929 $params[$attr]=$this->avalues['values'][0]; 914 930 } 915 931 public function getAppliedFilterText() { 932 if ($this->isApplied()) { 933 if (count($this->avalues['values'])) { 934 return sprintf(__("%s is %s"),$this->desc,join(__(' OR '), $this->avalues['values'])); 935 } else { 936 return sprintf(__('%s is %s'),$this->desc,$this->avalues['values'][0]); 937 } 938 } 939 } 916 940 } 917 941 … … 1001 1025 } 1002 1026 } 1027 public function getAppliedFilterText() { 1028 if ($this->isApplied()) { 1029 if ($this->avalues['verb'] == "is") { 1030 $txt = __("%s is %s"); 1031 $or = __(' or '); 1032 } else { 1033 $txt = __("%s is not %s"); 1034 $or = __(' nor '); 1035 } 1036 $texts = array(); 1037 foreach ($this->avalues['values'] as $v) { 1038 $texts[] = $this->field->getTextForValue($v); 1039 } 1040 if (count($texts)>=1) { 1041 return sprintf($txt,$this->desc,join($or, $texts)); 1042 } else { 1043 return sprintf($txt,$this->desc,$texts); 1044 } 1045 } 1046 } 1003 1047 1004 1048 }
Note: See TracChangeset
for help on using the changeset viewer.
