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


PHP Country::save方法代码示例

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


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

示例1: createCountry

 public function createCountry($name)
 {
     $tmp = new Country();
     $tmp->name = $name;
     $tmp->save();
     return $tmp;
 }
开发者ID:kaakshay,项目名称:audience-insight-repository,代码行数:7,代码来源:486TestCase.php

示例2: postCountry

 public function postCountry()
 {
     $posted = Input::get();
     $country = new Country();
     $country->country_name = $posted['country_name'];
     $country->category_id = $posted['category_id'];
     $country->category_name = $posted['category_name'];
     $country->save();
     return Redirect::back()->with('success', 'Country has been created');
 }
开发者ID:bernardowiredu,项目名称:unlocking-site,代码行数:10,代码来源:CountryController.php

示例3: newcountry

 function newcountry($data)
 {
     if ($data['name']) {
         $newcountry = new Country();
         $newcountry->name = sqlite_escape_string($data['name']);
         $newcountry->save();
         return true;
     } else {
         return false;
     }
 }
开发者ID:stas,项目名称:bebuntu,代码行数:11,代码来源:countries-controller.php

示例4: actionCreate

 public function actionCreate()
 {
     $model = new Country();
     if (isset($_POST['Country'])) {
         $model->attributes = $_POST['Country'];
         if ($model->validate() && $model->save()) {
             $this->redirect(array('index'));
         }
     }
     $statusOptions = array(0 => Yii::t('common', 'Disabled'), 1 => Yii::t('common', 'Enabled'));
     $yesNoOptions = array(0 => Yii::t('common', 'No'), 1 => Yii::t('common', 'Yes'));
     $this->render('create', array('model' => $model, 'statusOptions' => $statusOptions, 'yesNoOptions' => $yesNoOptions));
 }
开发者ID:damnpoet,项目名称:yiicart,代码行数:13,代码来源:CountriesController.php

示例5: actionCreate

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

示例6: add_check

 /**
  * Add Country check
  */
 public function add_check()
 {
     $validator = Validator::make(Input::all(), Country::$rulesAdd);
     if (!$validator->fails()) {
         $country = new Country(Input::all());
         if ($country->save()) {
             return Redirect::route('country_list', $country->id)->with('mSuccess', 'Le pays a bien été modifié');
         } else {
             return Redirect::route('country_add')->with('mError', 'Impossible de créer ce pays')->withInput();
         }
     } else {
         return Redirect::route('country_add')->with('mError', 'Il y a des erreurs')->withErrors($validator->messages())->withInput();
     }
 }
开发者ID:urashima82,项目名称:intranet,代码行数:17,代码来源:CountryController.php

示例7: postCountryCreate

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function postCountryCreate()
 {
     // Declare the rules for the form validation
     $rules = array('country' => 'required');
     // Validate the inputs
     $validator = Validator::make(Input::all(), $rules);
     // Check if the form validates with success
     if ($validator->passes()) {
         // Get the inputs, with some exceptions
         $inputs = Input::except('csrf_token');
         $this->country->country = $inputs['country'];
         $this->country->save();
         // Was the role created?
         if ($this->country->id) {
             // Redirect to the new role page
             return Redirect::to('admin/countries/' . $this->country->id . '/edit')->with('success', Lang::get('admin/countries/messages.create.success'));
         }
         // Redirect to the new country page
         return Redirect::to('admin/countries/create')->with('error', Lang::get('admin/countries/messages.create.error'));
     }
     // Form validation failed
     return Redirect::to('admin/countries/create')->withInput()->withErrors($validator);
 }
开发者ID:EricBui0512,项目名称:FYP,代码行数:28,代码来源:AdminCommonController.php

示例8: check

 public static function check($_cpt, $_shrt)
 {
     $country = Country::model()->find('short=:shrt', array(':shrt' => $_shrt));
     if ($country !== null) {
         return $country->getPrimaryKey();
     }
     $country = new Country();
     $country->attributes = array('caption' => $_cpt, 'short' => $_shrt);
     if ($country->save()) {
         return $country->getPrimaryKey();
     }
     return 1;
     //false;
 }
