Esempio n. 1
0
	public function init()
	{	
		parent::init();

		$this->current_index = 0;
		
		// make sure $field was specified
		if (!$this->field)
			throw new Exception("field must be specified in resultfilter control");
		$this->filter_definition = $this->controller->appmeta->filter->{$this->field};
		
		if (!$this->datasource) /* Default to the datasource definition in the config file */
			$this->datasource = $this->filter_definition->datasource;
		$filter_type = $this->filter_definition->type;

		// Set container and item templates from config file if not passed into tag
		if (!$this->item_template)
			$this->item_template = $this->controller->appmeta->renderer_map->{$filter_type}->item;
			
		if (!$this->container_template)
			$this->container_template = $this->controller->appmeta->renderer_map->{$filter_type}->container;
				
		// dig specific facet counts out of facets
		if (is_assoc($this->datasource))
		{
			$facet = $this->datasource[$this->filter_definition->facet->field];
			$this->datasource = array();
			foreach($facet as $value => $count)
				$this->datasource[] = array('value' => $value, 'count' => $count); 
		}
	}
Esempio n. 2
0
 public function init()
 {
     parent::init();
     $this->label = $this->controller->appmeta->sort->order_by->label;
     // Copy the sort options from the config file as the repeater datasources
     $index = 0;
     foreach ($this->controller->appmeta->sort->order_by->options as $opt => $values) {
         foreach ($values as $key => $value) {
             $this->datasource[$index][$key] = $value;
         }
         $index++;
     }
     // Set container and item templates from config file if not passed into tag
     if (!$this->item_template) {
         $this->item_template = $this->controller->appmeta->renderer_map->sort->item;
     }
     if (!$this->container_template) {
         $this->container_template = $this->controller->appmeta->renderer_map->sort->container;
     }
 }