Exemple #1
0
 public function run()
 {
     $model = new Soft();
     if (isset($_POST['Soft'])) {
         $model->attributes = $_POST['Soft'];
         //封面、图标、 文件
         $model->cover_image = isset($_POST['cover_image']) ? $_POST['cover_image'] : '';
         $model->soft_icon = isset($_POST['soft_icon']) ? $_POST['soft_icon'] : '';
         $model->soft_file = isset($_POST['soft_file']) ? $_POST['soft_file'] : '';
         //摘要
         $model->introduce = trim($_POST['Soft']['introduce']) ? $_POST['Soft']['introduce'] : Helper::truncate_utf8_string(preg_replace('/\\s+/', ' ', $_POST['Soft']['content']), 200);
         //标签   (前5个标签有效)
         $tags = trim($_POST['Soft']['tags']);
         $unique_tags = array_unique(explode(',', str_replace(array(' ', ','), array('', ','), $tags)));
         $explodeTags = array_slice($unique_tags, 0, 5);
         $model->tags = implode(',', $explodeTags);
         $model->create_time = time();
         $model->update_time = $model->create_time;
         if ($model->save()) {
             $this->controller->message('success', Yii::t('admin', 'Add Success'), $this->controller->createUrl('index'));
         }
     }
     //判断有无栏目
     $article_cat = Catalog::model()->find('type=:type', array(':type' => $this->controller->_type));
     if (!$article_cat) {
         $this->controller->message('error', Yii::t('admin', 'No Catalog'), $this->controller->createUrl('index'));
     }
     $this->controller->render('create', array('model' => $model));
 }
Exemple #2
0
 public function run()
 {
     $model = new Video();
     if (isset($_POST['Video'])) {
         $model->attributes = $_POST['Video'];
         //封面、文件
         $model->cover_image = isset($_POST['cover_image']) ? $_POST['cover_image'] : '';
         $model->video_file = isset($_POST['video_file']) ? $_POST['video_file'] : '';
         //标签   (前5个标签有效)
         $tags = trim($_POST['Video']['tags']);
         $unique_tags = array_unique(explode(',', str_replace(array(' ', ','), array('', ','), $tags)));
         $explodeTags = array_slice($unique_tags, 0, 5);
         $model->tags = implode(',', $explodeTags);
         $model->create_time = time();
         $model->update_time = $model->create_time;
         if ($model->save()) {
             $this->controller->message('success', Yii::t('admin', 'Add Success'), $this->controller->createUrl('index'));
         }
     }
     //判断有无栏目
     $article_cat = Catalog::model()->find('type=:type', array(':type' => $this->controller->_type));
     if (!$article_cat) {
         $this->controller->message('error', Yii::t('admin', 'No Catalog'), $this->controller->createUrl('index'));
     }
     $this->controller->render('create', array('model' => $model));
 }
Exemple #3
0
 /**
  * 浏览详细内容
  */
 public function actionView($id)
 {
     $post = Image::model()->findByPk(intval($id));
     if (false == $post || $post->status == 'N') {
         throw new CHttpException(404, Yii::t('common', 'The requested page does not exist.'));
     }
     //更新浏览次数
     $post->updateCounters(array('view_count' => 1), 'id=:id', array('id' => $id));
     //seo信息
     $this->_seoTitle = empty($post->seo_title) ? $post->title . ' - ' . $this->_setting['site_name'] : $post->seo_title;
     $this->_seoKeywords = empty($post->seo_keywords) ? $post->tags : $post->seo_keywords;
     $this->_seoDescription = empty($post->seo_description) ? $this->_seoDescription : $post->seo_description;
     $catalogArr = Catalog::model()->findByPk($post->catalog_id);
     //加载css,js
     Yii::app()->clientScript->registerCssFile($this->_stylePath . "/css/view.css");
     Yii::app()->clientScript->registerCssFile($this->_static_public . "/js/kindeditor/code/prettify.css");
     Yii::app()->clientScript->registerCssFile($this->_static_public . "/js/discuz/zoom.css");
     Yii::app()->clientScript->registerScriptFile($this->_static_public . "/js/jquery/jquery.js");
     Yii::app()->clientScript->registerScriptFile($this->_static_public . "/js/discuz/common.js");
     Yii::app()->clientScript->registerScriptFile($this->_static_public . "/js/discuz/zoom.js");
     Yii::app()->clientScript->registerScriptFile($this->_static_public . "/js/kindeditor/code/prettify.js", CClientScript::POS_END);
     //最近的图集
     $last_images = Image::model()->findAll(array('condition' => 'catalog_id = ' . $post->catalog_id, 'order' => 'id DESC', 'limit' => 10));
     //nav
     $navs = array();
     $navs[] = array('url' => $this->createUrl('image/view', array('id' => $id)), 'name' => $post->title);
     $tplVar = array('post' => $post, 'navs' => $navs, 'last_images' => $last_images);
     $this->render('view', $tplVar);
 }
 /**
  * 主界面
  */
 public function actionHome()
 {
     //查询课程
     $lessons = Lesson::model()->findAll(array('select' => array('catalog_id', 'arrivals', 'price')));
     //学员活跃度
     $studentAllCount = Student::model()->count();
     $criteria = new CDbCriteria();
     $criteria->distinct = true;
     $criteria->addCondition('is_pays=:is_pay');
     $criteria->params[':is_pay'] = 1;
     $studentActiveCount = StudentLesson::model()->countBySql("SELECT COUNT(DISTINCT student_id) FROM `seed_student_lesson` WHERE is_pay=:is_pay", array(':is_pay' => 1));
     $studentPercentage = round($studentActiveCount / $studentAllCount * 100) . '%';
     //获取课程分类数组
     $catalogs = Catalog::model()->findAllByAttributes(array('parent_id' => 6));
     $allCountLesson = Lesson::model()->count();
     foreach ($catalogs as $catalog) {
         //初始化
         $lessonMoney[$catalog[id]] = 0;
         $allLesson[$catalog[id]] = 0;
         $catalogName[$catalog[catalog_name]] = $catalog[id];
         //各分类中已报名课程和发布课程总量
         $allLesson[$catalog[id]] = Lesson::model()->count("catalog_id=:catalog_id", array(":catalog_id" => $catalog[id]));
         $applyLesson[$catalog[id]] = Lesson::model()->count("catalog_id=:catalog_id AND actual_students<>:actual_students", array(":catalog_id" => $catalog[id], ":actual_students" => 0));
     }
     //成交总金额
     foreach ($lessons as $lesson) {
         $lessonMoney[$lesson[catalog_id]] = (int) $lesson[arrivals] * (int) $lesson[price];
     }
     $this->render('home', array('catalogName' => json_encode($catalogName), 'lessonMoney' => json_encode($lessonMoney), 'allLesson' => json_encode($allLesson), 'applyLesson' => json_encode($applyLesson), 'studentPercentage' => $studentPercentage));
 }
