/** * Display widgets content * @access public * @param Zend_Config $value * @return void */ public function displayWidgets($value) { $tpl = View::getInstance(TEMPLATES_PATH . '/' . $this->requestModule); $tpl->init(); $debug = new Dot_Debug($tpl); // if we have only one widget, Zend_Config_Xml return a simple array, not an array with key 0(zero) if (is_null($value->{0})) { $value = new Zend_Config(array(0 => $value)); } $widgets = $value->toArray(); foreach ($widgets as $key => $val) { if ($this->varExists($val['token'])) { // initialize the template file where is the widget content $this->setFile('tpl_widget', 'blocks/' . strtolower($val['token']) . '.tpl'); switch ($val['token']) { case 'WIDGET_MEMORY': $debug->generateMemoryPiechart($val); break; case 'WIDGET_KEYS': $debug->generateKeysPiechart($val); break; case 'WIDGET_HITS': $debug->generateHitsPiechart($val); break; case 'WIDGET_USER_LOGINS': $this->_displayUserLoginsPiechart($val); break; case 'WIDGET_TOP_USERS': $this->_displayTopUsersColumnchart($val); break; case 'WIDGET_TIME_ACTIVITY': $this->_displayTimeActivityLinechart($val); break; } // parse the widget content $this->parse(strtoupper($val['token']), 'tpl_widget'); $this->unsetVar('tpl_widget'); } } }