import('TimedViewReportForm'); $this->addLocaleData(); } return $success; } /** * Get the name of this plugin. The name must be unique within * its category. * @return String name of plugin */ function getName() { return 'TimedViewReportPlugin'; } function getDisplayName() { return __('plugins.reports.timedView.displayName'); } function getDescription() { return __('plugins.reports.timedView.description'); } /** * Set the page's breadcrumbs, given the plugin's tree of items * to append. * @param $subclass boolean */ function setBreadcrumbs() { $templateMgr =& TemplateManager::getManager(); $pageCrumbs = array( array( Request::url(null, 'user'), 'navigation.user' ), array( Request::url(null, 'manager'), 'user.role.manager' ), array( Request::url(null, 'manager', 'statistics'), 'manager.statistics' ) ); $templateMgr->assign('pageHierarchy', $pageCrumbs); } function display($args, $request) { parent::display($args, $request); $this->setBreadcrumbs(); $form = new TimedViewReportForm($this); if ($request->getUserVar('generate')) { $form->readInputData(); if ($form->validate()) { $form->execute($request); } else { $form->display(); } } elseif ($request->getUserVar('clearLogs')) { $dateClear = date('Ymd', mktime(0, 0, 0, $request->getUserVar('dateClearMonth'), $request->getUserVar('dateClearDay'), $request->getUserVar('dateClearYear'))); $journal =& $request->getJournal(); $metricsDao =& DAORegistry::getDAO('MetricsDAO'); /* @var $metricsDao MetricsDAO */ $metricsDao->purgeRecords(OJS_METRIC_TYPE_TIMED_VIEWS, $dateClear); $form->display(); } else { $form->initData(); $form->display(); } } } ?>