Exemple #5
0
 public function run()
 {
     $model = $this->controller->loadModel();
     if (isset($_POST['Soft'])) {
         $model->attributes = $_POST['Soft'];
         //封面、图标、 文件
         $model->cover_image = isset($_POST['cover_image']) ? $_POST['cover_image'] : '';
         $model->soft_icon = isset($_POST['soft_icon']) ? $_POST['soft_icon'] : '';
         $model->soft_file = isset($_POST['soft_file']) ? $_POST['soft_file'] : '';
         //摘要
         $model->introduce = trim($_POST['Soft']['introduce']) ? $_POST['Soft']['introduce'] : Helper::truncate_utf8_string(preg_replace('/\\s+/', ' ', $_POST['Soft']['content']), 200);
         //标签   (前5个标签有效)
         $tags = trim($_POST['Soft']['tags']);
         $unique_tags = array_unique(explode(',', str_replace(array(' ', ','), array('', ','), $tags)));
         $explodeTags = array_slice($unique_tags, 0, 5);
         $model->tags = implode(',', $explodeTags);
         $model->update_time = time();
         if ($model->save()) {
             $this->controller->message('success', Yii::t('admin', 'Update Success'), $this->controller->createUrl('index'));
         }
     }
     $parents = Catalog::getParantsCatalog($model->catalog_id);
     $catalog = Catalog::model()->findByPk($model->catalog_id);
     $belong = $catalog ? implode('>', $parents) . '>' . $catalog->catalog_name : '';
     $this->controller->render('update', array('model' => $model, 'parents' => $belong));
 }
Exemple #6
0
 public function actionIndex()
 {
     /* 永不超时 */
     ini_set('max_execution_time', 0);
     //生成的crond
     $this->_conf = XXcache::get('_config');
     if (empty($this->_conf['is_cron'])) {
         exit;
     }
     $crond_json_file = SITE_BACKEND_PATH . 'protected/data/crond/crond.json';
     $arr = json_decode(file_get_contents($crond_json_file), TRUE);
     //为1则为完全删除
     $old = empty($arr['old']) ? 0 : 1;
     unset($arr['key'], $arr['old']);
     $arr = array_keys($arr);
     //        XUtils::ppr($arr,1);
     foreach ($arr as $v) {
         switch ($v) {
             case 'header':
                 $min = 1000;
                 $max = 1999;
                 break;
             case 'left':
                 $min = 2000;
                 $max = 2999;
                 break;
             case 'main':
                 $min = 3000;
                 $max = 3999;
                 break;
             case 'shop':
                 $min = 4000;
                 $max = 4999;
                 break;
             case 'fun':
                 $min = 5000;
                 $max = 5999;
                 break;
             case 'tools':
                 $min = 6000;
                 $max = 6999;
                 break;
             case 'games':
                 $min = 7000;
                 $max = 7999;
                 break;
         }
         if (!empty($max) && !empty($min)) {
             $catalog_arr = Catalog::model()->findAll(array('select' => 'id,tb_id', 'condition' => "t.tb_id>:min AND t.tb_id<:max", 'params' => array(':min' => $min, ':max' => $max)));
         }
         if (!empty($catalog_arr)) {
             foreach ($catalog_arr as $info) {
                 $re[$info->tb_id . ',' . $info->id] = $this->doTb($info->tb_id, $info->id, $old);
             }
         }
         //XUtils::ppr($re,1);
     }
     exit('执行完毕');
 }
Exemple #7
0
 public function init()
 {
     parent::init();
     //栏目
     $this->_catalog = Catalog::model()->findAll('status=:status', array('status' => 'Y'));
     //专题
     $this->_special = Special::model()->findAll('status=:status', array('status' => 'Y'));
 }
Exemple #8
0
 protected function getCatalogImage($id)
 {
     $catalog = Catalog::model()->findByPk(intval($id));
     if (!empty($catalog)) {
         return $catalog->image;
     } else {
         return null;
     }
 }
 public function actionSingle($id)
 {
     $model = Catalog::model()->findByPk($id);
     if (!$model) {
         $this->render('/errors/404');
     }
     $rubric = Rubrics::model()->findByPk($model->rubric_id);
     $data = array('data' => $model, 'rubric' => $rubric);
     $this->render('/catalog/single', $data);
 }
 /**
  * 判断数据是否存在
  * 
  */
 public function loadModel()
 {
     if ($this->model === null) {
         if (isset($_GET['id'])) {
             $this->model = Catalog::model()->findbyPk($_GET['id']);
         }
         if ($this->model === null) {
             throw new CHttpException(404, 'The requested page does not exist.');
         }
     }
     return $this->model;
 }
Exemple #11
0
 public function run()
 {
     $model = new Image();
     if (isset($_POST['Image'])) {
         $model->attributes = $_POST['Image'];
         //标题样式
         $title_style = Yii::app()->request->getPost('style');
         if (isset($title_style['bold']) && $title_style['bold'] != 'Y') {
             unset($title_style['bold']);
         }
         if (isset($title_style['underline']) && $title_style['underline'] != 'Y') {
             unset($title_style['underline']);
         }
         if (isset($title_style['color']) && !$title_style['color']) {
             unset($title_style['color']);
         }
         if ($title_style) {
             $model->title_style = serialize($title_style);
         } else {
             $model->title_style = '';
         }
         //封面
         $model->attach_file = isset($_POST['attach_file']) ? $_POST['attach_file'] : '';
         $model->attach_thumb = isset($_POST['attach_thumb']) ? $_POST['attach_thumb'] : '';
         //组图
         $imageList = isset($_POST['imagelist']) ? $_POST['imagelist'] : array();
         if ($imageList) {
             $model->image_list = implode(',', $imageList);
         }
         //标签   (前5个标签有效)
         $tags = trim($_POST['Image']['tags']);
         $unique_tags = array_unique(explode(',', str_replace(array(' ', ','), array('', ','), $tags)));
         $explodeTags = array_slice($unique_tags, 0, 5);
         $model->tags = implode(',', $explodeTags);
         //摘要
         $model->introduce = trim($_POST['Image']['introduce']) ? $_POST['Image']['introduce'] : Helper::truncate_utf8_string(preg_replace('/\\s+/', ' ', $_POST['Image']['content']), 200);
         $model->create_time = time();
         $model->update_time = $model->create_time;
         if ($model->save()) {
             //更新标签数据
             Tag::model()->updateTagData($explodeTags, array('content_id' => $model->id, 'status' => $model->status, 'type_id' => $this->controller->_type_ids['image']));
             $this->controller->message('success', Yii::t('admin', 'Add Success'), $this->controller->createUrl('index'));
         }
     }
     //判断有无栏目
     $article_cat = Catalog::model()->find('type=:type', array(':type' => $this->controller->_type));
     if (!$article_cat) {
         $this->controller->message('error', Yii::t('admin', 'No Catalog'), $this->controller->createUrl('index'));
     }
     $this->controller->render('create', array('model' => $model));
 }
