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


PHP L::r_item方法代码示例

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


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

示例1: actionConfirmation

 public function actionConfirmation()
 {
     $hash = trim(Yii::app()->request->getParam('hash', null));
     if (!empty($hash) && ($user = User::model()->find('sha(concat(email, "' . Yii::app()->params['salt'] . '")) = :hash', array(':hash' => $hash)))) {
         // Пользователь найден, регистрация окончена
         $user->password_confirm = $user->password;
         $user->status = L::r_item('userStatus', 'active');
         $user->activated = date('Y-m-d H:i:s');
         $user->save();
         if (empty($user->errors)) {
             // добавляю пользователя в RBAC
             $auth = Yii::app()->authManager;
             $auth->assign('user', $user->username);
             $loginForm = new LoginForm();
             $loginForm->username = $user->username;
             $loginForm->password = $user->password;
             $loginForm->login();
             $this->redirect(array('users/view', 'username' => $user->username));
         }
     } elseif (!empty($hash)) {
         Yii::app()->user->setFlash('registration', 'Вы ввели неверный ключ. Попробуйте еще раз.');
     } else {
         Yii::app()->user->setFlash('registration', 'На указанный Вами e-mail было отправленно письмо с кодом подтверждения. Введите его.');
     }
     $this->render('confirmation', array('hash' => $hash));
 }
开发者ID:BGCX261,项目名称:zoomtyre-svn-to-git,代码行数:26,代码来源:UsersController.php

示例2: actionApprove

 public function actionApprove($id)
 {
     if (Yii::app()->request->isPostRequest) {
         // we only allow deletion via POST request
         $model = $this->loadModel($id);
         Comment::model()->updateByPk($id, array('status' => L::r_item('commentStatus', 'approved')));
         $model->updateParentComments();
         // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser
         if (!isset($_GET['ajax'])) {
             $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin'));
         }
     } else {
         throw new CHttpException(400, 'Ошибка запроса. Пожалуйста, не повторяйте этот запрос.');
     }
 }
开发者ID:BGCX261,项目名称:zoomtyre-svn-to-git,代码行数:15,代码来源:CommentsController.php

示例3: actionIndex

 public function actionIndex()
 {
     $cart = Yii::app()->shoppingCart;
     $model = new OrderForm();
     if (Yii::app()->user->isGuest) {
         $model->scenario = 'guest_order';
     } else {
         $user = User::model()->findByPk(Yii::app()->user->name);
         $model->client = Yii::app()->user->name;
         if (!empty($user->client)) {
             $model->name = $user->client->name;
             $model->phone = $user->client->phone;
             $model->email = $user->client->email;
             $model->city = $user->client->city;
             $model->address = $user->client->address;
         }
     }
     if (isset($_POST['OrderForm'])) {
         $model->attributes = $_POST['OrderForm'];
         if ($model->validate()) {
             $order = new Order();
             $order->attributes = $model->attributes;
             $order->created = date('Y-m-d H:i:s');
             $tmp = array();
             $positions = $cart->getPositions();
             foreach ($positions as $k => $position) {
                 $tmp[] = array('item' => preg_split('/_/', $k), 'price' => $position->getPrice(), 'quantity' => $position->getQuantity());
             }
             $order->order = CJSON::encode($tmp);
             $order->status = L::r_item('orderStatus', 'new');
             $order->data = CJSON::encode($order->attributes);
             if ($order->save()) {
                 Yii::app()->getSession()->add('order', $order);
                 $cart->clear();
                 $this->redirect(array('basket/done'));
             } else {
                 $model->addError('error', 'Мы не можем обработать Ваш заказ.');
             }
         }
     }
     $this->render('index', array('model' => $model, 'cart' => $cart));
 }
开发者ID:BGCX261,项目名称:zoomtyre-svn-to-git,代码行数:42,代码来源:BasketController.php

示例4: relations

 /**
  * @return array relational rules.
  */
 public function relations()
 {
     // NOTE: you may need to adjust the relation name and the related
     // class name for the relations automatically generated below.
     return array('model' => array(self::BELONGS_TO, 'Car', 'model_id'), 'characteristic' => array(self::HAS_ONE, 'Characteristic', 'modification_id'), 'comments' => array(self::HAS_MANY, 'Comment', 'object_id', 'condition' => 'comments.type=' . L::r_item('CommentType', __CLASS__)));
 }
开发者ID:BGCX261,项目名称:zoomtyre-svn-to-git,代码行数:9,代码来源:Modification.php

