本文整理汇总了PHP中Phrase::trans方法的典型用法代码示例。如果您正苦于以下问题:PHP Phrase::trans方法的具体用法?PHP Phrase::trans怎么用?PHP Phrase::trans使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Phrase
的用法示例。
在下文中一共展示了Phrase::trans方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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));
}
示例2: 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 = SupportContacts::model()->findByPk($id);
if ($model === null) {
throw new CHttpException(404, Phrase::trans(193, 0));
}
return $model;
}
示例3: actionIndex
/**
* Lists all models.
*/
public function actionIndex()
{
$model = $this->loadModel(1);
$category = new ArticleCategory('search');
$category->unsetAttributes();
// clear any default values
if (isset($_GET['ArticleCategory'])) {
$category->attributes = $_GET['ArticleCategory'];
}
$columnTemp = array();
if (isset($_GET['GridColumn'])) {
foreach ($_GET['GridColumn'] as $key => $val) {
if ($_GET['GridColumn'][$key] == 1) {
$columnTemp[] = $key;
}
}
}
$columns = $category->getGridColumn($columnTemp);
// Uncomment the following line if AJAX validation is needed
$this->performAjaxValidation($model);
if (isset($_POST['ArticleSetting'])) {
$model->attributes = $_POST['ArticleSetting'];
$jsonError = CActiveForm::validate($model);
if (strlen($jsonError) > 2) {
$errors = $model->getErrors();
$summary['msg'] = "<div class='errorSummary'><strong>" . Yii::t('phrase', 'Please fix the following input errors:') . "</strong>";
$summary['msg'] .= "<ul>";
foreach ($errors as $key => $value) {
$summary['msg'] .= "<li>{$value[0]}</li>";
}
$summary['msg'] .= "</ul></div>";
$message = json_decode($jsonError, true);
$merge = array_merge_recursive($summary, $message);
$encode = json_encode($merge);
echo $encode;
} else {
if (isset($_GET['enablesave']) && $_GET['enablesave'] == 1) {
if ($model->update()) {
echo CJSON::encode(array('type' => 0, 'msg' => '<div class="errorSummary success"><strong>' . Phrase::trans(26013, 1) . '</strong></div>'));
} else {
print_r($model->getErrors());
}
}
}
Yii::app()->end();
}
$this->pageTitle = Phrase::trans(26001, 1);
$this->pageDescription = Phrase::trans(26002, 1);
$this->pageMeta = '';
$this->render('admin_index', array('model' => $model, 'category' => $category, 'columns' => $columns));
}
示例4: array
* @var $this MediaController
* @var $model ArticleMedia
* @var $form CActiveForm
*
* @author Putra Sudaryanto <putra.sudaryanto@gmail.com>
* @copyright Copyright (c) 2012 Ommu Platform (ommu.co)
* @link https://github.com/oMMu/Ommu-Articles
* @contact (+62)856-299-4114
*
*/
$this->breadcrumbs = array('Article Medias' => array('manage'), 'Delete');
?>
<?php
$form = $this->beginWidget('application.components.system.OActiveForm', array('id' => 'article-media-form', 'enableAjaxValidation' => true));
?>
<div class="dialog-content">
<?php
echo Phrase::trans(26107, 1);
?>
</div>
<div class="dialog-submit">
<?php
echo CHtml::submitButton(Phrase::trans(26106, 1), array('onclick' => 'setEnableSave()'));
?>
<?php
echo CHtml::button(Phrase::trans(174, 0), array('id' => 'closed'));
?>
</div>
<?php
$this->endWidget();
示例5: actionEdit
/**
* Updates a particular model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id the ID of the model to be updated
*/
public function actionEdit($id)
{
$model = $this->loadModel($id);
// Uncomment the following line if AJAX validation is needed
$this->performAjaxValidation($model);
if (isset($_POST['ReportCategory'])) {
$model->attributes = $_POST['ReportCategory'];
$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('manage'), 'id' => 'partial-report-category', 'msg' => '<div class="errorSummary success"><strong>' . Yii::t('phrase', 'Report category success updated.') . '</strong></div>'));
} else {
print_r($model->getErrors());
}
}
}
Yii::app()->end();
} else {
$this->dialogDetail = true;
$this->dialogGroundUrl = Yii::app()->controller->createUrl('manage');
$this->dialogWidth = 500;
$this->pageTitle = Yii::t('phrase', 'Update Report Category') . ': ' . Phrase::trans($model->name, 2);
$this->pageDescription = '';
$this->pageMeta = '';
$this->render('admin_edit', array('model' => $model));
}
}
示例6: getCategory
/**
* Get category
* 0 = unpublish
* 1 = publish
*/
public static function getCategory($publish = null)
{
$criteria = new CDbCriteria();
if ($publish != null) {
$criteria->compare('t.publish', $publish);
}
$model = self::model()->findAll($criteria);
$items = array();
if ($model != null) {
foreach ($model as $key => $val) {
$items[$val->cat_id] = Phrase::trans($val->name, 2);
}
return $items;
} else {
return false;
}
}
示例7: 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;
}
示例8: 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));
}
}
示例9: 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
}
示例10: 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');
示例11: 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> </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
?>
示例12: 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));
}
}
示例13: date
<?php
echo Phrase::trans(331, 0);
?>
© <?php
echo date("Y") > '2016' ? '2016-' . date("Y") : '2016';
?>
<a href="<?php
echo Yii::app()->createUrl('site/index');
?>
" title="<?php
echo $model->site_title;
?>
"> <?php
echo $model->site_title;
?>
</a>. <?php
echo Phrase::trans(332, 0);
?>
. <span class="powered"><?php
echo Phrase::trans(333, 0);
?>
<a href="http://swevel.com" target="_blank" title="Ommu Platform">Swevel</a> + <a href="http://opensource.ommu.co" target="_blank" title="Ommu Platform">Ommu Platform</a></span>
示例14: actionAjaxCover
/**
* 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 actionAjaxCover($id)
{
if (!isset($_GET['type'])) {
$arrThemes = Utility::getCurrentTemplate('public');
Yii::app()->theme = $arrThemes['folder'];
$this->layout = $arrThemes['layout'];
Utility::applyCurrentTheme($this->module);
}
$model = $this->loadModel($id);
if (Yii::app()->request->isPostRequest) {
// we only allow deletion via POST request
if (isset($id)) {
$model->cover = 1;
if ($model->update()) {
$url = Yii::app()->controller->createUrl('ajaxmanage', array('id' => $model->album_id, 'replace' => 'true'));
echo CJSON::encode(array('type' => 2, 'id' => 'media-render', 'get' => $url));
}
}
} else {
$this->dialogDetail = true;
$this->dialogGroundUrl = Yii::app()->controller->createUrl('admin/edit', array('id' => $model->album_id));
$this->dialogWidth = 350;
$this->pageTitle = Phrase::trans(26105, 1);
$this->pageDescription = '';
$this->pageMeta = '';
$this->render('front_cover');
}
}
示例15: actionDelete
/**
* 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 actionDelete($id)
{
$model = $this->loadModel($id);
if (Yii::app()->request->isPostRequest) {
// we only allow deletion via POST request
if (isset($id)) {
$model->delete();
if (isset($_GET['type']) && $_GET['type'] == 'article') {
echo CJSON::encode(array('type' => 4));
} else {
echo CJSON::encode(array('type' => 5, 'get' => Yii::app()->controller->createUrl('manage'), 'id' => 'partial-article-tag', 'msg' => '<div class="errorSummary success"><strong>' . Phrase::trans(26082, 1) . '</strong></div>'));
}
}
} else {
$this->dialogDetail = true;
if (isset($_GET['type']) && $_GET['type'] == 'article') {
$url = Yii::app()->controller->createUrl('o/admin/edit', array('id' => $model->article_id));
} else {
$url = Yii::app()->controller->createUrl('manage');
}
$this->dialogGroundUrl = $url;
$this->dialogWidth = 350;
$this->pageTitle = Phrase::trans(26081, 1);
$this->pageDescription = '';
$this->pageMeta = '';
$this->render('admin_delete');
}
}