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


PHP Organization::save方法代码示例

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


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

示例1: save

 public function save($id = null)
 {
     if ($_POST) {
         $data = new Organization($id);
         if ($_POST['id'] == '') {
             $_POST['created_by'] = $this->user->id;
         } else {
             $_POST['updated_by'] = $this->user->id;
         }
         $data->from_array($_POST);
         $data->show_rest = @$_POST['show_rest'] == '' ? 'n' : $_POST['show_rest'];
         $data->show_public = @$_POST['show_public'] == '' ? 'n' : $_POST['show_public'];
         $data->save();
         $this->db->query("DELETE FROM hotels_organizations WHERE org_id=" . $data->id);
         foreach ($_POST['org_hotel'] as $key => $item) {
             if ($item) {
                 $hotel_org = new Hotel_organization();
                 $hotel_org->hotel_id = $item;
                 $hotel_org->org_id = $data->id;
                 $hotel_org->save();
             }
         }
         $action = @$_POST['id'] > 0 ? 'UPDATE' : 'CREATE';
         save_logs($this->menu_id, $action, @$data->id, $action . ' ' . $data->org_name . ' Organizations ');
     }
     redirect("admin/settings/organizations");
 }
开发者ID:ultraauchz,项目名称:conference,代码行数:27,代码来源:organizations.php

示例2: executeProcessNewOrgForm

 public function executeProcessNewOrgForm(sfWebRequest $request)
 {
     $f = $request->getParameter("organization");
     $p = Doctrine::getTable('Principal')->findOneByFedid($this->getUser()->getUsername());
     $o = new Organization();
     $o->setName($f["name"]);
     $o->setDescription($f["description"]);
     $o->setCreatedAt(date('Y-m-d H:i:s'));
     $o->save();
     $op = new OrganizationPrincipal();
     $op->setOrganization($o);
     $op->setPrincipal($p);
     $op->save();
     $i = new Invitation();
     $i->setEmail($p->getEmail());
     $i->setOrganization($o);
     $i->setUuid('1');
     $i->setCreatedAt(date('Y-m-d H:i:s'));
     $i->setAcceptAt(date('Y-m-d H:i:s'));
     $i->setCounter(1);
     $i->setInviter($p);
     $i->setPrincipal($p);
     $i->setStatus("accepted");
     $i->save();
     $r = new Role();
     $r->setName($f["role_name"]);
     $r->setOrganization($o);
     $r->setShoworder(0);
     $r->save();
     $o->setDefaultRoleId($r->getId());
     $o->save();
     $this->redirect("show/index?id=" . $o->getId());
 }
开发者ID:br00k,项目名称:yavom,代码行数:33,代码来源:actions.class.php

示例3: create

 function create()
 {
     $organization = new Organization();
     $organization->name = $_POST['name'];
     if ($organization->save()) {
         $this->redirect('/organizations', 'Criado com sucesso!');
     } else {
         $this->redirect('/organizations', 'Falha na criação!');
     }
 }
开发者ID:hugoabonizio,项目名称:BirdsPHP-scaffold,代码行数:10,代码来源:organizations_controller.php

示例4: run

 public function run()
 {
     $organization = new Organization();
     $organization->name = 'Helpster';
     $organization->date_established = '2015-02-24';
     $organization->description = 'Helpster is a site dedicated to link volunteer organizations to prospecting volunteers';
     $organization->website = 'http://helpster.site';
     $organization->image = 'helpster.png';
     $organization->user_id = 4;
     $organization->save();
 }
开发者ID:thehelpster,项目名称:helpster,代码行数:11,代码来源:OrganizationsTableSeeder.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 Organization();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Organization'])) {
         $model->attributes = $_POST['Organization'];
         if ($model->save()) {
             $this->redirect(array('view', 'code' => $model->code));
         }
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:alexeevich,项目名称:portal,代码行数:17,代码来源:OrganizationController.php

