Пример #1
1
 /**
  *### .init()
  *
  * Initializes the widget.
  */
 public function init()
 {
     parent::init();
     $booster = Booster::getBooster();
     $popover = $booster->popoverSelector;
     $tooltip = $booster->tooltipSelector;
     $afterAjaxUpdate = "js:function() {\n\t\t\tjQuery('.popover').remove();\n\t\t\tjQuery('{$popover}').popover();\n\t\t\tjQuery('.tooltip').remove();\n\t\t\tjQuery('{$tooltip}').tooltip();\n\t\t}";
     if (!isset($this->afterAjaxUpdate)) {
         $this->afterAjaxUpdate = $afterAjaxUpdate;
     }
 }
Пример #2
0
 public function registerClientScript()
 {
     if ($this->ajaxUpdate === false) {
         return;
     }
     parent::registerClientScript();
 }
Пример #3
0
 private function getWidgetScript($callback1, $callback2)
 {
     Yii::import('zii.widgets.CListView');
     Yii::app()->clientScript->scripts = array();
     ob_start();
     $widget = new CListView(null);
     $widget->beforeAjaxUpdate = $callback1;
     $widget->afterAjaxUpdate = $callback2;
     $widget->itemView = 'dummy';
     $widget->dataProvider = new CArrayDataProvider(array(1, 2, 3));
     $widget->init();
     $widget->registerClientScript();
     Yii::app()->clientScript->render($out);
     ob_end_clean();
     return $out;
 }
Пример #4
0
	public function init() 
	{
		if (isset($_GET['filter']) && isset($_GET['filterDetails']) && $_GET['filterDetails'] != 0)
			$this->dataProvider->setScopes(array($_GET['filter']=>$_GET['filterDetails']));
		
		parent::init();
	}
Пример #5
0
 public function init()
 {
     if ($this->pager === array('class' => 'CLinkPager')) {
         $this->pager = array('header' => '', 'firstPageCssClass' => '', 'lastPageCssClass' => '', 'prevPageLabel' => '<', 'nextPageLabel' => '>', 'firstPageLabel' => '<<', 'lastPageLabel' => '>>');
     }
     $this->asa('X2BaseListViewBehavior')->setSummaryText();
     $this->ajax = isset($_GET['ajax']) && $_GET['ajax'] === $this->id;
     if ($this->ajax && ob_get_length()) {
         ob_clean();
     }
     if ($this->itemView === null) {
         throw new CException(Yii::t('app', 'The property "itemView" cannot be empty.'));
     }
     parent::init();
     if (!isset($this->htmlOptions['class'])) {
         $this->htmlOptions['class'] = 'list-view';
     }
     if ($this->baseScriptUrl === null) {
         $this->baseScriptUrl = Yii::app()->getAssetManager()->publish(Yii::getPathOfAlias('zii.widgets.assets')) . '/listview';
     }
     if ($this->cssFile !== false) {
         if ($this->cssFile === null) {
             $this->cssFile = $this->baseScriptUrl . '/styles.css';
         }
         Yii::app()->getClientScript()->registerCssFile($this->cssFile);
     }
 }
Пример #6
0
 /**
  *
  */
 public function init()
 {
     // pager labels
     if (!isset($this->pager['firstPageLabel'])) {
         $this->pager['firstPageLabel'] = '<i class="icon-fast-backward"></i>';
     }
     if (!isset($this->pager['lastPageLabel'])) {
         $this->pager['lastPageLabel'] = '<i class="icon-fast-forward"></i>';
     }
     if (!isset($this->pager['nextPageLabel'])) {
         $this->pager['nextPageLabel'] = '<i class="icon-forward"></i>';
     }
     if (!isset($this->pager['prevPageLabel'])) {
         $this->pager['prevPageLabel'] = '<i class="icon-backward"></i>';
     }
     if (!isset($this->pager['maxButtonCount'])) {
         $this->pager['maxButtonCount'] = 5;
     }
     if (!isset($this->pager['hideFirstAndLast'])) {
         $this->pager['hideFirstAndLast'] = true;
     }
     // userPageSize drop down changed
     $this->setUserPageSize();
     // set pagination
     $this->dataProvider->setPagination($this->getPagination());
     parent::init();
 }
Пример #7
0
 /**
  * Sets pager and summary text configuration.
  */
 public function init()
 {
     parent::init();
     $this->pager = array('header' => '', 'firstPageLabel' => 'Awal', 'lastPageLabel' => 'Akhir', 'nextPageLabel' => 'Sesudah >', 'prevPageLabel' => '< Sebelum', 'maxButtonCount' => 5);
     $this->summaryText = 'Menampilkan {start}-{end} dari {count} ' . $this->itemName;
     $this->emptyText = "Tidak ada {$this->itemName}.";
 }
Пример #8
0
 public function init()
 {
     parent::init();
     Yii::app()->bootstrap->enableTransitions();
     Yii::app()->bootstrap->registerCarousel();
     //		Yii::app()->bootstrap->registerScriptFile('bootstrap.min.js',CClientScript::POS_END);
     //		Yii::app()->bootstrap->registerScrollSpy();
 }
Пример #9
0
 protected function initColumns()
 {
     parent::initColumns();
     if ($this->filter !== null and $this->filterCleanColumn) {
         //Adiciona coluna para limpar filtros
         $this->htmlOptions['class'] .= ' hasFilter';
         $this->addCleanFiltersColumn();
     }
 }
Пример #10
0
 public function init()
 {
     if (!isset($this->sizerVariants[0])) {
         $this->sizerVariants = array(10);
     }
     $pageSize = Yii::app()->request->getQuery($this->sizerAttribute, $this->sizerVariants[0]);
     $this->dataProvider->pagination->pageSize = $pageSize;
     parent::init();
 }
Пример #11
0
 /**
  * Widget initialization
  *
  * @return void
  */
 public function init()
 {
     $this->initPageSizes();
     parent::init();
     // live hack before yii 1.1.15 release:
     strtolower($this->ajaxType) != 'post' || ($this->beforeAjaxUpdate = 'function(id, options) {
         options.data = $.extend(options.data, ' . json_encode(array(Yii::app()->getRequest()->csrfTokenName => Yii::app()->getRequest()->csrfToken)) . ');
     }');
 }
 /**
  * Renders the pager.
  */
 public function renderPager()
 {
     parent::renderPager();
     $pager = $this->dataProvider->getPagination();
     if ($pager && $pager->getPageCount() > 1) {
         echo CHtml::link('Развернуть', Yii::app()->createUrl('/catalog/catalog/show', array('id' => $this->modelId, 'group_id' => $this->activeGroupId, 'showAll' => true)), array('class' => 'close filter'));
     } elseif (!$pager) {
         echo CHtml::link('Свернуть', Yii::app()->createUrl('/catalog/catalog/show', array('id' => $this->modelId, 'group_id' => $this->activeGroupId)), array('class' => 'close filter'));
     }
 }
Пример #13
0
 /**
  * Initializes the widget.
  */
 public function init()
 {
     parent::init();
     $popover = Yii::app()->bootstrap->popoverSelector;
     $tooltip = Yii::app()->bootstrap->tooltipSelector;
     $afterAjaxUpdate = "js:function() {\r\n\t\t\tjQuery('.popover').remove();\r\n\t\t\tjQuery('{$popover}').popover();\r\n\t\t\tjQuery('.tooltip').remove();\r\n\t\t\tjQuery('{$tooltip}').tooltip();\r\n\t\t}";
     if (!isset($this->afterAjaxUpdate)) {
         $this->afterAjaxUpdate = $afterAjaxUpdate;
     }
 }
Пример #14
0
 /**
  * Initializes the view.
  */
 public function init()
 {
     if ($this->enablePagination === false) {
         $this->dataProvider->setPagination(false);
     }
     if ($this->enableAlphaPagination && $this->dataProvider->getAlphaPagination() === false) {
         $this->enableAlphaPagination = false;
     }
     parent::init();
 }
Пример #15
0
 public function init()
 {
     if (!$this->cssFile) {
         $this->cssFile = Yii::app()->getBaseUrl(true) . "/css/list-view/style.css";
     }
     if (!isset($this->pager['cssFile']) || !$this->pager['cssFile']) {
         $this->pager['cssFile'] = Yii::app()->getBaseUrl(true) . "/css/pager.css";
     }
     parent::init();
 }
Пример #16
0
 /**
  * Initializes the list view.
  * This method will initialize required property values and instantiate {@link columns} objects.
  */
 public function init()
 {
     if ($this->listSorted === true) {
         /*To use this widget, data provider must be an instance of CActiveDataProvider*/
         if (!$this->dataProvider instanceof CActiveDataProvider) {
             throw new CException(Yii::t('zii', 'Data provider must be an instance of CActiveDataProvider'));
         }
         if ($this->descSort !== true) {
             $sort_direction = 'ASC';
         } else {
             $sort_direction = 'DESC';
         }
         $this->dataProvider->setSort(array('defaultOrder' => $this->dataProvider->model->tableAlias . '.' . $this->orderField . ' ' . $sort_direction));
     }
     parent::init();
 }
 /**
  * Init the widget
  */
 public function init()
 {
     parent::init();
     EBootstrap::mergeClass($this->htmlOptions, array('bootstrap-list-view'));
     switch ($this->pagerAlign) {
         case 'centered':
             EBootstrap::mergeClassString($this->pagerCssClass, array('pagination-centered'));
             break;
         case 'right':
             EBootstrap::mergeClassString($this->pagerCssClass, array('pagination-right'));
             break;
     }
     if ($this->cssFile === false) {
         $cssFile = dirname(__FILE__) . '/css/bootstrap.css';
         $this->cssFile = Yii::app()->getAssetManager()->publish($cssFile);
         Yii::app()->clientScript->registerCssFile($this->cssFile);
     }
 }
Пример #18
0
 /**
  *### .init()
  *
  * Initializes the widget.
  */
 public function init()
 {
     parent::init();
     $popover = Yii::app()->bootstrap->popoverSelector;
     $tooltip = Yii::app()->bootstrap->tooltipSelector;
     $afterAjaxUpdate = "js:function() {\n\t\t\tjQuery('.popover').remove();\n\t\t\tjQuery('{$popover}').popover();\n\t\t\tjQuery('.tooltip').remove();\n\t\t\tjQuery('{$tooltip}').tooltip();\n\t\t}";
     if (is_string($this->pagerCssClass) && $this->pagerCssClass == "td-pager") {
         $this->pagerCssClass = 'pagination td-pager';
         $this->pager['class'] = 'core.widgets.TPager';
     } else {
         if (is_string($this->pagerCssClass) && $this->pagerCssClass == "f**k-pager") {
             $this->pagerCssClass = 'pagination td-pager f**k-pager';
             $this->pager['class'] = 'core.widgets.TFuckPager';
         }
     }
     if (!isset($this->afterAjaxUpdate)) {
         $this->afterAjaxUpdate = $afterAjaxUpdate;
     }
 }
Пример #19
0
 /**
  * Redeclare initialization
  */
 public function init()
 {
     parent::init();
     if ($this->enablePageSizing) {
         if ($pageSize = Yii::app()->request->getParam($this->id . '-page-size')) {
             $this->pageSize = $pageSize;
             Yii::app()->session[$this->id . '-page-size'] = $this->pageSize;
         } elseif (isset(Yii::app()->session[$this->id . '-page-size'])) {
             $this->pageSize = Yii::app()->session[$this->id . '-page-size'];
         }
         if ($this->dataProvider->getPagination() !== false) {
             $this->dataProvider->getPagination()->setPageSize($this->pageSize);
         } else {
             $this->dataProvider->setPagination(array('class' => 'CPagination', 'pageSize' => $this->pageSize));
             $this->enablePagination = true;
         }
         $this->dataProvider->getData(true);
     }
 }
Пример #20
0
 public function registerClientScript()
 {
     if (!Yii::app()->request->isAjaxRequest) {
         parent::registerClientScript();
         $cs = Yii::app()->clientScript;
         $basePath = Yii::getPathOfAlias('ext.NPager.assets');
         $baseUrl = Yii::app()->getAssetManager()->publish($basePath);
         $id = parent::getId();
         $cs = Yii::app()->clientScript;
         $cs->registerCoreScript('jquery');
         $js = "function {$id}" . "_changePageSize(id,url)\n";
         $js .= "{\n";
         $js .= "    url = {url:url+\$('#'+id+'>.{$this->pagerlistCssClass}>select').val()};\n";
         $js .= "    \$.fn.yiiListView.update(id,url);\n";
         $js .= "}\n";
         $js .= "\n";
         $cs->registerScript($this->getId(), $js, CClientScript::POS_END);
         $cs->registerCssFile($baseUrl . '/style.css');
     }
 }
Пример #21
0
 /**
  * Renders the item view.
  * This is the main entry of the whole view rendering.
  *
  * This is override function that supports multiple columns
  */
 public function renderItems()
 {
     $numColumns = (int) $this->columns;
     // Number of columns
     if ($numColumns < 2) {
         parent::renderItems();
         return;
     }
     echo CHtml::openTag($this->itemsTagName, array('class' => $this->itemsCssClass)) . "\n";
     $data = $this->dataProvider->getData();
     if (($n = count($data)) > 0) {
         // Compute column width
         $width = 100 / $numColumns;
         // Initialize table
         echo CHtml::openTag('table') . CHtml::openTag('tr');
         $owner = $this->getOwner();
         $render = $owner instanceof CController ? 'renderPartial' : 'render';
         //$j = 0;
         foreach ($data as $i => $item) {
             // Open cell
             echo CHtml::openTag('td', array('style' => 'width:' . $width . '%; vertical-align:top;'));
             $data = $this->viewData;
             $data['index'] = $i;
             $data['data'] = $item;
             $data['widget'] = $this;
             $owner->{$render}($this->itemView, $data);
             // Close cell
             echo CHtml::closeTag('td');
             // Change row
             if (($i + 1) % $numColumns == 0) {
                 echo CHtml::closeTag('tr') . CHtml::openTag('tr');
             }
         }
         // Close table
         echo CHtml::closeTag('tr') . CHtml::closeTag('table');
     } else {
         $this->renderEmptyText();
     }
     echo CHtml::closeTag($this->itemsTagName);
 }
Пример #22
0
 public function init()
 {
     $this->ajax = isset($_GET['ajax']) && $_GET['ajax'] === $this->id;
     if ($this->ajax && ob_get_length()) {
         ob_clean();
     }
     if ($this->itemView === null) {
         throw new CException(Yii::t('app', 'The property "itemView" cannot be empty.'));
     }
     parent::init();
     if (!isset($this->htmlOptions['class'])) {
         $this->htmlOptions['class'] = 'list-view';
     }
     if ($this->baseScriptUrl === null) {
         $this->baseScriptUrl = Yii::app()->getAssetManager()->publish(Yii::getPathOfAlias('zii.widgets.assets')) . '/listview';
     }
     if ($this->cssFile !== false) {
         if ($this->cssFile === null) {
             $this->cssFile = $this->baseScriptUrl . '/styles.css';
         }
         Yii::app()->getClientScript()->registerCssFile($this->cssFile);
     }
 }
Пример #23
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     // register shortlist js
     $uId = (int) Yii::app()->user->id;
     $rId = (int) Yii::app()->user->role_id;
     $roleMember = ROLE_REGISTER_MEMBER;
     $url = Yii::app()->createAbsoluteUrl('site/addShortlist');
     Yii::app()->clientScript->registerScript('shortlist-add-button', "setupShortList({ \n\t\t\tuserId: {$uId},\n\t\t\troleId: {$rId},\n\t\t\troleMember: {$roleMember},\n\t\t\taddShortListUrl: '{$url}'\n\t\t});");
     // default widget setting
     Yii::app()->clientScript->registerScript('listing-widget', 'setupListingWidget();');
     $this->htmlOptions['class'] = 'listing-widget';
     $this->itemView = 'application.components.views.listing-widget.item';
     $this->sortableAttributes = array('date_listed');
     $this->pagerCssClass = 'pag-container';
     $this->afterAjaxUpdate = "function () { \n\t\t\t\$('select').uniform();\n\t\t\twindow.addthis.layers.refresh();\n\t\t\tsetupListingWidget();\n\t\t}";
     $this->pager = array('header' => '', 'cssFile' => false, 'nextPageLabel' => 'Next', 'prevPageLabel' => 'Previous', 'firstPageLabel' => '', 'firstPageCssClass' => 'hide', 'lastPageLabel' => '', 'lastPageCssClass' => 'hide', 'selectedPageCssClass' => 'active', 'maxButtonCount' => 8, 'htmlOptions' => array('class' => 'pagination'));
     // apply filter
     if (isset($_GET['listing_type'])) {
         $this->listingType = $_GET['listing_type'];
     }
     $this->dataProvider->criteria->compare('listing_type', $this->listingType);
     //get current sort
     $this->dataProvider->sort->sortVar = 's_sort';
     $sortVar = $this->dataProvider->sort->sortVar;
     $this->sortBy = Listing::DEFAULT_SORT_BY;
     if (isset($_GET[$sortVar])) {
         $this->sortBy = $_GET[$sortVar];
     }
     //get current paging
     $this->pageSize = Listing::DEFAULT_ITEM_PERPAGE;
     if (isset($_GET['pageSize'])) {
         $this->pageSize = $_GET['pageSize'];
     }
     $this->dataProvider->pagination->pageSize = $this->pageSize;
     return parent::init();
 }
Пример #24
0
 public function __construct($owner = null)
 {
     $this->emptyText = '<p>' . Yii::t('site', 'No results found') . '</p>';
     parent::__construct($owner);
 }
Пример #25
0
 public function init()
 {
     parent::init();
 }
 public function run()
 {
     parent::run();
     $this->infiniteScrollScript();
 }
Пример #27
0
 /**
  * Initializes the list view.
  * This method will initialize required property values and instantiate {@link columns} objects.
  */
 public function init()
 {
     if ($this->itemView === null) {
         throw new CException(Yii::t('zii', 'The property "itemView" cannot be empty.'));
     }
     if ($this->baseScriptUrl === null) {
         $this->baseScriptUrl = Yii::app()->getAssetManager()->publish(Yii::getPathOfAlias('ext.adminList.assets'), false, -1, YII_DEBUG);
     }
     parent::init();
     $controller = Yii::app()->controller;
     if (!isset($this->htmlOptions['class'])) {
         $this->htmlOptions['class'] = 'list-view';
     } else {
         $this->htmlOptions['class'] .= ' list-view';
     }
     // if ($this->baseScriptUrl === null)
     $themeName = Yii::app()->theme->baseUrl;
     if ($controller instanceof Controller) {
         $htmlClass = 'pager-' . $controller->module->id;
         if (file_exists(Yii::getPathOfAlias("webroot.themes.{$themeName}.assets.css") . '/pager.css')) {
             $pagerFile = $themeName . '/assets/css/pager.css';
         } else {
             $pagerFile = false;
         }
     } else {
         $htmlClass = '';
         $adminAssetsUrl = Yii::app()->getModule('admin')->assetsUrl;
         if (file_exists(Yii::getPathOfAlias("mod.admin.assets.css") . '/pager.css')) {
             $pagerFile = $adminAssetsUrl . '/css/pager.css';
         } else {
             $pagerFile = false;
         }
     }
     $this->pager = CMap::mergeArray(array('cssFile' => $pagerFile, 'htmlOptions' => array('class' => 'pagination ' . $htmlClass), 'header' => Yii::app()->controller instanceof AdminController ? '' : $this->pager['header']), $this->pager);
     /* if ($this->cssFile !== false) {
            if ($this->cssFile === null)
                $this->cssFile = $this->baseScriptUrl . '/styles.css';
            Yii::app()->getClientScript()->registerCssFile($this->cssFile);
        }*/
 }
Пример #28
0
 public function run()
 {
     return parent::run();
 }
Пример #29
0
 public function registerClientScript()
 {
     if ($this->front === false) {
         parent::registerClientScript();
     }
 }
Пример #30
0
 public function init()
 {
     parent::init();
     $this->updateSelector = $this->updateSelector . ', #' . $this->id . ' .' . preg_replace('/\\s+/', '.', $this->pagerCssClass) . ' a, .' . preg_replace('/\\s+/', '.', $this->sorterCssClass) . ' a';
 }