<?php

$this->widget('ext.jstree.SJsTree', array('id' => 'CategoryAssignTreeDialog', 'data' => StoreCategoryNode::fromArray(StoreCategory::model()->findAllByPk(1))));
?>

<script type="text/javascript">
	$("#CategoryAssignTreeDialog").jstree(<?php 
echo CJavaScript::encode(array('core' => array('initially_open' => 'CategoryAssignTreeDialogNode_1'), 'plugins' => array('themes', 'html_data', 'ui', 'crrm', 'search', 'checkbox', 'cookies'), 'checkbox' => array('two_state' => true), 'cookies' => array('save_selected' => true)));
?>
);
</script>
Esempio n. 2
0
	<?php 
$this->beginWidget('zii.widgets.jui.CJuiButton', array('buttonType' => 'buttonset', 'name' => 'tree-set', 'htmlOptions' => array('style' => 'padding-top:2px;')));
$this->widget('zii.widgets.jui.CJuiButton', array('name' => 'button1', 'buttonType' => 'button', 'caption' => Yii::t('StoreModule.admin', 'Развернуть все'), 'onclick' => 'js:function(){
				 $("#StoreCategoryTreeFilter").jstree("open_all");
			}', 'options' => array('text' => false, 'icons' => array('primary' => 'ui-icon-triangle-1-s'))));
$this->widget('zii.widgets.jui.CJuiButton', array('name' => 'button12', 'buttonType' => 'button', 'caption' => Yii::t('StoreModule.admin', 'Свернуть все'), 'onclick' => 'js:function(){
				 $("#StoreCategoryTreeFilter").jstree("close_all");
				 $("#StoreCategoryTreeFilter").jstree("open_node", "#StoreCategoryTreeFilterNode_1", false, true);
			}', 'options' => array('text' => false, 'icons' => array('primary' => 'ui-icon-triangle-1-n'))));
$this->endWidget();
?>

</div>

<div style="clear: both;"></div>

<?php 
// Create jstree to filter products
$this->widget('ext.jstree.SJsTree', array('id' => 'StoreCategoryTreeFilter', 'data' => StoreCategoryNode::fromArray(StoreCategory::model()->findAllByPk(1), array('displayCount' => true)), 'options' => array('core' => array('initially_open' => 'StoreCategoryTreeFilterNode_1'), 'plugins' => array('themes', 'html_data', 'ui', 'crrm', 'search'), 'cookies' => array('save_selected' => false))));
// Category id to select in sidebar.
$activeCategoryId = Yii::app()->request->getQuery('category', 0);
if (is_array($activeCategoryId)) {
    $activeCategoryId = 0;
}
Yii::app()->getClientScript()->registerScript('insertAllCategory', '
$("#StoreCategoryTreeFilter").bind("loaded.jstree", function (event, data) {
	$(this).jstree("create",-1,false,{attr:{id:"StoreCategoryTreeFilterNode_0"}, data:{title:"' . Yii::t('StoreModule.admin', 'Все категории') . '"}},false,true);
	$(this).jstree("select_node","#StoreCategoryTreeFilterNode_' . $activeCategoryId . '");
});
');
Yii::app()->getClientScript()->registerCss("StoreCategoryTreeStyles", "\n\t#StoreCategoryTree { width:90% }\n\t#StoreCategoryTreeFilter {width: 255px}\n");
Esempio n. 3
0
<h3>&nbsp;</h3>
<div class="form wide">
	<input type="text" style="width: 80%;" onkeyup='$("#StoreCategoryTree").jstree("search", $(this).val());' />
</div>

<?php 
/**
 * Categories sidebar
 */
// Register scripts
Yii::app()->clientScript->registerScriptFile($this->module->assetsUrl . '/admin/category.js', CClientScript::POS_END);
// Create jstree
$this->widget('ext.jstree.SJsTree', array('id' => 'StoreCategoryTree', 'data' => StoreCategoryNode::fromArray(StoreCategory::model()->findAllByPk(1)), 'options' => array('core' => array('initially_open' => 'StoreCategoryTreeNode_1'), 'plugins' => array('themes', 'html_data', 'ui', 'dnd', 'crrm', 'search', 'cookies', 'contextmenu'), 'crrm' => array('move' => array('check_move' => 'js: function(m){
				// Disallow categories without parent.
				// At least each category must have `root` category as parent.
				var p = this._get_parent(m.r);
				if (p == -1) return false;
				return true;
			}')), 'dnd' => array('drag_finish' => 'js:function(data){
				//alert(data);
			}'), 'cookies' => array('save_selected' => false), 'ui' => array('initially_select' => array('#StoreCategoryTreeNode_' . (int) Yii::app()->request->getParam('id'))), 'contextmenu' => array('items' => array('view' => array('label' => Yii::t('StoreModule.admin', 'Перейти'), 'action' => 'js:function(obj){ CategoryRedirectToFront(obj); }'), 'products' => array('label' => Yii::t('StoreModule.admin', 'Продукты'), 'action' => 'js:function(obj){ CategoryRedirectToAdminProducts(obj); }'), 'create' => false, 'rename' => false, 'remove' => false, 'ccp' => false)))));
Yii::app()->getClientScript()->registerCss("StoreCategoryTreeStyles", "#StoreCategoryTree { width:90% }");
?>

<div class="hint">
	<br><?php 
echo Yii::t('StoreModule.admin', "Используйте 'drag-and-drop' для сортировки категорий.");
?>
</div>
Esempio n. 4
0
<?php

Yii::import('store.models.*');
?>

<div class="form wide">
	<?php 
echo Yii::t('DiscountsModule.admin', 'Поиск:');
?>
 <input type="text" onkeyup='$("#StoreDiscountCategoryTree").jstree("search", $(this).val());' />
</div>

<?php 
// Create jstree
$this->widget('ext.jstree.SJsTree', array('id' => 'StoreDiscountCategoryTree', 'data' => StoreCategoryNode::fromArray(StoreCategory::model()->findAllByPk(1)), 'options' => array('core' => array('initially_open' => 'StoreDiscountCategoryTreeNode_1'), 'plugins' => array('themes', 'html_data', 'ui', 'crrm', 'search', 'checkbox'), 'checkbox' => array('two_state' => true))));
// Check tree nodes
foreach ($model->categories as $id) {
    Yii::app()->getClientScript()->registerScript("checkNode{$id}", "\n\t\t\$('#StoreDiscountCategoryTree').checkNode({$id});\n\t");
}
?>

<div class="hint" style="margin: 0">
	<br><?php 
echo Yii::t('DiscountsModule.admin', "Здесь вы можете указать категории, для которых будет доступна скидка.");
?>
</div>
Esempio n. 5
0
<div class="form wide">
	<?php 
echo Yii::t('StoreModule.admin', 'Поиск:');
?>
 <input type="text" onkeyup='$("#StoreTypeCategoryTree").jstree("search", $(this).val());' />
</div>

<?php 
// Create jstree
$this->widget('ext.jstree.SJsTree', array('id' => 'StoreTypeCategoryTree', 'data' => StoreCategoryNode::fromArray(StoreCategory::model()->findAllByPk(1)), 'options' => array('core' => array('initially_open' => 'StoreTypeCategoryTreeNode_1'), 'plugins' => array('themes', 'html_data', 'ui', 'crrm', 'search', 'checkbox', 'cookies'), 'checkbox' => array('two_state' => true), 'cookies' => array('save_selected' => false), 'ui' => array('initially_select' => 'StoreTypeCategoryTreeNode_' . $model->main_category))));
// Check tree nodes
$categories = unserialize($model->categories_preset);
if (!is_array($categories)) {
    $categories = array();
}
foreach ($categories as $id) {
    Yii::app()->getClientScript()->registerScript("checkNode{$id}", "\n\t\t\$('#StoreTypeCategoryTree').checkNode({$id});\n\t");
}
?>

<div class="hint" style="margin: 0">
	<br><?php 
echo Yii::t('StoreModule.admin', "Здесь вы можете указать категории, которые будут автоматически выбраны при создании продукта.");
?>
	<br><?php 
echo Yii::t('StoreModule.admin', "Нажмите на название категории, чтобы сделать её главной.");
?>
</div>