public function getimageAction() { $this->_helper->layout->disableLayout(); $id = (int) $this->_request->getParam('id', 0); $brandTable = new Brands(); $brand = $brandTable->find($id)->current(); //Zend_Debug::dump($photo); header("Content-type:{$brand->logo_type}"); $this->view->image = base64_decode($brand->logo); }
function adminaddAction() { $this->_helper->layout->setLayout("layout_admin"); $brandTable = new Brands(); $order = "create_date desc"; $this->view->brands = $brandTable->fetchAll(null, $order, null, null); if ($this->_request->isPost()) { //post method $formData = $this->_request->getPost(); //get background image $imgfile = $_FILES['background']; $imgdata = null; if (is_array($imgfile)) { $name = $imgfile['name']; $type = $imgfile['type']; $size = $imgfile['size']; if (!preg_match('/^image\\//i', $type) ? true : false) { $this->view->error = "请上传正确的图片"; } else { if ($size > 2000000) { $this->view->error = "图片不得超过2M"; } else { $tmpfile = $imgfile['tmp_name']; $file = fopen($tmpfile, "rb"); $imgdata = base64_encode(fread($file, $size)); fclose($file); $this->view->error = "上传成功"; } } } //save mission $missionTable = new Missions(); $newMission = $missionTable->createRecord($formData['title'], $formData['intro'], $formData['type'], $formData['startdate'], $formData['enddate'], $imgdata, $type, $formData['brand']); if ($newMission > 0) { $result = "Success"; $this->_helper->redirector('adminlist', 'mission', null, array('id' => $formData['brand'])); } } else { //get method $fc = Zend_Controller_Front::getInstance(); $this->view->oFCKeditor = new FCKeditor("long_desc"); $this->view->oFCKeditor->BasePath = $fc->getBaseUrl() . "/js/fckeditor/"; $this->view->oFCKeditor->Height = "500px"; $this->view->oFCKeditor->Width = "700px"; if ($this->view->product['long_desc'] != null && $this->view->product['long_desc'] != '') { $this->view->oFCKeditor->Value = $this->view->product['long_desc']; } } }
public function actionSingle($id) { $brand = Brands::model()->findByPk($id); $sales = Sales::model()->findAll(array('condition' => 'status=1 and brand_id=:brandId and ((start=finish and start<=:now) OR :now between start and finish)', 'params' => array(':brandId' => $brand->id, ':now' => date('Y-m-d H:i:s')))); $data = array('brand' => $brand, 'sales' => $sales, 'title' => $brand->name); $this->render('single', $data); }
public function actionRubric($id = null, $new = null) { $rubric = Rubrics::model()->findByPk($id); // страница $page = Yii::app()->request->getParam('page'); if (!$page && !is_numeric($page)) { $page = 1; } // кол-во товароа на странице $per_page = 10; $select = '*'; $where = 'status=1'; $params = array(); if ($new) { $where .= ' and new=1'; } else { $where .= ' and rubric_id IN (' . $rubric->getChildsId() . ')'; } /* бренды */ $brands = Brands::model()->findAll(array('condition' => 'status=1', 'order' => 'name')); $filterBrand = Yii::app()->request->getParam('b'); if ($filterBrand > 0) { $where .= ' and brand_id=:brandId'; $params[':brandId'] = $filterBrand; $filterBrand = Brands::model()->findByPk($filterBrand)->name; } $catalog = Catalog::model()->findAll(array('select' => $select, 'condition' => $where, 'params' => $params, 'order' => $sort, 'limit' => $per_page, 'offset' => ($page - 1) * $per_page)); $cnt = Catalog::model()->count(array('condition' => $where, 'params' => $params)); $pages = ceil($cnt / $per_page); $data = array('rubric' => $rubric, 'data' => $catalog, 'brands' => $brands, 'filterBrand' => $filterBrand, 'pages' => $pages, 'page' => $page, 'page_link' => '?' . Yii::app()->request->getQueryString(), 'pp' => $per_page); $this->render('/catalog/rubric', $data); }
public function editAction($dealerId = NULL) { $this->view->setVar("title", "Редагування дилера"); $user = $this->session->get("user"); $methodistBrands = \BrandsMethodists::find("user_id=" . $user->id)->toArray(); $methodistActivities = \ActivitiesMethodists::find("user_id=" . $user->id)->toArray(); $dealer = $dealerId ? \Dealers::findFirst($dealerId) : new \Dealers(); if ($dealerId and !$dealer->id) { // не найден такой диллер $this->view->pick("dealer/not-found"); return; } $city = $dealer->City; $this->view->regionId = $city ? $city->Region->id : NULL; $dealerBrands = $dealer->id ? $dealer->DealersBrands->toArray() : array(); $dealerActivities = $dealer->id ? \DealersActivities::find("dealer_id=" . $dealer->id)->toArray() : array(); $this->view->dealers = \Dealers::find(array('order' => 'title')); $this->view->regions = \Region::find(); $this->view->regionFirst = $this->view->regions[0]; $this->view->cities = \City::find(); $this->view->staffListGroup = \StafflistGroup::find(); $this->view->brands = BrandsService::getForChosenEntity(\Brands::find()->toArray(), $methodistBrands, $dealerBrands); $this->view->activities = ActivitiesService::getForChosenEntity(\Activities::find()->toArray(), $methodistActivities, $dealerActivities); $this->view->dealerStatuses = \DealerStatuses::find(); $controllers = \Users::query()->rightJoin("UserGroups")->where("UserGroups.group_id = 3")->execute(); $this->view->controllers = $controllers; $this->view->dealerControllers = $dealer->DealersControllers; $this->view->dealer = $dealer; $this->view->saved = $this->request->get("saved"); }
public function getBrandsArray() { $brands = Brands::model()->findAll(array('order' => 'name')); $array = array(0 => '-выберите-'); foreach ($brands as $k => $v) { $array[$v->id] = $v->name; } return $array; }
public function getBrands() { $brandModel = new Brands(); $result = $brandModel->getBrands(); /*foreach ($result as $value) { echo ' <div class="servicesitem"> <div class="front"> <div data-icon="" class="icon"></div> <p>'.$value['site'].'</p> </div> <div class="back"> <h3>'.$value['nume'].'</h3> </div> </div> '; }*/ return $result; }
/** * Возвращает список брендов для пересохранения (дилера, курса, и тд.) * @param $brandsMethodist - все доступные бренды методиста * @param $entityBrands - бренды сущности * @param array $formBrands - бренды из формы * @return array */ public static function getCalculationResult($brandsMethodist, $entityBrands, array $formBrands) { $brandsAll = \Brands::find(); $data = array(); foreach ($brandsAll as $brand) { $issetInMethodist = EntityService::inEntityRecursive($brandsMethodist, $brand->id, "brand_id"); $issetInEntity = EntityService::inEntityRecursive($entityBrands, $brand->id, "brand_id"); // если бренд отсутствует у методиста и присудствует у entity if (!$issetInMethodist and $issetInEntity) { $data[] = $brand; } } if ($formBrands === array()) { return $data; } $brandsByForm = \Brands::find("id IN (" . implode(",", $formBrands) . ")"); foreach ($brandsByForm as $brandByForm) { $data[] = $brandByForm; } return $data; }
public function editAction($id = NULL) { $this->view->title = "Редагувати студента"; $this->view->nothing = true; $this->view->ind_code = $this->request->get("ind_code"); if (!is_null($this->view->ind_code) && $this->checkINN($this->view->ind_code) || !is_null($id)) { $this->view->nothing = false; $this->view->student = is_null($id) ? \Students::findFirst("ind_code = " . $this->view->ind_code) : \Students::findFirst($id); $this->view->user = $this->session->get("user"); $methodistBrands = \BrandsMethodists::find("user_id=" . $this->view->user->id)->toArray(); $methodistActivities = \ActivitiesMethodists::find("user_id=" . $this->view->user->id)->toArray(); if ($this->view->student != NULL) { $this->view->ind_code = $this->view->student->ind_code; $this->view->user = \Users::findFirst($this->view->student->user_id); $studentBrands = BrandsService::getStudentBrands($this->view->student); $studentActivities = ActivitiesService::getStudentActivities($this->view->student); $studentPostsJSON = array(); if ($this->view->student->StudentsPosts != NULL) { foreach ($this->view->student->StudentsPosts as $sp) { //{"dealer":"1","post":"2","brands":["2", "5"],"activities":["1"],"rate":"1.0","appoint_date":"2015-04-01"} $studentPostsJSON[$sp->id] = array(); $studentPostsJSON[$sp->id]["dealer"] = $sp->dealer; $studentPostsJSON[$sp->id]["post"] = $sp->post; $array = array(); foreach ($sp->StudentsPostsBrands as $spb) { $array[] = $spb->Brands->id; } $studentPostsJSON[$sp->id]["brands"] = $array; $array = array(); foreach ($sp->StudentsPostsActivities as $spa) { $array[] = $spa->Activities->id; } $studentPostsJSON[$sp->id]["activities"] = $array; $studentPostsJSON[$sp->id]["rate"] = $sp->rate; $studentPostsJSON[$sp->id]["appoint_date"] = $sp->appoint_date; } } //$this->view->student->StudentsEducation; } else { $this->view->student = new \Students(); $this->view->user = new \Users(); $studentPostsJSON = array(); $studentBrands = array(); $studentActivities = array(); } $this->view->brands = BrandsService::getForChosenEntity(\Brands::find()->toArray(), $methodistBrands, $studentBrands); $this->view->activities = ActivitiesService::getForChosenEntity(\Activities::find()->toArray(), $methodistActivities, $studentActivities); $this->view->allEducations = \Educations::find("parent_id is NULL"); $this->view->allDealers = \Dealers::find(); $this->view->studentPostsJSON = $studentPostsJSON; } }
<?php /** * [PHPB2B] Copyright (C) 2007-2099, Ualink Inc. All Rights Reserved. * The contents of this file are subject to the License; you may not use this file except in compliance with the License. * * @version $Revision: 2048 $ */ define('CURSCRIPT', 'list'); require "../libraries/common.inc.php"; require "../share.inc.php"; uses("brand", "brandtype"); $brand = new Brands(); $brandtype = new Brandtypes(); $condition = null; $conditions = array(); $viewhelper->setTitle(L("brands", "tpl")); $viewhelper->setPosition(L("brands", "tpl"), "brand.php"); if (isset($_GET['catid'])) { $typeid = intval($_GET['catid']); //$conditions[] = "type_id='".$typeid."'";//after 4.0.1 $type_info = $pdb->GetRow("SELECT * FROM {$tb_prefix}brandtypes WHERE id='" . $typeid . "'"); if (!empty($type_info)) { $type_ids = $pdb->GetArray("SELECT id FROM {$tb_prefix}brandtypes WHERE parent_id='" . $typeid . "' OR id='" . $typeid . "'"); foreach ($type_ids as $key => $val) { $tmp[] = $val['id']; } if (!empty($tmp)) { $conditions[] = "type_id IN (" . implode(",", $tmp) . ")"; } }
public function show($id) { $brand = Brands::findorFail($id); return view('backoffice.brands.show', compact('brand')); }
/** * [PHPB2B] Copyright (C) 2007-2099, Ualink Inc. All Rights Reserved. * The contents of this file are subject to the License; you may not use this file except in compliance with the License. * * @version $Revision: 2075 $ */ require "../libraries/common.inc.php"; uses("brand", "attachment", "brandtype", "typeoption"); require LIB_PATH . 'page.class.php'; require LIB_PATH . 'cache.class.php'; require "session_cp.inc.php"; $attachment = new Attachment('pic'); $brandtypes = new Brandtypes(); $typeoption = new Typeoption(); $brand = new Brands(); $cache = new Caches(); $page = new Pages(); $conditions = array(); $tpl_file = "brand"; setvar("AskAction", $typeoption->get_cache_type("common_option")); if (isset($_GET['do'])) { $do = trim($_GET['do']); $action = trim($_GET['action']); if (!empty($_GET['id'])) { $id = intval($_GET['id']); } if ($do == "search") { if (isset($_GET['q'])) { $conditions[] = "Brand.name like '%" . trim($_GET['q']) . "%'"; }
public function actionDelete($id) { $brand = Brands::model()->findByPk($bid); $model = Addresses::model()->findByPk($id)->delete(); if (!Yii::app()->request->isAjaxRequest) { $this->redirect('/admin/brands/' . $bid . '/addresses/'); } }
?> </div> </div> <br class="clear" /> </div> <div class="row"> <div class="label"> <?php echo $form->labelEx($model, 'brand_id'); ?> </div> <div class="field"> <?php echo $form->dropDownList($model, 'brand_id', Brands::model()->getBrandsArray()); ?> <?php echo $form->error($model, 'brand_id'); ?> </div> </div> <div class="row"> <div class="col3"> <div class="label"> <?php echo $form->labelEx($model, 'sale'); ?> </div> <div class="field">
<?php echo $form->error($model, 'logo_bg'); ?> </div> </div> <div class="clear"></div> </div> <div class="row"> <div class="label"> <?php echo $form->labelEx($model, 'categories_id'); ?> </div> <div class="field checkbox_list"> <?php echo CHtml::checkBoxList('Categories[]', explode(',', $model->categories_id), Brands::model()->getCategoriesArray(), array('separator' => ' ', 'template' => '<span class="item">{input} {label}</span>')); ?> <?php echo $form->error($model, 'categories_id'); ?> </div> </div> <div class="row"> <div class="label"> <?php echo $form->labelEx($model, 'text'); ?> </div> <div class="field"> <?php $this->widget('application.extensions.tinymce.ETinyMce', array('name' => get_class($model) . '[text]', 'value' => $model->getAttribute('text'), 'height' => '300px'));
<span><?php echo $rubric->name; ?> </span> <?php echo CHtml::link('Свойства', '#', array('class' => 'btn right cancel', 'onclick' => '$("#rubric_propeties").toggle();return false;')); ?> <?php echo CHtml::link('Вводный текст', '#', array('class' => 'btn right cancel', 'onclick' => '$("#rubric_text").toggle();return false;')); ?> <?php echo CHtml::link('Создать', $rubric->getLink() . 'add', array('class' => 'btn right')); ?> </div> <div id="rubric_text" class="none"> <?php echo $this->renderPartial('/text/_form', array('rubric' => $rubric, 'text' => $text)); ?> </div> <div id="rubric_propeties" class="none"> <?php echo $this->renderPartial('/rubrics/_propeties', array('rubric' => $rubric)); ?> </div> <?php $this->widget('zii.widgets.grid.CGridView', array('template' => '{summary} {pager} {items} {pager}', 'id' => 'data-grid', 'dataProvider' => $model->search(), 'pager' => array('class' => 'CLinkPager', 'firstPageLabel' => 'Первая', 'prevPageLabel' => 'Предыдущая', 'nextPageLabel' => 'Следующая', 'lastPageLabel' => 'В конец', 'header' => '<b>Страницы: </b>'), 'summaryText' => 'Показано {start} - {end} позиций. Всего найдено <b>{count}</b> записей', 'filter' => $model, 'columns' => array('id', array('name' => 'finish', 'type' => 'html', 'header' => 'Сроки', 'value' => '$data->start."<br /><br />".$data->finish'), 'name', 'announce', array('name' => 'brand_id', 'type' => 'html', 'value' => '"<img src=\'/userdata/brands/brands_".$data->brand->id."/thumb_s/".$data->brand->logo."\' />"', 'htmlOptions' => array('align' => 'center'), 'filter' => Brands::model()->getBrandsArray()), array('class' => 'EImageColumn', 'name' => 'image', 'parent_id' => 'id', 'pathPrefix' => '/userdata/sales/sales_', 'pathThumb' => '/thumb_s/', 'link' => true, 'htmlOptions' => array('align' => 'center', 'width' => 100)), array('name' => 'status', 'filter' => $this->defaultStatus, 'value' => 'Yii::app()->controller->getRuStatus($data->status)'), array('class' => 'CButtonColumn', 'updateButtonLabel' => 'Изменить', 'updateButtonUrl' => '"update/".$data->primaryKey."/?".Yii::app()->request->queryString', 'deleteButtonLabel' => 'Удалить', 'deleteButtonUrl' => '"delete/".$data->primaryKey."/?".Yii::app()->request->queryString'))));
* Licensed under The Languages Packages Licenses. * Support : phpb2b@hotmail.com * * @version $Revision$ */ require "../libraries/common.inc.php"; require "room.share.php"; require LIB_PATH . 'page.class.php'; require LIB_PATH . 'cache.class.php'; uses("brand", "attachment", "brandtype"); require LIB_PATH . 'time.class.php'; require CACHE_PATH . "cache_type.php"; $cache = new Caches(); $attachment = new Attachment('pic'); $brandtypes = new Brandtypes(); $brand = new Brands(); $page = new Pages(); $tpl_file = "brand"; if (empty($companyinfo)) { flash("pls_complete_company_info", "company.php", 0); } if (isset($_POST['save']) && !empty($company_id)) { $company->newCheckStatus($companyinfo['status']); if (!empty($_POST['data']['brand'])) { $vals = $_POST['data']['brand']; if (isset($_POST['id'])) { $id = intval($_POST['id']); } $attachment->rename_file = "brand-" . ($brand->getMaxId() + 1); if (!empty($id)) { $attachment->insert_new = false;
public function destroy($id) { Brands::where('brands_id', '=', $id)->delete(); return $this->response(array('statusCode' => 100, 'statusDescription' => 'Success', 'message' => "Brands Deleted Successfully")); }
public function searching($term) { $condition = array("New" => 1, "Perfect" => 2, "Good" => 3, "Blemist" => 4); $cond_prod_ids = array(); $product_ids = array(); $pro_ids = array(); $brand_prod_ids = array(); $cat_prod_ids = array(); $tag_prod_ids = array(); //Search by product condition if (in_array($term, $condition)) { $cond_prod_ids = Product::where("condition", "=", $condition[$term])->lists('products_id'); } //Search by product attribute name $product_values_ids = ProductsOptionsValues::where('products_options_values_name', 'LIKE', '%' . $term . '%')->lists('products_options_values_id'); if ($product_values_ids) { $product_ids = DB::table('bn_products_attributes')->whereIn('options_values_id', $product_values_ids)->lists('products_id'); } //Search by product name or description $pro_ids = ProductsDescription::where('products_name', 'LIKE', '%' . $term . '%')->orWhere('products_description', 'LIKE', '%' . $term . '%')->lists('products_id'); //Search by product brand $brand_ids = Brands::where('brand_name', 'LIKE', '%' . $term . '%')->lists('brands_id'); if ($brand_ids) { $brand_prod_ids = Product::whereIn("brand", $brand_ids)->lists('products_id'); } //Search product by category $cat_ids = Categories::where('title', 'LIKE', '%' . $term . '%')->lists('categories_id'); if ($cat_ids) { $cat_prod_ids = DB::table('bn_products_to_categories')->whereIn('categories_id', $cat_ids)->lists('products_id'); } //Search product by tags $tag_ids = Tags::where('title', 'LIKE', '%' . $term . '%')->lists('tags_id'); if ($tag_ids) { $tag_prod_ids = DB::table('bn_products_to_tags')->whereIn('tags_id', $tag_ids)->lists('products_id'); } $result_prod_ids = array_merge($product_ids, $cond_prod_ids, $pro_ids, $brand_prod_ids, $cat_prod_ids, $tag_prod_ids); $products = Product::whereIn('products_id', $result_prod_ids)->where('products_status', '1')->paginate(15); //->get(); if ($products) { $products = $this->product_add_detail($products); return $this->response(array('statusCode' => 100, 'statusDescription' => 'Success', 'products' => json_decode($products->toJson(), true))); } else { return $this->response(array('statusCode' => 400, 'statusDescription' => 'Not Found')); } }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer $id the ID of the model to be loaded * @return Brands the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Brands::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
public function actionSearch() { // страница $page = Yii::app()->request->getParam('page'); if (!$page && !is_numeric($page)) { $page = 1; } $per_page = 10; // ключевое слово $select = '*'; $where = '1'; $string = Yii::app()->request->getParam('string'); $string = strip_tags($string); if (isset($_GET['string'])) { if ($string) { $select .= ', MATCH(name) AGAINST (:string) as description'; $where .= " and (MATCH(name) AGAINST(:string) > 5 OR name like '%" . $string . "%' OR art like '%" . $string . "%')"; $params[':string'] = $string; $rubric = new Rubrics(); $rubric->parent_id = -1; $rubric->name = $string; } else { Yii::app()->user->setFlash('no_search_string', 'Задана пустая строка. Введите поисковую фразу.'); } } /* бренды */ $brands = Brands::model()->findAll(array('condition' => 'status=1', 'order' => 'name')); $filterBrand = Yii::app()->request->getParam('b'); if ($filterBrand > 0) { $where .= ' and brand_id=:brandId'; $params[':brandId'] = $filterBrand; $filterBrand = Brands::model()->findByPk($filterBrand)->name; } if (!$rubric) { $rubric = new Rubrics(); $rubric->parent_id = 1; $rubric->name = $filterBrand; } /* производитель аксессуаров */ $accessories = Accessories::model()->findAll(array('condition' => 'status=1', 'order' => 'name')); $filterAccessories = Yii::app()->request->getParam('a'); if ($filterAccessories > 0) { $where .= ' and accessories_id=:accessoriesId'; $params[':accessoriesId'] = $filterAccessories; $filterAccessories = Accessories::model()->findByPk($filterAccessories)->name; } if (!$rubric) { $rubric = new Rubrics(); $rubric->parent_id = 1; $rubric->name = $filterAccessories; } $catalog = Catalog::model()->findAll(array('select' => $select, 'condition' => $where, 'params' => $params, 'order' => $sort, 'limit' => $per_page, 'offset' => ($page - 1) * $per_page)); $cnt = Catalog::model()->count(array('condition' => $where, 'params' => $params)); $pages = ceil($cnt / $per_page); $data = array('rubric' => $rubric, 'data' => $catalog, 'brands' => $brands, 'accessories' => $accessories, 'pages' => $pages, 'page' => $page, 'page_link' => '?' . Yii::app()->request->getQueryString(), 'pp' => $per_page); $this->render('/catalog/rubric', $data); }
/** * [PHPB2B] Copyright (C) 2007-2099, Ualink Inc. All Rights Reserved. * The contents of this file are subject to the License; you may not use this file except in compliance with the License. * * @version $Revision: 2075 $ */ function smarty_block_brand($params, $content, &$smarty, &$repeat) { $conditions = array(); $param_count = count($smarty->_tag_stack); if (empty($params['name'])) { $params['name'] = "brand"; } if (class_exists("Brands")) { $brand = new Brands(); $brand_controller = new Brand(); } else { uses("brand"); $brand = new Brands(); $brand_controller = new Brand(); } if (isset($params['type'])) { $type = explode(",", $params['type']); $type = array_unique($type); foreach ($type as $val) { switch ($val) { case 'image': $conditions[] = "picture!=''"; break; case 'hot': $orderbys[] = "hits DESC"; break; case 'commend': $conditions[] = "if_commend='1'"; break; default: break; } } } if (isset($params['companyid'])) { $conditions[] = "b.company_id=" . $params['companyid']; } if (isset($params['memberid'])) { $conditions[] = "b.member_id=" . $params['memberid']; } if (isset($params['typeid'])) { $conditions[] = "b.type_id=" . $params['typeid']; } if (isset($params['removal'])) { $conditions[] = "b.id!=" . $params['removal']; } $orderby = null; if (!empty($orderbys)) { $orderby .= " ORDER BY " . implode(",", $orderbys); } if (isset($params['orderby'])) { $orderby = " ORDER BY " . implode(",", array(trim($params['orderby']), $orderby)) . " "; } if (empty($orderby)) { $orderby = " ORDER BY id DESC "; } $brand->setCondition($conditions); $limit = $offset = 0; if (isset($params['row'])) { $limit = $params['row']; } if (isset($params['start'])) { $offset = $params['start']; } $brand->setLimitOffset($offset, $limit); $sql = "SELECT id,name,name as title,picture,alias_name,description,description as content FROM {$brand->table_prefix}brands b " . $brand->getCondition() . "{$orderby}" . $brand->getLimitOffset(); if (empty($smarty->blockvars[$param_count])) { $smarty->blockvars[$param_count] = $brand->GetArray($sql); if (!$smarty->blockvars[$param_count]) { return $repeat = false; } } if (list($key, $item) = each($smarty->blockvars[$param_count])) { $repeat = true; $url = $brand->getPermaLink($item['id']); $item['url'] = $url; $item['content'] = strip_tags($item['content']); if (isset($params['titlelen'])) { $item['title'] = mb_substr(strip_tags($item['name']), 0, $params['titlelen']); } $item['link'] = '<a title="' . $item['name'] . '" href="' . $url . '">' . $item['title'] . '</a>'; if (isset($params['infolen'])) { if (isset($item['content'])) { $item['content'] = mb_substr(pb_strip_spaces($item['description']), 0, $params['infolen']); } } $item['src'] = $item['thumb'] = "attachment/" . $item['picture'] . ".small.jpg"; $smarty->assign($params['name'], $item); } else { $repeat = false; reset($smarty->blockvars[$param_count]); } if (!is_null($content)) { print $content; } if (!$repeat) { $smarty->blockvars[$param_count] = array(); } }
/** * Get active/applied filters to make easier to cancel them. */ public function getActiveFilters($rootcat='goods') { // Render links to cancel applied filters like prices, manufacturers, attributes. $menuItems = array(); $url = explode(';', Yii::app()->request->getQuery('url')); $criteria=new CDbCriteria; $criteria->addInCondition('t.url', $url); $criteria->order = 't.name'; $categ = Categories::model()->findAll($criteria); $manufacturers = array_filter(explode(';', Yii::app()->request->getQuery('brand'))); $manufacturers = Brands::model()->findAllByPk($manufacturers); $accounts = array_filter(explode(';', Yii::app()->request->getQuery('account'))); $accounts = User::model()->findAllByPk($accounts); $shops = array_filter(explode(';', Yii::app()->request->getQuery('shop'))); $shops = Shops::model()->findAllByPk($shops); if(!empty($categ)) { foreach($categ as $category) { if($category->url != 'goods' && $category->url != 'services' && $category->url != 'all'){ array_push($menuItems, array( 'mode'=>'category', 'label'=> $category->name, 'url' => Yii::app()->request->removeUrlParamCat($rootcat, $category->url), 'titlecat'=>$category->url )); } } } if(!empty($manufacturers)) { foreach($manufacturers as $manufacturer) { array_push($menuItems, array( 'mode'=>'brand', 'label'=> $manufacturer->title, 'url' => Yii::app()->request->removeUrlParam('/store/catalog/view', 'brand', $manufacturer->id) )); } } // Process eav attributes $activeAttributes = $this->getOwner()->activeAttributes; if(!empty($activeAttributes)) { foreach($activeAttributes as $attributeName=>$value) { if(isset($this->getOwner()->eavAttributes[$attributeName])) { $attribute = $this->getOwner()->eavAttributes[$attributeName]; foreach($attribute->options as $option) { if(isset($activeAttributes[$attribute->name]) && in_array($option->id, $activeAttributes[$attribute->name])) { array_push($menuItems, array( 'mode'=>'attributes', 'submode'=>$attribute->name, 'label'=> $option->value, 'url' => Yii::app()->request->removeUrlParam('/store/catalog/view', $attribute->name, $option->id) )); } } } } } if(Yii::app()->request->getQuery('min_price')) { array_push($menuItems, array( 'mode'=>'minprice', 'label'=> Yii::t('StoreModule.core', 'от {minPrice} {c}', array('{minPrice}'=>(int)$this->getCurrentMinPrice(), '{c}'=>Yii::app()->currency->active->symbol)), 'url' => Yii::app()->request->removeUrlParam('/store/catalog/view', 'min_price') )); } if(Yii::app()->request->getQuery('max_price')) { array_push($menuItems, array( 'mode'=>'maxprice', 'label'=> Yii::t('StoreModule.core', 'до {maxPrice} {c}', array('{maxPrice}'=>(int)$this->getCurrentMaxPrice(), '{c}'=>Yii::app()->currency->active->symbol)), 'url' => Yii::app()->request->removeUrlParam('/store/catalog/view', 'max_price') )); } if(!empty($accounts)) { foreach($accounts as $account) { array_push($menuItems, array( 'mode'=>'account', 'label'=> $account->username, 'url' => Yii::app()->request->removeUrlParam('/store/catalog/view', 'account', $account->id) )); } } if(!empty($shops)) { foreach($shops as $shop) { array_push($menuItems, array( 'mode'=>'shop', 'label'=> $shop->title, 'url' => Yii::app()->request->removeUrlParam('/store/catalog/view', 'shop', $shop->id) )); } } return $menuItems; }