public function checkParent($attribute, $params) { if ($this->isNewRecord) { return; } if ($this->{$attribute} == $this->current_parent) { return; } $nodeToMove = self::model()->findByPk($this->{$attribute}); if ($nodeToMove->isDescendantOf($this) || $this->{$attribute} == $this->id) { $this->addError($attribute, ProductsModule::t('Cannot move object to itself (or descendant of it)')); } else { $this->moveAsFirst($nodeToMove); } }
<a href="javascript:void(0);">Acer</a> </li> </ul> </li> <li> <a href="javascript:void(0);">Desktop</a> </li> <li> <a href="javascript:void(0);">Mouse</a> </li> <li> <a href="javascript:void(0);">Keyboard</a> </li> </ul> </li> </ul> </div> <?php if (in_array(APPLICATION_SCOPE, array("SITE_MANAGER", "TEMPLATE_MANAGER")) && $_SERVER['HTTP_HOST'] != JLTL_PREVIEW_DOMAIN) { ?> <div> <a class="dialog_link" href="<?php echo JLRouter::createAbsoluteUrl('/products/manage_categories/admin'); ?> "><?php echo ProductsModule::t('Manage Categories'); ?> </a> </div> <?php }
<?php $this->endWidget(); ?> </div><!-- form --> <script> var box = window.parent.getDialog(); box.dialog("option", { title: "<?php echo $model->isNewRecord ? ProductsModule::t('Create New Product') : ProductsModule::t('Update Product') . ' (' . CHtml::encode($model->name) . ')'; ?> ", width: 500, height: 550, minWidth: 500, minHeight: 550, buttons: { "<?php echo ProductsModule::t('Manage Product Items'); ?> ": function() { window.parent.showDialog("<?php echo $this->createAbsoluteUrl('/products/manage_items/admin', array('category' => isset($_GET['category']) ? $_GET['category'] : '')); ?> "); }, "<?php echo $model->isNewRecord ? ProductsModule::t('Create') : ProductsModule::t('Save'); ?> ": function() { $('#product-item-form').submit(); } } }); </script>
<div> <?php $this->widget('CTreeView', array('data' => $arrTrees, 'animated' => 'fast', 'htmlOptions' => array('class' => 'jlb_treeview treeview'))); ?> </div> <script> var box = window.parent.getDialog(); box.dialog("option", { title: "<?php echo ProductsModule::t('Manage Product Categories'); ?> ", width: 500, height: 400, minWidth: 500, minHeight: 400, buttons: { "<?php echo ProductsModule::t('Create New Category'); ?> ": function() { window.parent.showDialog("<?php echo $this->createAbsoluteUrl('/products/manage_categories/create'); ?> "); } } }); </script>
<div> <?php $this->widget('zii.widgets.grid.CGridView', array('id' => 'product-item-grid', 'dataProvider' => $model->search(), 'columns' => array('id', 'name', 'price', array('class' => 'CButtonColumn', 'template' => '{update}{delete}', 'buttons' => array('update' => array('url' => 'Yii::app()->createAbsoluteUrl("/products/manage_items/update",array("id"=>$data->primaryKey,"category"=>isset($_GET["category"])?$_GET["category"]:""))')))))); ?> </div> <script> var box = window.parent.getDialog(); box.dialog("option", { title: "<?php echo ProductsModule::t('Manage Product Items') . (isset($_GET['category']) && $_GET['category'] ? " (Of a Category)" : " (All Products)"); ?> ", width: 500, height: 360, minWidth: 500, minHeight: 360, buttons: { "<?php echo ProductsModule::t('Create New Product'); ?> ": function() { window.parent.showDialog("<?php echo $this->createAbsoluteUrl('/products/manage_items/create', array('category' => isset($_GET['category']) ? $_GET['category'] : '')); ?> "); } } }); </script>
<?php echo ProductsModule::t('No results found.'); if (!Yii::app()->user->isGuest && Yii::app()->user->superuser == 1) { ?> <div> <a class="h_dialog_link" href="<?php echo Yii::app()->createAbsoluteUrl('/products/manage_items/admin', array('category' => isset($_GET['category']) ? $_GET['category'] : '')); ?> "><?php echo ProductsModule::t('Manage Product Items'); ?> </a> </div> <?php }
?> </span></p> <p><?php echo ProductsModule::t('Number'); ?> : <input type="text" size="15" value="1" /><input class="h-button-add_tab-cart" type="button" value="<?php echo ProductsModule::t('Add to Cart'); ?> " /></p> <p><?php echo CHtml::encode($data->short_description); ?> </p> </div> <div> <a href="#" onclick="$('#product-description').show();$('#product-contact').hide();return false;"><?php echo ProductsModule::t('Information'); ?> </a> | <a href="#" onclick="$('#product-contact').show();$('#product-description').hide();return false;"><?php echo ProductsModule::t('Contact'); ?> </a> </div> <div id="product-description"> <?php echo CHtml::encode($data->description); ?> </div>
?> " rel="<?php echo $item->id . '|||' . $item->price; ?> " alt="" src="<?php if ($item->image) { echo Yii::app()->createAbsoluteUrl('/') . '/files/products/thumb_' . $item->image; } else { echo $baseScriptUrl . '/no_image.gif'; } ?> " /></a> <h5><?php echo CHtml::link($item->name, $url); ?> </h5> <p><?php echo ProductsModule::t('Price'); ?> : <span><?php echo CHtml::encode($item->price) . ($item->unit ? '/' . CHtml::encode($item->unit) : ''); ?> </span></p> </li> <?php } ?> </ul> </div> <?php }
private function __getDataTreeChilds($childrens, $moving = null) { $arrTrees = array(); $length = count($childrens); foreach ($childrens as $index => $child) { $strChildId = $child['item']->id; $linkUp = $index == 0 ? '' : '<a title="' . ProductsModule::t('Move Up') . '" href="' . $this->createAbsoluteUrl('/products/manage_categories/moveup', array('id' => $strChildId)) . '"><img src="' . $this->__baseScriptUrl . '/uparrow.png" /></a>'; $linkDown = $index == $length - 1 ? '<span style="display:inline-block;width:16px"></span>' : '<a title="' . ProductsModule::t('Move Down') . '" href="' . $this->createAbsoluteUrl('/products/manage_categories/movedown', array('id' => $strChildId)) . '"><img src="' . $this->__baseScriptUrl . '/downarrow.png" /></a>'; $linkUpdate = '<a title="' . ProductsModule::t('Update') . '" href="' . $this->createAbsoluteUrl('/products/manage_categories/update', array('id' => $strChildId)) . '"><img src="' . $this->__baseScriptUrl . '/update.png" /></a>'; $linkDelete = '<a title="' . ProductsModule::t('Delete') . '" onClick="if (!confirm(\'' . ProductsModule::t('Are you sure you want to delete?') . '\')) return false;" href="' . $this->createAbsoluteUrl('/products/manage_categories/delete', array('id' => $strChildId)) . '"><img src="' . $this->__baseScriptUrl . '/delete.png" /></a>'; $title = $moving == $strChildId ? '<span style="color:#ff0000;">' . $child['item']->name . '</span>' : $child['item']->name; $row['text'] = $title . '<span style="float:right;">' . $linkUp . $linkDown . $linkUpdate . $linkDelete . '</span>'; $row['children'] = $this->__getDataTreeChilds($child['children'], $moving); $arrTrees[] = $row; } return $arrTrees; }