<?php

/**
 * Modelo para el tablero
 *
 */
class Tablero extends CModel {
        
        private function getActividadPortlet() {
            $model=new Candidato('search');
        
            $portlet = array(
                'id' => 'actividad_candidatos',
                'header' => 'Resumen de actividad de candidatos (últimos 7 días)',
                'content' => array(
                    'model' => $model
                )
            );
            return $portlet;
        }

        private function getSituacionCandidatosPortlet() {
            $candidatos = new Candidato('search');
        
            $total = $candidatos->count();
            
            $portlet = array(
                'id' => 'situacion_candidatos',
                'header' => 'Situación actual',
                'content' => array(
                    'total' => $total
                )
            );
            return $portlet;
        }
        
        
	/**
	 * 
	 * @return array lista de portlets del tablero
	 */
        public function getPortlets() {
            $portlets = array();
            $portlets['actividad_candidatos'] = $this->getActividadPortlet();
            $portlets['situacion_candidatos'] = $this->getSituacionCandidatosPortlet();

            return $portlets;
        }
        
	/**
	 * Returns the list of attribute names.
	 * By default, this method returns all public properties of the class.
	 * You may override this method to change the default.
	 * @return array list of attribute names. Defaults to all public properties of the class.
	 */
	public function attributeNames()
	{
		$className=get_class($this);
		if(!isset(self::$_names[$className]))
		{
			$class=new ReflectionClass(get_class($this));
			$names=array();
			foreach($class->getProperties() as $property)
			{
				$name=$property->getName();
				if($property->isPublic() && !$property->isStatic())
					$names[]=$name;
			}
			return self::$_names[$className]=$names;
		}
		else
			return self::$_names[$className];
	}
}



?>
