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


PHP Publisher::validate方法代码示例

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


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

示例1: actionEdit

 /**
  * Edit a publisher.
  */
 public function actionEdit($id = 0)
 {
     if ($id > 0) {
         $model = Publisher::model()->findByPk($id);
     } else {
         $model = new Publisher();
     }
     if (isset($_POST['Publisher'])) {
         $model->attributes = $_POST['Publisher'];
         if ($model->validate() && $model->save()) {
             Yii::app()->user->setFlash('successmsg', 'The changes have been saved.');
             $this->redirect('/publisher/index');
         } else {
             Yii::app()->user->setFlash('errormsg', 'Error saving the publisher page.');
             $this->render('edit', array('model' => $model, 'id' => $id));
         }
     } else {
         $this->render('edit', array('model' => $model, 'id' => $id));
     }
 }
开发者ID:sundgaarden,项目名称:dashboard,代码行数:23,代码来源:PublisherController.php

示例2: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Publisher();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Publisher'])) {
         $model->attributes = $_POST['Publisher'];
         if ($model->validate()) {
             if ($model->save()) {
                 Yii::app()->clientScript->scriptMap['jquery.js'] = false;
                 echo CJSON::encode(array('status' => 'success', 'div' => "<div class=alert alert-info fade in>Successfully added ! </div>"));
                 Yii::app()->end();
             }
         }
     }
     if (Yii::app()->request->isAjaxRequest) {
         $cs = Yii::app()->clientScript;
         $cs->scriptMap = array('jquery.js' => false, 'bootstrap.js' => false, 'jquery.min.js' => false, 'bootstrap.notify.js' => false, 'bootstrap.bootbox.min.js' => false);
         echo CJSON::encode(array('status' => 'render', 'div' => $this->renderPartial('_form', array('model' => $model), true, false)));
         Yii::app()->end();
     } else {
         $this->render('create', array('model' => $model));
     }
 }
开发者ID:noonnightcoder,项目名称:bakou-pos-apsara,代码行数:28,代码来源:PublisherController.php


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