• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Phrase类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: get_default

 public static function get_default($phrase, $filter)
 {
     $default = Phrase::factory()->where("phrase", $phrase)->where("filter", $filter)->where_related_language(Language::get_default())->get();
     if (!$default->exists()) {
         $default->phrase = $default->translation = $phrase;
         $default->filter = $filter;
         $default->save(array(Language::get_default()));
     }
     return $default;
 }
开发者ID:jotavejv,项目名称:CMS,代码行数:10,代码来源:phrase.php


示例2: phrase

 public function phrase($phrase, $filter)
 {
     $tr = $this->get_translation($phrase, $filter);
     //var_dump($tr);
     //die;
     if ($tr) {
         return $tr;
     } else {
         //save for curr. language
         if ($this->language->id != Language::get_default()->id) {
             $newphr = Phrase::factory()->where('phrase', $phrase)->where_related_language($this->language)->limit(1)->get();
             $newphr->phrase = $phrase;
             $newphr->filter = $filter;
             $newphr->save($this->language);
         }
         //return default
         return Phrase::get_default($phrase, $filter)->translation;
     }
     /*	$phrase_obj = Phrase::factory()
     			->where("phrase", $phrase)
     			->where("filter", $filter)
     			->where_related_language($this->language)
     			->get();
     
     		if ($phrase_obj->exists())
     		{
     			if (trim($phrase_obj->translation) != "")
     				return $phrase_obj->translation;
     			else
     				return Phrase::get_default($phrase, $filter)->translation;
     		}
     		else
     		{
     			//save for curr. language
     			if ($this->language->id != Language::get_default()->id)
     			{
     				$newphr = new Phrase();
     				$newphr->phrase = $phrase;
     				$newphr->filter = $filter;
     				$newphr->save($this->language);
     			}
     
     			//return default
     			return Phrase::get_default($phrase, $filter)->translation;
     		}//*/
 }
开发者ID:jotavejv,项目名称:CMS,代码行数:46,代码来源:translate.php


示例3: actionIndex

 /**
  * Lists all models.
  */
 public function actionIndex()
 {
     $setting = ArticleSetting::model()->findByPk(1, array('select' => 'meta_description, meta_keyword'));
     if (isset($_GET['category']) && $_GET['category'] != '') {
         $title = ArticleCategory::model()->findByPk($_GET['category']);
     }
     $criteria = new CDbCriteria();
     $criteria->condition = 'publish = :publish AND published_date <= curdate()';
     $criteria->params = array(':publish' => 1);
     $criteria->order = 'published_date DESC';
     if (isset($_GET['category']) && $_GET['category'] != '') {
         $criteria->compare('cat_id', $_GET['category']);
     }
     $dataProvider = new CActiveDataProvider('Articles', array('criteria' => $criteria, 'pagination' => array('pageSize' => 10)));
     $this->pageTitle = 'Articles';
     $this->pageDescription = isset($_GET['category']) && $_GET['category'] != '' ? Phrase::trans($title->name, 2) : $setting->meta_description;
     $this->pageMeta = isset($_GET['category']) && $_GET['category'] != '' ? Phrase::trans($title->desc, 2) : $setting->meta_keyword;
     $this->render('front_index', array('dataProvider' => $dataProvider));
 }
开发者ID:OmmuOpenSource,项目名称:Swvl,代码行数:22,代码来源:SiteController.php


