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


PHP Yii::t方法代码示例

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


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

示例1: actionEdit

 public function actionEdit($id)
 {
     $this->pageTitle = Yii::t('app', 'Редактирование категории');
     $model = ShopCategories::model()->findByPk($id);
     if (!$model) {
         throw new CHttpException(404, Yii::t('app', 'Категория не найдена'));
     }
     //var_dump($model->url);die;
     // var_dump($model->path);die;
     //var_dump($model->breadcrumbs);
     //die;
     $this->breadcrumbs = array_merge($this->breadcrumbs, array('Редактирование категории "' . $model->title . '"'));
     $possibleParents = $model->getPossibleParents();
     if (!empty($_POST) && array_key_exists('ShopCategories', $_POST)) {
         $this->performAjaxValidation($model);
         $model->attributes = $_POST['ShopCategories'];
         //var_dump($model->attributes);die;
         if ($model->validate()) {
             if ($model->save()) {
                 Yii::app()->user->setFlash('success', 'Категория "' . $model->title . '" успешно отредактирована');
                 Yii::app()->request->redirect($this->createUrl('index'));
             }
         }
     }
     //var_dump($possibleParents);die;
     $this->render('edit', array('model' => $model, 'possibleParents' => $possibleParents));
 }
开发者ID:Wiedzal,项目名称:narisuemvse,代码行数:27,代码来源:CategoriesController.php

示例2: init

 public function init()
 {
     parent::init();
     if (!$this->items) {
         throw new InvalidConfigException(\Yii::t('front', 'No required parameter given') . ' - items');
     }
 }
开发者ID:czechcamus,项目名称:dasport,代码行数:7,代码来源:ArrayOwlCarousel.php

示例3: run

 /**
  * Renders the content of the widget.
  * @throws CException
  */
 public function run()
 {
     // Hide empty breadcrumbs.
     if (empty($this->links)) {
         return;
     }
     $links = array();
     if (!isset($this->homeLink)) {
         $content = CHtml::link(Yii::t('zii', 'Inicio'), Yii::app()->homeUrl);
         $links[] = $this->renderItem($content);
     } else {
         if ($this->homeLink !== false) {
             $links[] = $this->renderItem($this->homeLink);
         }
     }
     foreach ($this->links as $label => $url) {
         if (is_string($label) || is_array($url)) {
             $content = CHtml::link($this->encodeLabel ? CHtml::encode($label) : $label, $url);
             $links[] = $this->renderItem($content);
         } else {
             $links[] = $this->renderItem($this->encodeLabel ? CHtml::encode($url) : $url, true);
         }
     }
     echo CHtml::tag('ul', $this->htmlOptions, implode('', $links));
 }
开发者ID:VrainSystem,项目名称:Proyecto_PROFIT,代码行数:29,代码来源:TbBreadcrumbs.php

示例4: run

 public function run()
 {
     if (Yii::app()->user->isAuthenticated()) {
         $this->controller->redirect(Url::redirectUrl(Yii::app()->getUser()->getReturnUrl()));
     }
     /**
      * Если было совершено больше 3х попыток входа
      * в систему, используем сценарий с капчей:
      **/
     $badLoginCount = Yii::app()->authenticationManager->getBadLoginCount(Yii::app()->getUser());
     $module = Yii::app()->getModule('user');
     $scenario = $badLoginCount > (int) $module->badLoginCount ? LoginForm::LOGIN_LIMIT_SCENARIO : '';
     $form = new LoginForm($scenario);
     if (Yii::app()->getRequest()->getIsPostRequest() && !empty($_POST['LoginForm'])) {
         $form->setAttributes(Yii::app()->getRequest()->getPost('LoginForm'));
         if ($form->validate() && Yii::app()->authenticationManager->login($form, Yii::app()->getUser(), Yii::app()->getRequest())) {
             Yii::app()->user->setFlash(yupe\widgets\YFlashMessages::SUCCESS_MESSAGE, Yii::t('UserModule.user', 'You authorized successfully!'));
             if (Yii::app()->getUser()->isSuperUser() && $module->loginAdminSuccess) {
                 $redirect = $module->loginAdminSuccess;
             } else {
                 $redirect = empty($module->loginSuccess) ? Yii::app()->getBaseUrl() : $module->loginSuccess;
             }
             $redirect = Yii::app()->getUser()->getReturnUrl($redirect);
             Yii::app()->authenticationManager->setBadLoginCount(Yii::app()->getUser(), 0);
             $this->controller->redirect(Url::redirectUrl($redirect));
         } else {
             $form->addError('email', Yii::t('UserModule.user', 'Email or password was typed wrong!'));
             Yii::app()->authenticationManager->setBadLoginCount(Yii::app()->getUser(), $badLoginCount + 1);
         }
     }
     $this->controller->render($this->id, array('model' => $form));
 }
开发者ID:sepaker,项目名称:yupe,代码行数:32,代码来源:LoginAction.php

示例5: run

 public function run()
 {
     $ids = Yii::app()->request->getParam('id');
     $command = Yii::app()->request->getParam('command');
     empty($ids) && $this->controller->message('error', Yii::t('admin', 'No Select'));
     if (!is_array($ids)) {
         $ids = array($ids);
     }
     $criteria = new CDbCriteria();
     $criteria->addInCondition('id', $ids);
     switch ($command) {
         case 'delete':
             //删除
             Comment::model()->deleteAll($criteria);
             break;
         case 'show':
             //显示
             Comment::model()->updateAll(['status' => Comment::STATUS_SHOW], $criteria);
             break;
         case 'hide':
             //隐藏
             Comment::model()->updateAll(['status' => Comment::STATUS_HIDE], $criteria);
             break;
         default:
             $this->controller->message('error', Yii::t('admin', 'Error Operation'));
     }
     $this->controller->message('success', Yii::t('admin', 'Batch Operate Success'));
 }
开发者ID:jerrylsxu,项目名称:yiifcms,代码行数:28,代码来源:BatchAction.php

示例6: checkEmail

 public function checkEmail($attribute, $params)
 {
     $model = User::model()->find('email = :email', array(':email' => $this->{$attribute}));
     if ($model) {
         $this->addError('email', Yii::t('UserModule.user', 'Email already busy'));
     }
 }
开发者ID:kuzmina-mariya,项目名称:unizaro-kamin,代码行数:7,代码来源:RegistrationForm.php

示例7: loadModel

 public function loadModel($id)
 {
     if (($model = DictionaryGroup::model()->findByPk($id)) === null) {
         throw new CHttpException(404, Yii::t('DictionaryModule.dictionary', 'Requested page was not found'));
     }
     return $model;
 }
开发者ID:kuzmina-mariya,项目名称:4seasons,代码行数:7,代码来源:DictionaryBackendController.php

示例8: getHint

 public function getHint()
 {
     if ($this->owner->isNewRecord || !$this->file) {
         return '';
     }
     return Html::a(Yii::t('app', 'View attached file'), $this->fileUrl, ['target' => '_blank']);
 }
开发者ID:infoweb-internet-solutions,项目名称:yii2-cms,代码行数:7,代码来源:FileBehave.php

示例9: init

 public function init()
 {
     $this->name = \Yii::t('skeeks/shop/app', 'Delivery services');
     $this->modelShowAttribute = "name";
     $this->modelClassName = ShopDelivery::className();
     parent::init();
 }
开发者ID:skeeks-cms,项目名称:cms-shop,代码行数:7,代码来源:AdminDeliveryController.php

示例10: actionRegister

 /**
  * Creates account for new users
  */
 public function actionRegister()
 {
     if (!Yii::app()->user->isGuest) {
         Yii::app()->request->redirect('/');
     }
     $user = new User('register');
     $profile = new UserProfile();
     if (Yii::app()->request->isPostRequest && isset($_POST['User'], $_POST['UserProfile'])) {
         $user->attributes = $_POST['User'];
         $profile->attributes = $_POST['UserProfile'];
         $valid = $user->validate();
         $valid = $profile->validate() && $valid;
         if ($valid) {
             $user->save();
             $profile->save();
             $profile->setUser($user);
             // Add user to authenticated group
             Yii::app()->authManager->assign('Authenticated', $user->id);
             $this->addFlashMessage(Yii::t('UsersModule.core', 'Спасибо за регистрацию на нашем сайте.'));
             // Authenticate user
             $identity = new UserIdentity($user->username, $_POST['User']['password']);
             if ($identity->authenticate()) {
                 Yii::app()->user->login($identity, Yii::app()->user->rememberTime);
                 Yii::app()->request->redirect($this->createUrl('/users/profile/index'));
             }
         }
     }
     $this->render('register', array('user' => $user, 'profile' => $profile));
 }
开发者ID:kolbensky,项目名称:rybolove,代码行数:32,代码来源:RegisterController.php