示例6: update

 public function update(Organization $org)
 {
     $name = trim(Input::get('name'));
     $redirect = Redirect::route('settings', $org->slug);
     if ($name) {
         $org->name = $name;
         $org->css = Input::get('css', []);
         $org->save();
         return $redirect->withSuccess('Organization updated successfully');
     } else {
         return $redirect->withError('Name may not be blank');
     }
 }
开发者ID:foxted,项目名称:Multitenant-Apps-in-Laravel,代码行数:13,代码来源:OrganizationsController.php

示例7: register

 /**
  * Registers new principal and school for platform access
  * @return [type] [description]
  */
 public function register()
 {
     $this->setSEO(array("title" => "Register School"));
     $view = $this->getActionView();
     if (RequestMethods::post("action") == "register") {
         $user = new \User(array("name" => RequestMethods::post("name"), "email" => RequestMethods::post("email"), "phone" => RequestMethods::post("phone"), "username" => strtolower(implode("", explode(" ", RequestMethods::post("name")))), "password" => Markup::encrypt("password"), "admin" => 0));
         $user->save();
         $location = new Location(array("user_id" => $user->id, "address" => RequestMethods::post("address"), "city" => RequestMethods::post("city"), "latitude" => "", "longitude" => ""));
         $location->save();
         $organization = new Organization(array("user_id" => $user->id, "name" => RequestMethods::post("sname"), "location_id" => $location->id, "phone" => RequestMethods::post("sphone"), "logo" => ""));
         $organization->save();
         $view->set("success", true);
     }
 }
开发者ID:SwiftSchool,项目名称:School,代码行数:18,代码来源:school.php

示例8: save

 public function save($id = null)
 {
     if ($_POST) {
         $data = new Organization($id);
         if ($_POST['id'] == '') {
             $_POST['created_by'] = $this->user->id;
         } else {
             $_POST['updated_by'] = $this->user->id;
         }
         $data->from_array($_POST);
         $data->save();
         $action = @$_POST['id'] > 0 ? 'UPDATE' : 'CREATE';
         save_logs($this->menu_id, $action, @$data->id, $action . ' ' . $data->org_name . ' Organizations ');
     }
     redirect("admin/settings/organizations");
 }
开发者ID:ultraauchz,项目名称:asean_cultural_mapping,代码行数:16,代码来源:organizations.php

示例9: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     if ($this->menu_use[6]) {
         $model = new Organization();
         // Uncomment the following line if AJAX validation is needed
         // $this->performAjaxValidation($model);
         if (isset($_POST['Organization'])) {
             $_POST['Organization']['user_id'] = Yii::app()->user->id;
             $model->attributes = $_POST['Organization'];
             if ($model->save()) {
                 $this->redirect(array('index'));
             }
         }
         $this->render('create', array('model' => $model));
     } else {
         $this->redirect(array('site/index'));
     }
 }
开发者ID:ultr4h4ck,项目名称:project_gspa,代码行数:22,代码来源:OrganizationController.php

示例10: postCreate

 public function postCreate()
 {
     $validator = Validator::make(Input::all(), Organization::$rules);
     if ($validator->passes()) {
         //Upload the logo
         $file = Input::file('image');
         $upload_success = Input::file('image')->move('public/uploads', $file->getClientOriginalName());
         //save the register
         $organization = new Organization();
         $organization->name = Input::get('name');
         $organization->test = Input::get('test');
         $organization->logo = $file->getClientOriginalName();
         $organization->address = Input::get('address');
         $organization->save();
         return Redirect::to('organization/new')->with('message', 'Registro creado con exito');
     } else {
         return Redirect::to('organization/new')->with('error', 'Ocurrieron los siguientes errores')->withErrors($validator)->withInput();
     }
 }
开发者ID:josimarjimenez,项目名称:architects,代码行数:19,代码来源:OrganizationsController.php

示例11: 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->aUser !== null) {
             if ($this->aUser->isModified() || $this->aUser->isNew()) {
                 $affectedRows += $this->aUser->save($con);
             }
             $this->setUser($this->aUser);
         }
         if ($this->aOrganization !== null) {
             if ($this->aOrganization->isModified() || $this->aOrganization->isNew()) {
                 $affectedRows += $this->aOrganization->save($con);
             }
             $this->setOrganization($this->aOrganization);
         }
         if ($this->isNew() || $this->isModified()) {
             // persist changes
             if ($this->isNew()) {
                 $this->doInsert($con);
             } else {
                 $this->doUpdate($con);
             }
             $affectedRows += 1;
             $this->resetModified();
         }
         $this->alreadyInSave = false;
     }
     return $affectedRows;
 }
开发者ID:rwardhan,项目名称:datawrapper-1,代码行数:47,代码来源:BaseUserOrganization.php

示例12: Organization

 }
 // check if orga shortname exists
 $organization = new Organization($gDb, $_POST['orgaShortName']);
 if ($organization->getValue('org_id') > 0) {
     $gMessage->show($gL10n->get('INS_ORGA_SHORTNAME_EXISTS', $_POST['orgaShortName']));
 }
 // set execution time to 2 minutes because we have a lot to do :)
 // there should be no error output because of safe mode
 @set_time_limit(120);
 $gDb->startTransaction();
 // create new organization
 $newOrganization = new Organization($gDb, $_POST['orgaShortName']);
 $newOrganization->setValue('org_longname', $_POST['orgaLongName']);
 $newOrganization->setValue('org_shortname', $_POST['orgaShortName']);
 $newOrganization->setValue('org_homepage', $_SERVER['HTTP_HOST']);
 $newOrganization->save();
 // write all preferences from preferences.php in table adm_preferences
 require_once '../../installation/db_scripts/preferences.php';
 // set some specific preferences whose values came from user input of the installation wizard
 $orga_preferences['email_administrator'] = $_POST['orgaEmail'];
 $orga_preferences['system_language'] = $gPreferences['system_language'];
 // create all necessary data for this organization
 $newOrganization->setPreferences($orga_preferences, false);
 $newOrganization->createBasicData($gCurrentUser->getValue('usr_id'));
 // if installation of second organization than show organization select at login
 if ($gCurrentOrganization->countAllRecords() === 2) {
     $sql = 'UPDATE ' . TBL_PREFERENCES . ' SET prf_value = 1
          WHERE prf_name = \'system_organization_select\' ';
     $gDb->query($sql);
 }
 $gDb->endTransaction();
开发者ID:sistlind,项目名称:admidio,代码行数:31,代码来源:preferences_function.php

示例13: Organization

 function voluntary_work($employee_id = '')
 {
     $data['page_name'] = '<b>Personal Data Sheet</b>';
     $data['section_name'] = '<b>Personal Information</b>';
     $data['focus_field'] = 'org_name';
     $data['msg'] = '';
     $e = new Employee_m();
     $data['employee'] = $e->get_by_id($employee_id);
     if (Input::get('op')) {
         // VOLUNTARY WORK OR INVOLVEMENT=========================
         $org_name = Input::get('org_name');
         $org_inclusive_date_from = Input::get('org_inclusive_date_from');
         $org_inclusive_date_to = Input::get('org_inclusive_date_to');
         $org_number_of_hours = Input::get('org_number_of_hours');
         $org_position = Input::get('org_position');
         $org = new Organization();
         $org->get_by_employee_id($employee_id);
         $org->delete_all();
         $i = 0;
         foreach ($org_name as $org) {
             if ($org != "") {
                 $organization = new Organization();
                 $organization->employee_id = $employee_id;
                 $organization->name = $org_name[$i];
                 $organization->inclusive_date_from = $org_inclusive_date_from[$i];
                 $organization->inclusive_date_to = $org_inclusive_date_to[$i];
                 $organization->number_of_hours = $org_number_of_hours[$i];
                 $organization->position = $org_position[$i];
                 $organization->save();
             }
             $i++;
         }
         $data['msg'] = 'Voluntary Work has been saved!';
     }
     // Voluntary work or involvement ======================================
     $org = new Organization();
     $org->order_by('inclusive_date_from', 'DESC');
     $data['orgs'] = $org->get_by_employee_id($employee_id);
     $data['selected'] = $e->office_id;
     //Use for office listbox
     $data['options'] = $this->options->office_options();
     $data['employee_id'] = $employee_id;
     $data['main_content'] = 'voluntary_work';
     return View::make('includes/template', $data);
 }
