當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Language::save方法代碼示例

本文整理匯總了PHP中Language::save方法的典型用法代碼示例。如果您正苦於以下問題:PHP Language::save方法的具體用法?PHP Language::save怎麽用?PHP Language::save使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Language的用法示例。


在下文中一共展示了Language::save方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: postLanguage

 public function postLanguage()
 {
     $language = new Language();
     $language->name = Input::get('name');
     $language->save();
     return Response::json($language);
 }
開發者ID:saifurrahman,項目名稱:dev,代碼行數:7,代碼來源:LanguageController.php

示例2: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     if ($this->CanAccess('create')) {
         $model = new Language();
         // Uncomment the following line if AJAX validation is needed
         // $this->performAjaxValidation($model);
         if (isset($_POST['Language'])) {
             $model->attributes = $_POST['Language'];
             if ($model->CanUpdate() && $model->save()) {
                 // if AJAX request , we should not redirect the browser
                 if (!Yii::app()->request->isAjaxRequest) {
                     $this->redirect(array('view', 'id' => $model->id));
                 } else {
                     echo CJSON::encode(array('error' => '', 'id' => $model->id));
                     die;
                 }
             }
         }
         if (!Yii::app()->request->isAjaxRequest) {
             $this->render('create', array('model' => $model, 'ajaxRendering' => false));
         } else {
             $this->renderPartial('create', array('model' => $model, 'ajaxRendering' => true));
         }
     } else {
         throw new CHttpException(405, Yii::t('app', 'You do not have permissions to access this page.'));
     }
 }
開發者ID:lidijakralj,項目名稱:bober,代碼行數:31,代碼來源:LanguageController.php

示例3: saveLanguage

 public function saveLanguage(Language $language)
 {
     try {
         $language->save();
     } catch (Exception $e) {
         throw new DaoException($e->getMessage(), $e->getCode(), $e);
     }
 }
開發者ID:lahirwisada,項目名稱:orangehrm,代碼行數:8,代碼來源:LanguageDao.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 Language();
     if (isset($_POST['Language'])) {
         $model->attributes = $_POST['Language'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
開發者ID:ChristopheBrun,項目名稱:hLib,代碼行數:15,代碼來源:LanguageController.php

示例5: verifySessionContentEditLanguage

 public function verifySessionContentEditLanguage()
 {
     $sSessionDefaultLanguage = Settings::getSetting("session_default", AdminManager::CONTENT_LANGUAGE_SESSION_KEY, null);
     if (LanguageQuery::create()->filterById($sSessionDefaultLanguage)->count() < 1) {
         $oLanguage = new Language();
         $oLanguage->setId($sSessionDefaultLanguage);
         $oLanguage->setPathPrefix($sSessionDefaultLanguage);
         $oLanguage->setIsActive(true);
         $oLanguage->save();
     }
 }
開發者ID:rapila,項目名稱:cms-base,代碼行數:11,代碼來源:SanityCheck.php

示例6: actionCreate

 public function actionCreate()
 {
     $model = new Language();
     if (isset($_POST['Language'])) {
         $model->attributes = $_POST['Language'];
         if ($model->validate() && $model->save()) {
             $this->redirect(array('index'));
         }
     }
     $statusOptions = array(0 => Yii::t('common', 'Disabled'), 1 => Yii::t('common', 'Enabled'));
     $this->render('create', array('model' => $model, 'statusOptions' => $statusOptions));
 }
開發者ID:damnpoet,項目名稱:yiicart,代碼行數:12,代碼來源:LanguagesController.php

示例7: 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 corresponding set
         // method.  This object relates to these object(s) by a
         // foreign key reference.
         if ($this->aContentObject !== null) {
             if ($this->aContentObject->isModified() || $this->aContentObject->isNew()) {
                 $affectedRows += $this->aContentObject->save($con);
             }
             $this->setContentObject($this->aContentObject);
         }
         if ($this->aLanguage !== null) {
             if ($this->aLanguage->isModified() || $this->aLanguage->isNew()) {
                 $affectedRows += $this->aLanguage->save($con);
             }
             $this->setLanguage($this->aLanguage);
         }
         if ($this->aUserRelatedByCreatedBy !== null) {
             if ($this->aUserRelatedByCreatedBy->isModified() || $this->aUserRelatedByCreatedBy->isNew()) {
                 $affectedRows += $this->aUserRelatedByCreatedBy->save($con);
             }
             $this->setUserRelatedByCreatedBy($this->aUserRelatedByCreatedBy);
         }
         if ($this->aUserRelatedByUpdatedBy !== null) {
             if ($this->aUserRelatedByUpdatedBy->isModified() || $this->aUserRelatedByUpdatedBy->isNew()) {
                 $affectedRows += $this->aUserRelatedByUpdatedBy->save($con);
             }
             $this->setUserRelatedByUpdatedBy($this->aUserRelatedByUpdatedBy);
         }
         if ($this->isNew() || $this->isModified()) {
             // persist changes
             if ($this->isNew()) {
                 $this->doInsert($con);
             } else {
                 $this->doUpdate($con);
             }
             $affectedRows += 1;
             // Rewind the data LOB column, since PDO does not rewind after inserting value.
             if ($this->data !== null && is_resource($this->data)) {
                 rewind($this->data);
             }
             $this->resetModified();
         }
         $this->alreadyInSave = false;
     }
     return $affectedRows;
 }
