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


PHP yii::t方法代码示例

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


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

示例1: actionAdd

 public function actionAdd()
 {
     $shipping_id = (int) \yii::$app->request->get('shipping', 0);
     $sql = "SELECT shipping_name,shipping_code FROM " . Shipping::tableName() . " WHERE id={$shipping_id}";
     $shipping = \yii::$app->getDb()->createCommand($sql)->queryOne();
     $set_modules = 1;
     include_once \yii::getAlias('@ext') . '/shipping/' . $shipping['shipping_code'] . '.php';
     $fields = [];
     foreach ($modules[0]['configure'] as $key => $val) {
         $fields[$key]['name'] = $val['name'];
         $fields[$key]['value'] = $val['value'];
         $fields[$key]['label'] = \yii::t('shipping', $val['name']);
     }
     $count = count($fields);
     $fields[$count]['name'] = "freee_money";
     $fields[$count]['value'] = "0";
     $fields[$count]['label'] = \yii::t('shipping', 'free_money');
     //如果支持货到付款,则允许设置货到付款支付费用
     if ($modules[0]['cod']) {
         $count++;
         $fields[$count]['name'] = "pay_fee";
         $fields[$count]['value'] = "0";
         $fields[$count]['label'] = \yii::t('shipping', 'pay_fee');
     }
     $shipping_area['shipping_id'] = 0;
     $shipping_area['free_money'] = 0;
     return $this->render('shipping_area_info', ['shipping_area' => ['shipping_id' => $shipping_id, 'shipping_code' => $shipping['shipping_code']], 'fields' => $fields, 'form_action' => 'insert']);
 }
开发者ID:styleyoung,项目名称:taoshop,代码行数:28,代码来源:ShippingAreaController.php

示例2: admin_log

 /**
  * 记录管理员的操作内容
  *
  * @access  public
  * @param   string      $sn         数据的唯一值
  * @param   string      $action     操作的类型
  * @param   string      $content    操作的内容
  * @return  void
  */
 public static function admin_log($sn = '', $action, $content)
 {
     $log_info = \yii::t('log', $action) . \yii::t('log', $content) . ":" . Html::encode($sn);
     $time = time();
     $sql = "INSERT INTO " . self::tableName() . " (log_time,user_id,log_info,ip_address) " . " VALUES ('{$time}','" . \yii::$app->user->id . "','" . Html::encode($log_info) . "','" . \yii::$app->request->userIP . "')";
     return \yii::$app->getDb()->createCommand($sql)->execute();
 }
开发者ID:styleyoung,项目名称:taoshop,代码行数:16,代码来源:AdminLog.php

示例3: actionUpdate

 public function actionUpdate()
 {
     $pictures = array();
     $lid = Yii::app()->request->getParam('lid');
     Until::isUpdateValid(array($lid), $this->companyId, $this);
     //0,表示企业任何时候都在云端更新。
     $criteria = new CDbCriteria();
     $criteria->with = 'productImg';
     $criteria->addCondition('t.lid=:lid and t.dpid=:dpid and t.delete_flag=0 ');
     $criteria->order = ' t.lid desc ';
     $criteria->params[':lid'] = $lid;
     $criteria->params[':dpid'] = $this->companyId;
     $model = Product::model()->find($criteria);
     if (Yii::app()->request->isPostRequest) {
         $postData = Yii::app()->request->getPost('productImg');
         if (ProductPicture::saveImg($this->companyId, $lid, $postData)) {
             Yii::app()->user->setFlash('success', yii::t('app', '修改成功'));
             $this->redirect(array('productImg/index', 'companyId' => $this->companyId));
         }
     }
     if (!empty($model->productImg)) {
         foreach ($model->productImg as $pic) {
             array_push($pictures, $pic->pic_path);
         }
     }
     $this->render('updateProductImg', array('model' => $model, 'pictures' => $pictures));
 }
开发者ID:song-yuan,项目名称:wymenujp,代码行数:27,代码来源:ProductImgController.php