示例11: init

 public function init()
 {
     $data = array('content' => array(), 'error' => Yii::t('main', 'Модуль отключен.'));
     if (config('forum_threads.allow') == 1) {
         $data = cache()->get(CacheNames::FORUM_THREADS);
         if ($data === FALSE) {
             $data = array();
             try {
                 // Подключаюсь к БД
                 $this->db = Yii::createComponent(array('class' => 'CDbConnection', 'connectionString' => 'mysql:host=' . config('forum_threads.db_host') . ';port=' . config('forum_threads.db_port') . ';dbname=' . config('forum_threads.db_name'), 'enableProfiling' => YII_DEBUG, 'enableParamLogging' => TRUE, 'username' => config('forum_threads.db_user'), 'password' => config('forum_threads.db_pass'), 'charset' => 'utf8', 'emulatePrepare' => TRUE, 'tablePrefix' => config('forum_threads.prefix')));
                 app()->setComponent('ForumThreadsDb', $this->db);
                 $forumType = config('forum_threads.type');
                 if (method_exists($this, $forumType)) {
                     $data['content'] = $this->{$forumType}();
                     foreach ($data['content'] as $k => $v) {
                         $data['content'][$k]['user_link'] = $this->getUserLink($v['starter_id'], $v['starter_name']);
                         $data['content'][$k]['theme_link'] = $this->getForumLink($v['id_topic'], $v['title'], $v['id_forum']);
                         $data['content'][$k]['start_date'] = $this->getStartDate($v['start_date']);
                     }
                     if (config('forum_threads.cache')) {
                         cache()->set(CacheNames::FORUM_THREADS, $data, config('forum_threads.cache') * 60);
                     }
                 } else {
                     $data['error'] = Yii::t('main', 'Метод для обработки форума: :type не найден.', array(':type' => '<b>' . $forumType . '</b>'));
                 }
             } catch (Exception $e) {
                 $data['error'] = $e->getMessage();
             }
         }
     }
     app()->controller->renderPartial('//forum-threads', $data);
 }
开发者ID:mmorpg2015,项目名称:ghtweb5,代码行数:32,代码来源:ForumThreads.php

示例12: actionEdit

 /**
  * Updates a particular model.
  * If update is successful, the browser will be redirected to the 'view' page.
  */
 public function actionEdit()
 {
     $model = $this->loadUser();
     $profile = $model->profile;
     // ajax validator
     if (isset($_POST['ajax']) && $_POST['ajax'] === 'profile-form') {
         echo UActiveForm::validate(array($model, $profile));
         Yii::app()->end();
     }
     if (isset($_POST['User'])) {
         $model->attributes = $_POST['User'];
         $model->image = CUploadedFile::getInstance($model, 'image');
         $profile->attributes = $_POST['Profile'];
         if ($model->validate() && $profile->validate()) {
             $model->save();
             $profile->save();
             Yii::app()->user->updateSession();
             Yii::app()->user->setFlash('profileMessage', Yii::t('main', "Data saved successfully!"));
             $this->redirect(array('/user/profile'));
         } else {
             $profile->validate();
         }
     }
     $this->render('edit', array('model' => $model, 'profile' => $profile));
 }
开发者ID:blrtromax,项目名称:seobility,代码行数:29,代码来源:ProfileController.php

示例13: accessRules

 /**
  * Specifies the access control rules.
  * This method is used by the 'accessControl' filter.
  * @return array access control rules
  */
 public function accessRules()
 {
     if (!Yii::app()->user->checkAccess(Yii::app()->controller->action->id)) {
         throw new CHttpException(401, Yii::t('mds', 'You are prohibited to access this page. Contact Super Administrator'));
     }
     return array(array('allow', 'actions' => array('index', 'view', 'create', 'update', 'admin', 'delete', 'print', 'details', 'bayar', 'PrintDetails', 'bayarkan'), 'users' => array('@')), array('deny', 'users' => array('*')));
 }
开发者ID:nelitaaas,项目名称:Tugas-Besar,代码行数:12,代码来源:PinjamanpegTController.php

示例14: handleRequest

 public function handleRequest($request)
 {
     if (empty($this->catchAll)) {
         list($route, $params) = $request->resolve();
     } else {
         $route = $this->catchAll[0];
         $params = array_splice($this->catchAll, 1);
     }
     try {
         LuLu::trace("Route requested: '{$route}'", __METHOD__);
         $this->requestedRoute = $route;
         $actionsResult = $this->runAction($route, $params);
         $result = $actionsResult instanceof ActionResult ? $actionsResult->result : $actionsResult;
         if ($result instanceof \yii\web\Response) {
             return $result;
         } else {
             $response = $this->getResponse();
             if ($result !== null) {
                 $response->data = $result;
             }
             return $response;
         }
     } catch (InvalidRouteException $e) {
         throw new NotFoundHttpException(Yii::t('yii', 'Page not found.'), $e->getCode(), $e);
     }
 }
开发者ID:cookedsteak,项目名称:lulucms2,代码行数:26,代码来源:BaseApplication.php

示例15: init

 public function init()
 {
     $this->name = \Yii::t('skeeks/shop/app', 'Order statuses');
     $this->modelShowAttribute = "name";
     $this->modelClassName = ShopOrderStatus::className();
     parent::init();
 }
开发者ID:skeeks-cms,项目名称:cms-shop,代码行数:7,代码来源:AdminOrderStatusController.php


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