開發者ID:rapila,項目名稱:cms-base,代碼行數:63,代碼來源:BaseLanguageObjectHistory.php

示例8: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Language();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Language'])) {
         $model->attributes = $_POST['Language'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id_language));
         }
     }
     $this->render('create', array('model' => $model));
 }
開發者ID:fipumjdeveloper,項目名稱:web,代碼行數:17,代碼來源:LanguageController.php

示例9: testCreateNotUnique

	public function testCreateNotUnique()
	{
		$l = new Language;
		$l->language = 'nl';
		$l->name = 'Dutch';
		try
		{
			$l->save();
			$this->fail('Should throw exception');
		}
		catch (ValidationException $e)
		{
			$this->assertEquals('Language code is used', $l->language_error);
		}
	}
開發者ID:nathansamson,項目名稱:CoOrg,代碼行數:15,代碼來源:language.model.Test.php

示例10: actionCreate

 public function actionCreate()
 {
     $model = new Language();
     if (isset($_POST['Language'])) {
         $model->setAttributes($_POST['Language']);
         if ($model->save()) {
             if (Yii::app()->getRequest()->getIsAjaxRequest()) {
                 Yii::app()->end();
             } else {
                 $this->redirect(array('view', 'id' => $model->language_id));
             }
         }
     }
     $this->render('create', array('model' => $model));
 }
開發者ID:schmunk42,項目名稱:yii-sakila-crud,代碼行數:15,代碼來源:LanguageController.php

示例11: create

 /**
  * @test
  */
 public function create()
 {
     $model = new Language();
     $model->attributes = array('code' => 'test', 'name' => 'test');
     $this->assertFalse($model->save());
     $model = new Language();
     $model->attributes = array('code' => 'te', 'name' => 'test');
     $this->assertTrue($model->save());
     $model = new Language();
     $model->attributes = array('code' => 'test', 'name' => 'aaa');
     $this->assertFalse($model->save());
     $exception = null;
     $model = new Language();
     $model->attributes = array('name' => 'aaa');
     $this->assertFalse($model->save());
     $this->assertInstanceOf('Language', Language::model());
 }
開發者ID:ChristopheBrun,項目名稱:hLib,代碼行數:20,代碼來源:LanguageTest.php

示例12: createLanguageIfNoneExist

 /**
  * @param string $sLanguageId
  * use cases:
  * 1. at first users' creation
  * 2. fallback method, creates language if it does not exist, but not at first users' login time, i.e. when languages have been truncated
  * @return void
  */
 public static function createLanguageIfNoneExist($sLanguage, $oUser = null)
 {
     if (LanguageQuery::create()->count() > 0) {
         return;
     }
     $oLanguage = new Language();
     $oLanguage->setId($sLanguage);
     $oLanguage->setPathPrefix($sLanguage);
     $oLanguage->setIsActive(true);
     $oLanguage->setCreatedAt(date('c'));
     $oLanguage->setUpdatedAt(date('c'));
     if ($oUser) {
         $oLanguage->setCreatedBy($oUser->getId());
         $oLanguage->setUpdatedBy($oUser->getId());
     }
     LanguagePeer::ignoreRights(true);
     $oLanguage->save();
 }
開發者ID:rapila,項目名稱:cms-base,代碼行數:25,代碼來源:AdminManager.php