开发者ID:billyriantono,项目名称:ihrmis,代码行数:45,代码来源:pds2.php

示例14: 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->aUser !== null) {
             if ($this->aUser->isModified() || $this->aUser->isNew()) {
                 $affectedRows += $this->aUser->save($con);
             }
             $this->setUser($this->aUser);
         }
         if ($this->aOrganization !== null) {
             if ($this->aOrganization->isModified() || $this->aOrganization->isNew()) {
                 $affectedRows += $this->aOrganization->save($con);
             }
             $this->setOrganization($this->aOrganization);
         }
         if ($this->aChartRelatedByForkedFrom !== null) {
             if ($this->aChartRelatedByForkedFrom->isModified() || $this->aChartRelatedByForkedFrom->isNew()) {
                 $affectedRows += $this->aChartRelatedByForkedFrom->save($con);
             }
             $this->setChartRelatedByForkedFrom($this->aChartRelatedByForkedFrom);
         }
         if ($this->isNew() || $this->isModified()) {
             // persist changes
             if ($this->isNew()) {
                 $this->doInsert($con);
             } else {
                 $this->doUpdate($con);
             }
             $affectedRows += 1;
             $this->resetModified();
         }
         if ($this->chartsRelatedByIdScheduledForDeletion !== null) {
             if (!$this->chartsRelatedByIdScheduledForDeletion->isEmpty()) {
                 foreach ($this->chartsRelatedByIdScheduledForDeletion as $chartRelatedById) {
                     // need to save related object because we set the relation to null
                     $chartRelatedById->save($con);
                 }
                 $this->chartsRelatedByIdScheduledForDeletion = null;
             }
         }
         if ($this->collChartsRelatedById !== null) {
             foreach ($this->collChartsRelatedById as $referrerFK) {
                 if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->jobsScheduledForDeletion !== null) {
             if (!$this->jobsScheduledForDeletion->isEmpty()) {
                 JobQuery::create()->filterByPrimaryKeys($this->jobsScheduledForDeletion->getPrimaryKeys(false))->delete($con);
                 $this->jobsScheduledForDeletion = null;
             }
         }
         if ($this->collJobs !== null) {
             foreach ($this->collJobs as $referrerFK) {
                 if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         $this->alreadyInSave = false;
     }
     return $affectedRows;
 }
开发者ID:harivemula,项目名称:datawrapper,代码行数:82,代码来源:BaseChart.php

示例15: setOrganization

 public function setOrganization($orgID, $orgName)
 {
     $config = new Configuration();
     //if the org module is installed get the org name from org database
     if ($config->settings->organizationsModule == 'Y') {
         //if no org ID was passed in then we need to create a new organization shell
         if (!$orgID) {
             $dbName = $config->settings->organizationsDatabaseName;
             $orgName = str_replace("'", "''", $orgName);
             $query = "INSERT INTO " . $dbName . ".Organization (name, createDate, createLoginID) VALUES ('" . $orgName . "', NOW(), '" . $_SESSION['loginID'] . "')";
             $this->organizationID = $this->db->processQuery($query);
         } else {
             $this->organizationID = $orgID;
         }
         //otherwise if the org module is not installed get the org name from this database
     } else {
         //if no org ID was passed in then we need to create a new provider
         if (!$orgID) {
             $organization = new Organization();
             $organization->organizationID = '';
             $organization->shortName = $orgName;
             $organization->save();
             $this->organizationID = $organization->primaryKey;
         } else {
             $this->organizationID = $orgID;
         }
     }
 }
开发者ID:TAMULib,项目名称:CORAL-Management,代码行数:28,代码来源:License.php


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