protected function HTMLViewUsers() { global $wgTitle, $wgOut, $wgRequest, $wgExtensionsPath, $wgJsMimeType; $oTmpl = new EasyTemplate(dirname(__FILE__) . "/templates/"); $sMsg = ''; if ($wgRequest->getVal('action') == 'save') { $oUser = new SponsorshipDashboardUser(); $oUser->fillFromRequest(); $bSuccess = $oUser->save(); $sMsg = $bSuccess ? '' : wfMsg('sponsorship-dashboard-users-error', $oUser->name); } $wgOut->addScript("<script type=\"{$wgJsMimeType}\" src=\"{$wgExtensionsPath}/wikia/SponsorshipDashboard/js/SponsorshipDashboardList.js\" ></script>\n"); $wgOut->addStyle(AssetsManager::getInstance()->getSassCommonURL('/extensions/wikia/SponsorshipDashboard/css/SponsorshipDashboardList.scss')); $this->HTMLAdminHeader('ViewUsers'); $aUsers = new SponsorshipDashboardUsers(); $oTmpl->set_vars(array("data" => $aUsers->getData(), "path" => $wgTitle->getFullURL(), "errorMsg" => $sMsg)); $wgOut->addHTML($oTmpl->render('admin/viewUsers')); return false; }
protected function getTabs($tabName) { if ($this->isAllowed()) { return $this->getTabsForStaff($tabName); } $wgUser = F::app()->getGlobal('wgUser'); if ($wgUser->isAnon()) { return false; } $SDUser = SponsorshipDashboardUser::newFromUserId($wgUser->getId()); if (empty($SDUser)) { return false; } $SDUser->loadUserParams(); $SDGroups = F::build('SponsorshipDashboardGroups'); $SDUserGroups = $SDGroups->getUserData($SDUser->id); $this->currentGroups = $SDUserGroups; $exploded = explode('/', $tabName); $catId = $exploded[0]; if (isset($exploded[1])) { $repId = $exploded[1]; } else { $repId = 0; } if (empty($catId)) { $catKeys = array_keys($this->currentGroups); if (!isset($catKeys[0])) { return false; } $catId = $catKeys[0]; $repId = 0; } else { if (!in_array($catId, array_keys($this->currentGroups))) { return false; } } $currentGroup = $this->currentGroups[$catId]; if (empty($repId)) { $aKeys = array_keys($currentGroup->reports); if (!isset($aKeys[0])) { return false; } $repId = $aKeys[0]; } if (!isset($currentGroup->reports[$repId])) { return false; } $this->currentReports = $currentGroup->reports; $this->currentGroup = $catId; $this->currentReport = $currentGroup->reports[$repId]; return true; }