public function indexAction() { $statPlugins = array(); $this->view->pluginsLeft = array(); $this->view->pluginsRight = array(); $dir = dir(APP_DIR . Stats_Model_Report::STATS_PLUGIN_DIR); $i = 0; while (false !== ($entry = $dir->read())) { if (in_array($entry, array('.', '..')) || substr($entry, -4) != '.php') { continue; } try { $reportName = substr($entry, 0, -4); $statPlugins[$i] = Stats_Model_Report::getReportInstance($reportName); $statPlugins[$i]->setView($this->view); } catch (Monkeys_AccessDeniedException $ex) { Zend_Registry::get('logger')->log("Unable to open Stats plugin: {$entry}", Zend_Log::WARN); continue; } $i++; } $dir->close(); usort($statPlugins, array($this, '_sortPlugins')); $location = self::LOCATION_LEFT; foreach ($statPlugins as $statPlugin) { if ($location == self::LOCATION_LEFT) { $this->view->pluginsLeft[] = $statPlugin; $location = self::LOCATION_RIGHT; } else { $this->view->pluginsRight[] = $statPlugin; $location = self::LOCATION_LEFT; } } }
private function _getPlugin() { $reportName = $this->_getParam('report'); try { $statPlugin = Stats_Model_Report::getReportInstance($reportName); } catch (Monkeys_AccessDeniedException $ex) { throw new Exception("Unable to open Stats plugin: {$entry}"); } $statPlugin->setControllerAction($this); $statPlugin->setView($this->view); return $statPlugin; }