Source for file class.acBlockType_dropdown.php

Documentation is available at class.acBlockType_dropdown.php

  1. <?php
  2. {
  3.     function __construct(&$content_obj$params array())
  4.     {
  5.         $params['block_type''dropdown';
  6.         parent::__construct($content_obj$params);
  7.         
  8.         $this->SetProperty('delimiter'isset($params['delimiter']$params['delimiter''|');
  9.         $this->SetProperty('items'isset($params['items']$params['items''');
  10.         $this->SetProperty('values'isset($params['values']$params['values''');
  11.     }
  12.     
  13.     public function GetInput()
  14.     {
  15.         $AC &ac_utils::get_module('AdvancedContent');
  16.         $items array();
  17.         if($this->GetProperty('items'!= '')
  18.         {
  19.             foreach(explode($this->GetProperty('delimiter')$this->GetProperty('items')) as $key => $val)
  20.             {
  21.                 $items[$key]['label'trim($val);
  22.                 if($this->GetProperty('translate_labels'))
  23.                     $items[$key]['label'$AC->lang($items[$key]['label']);
  24.                 
  25.                 $items[$key]['value']    $items[$key]['label'];
  26.                 $items[$key]['selected'(trim($this->GetContent()) === $items[$key]['value']);
  27.             }
  28.         }
  29.         if($this->GetProperty('values'!= '')
  30.         {
  31.             foreach(explode($this->GetProperty('delimiter')$this->GetProperty('values')) as $key => $val)
  32.             {
  33.                 $items[$key]['value'trim($val);
  34.                 if($this->GetProperty('translate_values'))
  35.                     $items[$key]['value'$AC->lang($items[$key]['value']);
  36.                 
  37.                 $items[$key]['selected'(trim($this->GetContent()) === $items[$key]['value']);
  38.                 
  39.                 if(!isset($items[$key]['label']))
  40.                     $items[$key]['label'$items[$key]['value'];
  41.             }
  42.         }
  43.         
  44.         $input '<select name="' $this->GetProperty('id''" ' ($this->GetProperty('style'!= ''?'style="' $this->GetProperty('style'' "':''' >';
  45.         foreach($items as $item)
  46.         {
  47.             $input .= '<option value="' $item['value''"';
  48.             if($item['selected'])
  49.                 $input .= ' selected="selected"';
  50.             
  51.             $input .= '>' $item['label''</option>';
  52.         }
  53.         $input .= '</select>';
  54.         return $input;
  55.     }
  56. }
  57. ?>

Documentation generated on Tue, 09 Oct 2012 16:57:03 +0200 by phpDocumentor 1.4.1