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


PHP Catalog::get方法代码示例

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


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

示例1: init

 /**
  * 初始化
  * @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;
         }
     }
 }
开发者ID:lp19851119,项目名称:114la,代码行数:30,代码来源:XFrontBase.php

示例2: getCMSFields

 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;
 }
开发者ID:helpfulrobot,项目名称:flashbackzoo-silverstripe-angularjs-modeladmin,代码行数:7,代码来源:CatalogPage.php

示例3: handler

 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;
 }
开发者ID:helpfulrobot,项目名称:flashbackzoo-silverstripe-angularjs-modeladmin,代码行数:29,代码来源:API.php

示例4: onAfterWrite

 public function onAfterWrite()
 {
     parent::onAfterWrite();
     self::updateProductCache();
     // Update the catalog cache
     if ($catalog = Catalog::get()->byID($this->CatalogID)) {
         $catalog->updateCatalogCache();
     }
 }
开发者ID:helpfulrobot,项目名称:flashbackzoo-silverstripe-angularjs-modeladmin,代码行数:9,代码来源:Product.php

示例5: requireDefaultRecords

 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');
     }
 }
开发者ID:helpfulrobot,项目名称:i-lateral-silverstripe-commerce,代码行数:14,代码来源:Catalog.php

示例6: actionIndex

 /**
  * 首页
  */
 public function actionIndex()
 {
     $catalog_id = trim($this->_request->getParam('catalog_id'));
     $keyword = trim($this->_request->getParam('keyword'));
     $catalog = Catalog::model()->findByPk($catalog_id);
     //调取子孙分类和当前分类
     $catalog_ids = Catalog::get($catalog ? $catalog_id : 0, $this->_catalog);
     $children_ids = Helper::array_key_values($catalog_ids, 'id');
     $catalog_id ? $all_ids = array_merge($children_ids, (array) $catalog_id) : ($all_ids = $children_ids);
     $db_in_ids = implode(',', $all_ids);
     if (!$db_in_ids || $catalog_id && $catalog->type != $this->_type_ids['video']) {
         throw new CHttpException(404, Yii::t('common', 'The requested page does not exist.'));
     }
     //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('video/index', array('catalog_id' => $catalog->id)), 'name' => $catalog->catalog_name);
     } else {
         $this->_seoTitle = Yii::t('common', 'VideoListTitle') . ' - ' . $this->_setting['site_name'];
         $this->_seoKeywords = Yii::t('common', 'VideoListKeywords');
         $this->_seoDescription = Yii::t('common', 'VideoListDescription', array('{site_name}' => $this->_setting['site_name']));
         $navs[] = array('url' => $this->_request->getUrl(), 'name' => $this->_seoTitle);
     }
     //查询条件
     $post = new Video();
     $criteria = new CDbCriteria();
     $condition = "t.status = 'Y'";
     $keyword && ($condition .= ' AND title LIKE \'%' . $keyword . '%\'');
     $db_in_ids && ($condition .= ' AND catalog_id IN (' . $db_in_ids . ')');
     $criteria->condition = $condition;
     $criteria->order = 'video_score DESC, view_count DESC, t.id DESC';
     $criteria->with = array('catalog');
     $criteria->select = "title, id, t.cover_image, t.video_score,  t.update_time,t.introduce, t.view_count";
     //分页
     $count = $post->count($criteria);
     $pages = new CPagination($count);
     $pages->pageSize = 20;
     $criteria->limit = $pages->pageSize;
     $criteria->offset = $pages->currentPage * $pages->pageSize;
     $datalist = $post->findAll($criteria);
     //最近的视频
     $last_videos = Video::model()->findAll(array('condition' => 'catalog_id IN (' . $db_in_ids . ')', 'order' => 'id DESC', '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, 'videos' => $datalist, 'pagebar' => $pages, 'last_videos' => $last_videos));
 }
开发者ID:redtreelchao,项目名称:wander-moon,代码行数:53,代码来源:VideoController.php

示例7: parentTrue

 /**
  * 检测上级分类是否合法
  *
  * @param  $item
  * @param  $parentId
  */
 protected function parentTrue($item = 0, $parentId = 0)
 {
     $subCategory = Catalog::get($item, $this->_catalog);
     if (empty($subCategory)) {
         $getCategory[] = $item;
     } else {
         foreach ((array) $subCategory as $row) {
             $getCategory[] = $row['id'];
         }
         //将本身ID加入检测对象
         array_push($getCategory, $item);
     }
     if (in_array($parentId, $getCategory)) {
         XUtils::message('error', '所选择的上级分类不能是当前分类或者当前分类的下级分类');
     }
 }
开发者ID:zywh,项目名称:maplecity,代码行数:22,代码来源:CatalogController.php

示例8: init

 /**
  * 初始化
  * @see CController::init()
  */
 public function init()
 {
     parent::init();
     //检测系统是否已经安装
     if (!is_file(WWWPATH . DS . 'data' . DS . 'install.lock')) {
         $this->redirect(array('/install'));
     }
     //系统配置
     $this->_conf = XXcache::system('_config');
     $this->_catalog = Catalog::get(0, XXcache::system('_catalog'));
     $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();
     }
 }
