00001 <?php
00002
00015
00016
00017 import('pages.manager.ManagerHandler');
00018
00019 class StatisticsHandler extends ManagerHandler {
00023 function StatisticsHandler() {
00024 parent::ManagerHandler();
00025 }
00031 function statistics() {
00032 $this->validate();
00033 $this->setupTemplate(true);
00034
00035 $schedConf =& Request::getSchedConf();
00036 if (!$schedConf) Request::redirect(null, 'index');
00037
00038 $templateMgr =& TemplateManager::getManager();
00039
00040 $trackIds = $schedConf->getSetting('statisticsTrackIds');
00041 if (!is_array($trackIds)) $trackIds = array();
00042 $templateMgr->assign('trackIds', $trackIds);
00043
00044 foreach (StatisticsHandler::getPublicStatisticsNames() as $name) {
00045 $templateMgr->assign($name, $schedConf->getSetting($name));
00046 }
00047
00048 $schedConfStatisticsDao =& DAORegistry::getDAO('SchedConfStatisticsDAO');
00049 $paperStatistics = $schedConfStatisticsDao->getPaperStatistics($schedConf->getId(), null);
00050 $templateMgr->assign('paperStatistics', $paperStatistics);
00051
00052 $limitedPaperStatistics = $schedConfStatisticsDao->getPaperStatistics($schedConf->getId(), $trackIds);
00053 $templateMgr->assign('limitedPaperStatistics', $limitedPaperStatistics);
00054
00055 $trackDao =& DAORegistry::getDAO('TrackDAO');
00056 $tracks =& $trackDao->getSchedConfTracks($schedConf->getId());
00057 $templateMgr->assign('tracks', $tracks->toArray());
00058
00059 $reviewerStatistics = $schedConfStatisticsDao->getReviewerStatistics($schedConf->getId(), $trackIds);
00060 $templateMgr->assign('reviewerStatistics', $reviewerStatistics);
00061
00062 $userStatistics = $schedConfStatisticsDao->getUserStatistics($schedConf->getId());
00063 $templateMgr->assign('userStatistics', $userStatistics);
00064
00065 $registrationStatistics = $schedConfStatisticsDao->getRegistrationStatistics($schedConf->getId());
00066 $templateMgr->assign('registrationStatistics', $registrationStatistics);
00067
00068 $reportPlugins =& PluginRegistry::loadCategory('reports');
00069 $templateMgr->assign_by_ref('reportPlugins', $reportPlugins);
00070
00071 $templateMgr->assign('helpTopicId', 'conference.currentConferences.statsReports');
00072
00073 $templateMgr->display('manager/statistics/index.tpl');
00074 }
00075
00076 function saveStatisticsTracks() {
00077
00078
00079
00080 $this->validate();
00081
00082 $schedConf =& Request::getSchedConf();
00083 if (!$schedConf) Request::redirect(null, 'index');
00084
00085 $trackIds = Request::getUserVar('trackIds');
00086 if (!is_array($trackIds)) {
00087 if (empty($trackIds)) $trackIds = array();
00088 else $trackIds = array($trackIds);
00089 }
00090
00091 $schedConf->updateSetting('statisticsTrackIds', $trackIds);
00092 Request::redirect(null, null, 'manager', 'statistics', null, array('statisticsYear' => Request::getUserVar('statisticsYear')));
00093 }
00094
00095 function getPublicStatisticsNames() {
00096 return array(
00097 'statItemsPublished',
00098 'statNumSubmissions',
00099 'statPeerReviewed',
00100 'statCountAccept',
00101 'statCountDecline',
00102 'statCountRevise',
00103 'statDaysPerReview',
00104 'statRegisteredUsers',
00105 'statRegisteredReaders',
00106 'statRegistrations'
00107 );
00108 }
00109
00110 function savePublicStatisticsList() {
00111 $this->validate();
00112
00113 $schedConf =& Request::getSchedConf();
00114 if (!$schedConf) Request::redirect(null, 'index');
00115
00116 foreach (StatisticsHandler::getPublicStatisticsNames() as $name) {
00117 $schedConf->updateSetting($name, Request::getUserVar($name)?true:false);
00118 }
00119 Request::redirect(null, null, 'manager', 'statistics', null, array('statisticsYear' => Request::getUserVar('statisticsYear')));
00120 }
00121
00122 function report($args) {
00123 $this->validate();
00124
00125 $schedConf =& Request::getSchedConf();
00126 if (!$schedConf) Request::redirect(null, 'index');
00127
00128 $pluginName = array_shift($args);
00129 $reportPlugins =& PluginRegistry::loadCategory('reports');
00130
00131 if ($pluginName == '' || !isset($reportPlugins[$pluginName])) {
00132 Request::redirect(null, null, null, 'statistics');
00133 }
00134
00135 $plugin =& $reportPlugins[$pluginName];
00136 $plugin->display($args);
00137 }
00138 }
00139
00140 ?>