示例4: actionDefault

 /**
  * Deletes a particular model.
  * If deletion is successful, the browser will be redirected to the 'admin' page.
  * @param integer $id the ID of the model to be deleted
  */
 public function actionDefault($id)
 {
     $model = $this->loadModel($id);
     if (Yii::app()->request->isPostRequest) {
         // we only allow deletion via POST request
         if (isset($id)) {
             //change value active or publish
             $model->defaults = 1;
             if ($model->update()) {
                 echo CJSON::encode(array('type' => 5, 'get' => Yii::app()->controller->createUrl('manage'), 'id' => 'partial-levels', 'msg' => '<div class="errorSummary success"><strong>' . Phrase::trans(16007, 1) . '</strong></div>'));
             }
         }
     } else {
         $this->dialogDetail = true;
         $this->dialogGroundUrl = Yii::app()->controller->createUrl('manage');
         $this->dialogWidth = 350;
         $this->pageTitle = Yii::t('phrase', 'Default');
         $this->pageDescription = '';
         $this->pageMeta = '';
         $this->render('admin_default', array('model' => $model));
     }
 }
开发者ID:OmmuOpenSource,项目名称:OOS-Company-Profile,代码行数:27,代码来源:LevelController.php


示例5: actionGet

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionGet()
 {
     $model = new UserForgot();
     // Uncomment the following line if AJAX validation is needed
     $this->performAjaxValidation($model);
     if (isset($_POST['UserForgot'])) {
         $model->attributes = $_POST['UserForgot'];
         $model->scenario = 'get';
         $jsonError = CActiveForm::validate($model);
         if (strlen($jsonError) > 2) {
             echo $jsonError;
         } else {
             if (isset($_GET['enablesave']) && $_GET['enablesave'] == 1) {
                 if ($model->save()) {
                     echo CJSON::encode(array('type' => 5, 'get' => Yii::app()->controller->createUrl('get', array('name' => urlencode($model->user->displayname), 'email' => $model->user->email))));
                 } else {
                     print_r($model->getErrors());
                 }
             }
         }
         Yii::app()->end();
     }
     if (isset($_GET['name']) && isset($_GET['email'])) {
         if (isset($_GET['type']) && $_GET['type'] == 'success') {
             $desc = Phrase::trans(16191, 1);
         } else {
             $desc = Phrase::trans(16187, 1, array($_GET['name'], $_GET['email']));
         }
     } else {
         $desc = Phrase::trans(16185, 1);
     }
     $this->dialogDetail = true;
     $this->dialogGroundUrl = Yii::app()->createUrl('site/index');
     $this->pageTitle = Phrase::trans(16184, 1);
     $this->pageDescription = $desc;
     $this->pageMeta = '';
     $this->render('front_get', array('model' => $model));
 }
开发者ID:OmmuOpenSource,项目名称:OOS-Company-Profile,代码行数:42,代码来源:ForgotController.php


示例6: array

<?php

/**
 * User Forgot (user-forgot)
 * @var $this ForgotController
 * @var $model UserForgot
 * @var $form CActiveForm
 *
 * @author Putra Sudaryanto <[email protected]>
 * @copyright Copyright (c) 2012 Ommu Platform (ommu.co)
 * @link https://github.com/oMMu/Ommu-Users
 * @contact (+62)856-299-4114
 *
 */
$this->breadcrumbs = array('User Forgots' => array('manage'), 'Create');
if (isset($_GET['name']) && isset($_GET['email'])) {
    if (isset($_GET['type']) && $_GET['type'] == 'success') {
        echo '<a class="button" href="' . Yii::app()->createUrl('site/login') . '" title="' . Phrase::trans(1006, 2) . '">' . Phrase::trans(1006, 2) . '</a>';
    }
} else {
    echo $this->renderPartial('_form', array('model' => $model));
}
开发者ID:OmmuOpenSource,项目名称:OOS-Company-Profile,代码行数:22,代码来源:front_get.php


示例7:

<?php

if ($model->media != '') {
    $images = Yii::app()->request->baseUrl . '/public/page/' . $model->media;
} else {
    $images = Yii::app()->request->baseUrl . '/public/page/page_default.png';
}
?>
<div class="clearfix">
	<div class="sep">
		<img src="<?php 
echo Utility::getTimThumb($images, 300, 300, 1);
?>
" alt="<?php 
echo Phrase::trans($model->name, 2);
?>
">
		<?php 
