本文整理汇总了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())));
}
示例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;
}
示例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));
}
示例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;
}