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


PHP Criteria::save方法代码示例

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


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

示例1: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     try {
         $model = new Criteria();
         // Uncomment the following line if AJAX validation is needed
         // $this->performAjaxValidation($model);
         if (isset($_POST['Criteria'])) {
             $model->attributes = $_POST['Criteria'];
             if ($model->save()) {
                 Yii::app()->user->setFlash(TbHtml::ALERT_COLOR_SUCCESS, '<strong>Well!</strong> Criteria created with sucess!');
                 Yii::app()->controller->refresh();
             }
         }
     } catch (Exception $e) {
         Yii::app()->user->setFlash(TbHtml::ALERT_COLOR_ERROR, '<strong>Ops!</strong> ERROR!');
         Yii::app()->controller->refresh();
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:raphaelrocha,项目名称:mtcontrool_mtcontext,代码行数:23,代码来源:CriteriaController.php

示例2: actionAddCriteria

 /**
  * Add notification criteria.
  *
  * This method is called by a form on the "Manage Notification Criteria" page
  * and is used to create a new criteria for generation notifications.
  */
 public function actionAddCriteria()
 {
     $criteria = new Criteria();
     $users = User::getNames();
     $dataProvider = new CActiveDataProvider('Criteria');
     unset($users['']);
     unset($users['Anyone']);
     $criteria->users = Yii::app()->user->getName();
     if (isset($_POST['Criteria'])) {
         $criteria->attributes = $_POST['Criteria'];
         $str = "";
         $arr = $criteria->users;
         if ($criteria->type == 'assignment' && count($arr) > 1) {
             $this->redirect('addCriteria');
         }
         if (isset($arr)) {
             $str = implode(', ', $arr);
         }
         $criteria->users = $str;
         if ($criteria->modelType != null && $criteria->comparisonOperator != null) {
             if ($criteria->save()) {
             }
             $this->refresh();
         }
     }
     $this->render('addCriteria', array('users' => $users, 'model' => $criteria, 'dataProvider' => $dataProvider));
 }
开发者ID:xl602,项目名称:X2CRM,代码行数:33,代码来源:AdminController.php

示例3: actionAddCriteria

 public function actionAddCriteria()
 {
     $criteria = new Criteria();
     $users = User::getNames();
     $dataProvider = new CActiveDataProvider('Criteria');
     unset($users['']);
     if (isset($_POST['Criteria'])) {
         $criteria->attributes = $_POST['Criteria'];
         $str = "";
         $arr = $criteria->users;
         if ($criteria->type == 'assignment' && count($arr) > 1) {
             $this->redirect('addCriteria');
         }
         if (isset($arr)) {
             foreach ($arr as $user) {
                 $str .= $user . ", ";
             }
             $str = substr($str, 0, -2);
         }
         $criteria->users = $str;
         if ($criteria->modelType != null && $criteria->comparisonOperator != null) {
             if ($criteria->save()) {
             }
             $this->redirect('index');
         }
     }
     $this->render('addCriteria', array('users' => $users, 'model' => $criteria, 'dataProvider' => $dataProvider));
 }
开发者ID:netconstructor,项目名称:X2Engine,代码行数:28,代码来源:AdminController.php


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