Ejemplo n.º 1
0
function catalog_build($action, $settings, $board)
{
    global $config;
    // Possible values for $action:
    //	- all (rebuild everything, initialization)
    //	- news (news has been updated)
    //	- boards (board list changed)
    //	- post (a reply has been made)
    //	- post-thread (a thread has been made)
    $boards = explode(' ', $settings['boards']);
    if ($action == 'all') {
        foreach ($boards as $board) {
            $b = new Catalog();
            if ($config['smart_build']) {
                file_unlink($config['dir']['home'] . $board . '/catalog.html');
            } else {
                $b->build($settings, $board);
            }
        }
    } elseif ($action == 'post-thread' || $settings['update_on_posts'] && $action == 'post' || $settings['update_on_posts'] && $action == 'post-delete' && in_array($board, $boards)) {
        $b = new Catalog();
        if ($config['smart_build']) {
            file_unlink($config['dir']['home'] . $board . '/catalog.html');
        } else {
            $b->build($settings, $board);
        }
    }
}
 public function testOneAggregate()
 {
     $josh = new User('2131293jq', 'Josh Di Fabio');
     $catalog = new Catalog('uk2015', 'UK 2015', $josh);
     $catalog->addProduct(new Product('S9123', 'T-Shirt'));
     $catalog->addProduct(new Product('S9124', 'Jumper'));
     $normalizer = new \AggregatePersistence\Serialization\GenericNormalizer();
     $serializer = new \AggregatePersistence\Serialization\JsonSerializer($normalizer);
     $aggregateContainerSet = new \AggregatePersistence\Doctrine\AggregateContainerSet();
     $aggregateContainerSet->add(new \AggregatePersistence\Doctrine\AggregateContainer($catalog->id(), $catalog));
     $aggregateContainerSet->add(new \AggregatePersistence\Doctrine\AggregateContainer($josh->id(), $josh));
     $serialization1 = $serializer->serialize($catalog, $aggregateContainerSet);
     $repository = new class([$josh->id() => $josh]) implements \AggregatePersistence\AggregateRepository
     {
         private $aggregates;
         public function __construct(array $aggregates)
         {
             $this->aggregates = $aggregates;
         }
         public function find(string $aggregateRootId)
         {
             return $this->aggregates[$aggregateRootId];
         }
     };
     $deserialization = $serializer->deserialize($serialization1, $repository);
     $serialization2 = $serializer->serialize($deserialization, $aggregateContainerSet);
     $this->assertSame($serialization1, $serialization2);
 }
Ejemplo n.º 3
0
 public function delete($ID)
 {
     $cat = new Catalog();
     if ($cat->isEmptyProperty($ID)) {
         $db = MySQL::getInstance();
         $db->query("DELETE FROM catalog_property WHERE PropertyID=" . $ID);
         return true;
     }
     return false;
 }
Ejemplo n.º 4
0
 public function getHall()
 {
     $objCatalog = new Catalog();
     $_response = $objCatalog->getHall();
     $_response = $_response["ConsultarSalaHospitalResult"]["ClsSalaHospital"];
     $arrData[] = array("id" => "0", "description" => "TODOS");
     foreach ($_response as $value) {
         $arrData[] = array("id" => $value["SalaHospId"], "description" => $value["SalaHospDescripcion"]);
     }
     header("Content-Type: application/json");
     echo json_encode($arrData);
 }
Ejemplo n.º 5
0
 public function delete()
 {
     if ($this->show->itemID) {
         $Cat = new Catalog();
         $prop = new Catalog_Property();
         if ($Cat->isEmptyCategory($this->show->itemID) && $prop->isEmptyProperty($this->show->itemID)) {
             $oCategory = new Catalog_Category();
             $oCategory->delete($this->show->itemID);
         }
     }
     redirect(BASE_PATH . 'admin/catalog/category');
 }
 public function requireDefaultRecords()
 {
     parent::requireDefaultRecords();
     if (!Catalog::get()->first()) {
         $catalog = new Catalog();
         $catalog->Title = "Product Catalog";
         $catalog->URLSegment = "catalog";
         $catalog->Sort = 4;
         $catalog->write();
         $catalog->publish('Stage', 'Live');
         $catalog->flushCache();
         DB::alteration_message('Product Catalog created', 'created');
     }
 }
