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


PHP State::save方法代码示例

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


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

示例1: actionCreate

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

示例2: 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

示例3: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new State();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['State'])) {
         $model->attributes = $_POST['State'];
         $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,代码来源:StateController.php

示例4: save

 public function save($id = null)
 {
     if ($this->perm->can_create == 'y') {
         if ($_POST) {
             $save = new State();
             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->state_name . ' State Detail');
         }
     }
     redirect("admin/" . $this->modules_name);
 }
开发者ID:ultraauchz,项目名称:asean_cultural_mapping,代码行数:18,代码来源:states.php

示例5: agregar

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

示例6: handleRequest


//.........这里部分代码省略.........
                         if (isset($_REQUEST['id'])) {
                             $m = new Major($_REQUEST['id']);
                             $m->hide($_REQUEST['hide'] == 1);
                         } else {
                             \NQ::simple('intern', \Intern\UI\NotifyUI::ERROR, "No ID given. Cannot hide major.");
                         }
                     } else {
                         if (isset($_REQUEST['del'])) {
                             /* Delete major with same ID passed in REQUEST. */
                             if (isset($_REQUEST['id'])) {
                                 $m = new Major($_REQUEST['id']);
                                 $m->del();
                             } else {
                                 \NQ::simple('intern', \Intern\UI\NotifyUI::ERROR, "No ID given. Cannot delete major.");
                             }
                         }
                     }
                 }
             }
             \PHPWS_Core::reroute('index.php?module=intern&action=showEditMajors');
             break;
             /**
              * Matt additions!
              */
         /**
          * Matt additions!
          */
         case 'add_state':
             if (!Current_User::allow('intern', 'edit_state')) {
                 disallow();
             }
             $state = new State($_GET['abbr']);
             $state->setActive(true);
             $state->save();
             exit;
             break;
         case 'remove_state':
             if (!Current_User::allow('intern', 'edit_state')) {
                 disallow();
             }
             $state = new State($_GET['abbr']);
             $state->setActive(false);
             $state->save();
             exit;
             break;
         case 'edit_states':
             if (!Current_User::allow('intern', 'edit_state')) {
                 disallow();
             }
             $view = new StateUI();
             $this->content = $view->display();
             break;
         case 'showEditAdmins':
             $view = new UI\AdminUI();
             $this->content = $view->display();
             break;
         case 'edit_admins':
             if (isset($_REQUEST['add'])) {
                 // Add user in REQUEST to administrator list for the department in REQUEST.
                 Admin::add($_REQUEST['username'], $_REQUEST['department_id']);
             } else {
                 if (isset($_REQUEST['del'])) {
                     // Delete the user in REQUEST from department in REQUEST.
                     Admin::del($_REQUEST['username'], $_REQUEST['department_id']);
                 } else {
                     if (isset($_REQUEST['user_complete'])) {
开发者ID:jlbooker,项目名称:InternshipInventory,代码行数:67,代码来源:InternshipInventory.php

示例7: State

<?php

include 'admin-config.php';
$state_id = $country_id = $state_name = $state_status = $error = "";
if (strlen(Request::post("submit"))) {
    $state_id = Request::post("state_id");
    $country_id = Request::post("country_id");
    $state_name = Request::post("state_name");
    $state_status = Validation::getStautsTinyVal(Request::post("active"));
    $stateObj = new State();
    $stateObj->set("state_id", $state_id);
    $stateObj->set("country_id", $country_id);
    $stateObj->set("state_name", $state_name);
    $stateObj->set("state_status", $state_status);
    if ($stateObj->save()) {
        General::redirectUrl("state.php");
    } else {
        $error = "State Name alreday exist !";
    }
}
?>

<?php 
include 'header.php';
include 'sitebar.php';
?>
<div class="ch-container">
    <div class="row">

        <div id="content" class="col-lg-10 col-sm-10">
            <!-- content starts -->
开发者ID:sonaljain888,项目名称:legal-lawyer1,代码行数:31,代码来源:add_state.php

示例8: actionNewstate

 public function actionNewstate()
 {
     if (isset($_POST['State'])) {
         $obj = new State();
         $obj->attributes = $_POST['State'];
         $obj->active = 1;
         $obj->sort_order = 10;
         if ($obj->validate()) {
             if ($obj->save()) {
                 echo "success";
             } else {
                 echo print_r($obj->getErrors, true);
             }
         } else {
             echo print_r($obj->getErrors, true);
         }
     }
 }
开发者ID:uiDeveloper116,项目名称:webstore,代码行数:18,代码来源:ShippingController.php

示例9: createState

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

示例10: setCommentAsLiked

 public function setCommentAsLiked($comment, $user, $send = false)
 {
     if ($send) {
         $this->data['new']['comments'][] = $comment->id;
         if (!isset($this->data['posts'][$comment->post_id])) {
             $this->data['posts'][$comment->post_id] = array('post_id' => $comment->post_id);
         }
         if (!isset($this->data['posts'][$comment->post_id]['comments'][$comment->id])) {
             $this->data['posts'][$comment->post_id]['comments'][$comment->id] = array('comment_id' => $comment->id);
         }
         if (isset($this->data['posts'][$comment->post_id]['comments'][$comment->id]['liked'])) {
             $count = isset($this->data['posts'][$comment->post_id]['comments'][$comment->id]['liked']['count']) ? $this->data['posts'][$comment->post_id]['comments'][$comment->id]['liked']['count'] : 1;
             $this->data['posts'][$comment->post_id]['comments'][$comment->id]['liked'] = array('count' => ++$count);
         } else {
             $this->data['posts'][$comment->post_id]['comments'][$comment->id]['liked'] = array('user' => $user->name);
         }
     } else {
         $state = new State();
         $state->object = 'comment';
         $state->object_id = $comment->id;
         $state->event = 'liked';
         $state->user_id = $user->id;
         $state->owner_id = $comment->user_id;
         $state->save();
         $state->timestamp = DB::raw('NOW()');
         $state->save();
     }
     return $this;
 }
开发者ID:SenhorBardell,项目名称:yol,代码行数:29,代码来源:StateSender.php

示例11: createNewState

 function createNewState($id_country, $iso_country, $state_code_name)
 {
     $newstate = new State();
     $newstate->id = 0;
     $newstate->id_country = $id_country;
     $newstate->id_zone = Country::getIdZone($id_country);
     $newstate->name = $state_code_name;
     if (strlen($state_code_name) > 2) {
         $newstate->iso_code = $iso_country . substr($state_code_name, 0, 2);
     } else {
         $newstate->iso_code = $iso_country . $state_code_name;
     }
     $newstate->tax_behavior = 0;
     $newstate->active = 1;
     $newstate->save();
     return $newstate->id;
 }
开发者ID:ecssjapan,项目名称:guiding-you-afteropen,代码行数:17,代码来源:agilepaypalbase.php

示例12: 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      PropelPDO $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(PropelPDO $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 coresponding set
         // method.  This object relates to these object(s) by a
         // foreign key reference.
         if ($this->aState !== null) {
             if ($this->aState->isModified() || $this->aState->isNew()) {
                 $affectedRows += $this->aState->save($con);
             }
             $this->setState($this->aState);
         }
         if ($this->isNew() || $this->isModified()) {
             // persist changes
             if ($this->isNew()) {
                 $this->doInsert($con);
             } else {
                 $this->doUpdate($con);
             }
             $affectedRows += 1;
             $this->resetModified();
         }
         if ($this->usersScheduledForDeletion !== null) {
             if (!$this->usersScheduledForDeletion->isEmpty()) {
                 foreach ($this->usersScheduledForDeletion as $user) {
                     // need to save related object because we set the relation to null
                     $user->save($con);
                 }
                 $this->usersScheduledForDeletion = null;
             }
         }
         if ($this->collUsers !== null) {
             foreach ($this->collUsers as $referrerFK) {
                 if (!$referrerFK->isDeleted()) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         $this->alreadyInSave = false;
     }
     return $affectedRows;
 }
开发者ID:homer6,项目名称:blank_altumo,代码行数:57,代码来源:BaseContact.php

示例13: handleRequest


//.........这里部分代码省略.........
                             $m->hide($_REQUEST['hide'] == 1);
                         } else {
                             NQ::simple('intern', INTERN_ERROR, "No ID given. Cannot hide major.");
                         }
                     } else {
                         if (isset($_REQUEST['del'])) {
                             /* Delete major with same ID passed in REQUEST. */
                             if (isset($_REQUEST['id'])) {
                                 $m = new Major($_REQUEST['id']);
                                 $m->del();
                             } else {
                                 NQ::simple('intern', INTERN_ERROR, "No ID given. Cannot delete major.");
                             }
                         }
                     }
                 }
             }
             $view = new MajorUI();
             $this->content = $view->display();
             break;
             /**
              * Matt additions!
              */
         /**
          * Matt additions!
          */
         case 'add_state':
             if (!Current_User::allow('intern', 'edit_state')) {
                 disallow();
             }
             PHPWS_Core::initModClass('intern', 'State.php');
             $state = new State($_GET['abbr']);
             $state->setActive(true);
             $state->save();
             exit;
             break;
         case 'remove_state':
             if (!Current_User::allow('intern', 'edit_state')) {
                 disallow();
             }
             PHPWS_Core::initModClass('intern', 'State.php');
             $state = new State($_GET['abbr']);
             $state->setActive(false);
             $state->save();
             exit;
             break;
         case STATE_EDIT:
             if (!Current_User::allow('intern', 'edit_state')) {
                 disallow();
             }
             PHPWS_Core::initModClass('intern', 'UI/StateUI.php');
             $view = new StateUI();
             $this->content = $view->display();
             break;
         case 'edit_admins':
             PHPWS_Core::initModClass('intern', 'UI/AdminUI.php');
             PHPWS_Core::initModClass('intern', 'Admin.php');
             PHPWS_Core::initModClass('intern', 'Department.php');
             if (isset($_REQUEST['add'])) {
                 // Add user in REQUEST to administrator list for the department in REQUEST.
                 Admin::add($_REQUEST['username'], $_REQUEST['department_id']);
             } else {
                 if (isset($_REQUEST['del'])) {
                     // Delete the user in REQUEST from department in REQUEST.
                     Admin::del($_REQUEST['username'], $_REQUEST['department_id']);
                 } else {
开发者ID:jeffrafter,项目名称:InternshipInventory,代码行数:67,代码来源:InternshipInventory.php

示例14: actionCreateOrg

 public function actionCreateOrg()
 {
     $reg_details = Registration::model()->count();
     if ($reg_details == 0) {
         $this->redirect(array('registration/create'));
     }
     $this->layout = 'select_company_main';
     $model = new Organization();
     // Uncomment the following line if AJAX validation is needed
     $this->performAjaxValidation($model);
     if (isset($_POST['Organization']['organization_name']) && !empty($_POST['Organization']['address_line1']) && !empty($_POST['Organization']['city']) && !empty($_POST['Organization']['state']) && !empty($_POST['Organization']['country']) && !empty($_POST['Organization']['pin']) && !empty($_POST['Organization']['phone']) && !empty($_POST['Organization']['no_of_semester']) && !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()');
         if (!empty($_FILES['Organization']['tmp_name']['logo'])) {
             $file = CUploadedFile::getInstance($model, 'logo');
             //$model->filename = $file->name;
             $model->file_type = $file->type;
             $fp = fopen($file->tempName, 'r');
             $content = fread($fp, filesize($file->tempName));
             fclose($fp);
             $model->logo = $content;
         }
         $model->city = $city_model->city_id;
         $model->state = $state_model->state_id;
         $model->country = $country_model->id;
         if ($model->save(false)) {
             $this->redirect(array('site/redirectLogin'));
         }
     }
     $this->render('create_org', array('model' => $model));
 }
开发者ID:sharmarakesh,项目名称:edusec-college-management-system,代码行数:44,代码来源:SiteController.php

示例15: saveState

 public function saveState(State $state)
 {
     // make sure that such state doesn't exist already
     $f = new ARSelectFilter(new EqualsCond(new ARFieldHandle('State', 'countryID'), $state->countryID->get()));
     $f->mergeCondition(new EqualsCond(new ARFieldHandle('State', 'code'), $state->code->get()));
     if (!ActiveRecordModel::getRecordCount('State', $f)) {
         return $state->save();
     }
 }
开发者ID:saiber,项目名称:livecart,代码行数:9,代码来源:LiveCartImportDriver.php


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