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


PHP Time::validate方法代碼示例

本文整理匯總了PHP中Time::validate方法的典型用法代碼示例。如果您正苦於以下問題:PHP Time::validate方法的具體用法?PHP Time::validate怎麽用?PHP Time::validate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Time的用法示例。


在下文中一共展示了Time::validate方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testValidateNull

 /**
  * @covers Gacela\Field\Time::validate
  * @dataProvider providerNull
  */
 public function testValidateNull($meta, $value, $in)
 {
     $this->assertEquals(Time::NULL_CODE, $this->object->validate($meta, $value));
 }
開發者ID:energylab,項目名稱:gacela,代碼行數:8,代碼來源:TimeTest.php

示例2: testValidate14

 /**
  * Generated from @assert (NULL) === false.
  *
  * @covers pgn\tags\Time::validate
  */
 public function testValidate14()
 {
     $this->assertSame(false, $this->object->validate(NULL));
 }
開發者ID:Jadoube-Initiative,項目名稱:phpPGN,代碼行數:9,代碼來源:TimeTest.php

示例3: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'show' page.
  */
 public function actionCreate()
 {
     $model = new Time($this->action->id);
     if (isset($_POST['Time'])) {
         // collect user input data
         $model->attributes = $_POST['Time'];
         if (!isset($_POST['Time']['managerId'])) {
             // set manager based on the task
             if ($model->taskId >= 1) {
                 $criteria = new CDbCriteria();
                 $criteria->order = "`t`.`userPriority` ASC, `t`.`id` ASC";
                 if (($user2Task = User2Task::model()->findByAttributes(array('taskId' => $model->taskId, 'role' => User2Task::MANAGER), $criteria)) !== null) {
                     $model->managerId = $user2Task->userId;
                 } else {
                     $model->managerId = 0;
                 }
             } else {
                 $model->managerId = 0;
             }
         }
         if (!isset($_POST['Time']['consultantId'])) {
             // set consultant based on the task
             if ($model->taskId >= 1) {
                 $criteria = new CDbCriteria();
                 $criteria->order = "`t`.`userPriority` ASC, `t`.`id` ASC";
                 if (($user2Task = User2Task::model()->findByAttributes(array('taskId' => $model->taskId, 'role' => User2Task::CONSULTANT), $criteria)) !== null) {
                     $model->consultantId = $user2Task->userId;
                 } else {
                     $model->consultantId = 0;
                 }
             } else {
                 $model->consultantId = 0;
             }
         }
         // validate with the current action as scenario and save without validation
         if (($validated = $model->validate()) !== false && ($saved = $model->save(false)) !== false) {
             // set success message
             MUserFlash::setTopSuccess(Yii::t('hint', 'The new "{title}" time record has been successfully created.', array('{title}' => MHtml::wrapInTag($model->title, 'strong'))));
             // go to the 'show' page
             $this->redirect(array('show', 'id' => $model->id));
         }
     } else {
         // pre-assigned attributes (default values for a new record)
         if (Yii::app()->user->checkAccess(User::MANAGER) || Yii::app()->user->checkAccess(User::ADMINISTRATOR)) {
             $model->isConfirmed = Time::IS_CONFIRMED;
         }
         if (isset($_GET['taskId'])) {
             // task is known
             $model->taskId = $_GET['taskId'];
         }
     }
     $this->render($this->action->id, array('model' => $model));
 }
開發者ID:megabr,項目名稱:web3cms,代碼行數:57,代碼來源:TimeController.php


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