echo Phrase::trans($model->quote, 2);
?>
	</div>
	<div class="sep"><?php 
echo Phrase::trans($model->name, 2) != Utility::hardDecode(Phrase::trans($model->desc, 2)) ? Utility::cleanImageContent(Phrase::trans($model->desc, 2)) : '';
?>
</div>
</div>
开发者ID:oMMuCo,项目名称:ECC-HPTT-Website,代码行数:26,代码来源:page_main_introduction.php


示例8: beforeValidate

 /**
  * before validate attributes
  */
 protected function beforeValidate()
 {
     $module = strtolower(Yii::app()->controller->module->id);
     $controller = strtolower(Yii::app()->controller->id);
     if (parent::beforeValidate()) {
         if ($this->email != '') {
             $model = UserInviteQueue::model()->findByAttributes(array('email' => strtolower($this->email)), array('select' => 'queue_id, member_id, invite'));
             if ($model == null) {
                 // email belum masuk daftar invite
                 $invite = new UserInviteQueue();
                 $invite->email = $this->email;
                 if ($invite->save()) {
                     $this->queue_id = $invite->queue_id;
                 }
             } else {
                 // email sudah dalam daftar invite
                 if ($module != null && $module == 'users' && $controller == 'invite') {
                     if ($model->member_id != 0) {
                         // email sudah menjadi member
                         $this->addError('email', Phrase::trans(16213, 1));
                     } else {
                         // email belum menjadi member
                         $invite = self::model()->with('queue')->find(array('select' => 'invite_id', 'condition' => 'queue.email = :email AND t.user_id = :user', 'params' => array(':email' => strtolower($this->email), ':user' => Yii::app()->user->id)));
                         if ($invite == null) {
                             $this->queue_id = $model->queue_id;
                         } else {
                             // email sudah invite sebelumnya
                             $this->addError('email', Phrase::trans(16212, 1));
                         }
                     }
                 }
             }
         }
         if ($this->isNewRecord) {
             $this->user_id = Yii::app()->user->id;
             $this->code = self::getUniqueCode();
             $this->invite_ip = $_SERVER['REMOTE_ADDR'];
         }
     }
     return true;
 }
开发者ID:OmmuOpenSource,项目名称:OOS-Company-Profile,代码行数:44,代码来源:UserInvites.php


示例9: attributeLabels

 /**
  * @return array customized attribute labels (name=>label)
  */
 public function attributeLabels()
 {
     return array('id' => Phrase::trans(26080, 1), 'article_id' => Phrase::trans(26000, 1), 'tag_id' => Phrase::trans(26080, 1), 'article_search' => Phrase::trans(26000, 1), 'tag_search' => Phrase::trans(26080, 1), 'creation_date' => Phrase::trans(26069, 1), 'creation_search' => 'Creation');
 }
开发者ID:OmmuOpenSource,项目名称:OOS-Company-Profile,代码行数:7,代码来源:ArticleTag.php


示例10: approveEditsByContributor

 public static function approveEditsByContributor($repositoryID, $languageID, $contributorID)
 {
     $edits = self::getPendingEditsByRepositoryLanguageAndUser($repositoryID, $languageID, $contributorID);
     foreach ($edits as $edit) {
         $previousPhraseData = Database::getPhrase($repositoryID, $languageID, $edit['phraseKey']);
         if (empty($previousPhraseData)) {
             $phraseObject = Phrase::create(0, $edit['phraseKey'], $edit['payload'], 0, true);
         } else {
             $phraseObject = Phrase::create(0, $edit['phraseKey'], $previousPhraseData['payload'], 0);
         }
         $phraseObject->setPhraseValue($edit['phraseSubKey'], $edit['suggestedValue']);
         self::updatePhrase($repositoryID, $languageID, $edit['phraseKey'], $phraseObject->getPayload());
         self::updateContributor($repositoryID, $edit['userID']);
         self::deleteEdit($edit['id']);
     }
     Authentication::setCachedLanguageProgress($repositoryID, NULL);
     // unset cached version of this repository's progress
 }
开发者ID:jeckel420,项目名称:Localize,代码行数:18,代码来源:Database.php


示例11: array

<?php

/**
 * Banners (banners)
 * @var $this AdminController
 * @var $model Banners
 *
 * @author Putra Sudaryanto <[email protected]>
 * @copyright Copyright (c) 2014 Ommu Platform (ommu.co)
 * @link https://github.com/oMMu/Ommu-Banner
 * @contect (+62)856-299-4114
 *
 */
$this->breadcrumbs = array('Banners' => array('manage'), $model->title);
?>

<div class="box">
	<?php 
$this->widget('application.components.system.FDetailView', array('data' => $model, 'attributes' => array(array('name' => 'cat_id', 'value' => Phrase::trans($model->category_relation->name, 2)), 'title', array('name' => 'url', 'value' => CHtml::link($model->url, $model->url, array('target' => '_blank')), 'type' => 'raw'), array('name' => 'url', 'value' => CHtml::link($model->media, Yii::app()->request->baseUrl . '/public/banner/' . $model->media, array('target' => '_blank')), 'type' => 'raw'), array('name' => 'published_date', 'value' => Utility::dateFormat($model->published_date)), array('name' => 'expired_date', 'value' => Utility::dateFormat($model->expired_date)), 'view', 'click', array('name' => 'creation_date', 'value' => Utility::dateFormat($model->creation_date, true)), array('name' => 'creation_id', 'value' => $model->creation_relation->displayname), array('name' => 'modified_date', 'value' => Utility::dateFormat($model->modified_date, true)), array('name' => 'modified_id', 'value' => $model->modified_relation->displayname), array('name' => 'publish', 'value' => $model->publish == 1 ? Chtml::image(Yii::app()->theme->baseUrl . '/images/icons/publish.png') : Chtml::image(Yii::app()->theme->baseUrl . '/images/icons/unpublish.png'), 'type' => 'raw'))));
?>
</div>
开发者ID:OmmuOpenSource,项目名称:OOS-Company-Profile,代码行数:21,代码来源:admin_view.php


示例12: foreach

<?php

if ($model != null) {
    ?>
	<ul>
	<?php 
    echo '<li><a href="' . Yii::app()->controller->createUrl('index') . '" title="' . Yii::t('phrase', 'All') . '">' . Yii::t('phrase', 'All') . '</a></li>';
    foreach ($model as $key => $val) {
        echo '<li><a href="' . Yii::app()->controller->createUrl('index', array('cat' => $val->cat_id, 't' => Utility::getUrlTitle(Phrase::trans($val->name, 2)))) . '" title="' . Phrase::trans($val->name, 2) . '">' . Phrase::trans($val->name, 2) . '</a></li>';
    }
    ?>
	</ul>
<?php 
}
开发者ID:OmmuOpenSource,项目名称:OOS-Company-Profile,代码行数:14,代码来源:front_article_category.php


示例13: array

$model->title = Phrase::trans($model->name, 2);
echo $form->textField($model, 'title', array('maxlength' => 32, 'class' => 'span-7'));
?>
				<?php 
echo $form->error($model, 'title');
?>
			</div>
		</div>

		<div class="clearfix">
			<?php 
echo $form->labelEx($model, 'description');
?>
			<div class="desc">
				<?php 
$model->description = Phrase::trans($model->desc, 2);
echo $form->textArea($model, 'description', array('rows' => 6, 'cols' => 50, 'class' => 'span-9 smaller'));
?>
				<?php 
echo $form->error($model, 'description');
?>
			</div>
		</div>

		<div class="clearfix publish">
			<?php 
echo $form->labelEx($model, 'defaults');
?>
			<div class="desc">
				<?php 
