本文整理汇总了PHP中Catalog类的典型用法代码示例。如果您正苦于以下问题:PHP Catalog类的具体用法?PHP Catalog怎么用?PHP Catalog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Catalog类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: run
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));
}
开发者ID:jerrylsxu,项目名称:yiifcms,代码行数:16,代码来源:IndexAction.php
示例17: _GetPageTitle
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;
}
开发者ID:naOyD,项目名称:tshirtshop_g,代码行数:34,代码来源:store_front.php
示例18: create
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'));
}
开发者ID:stefferd,项目名称:me-consultancy,代码行数:32,代码来源:NewsletterController.php
示例19: actionView
/**
* 浏览详细内容
*/
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);
}
开发者ID:SallyU,项目名称:yiicms,代码行数:32,代码来源:ImageController.php
示例20: run
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));
}
开发者ID:jerrylsxu,项目名称:yiifcms,代码行数:26,代码来源:UpdateAction.php
注:本文中的Catalog类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论