當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。