当前位置: 首页>>代码示例>>PHP>>正文


PHP Event::validate方法代码示例

本文整理汇总了PHP中Event::validate方法的典型用法代码示例。如果您正苦于以下问题:PHP Event::validate方法的具体用法?PHP Event::validate怎么用?PHP Event::validate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Event的用法示例。


在下文中一共展示了Event::validate方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: doValidate

 /**
  * This function performs the validation work for complex object models.
  *
  * In addition to checking the current object, all related objects will
  * also be validated.  If all pass then <code>true</code> is returned; otherwise
  * an aggreagated array of ValidationFailed objects will be returned.
  *
  * @param      array $columns Array of column names to validate.
  * @return     mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise.
  */
 protected function doValidate($columns = null)
 {
     if (!$this->alreadyInValidation) {
         $this->alreadyInValidation = true;
         $retval = null;
         $failureMap = array();
         // We call the validate method on the following object(s) if they
         // were passed to this object by their coresponding set
         // method.  This object relates to these object(s) by a
         // foreign key reference.
         if ($this->aEvent !== null) {
             if (!$this->aEvent->validate($columns)) {
                 $failureMap = array_merge($failureMap, $this->aEvent->getValidationFailures());
             }
         }
         if ($this->aWing !== null) {
             if (!$this->aWing->validate($columns)) {
                 $failureMap = array_merge($failureMap, $this->aWing->getValidationFailures());
             }
         }
         if (($retval = EventWingsPeer::doValidate($this, $columns)) !== true) {
             $failureMap = array_merge($failureMap, $retval);
         }
         $this->alreadyInValidation = false;
     }
     return !empty($failureMap) ? $failureMap : true;
 }
开发者ID:yasirgit,项目名称:afids,代码行数:37,代码来源:BaseEventWings.php