echo $form->checkBox($model, 'defaults');
开发者ID:OmmuOpenSource,项目名称:OOS-Company-Profile,代码行数:31,代码来源:_form.php


示例14: array

				<div class="clearfix message">
					<div class="desc">
						<?php 
    echo $form->textArea($model, 'message', array('rows' => 6, 'cols' => 50));
    ?>
						<?php 
    echo $form->error($model, 'message');
    ?>
					</div>
				</div>

				<div class="submit clearfix">
					<label>&nbsp;</label>
					<div class="desc">
						<?php 
    echo CHtml::submitButton($model->isNewRecord ? Phrase::trans(328, 0) : Phrase::trans(328, 0), array('onclick' => 'setEnableSave()'));
    ?>
					</div>
				</div>

			</fieldset>
			<?php 
    $this->endWidget();
    ?>
		</div>
	<?php 
}
?>
	<?php 
//end.Contact Form
?>
开发者ID:OmmuOpenSource,项目名称:OOS-Company-Profile,代码行数:31,代码来源:backup.front_index.php


示例15: sortUntranslatedFirstCompare

 /**
  * Comparator for phrases so that empty phrases are shown first
  *
  * @param Phrase $a
  * @param Phrase $b
  * @return int 1 if $a is less complete then $b, 0 if both are equally complete, and -1 otherwise
  */
 public static function sortUntranslatedFirstCompare($a, $b)
 {
     $aCompletenessData = $a->getCompleteness();
     $aCompleteness = $aCompletenessData[0] / $aCompletenessData[1];
     $bCompletenessData = $b->getCompleteness();
     $bCompleteness = $bCompletenessData[0] / $bCompletenessData[1];
     if ($aCompleteness == $bCompleteness) {
         $res = 0;
         return $res;
     } else {
         $res = $aCompleteness > $bCompleteness ? 1 : -1;
         return $res;
     }
 }
开发者ID:jeckel420,项目名称:Localize,代码行数:21,代码来源:Language.php


示例16: actionSend

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionSend()
 {
     $model = new Reports();
     // Uncomment the following line if AJAX validation is needed
     $this->performAjaxValidation($model);
     if (isset($_POST['Reports'])) {
         $model->attributes = $_POST['Reports'];
         $jsonError = CActiveForm::validate($model);
         if (strlen($jsonError) > 2) {
             echo $jsonError;
         } else {
             if (isset($_GET['enablesave']) && $_GET['enablesave'] == 1) {
                 if ($model->save()) {
                     echo CJSON::encode(array('type' => 5, 'get' => Yii::app()->controller->createUrl('send', array('type' => 'success'))));
                 } else {
                     print_r($model->getErrors());
                 }
             }
         }
         Yii::app()->end();
     } else {
         $this->dialogDetail = true;
         $this->dialogGroundUrl = Yii::app()->createUrl('site/index');
         $this->dialogWidth = 500;
         $this->pageTitle = Phrase::trans(12014, 1);
         $this->pageDescription = '';
         $this->pageMeta = '';
         $this->render('front_send', array('model' => $model));
     }
 }
开发者ID:OmmuOpenSource,项目名称:Swvl,代码行数:34,代码来源:SiteController.php


