public function run() { $session = new CHttpSession(); $session->open(); $surSess = Yii::app()->session->get("favorites"); if (!Yii::app()->user->isGuest) { Yii::import('mod.users.models.UserFavorites'); $modelClass = $this->model; $currentModule = Yii::app()->controller->module->id; echo Html::openTag('div', array('id' => 'fav' . $this->model->id, 'class' => 'favorite')); $modelc = UserFavorites::model()->findAll(array('condition' => '`t`.`user_id`=:userid', 'params' => array(':userid' => Yii::app()->user->getId()))); if (count($modelc) < Yii::app()->settings->get('users', 'favorite_limit')) { if (isset($modelClass)) { $model = UserFavorites::model()->find(array('condition' => '`t`.`user_id`=:userid AND `t`.`model_class`=:model_class AND `t`.`object_id`=:id', 'params' => array(':userid' => Yii::app()->user->getId(), ':model_class' => $modelClass->getModelName(), ':id' => $modelClass->id))); if ($this->view && !isset($model)) { // $view = "add"; $params = array('model' => $this->model, 'mod' => $currentModule); } else { $view = "remove"; $params = array('favorite_id' => $model->id, 'model' => $this->model, 'object_id' => $this->model->id, 'mod' => $currentModule); } } } $this->render($view, $params); echo Html::closeTag('div'); } }
/** * @inheritdoc */ public function run() { if (empty($this->links)) { return; } echo Html::openTag($this->tagName, $this->htmlOptions); if ($this->homeLink !== false) { // check whether home link is not a link $active = stripos($this->homeLink, '<a') === false ? ' class="active"' : ''; echo '<li' . $active . '>' . $this->homeLink . $this->separator . '</li>'; } end($this->links); $lastLink = key($this->links); foreach ($this->links as $label => $url) { if (is_string($label) || is_array($url)) { echo '<li>'; echo strtr($this->activeLinkTemplate, ['{url}' => Html::normalizeUrl($url), '{label}' => $this->encodeLabel ? Html::encode($label) : $label]); } else { echo '<li class="active">'; echo str_replace('{label}', $this->encodeLabel ? Html::encode($url) : $url, $this->inactiveLinkTemplate); } if ($lastLink !== $label) { echo $this->separator; } echo '</li>'; } echo Html::closeTag($this->tagName); }
/** * Create ul html tree from data array * @param string $data */ private function createHtmlTree($data) { foreach ($data as $node) { echo Html::openTag('li', array('id' => $this->id . 'Node_' . $node['id'], 'data-status' => $node['switch'], 'class' => $node['switch'] ? '' : 'hiddenClass')); echo Html::link(Html::encode($node->name)); if ($node['hasChildren'] === true) { echo Html::openTag('ul'); $this->createHtmlTree($node['children']); echo Html::closeTag('ul'); } echo Html::closeTag('li'); } }
/** * Create ul html tree from data array * @param string $data */ private function createHtmlTree($data) { foreach ($data as $node) { echo Html::openTag('li', array()); echo Html::link(Html::encode($node->name)); if ($node['hasChildren'] === true) { echo Html::openTag('ul'); $this->createHtmlTree($node['children']); echo Html::closeTag('ul'); } echo Html::closeTag('li'); } }
/** * Render attributes table */ public function run() { $this->_attributes = $this->model->getEavAttributes(); $data = array(); foreach ($this->getModels() as $model) { $data[$model->title] = $model->renderValue($this->_attributes[$model->name]); } if (!empty($data)) { $link = ''; if ($this->tagName) { echo Html::openTag($this->tagName, $this->htmlOptions); } foreach ($data as $title => $value) { $links .= strtr($this->template, array('{title}' => Html::encode($title), '{value}' => Html::encode($value))); } echo $links; if ($this->tagName) { echo Html::closeTag($this->tagName); } } }
protected function renderMenuRecursive($items) { foreach ($items as $item) { if ($this->totalCount) { $totalCount = '<span class="total_count">(' . $item['total_count'] . ')</span>'; } else { $totalCount = ''; } echo Html::openTag('li', isset($item['itemOptions']) ? $item['itemOptions'] : array()); if (isset($item['url'])) { echo Html::link('<i class="fa ' . $item['icon'] . '"></i> ' . $item['label'] . ' ' . $totalCount, $item['url'], isset($item['linkOptions']) ? $item['linkOptions'] : array()); } else { echo Html::link('<i class="fa ' . $item['icon'] . '"></i> ' . $item['label'] . ' ' . $totalCount . '<span class="caret"></span>', "javascript:void(0);", isset($item['linkOptions']) ? $item['linkOptions'] : array('class' => 'dropdown-toggle', 'data-toggle' => "dropdown")); } if (isset($item['items']) && count($item['items'])) { echo "\n" . Html::openTag('ul', $this->submenuHtmlOptions) . "\n"; $this->renderMenuRecursive($item['items']); echo Html::closeTag('ul') . "\n"; } echo Html::closeTag('li') . "\n"; } }
protected function renderItems() { $result = ''; if ($this->widget) { $grid = $this->widget->getId(); } else { $grid = false; } if (isset($this->data->switch)) { $this->items[] = array('htmlOptions' => array('id' => 'FrontControlWidget_switch', 'onClick' => 'control.switchChange(this, "' . $grid . '"); return false;'), 'label' => 'Скрыть', 'url' => $this->data->getSwitchUrl(), 'icon' => 'flaticon-eye'); } if (isset($this->data->primaryKey)) { $this->items[] = array('htmlOptions' => array('id' => 'FrontControlWidget_update', 'target' => '_blank'), 'label' => Yii::t('app', 'UPDATE', 1), 'url' => $this->data->getUpdateUrl(), 'icon' => 'flaticon-edit'); $this->items[] = array('htmlOptions' => array('id' => 'FrontControlWidget_remove', 'onClick' => 'control.remove(this, "' . $grid . '"); return false;'), 'label' => Yii::t('app', 'DELETE'), 'url' => $this->data->getDeleteUrl(), 'icon' => 'flaticon-delete'); } foreach ($this->items as $item) { $result .= Html::openTag('li'); $result .= Html::link('<i class="' . $item['icon'] . '"></i> ' . $item['label'], $item['url'], $item['htmlOptions']); $result .= Html::closeTag('li'); } return $result; }
/** * Renders the content of the portlet. */ public function run() { if (empty($this->links)) { return; } echo Html::openTag($this->tagName, $this->htmlOptions) . "\n"; $content = ''; if ($this->homeLink === null) { $content .= Html::tag('li', array(), Html::link(Yii::t('zii', 'Home'), Yii::app()->homeUrl), true); } elseif ($this->homeLink !== false) { $content .= Html::tag('li', array(), $this->homeLink, true); } foreach ($this->links as $label => $url) { if (is_string($label) || is_array($url)) { $content .= strtr($this->activeLinkTemplate, array('{url}' => Html::normalizeUrl($url), '{label}' => $this->encodeLabel ? Html::encode($label) : $label)); } else { $content .= str_replace('{label}', $this->encodeLabel ? Html::encode($url) : $url, $this->inactiveLinkTemplate); } } echo $content; echo Html::closeTag($this->tagName); }
public function run() { $cs = Yii::app()->getClientScript(); if (Yii::app()->controller->isAjax) { $cs->registerCoreScript('jquery.ui'); $cs->scriptMap = array('jquery.js' => false); } $liContent = ''; $tabContent = ''; $cs->registerScript('tabs', '$(".tabs-form").tabs();', CClientScript::POS_READY); $n = 0; foreach ($this->tabs as $title => $content) { $tabContent .= Html::openTag('div', array('id' => 'tab_' . $n, 'class' => 'tabz')); $tabContent .= is_array($content) ? $content['content'] : $content; $tabContent .= Html::closeTag('div'); $title = preg_match('#^(icon-)#ui', $title) ? '<span class="icon-medium ' . $title . ' noBold"></span>' : $title; $liContent .= '<li><a href="#tab_' . $n . '">' . $title . '</a></li>'; $n++; } echo Html::openTag('div', array('class' => 'tabs-form')); echo '<ul class="tabs">' . $liContent . '</ul>' . $tabContent; echo Html::closeTag('div'); }
<?php if ($this->isAjax) { $this->renderPartial('mod.admin.views.layouts._content-top'); echo Html::openTag('div', array('class' => 'wrapper')); } $this->widget('ext.adminList.GridView', array('dataProvider' => $dataProvider, 'name' => $this->pageName, 'enableHeader' => true, 'selectableRows' => false)); if ($this->isAjax) { echo Html::closeTag('div'); }
/** * List elements generator * * @access public * * @param array $items lists multiple array * @param array $attributes attributes tag * @param bool $isNumeric Is a numeric list? * * @return string * @static */ public static function lists(array $items = [], array $attributes = [], $isNumeric = false) { $parentTag = $isNumeric ? 'ol' : 'ul'; $result = null; foreach ($items as $item) { $result .= Html::openTag('li', !empty($item['attr']) ? $item['attr'] : []); if (!empty($item['parents'])) { $result .= !empty($item['text']) ? $item['text'] : null; $result .= self::lists($item['parents'], !empty($item['parentsAttr']) ? $item['parentsAttr'] : [], !empty($item['parentsIsNumeric']) ? true : false); } else { $result .= $item['text']; } $result .= Html::closeTag('li'); } return self::openTag($parentTag, $attributes) . $result . self::closeTag($parentTag); }
} echo Html::link(Html::image($imgSource, $product->prd->mainImageTitle), array('product/view', 'seo_alias' => $product->prd->seo_alias), array('class' => 'thumbnail')); ?> </td> <td> <?php echo Html::openTag('h3'); ?> <?php echo $product->getRenderFullName(false); ?> <?php echo Html::closeTag('h3'); ?> <?php echo Html::openTag('span', array('class' => 'price')); ?> <?php echo ShopProduct::formatPrice(Yii::app()->currency->convert($product->price)); ?> <?php echo Yii::app()->currency->active->symbol; ?> <?php echo Html::closeTag('span'); ?> </td> <?php if ($config['wholesale']) { ?>
echo Html::closeTag('div'); //if (Yii::app()->request->getQuery($filter['queryKey'])) { // echo Html::link(Yii::t('ShopModule.core', 'сбросить фильтры'), $this->getOwner()->model->viewUrl, array('class' => 'cancel_filter')); //} //echo '<div class="clear"></div>'; } if ($config['filter_enable_attr']) { // Display attributes foreach ($attributes as $attrData) { echo Html::tag('div', array('class' => 'filter-header'), Html::encode($attrData['title']), true); echo Html::openTag('div', array('class' => 'filter-content')); echo Html::openTag('ul', array('class' => 'filter_links')); foreach ($attrData['filters'] as $filter) { $url = Yii::app()->request->addUrlParam('/shop/category/view', array($filter['queryKey'] => $filter['queryParam']), $attrData['selectMany']); $queryData = explode(',', Yii::app()->request->getQuery($filter['queryKey'])); echo Html::openTag('li'); // Filter link was selected. if (in_array($filter['queryParam'], $queryData)) { //print_r($queryData); //var_dump(array_search($filter['queryKey'],$queryData)); echo Html::checkBox('filter[' . $filter['queryKey'] . '][]', true, array('value' => $filter['queryParam'], 'data-id' => $filter['queryKey'], 'data-url' => $url, 'id' => $filter['queryKey'] . '_' . $filter['queryParam'])); } elseif (!$filter['count']) { echo Html::checkBox('filter[' . $filter['queryKey'] . '][]', false, array('value' => $filter['queryParam'], 'data-id' => $filter['queryKey'], 'data-url' => $url, 'id' => $filter['queryKey'] . '_' . $filter['queryParam'], 'disabled' => true)); } else { echo Html::checkBox('filter[' . $filter['queryKey'] . '][]', false, array('value' => $filter['queryParam'], 'data-id' => $filter['queryKey'], 'data-url' => $url, 'id' => $filter['queryKey'] . '_' . $filter['queryParam'])); // echo $filter['title'] . ' <small>(0)</small>'; } echo Html::label($filter['title'] . ' (' . $filter['count'] . ')', $filter['queryKey'] . '_' . $filter['queryParam']); echo Html::closeTag('li'); } echo Html::closeTag('ul');
protected function renderMenuRecursive($items) { $this->level++; foreach ($items as $item) { if ($this->totalCount) { $totalCount = '<span class="total_count">(' . $item['total_count'] . ')</span>'; } else { $totalCount = ''; } if ($this->level == 2) { echo Html::openTag('li', array('class' => 'yamm-content')); } else { echo Html::openTag('li', isset($item['itemOptions']) ? $item['itemOptions'] : array()); } if (isset($item['url'])) { $activeClass = Yii::app()->request->url == '/' . $item['url']['url'] ? 'active' : ''; if (isset($item['linkOptions'])) { $item['linkOptions']['class'] .= ' ' . $activeClass; $linkOptions = $item['linkOptions']; } else { $linkOptions = array(); } echo Html::link($item['label'] . ' ' . $totalCount . $this->level, $item['url'], $linkOptions); } else { echo Html::link($item['label'] . ' ' . $totalCount, "javascript:void(0);", $linkOptions); } if (isset($item['items']) && count($item['items'])) { echo "\n" . Html::openTag('ul', $this->submenuHtmlOptions) . "\n"; $this->renderMenuRecursive($item['items']); echo Html::closeTag('ul') . "\n"; } echo Html::closeTag('li') . "\n"; } }
/** * Renders the content of the portlet. */ public function run() { //if (file_exists(Yii::getPathOfAlias('webroot') . '' . Yii::app()->theme->baseUrl . '/assets/images/bc_defis.png')) { // $this->separator = '<img src="' . Yii::app()->controller->assetsUrl . '/images/bc_defis.png" alt="" />'; // } else { // if($this->separator) // $this->separator = ' '.Yii::app()->settings->get('core', 'bc_defis').' '; //} if (empty($this->links)) { return; } echo Html::openTag($this->tagName, $this->htmlOptions) . "\n"; $links = array(); if ($this->homeLink === null) { $links[] = Html::link(Yii::t('zii', 'Home'), Yii::app()->homeUrl); } elseif ($this->homeLink !== false) { $links[] = $this->homeLink; } foreach ($this->links as $label => $url) { if (is_string($label) || is_array($url)) { $links[] = strtr($this->activeLinkTemplate, array('{url}' => Html::normalizeUrl($url), '{label}' => $this->encodeLabel ? Html::encode($label) : $label)); } else { $links[] = str_replace('{label}', $this->encodeLabel ? Html::encode($url) : $url, $this->inactiveLinkTemplate); } } echo implode($this->separator, $links); echo Html::closeTag($this->tagName); }
} ?> </td> <td> <?php echo Html::textField("quantities[{$index}]", $product['quantity'], array('class' => 'spinner btn-group form-control', 'product_id' => $index)); ?> </td> <td id="price-<?php echo $index; ?> "> <?php echo Html::openTag('span', array('class' => 'price cart-total-product', 'id' => 'row-total-price' . $index)); echo Yii::app()->settings->get('shop', 'wholesale') ? ShopProduct::formatPrice(ShopProduct::formatPrice(Yii::app()->currency->convert($price * $product['model']->pcs * $product['quantity']))) : ShopProduct::formatPrice(Yii::app()->currency->convert($price * $product['quantity'])); echo Html::closeTag('span'); //echo $convertTotalPrice;// echo ShopProduct::formatPrice(Yii::app()->currency->convert($convertPrice, $product['currency_id'])); echo ' ' . Yii::app()->currency->active->symbol; //echo ' '.($product['currency_id'])? Yii::app()->currency->getSymbol($product['currency_id']): Yii::app()->currency->active->symbol; ?> </td> <td style="vertical-align:middle;" width="20px"> <?php echo Html::link('', array('cart/remove', 'id' => $index), array('class' => 'remove')); ?> </td> </tr> <?php }
/** * Render single alert. * @param string $tag Alert html tag. * @param string $type Alert type. * @param string $alert Alert text. * @param array $options Alert type specific options. */ protected function renderAlert($tag, $type, $alert, array $options) { $classes = ['alert', 'in', 'alert-' . $type]; if ($options['block']) { $classes[] = 'alert-block'; } if ($options['fade']) { $classes[] = 'fade'; } Html::addCssClass($options['htmlOptions'], implode(' ', $classes)); echo Html::openTag($tag, $options['htmlOptions']); if ($options['closeText'] !== false) { echo '<a href="#" class="close" data-dismiss="alert">' . $options['closeText'] . '</a>'; } echo $alert; echo Html::closeTag($tag); }
<?php $config = Yii::app()->settings->get('shop'); /** * @var $this SFilterRenderer */ /** * Render filters based on the next array: * $data[attributeName] = array( * 'title'=>'Filter Title', * 'selectMany'=>true, // Can user select many filter options * 'filters'=>array(array( * 'title' => 'Title', * 'count' => 'Products count', * 'queryKey' => '$_GET param', * 'queryParam' => 'many', * )) * ); */ // Render active filters echo $this->render('_currentFilter', array(), true); echo $this->render('_priceFilter', array('config' => $config), true); if (!empty($manufacturers['filters']) || !empty($attributes)) { echo Html::openTag('div', array('class' => 'list-group')); } echo $this->render('_manufacturerFilter', array('config' => $config, 'manufacturers' => $manufacturers, 'attributes' => $attributes), true); echo $this->render('_attributesFilter', array('config' => $config, 'attributes' => $attributes), true); if (!empty($manufacturers['filters']) || !empty($attributes)) { echo Html::closeTag('div'); }
<div class="container"> <div class="row header"> <div class="col-lg-3 col-md-3 col-sm-3 col-xs-6"> <?php echo Html::link($config['site_name'], '/', array('class' => 'navbar-brand')); ?> </div> <div class="col-lg-3 col-md-3 col-sm-3 col-xs-6 col-lg-push-6 col-md-push-6 col-sm-push-6"> <div class="pull-right"> <?php $this->widget('ext.callback.CallbackWidget'); ?> <?php if (!Yii::app()->request->isAjaxRequest) { echo Html::openTag('div', array('id' => 'cart', 'class' => 'small-cart')); } $this->widget('mod.cart.widgets.cart.CartWidget', array('skin' => "currentTheme.views.layouts.partials.widgets.CartWidget1")); if (!Yii::app()->request->isAjaxRequest) { echo Html::closeTag('div'); } ?> </div> </div> <div class="clearfix visible-xs-block"></div> <div class="col-lg-6 col-md-6 col-sm-6 col-xs-12 col-lg-pull-3 col-md-pull-3 col-sm-pull-3"> <span id="header-phone"></span> <?php $this->widget('mod.shop.blocks.search.SearchWidget', array('skin' => "currentTheme.views.layouts.partials.widgets.SearchWidget")); ?>
if ($image) { $img = $image; } else { $img = 'http://placehold.it/' . $this->config['img_view_size']; } echo Html::link(Html::image($img, $model->name, array('class' => 'img-responsive', 'height' => 240)), array('product/view', 'seo_alias' => $data->seo_alias), array('class' => 'thumbnail')); ?> </div> <?php if (isset($model->imagesNoMain)) { ?> <div class="row"> <?php foreach ($model->imagesNoMain as $image) { echo Html::openTag('div', array('class' => 'col-md-3')); echo Html::link(Html::image($image->getUrl($config['img_view_thumbs_size']), $image->title), $image->getUrl(), array('class' => 'thumbnail2', 'rel' => 'gallery')); echo Html::closeTag('div'); } ?> </div> <?php } ?> </div> <div class="col-md-7"> <h3><?php echo Html::encode($model->name); ?> </h3>
} ?> </td> <td> <?php echo Html::textField("quantities[{$index}]", $product['quantity'], array('class' => 'spinner btn-group form-control', 'product_id' => $index)); ?> </td> <td id="price-<?php echo $index; ?> " class="cart-product-sub-total"> <?php echo Html::openTag('span', array('class' => 'cart-sub-total-price', 'id' => 'row-total-price' . $index)); echo Yii::app()->settings->get('shop', 'wholesale') ? ShopProduct::formatPrice(ShopProduct::formatPrice(Yii::app()->currency->convert($price * $product['model']->pcs * $product['quantity']))) : ShopProduct::formatPrice(Yii::app()->currency->convert($price * $product['quantity'])); echo Html::closeTag('span'); //echo $convertTotalPrice;// echo ShopProduct::formatPrice(Yii::app()->currency->convert($convertPrice, $product['currency_id'])); echo ' ' . Yii::app()->currency->active->symbol; //echo ' '.($product['currency_id'])? Yii::app()->currency->getSymbol($product['currency_id']): Yii::app()->currency->active->symbol; ?> </td> <td width="20px" class="romove-item"> <?php echo Html::link('<i class="fa close"></i>', array('/cart/default/remove', 'id' => $index), array('class' => 'remove icon')); ?> </td> </tr> <?php }
/** * Renders the sorter. */ public function renderSorter() { if ($this->dataProvider->getItemCount() <= 0 || !$this->enableSorting || empty($this->sortableAttributes)) { return; } echo Html::openTag('div', array('class' => $this->sorterCssClass)) . "\n"; echo $this->sorterHeader === null ? Yii::t('zii', 'Sort by: ') : $this->sorterHeader; echo "<ul>\n"; $sort = $this->dataProvider->getSort(); foreach ($this->sortableAttributes as $name => $label) { echo "<li>"; if (is_integer($name)) { echo $sort->link($label); } else { echo $sort->link($name, $label); } echo "</li>\n"; } echo "</ul>"; echo $this->sorterFooter; echo Html::closeTag('div'); }
/** * Renders the data items for the grid view. */ public function renderItems() { if ($this->enableHeader) { //$this->enableHeader $params = array(); if (isset($this->name)) { $params['title'] = $this->name; } if ($this->headerOptions && $this->autoColumns) { $params['options'] = array(array('label' => self::t('CHANGE_TABLE'), 'icon' => 'icon-table-2', 'href' => 'javascript:grid.editcolums("' . $this->id . '","' . $this->dataProvider->modelClass . '","' . $this->controller->module->id . '");')); } if (isset($this->headerButtons)) { $params['buttons'] = $this->headerButtons; } Yii::app()->tpl->openWidget($params); } echo Html::openTag('div', array('class' => 'table-responsive')); parent::renderItems(); echo Html::closeTag('div'); if ($this->selectableRows > 0 && $this->enableCustomActions === true && count($this->dataProvider->getData()) > 0) { //echo '<select class="CA" name="test" onChange="customActions(this);">'; if ($this->enableCustomActions === true) { $this->widget('zii.widgets.CMenu', array('id' => $this->getId() . 'Actions', 'encodeLabel' => false, 'submenuHtmlOptions' => array('class' => 'dropdown-menu'), 'htmlOptions' => array('class' => 'btn-group dropup gridActions'), 'items' => array(array('label' => 'Выбрать действие <span class="caret"></span>', 'url' => '#', 'linkOptions' => array('class' => 'btn btn-sm btn-default', 'data-toggle' => 'dropdown', 'aria-haspopup' => "true", 'aria-expanded' => "false"), 'items' => $this->getCustomActions())))); } } $this->renderPager(); if ($this->enableHeader) { //$this->autoColumns && Yii::app()->tpl->closeWidget(); } }