Exemple #12
0
 public function run()
 {
     $catalog_id = trim(Yii::app()->request->getParam('catalog_id'));
     $order = trim(Yii::app()->request->getParam('order'));
     if (!$order) {
         $order = 'id';
     }
     switch ($order) {
         case 'id':
             $order_by = 't.id DESC';
             break;
         case 'view_count':
             $order_by = 'view_count DESC';
             break;
         default:
             $order = 'id';
             $order_by = 't.id DESC';
             break;
     }
     //SEO
     $navs = array();
     $search_cats = '所有';
     if ($catalog_id) {
         $condition = ' AND catalog_id = ' . $catalog_id;
         $catalog = Catalog::model()->findByPk($catalog_id);
         if ($catalog) {
             $this->controller->_seoTitle = $catalog->seo_title ? $catalog->seo_title : $catalog->catalog_name . ' - ' . $this->controller->_setting['site_name'];
             $this->controller->_seoKeywords = $catalog->seo_keywords;
             $this->controller->_seoDescription = $catalog->seo_description;
             $navs[] = array('url' => $this->controller->createUrl('image/index', array('catalog_id' => $catalog->id)), 'name' => $catalog->catalog_name);
             //已搜索的分类
             $cat_parents = Catalog::getParantsCatalog($catalog_id);
             $search_cats = $cat_parents ? implode('>', $cat_parents) . '>' . $catalog->catalog_name : $catalog->catalog_name;
         }
     }
     if (!$navs) {
         $condition = '';
         $catalog = array();
         $seo = ModelType::getSEO('image');
         $this->controller->_seoTitle = $seo['seo_title'] . ' - ' . $this->controller->_setting['site_name'];
         $this->controller->_seoKeywords = $seo['seo_keywords'];
         $this->controller->_seoDescription = $seo['seo_description'];
         $navs[] = array('url' => Yii::app()->request->getUrl(), 'name' => $this->controller->_seoTitle);
     }
     //获取所有符合条件的图集
     $pages = array();
     $datalist = Image::model()->getList(array('condition' => $condition, 'limit' => 15, 'order' => $order_by, 'page' => true), $pages);
     //该栏目下最新的图集
     $last_images = Image::model()->getList(array('condition' => $condition, 'limit' => 10));
     $this->controller->render('index', array('navs' => $navs, 'catalog' => $catalog, 'datalist' => $datalist, 'pagebar' => $pages, 'last_images' => $last_images, 'order' => $order, 'search_cats' => $search_cats));
 }
Exemple #13
0
 public function run()
 {
     $model = $this->controller->loadModel();
     if (isset($_POST['Image'])) {
         $model->attributes = $_POST['Image'];
         //标题样式
         $title_style = Yii::app()->request->getPost('style');
         if (isset($title_style['bold']) && $title_style['bold'] != 'Y') {
             unset($title_style['bold']);
         }
         if (isset($title_style['underline']) && $title_style['underline'] != 'Y') {
             unset($title_style['underline']);
         }
         if (isset($title_style['color']) && !$title_style['color']) {
             unset($title_style['color']);
         }
         if ($title_style) {
             $model->title_style = serialize($title_style);
         } else {
             $model->title_style = '';
         }
         $model->attach_file = isset($_POST['attach_file']) ? $_POST['attach_file'] : '';
         $model->attach_thumb = isset($_POST['attach_thumb']) ? $_POST['attach_thumb'] : '';
         //组图
         $imageList = isset($_POST['imagelist']) ? $_POST['imagelist'] : array();
         if ($imageList) {
             $model->image_list = implode(',', $imageList);
         }
         //标签   (前5个标签有效)
         $tags = trim($_POST['Image']['tags']);
         $unique_tags = array_unique(explode(',', str_replace(array(' ', ','), array('', ','), $tags)));
         $explodeTags = array_slice($unique_tags, 0, 5);
         //摘要
         $model->introduce = trim($_POST['Image']['introduce']) ? $_POST['Image']['introduce'] : Helper::truncate_utf8_string(preg_replace('/\\s+/', ' ', $_POST['Image']['content']), 200);
         $model->tags = implode(',', $explodeTags);
         $model->update_time = time();
         if ($model->save()) {
             //更新标签数据
             Tag::model()->updateTagData($explodeTags, array('content_id' => $model->id, 'status' => $model->status, 'type_id' => $this->controller->_type_ids['image']));
             $this->controller->message('success', Yii::t('admin', 'Update Success'), $this->controller->createUrl('index'));
         }
     } else {
         $imageList = $model->image_list ? explode(',', $model->image_list) : array();
         $style = unserialize($model->title_style);
     }
     $parents = Catalog::getParantsCatalog($model->catalog_id);
     $catalog = Catalog::model()->findByPk($model->catalog_id);
     $belong = $catalog ? implode('>', $parents) . '>' . $catalog->catalog_name : '';
     $this->controller->render('update', array('model' => $model, 'imageList' => $imageList, 'style' => $style, 'parents' => $belong));
 }
Exemple #14
0
 /**
  * 首页
  */
 public function actionIndex()
 {
     $catalog_id = trim($this->_request->getParam('catalog_id'));
     $order = trim($this->_request->getParam('order'));
     $keyword = trim($this->_request->getParam('keyword'));
     if (!$order) {
         $order = 'id';
     }
     switch ($order) {
         case 'id':
             $order_by = 't.id DESC';
             break;
         case 'view_count':
             $order_by = 'view_count DESC';
             break;
         default:
             $order = 'id';
             $order_by = 't.id DESC';
             break;
     }
     //获取子孙分类(包括本身)
     $data = Catalog::model()->getChildren($catalog_id);
     $catalog = $data['catalog'];
     $db_in_ids = $data['db_in_ids'];
     //SEO
     $navs = array();
     if ($catalog) {
         $this->_seoTitle = $catalog->seo_title ? $catalog->seo_title : $catalog->catalog_name . ' - ' . $this->_setting['site_name'];
         $this->_seoKeywords = $catalog->seo_keywords;
         $this->_seoDescription = $catalog->seo_description;
         $navs[] = array('url' => $this->createUrl('post/index', array('catalog_id' => $catalog->id)), 'name' => $catalog->catalog_name);
     } else {
         $seo = ModelType::getSEO('post');
         $this->_seoTitle = $seo['seo_title'] . ' - ' . $this->_setting['site_name'];
         $this->_seoKeywords = $seo['seo_keywords'];
         $this->_seoDescription = $seo['seo_description'];
         $navs[] = array('url' => $this->_request->getUrl(), 'name' => $this->_seoTitle);
     }
     //获取所有符合条件的文章
     $condition = '';
     $catalog && ($condition .= ' AND catalog_id IN (' . $db_in_ids . ')');
     $datalist = Post::model()->getList(array('condition' => $condition, 'limit' => 15, 'order' => $order_by, 'page' => true), $pages);
     //该栏目下最新的文章
     $last_posts = Post::model()->getList(array('condition' => $condition, 'limit' => 10));
     //加载css,js
     Yii::app()->clientScript->registerCssFile($this->_stylePath . "/css/list.css");
     Yii::app()->clientScript->registerScriptFile($this->_static_public . "/js/jquery/jquery.js");
     $this->render('index', array('navs' => $navs, 'catalog' => $catalog, 'posts' => $datalist, 'pagebar' => $pages, 'tags' => $tags, 'last_posts' => $last_posts, 'order' => $order));
 }
Exemple #15
0
 public function actionCreateInner()
 {
     parent::_acl();
     //内页主类
     $innerCatalog = Catalog::model()->findAll("`status_is`='Y' AND `parent_id`='2'");
     //        ppr($innerCatalog,1);
     $page_arr = null;
     if (!empty($innerCatalog)) {
         foreach ($innerCatalog as $pageInfo) {
             $page_arr[$pageInfo->id] = array('name' => $pageInfo->catalog_name, 'path' => $pageInfo->path, 'error' => 0);
             try {
                 if (FALSE === strpos($pageInfo->path, 'http:')) {
                     if (empty($pageInfo->path)) {
                         $page_arr[$pageInfo->id]['error'] = '目录名未填写';
                         continue;
                     }
                     preg_match_all("/\\w+/", $pageInfo->path, $re);
                     if (empty($re[0][0])) {
                         $page_arr[$pageInfo->id]['error'] = '目录名只能是字母数字下划线';
                         continue;
                     }
                     $dir = SITE_PATH . substr($this->_conf['path_inside_page'], 1) . '/' . $re[0][0] . '/';
                     if (!is_dir($dir)) {
                         mkdir($dir);
                         if (!is_writable($dir)) {
                             $page_arr[$pageInfo->id]['error'] = '目录写入失败';
                             continue;
                         }
                     }
                     //                        ppr($pageInfo);ppr($this->_getDataPid($pageInfo->id));
                     $links = $this->_getDataPid($pageInfo->id);
                     //                        ppr($links);
                     //统一内页模板
                     $code = $this->render($this->_conf['theme'] . '/inner', array('info' => $pageInfo, 'links' => $links, 'innerCatalog' => $innerCatalog), 1);
                     $filename_html = $dir . 'index.html';
                     $filename_htm = $dir . 'index.htm';
                     file_put_contents($filename_html, $code, LOCK_EX);
                     file_put_contents($filename_htm, $code, LOCK_EX);
                 } else {
                     $page_arr[$pageInfo->id]['error'] = '已设置' . '<a href=' . $pageInfo->path . ' target="blank">外链</a>';
                 }
             } catch (Exception $exc) {
                 continue;
             }
         }
         return $page_arr;
     }
 }
Exemple #16
0
 public function init()
 {
     parent::init();
     if (isset($_POST['sessionId'])) {
         $session = Yii::app()->getSession();
         $session->close();
         $session->sessionID = $_POST['sessionId'];
         $session->open();
     }
     $this->_admini = parent::_sessionGet('_admini');
     if (empty($this->_admini['userId'])) {
         $this->redirect(array('public/login'));
     }
     //栏目
     $this->_catalog = Catalog::model()->findAll();
 }
 public function actionIndex()
 {
     $client = new Client();
     $catalogs = Catalog::model()->findAll(array('condition' => "status='ACTIVE'", 'order' => 'category'));
     $pictures = [];
     $files = [];
     $medio = 'default';
     if (isset($_GET["medio"])) {
         $medio = $_GET["medio"];
     }
     foreach ($catalogs as $i => $catalog) {
         $pictures[$catalog->id] = $catalog->vehicle->pictures[0]->description;
         $files[$catalog->id] = $catalog->file;
     }
     $this->render('index', array("catalogs" => $catalogs, 'client' => $client, 'pictures' => $pictures, 'files' => $files, 'medio' => $medio));
 }
Exemple #18
0
 public function renderNav($roots)
 {
     echo CHtml::openTag('ul', array('class' => $this->rootUlCss, 'id' => $this->id)) . "\n";
     foreach ($roots as $root) {
         $a = Catalog::model()->findByPk($root);
         echo CHtml::openTag('li');
         echo CHtml::openTag('a', array('href' => Yii::app()->createUrl("/post/post/index", array("catalog" => $a->url))));
         echo CHtml::openTag('span');
         echo CHtml::encode($a->name);
         echo CHtml::closeTag('span');
         echo CHtml::closeTag('a');
         echo CHtml::closeTag('span');
         $level = 0;
         $catalogs = Catalog::model()->findByPk($a->id)->children()->findAll();
         foreach ($catalogs as $n => $catalog) {
             // echo CHtml::openTag('ul',array('class'=>$this->childULCss)) . "\n";
             if ($catalog->level == $level) {
                 echo CHtml::closeTag('li') . "\n";
             } else {
                 if ($catalog->level > $level) {
                     echo CHtml::openTag('ul', array('class' => $this->childULCss)) . "\n";
                 } else {
                     echo CHtml::closeTag('li') . "\n";
                     for ($i = $level - $catalog->level; $i; $i--) {
                         echo CHtml::closeTag('ul') . "\n";
                         echo CHtml::closeTag('li') . "\n";
                     }
                 }
             }
             echo CHtml::openTag('li');
             echo CHtml::openTag('a', array('href' => Yii::app()->createUrl("/post/post/index", array("catalog" => $catalog->url))));
             echo CHtml::openTag('span');
             echo CHtml::encode($catalog->name);
             echo CHtml::closeTag('span');
             echo CHtml::closeTag('a');
             $level = $catalog->level;
         }
         for ($i = $level; $i; $i--) {
             echo CHtml::closeTag('li') . "\n";
             echo CHtml::closeTag('ul') . "\n";
         }
         // echo CHtml::closeTag('li') . "\n";
     }
 }
 /**
  * 主界面
  */
 public function actionHome()
 {
     //查询课程
     $lessons = Lesson::model()->findAll(array('select' => array('catalog_id', 'arrivals', 'price')));
     //学员活跃度
     $studentAllCount = Student::model()->count();
     $studentActiveCount = StudentLesson::model()->countBySql("SELECT COUNT(DISTINCT student_id) FROM `seed_student_lesson` WHERE is_pay=:is_pay", array(':is_pay' => 1));
     $studentPercentage = @round($studentActiveCount / $studentAllCount * 100) . '%';
     //学员月活跃度
     $time = date('Y-m', time());
     for ($i = -1; $i < 8; $i++) {
         $m = date('m', time());
         $m = $m - $i - 1;
         $ii = $i + 1;
         $startTime[$m] = date('Y-m-d H:i:s', strtotime("{$time} -{$ii} month"));
         $endTime[$m] = date('Y-m-d H:i:s', strtotime("{$time} -{$i} month"));
         $sMoAcCount[$m] = StudentLesson::model()->countBySql("SELECT COUNT(DISTINCT student_id) FROM `seed_student_lesson` WHERE is_pay=:is_pay AND pay_time>=:start_time AND pay_time<:end_time", array(':is_pay' => 1, ':start_time' => $startTime[$m], ':end_time' => $endTime[$m]));
         $sAllMoAcCount[$m] = Student::model()->countBySql('SELECT COUNT(id) FROM `seed_student` WHERE register_time>=:start_time AND register_time<:end_time', array(':start_time' => $startTime[$m], ':end_time' => $endTime[$m]));
         if ($sAllMoAcCount[$m] == 0) {
             $sMoPercentage[$m] = "0%";
         } else {
             $sMoPercentage[$m] = round($sMoAcCount[$m] / $sAllMoAcCount[$m] * 100) . '%';
         }
     }
     //获取课程分类数组
     $catalogs = Catalog::model()->findAllByAttributes(array('parent_id' => 6));
     $allCountLesson = Lesson::model()->count();
     foreach ($catalogs as $catalog) {
         //初始化
         $lessonMoney[$catalog[id]] = 0;
         $allLesson[$catalog[id]] = 0;
         $catalogName[$catalog[catalog_name]] = $catalog[id];
         //各分类中已报名课程和发布课程总量
         $allLesson[$catalog[id]] = Lesson::model()->count("catalog_id=:catalog_id", array(":catalog_id" => $catalog[id]));
         $applyLesson[$catalog[id]] = Lesson::model()->count("catalog_id=:catalog_id AND actual_students<>:actual_students", array(":catalog_id" => $catalog[id], ":actual_students" => 0));
     }
     //成交总金额
     foreach ($lessons as $lesson) {
         $lessonMoney[$lesson[catalog_id]] = (int) $lesson[arrivals] * (int) $lesson[price];
     }
     $this->render('home', array('catalogName' => json_encode($catalogName), 'lessonMoney' => json_encode($lessonMoney), 'allLesson' => json_encode($allLesson), 'applyLesson' => json_encode($applyLesson), 'studentPercentage' => $studentPercentage, 'sMoPercentage' => $sMoPercentage));
 }
Exemple #20
0
 /**
  * 栏目分类
  */
 private function categorySitemap()
 {
     $criteria = new CDbCriteria();
     $criteria->condition = 'status=:status';
     $criteria->params = array(':status' => 'Y');
     $criteria->order = 'id ASC';
     $result = Catalog::model()->findAll($criteria);
     foreach ($result as $k => $v) {
         switch ($v->type) {
             case 1:
                 $type = 'post';
                 break;
             case 2:
                 $type = 'image';
                 break;
             case 3:
                 $type = 'soft';
         }
         $this->categoryItems[] = array('url' => $this->createUrl($type . '/index', array('catalog_id' => $v->id)), 'date' => date(DATE_W3C, $v->update_time));
     }
 }
    public function get_specials($specials = '')
    {
        $model = Catalog::model()->findAllByAttributes(array('field_varname' => 'specials'));
        $list = CHtml::listData($model, 'id', 'cat_name');
        $arr = explode(',', $specials);
        $sizenumber = count($list);
        $select = '
			<select class="select-specilization" name="Profile[specials]" id="Profile[specials]" multiple size="' . $sizenumber . '">
			<option value="" disabled>' . ProjectModule::t('UseCtrlForMultiselect') . '</option>
			<optgroup label="' . ProjectModule::t('All') . '">' . ProjectModule::t('All') . '</optgroup>
		';
        foreach ($list as $key => $opt) {
            $select .= '<option value="' . $key . '"';
            if (in_array($key, $arr)) {
                $select .= ' selected="selected"';
            }
            $select .= '>' . Yii::t('project', $opt) . '</option>';
        }
        $select .= '</select>';
        return $select;
    }
Exemple #22
0
 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':
             //删除
             Catalog::model()->deleteAll($criteria);
             break;
         case 'sortOrder':
             $sortOrder = $_POST['sortOrder'];
             foreach ((array) $ids as $id) {
                 $catalogModel = Catalog::model()->findByPk($id);
                 if ($catalogModel) {
                     $catalogModel->sort_order = $sortOrder[$id];
                     $catalogModel->save();
                 }
             }
             break;
         case 'show':
             //显示
             Catalog::model()->updateAll(['status' => 'Y'], $criteria);
             break;
         case 'hidden':
             //隐藏
             Catalog::model()->updateAll(['status' => 'N'], $criteria);
             break;
         default:
             $this->controller->message('error', Yii::t('admin', 'Error Operation'));
     }
     $this->controller->message('success', Yii::t('admin', 'Batch Operate Success'));
 }
Exemple #23
0
 /**
  * 商品详情
  * @param unknown $id
  * @throws CHttpException
  */
 public function actionView($id)
 {
     $good = Goods::model()->findByPk(intval($id));
     if (false == $good || $good->status == 'N') {
         throw new CHttpException(404, Yii::t('common', 'The requested page does not exist.'));
     }
     // seo信息
     $this->_seoTitle = empty($good->seo_title) ? $good->goods_name . ' - ' . $this->_setting['site_name'] : $good->seo_title;
     $this->_seoKeywords = empty($good->seo_keywords) ? $this->_seoKeywords : $good->seo_keywords;
     $this->_seoDescription = empty($good->seo_description) ? $this->_seoDescription : $good->seo_description;
     $catalogArr = Catalog::model()->findByPk($good->catalog_id);
     //更新浏览次数
     $good->updateCounters(array('views' => 1), 'id=:id', array('id' => $id));
     // 加载css,js
     Yii::app()->clientScript->registerCssFile($this->_stylePath . "/css/view.css");
     Yii::app()->clientScript->registerScriptFile($this->_static_public . "/js/jquery/jquery.js");
     // 最近的商品
     $last_goods = Goods::model()->findAll(array('condition' => 'catalog_id = ' . $good->catalog_id, 'order' => 'id DESC', 'limit' => 10));
     // nav
     $navs = array();
     $navs[] = array('url' => $this->createUrl('goods/view', array('id' => $id)), 'name' => $good->goods_name);
     $tplVar = array('good' => $good, 'navs' => $navs, 'last_goods' => $last_goods);
     $this->render('view', $tplVar);
 }
 /**
  * 新增数据
  *
  */
 public function actionCreate()
 {
     $model = new Post();
     if (isset($_POST['Post'])) {
         $model->attributes = $_POST['Post'];
         //标题样式
         $title_style = $this->_request->getPost('style');
         if ($title_style['bold'] != 'Y') {
             unset($title_style['bold']);
         }
         if ($title_style['underline'] != 'Y') {
             unset($title_style['underline']);
         }
         if (!$title_style['color']) {
             unset($title_style['color']);
         }
         if ($title_style) {
             $model->title_style = serialize($title_style);
         } else {
             $model->title_style = '';
         }
         if ($_FILES['attach']['error'] == UPLOAD_ERR_OK) {
             //封面图片
             $upload = new Uploader();
             $upload->_thumb_width = 100;
             $upload->_thumb_height = 100;
             $upload->uploadFile($_FILES['attach'], true);
             if ($upload->_error) {
                 $upload->deleteFile($upload->_file_name);
                 $upload->deleteFile($upload->_thumb_name);
                 $this->message('error', Yii::t('admin', $upload->_error));
                 return;
             }
             $model->attach_file = $upload->_file_name;
             $model->attach_thumb = $upload->_thumb_name;
         } else {
             //未改变前的封面图片
             $model->attach_file = $_POST['old_file'];
             $model->attach_thumb = $_POST['old_thumb'];
         }
         //组图
         $imageList = $this->_request->getPost('imageList');
         $imageListSerialize = $this->imageListSerialize($imageList);
         $model->image_list = $imageListSerialize['dataSerialize'];
         //标签(只要前10个标签)
         $tags = trim($_POST['Post']['tags']);
         $explodeTags = array_unique(explode(',', str_replace(array(' ', ','), array('', ','), $tags)));
         $explodeTags = array_slice($explodeTags, 0, 10);
         $model->tags = implode(',', $explodeTags);
         //摘要
         $model->introduce = trim($_POST['Post']['introduce']) ? $_POST['Post']['introduce'] : Helper::truncate_utf8_string(preg_replace('/\\s+/', ' ', $_POST['Post']['content']), 200);
         $model->create_time = time();
         $model->update_time = $model->create_time;
         if ($model->save()) {
             //更新标签数据
             Tag::model()->updateTagData($explodeTags, array('content_id' => $model->id, 'status' => $model->status, 'type_id' => $this->_type_ids['post']));
             $this->message('success', Yii::t('admin', 'Add Success'), $this->createUrl('index'));
         }
     }
     //判断有无文章栏目
     $article_cat = Catalog::model()->find('type=:type', array(':type' => $this->_type));
     if (!$article_cat) {
         $this->message('error', Yii::t('admin', 'No Catalog'), $this->createUrl('index'));
     }
     $this->render('update', array('model' => $model));
 }
 public function yiichat_post($chat_id, $identity, $message, $postdata, $data)
 {
     $this->_chat_id = $chat_id;
     $this->_identity = $identity;
     $this->_data = $data;
     $message_filtered = trim($this->acceptMessage($message));
     if ($message_filtered != "") {
         $obj = array("order" => $chat_id, "sender" => $identity, "date" => date('Y-m-d H:i:s'), "message" => $message_filtered);
         $order = Zakaz::model()->findByPk($chat_id);
         if ($postdata['index'] == 0) {
             if ($postdata['recipient'] == 'Author') {
                 $obj['recipient'] = $order->attributes['executor'];
                 if ($obj['recipient'] == 0) {
                     $obj['recipient'] = -1;
                 }
             } elseif ($postdata['recipient'] == 'Customer') {
                 $obj['recipient'] = $order->attributes['user_id'];
                 /*} elseif (isset($postdata['recipient'])){
                 		$obj['recipient'] = $postdata['recipient'];*/
             } else {
                 $obj['recipient'] = 0;
             }
             $newid = $this->getDb()->createCommand()->insert($this->getTableName(), $obj);
         } else {
             if ($postdata['recipient'] == 'no') {
                 $obj['recipient'] = 0;
                 $newid = $this->getDb()->createCommand()->update($this->getTableName(), $obj, 'id=:id', array('id' => $postdata['index']));
             } else {
                 if ($postdata['recipient'] == 'redir') {
                     $sender = ProjectMessages::model()->findByPk($postdata['index'])->senderObject->AuthAssignment['itemname'];
                     $obj['sender'] = ProjectMessages::model()->findByPk($postdata['index'])->attributes['sender'];
                     $obj['moderated'] = 1;
                     if ($sender == 'Customer') {
                         $obj['recipient'] = $order->attributes['executor'];
                     }
                     if ($sender == 'Author') {
                         $obj['recipient'] = $order->attributes['user'];
                     }
                     $newid = $this->getDb()->createCommand()->insert($this->getTableName(), $obj);
                 } else {
                     if ($postdata['recipient'] == 'Customer') {
                         $obj['recipient'] = $order->attributes['user_id'];
                     }
                     if ($postdata['recipient'] == 'Author') {
                         $obj['recipient'] = $order->attributes['executor'];
                     }
                     if (is_numeric($postdata['recipient'])) {
                         $obj['recipient'] = $postdata['recipient'];
                     }
                     $newid = $this->getDb()->createCommand()->insert($this->getTableName(), $obj);
                 }
             }
         }
         // now retrieve the post
         $obj['recipient'] = User::model()->findByPk($obj['recipient']);
         $obj['recipient']->superuser = $obj['recipient']->getRelated('AuthAssignment');
         $obj['sender'] = User::model()->findByPk($obj['sender']);
         $obj['sender']->superuser = $obj['sender']->getRelated('AuthAssignment');
         $title = Catalog::model()->findByPk($order->specials)->cat_name . '. ' . $order->attributes['title'] . '. ' . Yii::t('site', 'You have received a new message.');
         $message = CHtml::link(Yii::t('site', 'Link to order page'), Yii::app()->createAbsoluteUrl('/project/chat', array('orderId' => $chat_id))) . '<br />' . $obj['message'];
         $headers = 'From: no-reply@' . $_SERVER['SERVER_NAME'] . "\r\n" . 'Reply-To: no-reply@' . $_SERVER['SERVER_NAME'] . "\r\n" . 'Content-Type: text/html; charset=utf-8;' . 'X-Mailer: PHP/' . phpversion();
         mail($obj['recipient']->attributes['email'], $title, $message, $headers);
         if ($postdata['flags']) {
             foreach ($postdata['flags'] as $v) {
                 switch ($v) {
                     case 'send_sms':
                         include_once "smsc_api.php";
                         list($sms_id, $sms_cnt, $cost, $balance) = send_sms(str_replace(['+', '-'], '', $obj['recipient']->profile->attributes['mob_tel']), $obj['message']);
                         break;
                     case 'send_email':
                         mail($obj['recipient']->attributes['email'], 'You receive new message in chat', $obj['message']);
                         break;
                 }
             }
         }
         $obj['time'] = date_format(date_create($obj['date']), 'd.m.Y H:i:s');
         $obj['owner'] = substr($this->getIdentityName(), 0, 20);
         return $obj;
     } else {
         return array();
     }
 }
    echo '<br>';
    echo $form->labelEx($model, 'title');
    echo $form->textField($model, 'title', array('size' => 70, 'maxlength' => 255));
    echo $form->error($model, 'title');
    echo '<br>';
    echo $form->labelEx($model, 'text');
    echo $form->textArea($model, 'text', array('rows' => 6, 'cols' => 70));
    echo $form->error($model, 'text');
} else {
    $projectFields = $model->getFields();
    if ($projectFields) {
        foreach ($projectFields as $field) {
            echo '<div class="form-group">';
            echo $form->labelEx($model, $field->varname) . '<br/>';
            if ($field->field_type == "LIST") {
                $models = Catalog::model()->findAllByAttributes(array('field_varname' => $field->varname));
                $list = CHtml::listData($models, 'id', 'cat_name');
                echo $form->dropDownList($model, $field->varname, $list, array('empty' => ProjectModule::t('Select a category'), 'class' => 'form-control'));
                echo $form->error($model, $field->varname);
            } elseif ($field->field_type == "TEXT") {
                echo $form->textArea($model, $field->varname, array('rows' => 6, 'cols' => 50, 'class' => 'form-control'));
            } elseif ($field->field_type != "TIMESTAMP") {
                echo $form->textField($model, $field->varname, array('size' => 60, 'maxlength' => $field->field_size ? $field->field_size : 255, 'class' => 'form-control'));
            }
            echo '</div>';
        }
    }
}
?>
                                        <h3> <?php 
echo ProjectModule::t('Deadlines');
    $projectFields = $model->getFields();
    if ($projectFields) {
        foreach ($projectFields as $field) {
            if ($work_type === false || $field->work_types == null || in_array($work_type, explode(',', $field->work_types))) {
                if ($field->field_type == "BOOL") {
                    $tmp = $field->varname;
                    $tmp = $model->{$tmp};
                    if ($tmp) {
                        $tmp = ProjectModule::t('Yes');
                    } else {
                        $tmp = ProjectModule::t('No');
                    }
                    $columns[] = ['label' => $field->title, 'value' => $tmp];
                } elseif ($field->field_type == "LIST") {
                    $tmp = $field->varname;
                    $columns[] = ['label' => $field->title, 'type' => 'raw', 'value' => Catalog::model()->findByPk($model->{$tmp})->cat_name];
                } else {
                    $tmp = $field->varname;
                    $columns[] = ['label' => $field->title, 'value' => $model->{$tmp}];
                }
            }
        }
    }
    $this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => $columns));
    ?>
	<br>
	<form method="post"
		  action="<?php 
    echo Yii::app()->createUrl('project/zakaz/moderationAnswer', array('id' => $model->id, 'event_id' => $event->id, 'answer' => 1));
    ?>
"
Exemple #28
0
function getTreeCheckbox($model, $catalogs, $setCat = array(), $ulId = 'tree')
{
    $cats = Catalog::model()->with('fields')->findAll();
    $js_cats_list = array();
    foreach ($cats as $cat) {
        $fields = array();
        foreach ($cat->fields as $field) {
            array_push($fields, $field->varname);
        }
        array_push($js_cats_list, $cat->id . ':[\'' . implode('\',\'', $fields) . '\']');
    }
    $basePath = Yii::getPathOfAlias('application.modules.cart.views.asset');
    $baseUrl = Yii::app()->getAssetManager()->publish($basePath);
    $cs = Yii::app()->getClientScript();
    $cs->registerCoreScript('jquery');
    $css = '
			/* Catalog Tree */
			#tree {
	    		list-style: none;
				padding-left:1em;
	    	}
			#tree ul {
	    		list-style: none;
				padding-left: 2em;
	    	}
			#tree input {
				margin-right: .5em;
			}
			div.form li label {
				display:inline;
			}
		';
    $js = '
			$(document).ready(function(){
				var cats_list = {' . implode(',', $js_cats_list) . '};
				
				$("#tree input").click(function(){
					if (this.checked) {
						$(this).parents("li").children("input").attr("checked", "checked");
					} else {
						$(this).parent("li").find("input").removeAttr("checked");
					}
					showFields();
    			});
    			showFields();
    			
    			function showFields() {
    				$(".fields").addClass(\'tohide\').removeClass(\'toshow\');
    				
    				$("#tree input:checked").each(function(){
    					var cat_id = $(this).attr(\'id\').replace(\'Product_catalogs_\',\'\');
    					if (cats_list[cat_id]) {
    						for (var k in cats_list[cat_id]) {
    							$(\'.\'+cats_list[cat_id][k]).addClass(\'toshow\').removeClass(\'tohide\')
    						}
    					}
    				});
					
					$(\'div.toshow\').show(500);
					$(\'div.tohide\').hide(500);
    			}
			});
		';
    $cs->registerCss(__CLASS__ . '#form', $css);
    $cs->registerScript(__CLASS__ . '#form', $js);
    $content = "<ul id=\"{$ulId}\">";
    foreach ($catalogs as $item) {
        $htmlOptions = array();
        $htmlOptions['value'] = $item['self']->id;
        if ($model->isNewRecord) {
            if (isset($setCat[$item['self']->id]) && $setCat[$item['self']->id]) {
                $htmlOptions['checked'] = 'checked';
            }
        } else {
            if (isset($setCat[$item['self']->id]->id)) {
                $htmlOptions['checked'] = 'checked';
            }
        }
        $content .= '<li>' . CHtml::activeCheckBox($model, "catalogs[" . $item['self']->id . "]", $htmlOptions) . '' . CHtml::activeLabelEx($model, "catalogs[" . $item['self']->id . "]", array('label' => $item['self']->name)) . getTreeCheckboxChilds($model, $item['childs'], $setCat) . ' </li>';
    }
    $content .= '</ul>';
    return $content;
}
Exemple #29
0
 /**
  * 批量操作
  *
  */
 public function actionBatch()
 {
     if (XUtils::method() == 'GET') {
         $command = trim($_GET['command']);
         $ids = intval($_GET['id']);
     } else {
         if (XUtils::method() == 'POST') {
             $command = trim($_POST['command']);
             $ids = $_POST['id'];
             is_array($ids) && ($ids = implode(',', $ids));
         } else {
             XUtils::message('errorBack', '只支持POST,GET数据');
         }
     }
     switch ($command) {
         case 'delete':
             parent::_acl('catalog_delete');
             empty($ids) && XUtils::message('error', '未选择记录');
             AdminLogger::_create(array('catalog' => 'delete', 'intro' => '删除全局分类,ID:' . $ids));
             parent::_delete(new Catalog(), $ids, array('index'));
             break;
         case 'sortOrder':
             parent::_acl('catalog_sort_order');
             $sortOrder = $this->_gets->getParam('sortOrder');
             foreach ((array) $sortOrder as $id => $val) {
                 $catalogModel = Catalog::model()->findByPk($id);
                 if ($catalogModel) {
                     $catalogModel->sort_order = $val;
                     $catalogModel->save();
                 }
             }
             $this->redirect(array('index'));
             break;
         default:
             throw new CHttpException(404, '错误的操作类型:' . $command);
             break;
     }
 }
 public function actionSetTechSpec()
 {
     $orderId = $_POST['orderId'];
     $val = $_POST['val'];
     $order = Zakaz::model()->findByPk($orderId);
     if (!$order) {
         throw new CHttpException(500);
     }
     $order->technicalspec = $val;
     $order->save();
     if ($val) {
         $criteria = new CDbCriteria();
         if (Company::getId()) {
             $projectFields = $order->getFields();
             if ($projectFields) {
                 foreach ($projectFields as $field) {
                     if ($field->required == ProjectField::REQUIRED_YES_REG_SPAM) {
                         $varname = $field->varname;
                         $value = $order->{$varname};
                         $criteria->addSearchCondition('profile.' . $varname, $value);
                     }
                 }
             }
         }
         $criteria->addSearchCondition('AuthAssignment.itemname', 'Corrector');
         $authors = User::model()->with('profile', 'AuthAssignment')->findAll($criteria);
         if (!empty($authors)) {
             /*$link = $this->createAbsoluteUrl('/project/chat/', ['orderId' => $orderId]);
                        $mail = new YiiMailer();
             		$mail->clearLayout();
                        $mail->setFrom(Yii::app()->params['supportEmail'], Yii::app()->name);
                        $mail->setSubject('Приглашение в проект');
             		$link = 'http://'.$_SERVER['SERVER_NAME'].'/project/chat?orderId='.$orderId;
                        $mail->setBody('<a href="'.$link.'">'.$link.'</a>');*/
             // новая рассылка
             $typeId = Emails::TYPE_26;
             $rec = Templates::model()->findAll("`type_id`='{$typeId}'");
             foreach ($authors as $user) {
                 //$specials = explode(',',$user->profile->specials);
                 //if (!in_array($order->specials, $specials)) continue;
                 $email = new Emails();
                 $email->to_id = $user->id;
                 // to rm ??
                 $email->name = $user->full_name;
                 if (strlen($email->name) < 2) {
                     $email->name = $user->username;
                 }
                 $email->login = $user->username;
                 $email->num_order = $orderId;
                 $email->page_order = 'http://' . $_SERVER['SERVER_NAME'] . '/project/chat?orderId=' . $orderId;
                 $specials = isset($order->specials) ? $order->specials : $order->specials2;
                 $specials = Catalog::model()->findByPk($specials);
                 $email->specialization = $specials->cat_name;
                 $email->name_order = $order->title;
                 $email->subject_order = $order->title;
                 $email->sendTo($user->email, $rec[0]->title, $rec[0]->text, $typeId);
             }
             echo 'send_email';
         } else {
             echo 'no_users';
         }
     }
     Yii::app()->end();
 }