当前位置: 首页>>代码示例>>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;未经允许,请勿转载。