本文整理汇总了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));
}
示例2: testValidate14
/**
* Generated from @assert (NULL) === false.
*
* @covers pgn\tags\Time::validate
*/
public function testValidate14()
{
$this->assertSame(false, $this->object->validate(NULL));
}
示例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));
}