开发者ID:bigbol,项目名称:ziiwo,代码行数:21,代码来源:XFrontBase.php

示例9: edit

 public function edit()
 {
     $oCatalog = new Catalog();
     $prop = new Catalog_Property();
     if ($this->show->itemID) {
         $row = $oCatalog->getById($this->show->itemID);
         $this->show->categoryID = $row['CategoryID'];
         $this->show->propertyID = $row['PropertyID'];
     } else {
         $this->show->brandID = $this->post['BrandID'];
         $this->show->categoryID = $this->post['CategoryID'];
     }
     $this->show->propertyList = $prop->getList($this->show->categoryID);
     setcookie("brandID", $this->show->brandID, null, '/');
     $this->show->status = $oCatalog->getStatusList();
     if (!empty($this->post['Save'])) {
         if ($this->show->itemID) {
             $oCatalogID = $oCatalog->update($this->post, $this->show->itemID);
         } else {
             $oCatalogID = $oCatalog->insert($this->post);
         }
         if ($oCatalogID) {
             redirect(BASE_PATH . 'admin/catalog/');
         }
     }
     if ($this->show->itemID) {
         $this->show->item = $oCatalog->getByID($this->show->itemID);
         $this->show->breadcrumbs[] = array('url' => BASE_PATH . 'admin/catalog/' . $this->show->itemID, 'title' => $this->show->item['Title']);
     } else {
         $this->show->item = $oCatalog->get();
         $this->show->breadcrumbs[] = array('url' => BASE_PATH . 'admin/catalog/' . $this->show->itemID, 'title' => 'Создание');
         $oCategory = new Catalog_Category();
         $this->show->categoryList = $oCategory->getList($this->show->brandID);
         $oBrand = new Catalog_Brand();
         $this->show->brandList = $oBrand->getList();
     }
     if (!empty($this->post['Save'])) {
         $this->show->item->merge($this->post);
     }
 }
开发者ID:kizz66,项目名称:meat,代码行数:40,代码来源:Catalog.php

示例10: array

echo $form->textField($model, 'goods_name', array('size' => 60, 'maxlength' => 128, 'class' => 'validate[required]'));
?>
     
      </td>
  </tr> 
 
  <tr>
    <td class="tb_title"><?php 
echo Yii::t('admin', 'Belong Category');
?>
:</td>
  </tr>
  <tr >
    <td ><select name="Goods[catalog_id]" id="Goods_catalog_id" onchange="changeCatalog(this)">
        <?php 
foreach ((array) Catalog::get(0, $this->_catalog) as $catalog) {
    ?>
        <option value="<?php 
    echo $catalog['id'];
    ?>
" <?php 
    Helper::selected($catalog['id'], $model->catalog_id);
    ?>
><?php 
    echo $catalog['str_repeat'];
    echo $catalog['catalog_name'];
    ?>
</option>
        <?php 
}
?>
开发者ID:jzxyouok,项目名称:yiifcms,代码行数:31,代码来源:_form.php

示例11: parentTrue

 /**
  * 检测上级分类是否合法
  *
  * @param  $item
  * @param  $parentId
  */
 protected function parentTrue($item = 0, $parentId = 0)
 {
     $subCategory = Catalog::get($item, $this->_catalog);
     if (empty($subCategory)) {
         $getCategory[] = $item;
     } else {
         foreach ((array) $subCategory as $row) {
             $getCategory[] = $row['id'];
         }
         //将本身ID加入检测对象
         array_push($getCategory, $item);
     }
     if (in_array($parentId, $getCategory)) {
         $this->message('error', Yii::t('admin', 'Selected Category is Current Category or Children Category'));
     }
 }
开发者ID:redtreelchao,项目名称:wander-moon,代码行数:22,代码来源:CatalogController.php


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