Ejemplo n.º 7
0
 public function run()
 {
     $model = new Catalog();
     if (isset($_POST['Catalog'])) {
         $model->attributes = $_POST['Catalog'];
         $now = time();
         $model->create_time = $now;
         $model->update_time = $now;
         if ($model->save()) {
             $this->controller->message('success', Yii::t('admin', 'Add Success'), $this->controller->createUrl('index'));
         }
     }
     $parentId = intval(Yii::app()->request->getParam('id'));
     $this->controller->render('create', array('model' => $model, 'parentId' => $parentId));
 }
Ejemplo n.º 8
0
 /**
  * 主界面
  */
 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));
 }
Ejemplo n.º 9
0
 /**
  * Adds a new item to this cart instance. Each item is added with a ProductRatePlanId, a Quantity, and a unique Cart Item identification number
  * @param $rateplanId The ProductRatePlanId of the item being added
  * @param $quantity The number of UOM to be applied to this rateplan for all charges with a Per Unit quantity
  */
 public function addCartItem($rateplanId, $chargeAndQty)
 {
     $newCartItem = new Cart_Item($rateplanId, $this->latestItemId);
     $newCartItem->ratePlanId = $rateplanId;
     $newCartItem->itemId = $this->latestItemId++;
     $plan = Catalog::getRatePlan($newCartItem->ratePlanId);
     $newCartItem->charges = array();
     foreach ($plan->charges as $charge) {
         $cart_charge = new Cart_Charge();
         $cart_charge->Id = $charge->Id;
         $cart_charge->Name = $charge->Name;
         $cart_charge->Uom = $charge->Uom;
         $cart_charge->ChargeType = $charge->ChargeType;
         $cart_charge->ChargeModel = $charge->ChargeModel;
         $cart_charge->Qty = null;
         if ($chargeAndQty) {
             foreach ($chargeAndQty as $chargeObj) {
                 if ($chargeObj['name'] == $charge->Id) {
                     $cart_charge->Qty = $chargeObj['value'];
                     break;
                 }
             }
         }
         array_push($newCartItem->charges, $cart_charge);
     }
     $newCartItem->ratePlanName = $plan != null ? $plan->Name : 'Invalid Product';
     $newCartItem->ProductName = $plan != null ? $plan->productName : 'Invalid Product';
     array_push($this->cart_items, $newCartItem);
 }
Ejemplo n.º 10
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));
 }
Ejemplo n.º 11
0
 public function init()
 {
     //при добавлении нового товара
     if ($this->_mAction == 'add_prod') {
         $product_name = $_POST['product_name'];
         $product_description = $_POST['product_description'];
         $product_price = $_POST['product_price'];
         if ($product_name == null) {
             $this->mErrorMessage = 'Имя продукта не заполнено';
         }
         if ($product_description == null) {
             $this->mErrorMessage = 'Описание товара не заполнено';
         }
         if ($product_price == null || !is_numeric($product_price)) {
             $this->mErrorMessage = 'Цена товара должна быть в виде числа!';
         }
         if ($this->mErrorMessage == null) {
             Catalog::AddProductToCategory($this->mCategoryId, $product_name, $product_description, $product_price);
             header('Location: ' . htmlspecialchars_decode($this->mLinkToCategoryProductsAdmin));
         }
     }
     //для просмотра сведений о товаре
     if ($this->_mAction == 'edit_prod') {
         header('Location: ' . htmlspecialchars_decode(Link::ToProductAdmin($this->mDepartmentId, $this->mCategoryId, $this->_mActionedProductId)));
         exit;
     }
     $this->mProducts = Catalog::GetCategoryProducts($this->mCategoryId);
     $this->mProductsCount = count($this->mProducts);
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $catalogDropdown = DropdownField::create('CatalogID', 'Catalog to display', Catalog::get()->map('ID', 'Title'))->setEmptyString('Select...');
     $fields->addFieldToTab('Root.Main', $catalogDropdown);
     return $fields;
 }
 public function handler()
 {
     $params = $this->getURLParams();
     $catalog = null;
     $product = null;
     // Only deal with AJAX requests
     if (!$this->request->isAjax()) {
         return $this->httpError(401, 'Bad request');
     }
     switch ($params['Action']) {
         case 'Catalog':
             $catalog = Catalog::get()->byId($params['ID']);
             break;
         case 'Product':
             $product = Product::get()->byID($params['ID']);
             break;
         default:
             return $this->httpError(401, 'Bad request');
     }
     // Make sure we have some data.
     if (!$catalog && !$product) {
         return $this->httpError(404, 'Sorry, we couldn\'t find anything.');
     }
     // If there's a catalog, fetch its JSON, otherwise fetch the product's JSON.
     $JSON = $catalog ? $catalog->getCatalogJSON() : $product->getProductJSON();
     $response = $this->getResponse()->addHeader('Content-type', 'application/json; charset=utf-8');
     $response->setBody($JSON);
     return $response;
 }
