当前位置: 首页>>代码示例>>PHP>>正文


PHP History::model方法代码示例

本文整理汇总了PHP中History::model方法的典型用法代码示例。如果您正苦于以下问题:PHP History::model方法的具体用法?PHP History::model怎么用?PHP History::model使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在History的用法示例。


在下文中一共展示了History::model方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionIndex

 /**
  * Главная страница админцентра
  * @throws CHttpException
  */
 public function actionIndex()
 {
     // Если гость, выдаем эксепшн
     if (Yii::app()->user->isGuest) {
         throw new CHttpException(403, 'У Вас недостаточно прав');
     }
     // Только главный админ имеет право входить в аминцентр
     if (Yii::app()->user->id != '1') {
         throw new CHttpException(403, 'У Вас недостаточно прав');
     }
     $this->render('index', array('sysinfo' => array('bancount' => History::model()->cache(300)->count(), 'activebans' => Bans::model()->cache(300)->count(), 'filescount' => Files::model()->cache(300)->count(), 'commentscount' => Comments::model()->cache(300)->count())));
 }
开发者ID:DmitriyS,项目名称:CS-Bans,代码行数:16,代码来源:AdminController.php

示例2: loadHistory

 /**
  * 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 the primary key value. Defaults to null, meaning using the 'id' GET variable
  */
 public function loadHistory($id = null)
 {
     if ($this->_model === null) {
         if ($id !== null || isset($_GET['id'])) {
             $this->_model = History::model()->findbyPk($id !== null ? $id : $_GET['id']);
         }
         if ($this->_model === null) {
             throw new CHttpException(404, 'The requested page does not exist.');
         }
     }
     return $this->_model;
 }
开发者ID:smoothcoder,项目名称:DISCARDEDYiiblog,代码行数:17,代码来源:HistoryController.php

示例3: actionIndex

 /**
  * Вывод всех банов
  */
 public function actionIndex()
 {
     if (Yii::app()->request->isAjaxRequest && isset($_POST['server'])) {
         if ($_POST['server'] == 0) {
             Yii::app()->end('$("#Bans_admin_nick").html("<option value=\\"0\\">Не выбрано</option>");');
         }
         $amxadmins = Amxadmins::model()->with('servers')->findAll('`address` = :addr', array(':addr' => $_POST['server']));
         $js = "<option>Любой админ</option>";
         foreach ($amxadmins as $admin) {
             $js .= "<option value=\"{$admin->steamid}\">{$admin->nickname}</option>";
         }
         Yii::app()->end("\$('#Bans_admin_nick').html('{$js}')");
     }
     $model = new Bans('search');
     $model->unsetAttributes();
     if (isset($_GET['Bans'])) {
         $model->attributes = $_GET['Bans'];
     }
     $select = "(ban_created+(ban_length*60)) < UNIX_TIMESTAMP() OR ban_length = 0";
     $dataProvider = new CActiveDataProvider('History', array('criteria' => array('condition' => Yii::app()->config->auto_prune ? $select : null, 'order' => '`ban_created` DESC'), 'pagination' => array('pageSize' => Yii::app()->config->bans_per_page)));
     // Проверяем IP посетителя, есть ли он в активных банах
     $check = History::model()->count("`player_ip` = :ip AND " . $select, array(':ip' => Prefs::getRealIp()));
     $this->render('index', array('dataProvider' => $dataProvider, 'model' => $model, 'check' => $check > 0 ? true : false));
 }
开发者ID:DmitriyS,项目名称:CS-Bans,代码行数:27,代码来源:HistoryController.php

示例4: loadModel

 /**
  * 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 History the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = History::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
开发者ID:thongnv90,项目名称:bluesms,代码行数:15,代码来源:HistoryController.php


注:本文中的History::model方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。