示例17: afterConstruct

 /**
  * Set default columns to display
  */
 protected function afterConstruct()
 {
     if (count($this->defaultColumns) == 0) {
         $this->defaultColumns[] = array('header' => 'No', 'value' => '$this->grid->dataProvider->pagination->currentPage*$this->grid->dataProvider->pagination->pageSize + $row+1');
         $this->defaultColumns[] = array('name' => 'user_search', 'value' => '$data->newsletter->user_id != 0 ? $data->newsletter->user->displayname : "-"');
         $this->defaultColumns[] = array('name' => 'email_search', 'value' => '$data->newsletter->email');
         $this->defaultColumns[] = array('name' => 'status', 'value' => '$data->status == 1 ? Phrase::trans(23057,1) : Phrase::trans(16256,1)', 'htmlOptions' => array('class' => 'center'), 'filter' => array(1 => Phrase::trans(23057, 1), 0 => Phrase::trans(16256, 1)), 'type' => 'raw');
         $this->defaultColumns[] = array('name' => 'creation_date', 'value' => 'Utility::dateFormat($data->creation_date)', 'htmlOptions' => array('class' => 'center'), 'filter' => Yii::app()->controller->widget('zii.widgets.jui.CJuiDatePicker', array('model' => $this, 'attribute' => 'creation_date', 'language' => 'ja', 'i18nScriptFile' => 'jquery.ui.datepicker-en.js', 'htmlOptions' => array('id' => 'creation_date_filter'), 'options' => array('showOn' => 'focus', 'dateFormat' => 'dd-mm-yy', 'showOtherMonths' => true, 'selectOtherMonths' => true, 'changeMonth' => true, 'changeYear' => true, 'showButtonPanel' => true)), true));
     }
     parent::afterConstruct();
 }
开发者ID:OmmuOpenSource,项目名称:OOS-Company-Profile,代码行数:14,代码来源:UserNewsletterHistory.php


示例18: actionView

 /**
  * Displays a particular model.
  * @param integer $id the ID of the model to be displayed
  */
 public function actionView($id = null, $static = null)
 {
     $arrThemes = Utility::getCurrentTemplate('public');
     Yii::app()->theme = $arrThemes['folder'];
     $this->layout = $arrThemes['layout'];
     Utility::applyCurrentTheme($this->module);
     //$this->pageGuest = true;
     if ($id == null) {
         $criteria = new CDbCriteria();
         $criteria->condition = 'publish = :publish';
         $criteria->params = array(':publish' => 1);
         $criteria->order = 'creation_date DESC';
         $dataProvider = new CActiveDataProvider('OmmuPages', array('criteria' => $criteria, 'pagination' => array('pageSize' => 10)));
         $this->pageTitle = '';
         $this->pageDescription = '';
         $this->pageMeta = '';
         $this->render('application.webs.page.front_index', array('dataProvider' => $dataProvider));
     } else {
         if ($static == null) {
             $model = $this->loadModel($id);
             $title = Phrase::trans($model->name, 2);
             $description = Phrase::trans($model->desc, 2);
             $image = $model->media != '' && $model->media_show == 1 ? Yii::app()->request->baseUrl . '/public/page/' . $model->media : '';
         } else {
             $server = Utility::getConnected(Yii::app()->params['server_options']['bpad']);
             if ($server != 'neither-connected') {
                 if (in_array($server, Yii::app()->params['server_options']['localhost'])) {
                     $server = $server . '/bpadportal';
                 }
                 $url = $server . preg_replace('(' . Yii::app()->request->baseUrl . ')', '', Yii::app()->createUrl('api/page/detail'));
                 $item = array('id' => $id);
                 $items = http_build_query($item);
                 $ch = curl_init();
                 curl_setopt($ch, CURLOPT_URL, $url);
                 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
                 //curl_setopt($ch,CURLOPT_HEADER, true);
                 curl_setopt($ch, CURLOPT_POST, true);
                 curl_setopt($ch, CURLOPT_POSTFIELDS, $items);
                 $output = curl_exec($ch);
                 $model = json_decode($output);
             }
             $title = $model->success == '0' ? 'Page not found' : $model->title;
             $description = $model->success == '0' ? '' : $model->description;
             $image = $model->success == '0' ? '' : $model->media_image != '-' ? $model->media_image : '';
         }
         if ($static == null && $model == null || $static != null && $model->success == '0') {
             throw new CHttpException(404, Yii::t('phrase', 'The requested page does not exist.'));
         }
         $this->pageTitleShow = true;
         $this->pageTitle = $title;
         $this->pageDescription = Utility::shortText(Utility::hardDecode($description), 200);
         $this->pageMeta = '';
         $this->pageImage = $image;
         $this->render('application.webs.page.front_view', array('model' => $model, 'a' => $static));
     }
 }