示例4: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $pageSize = Yii::app()->request->getParam('pageSize', Yii::app()->params['pageSize']);
     Yii::app()->user->setState('pageSize', $pageSize);
     $model = new RejectModel('search');
     $model->unsetAttributes();
     // clear any default values
     //lay mang phone
     $phone = Yii::app()->request->getParam('phone');
     $phoneModel = RejectModel::model()->findByAttributes(array('phone' => $phone));
     if (empty($phoneModel)) {
         $model = new RejectModel();
         $model->phone = $phone;
         try {
             if ($model->save()) {
                 $message = yii::t('SpamModule', 'Success!');
             } else {
                 $message = yii::t('SpamModule', 'Insert fail');
             }
         } catch (Exception $exc) {
             echo $exc->getTrace();
         }
     } else {
         $message = yii::t('SpamModule', 'The number had exists');
     }
     echo $message;
 }
开发者ID:giangnh264,项目名称:mobileplus,代码行数:31,代码来源:RejectController.php

示例5: actionIndex

 public function actionIndex()
 {
     $type = CHtml::encode(Yii::app()->request->getParam('type', 'HOT'));
     $callBack = (int) Yii::app()->request->getParam('call_back', 0);
     $page = (int) Yii::app()->request->getParam('page', 1);
     $limit = Yii::app()->params['numberSongPerPage'];
     if ($this->layout == 'application.views.wap.layouts.main') {
         $limit = Yii::app()->params['numberSongPerPageWap'];
     }
     $count_hot = WapSongModel::countListByCollection('SONG_HOT');
     $songs = WapSongModel::getListByCollection('SONG_HOT', $page, $limit);
     $pager = new CPagination($count_hot);
     $pager->setPageSize($limit);
     $offset = $pager->getOffset();
     $count_new = WapSongModel::countListByCollection('SONG_NEW');
     $songs_new = WapSongModel::getListByCollection('SONG_NEW', $page, $limit);
     $arr_songs = array(array('headerText' => yii::t('wap', 'BÀI HÁT HOT'), 'song' => $songs, 'link' => 'song/list?type=HOT'), array('headerText' => yii::t('wap', 'BÀI HÁT MỚI'), 'song' => $songs_new, 'link' => 'song/list?type=NEW'));
     $callBackLink = Yii::app()->createUrl("song/index", array('type' => $type));
     if ($callBack) {
         $this->layout = false;
         $this->render("_ajaxList", compact('songs', 'pager', 'callBackLink', 'options'));
     } else {
         $userPlaylist = array();
         if ($this->userPhone) {
             $userPlaylist = WapPlaylistModel::model()->getPlaylistByPhone($this->userPhone, $limit, $page);
         }
         $this->render("index", compact('arr_songs', 'pager', 'callBackLink', 'userPlaylist'));
     }
 }
开发者ID:giangnh264,项目名称:mobileplus,代码行数:29,代码来源:SongController.php

示例6: actionLogin

 /**
  * User login
  */
 public function actionLogin()
 {
     if (!\Yii::$app->user->isGuest) {
         return $this->goHome();
     }
     $userDriver = isset(\Yii::$app->params['user_driver']) == true && empty(\Yii::$app->params['user_driver']) == false ? strtolower(\Yii::$app->params['user_driver']) : 'local';
     if ($userDriver == 'ldap') {
         if (isset(\Yii::$app->params['ldap']) == false) {
             throw new \Exception(yii::t('walle', 'the login dirver configs does not defined', array('loginType' => \Yii::$app->params['user_driver'])));
         }
         if (is_array(\Yii::$app->params['ldap']) == false) {
             throw new \Exception(yii::t('walle', 'the login dirver configs parse error', array('loginType' => \Yii::$app->params['user_driver'])));
         }
         $model = new LdapLoginForm(\Yii::$app->params['ldap']);
         if ($model->load(Yii::$app->request->post()) && $model->login()) {
             return $this->goBack();
         } else {
             return $this->render('login', ['isLdapLigin' => true, 'model' => $model]);
         }
     } elseif ($userDriver == 'local') {
         $model = new LoginForm();
         if ($model->load(Yii::$app->request->post()) && $model->login()) {
             return $this->goBack();
         } else {
             return $this->render('login', ['isLdapLigin' => false, 'model' => $model]);
         }
     } else {
         throw new \Exception(yii::t('walle', 'login type could not support', array('loginType' => \Yii::$app->params['user_driver'])));
     }
 }
