/** * Sets init. * * @access protected * @return void * * @author Stephan Mascarell <*****@*****.**> * @author <Adel Oustad> <*****@*****.**> */ protected function render($options = null) { if (!isset($options['action']) || empty($options['action']) || isset($options['action']) && !in_array(strtolower($options['action']), self::$actions)) { throw ExtensionException::optionValueNotSpecified('action', __CLASS__); } $action = strtolower($options['action']) . "Action"; if (method_exists($this, $action)) { return $articles = $this->{$action}($options); } else { throw ExtensionException::MethodUnDefined($action); } }
/** * Set progress text for Progress flash dialog. * * @param $options tableau d'options. * @access protected * @return void * * @author Etienne de Longeaux <*****@*****.**> */ protected function render($options = null) { // Options management if (!isset($options['action']) || empty($options['action']) || isset($options['action']) && !in_array(strtolower($options['action']), self::$actions)) { throw ExtensionException::optionValueNotSpecified('action', __CLASS__); } if (!isset($options['dialog-name']) || empty($options['dialog-name'])) { throw ExtensionException::optionValueNotSpecified('dialog-name', __CLASS__); } $method = strtolower($options['action']) . "Action"; if (method_exists($this, $method)) { return $this->{$method}($options); } else { throw ExtensionException::MethodUnDefined($method); } }
/** * Set progress text for Progress flash dialog. * * @param $options tableau d'options. * @access protected * @return void * * @author Etienne de Longeaux <*****@*****.**> */ protected function render($options = null) { if (!isset($options['action']) || empty($options['action']) || isset($options['action']) && !in_array(strtolower($options['action']), self::$actions)) { throw ExtensionException::optionValueNotSpecified('action', __CLASS__); } if (!isset($options['menu']) || empty($options['menu']) || isset($options['menu']) && !in_array(strtolower($options['menu']), self::$menus)) { throw ExtensionException::optionValueNotSpecified('menu', __CLASS__); } $method = strtolower($options['menu']) . "Menu"; $action = strtolower($options['action']) . "Action"; if (method_exists($this, $method)) { $sliders = $this->{$method}($options); } else { throw ExtensionException::MethodUnDefined($method); } return $this->{$action}($sliders, $options); }
/** * Set progress text for Progress flash dialog. * * @param $options tableau d'options. * @access protected * @return void * * @author Etienne de Longeaux <*****@*****.**> */ protected function render($options = null) { // Options management if (!isset($options['id']) || empty($options['id'])) { throw ExtensionException::optionValueNotSpecified('id', __CLASS__); } if (!isset($options['menu']) || empty($options['menu']) || isset($options['menu']) && !in_array($options['menu'], self::$menus)) { throw ExtensionException::optionValueNotSpecified('id', __CLASS__); } if (!isset($options['them']) || empty($options['them']) || isset($options['them']) && !in_array($options['them'], self::$thems)) { $options['them'] = 'human'; } $method = strtolower($options['menu']) . "Menu"; if (method_exists($this, $method)) { $var_menu = $this->{$method}(); } else { throw ExtensionException::MethodUnDefined($method); } // We open the buffer. ob_start(); ?> jQuery(document).ready(function() { var id = "<?php echo $options['id']; ?> "; var menu = <?php echo $var_menu; ?> ; $(id).contextMenu(menu,{ <?php if (isset($options['theme']) && !empty($options['theme'])) { ?> theme: '<?php echo $options['theme']; ?> ', <?php } else { ?> theme:'human', <?php } ?> <?php if (isset($options['options']['shadow']) && !empty($options['options']['shadow'])) { ?> shadow:<?php echo $options['options']['shadow']; ?> , <?php } ?> <?php if (isset($options['options']['shadowOpacity']) && !empty($options['options']['shadowOpacity'])) { ?> shadowOpacity:<?php echo $options['options']['shadowOpacity']; ?> , <?php } ?> <?php if (isset($options['options']['shadowColor']) && !empty($options['options']['shadowColor'])) { ?> shadowColor:'<?php echo $options['options']['shadowColor']; ?> ', <?php } ?> <?php if (isset($options['options']['shadowOffset']) && !empty($options['options']['shadowOffset'])) { ?> shadowOffset: <?php echo $options['options']['shadowOffset']; ?> , <?php } ?> <?php if (isset($options['options']['shadowWidthAdjust']) && !empty($options['options']['shadowWidthAdjust'])) { ?> shadowWidthAdjust: <?php echo $options['options']['shadowWidthAdjust']; ?> , <?php } ?> <?php if (isset($options['options']['shadowHeightAdjust']) && !empty($options['options']['shadowHeightAdjust'])) { ?> shadowHeightAdjust: <?php echo $options['options']['shadowHeightAdjust']; ?> , <?php } ?> <?php if (isset($options['options']['shadowOffsetX']) && !empty($options['options']['shadowOffsetX'])) { ?> shadowOffsetX: <?php echo $options['options']['shadowOffsetX']; ?> , <?php } ?> <?php if (isset($options['options']['shadowOffsetY']) && !empty($options['options']['shadowOffsetY'])) { ?> shadowOffsetY: <?php echo $options['options']['shadowOffsetY']; ?> , <?php } ?> <?php if (isset($options['options']['direction']) && !empty($options['options']['direction'])) { // {'up', 'down'} ?> direction: '<?php echo $options['options']['direction']; ?> ', <?php } ?> <?php if (isset($options['options']['offsetX']) && !empty($options['options']['offsetX'])) { ?> offsetX: <?php echo $options['options']['offsetX']; ?> , <?php } ?> <?php if (isset($options['options']['offsetY']) && !empty($options['options']['offsetY'])) { ?> offsetY: <?php echo $options['options']['offsetY']; ?> , <?php } ?> <?php if (isset($options['options']['showSpeed']) && !empty($options['options']['showSpeed'])) { ?> showSpeed: <?php echo $options['options']['showSpeed']; ?> , <?php } else { ?> showSpeed:1000, <?php } ?> <?php if (isset($options['options']['hideSpeed']) && !empty($options['options']['hideSpeed'])) { ?> hideSpeed: <?php echo $options['options']['hideSpeed']; ?> , <?php } else { ?> hideSpeed:1000, <?php } ?> <?php if (isset($options['options']['showTransition']) && !empty($options['options']['showTransition'])) { ?> showTransition: '<?php echo $options['options']['showTransition']; ?> ', <?php } else { ?> showTransition:'fadeIn', <?php } ?> <?php if (isset($options['options']['hideTransition']) && !empty($options['options']['hideTransition'])) { ?> hideTransition: '<?php echo $options['options']['hideTransition']; ?> ', <?php } else { ?> hideTransition:'fadeOut', <?php } ?> showCallback:function() { <?php if (isset($options['options']['showCallback']) && !empty($options['options']['showCallback'])) { echo $options['options']['showCallback']; } ?> }, hideCallback:function() { <?php if (isset($options['options']['hideCallback']) && !empty($options['options']['hideCallback'])) { echo $options['options']['hideCallback']; } ?> }, beforeShow:function() { <?php if (isset($options['options']['beforeShow']) && !empty($options['options']['beforeShow'])) { echo $options['options']['beforeShow']; } ?> }, }); // add the left click mouse for tablette. $(id).click(function(e){ var element = e.target; var evt = element.ownerDocument.createEvent('MouseEvents'); var RIGHT_CLICK_BUTTON_CODE = 2; // the same for FF and IE evt.initMouseEvent('contextmenu', true, true, element.ownerDocument.defaultView, 1, e.screenX, e.screenY, e.clientX, e.clientY, false, false, false, false, RIGHT_CLICK_BUTTON_CODE, null); if (document.createEventObject){ // dispatch for IE return element.fireEvent('onclick', evt) } else{ // dispatch for firefox + others return element.dispatchEvent(evt); } }); }); <?php // We retrieve the contents of the buffer. $_content_js = ob_get_contents(); // We clean the buffer. ob_clean(); // We close the buffer. ob_end_flush(); return $this->renderScript($_content_js, '', 'cmf/contextmenu/'); }
/** * Set progress text for Progress flash dialog. * * @param $options tableau d'options. * @access protected * @return void * * @author Etienne de Longeaux <*****@*****.**> */ protected function render($options = null) { // Options management if (!isset($options['id']) || empty($options['id'])) { throw ExtensionException::optionValueNotSpecified('id', __CLASS__); } if (!isset($options['menu']) || empty($options['menu']) || isset($options['menu']) && !in_array($options['menu'], self::$menus)) { throw ExtensionException::optionValueNotSpecified('id', __CLASS__); } $method = strtolower($options['menu']) . "Menu"; if (method_exists($this, $method)) { $htmlTree = $this->{$method}(); } else { throw ExtensionException::MethodUnDefined($method); } // We open the buffer. ob_start(); ?> //-------------------------------- // Create tree //-------------------------------- treeObj = new JSDragDropTree(); treeObj.setTreeId('dhtmlgoodies_tree2'); treeObj.setMaximumDepth(7); treeObj.setImageFolder("<?php echo $this->container->get('templating.helper.assets')->getUrl("bundles/sfynxtemplate/js/drag-drop-folder-tree/images/"); ?> "); treeObj.setMessageMaximumDepthReached('Maximum depth reached'); // If you want to show a message when maximum depth is reached, i.e. on drop. treeObj.initTree(); treeObj.expandAll(); jQuery(document).ready(function() { $("<?php echo $options['id']; ?> ").click(function(e){ var _width = $('#pi_tree-boxes-cadre').width(); if ($('#pi_tree-boxes-cadre').is(':hidden')){ $("div[data-block^='pi_menuright']").attr("style", "display: block;margin-right: -"+(_width+1500)+"px;"); $("div[data-block^='pi_menuright']").delay(200).animate({marginRight: '0'}, 1500); } else { $("div[data-block^='pi_menuright']").fadeOut('slow', function(){ $(this).attr("style", "display: none;margin-right: -1500px;"); }); } }); }); //-------------------------------- // Save functions //-------------------------------- var ajaxObjects = new Array(); // Use something like this if you want to save data by Ajax. function saveMyTree() { saveString = treeObj.getNodeOrders(); var ajaxIndex = ajaxObjects.length; ajaxObjects[ajaxIndex] = new sack(); var url = 'saveNodes.php?saveString=' + saveString; ajaxObjects[ajaxIndex].requestFile = url; // Specifying which file to get ajaxObjects[ajaxIndex].onCompletion = function() { saveComplete(ajaxIndex); } ; // Specify function that will be executed after file has been found ajaxObjects[ajaxIndex].runAJAX(); // Execute AJAX function } function saveComplete(index) { alert(ajaxObjects[index].response); } // Call this function if you want to save it by a form. function saveMyTree_byForm() { document.myForm.elements['saveString'].value = treeObj.getNodeOrders(); document.myForm.submit(); } <?php // We retrieve the contents of the buffer. $_content_js = ob_get_contents(); // We clean the buffer. ob_clean(); // We close the buffer. ob_end_flush(); // We open the buffer. ob_start(); ?> <div id="pi_tree-boxes-cadre" class="pi_menuright" data-block="pi_menuright" > <ul id="dhtmlgoodies_tree2" class="dhtmlgoodies_tree" > <li id="node0" noDrag="true" noSiblings="true" noDelete="true" noRename="true"> <a href="#">Root node</a> <?php echo $htmlTree; ?> </li> </ul> <form> <input type="button" onclick="saveMyTree()" value="Save"> </Form> </div> <?php // We retrieve the contents of the buffer. $_content_html = ob_get_contents(); // We clean the buffer. ob_clean(); // We close the buffer. ob_end_flush(); return $this->renderScript($_content_js, $_content_html, 'cmf/orgtreepage/'); }