本文整理汇总了PHP中CMS::time方法的典型用法代码示例。如果您正苦于以下问题:PHP CMS::time方法的具体用法?PHP CMS::time怎么用?PHP CMS::time使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMS
的用法示例。
在下文中一共展示了CMS::time方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: afterFind
public function afterFind()
{
parent::afterFind();
if (CMS::time() >= strtotime($this->date_end)) {
$this->switch = 0;
$this->save(false);
}
}
示例2: beforeSave
protected function beforeSave()
{
if (parent::beforeSave()) {
//create
if ($this->isNewRecord) {
if (isset($this->tableSchema->columns['ip_create'])) {
//Текущий IP адресс, автора добавление
$this->ip_create = Yii::app()->request->userHostAddress;
}
if (isset($this->tableSchema->columns['user_id'])) {
$this->user_id = Yii::app()->user->isGuest ? 0 : Yii::app()->user->id;
}
if (isset($this->tableSchema->columns['user_agent'])) {
$this->user_agent = Yii::app()->request->userAgent;
}
if (isset($this->tableSchema->columns['date_create'])) {
// $this->date_create = date('Y-m-d H:i:s');
$this->date_create = date('Y-m-d H:i:s', CMS::time());
}
if (isset($this->tableSchema->columns['ordern'])) {
if (!isset($this->ordern)) {
$row = $this->model()->find(array('select' => 'max(ordern) AS maxOrdern'));
$this->ordern = $row['maxOrdern'] + 1;
}
}
} else {
//update
if (isset($this->tableSchema->columns['date_update'])) {
$this->date_update = date('Y-m-d H:i:s');
}
}
return true;
} else {
return false;
}
}
示例3: controlTimeout
/**
* Определяет таймаут управление комментарием
* @return bool
*/
public function controlTimeout()
{
$stime = strtotime($this->date_create) + Yii::app()->settings->get('comments', 'control_timeout');
return CMS::time() < $stime || Yii::app()->user->isSuperuser ? true : false;
}
示例4: actionCreate
public function actionCreate()
{
$owner_title = $_POST['owner_title'];
$modelName = $_POST['model'];
$objID = $_POST['object_id'];
$comment = new Comments();
$request = Yii::app()->request;
if ($request->isPostRequest && $request->isAjaxRequest) {
$comment->attributes = $request->getPost('Comments');
$comment->model = $modelName;
$comment->owner_title = $owner_title;
$comment->object_id = $objID;
if ($comment->validate()) {
$comment->saveNode();
echo CJSON::encode(array('success' => true, 'message' => 'Комментарий будет опубликован после проверки'));
Yii::app()->end();
Yii::app()->session['caf'] = CMS::time();
}
}
return $comment;
}