开发者ID:OmmuOpenSource,项目名称:OOS-Company-Profile,代码行数:60,代码来源:PageController.php


示例19: loadModel

 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = ArticleMedia::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, Phrase::trans(193, 0));
     }
     return $model;
 }
开发者ID:OmmuOpenSource,项目名称:Nirwasita,代码行数:13,代码来源:MediaController.php


示例20: beforeSave

 /**
  * before save attributes
  */
 protected function beforeSave()
 {
     if (parent::beforeSave()) {
         $action = strtolower(Yii::app()->controller->action->id);
         $location = strtolower(Yii::app()->controller->id);
         if ($this->isNewRecord) {
             $title = new OmmuSystemPhrase();
             $title->location = $location . '_title';
             $title->en_us = $this->title;
             if ($title->save()) {
                 $this->name = $title->phrase_id;
             }
             $desc = new OmmuSystemPhrase();
             $desc->location = $location . '_description';
             $desc->en_us = $this->description;
             if ($desc->save()) {
                 $this->desc = $desc->phrase_id;
             }
             $quote = new OmmuSystemPhrase();
             $quote->location = $location . '_quotes';
             $quote->en_us = $this->quotes;
             if ($quote->save()) {
                 $this->quote = $quote->phrase_id;
             }
         } else {
             $title = OmmuSystemPhrase::model()->findByPk($this->name);
             $title->en_us = $this->title;
             $title->save();
             $desc = OmmuSystemPhrase::model()->findByPk($this->desc);
             $desc->en_us = $this->description;
             $desc->save();
             if ($this->quote != 0) {
                 $quote = OmmuSystemPhrase::model()->findByPk($this->quote);
                 $quote->en_us = $this->quotes;
                 $quote->save();
             } else {
                 $quote = new OmmuSystemPhrase();
                 $quote->location = $location . '_quotes';
                 $quote->en_us = $this->quotes;
                 if ($quote->save()) {
                     $this->quote = $quote->phrase_id;
                 }
             }
         }
         //upload new photo
         if (in_array($action, array('add', 'edit'))) {
             $page_path = "public/page";
             $this->media = CUploadedFile::getInstance($this, 'media');
             if ($this->media instanceof CUploadedFile) {
                 $fileName = time() . '_' . Utility::getUrlTitle(Phrase::trans($this->name, 2)) . '.' . strtolower($this->media->extensionName);
                 if ($this->media->saveAs($page_path . '/' . $fileName)) {
                     //create thumb image
                     Yii::import('ext.phpthumb.PhpThumbFactory');
                     $pageImg = PhpThumbFactory::create($page_path . '/' . $fileName, array('jpegQuality' => 90, 'correctPermissions' => true));
                     $pageImg->resize(700);
                     if ($pageImg->save($page_path . '/' . $fileName)) {
                         $this->media_show = 1;
                         $this->media_type = 1;
                     }
                     if (!$this->isNewRecord && $this->old_media != '' && file_exists($page_path . '/' . $this->old_media)) {
                         rename($page_path . '/' . $this->old_media, 'public/page/verwijderen/' . $this->page_id . '_' . $this->old_media);
                     }
                     $this->media = $fileName;
                 }
             }
             if (!$this->isNewRecord && $this->media == '') {
                 $this->media = $this->old_media;
             }
         }
     }
     return true;
 }
开发者ID:OmmuOpenSource,项目名称:OOS-Company-Profile,代码行数:75,代码来源:OmmuPages.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP PhraseanetTestCase类代码示例发布时间:2022-05-23
下一篇:
PHP Phprojekt_Loader类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap