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


PHP Documents::validate方法代码示例

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


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

示例1: actionDelZnoSubject

 public function actionDelZnoSubject($num)
 {
     $model = new Documents('ZNO');
     $subjects = array();
     $valid = true;
     if (isset($_GET["Documents"])) {
         $model->attributes = $_GET["Documents"];
         $model->validate();
     }
     if (isset($_GET["Documentsubject"])) {
         unset($_GET["Documentsubject"][$num]);
         foreach ($_GET["Documentsubject"] as $i => $obj) {
             $item = new Documentsubject();
             $item->attributes = $obj;
             if ($i == $num) {
                 $item->deleted = 1;
             }
             if ($item->deleted == 0) {
                 $valid = $item->validate() && $valid;
             }
             $subjects[] = $item;
         }
     }
     $this->renderPartial('_form', array('model' => $model, 'subjects' => $subjects));
 }
开发者ID:upmunspel,项目名称:abiturient,代码行数:25,代码来源:DocumentsController.php

示例2: actionAppendBenefit

 public function actionAppendBenefit()
 {
     $model = new PersonBenefits();
     $documents = array();
     $valid = true;
     if (isset($_GET["PersonBenefits"])) {
         $model->attributes = $_GET["PersonBenefits"];
         if (isset($_GET["Documents"])) {
             foreach ($_GET["Documents"] as $i => $obj) {
                 $item = new Documents();
                 $item->attributes = $obj;
                 $valid = $valid && $item->validate();
                 $documents[] = $item;
             }
         }
     }
     if (!$valid) {
         echo CJSON::encode(array("result" => "suceess", "data" => $this->renderPartial('_form', array('model' => $model, 'documents' => $documents), true)));
     } else {
         /* save all new records */
         $flag = $transaction = Yii::app()->db->getCurrentTransaction();
         if ($transaction === null) {
             $transaction = Yii::app()->db->beginTransaction();
         }
         try {
             if ($model->save()) {
                 foreach ($documents as $doc) {
                     $doc->PersonID = $model->PersonID;
                     if ($doc->save()) {
                         if (empty($doc->idDocuments)) {
                             throw new Exception("idDocuments is empty!");
                         }
                         $rel = new PersonBenefitDocument();
                         $rel->DocumentID = $doc->getPrimaryKey();
                         $rel->PersonBenefitID = $model->idPersonBenefits;
                         $rel->save();
                     }
                 }
             }
             $transaction->commit();
             $person = Person::model()->findByPk($model->PersonID);
             echo CJSON::encode(array("result" => "success", "data" => $this->renderPartial("_benefits", array('models' => $person->benefits, 'personid' => $model->PersonID), true)));
         } catch (Exception $e) {
             if ($flag !== null) {
                 $transaction->rollback();
             }
             echo CJSON::encode(array("result" => "suceess", "data" => $e->getMessage()));
         }
     }
 }
开发者ID:upmunspel,项目名称:abiturient,代码行数:50,代码来源:PersonbenefitsController_old.php


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