示例5: addComment

 /**
  * Функция добавление комментов 
  */
 protected function addComment(&$model)
 {
     if (isset($_POST['CommentForm'])) {
         $commentForm = new CommentForm();
         $commentForm->attributes = $_POST['CommentForm'];
         if ($commentForm->validate()) {
             Yii::app()->user->setState('CommentForm', null);
             $comment = new Comment();
             $comment->attributes = $_POST['CommentForm'];
             $comment->object_type = L::r_item('CommentType', get_class($model));
             $comment->object_id = $model->id;
             $comment->created = date('Y-m-d H:i:s');
             $comment->rating = 0;
             $comment->status = L::r_item('commentStatus', 'new');
             if ($parent = Comment::model()->findbyPk((int) $commentForm->parent)) {
                 $parent->append($comment);
             } else {
                 $comment->saveNode();
             }
             Yii::app()->user->setFlash('comment', array('text' => 'Спасибо за Ваш комментарий', 'class' => 'error'));
             $this->redirect(Yii::app()->request->requestUri . '#comment-' . $comment->id);
         } else {
             Yii::app()->user->setState('CommentForm', $commentForm);
         }
     } else {
         Yii::app()->user->setState('CommentForm', null);
     }
 }
开发者ID:BGCX261,项目名称:zoomtyre-svn-to-git,代码行数:31,代码来源:Controller.php

示例6: showTyresByModel

 private function showTyresByModel($alias, $season = null, $stud = null)
 {
     $criteria = new CDbCriteria();
     $criteria->condition = 'tyre.alias = :alias';
     $criteria->params = array(':alias' => $alias);
     if (!($model = Tyre::model()->find('alias = :alias', array(':alias' => $alias)))) {
         throw new CHttpException(400, 'Такой страницы нет');
     }
     // Сезонность
     if ($season && L::r_item('tyreSeason', $season)) {
         $criteria->addCondition('tyre.season = ' . L::r_item('tyreSeason', $season));
     }
     // Шипованность
     if ($stud == 'studded') {
         $criteria->addCondition('tyre.stud = 1');
     }
     if ($stud == 'not_studded') {
         $criteria->addCondition('tyre.stud = 0');
     }
     $criteria->addCondition('t.rest <> "0"');
     $criteria->with = array('tyre');
     $dataProvider = new CActiveDataProvider('TyreSizes', array('criteria' => $criteria));
     $this->addComment($model);
     $this->render('tyres/sizes', array('dataProvider' => $dataProvider, 'season' => $season, 'stud' => $stud, 'model' => $model));
 }
开发者ID:BGCX261,项目名称:zoomtyre-svn-to-git,代码行数:25,代码来源:CatalogController.php

示例7: rules

 /**
  * Declares the validation rules.
  * The rules state that username and password are required,
  * and password needs to be authenticated.
  */
 public function rules()
 {
     return array(array('username, password, password_confirm, email, name, phone, city, address', 'required'), array('username', 'unique', 'className' => 'User', 'attributeName' => 'username', 'criteria' => array('condition' => 'status != ' . L::r_item('userStatus', 'not_active'))), array('password', 'compare', 'compareAttribute' => 'password_confirm'), array('email', 'email'), array('verifyCode', 'captcha', 'allowEmpty' => !extension_loaded('gd'), 'captchaAction' => Yii::app()->params['captchaAction']));
 }
开发者ID:BGCX261,项目名称:zoomtyre-svn-to-git,代码行数:9,代码来源:RegistrationForm.php

