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


PHP Documents::loadAndSave方法代碼示例

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


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

示例1: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $this->layout = '//layouts/column2_noblock';
     $model = new Person();
     $model->Birthday = date("d.m.Y", mktime(0, 0, 0, 1, 1, date('Y') - 18));
     $searchRes = array();
     // Обработка формы поиска
     if (isset($_POST['search'])) {
         $findRes = 0;
         //$this->FindLocalPersonByDoc($_POST['search']['attestatSeries'],$_POST['search']['attestatNumber']);
         try {
             if ($findRes == 0) {
                 $fio = trim($_POST['search']['fio']);
                 if (empty($fio)) {
                     $res = WebServices::findPerson($_POST['search']['series'], $_POST['search']['number']);
                 } else {
                     $res = WebServices::findPersonByFio($_POST['search']['fio']);
                 }
                 $searchRes = Person::JsonDataAsArray($res);
                 Yii::app()->session['searchRes'] = $searchRes;
             } else {
                 Yii::app()->user->setFlash("message", "Персона вже існує в системі з кодом {$findRes}");
                 $this->redirect(Yii::app()->createUrl("person/update", array("id" => $findRes)));
             }
         } catch (Exception $e) {
             Yii::app()->user->setFlash("message", $e->getMessage());
         }
     }
     // Обработка пролистывания найденных персон
     if (isset($_GET['page'])) {
         $searchRes = Yii::app()->session['searchRes'];
     }
     // Загрузка данный из ЕДЕБО по коду персоны
     if (isset($_GET['personCodeU'])) {
         try {
             if ($model->loadByUCode($_GET['personCodeU'])) {
                 try {
                     $response = WebServices::findPersonDocumentsByCodeU($_GET['personCodeU']);
                     Yii::app()->session[$_GET['personCodeU'] . "-tmp_documents"] = $response;
                     $searchRes = $model->loadDocumentsFromJSON($response);
                     $response = WebServices::findPersonContactsByCodeU($_GET['personCodeU']);
                     $searchRes = $model->loadContactsFromJSON($response);
                 } catch (Exception $e) {
                     Yii::app()->user->setFlash("message", $e->getMessage());
                 }
             }
         } catch (Exception $e) {
             Yii::app()->user->setFlash("message", $e->getMessage());
         }
     }
     if (isset($_POST['Person'])) {
         $model->attributes = $_POST['Person'];
         if (isset($_POST['Documents']['persondoc'])) {
             $model->persondoc->attributes = $_POST['Documents']['persondoc'];
             //$model->validate();
         }
         if (!empty($model->codeU)) {
             if (isset(Yii::app()->session[$model->codeU . "-tmp_documents"])) {
                 $model->loadDocumentsFromJSON(Yii::app()->session[$model->codeU . "-tmp_documents"]);
             }
         }
         if (isset($_POST['Documents']['entrantdoc'])) {
             $model->entrantdoc->attributes = $_POST['Documents']['entrantdoc'];
         }
         if (isset($_POST['PersonContacts']['homephone'])) {
             $model->homephone->attributes = $_POST['PersonContacts']['homephone'];
         }
         if (isset($_POST['PersonContacts']['mobphone'])) {
             $model->mobphone->attributes = $_POST['PersonContacts']['mobphone'];
         }
         $entrant_valid = true;
         $showPersonEntrantDocForm = Yii::app()->user->checkAccess("showPersonEntrantDocForm");
         if ($showPersonEntrantDocForm && isset($_POST['Documents']['entrantdoc'])) {
             $entrant_valid = $model->entrantdoc->validate("ENTRANT");
         }
         $asEDBOReqOperator = Yii::app()->user->checkAccess("asEDBOReqOperator");
         // Обробка для електронных заяв
         if ($asEDBOReqOperator) {
             $model->scenario = "EDBOREQ";
             if ($model->LanguageID == 0) {
                 $model->LanguageID = 2;
             }
             if ($model->homephone->validate() && $model->mobphone->validate() && $model->save()) {
                 $model->homephone->PersonID = $model->idPerson;
                 $model->mobphone->PersonID = $model->idPerson;
                 $model->homephone->save();
                 $model->mobphone->save();
                 if (isset(Yii::app()->session[$model->codeU . "-documents"])) {
                     Documents::loadAndSave($model->idPerson, unserialize(Yii::app()->session[$model->codeU . "-documents"]));
                 }
                 $this->redirect(array('view', 'id' => $model->idPerson));
             }
         } else {
             // Обробка обычной заявки
             if (!empty($model->persondoc->edboID) && $model->persondoc->TypeID == 1) {
                 $model->persondoc->scenario = "FULLINPUT";
//.........這裏部分代碼省略.........
開發者ID:upmunspel,項目名稱:abiturient,代碼行數:101,代碼來源:PersonController.php


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