开发者ID:righ22,项目名称:Xata,代码行数:14,代码来源:Country.php

示例9: doSave

 /**
  * Performs the work of inserting or updating the row in the database.
  *
  * If the object is new, it inserts it; otherwise an update is performed.
  * All related objects are also updated in this method.
  *
  * @param      ConnectionInterface $con
  * @return int             The number of rows affected by this insert/update and any referring fk objects' save() operations.
  * @throws PropelException
  * @see save()
  */
 protected function doSave(ConnectionInterface $con)
 {
     $affectedRows = 0;
     // initialize var to track total num of affected rows
     if (!$this->alreadyInSave) {
         $this->alreadyInSave = true;
         // We call the save method on the following object(s) if they
         // were passed to this object by their corresponding set
         // method.  This object relates to these object(s) by a
         // foreign key reference.
         if ($this->aCountry !== null) {
             if ($this->aCountry->isModified() || $this->aCountry->isNew()) {
                 $affectedRows += $this->aCountry->save($con);
             }
             $this->setCountry($this->aCountry);
         }
         if ($this->aCurrency !== null) {
             if ($this->aCurrency->isModified() || $this->aCurrency->isNew()) {
                 $affectedRows += $this->aCurrency->save($con);
             }
             $this->setCurrency($this->aCurrency);
         }
         if ($this->isNew() || $this->isModified()) {
             // persist changes
             if ($this->isNew()) {
                 $this->doInsert($con);
             } else {
                 $this->doUpdate($con);
             }
             $affectedRows += 1;
             $this->resetModified();
         }
         if ($this->googleshoppingProductSynchronisationsScheduledForDeletion !== null) {
             if (!$this->googleshoppingProductSynchronisationsScheduledForDeletion->isEmpty()) {
                 \GoogleShopping\Model\GoogleshoppingProductSynchronisationQuery::create()->filterByPrimaryKeys($this->googleshoppingProductSynchronisationsScheduledForDeletion->getPrimaryKeys(false))->delete($con);
                 $this->googleshoppingProductSynchronisationsScheduledForDeletion = null;
             }
         }
         if ($this->collGoogleshoppingProductSynchronisations !== null) {
             foreach ($this->collGoogleshoppingProductSynchronisations as $referrerFK) {
                 if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         $this->alreadyInSave = false;
     }
     return $affectedRows;
 }
开发者ID:Mertiozys,项目名称:GoogleShopping,代码行数:60,代码来源:GoogleshoppingAccount.php

示例10: actionCreateOrg

 public function actionCreateOrg()
 {
     $org = Organization::model()->count();
     if ($org == 0) {
         $this->layout = 'installation_layout';
         $model = new Organization();
         $user = new User();
         $auth_assign = new AuthAssignment();
         // Uncomment the following line if AJAX validation is needed
         $this->performAjaxValidation($model);
         if (isset($_POST['Organization']['organization_name']) && !empty($_POST['Organization']['phone']) && !empty($_POST['Organization']['email'])) {
             $country_model = new Country();
             $country_model->name = $_POST['Organization']['country'];
             $country_model->save();
             $state_model = new State();
             $state_model->state_name = $_POST['Organization']['state'];
             $state_model->country_id = $country_model->id;
             $state_model->save();
             $city_model = new City();
             $city_model->city_name = $_POST['Organization']['city'];
             $city_model->country_id = $country_model->id;
             $city_model->state_id = $state_model->state_id;
             $city_model->save();
             $model->attributes = $_POST['Organization'];
             $model->organization_created_by = 1;
             $model->organization_creation_date = new CDbExpression('NOW()');
             $model->city = $city_model->city_id;
             $model->state = $state_model->state_id;
             $model->country = $country_model->id;
             if ($model->save(false)) {
                 $user->user_organization_email_id = $model->email;
                 $user->user_password = md5($model->email . $model->email);
                 $user->user_type = 'admin';
                 $user->user_created_by = 1;
                 $user->user_creation_date = new CDbExpression('NOW()');
                 $user->user_organization_id = $model->organization_id;
                 $user->save();
                 $auth_assign->itemname = 'SuperAdmin';
                 $auth_assign->userid = $user->user_id;
                 $auth_assign->save(false);
                 $this->redirect(array('redirectLogin'));
             }
         }
         $this->render('create_org', array('model' => $model));
     } else {
         Yii::app()->user->logout();
         $this->redirect(array('login'));
     }
 }
开发者ID:sharmarakesh,项目名称:EduSec2.0.0,代码行数:49,代码来源:SiteController.php

示例11: actionCreate

 public function actionCreate()
 {
     $model = new Country();
     if (isset($_POST['Country'])) {
         $model->setAttributes($_POST['Country']);
         if ($model->save()) {
             if (Yii::app()->getRequest()->getIsAjaxRequest()) {
                 Yii::app()->end();
             } else {
                 $this->redirect(array('view', 'id' => $model->country_id));
             }
         }
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:schmunk42,项目名称:yii-sakila-crud,代码行数:15,代码来源:CountryController.php

示例12: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Country();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Country'])) {
         $model->attributes = $_POST['Country'];
         $model->created_on = date('Y-m-d');
         $model->created_by = Yii::app()->user->id;
         if ($model->save()) {
             Yii::app()->user->setFlash('success', 'Saved successfully');
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:optimosolution,项目名称:jasorbd,代码行数:20,代码来源:CountryController.php

示例13: agregar

 public function agregar()
 {
     $data = array();
     if ($_POST) {
         $pais = new Country(elements(array('pais'), $_POST));
         if ($pais->is_valid()) {
             $pais->save();
             $this->session->set_flashdata('msg', '<div class="success">El pais se guardó correctamente.</div>');
             redirect('paises');
         } else {
             $data['errors'] = $pais->errors;
         }
     }
     $data['titulo'] = "Agregar pais";
     $data['action'] = "paises/agregar";
     $this->template->write_view('content', 'paises/agregar', $data);
     $this->template->render();
 }
开发者ID:ricardocasares,项目名称:Cobros,代码行数:18,代码来源:paises.php

示例14: save

 public function save($id = null)
 {
     if ($this->perm->can_create == 'y') {
         if ($_POST) {
             $save = new Country();
             if ($_POST['id'] == '') {
                 $_POST['created_by'] = $this->user->id;
             } else {
                 $_POST['updated_by'] = $this->user->id;
             }
             $save->from_array($_POST);
             $save->save();
             $action = $_POST['id'] > 0 ? 'UPDATE' : 'CREATE';
             save_logs($this->menu_id, $action, $save->id, $action . ' ' . $save->country_name . ' Country');
         }
     }
     redirect("admin/" . $this->modules_name);
 }
开发者ID:ultraauchz,项目名称:asean_cultural_mapping,代码行数:18,代码来源:countries.php

示例15: actionCreate

 /**
  * Add a new country
  */
 public function actionCreate()
 {
     // Check Access
     checkAccessThrowException('op_country_addpages');
     $model = new Country();
     if (isset($_POST['Country'])) {
         $model->attributes = $_POST['Country'];
         if ($model->save()) {
             fok(at('Country Created.'));
             alog(at("Created Country Record '{name}'.", array('{name}' => $model->name)));
             $this->redirect(array('country/index'));
         }
     }
     // Add Breadcrumb
     $this->addBreadCrumb(at('Creating New Country'));
     $this->title[] = at('Creating New Country Record');
     // Display form
     $this->render('form', array('model' => $model));
 }
开发者ID:YiiCoded,项目名称:yii-ecommerce,代码行数:22,代码来源:CountryController.php


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