當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CMS::time方法代碼示例

本文整理匯總了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);
     }
 }
開發者ID:buildshop,項目名稱:bs-common,代碼行數:8,代碼來源:BSAds.php

示例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;
     }
 }
開發者ID:buildshop,項目名稱:bs-common,代碼行數:36,代碼來源:BSAbstractDb.php

示例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;
 }
開發者ID:buildshop,項目名稱:bs-common,代碼行數:9,代碼來源:Comments.php

示例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;
 }
開發者ID:buildshop,項目名稱:bs-common,代碼行數:21,代碼來源:DefaultController.php


注:本文中的CMS::time方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。