开发者ID:meolu,项目名称:walle-web,代码行数:33,代码来源:SiteController.php

示例7: renderHtmlInput

 public function renderHtmlInput($input_type_id, $options = [])
 {
     $field = $options['prefix_text'] . " ";
     switch ($input_type_id) {
         case Types::$input_type['small_text']['id']:
             $field .= Html::textInput(sprintf('question_%s', $options['screening_question_id']), '', ['style' => 'width:60px']);
             break;
         case Types::$input_type['med_text']['id']:
             $field .= Html::textInput(sprintf('question_%s', $options['screening_question_id']), '', []);
             break;
         case Types::$input_type['large_text']['id']:
             $field .= Html::textInput(sprintf('question_%s', $options['screening_question_id']), '', ['style' => 'width:240px']);
             break;
         case Types::$input_type['date']['id']:
             $field = sprintf('');
             break;
         case Types::$input_type['radio']['id']:
             // Enable tristate behavior with custom indeterminate value, custom toggle icon, and a custom label for the indeterminate state.
             $options['tristate_option_id'] == Types::$boolean['true']['id'] ? $tristate = true : ($tristate = false);
             $field = Html::radioList(sprintf('question_%s', $options['screening_question_id']), Types::$boolean['null']['id'], [Types::$boolean['true']['description'] => Types::$boolean['true']['description'], Types::$boolean['false']['description'] => Types::$boolean['false']['description']], ['unselect' => Types::$boolean['null']['description'], 'separator' => '   ']);
             break;
         case Types::$input_type['text_agreement']['id']:
         case Types::$input_type['text_agreement']['id']:
             $field = Html::radioList(sprintf('question_%s', $options['screening_question_id']), Types::$boolean['null']['id'], [yii::t('app', 'Agree') => yii::t('app', 'Agree'), yii::t('app', 'Disagree') => yii::t('app', 'Disagree')], ['unselect' => Types::$boolean['null']['description'], 'separator' => '   ']);
             break;
             break;
         case Types::$input_type['image_overlay']['id']:
             $field = sprintf('image overlay');
             break;
     }
     $field .= " " . $options['suffix_text'];
     return $field;
 }
开发者ID:spiro-stathakis,项目名称:projects,代码行数:33,代码来源:ScreeningResponseComponent.php

示例8: validatePassword

 /**
  * Validates the password.
  * This method serves as the inline validation for password.
  *
  * @param string $attribute the attribute currently being validated
  * @param array $params the additional name-value pairs given in the rule
  */
 public function validatePassword($attribute, $params)
 {
     if (!$this->hasErrors()) {
         $user = $this->getUser();
         if (!$user || !$user->validatePassword($this->password)) {
             $this->addError($attribute, yii::t('adminlte', 'Incorrect username or password.'));
         }
     }
 }
开发者ID:cjtterabytesoft,项目名称:yii2-adminlte-basic,代码行数:16,代码来源:LoginForm.php

示例9: moneySingle

 /**
  * 检查货币是否符合规范
  * @param $data 需要检查的字符串 (此值用传址格式传递,当其格式误差不大时会将其修改为货币格式)
  * @param $name 错误提示名
  * @return 成功返回转换后的字符串,否则返回false
  */
 static function moneySingle(&$data = null, $name = 'data')
 {
     if (empty($data)) {
         throw new BeubeuException($name . yii::t('public', "为空"), BeubeuException::FIELD_EMPTY);
     }
     if (!is_numeric($data)) {
         throw new BeubeuException($name . Yii::t('public', '格式不正确'), BeubeuException::FIELD_FORMAT);
     } else {
         $data = number_format($data, 2);
     }
 }