示例13: save

	/**
	 * @Acl allow admin-language
	*/
	public function save($language, $name)
	{
		$l = new Language;
		$l->language = $language;
		$l->name = $name;
		try
		{
			$l->save();
			$this->notice(t('Installed "%l"', array('l' => $name)));
			$this->redirect('admin/i18n');
		}
		catch (ValidationException $e)
		{
			$this->languages = Language::languages();
			$this->newLanguage = $l;
			$this->error(t('Did not install "%l"', array('l' => $name)));
			$this->render('i18n/index');
		}
	}
開發者ID:nathansamson,項目名稱:CoOrg,代碼行數:22,代碼來源:admin.i18n.controller.php

示例14: duplicatecvpage

 public function duplicatecvpage($cv_code)
 {
     $cv_old = Cv::where('cv_code', $cv_code)->first();
     if ($cv_old->user_id != Auth::id()) {
         return 'False';
     }
     $new_cv_name = $cv_old->cv_name . ' - Copy';
     $cv = new Cv();
     do {
         $random = str_random(10);
         $count = Cv::where('cv_code', $random)->count();
     } while ($count != 0);
     $cv->cv_code = $random;
     if (Auth::check()) {
         $cv->user_id = Auth::id();
     }
     $cv->cv_name = $new_cv_name;
     $cv->user_id = $cv_old->user_id;
     $cv->full_name = $cv_old->full_name;
     $cv->phone_num = $cv_old->phone_num;
     $cv->email = $cv_old->email;
     $cv->website = $cv_old->website;
     $cv->add_line1 = $cv_old->add_line1;
     $cv->add_line2 = $cv_old->add_line2;
     $cv->dob = $cv_old->dob;
     $cv->marital_status = $cv_old->marital_status;
     $cv->profile_image = $cv_old->profile_image;
     $cv->sex = $cv_old->sex;
     $cv->state_origin = $cv_old->state_origin;
     $cv->religion = $cv_old->religion;
     $cv->religion_text = $cv_old->religion_text;
     $cv->show_profile_pic = $cv_old->show_profile_pic;
     $cv->local_government = $cv_old->local_government;
     $cv->save();
     $new_cv_id = $cv->id;
     // copying sections
     $sections = Section::where('cv_id', $cv_old->id)->get();
     foreach ($sections as $section) {
         $section_new = new Section();
         $section_new->cv_id = $new_cv_id;
         $section_new->section_name = $section->section_name;
         $section_new->type = $section->type;
         $section_new->content = $section->content;
         $section_new->default = $section->default;
         $section_new->priority = $section->priority;
         $section_new->save();
     }
     // copying educations
     $educations = Education::where('cv_id', $cv_old->id)->get();
     foreach ($educations as $education) {
         $education_new = new Education();
         $education_new->cv_id = $new_cv_id;
         $education_new->coursename = $education->coursename;
         $education_new->institutename = $education->institutename;
         $education_new->add_line1 = $education->add_line1;
         $education_new->add_line2 = $education->add_line2;
         $education_new->startdate = $education->startdate;
         $education_new->enddate = $education->enddate;
         $education_new->otherinfo = $education->otherinfo;
         $education_new->priority = $education->priority;
         $education_new->save();
     }
     // copying languages
     $languages = Language::where('cv_id', $cv_old->id)->get();
     foreach ($languages as $language) {
         $language_new = new Language();
         $language_new->cv_id = $new_cv_id;
         $language_new->language_id = $language->language_id;
         $language_new->language_name = $language->language_name;
         $language_new->ability_id = $language->ability_id;
         $language_new->level_id = $language->level_id;
         $language_new->priority = $language->priority;
         $language_new->save();
     }
     // copying nysc
     $nyscs = Nysc::where('cv_id', $cv_old->id)->get();
     foreach ($nyscs as $nysc) {
         $nysc_new = new Nysc();
         $nysc_new->cv_id = $new_cv_id;
         $nysc_new->year = $nysc->year;
         $nysc_new->batch = $nysc->batch;
         $nysc_new->ppa = $nysc->ppa;
         $nysc_new->cd = $nysc->cd;
         $nysc_new->otherinfo = $nysc->otherinfo;
         $nysc_new->priority = $nysc->priority;
         $nysc_new->save();
     }
     // copying work_exp
     $work_exps = WorkExperience::where('cv_id', $cv_old->id)->get();
     foreach ($work_exps as $work_exp) {
         $work_exp_new = new WorkExperience();
         $work_exp_new->cv_id = $new_cv_id;
         $work_exp_new->title = $work_exp->title;
         $work_exp_new->company = $work_exp->company;
         $work_exp_new->location = $work_exp->location;
         $work_exp_new->startdate = $work_exp->startdate;
         $work_exp_new->enddate = $work_exp->enddate;
         $work_exp_new->otherinfo = $work_exp->otherinfo;
         $work_exp_new->priority = $work_exp->priority;
         $work_exp_new->save();
//.........這裏部分代碼省略.........
開發者ID:vishu87,項目名稱:cpr,代碼行數:101,代碼來源:UserprofileController.php

示例15: 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 corresponding set
         // method.  This object relates to these object(s) by a
         // foreign key reference.
         if ($this->aLanguageRelatedByLanguageId !== null) {
             if ($this->aLanguageRelatedByLanguageId->isModified() || $this->aLanguageRelatedByLanguageId->isNew()) {
                 $affectedRows += $this->aLanguageRelatedByLanguageId->save($con);
             }
             $this->setLanguageRelatedByLanguageId($this->aLanguageRelatedByLanguageId);
         }
         if ($this->isNew() || $this->isModified()) {
             // persist changes
             if ($this->isNew()) {
                 $this->doInsert($con);
             } else {
                 $this->doUpdate($con);
             }
             $affectedRows += 1;
             // Rewind the backend_settings LOB column, since PDO does not rewind after inserting value.
             if ($this->backend_settings !== null && is_resource($this->backend_settings)) {
                 rewind($this->backend_settings);
             }
             $this->resetModified();
         }
         if ($this->userGroupsRelatedByUserIdScheduledForDeletion !== null) {
             if (!$this->userGroupsRelatedByUserIdScheduledForDeletion->isEmpty()) {
                 UserGroupQuery::create()->filterByPrimaryKeys($this->userGroupsRelatedByUserIdScheduledForDeletion->getPrimaryKeys(false))->delete($con);
                 $this->userGroupsRelatedByUserIdScheduledForDeletion = null;
             }
         }
         if ($this->collUserGroupsRelatedByUserId !== null) {
             foreach ($this->collUserGroupsRelatedByUserId as $referrerFK) {
                 if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->userRolesRelatedByUserIdScheduledForDeletion !== null) {
             if (!$this->userRolesRelatedByUserIdScheduledForDeletion->isEmpty()) {
                 UserRoleQuery::create()->filterByPrimaryKeys($this->userRolesRelatedByUserIdScheduledForDeletion->getPrimaryKeys(false))->delete($con);
                 $this->userRolesRelatedByUserIdScheduledForDeletion = null;
             }
         }
         if ($this->collUserRolesRelatedByUserId !== null) {
             foreach ($this->collUserRolesRelatedByUserId as $referrerFK) {
                 if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->documentsRelatedByOwnerIdScheduledForDeletion !== null) {
             if (!$this->documentsRelatedByOwnerIdScheduledForDeletion->isEmpty()) {
                 foreach ($this->documentsRelatedByOwnerIdScheduledForDeletion as $documentRelatedByOwnerId) {
                     // need to save related object because we set the relation to null
                     $documentRelatedByOwnerId->save($con);
                 }
                 $this->documentsRelatedByOwnerIdScheduledForDeletion = null;
             }
         }
         if ($this->collDocumentsRelatedByOwnerId !== null) {
             foreach ($this->collDocumentsRelatedByOwnerId as $referrerFK) {
                 if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->linksRelatedByOwnerIdScheduledForDeletion !== null) {
             if (!$this->linksRelatedByOwnerIdScheduledForDeletion->isEmpty()) {
                 LinkQuery::create()->filterByPrimaryKeys($this->linksRelatedByOwnerIdScheduledForDeletion->getPrimaryKeys(false))->delete($con);
                 $this->linksRelatedByOwnerIdScheduledForDeletion = null;
             }
         }
         if ($this->collLinksRelatedByOwnerId !== null) {
             foreach ($this->collLinksRelatedByOwnerId as $referrerFK) {
                 if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->pagesRelatedByCreatedByScheduledForDeletion !== null) {
             if (!$this->pagesRelatedByCreatedByScheduledForDeletion->isEmpty()) {
                 foreach ($this->pagesRelatedByCreatedByScheduledForDeletion as $pageRelatedByCreatedBy) {
                     // need to save related object because we set the relation to null
//.........這裏部分代碼省略.........
開發者ID:rapila,項目名稱:cms-base,代碼行數:101,代碼來源:BaseUser.php


注:本文中的Language::save方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。