Ejemplo n.º 14
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));
 }
Ejemplo n.º 15
0
 /**
  * 初始化
  * @see CController::init()
  */
 public function init()
 {
     parent::init();
     //前端控制器在此获得分类,从顶级分类(0)开始分层往下取,得到所有层次的分类
     //        ppr(XXcache::system('_catalog')); //这里是遍历出来未按照从属排序
     //        ppr($this->_catalog); //这里重新按从属排序
     $this->_catalog = Catalog::get(0, XXcache::system('_catalog'));
     //系统配置
     $this->_conf = XXcache::system('_config');
     $this->_seoTitle = $this->_conf['seo_title'];
     $this->_seoKeywords = $this->_conf['seo_keywords'];
     $this->_seoDescription = $this->_conf['seo_description'];
     if ($this->_conf['site_status'] == 'close') {
         self::_closed();
     }
     $this->_thisUrl = higu();
     if ($this->_conf['cache_page_status'] == 'open') {
         $value = Yii::app()->cache->get($this->_thisUrl);
         if ($value === false) {
             echo 'nocache';
         } else {
             echo 'cache';
             echo $value;
         }
     }
 }
Ejemplo n.º 16
0
    public static function Report()
    {
        $sql = 'SELECT * FROM {{orders}} WHERE loyalty=1 AND sent=0';
        $list = DB::getAll($sql);
        foreach ($list as $order) {
            $sql = '
				SELECT * FROM {{orders_items}}
				WHERE orders=' . $order['id'] . '
			';
            $items = DB::getAll($sql);
            $data = $order;
            foreach ($items as $item) {
                $temp = Tree::getInfo($item['tree']);
                if ($temp['path'] != 'catalogopt') {
                    $data['list'][] = Catalog::getOne($item['tree']);
                }
            }
            $text = View::getRenderEmpty('email/report', $data);
            $mail = new Email();
            $mail->Text($text);
            $mail->Subject('Оставьте отзыв о товаре на сайте www.' . str_replace('www.', '', $_SERVER["HTTP_HOST"]));
            $mail->From('robot@' . str_replace('www.', '', $_SERVER["HTTP_HOST"]));
            $mail->To($order['email']);
            $mail->Send();
            $sql = '
				UPDATE {{orders}}
				SET	sent=1
				WHERE id=' . $order['id'] . '
			';
            DB::exec($sql);
        }
    }
Ejemplo n.º 17
0
 function getCatalogInfo()
 {
     //        $fileName = $this->getPath().$this->_props['name'].'.'.Q::ini('appini/catalog/fileInfoExt', 'inf');
     //        //读取文件编目信息
     //        $handle = @fopen($fileName, 'a+');
     //        if($handle){
     //            $filesize = @filesize($fileName);
     //            if ($filesize > 0){
     //                $json = @fread ($handle, $filesize);
     //                $catalogInfo = Helper_JSON::decode($json);
     //            }else{
     //                $catalogInfo = array();
     //            }
     //            @fclose ($handle);
     //        }
     $catalogInfo = $this->_props['catalog_info'] == null ? array() : Helper_JSON::decode($this->_props['catalog_info']);
     //获得编目信息分类
     $catalog = Catalog::find('path like ? and enabled=1', '%,' . ($this->_props['type'] + 1) . ',%')->order('weight desc')->asArray()->getAll();
     $catalog = Helper_Array::toTree($catalog, 'id', 'parent_id', 'children');
     //合并编目信息
     foreach ($catalog as $k => $v) {
         if (isset($catalogInfo[$v['name']])) {
             foreach ($v['children'] as $_k => $_v) {
                 if (!isset($catalogInfo[$v['name']][$_v['name']])) {
                     $catalogInfo[$v['name']][$_v['name']] = '';
                 }
             }
         } else {
             foreach ($v['children'] as $_k => $_v) {
                 $catalogInfo[$v['name']][$_v['name']] = '';
             }
         }
     }
     return $catalogInfo;
 }
