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


PHP Catalog类代码示例

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


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

示例1: catalog_build

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);
        }
    }
}
开发者ID:0151n,项目名称:vichan,代码行数:28,代码来源:theme.php

示例2: testOneAggregate

 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);
 }
开发者ID:joshdifabio,项目名称:aggregate-persistence,代码行数:28,代码来源:SerializationTest.php

示例3: delete

 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;
 }
开发者ID:kizz66,项目名称:meat,代码行数:10,代码来源:Property.php

示例4: getHall

 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);
 }
开发者ID:atoledov,项目名称:siglab,代码行数:12,代码来源:controlCatalog.php

示例5: delete

 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');
 }
开发者ID:kizz66,项目名称:meat,代码行数:12,代码来源:Category.php

示例6: 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

示例7: run

 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));
 }
开发者ID:jerrylsxu,项目名称:yiifcms,代码行数:15,代码来源:CreateAction.php

示例8: actionHome

 /**
  * 主界面
  */
 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));
 }
开发者ID:tecshuttle,项目名称:51qsk,代码行数:33,代码来源:DefaultController.php

示例9: addCartItem

 /**
  * 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);
 }
开发者ID:j0nbr0wn,项目名称:zilla_heroku,代码行数:34,代码来源:Cart.php

示例10: init

 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);
 }
开发者ID:naOyD,项目名称:tshirtshop_g,代码行数:29,代码来源:admin_products.php

示例11: 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

示例12: 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

示例13: 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

示例14: Report

    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);
        }
    }
开发者ID:sov-20-07,项目名称:billing,代码行数:32,代码来源:CronModel.php

示例15: getCatalogInfo

 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;
 }
开发者ID:Debenson,项目名称:openwan,代码行数:35,代码来源:files.php


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