public function testSuperUserProductDefaultControllerActions() { $super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super'); //Default Controller actions requiring some sort of parameter via POST or GET //Load Product Modules Menu. $this->setGetArray(array('moduleClassName' => 'ProductsModule')); $this->runControllerWithNoExceptionsAndGetContent('designer/default/modulesMenu'); //Load AttributesList for Product module. $this->setGetArray(array('moduleClassName' => 'ProductsModule')); $this->runControllerWithNoExceptionsAndGetContent('designer/default/attributesList'); //Load ModuleLayoutsList for Product module. $this->setGetArray(array('moduleClassName' => 'ProductsModule')); $this->runControllerWithNoExceptionsAndGetContent('designer/default/moduleLayoutsList'); //Now confirm everything did in fact save correctly. $this->assertEquals('Product', ProductsModule::getModuleLabelByTypeAndLanguage('Singular')); $this->assertEquals('Products', ProductsModule::getModuleLabelByTypeAndLanguage('Plural')); $this->assertEquals('product', ProductsModule::getModuleLabelByTypeAndLanguage('SingularLowerCase')); $this->assertEquals('products', ProductsModule::getModuleLabelByTypeAndLanguage('PluralLowerCase')); //Load LayoutEdit for each applicable module and applicable layout $this->resetPostArray(); $this->setGetArray(array('moduleClassName' => 'ProductsModule', 'viewClassName' => 'ProductsListView')); $this->runControllerWithNoExceptionsAndGetContent('designer/default/LayoutEdit'); $this->setGetArray(array('moduleClassName' => 'ProductsModule', 'viewClassName' => 'ProductsModalListView')); $this->runControllerWithNoExceptionsAndGetContent('designer/default/LayoutEdit'); $this->setGetArray(array('moduleClassName' => 'ProductsModule', 'viewClassName' => 'ProductsModalSearchView')); $this->runControllerWithNoExceptionsAndGetContent('designer/default/LayoutEdit'); $this->setGetArray(array('moduleClassName' => 'ProductsModule', 'viewClassName' => 'ProductsRelatedListView')); $this->runControllerWithNoExceptionsAndGetContent('designer/default/LayoutEdit'); $this->setGetArray(array('moduleClassName' => 'ProductsModule', 'viewClassName' => 'ProductEditAndDetailsView')); $this->runControllerWithNoExceptionsAndGetContent('designer/default/LayoutEdit'); }
protected function getMenuItems() { $items = array(); if (RightsUtil::doesUserHaveAllowByRightName('ProductsModule', ProductsModule::getCreateRight(), Yii::app()->user->userModel)) { $items[] = array('label' => Zurmo::t('ProductsModule', 'Create ProductsModuleSingularLabel', LabelUtil::getTranslationParamsForAllModules()), 'url' => Yii::app()->createUrl('products/default/create')); } if (!empty($items)) { return $items; } return null; }
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); } }
/** * @return null or string containing create link */ public function render() { $items = array(); if (RightsUtil::doesUserHaveAllowByRightName('ProductsModule', ProductsModule::getCreateRight(), Yii::app()->user->userModel)) { $items[] = array('label' => Zurmo::t('ProductsModule', 'Create Product'), 'url' => Yii::app()->createUrl('products/default/create')); } if (RightsUtil::doesUserHaveAllowByRightName('ProductTemplatesModule', ProductTemplatesModule::getCreateRight(), Yii::app()->user->userModel)) { $items[] = array('label' => Zurmo::t('ProductTemplatesModule', 'Create Catalog Item'), 'url' => Yii::app()->createUrl('productTemplates/default/create')); $items[] = array('label' => Zurmo::t('ProductTemplatesModule', 'Create Category'), 'url' => Yii::app()->createUrl('productTemplates/category/create')); } if (!empty($items)) { $menuItems = array('label' => $this->getLabel(), 'url' => null, 'items' => $items); $cClipWidget = new CClipWidget(); $cClipWidget->beginClip("ActionMenu"); $cClipWidget->widget('application.core.widgets.MbMenu', array('htmlOptions' => array('id' => 'MashableInboxCreateDropdown'), 'items' => array($menuItems))); $cClipWidget->endClip(); return $cClipWidget->getController()->clips['ActionMenu']; } return null; }
/** * Action called in the event that the mass delete quantity is larger than the pageSize. * This action is called after the pageSize quantity has been delted and continues to be * called until the mass delete action is complete. For example, if there are 20 records to delete * and the pageSize is 5, then this action will be called 3 times. The first 5 are updated when * the actionMassDelete is called upon the initial form submission. */ public function actionMassDeleteProgress() { $pageSize = Yii::app()->pagination->resolveActiveForCurrentUserByType('massDeleteProgressPageSize'); $product = new Product(false); $dataProvider = $this->getDataProviderByResolvingSelectAllFromGet(new ProductsSearchForm($product), $pageSize, Yii::app()->user->userModel->id, null, 'ProductsSearchView'); $this->processMassDeleteProgress('Product', $pageSize, ProductsModule::getModuleLabelByTypeAndLanguage('Plural'), $dataProvider); }
<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 }
<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 $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>
<?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>
/** * Resolve confirm alert options while deleting product * @param array $htmlOptions * @return array */ protected function resolveConfirmAlertInHtmlOptions($htmlOptions) { $htmlOptions['confirm'] = Zurmo::t('ProductsModule', 'Are you sure you want to delete this {modelLabel}?', array('{modelLabel}' => ProductsModule::getModuleLabelByTypeAndLanguage('SingularLowerCase'))); return $htmlOptions; }
?> " 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; }