开发者ID:bobwuyan,项目名称:testproject,代码行数:17,代码来源:Comm.php

示例10: getRevision

 public static function getRevision($conf)
 {
     switch ($conf->repo_type) {
         case Project::REPO_GIT:
             return new Git($conf);
         case Project::REPO_SVN:
             return new Svn($conf);
         default:
             throw new \Exception(\yii::t('walle', 'unknown scm'));
             break;
     }
 }
开发者ID:9618211,项目名称:walle-web,代码行数:12,代码来源:Repo.php

示例11: validatePassword

 /**
  * Validates the password.
  * This method serves as the inline validation for password.
  */
 public function validatePassword()
 {
     if (!$this->hasErrors()) {
         $user = $this->getUser();
         if (!$user) {
             return $this->addError('password', yii::t('user', 'inactive or ban'));
         }
         if (!$user->validatePassword($this->password)) {
             return $this->addError('password', yii::t('user', 'password error'));
         }
     }
 }
开发者ID:ashehui,项目名称:walle-web,代码行数:16,代码来源:LoginForm.php

示例12: init

 public function init()
 {
     parent::init();
     if (empty($this->secret)) {
         if (!\yii::$app->has("recaptcha") || empty(\yii::$app->recaptcha->secret)) {
             throw new \yii\base\InvalidConfigException("`secret` param is required");
         }
         $this->secret = \yii::$app->recaptcha->secret;
     }
     if ($this->message === null) {
         $this->message = \yii::t("yii", "The verification code is incorrect.");
     }
 }
开发者ID:alexeevdv,项目名称:yii2-recaptcha-widget,代码行数:13,代码来源:Validator.php

示例13: actionContact

 public function actionContact()
 {
     $model = new ContactForm();
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         if ($model->sendEmail(Yii::$app->params['adminEmail'])) {
             Yii::$app->session->setFlash('success', yii::t('adminlte', 'Thank you for contacting us. We will respond to you as soon as possible.'));
         } else {
             Yii::$app->session->setFlash('error', yii::t('adminlte', 'There was an error sending email.'));
         }
         return $this->refresh();
     } else {
         return $this->render('contact', ['model' => $model]);
     }
 }
开发者ID:cjtterabytesoft,项目名称:yii2-adminlte-basic,代码行数:14,代码来源:SiteController.php

示例14: connect

 /**
  * Connects to our database
  */
 public function connect()
 {
     if (!extension_loaded('mongo')) {
         throw new EMongoException(yii::t('yii', 'We could not find the MongoDB extension ( http://php.net/manual/en/mongo.installation.php ), please install it'));
     }
     try {
         $this->_mongo = new MongoClient($this->connectionString, $this->connectOptions);
         $dbname = $this->db;
         $this->_db = $this->_mongo->{$dbname};
         $this->_db->setWriteConcern($this->options['writeConcerns'], $this->options['wTimeoutMS']);
     } catch (Exception $e) {
         throw new EMongoException(yii::t('yii', 'We could not find the MongoDB extension ( http://php.net/manual/en/mongo.installation.php ), please install it'));
     }
 }
开发者ID:blackdragon199154,项目名称:scryptmail,代码行数:17,代码来源:MongoDBConnection.php

示例15: getSelecter

 public function getSelecter($categoryTree)
 {
     $selecter = '';
     for ($i = 0, $count = count($categoryTree); $i < $count - 1; $i++) {
         $categoties = Helper::getCategories($this->companyId, $categoryTree[$i]);
         $selecter .= '<select class="form-control category_selecter" tabindex="-1" name="category_id_selecter">';
         $selecter .= yii::t('app', '<option value="">--请选择--</option>');
         foreach ($categoties as $c) {
             $selecter .= '<option value="' . $c['lid'] . '" ' . (in_array($c['lid'], $categoryTree) ? 'selected' : '') . '>' . $c['category_name'] . '</option>';
         }
         $selecter .= '</select>';
     }
     return $selecter;
 }
开发者ID:song-yuan,项目名称:wymenujp,代码行数:14,代码来源:ProductCategorySelecter.php


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