/** * Returns an instance of class * * @return OCSSITESTATS_BOL_Service */ public static function getInstance() { if (self::$classInstance === null) { self::$classInstance = new self(); } return self::$classInstance; }
public function __construct(BASE_CLASS_WidgetParameter $params) { parent::__construct(); $lang = OW::getLanguage(); $service = OCSSITESTATS_BOL_Service::getInstance(); $this->assign('data', $service->getStatistics()); $this->assign('zeroValues', OW::getConfig()->getValue('ocssitestats', 'zero_values')); }
public function __construct(BASE_CLASS_WidgetParameter $params) { parent::__construct(); if (!OW::getUser()->isAuthorized('ocssitestats', 'view_stats')) { $this->setVisible(false); return; } $service = OCSSITESTATS_BOL_Service::getInstance(); $this->assign('data', $service->getStatistics()); $this->assign('zeroValues', OW::getConfig()->getValue('ocssitestats', 'zero_values')); }
public function addUserlistData(BASE_CLASS_EventCollector $event) { $config = OW::getConfig(); $metricsConf = json_decode($config->getValue('ocssitestats', 'metrics'), true); $zeroValues = $config->getValue('ocssitestats', 'zero_values'); $service = OCSSITESTATS_BOL_Service::getInstance(); $count = $service->countNewUsersToday(); if (!empty($metricsConf['new_users_today']) && ($count || $zeroValues)) { $event->add(array('label' => OW::getLanguage()->text('ocssitestats', 'new_users_today'), 'url' => OW::getRouter()->urlForRoute('base_user_lists', array('list' => 'new-today')), 'iconClass' => 'ow_ic_user', 'key' => 'new-today', 'order' => 6, 'dataProvider' => array(OCSSITESTATS_BOL_Service::getInstance(), 'getNewTodayUserListData'))); } $count = $service->countNewUsersThisMonth(); if (!empty($metricsConf['new_users_this_month']) && ($count || $zeroValues)) { $event->add(array('label' => OW::getLanguage()->text('ocssitestats', 'new_users_this_month'), 'url' => OW::getRouter()->urlForRoute('base_user_lists', array('list' => 'new-this-month')), 'iconClass' => 'ow_ic_user', 'key' => 'new-this-month', 'order' => 7, 'dataProvider' => array($service, 'getNewThisMonthUserListData'))); } }