本文整理汇总了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";
//.........这里部分代码省略.........