示例8: actionNomenclature

 public function actionNomenclature()
 {
     ini_set('memory_limit', '650M');
     set_time_limit(0);
     $tyresForm = new ImportForm();
     $result = array();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['ImportForm'])) {
         $tyresForm->attributes = $_POST['ImportForm'];
         if ($tyresForm->validate()) {
             # Вот тут начинается импорт
             Yii::import('ext.markdown.*');
             Yii::import('ext.markdownify.*');
             Yii::import('webroot.helpers.*');
             #$tyresForm->file = CUploadedFile::getInstance($tyresForm, 'file');
             /* Первая страница
              * 1. CAI
              * 2. Производитель
              * 3. Модель
              * 4. Сезон
              * 5. Применяемость
              * 6. Тип протектора
              * 7. Шипованность
              * 8. Ширина профиля(мм)
              * 9. Высота профиля (%)
              * 10. Диаметр (,R)
              * 11. Индекс скорости
              * 12. Индекс нагрузки
              * 13. Цена
              * 14. Фото, большое
              * 15. Фото, мелкое
             */
             $uploaded = Yii::app()->file->set('ImportForm[file]');
             Yii::app()->file->set(Yii::getPathOfAlias('webroot.files.' . $this->id . '.' . $this->action->id))->createDir();
             $newfile = $uploaded->copy(strtolower(Yii::getPathOfAlias('webroot.files.' . $this->id . '.' . $this->action->id)) . '/' . $uploaded->basename);
             $newfile->filename = $newfile->filename . '.' . date('YmdHis');
             Yii::import('ext.phpexcelreader.EPhpExcelReader');
             $data = new EPhpExcelReader($newfile->realpath, false);
             $rowcount = $data->rowcount();
             #$colcount = $data->colcount();
             #$rowcount = 3;
             $r = 2;
             while ($r <= $rowcount) {
                 $producer_alias = EString::strtolower(EString::sanitize($data->val($r, 2)));
                 if (!($producer = TyreProducers::model()->find('alias=:alias', array(':alias' => $producer_alias)))) {
                     $producer = new TyreProducers();
                     @($result['new_producers'] += 1);
                 } else {
                     @($result['old_producers'] += 1);
                 }
                 $producer->title = $data->val($r, 2);
                 $producer->alias = $producer_alias;
                 if (!$producer->save()) {
                     $result['errors']['producer:' . $data->val($r, 1)] = $producer->errors;
                 }
                 $tyre_alias = EString::strtolower(EString::sanitize($data->val($r, 3)));
                 if (!($tyre = Tyre::model()->find('alias=:alias', array(':alias' => $tyre_alias)))) {
                     $tyre = new Tyre();
                     @($result['new_tyres'] += 1);
                 } else {
                     @($result['old_tyres'] += 1);
                 }
                 $tyre->producer_id = $producer->id;
                 $tyre->title = $data->val($r, 3);
                 $tyre->alias = $tyre_alias;
                 $tyre->new = true;
                 $tyre->currency = L::r_item('tyreCurrency', $data->val($r, 5)) ? L::r_item('tyreCurrency', $data->val($r, 5)) : 0;
                 if ($data->val($r, 4) == 'зимние') {
                     $tyre->season = L::r_item('tyreSeason', 'winter');
                 }
                 if ($data->val($r, 4) == 'летние') {
                     $tyre->season = L::r_item('tyreSeason', 'summer');
                 }
                 if ($data->val($r, 4) == 'всесезонные') {
                     $tyre->season = L::r_item('tyreSeason', 'yearround');
                 }
                 $tyre->stud = $data->val($r, 7) ? 1 : 0;
                 $tyre->construction_type = 1;
                 $tyre->runflat_type = 0;
                 // загрузка картинок...
                 $alias = EString::sanitize($producer_alias . '_' . $tyre_alias);
                 $path0 = Yii::getPathOfAlias('webroot.files.' . EString::strtolower('Tyre') . '.' . 'photo') . DIRECTORY_SEPARATOR;
                 $f = false;
                 $tmp_image = str_replace('.jpg', '.png', $data->val($r, 14));
                 if (!empty($tmp_image) && empty($tyre->photo)) {
                     #d($tmp_image);
                     #d($tyre->photo);
                     foreach (Tyre::model()->images['photo']['sizes'] as $key => $size) {
                         $pic = null;
                         // папка в которой будет хранится картинка
                         $path = $path0 . $key . DIRECTORY_SEPARATOR;
                         // создаю папку если ее не было
                         EFile::set($path)->createDir();
                         $pic = @file_get_contents('http://www.4tochki.ru' . $tmp_image);
                         $info = pathinfo($tmp_image);
                         #$row['pic_file'] - 117*(65-88) (лента слева)
                         if (empty($pic)) {
                             continue;
                         }
//.........这里部分代码省略.........
开发者ID:BGCX261,项目名称:zoomtyre-svn-to-git,代码行数:101,代码来源:ImportController.php

示例9: relations

 /**
  * @return array relational rules.
  */
 public function relations()
 {
     // NOTE: you may need to adjust the relation name and the related
     // class name for the relations automatically generated below.
     return array('comments' => array(self::HAS_MANY, 'Comment', 'object_id', 'condition' => 'comments.status != ' . L::r_item('commentStatus', 'blocked') . ' and comments.object_type=' . L::r_item('CommentType', __CLASS__), 'together' => false, 'order' => 'comments.root, comments.lft'));
 }
开发者ID:BGCX261,项目名称:zoomtyre-svn-to-git,代码行数:9,代码来源:News.php

示例10: scopes

 /**
  * @return array of scopes
  */
 public function scopes()
 {
     $db = $this->getDbConnection();
     $alias = $db->quoteColumnName($this->getTableAlias());
     return array('approved' => array('condition' => $alias . '.status=' . L::r_item('CommentStatus', 'approved')), 'notblocked' => array('condition' => $alias . '.status!=' . L::r_item('CommentStatus', 'blocked')), 'recently' => array('order' => $alias . '.created DESC'));
 }
开发者ID:BGCX261,项目名称:zoomtyre-svn-to-git,代码行数:9,代码来源:Comment.php

示例11: relations

 /**
  * @return array relational rules.
  */
 public function relations()
 {
     // NOTE: you may need to adjust the relation name and the related
     // class name for the relations automatically generated below.
     return array('producer' => array(self::BELONGS_TO, 'DiskProducers', 'producer_id'), 'sizes' => array(self::HAS_MANY, 'DiskSizes', 'disk_id', 'joinType' => 'inner join'), 'model' => array(self::BELONGS_TO, 'Car', 'model_id'), 'comments' => array(self::HAS_MANY, 'Comment', 'object_id', 'condition' => 'comments.status != ' . L::r_item('commentStatus', 'blocked') . ' and comments.object_type=' . L::r_item('CommentType', __CLASS__), 'together' => false, 'order' => 'comments.root, comments.lft'));
 }
开发者ID:BGCX261,项目名称:zoomtyre-svn-to-git,代码行数:9,代码来源:Disk.php


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