Ejemplo n.º 18
0
 public function run()
 {
     $model = new Catalog();
     //一级分类条件
     $criteria = new CDbCriteria();
     $type = intval(Yii::app()->request->getParam('type'));
     $type && $criteria->addColumnCondition(array('type' => $type));
     $criteria->addColumnCondition(array('parent_id' => 0));
     $count = $model->count($criteria);
     //分页
     $pages = new CPagination($count);
     $pages->pageSize = 20;
     $pages->applyLimit($criteria);
     $result = $model->findAll($criteria);
     $this->controller->render('index', array('model' => $model, 'datalist' => $result, 'pages' => $pages));
 }
Ejemplo n.º 19
0
 private function _GetPageTitle()
 {
     $page_title = 'TShirtShop: ' . 'Demo Product Catalog from Beginning PHP and MySQL E-Commerce';
     if (isset($_GET['DepartmentId']) && isset($_GET['CategoryId'])) {
         $page_title = 'TShirtShop: ' . Catalog::GetDepartmentName($_GET['DepartmentId']) . ' - ' . Catalog::GetCategoryName($_GET['CategoryId']);
         if (isset($_GET['Page']) && (int) $_GET['Page'] > 1) {
             $page_title .= ' - Page ' . (int) $_GET['Page'];
         }
     } elseif (isset($_GET['DepartmentId'])) {
         $page_title = 'TShirtShop: ' . Catalog::GetDepartmentName($_GET['DepartmentId']);
         if (isset($_GET['Page']) && (int) $_GET['Page'] > 1) {
             $page_title .= ' - Page ' . (int) $_GET['Page'];
         }
     } elseif (isset($_GET['ProductId'])) {
         $page_title = 'TShirtShop: ' . Catalog::GetProductName($_GET['ProductId']);
     } elseif (isset($_GET['SearchResults'])) {
         $page_title = 'TShirtShop: "';
         // Display the search string
         $page_title .= trim(str_replace('-', ' ', $_GET['SearchString'])) . '" (';
         // Display "all-words search " or "any-words search"
         $all_words = isset($_GET['AllWords']) ? $_GET['AllWords'] : 'off';
         $page_title .= ($all_words == 'on' ? 'all' : 'any') . '-words search';
         // Display page number
         if (isset($_GET['Page']) && (int) $_GET['Page'] > 1) {
             $page_title .= ', page ' . (int) $_GET['Page'];
         }
         $page_title .= ')';
     } else {
         if (isset($_GET['Page']) && (int) $_GET['Page'] > 1) {
             $page_title .= ' - Page ' . (int) $_GET['Page'];
         }
     }
     return $page_title;
 }
 public function create($catalog_id)
 {
     $rules = array('images' => 'required');
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         return Redirect::route(array('admin.newsletter.create', $catalog_id))->withErrors($validator)->With(Input::all());
     } else {
         $catalog = Catalog::find($catalog_id);
         $pictures = $catalog->pictures;
         $car = $catalog->car;
         $images = Input::get('images');
         $newsletter = new Newsletter();
         $newsletter->title = $catalog->title;
         $newsletter->images = $images;
         $newsletter->send_to = 0;
         $newsletter->user_id = Auth::user()->id;
         $newsletter->catalog_id = $catalog_id;
         $newsletter->save();
         $settingsEmail = Settings::where('key', '=', 'contact_email')->first();
         $settingsEmailName = Settings::where('key', '=', 'contact_name')->first();
         // Subscribers::find(8001) for testing
         $subscribers = Subscribers::all();
         foreach ($subscribers as $subscriber) {
             $data = array('subject' => $catalog->title, 'to' => $subscriber->email, 'to_name' => $subscriber->name, 'from_name' => $settingsEmailName->value, 'from' => $settingsEmail->value, 'catalog' => $catalog, 'images' => $images, 'car' => $car, 'pictures' => $pictures, 'user' => $subscriber);
             Mail::queue('emails.newsletter.html', $data, function ($message) use($data) {
                 $message->to($data['to'], $data['to_name'])->from($data['from'], $data['from_name'])->subject($data['subject']);
             });
         }
         return Redirect::route('admin.newsletter.index')->with('success', Lang::get('messages.newsletter_created'));
     }
     return Redirect::route('admin.newsletter.index')->with('success', Lang::get('messages.newsletter_created'));
 }
Ejemplo n.º 21
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);
 }
Ejemplo n.º 22
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));
 }
Ejemplo n.º 23
0
 public function actionIndex()
 {
     $this->_seoTitle = '我要去上课 - 课程汇总';
     $criteria = new CDbCriteria();
     //根据分类查找课程信息
     $cat = Yii::app()->request->getParam('cat');
     $city = Yii::app()->request->getParam('city');
     $sex = Yii::app()->request->getParam('sex');
     //课程分类
     $catalogs = Catalog::getMenu();
     if (!empty($city)) {
         $criteria->addCondition("city = '{$city}'");
     }
     if (!empty($cat)) {
         $criteria->addCondition("catalog_id = '{$cat}'");
     }
     if (!empty($sex)) {
         $criteria->addCondition("sex = '{$sex}'");
     }
     $criteria->addCondition("check_status = :check_status");
     $criteria->params[':check_status'] = 1;
     //分页
     $count = Lesson::model()->count($criteria);
     $pager = new CPagination($count);
     $pager->pageSize = 5;
     $pager->applyLimit($criteria);
     $lessons = Lesson::model()->findAll($criteria->addCondition("check_status = 1"));
     $this->render('index', array('lessons' => $lessons, 'count' => $count, 'pager' => $pager, 'cat' => $cat, 'sex' => $sex, 'catalogs' => $catalogs, 'city' => $city, 'food' => $_GET['food']));
 }
Ejemplo n.º 24
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('执行完毕');
 }
Ejemplo n.º 25
0
 public function init()
 {
     $this->mCategories = Catalog::GetCategoriesInDepartment($this->mSelectedDepartment);
     //  Генерируем ссылки для страниц категорий
     for ($i = 0; $i < count($this->mCategories); $i++) {
         $this->mCategories[$i]['link_to_category'] = Link::ToCategory($this->mSelectedDepartment, $this->mCategories[$i]['category_id']);
     }
 }
Ejemplo n.º 26
0
 /**
  * Assemble the command for CLI
  * @param string $command beets command (e.g. 'ls myArtist')
  * @param boolean $disableCostomFields disables the -f switch for this time
  * @return type
  */
 protected function assembleCommand($command, $disableCostomFields = false)
 {
     $commandParts = array(escapeshellcmd($this->beetsCommand), ' -l ' . escapeshellarg($this->handler->getBeetsDb()), escapeshellcmd($command));
     if ($this->useCustomFields && !$disableCostomFields) {
         $commandParts[] = ' -f ' . escapeshellarg($this->getFieldFormat());
     }
     return implode(' ', $commandParts);
 }
Ejemplo n.º 27
0
 public function getName()
 {
     if ($this->catalog_id > 0) {
         $catalog = Catalog::create_from_id($this->catalog_id);
         return $catalog->name;
     }
     return AmpConfig::get('site_title');
 }
Ejemplo n.º 28
0
 public function init()
 {
     $this->mCategories = Catalog::GetCategoriesInDepartment($this->mSelectedDepartment);
     // Building links for the category pages
     for ($i = 0; $i < count($this->mCategories); $i++) {
         $this->mCategories[$i]['link_to_category'] = Link::ToCategory($this->mSelectedDepartment, $this->mCategories[$i]['category_id']);
     }
 }
Ejemplo n.º 29
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'));
 }
Ejemplo n.º 30
0
 public function init()
 {
     parent::init();
     $this->_type = $this->_type_ids['video'];
     //视频栏目
     $this->_catalog = Catalog::getTopCatalog(true, $this->_type);
     $this->_video_type = array('comedy' => '喜剧', 'active' => '动作', 'story' => '剧情', 'science' => '科幻', 'terrified' => '惊悚', 'war' => '战争', 'sexy' => '伦理');
 }