/** * Displays the admin page */ public function actionIndex() { $this->layout = '//layouts/column1'; $this->pageTitle = Yii::t('sourcebans', 'controllers.admin.index.title'); $this->breadcrumbs = array(Yii::t('sourcebans', 'controllers.admin.index.title')); $this->menu = array(array('label' => Yii::t('sourcebans', 'controllers.admin.admins.title'), 'url' => array('admin/admins'), 'itemOptions' => array('class' => 'admins'), 'visible' => Yii::app()->user->data->hasPermission('ADD_ADMINS', 'DELETE_ADMINS', 'EDIT_ADMINS', 'LIST_ADMINS')), array('label' => Yii::t('sourcebans', 'controllers.admin.bans.title'), 'url' => array('admin/bans'), 'itemOptions' => array('class' => 'bans'), 'visible' => Yii::app()->user->data->hasPermission('ADD_BANS', 'IMPORT_BANS', 'BAN_APPEALS', 'BAN_REPORTS')), array('label' => Yii::t('sourcebans', 'controllers.admin.groups.title'), 'url' => array('admin/groups'), 'itemOptions' => array('class' => 'groups'), 'visible' => Yii::app()->user->data->hasPermission('ADD_GROUPS', 'DELETE_GROUPS', 'EDIT_GROUPS', 'LIST_GROUPS')), array('label' => Yii::t('sourcebans', 'controllers.admin.servers.title'), 'url' => array('admin/servers'), 'itemOptions' => array('class' => 'servers'), 'visible' => Yii::app()->user->data->hasPermission('ADD_SERVERS', 'DELETE_SERVERS', 'EDIT_SERVERS', 'LIST_SERVERS')), array('label' => Yii::t('sourcebans', 'controllers.admin.games.title'), 'url' => array('admin/games'), 'itemOptions' => array('class' => 'games'), 'visible' => Yii::app()->user->data->hasPermission('ADD_GAMES', 'DELETE_GAMES', 'EDIT_GAMES', 'LIST_GAMES')), array('label' => Yii::t('sourcebans', 'controllers.admin.settings.title'), 'url' => array('admin/settings'), 'itemOptions' => array('class' => 'settings'), 'visible' => Yii::app()->user->data->hasPermission('SETTINGS'))); $demosize = Helpers::getDirectorySize(Yii::getPathOfAlias('webroot.demos')); $this->render('index', array('demosize' => Yii::app()->format->formatSize($demosize['size']), 'total_admins' => SBAdmin::model()->count(), 'total_archived_appeals' => SBAppeal::model()->countByAttributes(array('archived' => true)), 'total_archived_reports' => SBReport::model()->countByAttributes(array('archived' => true)), 'total_bans' => SBBan::model()->count(), 'total_blocks' => SBBlock::model()->count(), 'total_appeals' => SBAppeal::model()->countByAttributes(array('archived' => false)), 'total_servers' => SBServer::model()->count(), 'total_reports' => SBReport::model()->countByAttributes(array('archived' => false)))); }
/** * Displays the bans page */ public function actionBans() { $this->pageTitle = Yii::t('sourcebans', 'controllers.default.bans.title'); $this->breadcrumbs = array(Yii::t('sourcebans', 'controllers.default.bans.title')); $hideInactive = Yii::app()->request->getQuery('hideinactive', 'false') == 'true'; $search = Yii::app()->request->getQuery('q'); $ban = new SBBan(); $bans = new SBBan('search'); $bans->unsetAttributes(); // clear any default values if (isset($_GET['SBBan'])) { $bans->attributes = $_GET['SBBan']; } $comment = new SBComment(); $comment->object_type = SBComment::TYPE_BAN; $this->render('bans', array('ban' => $ban, 'bans' => $bans, 'comment' => $comment, 'hideInactive' => $hideInactive, 'search' => $search, 'total_bans' => SBBan::model()->count(array('scopes' => $hideInactive ? 'active' : null)))); }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer $id the ID of the model to be loaded * @return SBBan the loaded model * @throws CHttpException */ public function loadModel($id) { $model = SBBan::model()->with('admin')->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }