Skip to content

Instantly share code, notes, and snippets.

@vpadhariya
Created August 6, 2015 14:20
Show Gist options
  • Save vpadhariya/25264173553140e05c75 to your computer and use it in GitHub Desktop.
Save vpadhariya/25264173553140e05c75 to your computer and use it in GitHub Desktop.
Yii 1.1.16 Widget Factory Setting -- (put them under protected/config/widgetFactory.php) and in main.php file include using "CMap::mergeArray()" method
<?php
/**
* Common Settings for widgets across whole project
* @reference : http://www.yiiframework.com/doc/api/1.1/CWidgetFactory
* Based on Bootstrap CSS class
*/
return array(
'components' => array(
'widgetFactory' => array( // Default properties for some widgets
'widgets' => array(
// CLinkPager options
'CLinkPager' => array(
'htmlOptions' => array(
'class' => 'pagination'
),
'header' => false,
'maxButtonCount' => 5,
'cssFile' => false,
'firstPageLabel' => 'First',
'prevPageLabel' => 'Previous',
'nextPageLabel' => 'Next',
'lastPageLabel' => 'Last',
// 'firstPageCssClass' => 'pager_first', //default "first"
// 'lastPageCssClass' => 'pager_last', //default "last"
// 'previousPageCssClass' => 'pager_previous', //default "previours"
// 'nextPageCssClass' => 'pager_next', //default "next"
// 'internalPageCssClass' => 'pager_li', //default "page"
'selectedPageCssClass' => 'active', //default "selected"
// 'hiddenPageCssClass' => 'pager_hidden_li'//default "hidden"
),
// Common Settings for CListView options
// 'CListView' => array(
// 'htmlOptions' => array(
// 'class' => 'panel panel-default table-responsive'
// ),
// ),
// Common Settings for CGridView options
'CGridView' => array(
'htmlOptions' => array(
'class' => 'row panel panel-default table-responsive'
),
'enableHistory' => true,
//'afterAjaxUpdate' => 'showStickyMsg("Record Updated successfully", "success")',
//'ajaxUpdateError' => 'showStickyMsg("There is some error, please try again later!", "warning")',
'itemsCssClass' => 'table table-striped table-hover dataTable',
'pagerCssClass' => 'dataTables_paginate paging_bootstrap text-right',
'rowCssClass' => array('odd', 'even'),
'cssFile' => false,
//'template' => '{summary} {items} {pager}',
'summaryCssClass' => 'dataTables_info',
'summaryText' => 'Showing {start} to {end} of {count} entries',
'template' => '<div class="dt-wrapper">{items}</div>
<div class="dt-row dt-bottom-row">
<div class="row">
<div class="col-sm-3">{summary}</div>
<div class="col-sm-9">{pager}</div>
</div>
</div>',
),
// Common Settings for CActiveForm options
'CActiveForm' => array(
'enableAjaxValidation' => true,
'enableClientValidation' => true,
'clientOptions' => array(
'validateOnSubmit' => true,
//'afterValidate' => 'js:validatewebsite'
),
// 'htmlOptions' => array(
// 'class' => 'row'
// ),
),
'CMenu' => array(
'encodeLabel' => false,
'activeCssClass' => 'link_active',
),
'CJuiDatePicker' => array(
//'themeUrl' => dirname($_SERVER['SCRIPT_NAME']) . '/js/lib/jquery_ui/css',
//'theme' => 'delta',
//'cssFile' => array('jquery-ui-1.10.3.custom.min.css'),
'htmlOptions' => array(
'class' => 'form-control',
'size' => '10', // textField size
'maxlength' => '10', // textField maxlength
),
'options' => array(
'dateFormat' => 'dd-mm-yy',
'value' => date('dd-mm-yy'),
// 'showOn' => 'both', // also opens with a button
//'dateFormat' => 'dd-mm-yy', // format of "2012-12-25"
'showOtherMonths' => true, // show dates in other months
'selectOtherMonths' => true, // can seelect dates in other months
'changeYear' => true, // can change year
'changeMonth' => true, // can change month
'yearRange' => '2000:2020', // range of year
//'minDate' => '22-11-2013', // minimum date
//'maxDate' => '25-11-2013', // maximum date
'showButtonPanel' => true, // show button panel
'constrainInput' => true,
'duration' => 'fast',
)
),
),
),
),
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment