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


PHP Requirement::save方法代码示例

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


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

示例1: createRequirement

 /**
  * This method gets userId and array of data from user. 
  * Returns model if creation successful
  * Returns null if creation fails
  ** Data arrary should have the following Hash keys
  *  string $i_want_to
  *  string $description
  *  double $covered_area_from
  *  double $covered_area_to
  *  double $plot_area_from
  *  double $plot_area_to
  *  double $min_price
  *  double $max_price
  *
  * @param int $userId,array $data
  * @return model|false
  */
 public static function createRequirement($userId, $data)
 {
     $requirement = new Requirement();
     $requirement->attributes = $data;
     $requirement->user_id = $userId;
     $requirement->save();
     return $requirement;
 }
开发者ID:romeo14,项目名称:wallfeet,代码行数:25,代码来源:RequirementApi.php

示例2: testRequirementSuccess

 public function testRequirementSuccess()
 {
     $requirement = new Requirement();
     $requirement->protocol_id = 1;
     $requirement->family = "user";
     $requirement->parameter_id = 1;
     $this->assertTrue($requirement->save());
 }
开发者ID:philtweir,项目名称:glossia-scratch-test-site,代码行数:8,代码来源:RequirementTest.php

示例3: save_edit

 public function save_edit()
 {
     if (!isset($_SESSION['logged'])) {
         return call('pages', 'home');
     } else {
         if (!isset($_GET['code'])) {
             return call('pages', 'error', 2);
         }
         $post_data = $_POST;
         Requirement::save($post_data, $_GET['code']);
         return call('requirements', 'index');
     }
 }
开发者ID:ScalateKids,项目名称:Scalatetrack,代码行数:13,代码来源:requirements_controller.php

示例4: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Requirement();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Requirement'])) {
         $model->attributes = $_POST['Requirement'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:romeo14,项目名称:wallfeet,代码行数:17,代码来源:RequirementController.php

示例5: actionAjaxRequirementCreate

 public function actionAjaxRequirementCreate()
 {
     $city_id = Yii::app()->request->getPost('city_id');
     $district_id = Yii::app()->request->getPost('district_id');
     $investType_id = Yii::app()->request->getPost('investType_id');
     $propertyType_id = Yii::app()->request->getPost('propertyType_id');
     $total_price = Yii::app()->request->getPost('total_price');
     $house_area = Yii::app()->request->getPost('house_area');
     $land_area = Yii::app()->request->getPost('land_area');
     $bedroom_num = Yii::app()->request->getPost('bedroom_num');
     $construction_year = Yii::app()->request->getPost('construction_year');
     if (!empty($this->_account['userId'])) {
         $user = User::model()->findByPk($this->_account['userId']);
         $model = new Requirement();
         $model->city_id = $city_id;
         $model->district_id = $district_id;
         $model->investType_id = $investType_id;
         $model->propertyType_id = $propertyType_id;
         $model->total_price = $total_price;
         $model->house_area = $house_area;
         $model->land_area = $land_area;
         $model->bedroom_num = $bedroom_num;
         $model->construction_year = $construction_year;
         $model->phone = $user->phone;
         $model->email = $user->email;
         if ($model->save()) {
             $url = Yii::app()->createUrl('column/success');
             echo CJSON::encode(array('status' => 'success', 'url' => $url, 'msg' => '提交成功'));
         } else {
             echo CJSON::encode(array('status' => 'failed', 'url' => '', 'msg' => '提交失败,请稍候重试'));
         }
     } else {
         echo CJSON::encode(array('status' => 'failed', 'url' => '', 'msg' => '您还未登录,请先登录'));
     }
 }
开发者ID:zywh,项目名称:maplecity,代码行数:35,代码来源:ColumnController.php


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