示例2: createOrUpdate

 protected function createOrUpdate(Event $model)
 {
     if (isset($_POST['Event'])) {
         $model->scenario = 'backend';
         $model->attributes = $_POST['Event'];
         $categories = EventCategory::model()->findAllByPk($_POST['Event']['categories']);
         $links = array();
         if (!$model->isNewRecord) {
             EventLink::model()->deleteAllByAttributes(array('eventId' => $model->id));
         }
         if (isset($_POST['EventLink'])) {
             foreach ($_POST['EventLink'] as $i => $info) {
                 $link = new EventLink();
                 $link->attributes = $info;
                 if (strlen($link->url) > 0) {
                     $links[] = $link;
                 }
             }
         }
         $model->categories = $categories;
         $model->links = $links;
         $model->validate();
         if ($model->save()) {
             if ($pictureSmall = CUploadedFile::getInstance($model, 'pictureSmall')) {
                 $model->pictureSmall = $pictureSmall;
             }
             if ($pictureBig = CUploadedFile::getInstance($model, 'pictureBig')) {
                 $model->pictureBig = $pictureBig;
             }
             $model->setTags($_POST['Event']['tagsString'])->save();
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
 }
开发者ID:niranjan2m,项目名称:Voyanga,代码行数:34,代码来源:EventController.php

示例3: actionCreate

 public function actionCreate()
 {
     $model = new Event();
     $model->setAttributes($this->getJsonInput());
     if (!$model->validate()) {
         $this->sendResponse(400, CHtml::errorSummary($model));
     } else {
         if (!$model->save(false)) {
             throw new CException('Cannot create a record');
         }
     }
     $model->refresh();
     $this->sendResponse(200, CJSON::encode($model));
 }
开发者ID:Bodya91,项目名称:yii-rest,代码行数:14,代码来源:EventController.php

示例4: create

 function create($aData)
 {
     if (!isset($aData['EVN_UID']) || $aData['EVN_UID'] == '') {
         $aData['EVN_UID'] = G::generateUniqueID();
     }
     $oConnection = Propel::getConnection(EventPeer::DATABASE_NAME);
     try {
         $oEvent = new Event();
         $oEvent->setEvnUid($aData['EVN_UID']);
         $oEvent->setProUid($aData['PRO_UID']);
         if (isset($aData['EVN_RELATED_TO'])) {
             $oEvent->setEvnRelatedTo($aData['EVN_RELATED_TO']);
             if ($aData['EVN_RELATED_TO'] == 'SINGLE') {
                 if (isset($aData['TAS_UID'])) {
                     $oEvent->setTasUid($aData['TAS_UID']);
                 }
                 $oEvent->setEvnTasUidTo('');
                 $oEvent->setEvnTasUidFrom('');
             } else {
                 $oEvent->setTasUid('');
                 if (isset($aData['EVN_TAS_UID_TO'])) {
                     $oEvent->setEvnTasUidTo($aData['EVN_TAS_UID_TO']);
                 }
                 if (isset($aData['EVN_TAS_UID_FROM'])) {
                     $oEvent->setEvnTasUidFrom($aData['EVN_TAS_UID_FROM']);
                 }
             }
         }
         if (isset($aData['EVN_POSX'])) {
             $oEvent->setEvnPosx($aData['EVN_POSX']);
         }
         if (isset($aData['EVN_POSY'])) {
             $oEvent->setEvnPosy($aData['EVN_POSY']);
         }
         if (isset($aData['EVN_TYPE'])) {
             $oEvent->setEvnType($aData['EVN_TYPE']);
         }
         if (isset($aData['EVN_TAS_ESTIMATED_DURATION'])) {
             $oEvent->setEvnTasEstimatedDuration($aData['EVN_TAS_ESTIMATED_DURATION']);
         }
         if (isset($aData['EVN_WHEN_OCCURS'])) {
             $oEvent->setEvnWhenOccurs($aData['EVN_WHEN_OCCURS']);
         }
         if (isset($aData['EVN_ACTION'])) {
             $oEvent->setEvnAction($aData['EVN_ACTION']);
         }
         if (isset($aData['EVN_CONDITIONS'])) {
             $oEvent->setEvnConditions($aData['EVN_CONDITIONS']);
         }
         if (isset($aData['EVN_STATUS'])) {
             $oEvent->setEvnStatus($aData['EVN_STATUS']);
         }
         if (isset($aData['EVN_WHEN'])) {
             $oEvent->setEvnWhen($aData['EVN_WHEN']);
         }
         $oEvent->setEvnMaxAttempts(3);
         //start the transaction
         $oConnection->begin();
         if (isset($aData['EVN_TYPE'])) {
             if ($aData['EVN_TYPE'] === 'bpmnEventEmptyEnd') {
                 unset($aData['TRI_UID']);
             }
         }
         if (isset($aData['TRI_UID'])) {
             $oTrigger = new Triggers();
             if (trim($aData['TRI_UID']) === "" || !$oTrigger->TriggerExists($aData['TRI_UID'])) {
                 //create an empty trigger
                 $aTrigger = array();
                 $aTrigger['PRO_UID'] = $aData['PRO_UID'];
                 $aTrigger['TRI_TITLE'] = 'For event: ' . $aData['EVN_DESCRIPTION'];
                 $aTrigger['TRI_DESCRIPTION'] = 'Autogenerated ' . $aTrigger['TRI_TITLE'];
                 $aTrigger['TRI_WEBBOT'] = '// ' . $aTrigger['TRI_DESCRIPTION'];
                 $oTrigger->create($aTrigger);
             } else {
                 $oTrigger = TriggersPeer::retrieveByPk($aData['TRI_UID']);
             }
             $oEvent->setTriUid($oTrigger->getTriUid());
             $parameters = new StdClass();
             $parameters->hash = md5($oTrigger->getTriWebbot());
             if (isset($aData['EVN_ACTION_PARAMETERS']->SUBJECT)) {
                 $parameters->SUBJECT = $aData['EVN_ACTION_PARAMETERS']->SUBJECT;
                 $parameters->TO = $aData['EVN_ACTION_PARAMETERS']->TO;
                 $parameters->CC = $aData['EVN_ACTION_PARAMETERS']->CC;
                 $parameters->BCC = $aData['EVN_ACTION_PARAMETERS']->BCC;
                 $parameters->TEMPLATE = $aData['EVN_ACTION_PARAMETERS']->TEMPLATE;
             }
             $oEvent->setEvnActionParameters(serialize($parameters));
         }
         if ($oEvent->validate()) {
             $iResult = $oEvent->save();
             if (isset($aData['EVN_DESCRIPTION'])) {
                 $oEvent->setEvnDescription($aData['EVN_DESCRIPTION']);
             }
             $oConnection->commit();
             return $aData['EVN_UID'];
         } else {
             $sMessage = '';
             $aValidationFailures = $oEvent->getValidationFailures();
             foreach ($aValidationFailures as $oValidationFailure) {
                 $sMessage .= $oValidationFailure->getMessage() . '<br />';
//.........这里部分代码省略.........
开发者ID:nshong,项目名称:processmaker,代码行数:101,代码来源:Event.php

示例5: actionIndex

 public function actionIndex()
 {
     $personForm = new PersonForm();
     $eventForm = new EventForm();
     $person = null;
     $event = null;
     $tplData = array('personForm' => $personForm, 'eventForm' => $eventForm);
     if (($personFormData = Yii::app()->getRequest()->getPost('PersonForm')) !== null) {
         $personForm->setAttributes($personFormData);
         //var_dump($personForm);
         if ($personForm->validate()) {
             $person = new Person();
             $person->setAttributes(array('name' => $personForm->name, 'gender' => $personForm->gender, 'date' => $personForm->date, 'time' => $personForm->getTime(), 'city_id' => $personForm->city_id));
             /*
                             if($person->validate())
                             {
                $calculator = new Calculator($person);
                // Запуск расчета
                $calculator->run();
                
                $this->calculator = $calculator;
                //var_dump($calculator->chart);
                //$tplData['calculator'] = $calculator; 
                             }
                             else
                             {
                $personForm->addErrors($person->getErrors());
                             }
             * 
             */
         }
     }
     if (($eventFormData = Yii::app()->getRequest()->getPost('EventForm')) !== null) {
         $eventForm->setAttributes($eventFormData);
         if ($eventForm->date != '' || $eventForm->city_id != '' || $eventForm->hour != '' || $eventForm->minute != '') {
             //var_dump($personForm);
             if ($eventForm->validate()) {
                 $event = new Event();
                 $event->setAttributes(array('date' => $eventForm->date, 'time' => $eventForm->getTime(), 'city_id' => $eventForm->city_id));
             }
         }
     }
     if ($person !== null) {
         $validateResult = $person->validate();
         $validateResult = $validateResult && ($event !== null ? $event->validate() : true);
     }
     if ($validateResult) {
         $calculator = new Calculator($person, $event);
         // Запуск расчета
         $calculator->run();
         $this->calculator = $calculator;
         //var_dump($calculator->chart);
         //$tplData['calculator'] = $calculator;
     } else {
         if ($person !== null) {
             $personForm->addErrors($person->getErrors());
         }
         if ($event !== null) {
             $eventForm->addErrors($event->getErrors());
         }
     }
     // Вывод в шаблон
     $this->render('index', $tplData);
 }
开发者ID:kuzmina-mariya,项目名称:happy-end,代码行数:64,代码来源:CalculatorController.php

示例6: actionValidate

 public function actionValidate()
 {
     $this->layout = "test";
     $e = new Event();
     $e->validate("eventFormRDF");
 }
开发者ID:acorbi,项目名称:pixelhumain,代码行数:6,代码来源:TestController.php

示例7: run

 /**
  * Запускаем отрисовку виджета
  *
  * @return void
  */
 public function run()
 {
     // Авторизован ли пользователь
     if (Yii::app()->user->isAuthenticated() === false) {
         return;
     }
     if (($user = Yii::app()->user->getProfile()) === null) {
         return;
     }
     // Загрузка таблицы для блока
     $table = Table::model()->with(array('descriptions'))->findByPK((int) $this->model_id);
     if ($table === null) {
         return;
     }
     // Устанавливаем источники данных
     $person = null;
     $event = null;
     $personForm = new PersonForm();
     $eventForm = new EventForm();
     $description = '';
     if ($table->source_destiny_table == Table::SOURCE_USER) {
         $person = new Person();
         $person->setAttributes(array('name' => $user->profile->name, 'gender' => $user->profile->gender, 'date' => $user->profile->birth_date, 'time' => $user->profile->birth_time, 'city_id' => $user->profile->city_id));
     } elseif ($table->source_destiny_table == Table::SOURCE_ADMIN) {
         $person = $table->person;
     } elseif ($table->source_destiny_table == Table::SOURCE_FROM_USER && ($personFormData = Yii::app()->getRequest()->getPost('PersonForm')) !== null) {
         $personForm->setAttributes($personFormData);
         if ($personForm->validate()) {
             $person = new Person();
             $person->setAttributes(array('name' => $personForm->name, 'gender' => $personForm->gender, 'date' => $personForm->date, 'time' => $personForm->getTime(), 'city_id' => $personForm->city_id));
         }
     }
     if ($table->source_event_table == Table::SOURCE_USER) {
         $event = new Event();
         $event->setAttributes(array('date' => date('Y-m-d'), 'time' => date('H:i'), 'city_id' => $user->profile->city_id));
     } elseif ($table->source_event_table == Table::SOURCE_ADMIN) {
         $event = $table->event;
     } elseif ($table->source_event_table == Table::SOURCE_FROM_USER && ($eventFormData = Yii::app()->getRequest()->getPost('EventForm')) !== null) {
         $eventForm->setAttributes($eventFormData);
         if ($eventForm->date != '' || $eventForm->city_id != '' || $eventForm->hour != '' || $eventForm->minute != '') {
             if ($eventForm->validate()) {
                 $event = new Event();
                 $event->setAttributes(array('date' => $eventForm->date, 'time' => $eventForm->getTime(), 'city_id' => $eventForm->city_id));
             }
         }
     }
     if ($person !== null) {
         $validateResult = $person->validate();
         $validateResult = $validateResult && ($event !== null ? $event->validate() : true);
     }
     if ($validateResult) {
         $calculator = new Calculator($person, $event);
         // Запуск расчета
         $calculator->run();
         if ($table->active_luck_pillar > 0) {
             $calculator->numCurrentLuckColumn = (int) $table->active_luck_pillar;
         }
         // Определяем описание
         $description = $table->description;
     } else {
         if ($person !== null) {
             $personForm->addErrors($person->getErrors());
         }
         if ($event !== null) {
             $eventForm->addErrors($event->getErrors());
         }
     }
     if (Yii::app()->request->isAjaxRequest) {
         $this->controller->renderPartial('//bazi/widgets/TableWidget/_chart', array('model' => $table, 'calculator' => $calculator, 'description' => $description), false, true);
     } else {
         $this->render($this->view, array('model' => $table, 'calculator' => $calculator, 'description' => $description, 'personForm' => $personForm, 'eventForm' => $eventForm));
     }
 }
开发者ID:kuzmina-mariya,项目名称:happy-end,代码行数:78,代码来源:TableWidget_1.php

示例8: htmlspecialchars

 }
 if (isset($_POST["max_attendance"])) {
     $max_attendance = htmlspecialchars($_POST["max_attendance"]);
 }
 // set up event object
 $event = new Event();
 $event->setTitle($title);
 $event->setDate($date);
 $event->setStartTime($start_time);
 $event->setEndTime($end_time);
 $event->setLocation($location);
 $event->setDescription($description);
 $event->setMaxAttendance($max_attendance);
 $event->setCreatorUserId($_SESSION['uid']);
 $failure_messages = array();
 if (!$event->validate()) {
     foreach ($event->getValidationFailures() as $failure) {
         $message = '<p><strong>Error in ' . $failure->getPropertyPath() . ' field!</strong> ' . $failure->getMessage() . '</p>';
         array_push($failure_messages, $message);
         // clear out the bad data
         $_POST[$failure->getPropertyPath()] = '';
     }
     unset($message);
 } else {
     // validate date fields
     //$now = new DateTime('now');
     $st = DateTime::createFromFormat("m/d/Y H:i A", $date . " " . $start_time);
     $et = DateTime::createFromFormat("m/d/Y H:i A", $date . " " . $end_time);
     /*
             if($now > $st) {
                 array_push($failure_messages, "<p><strong>Error:</strong> You cannot create an event that has already started</p>");
开发者ID:Web-Systems-Development-Team,项目名称:RPIwannahangout,代码行数:31,代码来源:create.php


注:本文中的Event::validate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。