/**
     * Set progress text for Progress flash dialog.
     *
     * <code>
     *        {% set options_backstretch = {'id': 'body', 'img': 'bundles/sfynxtemplate/images/layout/novedia/BACKGROUNDS/background-home.jpg' } %}
     *        {{ renderJquery('TOOL', 'backstretch', options_backstretch )|raw }}    
     * </code>
     * 
     * @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['img']) || empty($options['img'])) {
            throw ExtensionException::optionValueNotSpecified('img', __CLASS__);
        }
        // if the file doesn't exist, we call an exception
        $is_file_exist = realpath($this->container->get('kernel')->getRootDir() . '/../web/' . $options['img']);
        if (!$is_file_exist) {
            throw ExtensionException::FileUnDefined('img', __CLASS__);
        }
        $Urlpath = $this->container->get('templating.helper.assets')->getUrl($options['img']);
        // We open the buffer.
        ob_start();
        ?>
                $.backstretch("<?php 
        echo $Urlpath;
        ?>
");
        <?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/backstretch/');
    }
 /**
  * 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);
     }
 }
 /**
  * Sets the nested accordeon render.
  *
  * @param    $options    tableau d'options.
  * @access protected
  * @return void
  *
  * @author Etienne de Longeaux <*****@*****.**>
  */
 protected function render($options = null)
 {
     // Options management
     if (!isset($options['acc-id-box']) || empty($options['acc-id-box'])) {
         throw ExtensionException::optionValueNotSpecified('acc-id-box', __CLASS__);
     }
     if (!isset($options['acc-id']) || empty($options['acc-id'])) {
         throw ExtensionException::optionValueNotSpecified('acc-id', __CLASS__);
     }
     if (!isset($options['acc-type']) || empty($options['acc-type']) || isset($options['acc-type']) && !in_array($options['acc-type'], self::$types)) {
         throw ExtensionException::optionValueNotSpecified('acc-type', __CLASS__);
     }
     if ($options['acc-type'] == "accordeonUl") {
         return $this->accUlAction($options);
     } elseif ($options['acc-type'] == "accordeonDiv") {
         return $this->accDivAction($options);
     } elseif ($options['acc-type'] == "accordeonTree") {
         return $this->accTreeAction($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)
    {
        // Option management
        if (!isset($options['form-name']) || empty($options['form-name'])) {
            throw ExtensionException::optionValueNotSpecified('form-name', __CLASS__);
        }
        $url_css = '/css/layout.css';
        $url_base = 'http://' . $this->container->get('Request')->getHttpHost() . $this->container->get('Request')->getBasePath() . "/bundles/sfynxtemplate/js/tiny_mce";
        // We open the buffer.
        ob_start();
        ?>
        
            	var id_form_delete = "";
            
                // we create the animations.
                var j_prototype = new function()
                {
                    this.ftc_tinymce_editor = function(idObj){
                        idObj.tinymce({
                            // Location of TinyMCE script
                            script_url : '<?php 
        echo $url_base;
        ?>
/tiny_mce.js',
                            // General options
                            theme : "advanced",
                            language : "<?php 
        echo strtolower(current(explode("_", $this->locale)));
        ?>
",
                            plugins : "openmanager,autolink,lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,advlist",
                            // url convertion : http://www.tinymce.com/tryit/url_conversion.php
                            relative_urls : true,
                            document_base_url: '',
                            remove_script_host : true,
                            convert_urls : true,
                            //FILE UPLOAD MODS
                            file_browser_callback: "openmanager",
                            open_manager_upload_path: "<?php 
        echo $root_upload;
        ?>
",
                            open_manager_web_path: "<?php 
        echo $root_web;
        ?>
",
                            /*SBLA 20130211*/
                            // forced_root_block : false,         // Needed for 3.x
                            // forced_root_block : '',
                            extended_valid_elements : "-p",   // suprime les <p></p>
                            force_br_newlines : true,
                            //force_p_newlines : false,
                            convert_newlines_to_brs : true,
                            //remove_linebreaks : true,
                            convert_fonts_to_spans : true,
                            font_size_classes : "tt-10,tt-9,tt-8,tt-7,tt-6,tt-4,tt-2",
                            // don't replace encoding character like : é to &eacutes;
                            entity_encoding : "raw",  
                         	// clean up the content
                            cleanup_callback : this.fct_tinymce_xhtml_transform,                    
                            // Theme options
                            theme_advanced_buttons1 : "fullscreen,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,formatselect,styleselect,fontselect,fontsizeselect",
                            theme_advanced_buttons2 : "code,cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,image,anchor,cleanup,help,|,insertdate,inserttime,preview,|,forecolor,backcolor",
                            theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl",
                            theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak",
                            theme_advanced_toolbar_location : "top",
                            theme_advanced_toolbar_align : "left",
                            theme_advanced_statusbar_location : "bottom",
                            theme_advanced_resizing : true,
                            // Exemple content CSS (should be your site CSS)
                            content_css : "<?php 
        echo $url_css;
        ?>
",
                            // Style formats for 'styleselect'
                            style_formats : [
                                {title : 'Liste point rose', selector : 'ul', classes : 'roseDisc'},
                                {title : 'Titre rose', block : 'h3', classes : 'tt-5 tt-clr'},
                                {title : 'Titre 1', block : 'h3', classes : 'tt-1'},
                                {title : 'Titre 2', block : 'h3', classes : 'tt-2'},
                                {title : 'Titre 3', block : 'h3', classes : 'tt-3'},
                                {title : 'Titre 4', block : 'h4', classes : 'tt-4'},
                                {title : 'Titre 5', block : 'h4', classes : 'tt-red'},
                                {title : 'Titre 6', block : 'h4', classes : 'tt-purple'}
                            ],
                            formats : {
                                alignleft : {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', classes : 'txtleft'},
                                aligncenter : {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', classes : 'txtcenter'},
                                alignright : {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', classes : 'txtright'},
                                alignfull : {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', classes : 'txtjustify'},
                                bold : {inline : 'span', 'classes' : 'bold'},
                                italic : {inline : 'span', 'classes' : 'italic'},
                                underline : {inline : 'span', 'classes' : 'underline', exact : true},
                                strikethrough : {inline : 'del'},
                            },
                            // Drop lists for link/image/media/template dialogs
                            template_external_list_url : "<?php 
        echo $url_base;
        ?>
/plugins/lists/template_list.js",
                            external_link_list_url : "<?php 
        echo $url_base;
        ?>
/plugins/lists/link_list.js",
                            external_image_list_url : "<?php 
        echo $url_base;
        ?>
/plugins/lists/image_list.js",
                            media_external_list_url : "<?php 
        echo $url_base;
        ?>
/plugins/lists/media_list.js",
                            // count without the lenght of html balise
                            setup : function(ed) {
                                ed.onKeyUp.add(function(ed, e) {
                                    var strip = (tinymce.activeEditor.getContent()).replace(/(<([^>]+)>)/ig,"").replace(/&[a-z]+;/ig, "");
                                    var text = strip.split(' ').length + " Mots, " +  (10000 - strip.length) + " Caractères "
                                    tinymce.DOM.setHTML(tinymce.DOM.get(tinymce.activeEditor.id + '_path_row'), text);

                                    // limit the lenght of written
                                    //if (strip.length > ("<?php 
        if ($this->container->get('Request')->get('_route') == 'gedmo_admin_social_edit') {
            ?>
"+245+"<?php 
        } else {
            ?>
"+475+"<?php 
        }
        ?>
")) {
                                    //      strip = strip.substring(0,("<?php 
        if ($this->container->get('Request')->get('_route') == 'gedmo_admin_social_edit') {
            ?>
"+245+"<?php 
        } else {
            ?>
"+475+"<?php 
        }
        ?>
"));
                                    //      tinymce.execCommand('mceSetContent',false,strip);
                                    //}
                                });
                            }
                        });
                    };    

                    this.ftc_tinymce_editor_simple = function(idObj){
                        idObj.tinymce({
                            // Location of TinyMCE script
                            script_url : '<?php 
        echo $url_base;
        ?>
/tiny_mce.js',
                            // General options
                            theme : "advanced",
                            language : "<?php 
        echo strtolower(current(explode("_", $this->locale)));
        ?>
",
                            plugins : "openmanager,autolink,lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,advlist",
                            // url convertion : http://www.tinymce.com/tryit/url_conversion.php
                            relative_urls : true,
                            document_base_url: '',
                            remove_script_host : true,
                            convert_urls : true,
                            //FILE UPLOAD MODS
                            file_browser_callback: "openmanager",
                            open_manager_upload_path: "<?php 
        echo $root_upload;
        ?>
",
                            open_manager_web_path: "<?php 
        echo $root_web;
        ?>
",
                            /*SBLA 20130211*/
                            // forced_root_block : false,         // Needed for 3.x
                            // forced_root_block : '',
                            extended_valid_elements : "-p",   // suprime les <p></p>
                            force_br_newlines : true,
                            //force_p_newlines : false,
                            convert_newlines_to_brs : true,
                            //remove_linebreaks : true,
                            convert_fonts_to_spans : true,
                            font_size_classes : "tt-10,tt-9,tt-8,tt-7,tt-6,tt-4,tt-2",
                            // don't replace encoding character like : é to &eacutes;
                            entity_encoding : "raw",  
                         	// clean up the content
                            cleanup_callback : this.fct_tinymce_xhtml_transform,                    
                            // Theme options
                            theme_advanced_buttons1 : "fullscreen,bold,italic,underline,strikethrough,justifyleft,justifycenter,justifyright,justifyfull,bullist,numlist,hr,sub,sup,forecolor,backcolor",
                            theme_advanced_buttons2 : "removeformat,formatselect,styleselect,fontsizeselect,visualchars,outdent,indent,undo,redo",
                            theme_advanced_buttons3 : "code,link,unlink,search,replace,tablecontrols",
                            theme_advanced_buttons4 : "visualaid,insertdate,inserttime,anchor,blockquote,charmap,iespell,advhr,nonbreaking,|,insertlayer,moveforward,movebackward,absolute,|,styleprops,|acronym,del,ins,attribs,image,media",
                            theme_advanced_toolbar_location : "top",
                            theme_advanced_toolbar_align : "left",
                            theme_advanced_statusbar_location : "bottom",
                            theme_advanced_resizing : true,
                            // Exemple content CSS (should be your site CSS)
                            content_css : "<?php 
        echo $url_css;
        ?>
",
                            // Style formats for 'styleselect'
                            style_formats : [
                                {title : 'Liste point rose', selector : 'ul', classes : 'roseDisc'},
                                {title : 'Titre rose', block : 'h3', classes : 'tt-5 tt-clr'},
                                {title : 'Titre 1', block : 'h3', classes : 'tt-1'},
                                {title : 'Titre 2', block : 'h3', classes : 'tt-2'},
                                {title : 'Titre 3', block : 'h3', classes : 'tt-3'},
                                {title : 'Titre 4', block : 'h4', classes : 'tt-4'},
                                {title : 'Titre 5', block : 'h4', classes : 'tt-red'},
                                {title : 'Titre 6', block : 'h4', classes : 'tt-purple'}
                            ],
                            formats : {
                                alignleft : {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', classes : 'txtleft'},
                                aligncenter : {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', classes : 'txtcenter'},
                                alignright : {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', classes : 'txtright'},
                                alignfull : {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', classes : 'txtjustify'},
                                bold : {inline : 'span', 'classes' : 'bold'},
                                italic : {inline : 'span', 'classes' : 'italic'},
                                underline : {inline : 'span', 'classes' : 'underline', exact : true},
                                strikethrough : {inline : 'del'},
                            },
                            // Drop lists for link/image/media/template dialogs
                            template_external_list_url : "<?php 
        echo $url_base;
        ?>
/plugins/template_list.js",
                            external_link_list_url : "<?php 
        echo $url_base;
        ?>
/plugins/lists/link_list.js",
                            external_image_list_url : "<?php 
        echo $url_base;
        ?>
/plugins/lists/image_list.js",
                            media_external_list_url : "<?php 
        echo $url_base;
        ?>
/plugins/lists/media_list.js",
                            // count without the lenght of html balise
                            setup : function(ed) {
                                ed.onKeyUp.add(function(ed, e) {
                                    var strip = (tinymce.activeEditor.getContent()).replace(/(<([^>]+)>)/ig,"").replace(/&[a-z]+;/ig, "");
                                    var text = strip.split(' ').length + " Mots, " +  (10000 - strip.length) + " Caractères "
                                    tinymce.DOM.setHTML(tinymce.DOM.get(tinymce.activeEditor.id + '_path_row'), text);

                                    // limit the lenght of written
                                    //if (strip.length > ("<?php 
        if ($this->container->get('Request')->get('_route') == 'gedmo_admin_social_edit') {
            ?>
"+245+"<?php 
        } else {
            ?>
"+475+"<?php 
        }
        ?>
")) {
                                    //      strip = strip.substring(0,("<?php 
        if ($this->container->get('Request')->get('_route') == 'gedmo_admin_social_edit') {
            ?>
"+245+"<?php 
        } else {
            ?>
"+475+"<?php 
        }
        ?>
"));
                                    //      tinymce.execCommand('mceSetContent',false,strip);
                                    //}
                                });
                            }
                        });
                    };        

                    this.ftc_tinymce_editor_simple_easy = function(idObj){
                        idObj.tinymce({
                            // Location of TinyMCE script
                            script_url : '<?php 
        echo $url_base;
        ?>
/tiny_mce.js',
                            // General options
                            theme : "advanced",
                            language : "<?php 
        echo strtolower(current(explode("_", $this->locale)));
        ?>
",
                            plugins : "openmanager,autolink,lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,advlist",
                            // url convertion : http://www.tinymce.com/tryit/url_conversion.php
                            relative_urls : true,
                            document_base_url: '',
                            remove_script_host : true,
                            convert_urls : true,
                            //FILE UPLOAD MODS
                            file_browser_callback: "openmanager",
                            open_manager_upload_path: "<?php 
        echo $root_upload;
        ?>
",
                            open_manager_web_path: "<?php 
        echo $root_web;
        ?>
",
                            /*SBLA 20130211*/
                            // forced_root_block : false,         // Needed for 3.x
                            // forced_root_block : '',
                            extended_valid_elements : "-p",   // suprime les <p></p>
                            force_br_newlines : true,
                            //force_p_newlines : false,
                            convert_newlines_to_brs : true,
                            //remove_linebreaks : true,
                            convert_fonts_to_spans : true,
                            font_size_classes : "tt-10,tt-9,tt-8,tt-7,tt-6,tt-4,tt-2",
                            // don't replace encoding character like : é to &eacutes;
                            entity_encoding : "raw",  
                         	// clean up the content
                            cleanup_callback : this.fct_tinymce_xhtml_transform,                    
                            // Theme options
                            theme_advanced_buttons1 : "fullscreen,bold,italic,underline,strikethrough,justifyleft,justifycenter,justifyright,justifyfull,bullist,numlist,forecolor,backcolor",
                            theme_advanced_buttons2 : "removeformat,formatselect,styleselect,fontsizeselect,outdent,indent,undo,redo",
                            theme_advanced_buttons3 : "code,link,unlink,search,replace,insertdate,inserttime,blockquote,charmap,image,media",
                            theme_advanced_toolbar_location : "top",
                            theme_advanced_toolbar_align : "left",
                            theme_advanced_statusbar_location : "bottom",
                            theme_advanced_resizing : true,
                            // Exemple content CSS (should be your site CSS)
                            content_css : "<?php 
        echo $url_css;
        ?>
",
                            // Style formats for 'styleselect'
                            style_formats : [
                                {title : 'Liste point rose', selector : 'ul', classes : 'roseDisc'},
                                {title : 'Titre rose', block : 'h3', classes : 'tt-5 tt-clr'},
                                {title : 'Titre 1', block : 'h3', classes : 'tt-1'},
                                {title : 'Titre 2', block : 'h3', classes : 'tt-2'},
                                {title : 'Titre 3', block : 'h3', classes : 'tt-3'},
                                {title : 'Titre 4', block : 'h4', classes : 'tt-4'},
                                {title : 'Titre 5', block : 'h4', classes : 'tt-red'},
                                {title : 'Titre 6', block : 'h4', classes : 'tt-purple'}
                            ],
                            formats : {
                                alignleft : {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', classes : 'txtleft'},
                                aligncenter : {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', classes : 'txtcenter'},
                                alignright : {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', classes : 'txtright'},
                                alignfull : {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', classes : 'txtjustify'},
                                bold : {inline : 'span', 'classes' : 'bold'},
                                italic : {inline : 'span', 'classes' : 'italic'},
                                underline : {inline : 'span', 'classes' : 'underline', exact : true},
                                strikethrough : {inline : 'del'},
                            },
                            // Drop lists for link/image/media/template dialogs
                            template_external_list_url : "<?php 
        echo $url_base;
        ?>
/plugins/template_list.js",
                            external_link_list_url : "<?php 
        echo $url_base;
        ?>
/plugins/lists/link_list.js",
                            external_image_list_url : "<?php 
        echo $url_base;
        ?>
/plugins/lists/image_list.js",
                            media_external_list_url : "<?php 
        echo $url_base;
        ?>
/plugins/lists/media_list.js",
                            // count without the lenght of html balise
                            setup : function(ed) {
                                ed.onKeyUp.add(function(ed, e) {
                                    var strip = (tinymce.activeEditor.getContent()).replace(/(<([^>]+)>)/ig,"").replace(/&[a-z]+;/ig, "");
                                    var text = strip.split(' ').length + " Mots, " +  (10000 - strip.length) + " Caractères "
                                    tinymce.DOM.setHTML(tinymce.DOM.get(tinymce.activeEditor.id + '_path_row'), text);

                                    // limit the lenght of written
                                    //if (strip.length > ("<?php 
        if ($this->container->get('Request')->get('_route') == 'gedmo_admin_social_edit') {
            ?>
"+245+"<?php 
        } else {
            ?>
"+475+"<?php 
        }
        ?>
")) {
                                    //      strip = strip.substring(0,("<?php 
        if ($this->container->get('Request')->get('_route') == 'gedmo_admin_social_edit') {
            ?>
"+245+"<?php 
        } else {
            ?>
"+475+"<?php 
        }
        ?>
"));
                                    //      tinymce.execCommand('mceSetContent',false,strip);
                                    //}
                                });
                            }
                        });
                    };                        

                    this.ftc_tinymce_editor_easy = function(idObj){
                        idObj.tinymce({
                            // Location of TinyMCE script
                            script_url : '<?php 
        echo $url_base;
        ?>
/tiny_mce.js',
                            // General options
                            theme : "advanced",
                            language : "<?php 
        echo strtolower(current(explode("_", $this->locale)));
        ?>
",
                            plugins : "openmanager,autolink,lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,advlist",
                            // url convertion : http://www.tinymce.com/tryit/url_conversion.php
                            relative_urls : true,
                            document_base_url: '',
                            remove_script_host : true,
                            convert_urls : true,
                            //FILE UPLOAD MODS
                            file_browser_callback: "openmanager",
                            open_manager_upload_path: "<?php 
        echo $root_upload;
        ?>
",
                            open_manager_web_path: "<?php 
        echo $root_web;
        ?>
",
                            /*SBLA 20130211*/
                            // forced_root_block : false,         // Needed for 3.x
                            // forced_root_block : '',
                            extended_valid_elements : "-p",   // suprime les <p></p>
                            force_br_newlines : true,
                            //force_p_newlines : false,
                            convert_newlines_to_brs : true,
                            //remove_linebreaks : true,
                            convert_fonts_to_spans : true,
                            font_size_classes : "tt-10,tt-9,tt-8,tt-7,tt-6,tt-4,tt-2",
                            // don't replace encoding character like : é to &eacutes;
                            entity_encoding : "raw",  
                         	// clean up the content
                            cleanup_callback : this.fct_tinymce_xhtml_transform,                    
                            // Theme options
                            theme_advanced_buttons1 : "fullscreen,bold,italic,underline,strikethrough,justifyleft,justifycenter,justifyright,justifyfull,bullist,numlist,hr,sub,sup,forecolor,backcolor",
                            theme_advanced_buttons2 : "code,formatselect,styleselect,fontsizeselect,removeformat,visualchars,outdent,indent,undo,redo",
                            theme_advanced_buttons3 : "", 
                            theme_advanced_toolbar_location : "top",
                            theme_advanced_toolbar_align : "left",
                            theme_advanced_statusbar_location : "bottom",
                            theme_advanced_resizing : true,
                            // Exemple content CSS (should be your site CSS)
                            content_css : "<?php 
        echo $url_css;
        ?>
",
                            // Style formats for 'styleselect'
                            style_formats : [
                                {title : 'Liste point rose', selector : 'ul', classes : 'roseDisc'},
                                {title : 'Titre rose', block : 'h3', classes : 'tt-5 tt-clr'},
                                {title : 'Titre 1', block : 'h3', classes : 'tt-1'},
                                {title : 'Titre 2', block : 'h3', classes : 'tt-2'},
                                {title : 'Titre 3', block : 'h3', classes : 'tt-3'},
                                {title : 'Titre 4', block : 'h4', classes : 'tt-4'},
                                {title : 'Titre 5', block : 'h4', classes : 'tt-red'},
                                {title : 'Titre 6', block : 'h4', classes : 'tt-purple'}
                            ],
                            formats : {
                                alignleft : {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', classes : 'txtleft'},
                                aligncenter : {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', classes : 'txtcenter'},
                                alignright : {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', classes : 'txtright'},
                                alignfull : {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', classes : 'txtjustify'},
                                bold : {inline : 'span', 'classes' : 'bold'},
                                italic : {inline : 'span', 'classes' : 'italic'},
                                underline : {inline : 'span', 'classes' : 'underline', exact : true},
                                strikethrough : {inline : 'del'},
                            },
                            // Drop lists for link/image/media/template dialogs
                            template_external_list_url : "<?php 
        echo $url_base;
        ?>
/plugins/lists/template_list.js",
                            external_link_list_url : "<?php 
        echo $url_base;
        ?>
/plugins/lists/link_list.js",
                            external_image_list_url : "<?php 
        echo $url_base;
        ?>
/plugins/lists/image_list.js",
                            media_external_list_url : "<?php 
        echo $url_base;
        ?>
/plugins/lists/media_list.js",
                            // count without the lenght of html balise
                            setup : function(ed) {
                                ed.onKeyUp.add(function(ed, e) {
                                    var strip = (tinymce.activeEditor.getContent()).replace(/(<([^>]+)>)/ig,"").replace(/&[a-z]+;/ig, "");
                                    var text = strip.split(' ').length + " Mots, " +  (10000 - strip.length) + " Caractères "
                                    tinymce.DOM.setHTML(tinymce.DOM.get(tinymce.activeEditor.id + '_path_row'), text);

                                    // limit the lenght of written
                                    //if (strip.length > ("<?php 
        if ($this->container->get('Request')->get('_route') == 'gedmo_admin_social_edit') {
            ?>
"+245+"<?php 
        } else {
            ?>
"+475+"<?php 
        }
        ?>
")) {
                                    //      strip = strip.substring(0,("<?php 
        if ($this->container->get('Request')->get('_route') == 'gedmo_admin_social_edit') {
            ?>
"+245+"<?php 
        } else {
            ?>
"+475+"<?php 
        }
        ?>
"));
                                    //      tinymce.execCommand('mceSetContent',false,strip);
                                    //}
                                });
                            }
                        });
                    };    
                 	// This function allows to convert the entered text
                    this.fct_tinymce_xhtml_transform = function xhtml_transform(type, value) {
                    	switch (type) {
		                        case "get_from_editor":
		                        	 	value = value.replace(/&nbsp;/ig, " ");	
		                        		value = value.replace(/\s/ig, " ");
		                                break;
		                        case "insert_to_editor":
										//value = value.replace(/<p[^>]*><span[^>]*> <\/span><\/p>/g,"<p><span> </span></p>");
		                    			//value = value.replace(/<p[^>]*> <\/p>/g, "<p> </p>");
		                    			value = value.replace(/&nbsp;/ig, " ");		     
		                    			value = value.replace(/\s/ig, " ");		                                    
		                                break;
		                        case "submit_content":
		                                break;
		                        case "get_from_editor_dom":
		                                break;
		                        case "insert_to_editor_dom":
		                                break;
		                        case "setup_content_dom":
		                                break;
		                        case "submit_content_dom":
		                                break;
		                }
		                return value;				
		            },                     
                    // THIS FUNCTION ALLOW TO INJECT SEVERAL FIELDS IN A ACCORDION MENU.
                    // exemple : j_prototype_bytabs.ftc_accordion_form("meta_definition", "SEO", ".myform");
                    // exemple : j_prototype_bytabs.ftc_accordion_form("meta_definition", "SEO", ".myform", 'questionLi0');
                    // exemple : j_prototype_bytabs.ftc_accordion_form("meta_definition", "SEO", ".myform", 'questionLi1');
                    this.ftc_accordion_form = function(className, title, idForm, addClass){
                        var addClassBis;
                        var tabsToProcess = $(idForm+" .ui-tabs-panel");

                        if (typeof(addClass) == "undefined") { addClass = '';addClassBis = ''; }
                        else addClassBis = '.' + addClass;
                        
                        $(tabsToProcess).each(function(indTab,tabProcessed){
                            var tabProcessedId = $(tabProcessed).attr("id");

                            if ( $("#"+tabProcessedId+" ."+className).length ==0 ) {
                                // Process next $.each()
                                return;
                            }
                            
                            $("#"+tabProcessedId+" fieldset:first").addClass("no-accordion");
                            if ( $("#"+tabProcessedId+" .accordion-form").length == 0 ) {
                                $("<div class='accordion-form'>").insertAfter("#"+tabProcessedId+" fieldset");
                            }
                            
                            var accordionId = "accordion_" + tabProcessedId + "_" + addClass +"_"+ className;
                            $("<fieldset id='"+accordionId+"' class='accordion'><legend>"+title+"</legend></fieldset>").appendTo("#"+tabProcessedId+" .accordion-form");

                            $("#"+tabProcessedId+" "+addClassBis+" ."+className).each(function(indClass) {
                                //$(this).parent('.clearfix').detach().appendTo("#"+accordionId);
                                $(this).closest('.clearfix').detach().appendTo("#"+accordionId);
                            });    
                        
                            $('#'+accordionId+' legend').click(function(event, dataObject) {  
                            	event.preventDefault(); 
                                var that = $(this);
                                var newHeight = function(){
                                    var h=16;    //initial height when closed
                                    that.parent('fieldset').children('.clearfix').each(function(ind,el){
                                        h += $(el).outerHeight(true);
                                    });
                                    return (h+80)+'px';
                                };
                                
                                if ( $(this).parent('fieldset').hasClass('open') ){
                                    $(this).parent('fieldset').removeClass('open');
                                    $(this).parent('fieldset').animate({
                                        height: '16px'
                                      }, 400, 'swing'
                                    );
                                } else {
                                    $(this).parent('fieldset').animate({
                                        height: newHeight()
                                    }, 400, 'swing', function() {
                                        $(this).addClass('open');
                                    }).siblings('fieldset').removeClass('open').animate({
                                        height: '16px'
                                      }, 400, 'swing'
                                    );
                                }
                                return false;
                            });
                        });
                    };
                        
                    // this function allow to inject several fields in a dialog.
                    // exemple : j_prototype_bytabs.ftc_dialog_form("solution_descriptif", "Descriptif", ".myform", 400, 366, "center");
                    this.ftc_dialog_form = function(className, title, idForm, height, width, position){
                        // We inject the testimonial fields via a dialog
                        // var button     = $("<a href='#' style='margin-right:30px' class=' dialog_link_"+className+"' title='"+title+"'>"+title+"</a>").appendTo(idForm+" fieldset"); SBLA
                        var button     = $("<a href='#' style='margin-right:30px' class=' dialog_link_"+className+"' title='"+title+"'>"+title+"</a>");
                        $(idForm+" fieldset:first").append(button);
                        var form     = "form_"+className;
                        var obj_form = null;
                        var dialogId = "dialog_"+className;

                        $("<div id='"+dialogId+"' class='dialog_form' ><span id='"+form+"'></span></div>").appendTo(idForm);
                    
                        $("."+className).each(function(index) {
                            $(this).parent().attr('style', "display:none");
                        });    

                        // modal dialog init: custom buttons and a "close" callback reseting the form inside
                        var $dialog_form = $('#'+dialogId).dialog({
                            autoOpen: false,
                            modal:true,
                            height: height,
                            width: width,
                            position: position,
                            buttons: {
                                '<?php 
        echo $this->translator->trans('pi.form.tab.box.close');
        ?>
': function () {
                                    $(this).dialog('close');
                                },
                            },
                            open: function () {
                                $(this).dialog({title: title + ' form'});
                            },
                            focus: function () {
                                //j_prototype_bytabs.ftc_tinymce_editor($(".pi_editor"));
                            },
                            beforeClose: function () {
                                obj_form = $(this).children().detach();
                                obj_form.attr('style', "display:none").appendTo(idForm);
                            },
                            captionButtons: {
                                    pin: { visible: false },
                                    refresh: { visible: false },
                                    toggle: { visible: true },
                                    minimize: { visible: false },
                                    maximize: { visible: false }
                                },                                        
                            show: 'scale',
                            hide: 'scale',                
                        });    

                        button.click(function () {
                            if (obj_form != null){
                                obj_form = $("#"+form).detach();
                                obj_form.appendTo($dialog_form);
                                obj_form.attr('style', "display:block");
                            } else {
                                $("."+className).each(function(index) {
                                    obj_start = $(this).parent().attr('style', "display:block");
                                    obj_start.detach().appendTo("#"+form);
                                    obj_newform = $("#"+form).detach();
                                    obj_newform.appendTo($dialog_form);
                                    obj_newform.attr('style', "display:block");
                                });    
                            }
                                
                            $dialog_form.wijdialog('open');
                        });                        
                    };                        
                        
                };
            
                $(document).ready(function() {

                    $("#dialog-confirm").dialog({
	               		 autoOpen: false,
	               		 resizable: false,
	               		 height:140,
	               		 modal: true,
	               		 buttons: {
	                   		 "<?php 
        echo $this->container->get('translator')->trans('pi.form.tab.box.delete');
        ?>
": function() {
	                           	$('#'+id_form_delete).trigger('submit');
	                           	$( this ).dialog( "close" );
	                   		 },
	                   		 "<?php 
        echo $this->container->get('translator')->trans('pi.form.tab.box.cancel');
        ?>
": function() {
	                   		 	$( this ).dialog( "close" );
	                   		 }
	               		 }
              	 	});                    
                
                    $("<?php 
        echo $options['form-name'];
        ?>
 input[type='radio']").iCheck({
                        handle: 'radio',
                        radioClass: 'iradio_square-blue',
                    });
                    $("<?php 
        echo $options['form-name'];
        ?>
 input[type='checkbox']").iCheck({
                        handle: 'checkbox',
                        checkboxClass: 'icheckbox_square-blue',
                    });

                    $("<?php 
        echo $options['form-name'];
        ?>
 button.button-ui-create").button({icons: {primary: "ui-icon-circle-plus"}});
                    $("<?php 
        echo $options['form-name'];
        ?>
 button.button-ui-save").button({icons: {primary: "ui-icon-disk"}});
                    $("<?php 
        echo $options['form-name'];
        ?>
 a.button-ui-delete").button({icons: {primary: "ui-icon-trash"}}) .click(function( event ) {
                    	 event.preventDefault();
                    	 id_form_delete = $(this).data('id');
                    	 $("#dialog-confirm").dialog("open");
                    });
                    $(<?php 
        echo $options['form-name'];
        ?>
 "a.button-ui-back-list").button({icons: {primary: "ui-icon-arrowreturn-1-w"}});
                    $("<?php 
        echo $options['form-name'];
        ?>
 input[type='button']").click(function () { return false; });
                    

                    $("<?php 
        echo $options['form-name'];
        ?>
 select.pi_simpleselect").multiselect({
                       multiple: false,
                       header: true,
                       noneSelectedText: "<?php 
        echo $this->translator->trans('pi.form.label.select.choose.option');
        ?>
",
                       selectedList: 1
                    }).multiselectfilter();                                                

                    $("<?php 
        echo $options['form-name'];
        ?>
 select.pi_multiselect").multiselect({
                       multiple: true,
                       header: true,
                       noneSelectedText: "<?php 
        echo $this->translator->trans('pi.form.label.select.choose.options');
        ?>
",
                       selectedList: 4
                    }).multiselectfilter();                                                
                    
                    $("<?php 
        echo $options['form-name'];
        ?>
 .pi_datepicker").datepicker({
                    	changeMonth: true,
                        changeYear: true,
                        yearRange: "-71:+11",
                        reverseYearRange: true,
                        showOtherMonths: true,
                        showButtonPanel: true,
                        showAnim: "fade",  // blind fade explode puff fold
                        showWeek: true,
                        showOptions: { 
                            direction: "up" 
                        },
                        numberOfMonths: [ 1, 2 ],
                        buttonText: "<?php 
        echo $this->translator->trans('pi.form.label.select.choose.date');
        ?>
",
                        showOn: "both",
                        buttonImage: "/bundles/sfynxtemplate/images/icons/form/picto-calendar.png"
                    });
                    $("<?php 
        echo $options['form-name'];
        ?>
 .pi_datetimepicker").datepicker({
                        formatDate: 'g',
                        buttonText: "<?php 
        echo $this->translator->trans('pi.form.label.select.choose.hour');
        ?>
",
                        showOn: "both",
                        buttonImage: "/bundles/sfynxtemplate/images/icons/form/Clock_4-64.png"
                    });
                    $.datepicker.setDefaults( $.datepicker.regional[ "<?php 
        echo strtolower(substr($locale, 0, 2));
        ?>
" ] );

                    $("[class*='limited']").each(function(i){
                        var c = $(this).attr("class");
                        var from = c.indexOf("(");
                        var to = c.indexOf(")");
                        var limit = parseInt(c.substring(from+1,to));

                        $(this).bind("keyup keydown change",function(e){
                          if (this.value.length > limit) {
                          this.value = this.value.substring(0, limit);
                          }
                        });
                    });            

                    j_prototype.ftc_tinymce_editor($("<?php 
        echo $options['form-name'];
        ?>
 .pi_editor"));                                                
                    j_prototype.ftc_tinymce_editor_simple($("<?php 
        echo $options['form-name'];
        ?>
 .pi_editor_simple"));
                    j_prototype.ftc_tinymce_editor_simple_easy($("<?php 
        echo $options['form-name'];
        ?>
 .pi_editor_simple_easy"));
                    j_prototype.ftc_tinymce_editor_simple($("<?php 
        echo $options['form-name'];
        ?>
 .pi_editor_easy"));
                    
                });
        <?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="dialog-confirm" title="<?php 
        echo $this->container->get('translator')->trans('pi.grid.action.delete.confirmation.title');
        ?>
">
    		    <p><span class="ui-icon ui-icon-alert" style="float: left; margin: 0 7px 20px 0;"></span>
    			<?php 
        echo $this->container->get('translator')->trans('pi.grid.action.delete.confirmation.message');
        ?>
</p>
    		</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, 'core/formsimple/');
    }
 /**
  * Define page Org html with ul/li balises.
  *
  * <code>
  *  {% set options_chartpage = {
  *       'entity':'PiAppGedmoBundle:Menu',
  *       'category':'Menuwrapper',
  *       'action':'renderDefault',
  *       'menu': 'organigram',
  *       'fields':{
  *                  '0':{'content':'title', 'class':'pi_tree_desc'}
  *              },
  *       'id':'orga' } %}
  *  {{ renderJquery('MENU', 'org-chart-page', options_chartpage )|raw }}
  * <code> 
  *
  * @param array $options
  * 
  * @access public
  * @return string
  * @author Etienne de Longeaux <*****@*****.**>
  */
 public function organigramMenu($options = null)
 {
     // Options management
     if (!isset($options['entity']) || empty($options['entity'])) {
         throw ExtensionException::optionValueNotSpecified('entity', __CLASS__);
     }
     if (!isset($options['category'])) {
         throw ExtensionException::optionValueNotSpecified('category', __CLASS__);
     }
     if (!isset($options['locale'])) {
         $locale = $this->container->get('request')->getLocale();
     } else {
         $locale = $options['locale'];
     }
     $TreeManager = $this->container->get('pi_app_admin.manager.tree');
     if ($TreeManager instanceof PiTreeManager) {
         return $TreeManager->defaultOrganigram($locale, $options['entity'], $options['category'], $options);
     } else {
         throw ExtensionException::serviceUndefined('PiTreeManager');
     }
 }
    /**
     * Sets render for prototype links in the form.
     *
     * @param    $options    tableau d'options.
     * @access protected
     * @return void
     *
     * @author Etienne de Longeaux <*****@*****.**>
     */
    protected function render($options = null)
    {
        // Option management
        if (!isset($options['prototype-name']) || empty($options['prototype-name'])) {
            $options['prototype-name'] = '';
        }
        if (!isset($options['prototype-tab-title']) || empty($options['prototype-tab-title'])) {
            throw ExtensionException::optionValueNotSpecified('prototype-tab-title', __CLASS__);
        }
        if (!isset($options['prototype-tab-idForm']) || empty($options['prototype-tab-idForm'])) {
            $options['prototype-idForm'] = ".myform";
        }
        // we set all roots
        $url_css = '/css/layout.css';
        $url_root = 'http://' . $this->container->get('Request')->getHttpHost() . $this->container->get('Request')->getBasePath();
        $url_base = $url_root . "/bundles/sfynxtemplate/js/tiny_mce";
        $root_upload = $this->container->get("kernel")->getRootDir() . "/../web/uploads/tinymce/";
        $root_web = $this->container->get("kernel")->getRootDir() . "/../web";
        // we set the locale date format of datepicker
        $locale = strtolower(substr($this->locale, 0, 2));
        $root_file = realpath($this->container->getParameter("kernel.root_dir") . "/../web/bundles/sfynxtemplate/js/ui/i18n/jquery.ui.datepicker-{$locale}.js");
        if (!$root_file) {
            $locale = "en-GB";
        }
        // We open the buffer.
        ob_start();
        ?>
                var id_form_delete = "";

                // we create the animations.
                var j_prototype_bytabs = new function()
                {
                    var tab_counter            = 2;
                    var name_prototype         = '';
                    var $prototype_content     = '';
                    var name_idForm            = '';
                    var tabTemplate            = '<li><a href="#{href}">#{label}</a> <span class="ui-icon ui-icon-close">Remove Tab</span></li>';
                    var tab_ajaxselect         = new Array();

                    // tabs init with a custom tab template and an "add" callback filling in the content
                    // http://jqueryui.com/tabs/#manipulation
                    var tabs = $('#tabs').tabs({
                        tabTemplate: tabTemplate,
                        create: function (event, ui) {
                            // On enregistre le contenu du prototype dans le nouveau tab.
                            $(ui.panel).append('<p>' + $prototype_content + '</p>');
                        },
                        activate: function(event, ui) {
                                //console.log(ui)
                                var curTab = $('.ui-tabs-selected'); 
                                var curTabPanel = $('.ui-tabs-panel:not(.ui-tabs-hide)');                              
                        }
                    });

                    // modal dialog init: custom buttons and a "close" callback reseting the form inside
                    var $dialog = $('#dialog').dialog({
                        showStatus: false,
                        showControlBox: false,
                        autoOpen: false,
                        modal: true,
                        buttons: {
                            '<?php 
        echo $this->translator->trans('pi.form.tab.box.add');
        ?>
': function () {
                                j_prototype_bytabs.ftc_add_tag();
                                $(this).dialog('close');
                            },
                            '<?php 
        echo $this->translator->trans('pi.form.tab.box.cancel');
        ?>
': function () {
                                $(this).dialog('close');
                            }
                        },
                        open: function () {
                        },
                        close: function () {
                        }
                    });

                    // We inject the error messages via a dialog
                    var value_message = '';

                    $(".symfony-form-errors").each(function(index) {
                        value_message = value_message + $(this).html();
                    });

                    this.ftc_init = function(idForm, var_prototype){
                                                // We initialize the variables.
                                                name_prototype = var_prototype;
                                                name_idForm    = idForm;

                                                if (value_message.length != 0) {
                                                    // modal dialog for the error form
                                                    $('#form-error-dialog').dialog({
                                                        autoOpen: true,
                                                        height: 300,
                                                        width: 400,
                                                        modal: true,
                                                        buttons: {
                                                            Ok: function () {
                                                                $(this).dialog("close");
                                                            }
                                                        },
                                                        open: function () {
                                                            $(this).attr('title', 'Error form');
                                                            $(this).html(value_message);
                                                        },
                                                        captionButtons: {
                                                            pin: { visible: false },
                                                            refresh: { visible: false },
                                                            toggle: { visible: false },
                                                            minimize: { visible: false },
                                                            maximize: { visible: false }
                                                        }
                                                    });
                                                }

                                                // Tags with onglet management
                                                $("#tabs").tabs({
                                                    scrollable: true,
                                                    alignment: 'top',
                                                    showOption: {
                                                        blind: false,
                                                        fade: true,
                                                        duration: 400
                                                    },
                                                    hideOption: {
                                                        blind: false,
                                                        fade: true,
                                                        duration: 200
                                                    }
                                                });

                                                // close icon: removing the tab on click
                                                tabs.delegate( "span.ui-icon-close", "click", function() {
                                                  var panelId = $( this ).closest( "li" ).remove().attr( "aria-controls" );
                                                  $( "#" + panelId ).remove();
                                                  tabs.tabs( "refresh" );
                                                });

                                                // addTab form: calls addTab function on submit and closes the dialog
                                                $('fieldset', $dialog).submit(function () {
                                                    j_prototype_bytabs.ftc_addTab();
                                                    $dialog.dialog('close');
                                                    return false;
                                                });

                                                // http://jquery-ui.googlecode.com/svn/tags/1.6rc5/tests/static/icons.html
                                                $("button.button-ui-create").button({icons: {primary: "ui-icon-circle-plus"}});
                                                $("button.button-ui-save").button({icons: {primary: "ui-icon-disk"}});
                                                $("a.button-ui-delete").button({icons: {primary: "ui-icon-trash"}}).click(function( event ) {
                                                    event.preventDefault();
                                                    id_form_delete = $(this).data('id');
                                                    $("#dialog-confirm").dialog("open");
                                                });
                                                $("a.button-ui-back-list").button({icons: {primary: "ui-icon-arrowreturn-1-w"}});

                                                // addTab button: just opens the dialog
                                                $('button.button-ui-add-tab').button({icons: {primary: "ui-icon-newwin"}}).on('click', function (event) {
                                                      event.preventDefault();
                                                      $dialog.dialog('open');
                                                });

                                                // close icon: removing the tab on click
                                                // note: closable tabs gonna be an option in the future - see http://dev.jqueryui.com/ticket/3924
                                                $('#tabs span.ui-icon-close').on('click', function () {
                                                      var index = $('li', tabs).index($(this).parent());
                                                      tabs.tabs('remove', index);
                                                });

                                                // We run the "get start" of construction.
                                                j_prototype_bytabs.ftc_addGetStart(name_idForm);

                                                // we remove each number of all tabs
                                                $("[id^='"+var_prototype+"']").each(function(i){
                                                    var currentId = $(this).attr('id');
                                                    $(this).find('div:first-child > label').remove();
                                                });

                                                // we remove each first label of all fieldsets
                                                $("fieldset.no-accordion > div > label:first-child").each(function(i){
                                                    var myclass = $(this).parent().attr('class');
                                                    if( (typeof(myclass) == "undefined") && (myclass != "clearfix") ){
                                                        $(this).remove();
                                                    }
                                                });
                    };

                    // actual addTab function: adds new tab using the title input from the form above
                    this.ftc_addGetStart = function(idForm){
                                                $("div[id^='"+name_prototype+"_']").each(function(index) {
                                                    // It retrieves the content.
                                                    var $dataprototype = $(this).html();

                                                    // We tag the prototype with the corresponding class.
                                                    $prototype_content = '<fieldset class="no-accordion"><div id="'+name_prototype+'_' + index + '" >' + $dataprototype + '</div></fieldset>';

                                                    // We add the contents into a new tab.
                                                    j_prototype_bytabs.ftc_addTab(index+1);
                                                });

                                                // It deletes the contents of all collections of such translation.
                                                $("#prototype_all_widgets_"+name_prototype).remove();

                                                // Functions are applied to the management of records of fields.
                                                j_prototype_bytabs.ftc_add_render_form(idForm);

                    };

                    // We define a function that will add a field.
                    this.ftc_add_tag = function(){
                                                var index    = $("div[id^='"+name_prototype+"_']").length;

                                                // We recover the <script> tag which contains the following content « data-prototype ».
                                                var $prototype     = $('script#prototype_script_'+name_prototype);

                                                // The following variable $$name$$ or __name__ is replaced by the number of field.
                                                //var $dataprototype = $prototype.html().replace(/\$\$name\$\$/g, index);
                                                var $dataprototype = $prototype.html().replace('<label class="  required">__name__label__</label>', '');
                                                $dataprototype     = $dataprototype.replace(/__name__/g, index);

                                                // We tag the prototype with the corresponding class.
                                                $prototype_content = '<fieldset><div id="'+name_prototype+'_' + index + '" >' + $dataprototype + '</div></fieldset>';

                                                // We add the contents into a new tab.
                                                j_prototype_bytabs.ftc_addTab(index+1);

                                                // Functions are applied to the management of records of fields.
                                                j_prototype_bytabs.ftc_add_render_form("#"+name_prototype+"_" + index);
                    };

                    // actual addTab function: adds new tab using the title input from the form above
                    this.ftc_addTab = function(index){
                                                //tabs.tabs('add', '#tabs-' + tab_counter, '<?php 
        echo $options['prototype-tab-title'];
        ?>
 ' + index);
                                                var label = "<?php 
        echo $options['prototype-tab-title'];
        ?>
 " + index;
                                                var id = "tabs-" + tab_counter;
                                                var li = $( tabTemplate.replace( /#\{href\}/g, "#" + id ).replace( /#\{label\}/g, label ) );
                                                tabs.find( ".ui-tabs-nav" ).append( li );
                                                tabs.find('form').prepend( "<div id='" + id + "'><p>" + $prototype_content + "</p></div>" );
                                                tabs.tabs( "refresh" );
                                                tab_counter++;
                    };

                    // Applying  Functions which are applied to the management of records of fields.
                    this.ftc_add_render_form = function(prototype_widget){
                                                $(prototype_widget + " a.button-ui-dialog").button({icons: {primary: "ui-icon-image"}}).css('padding', '7px');
                                                $(prototype_widget + " input[type='radio']").iCheck({
                                                    handle: 'radio',
                                                    radioClass: 'iradio_square-blue'
                                                });
                                                $(prototype_widget + " input[type='checkbox']").iCheck({
                                                    handle: 'checkbox',
                                                    checkboxClass: 'icheckbox_square-blue'
                                                });
                                                // multiselect
                                                $(prototype_widget + " select.pi_simpleselect").multiselect({
                                                    multiple: false,
                                                    header: true,
                                                    noneSelectedText: "<?php 
        echo $this->translator->trans('pi.form.label.select.choose.option');
        ?>
",
                                                    selectedList: 1,
                                                    selectedText: function(numChecked, numTotal, checkedItems) {
                                                        return j_prototype_bytabs.fct_util_multiselect_text(numChecked, numTotal, checkedItems);
                                                    },
                                                    open : function() {
                                                        j_prototype_bytabs.fct_util_multiselect_open();
                                                    }
                                                }).multiselectfilter({
                                                    filter: function(e, matches) {
                                                        j_prototype_bytabs.fct_util_multiselect_filter(e, matches);
                                                    }
                                                });

                                                $(prototype_widget + " select.pi_multiselect").multiselect({
                                                    multiple: true,
                                                    header: true,
                                                    noneSelectedText: "<?php 
        echo $this->translator->trans('pi.form.label.select.choose.options');
        ?>
",
                                                    selectedText: function(numChecked, numTotal, checkedItems) {
                                                        return j_prototype_bytabs.fct_util_multiselect_text(numChecked, numTotal, checkedItems);
                                                    },
                                                    open : function() {
                                                        j_prototype_bytabs.fct_util_multiselect_open();
                                                    }
                                                }).multiselectfilter({
                                                    filter: function(e, matches) {
                                                        j_prototype_bytabs.fct_util_multiselect_filter(e, matches);
                                                    }
                                                });

                                                // http://stackoverflow.com/questions/7252633/populate-multiselect-box-using-jquery
                                                // https://drupal.org/node/1124052
                                                // jquery multiselect I don't get the values that are selected in the multiselect field when performing an AJAX callback triggered
                                                // http://www.erichynds.com/blog/jquery-ui-multiselect-widget
                                                $(prototype_widget + " select.pi_simpleselect.ajaxselect, " + prototype_widget + " select.pi_multiselect.ajaxselect").each(function(i){
                                                    var el = $(this).multiselect('disable'); //disable it initially
                                                    var _selectId = $(this).data('selectid');
                                                    $(this).data('pagination',1).data('loading', false);      

                                                    var _url_ajaxselect = $(this).data('url')
                                                    + '?pagination=1'
                                                    + '&max=' + $(this).data('max');                                            

                                                    if( _url_ajaxselect in tab_ajaxselect ) {
                                                        //console.log('tab: ' + _url_ajaxselect)
                                                        // We add options of a select element.
                                                        el.multiselect('enable');
                                                        j_prototype_bytabs.ftc_util_ajaxselect(el, tab_ajaxselect[_url_ajaxselect], _selectId, 1);
                                                        el.multiselect('refresh');
                                                        j_prototype_bytabs.ftc_util_descrypt();
                                                    } else {
                                                        $.ajax({
                                                            type: "GET",
                                                            url: $(this).data('url'),
                                                            data: {pagination:1, max:$(this).data('max')},
                                                            contentType: "application/json; charset=utf-8",
                                                            dataType: "json",
                                                            async:  false // IMPORTANT !!! nécessaire afin que l'execution attende la fin de l'éxecution de l'ajax
                                                        }).done(function(response) {
                                                            //console.log('ajax: ' + _url_ajaxselect)
                                                            // We register the response value.
                                                            tab_ajaxselect[_url_ajaxselect] = response;
                                                            // We add options of a select element.
                                                            el.multiselect('enable');
                                                            j_prototype_bytabs.ftc_util_ajaxselect(el, response, _selectId, 1);
                                                        }).complete(function(){
                                                            el.multiselect('refresh');
                                                            j_prototype_bytabs.ftc_util_descrypt();
                                                        });
                                                    }                                           
                                                });

                                                j_prototype_bytabs.ftc_util_descrypt();

                                                // date picker
                                                $(prototype_widget + " .pi_datepicker").datepicker({
                                                    changeMonth: true,
                                                    changeYear: true,
                                                    yearRange: "-71:+11",
                                                    reverseYearRange: true,
                                                    showOtherMonths: true,
                                                    showButtonPanel: true,
                                                    showAnim: "fade",  // blind fade explode puff fold
                                                    showWeek: true,
                                                    showOptions: {
                                                        direction: "up"
                                                    },
                                                    numberOfMonths: [ 1, 2 ],
                                                    buttonText: "<?php 
        echo $this->translator->trans('pi.form.label.select.choose.date');
        ?>
",
                                                    showOn: "both",
                                                    buttonImage: "/bundles/sfynxtemplate/images/icons/form/picto-calendar.png"
                                                });
                                                $(prototype_widget + " .pi_datetimepicker").datepicker({
                                                    formatDate: 'g',
                                                    buttonText: "<?php 
        echo $this->translator->trans('pi.form.label.select.choose.hour');
        ?>
",
                                                    showOn: "both",
                                                    buttonImage: "/bundles/sfynxtemplate/images/icons/form/Clock_4-64.png"
                                                });
                                                $.datepicker.setDefaults( $.datepicker.regional[ "<?php 
        echo strtolower(substr($locale, 0, 2));
        ?>
" ] );

                                                $("[class*='limited']").each(function(i){
                                                    var c = $(this).attr("class");
                                                    var from = c.indexOf("(");
                                                    var to = c.indexOf(")");
                                                    var limit = parseInt(c.substring(from+1,to));

                                                    $(this).bind("keyup keydown change",function(e){
                                                      if (this.value.length > limit) {
                                                      this.value = this.value.substring(0, limit);
                                                      }
                                                    });
                                                });
                                                j_prototype_bytabs.ftc_tinymce_editor($(prototype_widget + " .pi_editor"));
                                                j_prototype_bytabs.ftc_tinymce_editor_simple($(prototype_widget + " .pi_editor_simple"));
                                                j_prototype_bytabs.ftc_tinymce_editor_simple_easy($(prototype_widget + " .pi_editor_simple_easy"));
                                                j_prototype_bytabs.ftc_tinymce_editor_easy($(prototype_widget + " .pi_editor_easy"));


                                               /*
                                                *  ->add('media', 'entity', array(
                                                *           'class' => 'SfynxMediaBundle:Mediatheque',
                                                *           'query_builder' => function(EntityRepository $er) use ($id_media) {
                                                *               $translatableListener = $this->_container->get('gedmo.listener.translatable');
                                                *               $translatableListener->setTranslationFallback(true);
                                                *               return $er->createQueryBuilder('a')
                                                *               ->select('a')
                                                *               ->where("a.id IN (:id)")
                                                *               ->setParameter('id', $id_media)
                                                *               //->where("a.status = 'image'")
                                                *               //->andWhere("a.image IS NOT NULL")
                                                *               //->andWhere("a.enabled = 1")
                                                *               //->orderBy('a.id', 'ASC')
                                                *               ;
                                                *           },
                                                *           //'property' => 'id',
                                                *           'empty_value' => 'pi.form.label.select.choose.media',
                                                *           'multiple' => false,
                                                *           'required'  => true,
                                                *           'constraints' => array(
                                                *                   new Constraints\NotBlank(),
                                                *           ),
                                                *           "label_attr" => array(
                                                *                   "class"=> 'image_collection',
                                                *           ),
                                                *           "attr" => array(
                                                *                   "class"=>"pi_simpleselect", // ajaxselect
                                                *                   "data-url"=>$this->_container->get('sfynx.tool.route.factory')->getRoute("admin_gedmo_media_selectentity_ajax", array('type'=>'image')),
                                                *                   //"data-selectid" => $id
                                                *                   "data-max" => 40,
                                                *           ),
                                                *           'label' => "Media",
                                                *           'widget_suffix' => '<a class="button-ui-mediatheque button-ui-dialog"
                                                *                   title="Ajouter une image à la médiatheque"
                                                *                   data-title="Mediatheque"
                                                *                   data-href="'.$this->_container->get('sfynx.tool.route.factory')->getRoute("admin_gedmo_media_new", array("NoLayout"=>"false", "category"=>'', 'status'=>'image')).'"
                                                *                   data-selectid="#sfynx_mediabundle_mediatype_id"
                                                *                   data-selecttitle="#sfynx_mediabundle_mediatype_title"
                                                *                   data-insertid="#m1m_providerbundle_rubbloctype_media"
                                                *                   data-inserttype="multiselect"
                                                *                   ></a>',
                                                *   ))
                                                */
                                                $(prototype_widget + " a.button-ui-dialog").on('click', function (event) {
                                                    event.preventDefault();
                                                    var _url = $(this).data('href');
                                                    var _title = $(this).data('title');
                                                    var _selectId = $(this).data('selectid');
                                                    var _selectTitle = $(this).data('selecttitle');
                                                    var _insertId = $(this).data('insertid');
                                                    var _insertType = $(this).data('inserttype');
                                                    $('<div id="iframe-dialog" title="'+_title+'">&nbsp;</div>').html('<iframe id="modalIframeId" width="100%" height="99%" style="overflow-x: hidden; overflow-y: hidden" scrolling="no" marginWidth="0" marginHeight="0" frameBorder="0" src="'+_url+'" />').dialog({
                                                        width: 421,
                                                        height: 691,
                                                        open: function () {
                                                            $(this).find("iframe").contents().find('body').attr('scrolling', 'no');
                                                        },
                                                        beforeClose: function () {
                                                            var _id_ = $(this).find('iframe').contents().find(_selectId).val();
                                                            var _title_ = $(this).find('iframe').contents().find(_selectTitle).val();
                                                            if (_insertType == "select") {
                                                                if ( (_id_  != undefined ) && (_title_  != undefined ) ) {
                                                                    $(_insertId).append('<option value="'+_id_+'" selected="selected">'+_id_+' - '+_title_+'</option>');
                                                                }
                                                            } else if (_insertType == "multiselect") {
                                                                if ( (_id_  != undefined ) && (_title_  != undefined ) ) {
                                                                    $(_insertId).append('<option value="'+_id_+'" selected="selected">'+_id_+' - '+_title_+'</option>');
                                                                    $(_insertId).multiselect( 'refresh' );
                                                                }
                                                            } else {
                                                                if ( _id_  != undefined ) {
                                                                    $(_insertId).val(_id_);
                                                                }
                                                            }
                                                            j_prototype_bytabs.ftc_util_descrypt();
                                                        },
                                                        close: function () {
                                                            $(this).dialog("close");
                                                        }
                                                    });
                                                });

                    };

                    this.ftc_util_getMoreItems = function(container, kw, max) {
                        var _selectId = container.data('selectid');
                        container.data('pagination', container.data('pagination') + 1);

                        var _url_ajaxselect = container.data('url') 
                        + '?pagination=' + container.data('pagination')
                        + '&keyword=' + kw
                        + '&max=' + max;

                        // add spinner in checkboxes list
                        var spinner = new Spinner({className:'tempSpinner'}).spin();
                        $('.ui-multiselect-checkboxes.'+container.attr('id')).append(spinner.el);
                        $('.tempSpinner').css({
                            left:'48%',
                            'margin-top':'24px'
                        });

                        j_prototype_bytabs.ftc_util_ajaxselect_main(container, _url_ajaxselect, _selectId, kw, max, spinner, 0);
                    };

                    this.ftc_util_filterItems = function(container, kw, max) {
                        var _selectId = container.data('selectid');
                        container.data('pagination', 1);

                        var _url_ajaxselect = container.data('url')
                        + '?pagination=' + container.data('pagination')
                        + '&keyword=' + kw
                        + '&max=' + max;

                        // add spinner in checkboxes list
                        var spinner = new Spinner({className:'tempSpinner'}).spin();
                        $('.ui-multiselect-checkboxes.'+container.attr('id')).empty().append(spinner.el);
                        $('.tempSpinner').css({
                            left:'48%',
                            top:'48%'
                        });

                        j_prototype_bytabs.ftc_util_ajaxselect_main(container, _url_ajaxselect, _selectId, kw, max, spinner, 0);
                    };

                    // We add options of a select element.
                    this.ftc_util_ajaxselect_main = function(container, _url_ajaxselect, _selectId, kw, max, spinner, isEmpty) {
                        if( _url_ajaxselect in tab_ajaxselect ) {
                            if (isEmpty == 1) {
                               container.empty();
                            }
                            j_prototype_bytabs.ftc_util_ajaxselect(container, tab_ajaxselect[_url_ajaxselect], _selectId);
                            //
                            spinner.stop();
                            container.multiselect('refresh');
                            $('.ui-multiselect-checkboxes.'+container.attr('id')).find('li').show();
                            container.data('loading', false);
                            j_prototype_bytabs.ftc_util_descrypt();
                        } else {
                            $.ajax({
                                type: "GET",
                                url: container.data('url'),
                                data: {pagination: container.data('pagination'), keyword:kw, max:max},
                                contentType: "application/json; charset=utf-8",
                                dataType: "json",
                            }).done(function(response) {
                                // We register the response value.
                                tab_ajaxselect[_url_ajaxselect] = response;
                                if (isEmpty == 1) {
                                    container.empty();
                                }
                                //
                                j_prototype_bytabs.ftc_util_ajaxselect(container, response, _selectId);
                            }).complete(function(){
                                spinner.stop();
                                container.multiselect('refresh');
                                $('.ui-multiselect-checkboxes.'+container.attr('id')).find('li').show();
                                container.data('loading', false);
                                j_prototype_bytabs.ftc_util_descrypt();
                            });
                        }
                    };                    

                    // We add options of a select element.
                    this.ftc_util_ajaxselect = function(el, response, _selectId, prevent_doublon) {
                        if (response.length > 0) {
                            $.each(response, function(key, value) {
                                    if(
                                        (el.find('option[value='+value.id+']').length == 0)
                                        ||
                                        (prevent_doublon == 0)
                                    ) {
                                        var opt = $('<option />', {
                                            value: value.id,
                                            text: value.text
                                        });
                                            opt.appendTo( el );
                                    }
                                    if (_selectId instanceof Array) {
                                              _selectId.forEach(function(entry) {
                                                    if (entry == value.id) {
                                                          el.find(value.id).attr( "selected","selected")
                                                    }
                                              });
                                    } else if (_selectId == value.id) {
                                             el.find(value.id).attr( "selected","selected")
                                    }
                            });
                        }
                    };

                    this.fct_util_multiselect_text = function(numChecked, numTotal, checkedItems) {
                        var result = '';
                        var nameSelect = $(checkedItems[0]).attr('name').replace('multiselect_', '');
                        if(checkedItems.length > 3) {
                            result = numChecked + ' selected';
                        }
                        else {
                            $.each(checkedItems, function(key, value) {
                                if(key > 0 && key < checkedItems.length) { result += ', '; }
                                result += $(value).next().text();
                            });
                        }
                        $('#'+nameSelect).next('button').text(result);
                        // console.log($('#'+nameSelect).next('button').text());
                        return result;
                    };

                    this.fct_util_multiselect_open = function() {
                        var heightList,
                        // ID selecteur correspondant
                        nameSelect = $('.ui-multiselect-checkboxes:visible').find('li:last').find('input').attr('name').replace('multiselect_', '');
                        $('.ui-multiselect-checkboxes:visible').addClass(nameSelect);
                        // calcul height totale de la liste
                        $('.ui-multiselect-checkboxes:visible').on('scroll', function() {
                            heightList = 0;
                            $.each($(this).find('li'), function() {
                                heightList += $(this).height();
                            });

                            // if scroll end && items not loading, getMoreItems
                            if($(this).scrollTop() + $(this).outerHeight() + 10 > heightList && $('#'+nameSelect).data('loading') == false) {
                                var keyword = $('.ui-multiselect-filter:visible').find('input').val();
                                $('#'+nameSelect).data('loading', true);
                                j_prototype_bytabs.ftc_util_getMoreItems($('#'+nameSelect), keyword, $('#'+nameSelect).data('max'));
                            }
                        });
                    };                    

                    this.fct_util_multiselect_filter = function(e, matches) {
                        e.preventDefault();
                        var search_timeout = undefined;
                        $('.ui-multiselect-filter:visible').find('input').keyup( function () {
                            if(search_timeout != undefined) {
                                clearTimeout(search_timeout);
                            }
                            $this = this;
                            search_timeout = setTimeout(function() {
                                search_timeout = undefined;
                                keyword = $this.value;
                                $('.ui-multiselect-checkboxes').find('li').show();
                                if($(e.target).data('loading') == false && keyword != $(e.target).data('keyword')) {
                                    $(e.target).data('loading', true);
                                    $(e.target).data('keyword', keyword);
                                    j_prototype_bytabs.ftc_util_filterItems($(e.target), keyword, $(this).data('max'));
                                    $   ('.ui-multiselect-checkboxes').find('li').show();
                                } 
                            }, 2000);
                        } );
                    };

                    this.ftc_util_descrypt = function(){
                        $("[id^='ui-multiselect-']").each(function(i){
                            var string = $(this).next('span').html();
                            string = string.toString().replace(/&lt;/g, '<').replace(/&gt;/g, '>');
                            string = string.replace(/&#0*39;/g, "'");
                            string = string.replace(/&quot;/g, '"');
                            string = string.replace(/&amp;/g, '&');
                            $(this).next('span').html(string);
                            $(this).click(function() {
                                    var id = $(this).attr('id').toString().replace(/-option-(.+)/ig,'').replace('ui-multiselect-','');
                                    var string = $(this).val();
                                    string = string.toString().replace(/&amp;lt;img.*?\/&amp;gt;/ig,'');
                                    $("#"+id).next("button.ui-multiselect").html(string);
                            });
                        });

                        $("button.ui-multiselect").each(function(i){
                            var string = $(this).html();
                            if(string) {
                              string = string.toString().replace(/&lt;.*?\/&gt;/ig,'');
                              $(this).html(string);
                            }
                        });
                    };

                    this.ftc_tinymce_editor = function(idObj){
                        idObj.tinymce({
                            // Location of TinyMCE script
                            script_url : '<?php 
        echo $url_base;
        ?>
/tiny_mce_src.js',
                            // General options
                            theme : "advanced",
                            language : "<?php 
        echo strtolower(current(explode("_", $this->locale)));
        ?>
",
                            plugins : "openmanager,autolink,lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,advlist",
                            // url convertion : http://www.tinymce.com/tryit/url_conversion.php
                            relative_urls : true,
                            document_base_url: '',
                            remove_script_host : true,
                            convert_urls : true,
                            //FILE UPLOAD MODS
                            file_browser_callback: "openmanager",
                            open_manager_upload_path: "<?php 
        echo $root_upload;
        ?>
",
                            open_manager_web_path: "<?php 
        echo $root_web;
        ?>
",
                            /*SBLA 20130211*/
                            // forced_root_block : false,         // Needed for 3.x
                            // forced_root_block : '',
                            extended_valid_elements : "-p",   // suprime les <p></p>
                            force_br_newlines : true,
                            //force_p_newlines : false,
                            convert_newlines_to_brs : true,
                            //remove_linebreaks : true,
                            convert_fonts_to_spans : true,
                            // don't replace encoding character like : é to &eacutes;
                            entity_encoding : "raw",
                            // clean up the content
                            cleanup_callback : this.fct_tinymce_xhtml_transform,
                            // Theme options
                            theme_advanced_buttons1 : "fullscreen,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,formatselect,styleselect,fontselect,fontsizeselect",
                            theme_advanced_buttons2 : "code,cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,image,anchor,cleanup,help,|,insertdate,inserttime,preview,|,forecolor,backcolor",
                            theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl",
                            theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak",
                            theme_advanced_toolbar_location : "top",
                            theme_advanced_toolbar_align : "left",
                            theme_advanced_statusbar_location : "bottom",
                            theme_advanced_resizing : true,
                            // Exemple content CSS (should be your site CSS)
                            content_css : "<?php 
        echo $url_css;
        ?>
",
                            // Style formats for 'styleselect'
                            style_formats : <?php 
        echo $this->TINYMCEstyleformats();
        ?>
,
                            formats : <?php 
        echo $this->TINYMCEformats();
        ?>
,
                            font_size_classes : "<?php 
        echo $this->TINYMCEsize();
        ?>
",
                            // Drop lists for link/image/media/template dialogs
                            template_external_list_url : "<?php 
        echo $url_base;
        ?>
/plugins/lists/template_list.js",
                            external_link_list_url : "<?php 
        echo $url_base;
        ?>
/plugins/lists/link_list.js",
                            external_image_list_url : "<?php 
        echo $url_base;
        ?>
/plugins/lists/image_list.js",
                            media_external_list_url : "<?php 
        echo $url_base;
        ?>
/plugins/lists/media_list.js",
                            // count without the lenght of html balise
                            setup : function(ed) {
                                alert(JSON.stringify(ed));
                                ed.onKeyUp.add(function(ed, e) {
                                    var strip = (tinymce.activeEditor.getContent()).replace(/(<([^>]+)>)/ig,"").replace(/&[a-z]+;/ig, "");
                                    var text = strip.split(' ').length + " Mots, " +  (10000 - strip.length) + " Caractères "
                                    tinymce.DOM.setHTML(tinymce.DOM.get(tinymce.activeEditor.id + '_path_row'), text);

                                    // limit the lenght of written
                                    //if (strip.length > ("<?php 
        if ($this->container->get('Request')->get('_route') == 'gedmo_admin_social_edit') {
            ?>
"+245+"<?php 
        } else {
            ?>
"+475+"<?php 
        }
        ?>
")) {
                                    //      strip = strip.substring(0,("<?php 
        if ($this->container->get('Request')->get('_route') == 'gedmo_admin_social_edit') {
            ?>
"+245+"<?php 
        } else {
            ?>
"+475+"<?php 
        }
        ?>
"));
                                    //      tinymce.execCommand('mceSetContent',false,strip);
                                    //}
                                });
                            }
                        });
                    };

                    this.ftc_tinymce_editor_simple = function(idObj){
                        idObj.tinymce({
                            // Location of TinyMCE script
                            script_url : '<?php 
        echo $url_base;
        ?>
/tiny_mce.js',
                            // General options
                            theme : "advanced",
                            language : "<?php 
        echo strtolower(current(explode("_", $this->locale)));
        ?>
",
                            plugins : "openmanager,autolink,lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,advlist",
                            // url convertion : http://www.tinymce.com/tryit/url_conversion.php
                            relative_urls : true,
                            document_base_url: '',
                            remove_script_host : true,
                            convert_urls : true,
                            //FILE UPLOAD MODS
                            file_browser_callback: "openmanager",
                            open_manager_upload_path: "<?php 
        echo $root_upload;
        ?>
",
                            open_manager_web_path: "<?php 
        echo $root_web;
        ?>
",
                            /*SBLA 20130211*/
                            // forced_root_block : false,         // Needed for 3.x
                            // forced_root_block : '',
                            extended_valid_elements : "-p",   // suprime les <p></p>
                            force_br_newlines : true,
                            //force_p_newlines : false,
                            convert_newlines_to_brs : true,
                            //remove_linebreaks : true,
                            convert_fonts_to_spans : true,
                            // don't replace encoding character like : é to &eacutes;
                            entity_encoding : "raw",
                              // clean up the content
                            cleanup_callback : this.fct_tinymce_xhtml_transform,
                            // Theme options
                            theme_advanced_buttons1 : "fullscreen,bold,italic,underline,strikethrough,justifyleft,justifycenter,justifyright,justifyfull,bullist,numlist,hr,sub,sup,forecolor,backcolor",
                            theme_advanced_buttons2 : "removeformat,formatselect,styleselect,fontsizeselect,visualchars,outdent,indent,undo,redo",
                            theme_advanced_buttons3 : "code,link,unlink,search,replace,tablecontrols",
                            theme_advanced_buttons4 : "visualaid,insertdate,inserttime,anchor,blockquote,charmap,iespell,advhr,nonbreaking,|,insertlayer,moveforward,movebackward,absolute,|,styleprops,|acronym,del,ins,attribs,image,media",
                            theme_advanced_toolbar_location : "top",
                            theme_advanced_toolbar_align : "left",
                            theme_advanced_statusbar_location : "bottom",
                            theme_advanced_resizing : true,
                            // Exemple content CSS (should be your site CSS)
                            content_css : "<?php 
        echo $url_css;
        ?>
",
                            // Style formats for 'styleselect'
                            style_formats : <?php 
        echo $this->TINYMCEstyleformats();
        ?>
,
                            formats : <?php 
        echo $this->TINYMCEformats();
        ?>
,
                            font_size_classes : "<?php 
        echo $this->TINYMCEsize();
        ?>
",
                            // Drop lists for link/image/media/template dialogs
                            template_external_list_url : "<?php 
        echo $url_base;
        ?>
/plugins/template_list.js",
                            external_link_list_url : "<?php 
        echo $url_base;
        ?>
/plugins/lists/link_list.js",
                            external_image_list_url : "<?php 
        echo $url_base;
        ?>
/plugins/lists/image_list.js",
                            media_external_list_url : "<?php 
        echo $url_base;
        ?>
/plugins/lists/media_list.js",
                            // count without the lenght of html balise
                            setup : function(ed) {
                                ed.onKeyUp.add(function(ed, e) {
                                    var strip = (tinymce.activeEditor.getContent()).replace(/(<([^>]+)>)/ig,"").replace(/&[a-z]+;/ig, "");
                                    var text = strip.split(' ').length + " Mots, " +  (10000 - strip.length) + " Caractères "
                                    tinymce.DOM.setHTML(tinymce.DOM.get(tinymce.activeEditor.id + '_path_row'), text);

                                    // limit the lenght of written
                                    //if (strip.length > ("<?php 
        if ($this->container->get('Request')->get('_route') == 'gedmo_admin_social_edit') {
            ?>
"+245+"<?php 
        } else {
            ?>
"+475+"<?php 
        }
        ?>
")) {
                                    //      strip = strip.substring(0,("<?php 
        if ($this->container->get('Request')->get('_route') == 'gedmo_admin_social_edit') {
            ?>
"+245+"<?php 
        } else {
            ?>
"+475+"<?php 
        }
        ?>
"));
                                    //      tinymce.execCommand('mceSetContent',false,strip);
                                    //}
                                });
                            }
                        });
                    };

                    this.ftc_tinymce_editor_simple_easy = function(idObj){
                        idObj.tinymce({
                            // Location of TinyMCE script
                            script_url : '<?php 
        echo $url_base;
        ?>
/tiny_mce.js',
                            // General options
                            theme : "advanced",
                            language : "<?php 
        echo strtolower(current(explode("_", $this->locale)));
        ?>
",
                            plugins : "openmanager,autolink,lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,advlist",
                            // url convertion : http://www.tinymce.com/tryit/url_conversion.php
                            relative_urls : true,
                            document_base_url: '',
                            remove_script_host : true,
                            convert_urls : true,
                            //FILE UPLOAD MODS
                            file_browser_callback: "openmanager",
                            open_manager_upload_path: "<?php 
        echo $root_upload;
        ?>
",
                            open_manager_web_path: "<?php 
        echo $root_web;
        ?>
",
                            /*SBLA 20130211*/
                            // forced_root_block : false,         // Needed for 3.x
                            // forced_root_block : '',
                            extended_valid_elements : "-p",   // suprime les <p></p>
                            force_br_newlines : true,
                            //force_p_newlines : false,
                            convert_newlines_to_brs : true,
                            //remove_linebreaks : true,
                            convert_fonts_to_spans : true,
                            // don't replace encoding character like : é to &eacutes;
                            entity_encoding : "raw",
                            // clean up the content
                            cleanup_callback : this.fct_tinymce_xhtml_transform,
                            // Theme options
                            theme_advanced_buttons1 : "fullscreen,bold,italic,underline,strikethrough,justifyleft,justifycenter,justifyright,justifyfull,bullist,numlist,forecolor,backcolor",
                            theme_advanced_buttons2 : "removeformat,styleselect,fontsizeselect,outdent,indent,undo,redo",
                            theme_advanced_buttons3 : "code,link,unlink,search,replace,insertdate,inserttime,blockquote,charmap,image,media",
                            theme_advanced_toolbar_location : "top",
                            theme_advanced_toolbar_align : "left",
                            theme_advanced_statusbar_location : "bottom",
                            theme_advanced_resizing : true,
                            // Exemple content CSS (should be your site CSS)
                            content_css : "<?php 
        echo $url_css;
        ?>
",
                            // Style formats for 'styleselect'
                            style_formats : <?php 
        echo $this->TINYMCEstyleformats();
        ?>
,
                            formats : <?php 
        echo $this->TINYMCEformats();
        ?>
,
                            font_size_classes : "<?php 
        echo $this->TINYMCEsize();
        ?>
",
                            // Drop lists for link/image/media/template dialogs
                            template_external_list_url : "<?php 
        echo $url_base;
        ?>
/plugins/template_list.js",
                            external_link_list_url : "<?php 
        echo $url_base;
        ?>
/plugins/lists/link_list.js",
                            external_image_list_url : "<?php 
        echo $url_base;
        ?>
/plugins/lists/image_list.js",
                            media_external_list_url : "<?php 
        echo $url_base;
        ?>
/plugins/lists/media_list.js",
                            // count without the lenght of html balise
                            setup : function(ed) {
                                ed.onKeyUp.add(function(ed, e) {
                                    var strip = (tinymce.activeEditor.getContent()).replace(/(<([^>]+)>)/ig,"").replace(/&[a-z]+;/ig, "");
                                    var text = strip.split(' ').length + " Mots, " +  (10000 - strip.length) + " Caractères "
                                    tinymce.DOM.setHTML(tinymce.DOM.get(tinymce.activeEditor.id + '_path_row'), text);

                                    // limit the lenght of written
                                    //if (strip.length > ("<?php 
        if ($this->container->get('Request')->get('_route') == 'gedmo_admin_social_edit') {
            ?>
"+245+"<?php 
        } else {
            ?>
"+475+"<?php 
        }
        ?>
")) {
                                    //      strip = strip.substring(0,("<?php 
        if ($this->container->get('Request')->get('_route') == 'gedmo_admin_social_edit') {
            ?>
"+245+"<?php 
        } else {
            ?>
"+475+"<?php 
        }
        ?>
"));
                                    //      tinymce.execCommand('mceSetContent',false,strip);
                                    //}
                                });
                            }
                        });
                    };

                    this.ftc_tinymce_editor_easy = function(idObj){
                        idObj.tinymce({
                            // Location of TinyMCE script
                            script_url : '<?php 
        echo $url_base;
        ?>
/tiny_mce.js',
                            // General options
                            theme : "advanced",
                            language : "<?php 
        echo strtolower(current(explode("_", $this->locale)));
        ?>
",
                            plugins : "openmanager,autolink,lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,advlist",
                            // url convertion : http://www.tinymce.com/tryit/url_conversion.php
                            relative_urls : true,
                            document_base_url: '',
                            remove_script_host : true,
                            convert_urls : true,
                            //FILE UPLOAD MODS
                            file_browser_callback: "openmanager",
                            open_manager_upload_path: "<?php 
        echo $root_upload;
        ?>
",
                            open_manager_web_path: "<?php 
        echo $root_web;
        ?>
",
                            /*SBLA 20130211*/
                            // forced_root_block : false,         // Needed for 3.x
                            // forced_root_block : '',
                            extended_valid_elements : "-p",   // suprime les <p></p>
                            force_br_newlines : true,
                            //force_p_newlines : false,
                            convert_newlines_to_brs : true,
                            //remove_linebreaks : true,
                            convert_fonts_to_spans : true,
                            // don't replace encoding character like : é to &eacutes;
                            entity_encoding : "raw",
                            // clean up the content
                            cleanup_callback : this.fct_tinymce_xhtml_transform,
                            // Theme options
                            theme_advanced_buttons1 : "fullscreen,bold,italic,underline,strikethrough,justifyleft,justifycenter,justifyright,justifyfull,bullist,numlist,hr,sub,sup,forecolor,backcolor",
                            theme_advanced_buttons2 : "code,formatselect,styleselect,fontsizeselect,removeformat,visualchars,outdent,indent,undo,redo,image",
                            theme_advanced_buttons3 : "",
                            theme_advanced_toolbar_location : "top",
                            theme_advanced_toolbar_align : "left",
                            theme_advanced_statusbar_location : "bottom",
                            theme_advanced_resizing : true,
                            // Exemple content CSS (should be your site CSS)
                            content_css : "<?php 
        echo $url_css;
        ?>
",
                            // Style formats for 'styleselect'
                            style_formats : <?php 
        echo $this->TINYMCEstyleformats();
        ?>
,
                            formats : <?php 
        echo $this->TINYMCEformats();
        ?>
,
                            font_size_classes : "<?php 
        echo $this->TINYMCEsize();
        ?>
",
                            // Drop lists for link/image/media/template dialogs
                            template_external_list_url : "<?php 
        echo $url_base;
        ?>
/plugins/lists/template_list.js",
                            external_link_list_url : "<?php 
        echo $url_base;
        ?>
/plugins/lists/link_list.js",
                            external_image_list_url : "<?php 
        echo $url_base;
        ?>
/plugins/lists/image_list.js",
                            media_external_list_url : "<?php 
        echo $url_base;
        ?>
/plugins/lists/media_list.js",
                            // count without the lenght of html balise
                            setup : function(ed) {
                                ed.onKeyUp.add(function(ed, e) {
                                    var strip = (tinymce.activeEditor.getContent()).replace(/(<([^>]+)>)/ig,"").replace(/&[a-z]+;/ig, "");
                                    var text = strip.split(' ').length + " Mots, " +  (10000 - strip.length) + " Caractères "
                                    tinymce.DOM.setHTML(tinymce.DOM.get(tinymce.activeEditor.id + '_path_row'), text);

                                    // limit the lenght of written
                                    //if (strip.length > ("<?php 
        if ($this->container->get('Request')->get('_route') == 'gedmo_admin_social_edit') {
            ?>
"+245+"<?php 
        } else {
            ?>
"+475+"<?php 
        }
        ?>
")) {
                                    //      strip = strip.substring(0,("<?php 
        if ($this->container->get('Request')->get('_route') == 'gedmo_admin_social_edit') {
            ?>
"+245+"<?php 
        } else {
            ?>
"+475+"<?php 
        }
        ?>
"));
                                    //      tinymce.execCommand('mceSetContent',false,strip);
                                    //}
                                });
                            }
                        });
                    };
                    // This function allows to convert the entered text
                    this.fct_tinymce_xhtml_transform = function xhtml_transform(type, value) {
                        //console.log(type)
                        switch (type) {
                                case "get_from_editor":
                                        value = value.replace(/&nbsp;/ig, " ");
                                        value = value.replace(/\s/ig, " ");
                                        break;
                                case "insert_to_editor":
                                        //value = value.replace(/<p[^>]*><span[^>]*> <\/span><\/p>/g,"<p><span> </span></p>");
                                        //value = value.replace(/<p[^>]*> <\/p>/g, "<p> </p>");
                                        //value = value.replace(/<\/?[^<]+>/g,'');
                                        //value = value.replace(/<\w+>(\w+)<\/\w+>/g,'');
                                        value = value.replace(/&nbsp;/ig, " ");
                                        value = value.replace(/\s/ig, " ");
                                        break;
                                case "submit_content":
                                        break;
                                case "get_from_editor_dom":
                                        break;
                                case "insert_to_editor_dom":
                                        break;
                                case "setup_content_dom":
                                        break;
                                case "submit_content_dom":
                                        break;
                        }

                        return value;
                    },
                    // THIS FUNCTION ALLOW TO INJECT SEVERAL FIELDS IN A ACCORDION MENU.
                    // exemple : j_prototype_bytabs.ftc_accordion_form("meta_definition", "SEO", ".myform");
                    // exemple : j_prototype_bytabs.ftc_accordion_form("meta_definition", "SEO", ".myform", 'questionLi0');
                    // exemple : j_prototype_bytabs.ftc_accordion_form("meta_definition", "SEO", ".myform", 'questionLi1');
                    this.ftc_accordion_form = function(className, title, idForm, addClass){
                        var addClassBis;
                        var tabsToProcess = $(idForm+" .ui-tabs-panel");

                        if (typeof(addClass) == "undefined") { addClass = '';addClassBis = ''; }
                        else addClassBis = '.' + addClass;

                        $(tabsToProcess).each(function(indTab,tabProcessed){
                            var tabProcessedId = $(tabProcessed).attr("id");

                            if ( $("#"+tabProcessedId+" ."+className).length ==0 ) {
                                // Process next $.each()
                                return;
                            }

                            $("#"+tabProcessedId+" fieldset:first").addClass("no-accordion");
                            if ( $("#"+tabProcessedId+" .accordion-form").length == 0 ) {
                                $("<div class='accordion-form'>").insertAfter("#"+tabProcessedId+" fieldset");
                            }

                            var accordionId = "accordion_" + tabProcessedId + "_" + addClass +"_"+ className;
                            $("<fieldset id='"+accordionId+"' class='accordion'><legend>"+title+"</legend></fieldset>").appendTo("#"+tabProcessedId+" .accordion-form");
                            
                            $("#"+tabProcessedId+" "+addClassBis+" ."+className).each(function(indClass) {
                                //$(this).parent('.clearfix').detach().appendTo("#"+accordionId);
                                $(this).closest('.clearfix').detach().appendTo("#"+accordionId);
                            });
                            $('#'+accordionId+' legend').on('click', function (event, dataObject) {
                                event.preventDefault();
                                var that = $(this);
                                var newHeight = function(){
                                    var h=16;    //initial height when closed
                                    that.parent('fieldset').children('.clearfix').each(function(ind,el){
                                        h += $(el).outerHeight(true);
                                    });
                                    return (h+80)+'px';
                                };
                                if ( $(this).parent('fieldset').hasClass('open') ){
                                    $(this).parent('fieldset').removeClass('open');
                                    $(this).parent('fieldset').animate({
                                        height: '16px'
                                      }, 400, 'swing'
                                    );
                                } else {
                                    $(this).parent('fieldset').animate({
                                        height: newHeight()
                                    }, 400, 'swing', function() {
                                        $(this).addClass('open');
                                    }).siblings('fieldset').removeClass('open').animate({
                                        height: '16px'
                                      }, 400, 'swing'
                                    );
                                }
                                return false;
                            });
                        });
                    };


                    // this function allow to inject several fields in a dialog.
                    // exemple : j_prototype_bytabs.ftc_dialog_form("solution_descriptif", "Descriptif", ".myform", 400, 366, "center");
                    this.ftc_dialog_form = function(className, title, idForm, height, width, position){
                        // We inject the testimonial fields via a dialog
                        // var button     = $("<a href='#' style='margin-right:30px' class=' dialog_link_"+className+"' title='"+title+"'>"+title+"</a>").appendTo(idForm+" fieldset"); SBLA
                        var button     = $("<a href='#' style='margin-right:30px' class=' dialog_link_"+className+"' title='"+title+"'>"+title+"</a>");
                        $(idForm+" fieldset:first").append(button);
                        var form     = "form_"+className;
                        var obj_form = null;
                        var dialogId = "dialog_"+className;

                        $("<div id='"+dialogId+"' class='dialog_form' ><span id='"+form+"'></span></div>").appendTo(idForm);

                        $("."+className).each(function(index) {
                            $(this).parent().attr('style', "display:none");
                        });

                        // modal dialog init: custom buttons and a "close" callback reseting the form inside
                        var $dialog_form = $('#'+dialogId).dialog({
                            autoOpen: false,
                            modal:true,
                            height: height,
                            width: width,
                            position: position,
                            buttons: {
                                '<?php 
        echo $this->translator->trans('pi.form.tab.box.close');
        ?>
': function () {
                                    $(this).dialog('close');
                                }
                            },
                            open: function () {
                                $(this).dialog({title: title + ' form'});
                            },
                            focus: function () {
                                //j_prototype_bytabs.ftc_tinymce_editor($(".pi_editor"));
                            },
                            beforeClose: function () {
                                obj_form = $(this).children().detach();
                                obj_form.attr('style', "display:none").appendTo(idForm);
                            },
                            captionButtons: {
                                    pin: { visible: false },
                                    refresh: { visible: false },
                                    toggle: { visible: true },
                                    minimize: { visible: false },
                                    maximize: { visible: false }
                            },
                            show: 'scale',
                            hide: 'scale'
                        });

                        button.on('click', function (event) {
                            if (obj_form != null){
                                obj_form = $("#"+form).detach();
                                obj_form.appendTo($dialog_form);
                                obj_form.attr('style', "display:block");
                            } else {
                                $("."+className).each(function(index) {
                                    obj_start = $(this).parent().attr('style', "display:block");
                                    obj_start.detach().appendTo("#"+form);
                                    obj_newform = $("#"+form).detach();
                                    obj_newform.appendTo($dialog_form);
                                    obj_newform.attr('style', "display:block");
                                });
                            }

                            $dialog_form.dialog('open');
                        });
                    };

                };

                $(document).ready(function() {
                    <?php 
        foreach ($options['prototype-name'] as $key => $value) {
            ?>
                        // We run the function.
                        j_prototype_bytabs.ftc_init('<?php 
            echo $options['prototype-idForm'];
            ?>
', '<?php 
            echo $value;
            ?>
');
                    <?php 
        }
        ?>

                    $("#dialog-confirm").dialog({
                         autoOpen: false,
                         resizable: false,
                         height:140,
                         modal: true,
                         buttons: {
                             "<?php 
        echo $this->container->get('translator')->trans('pi.form.tab.box.delete');
        ?>
": function() {
                                $('#'+id_form_delete).trigger('submit');
                                $( this ).dialog( "close" );
                             },
                             "<?php 
        echo $this->container->get('translator')->trans('pi.form.tab.box.cancel');
        ?>
": function() {
                                $( this ).dialog( "close" );
                             }
                         }
                    });
                });
        <?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 class="demo-options">
                <!-- Begin options markup -->
                <div id="dialog" title="<?php 
        echo $this->translator->trans('pi.form.tab.box.title');
        ?>
">
                    <fieldset class="ui-helper-reset">
                        <label>
                            <?php 
        echo $this->translator->trans('pi.form.tab.box.click');
        ?>
                        </label>
                    </fieldset>
                </div>
                <!-- End options markup -->
            </div>

            <div id="form-error-dialog" >&nbsp;</div>

            <div id="dialog-confirm" title="<?php 
        echo $this->container->get('translator')->trans('pi.grid.action.delete.confirmation.title');
        ?>
">
                <p><span class="ui-icon ui-icon-alert" style="float: left; margin: 0 7px 20px 0;"></span>
                <?php 
        echo $this->container->get('translator')->trans('pi.grid.action.delete.confirmation.message');
        ?>
</p>
            </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, 'core/prototypebytab/');
    }
 /**
  * Sets the grid render.
  *
  * @param    $options    tableau d'options.
  * @access protected
  * @return void
  *
  * @author Etienne de Longeaux <*****@*****.**> 
  */
 protected function render($options = null)
 {
     // Options management
     if (!isset($options['grid-name']) || empty($options['grid-name'])) {
         throw ExtensionException::optionValueNotSpecified('grid-name', __CLASS__);
     }
     if (!isset($options['grid-type']) || empty($options['grid-type']) || isset($options['grid-type']) && !in_array($options['grid-type'], self::$types)) {
         throw ExtensionException::optionValueNotSpecified('grid-type', __CLASS__);
     }
     if (!isset($options['grid-paginate']) || empty($options['grid-paginate'])) {
         $options['grid-paginate'] = true;
     }
     if ($options['grid-type'] == "simple") {
         return $this->gridSimple($options);
     } elseif ($options['grid-type'] == "bootstrap") {
         return $this->gridBootstrap($options);
     }
 }
Ejemplo n.º 8
0
 /**
  * Sets the render of the lucene action.
  *
  * <code>
  *   <?xml version="1.0"?>
  *   <config>
  *         <widgets>
  *             <search>
  *                 <controller>LUCENE:search-lucene</controller>
  *                 <params>
  *                    <cachable>false</cachable>
  *                    <template>searchlucene-result.html.twig</template>
  *                    <MaxResults></MaxResults>
  *                  <lucene>
  *                      <action>renderPage</action>
  *                        <menu>searchpage</menu>
  *                        <searchBool>true</searchBool>
  *                        <searchBoolType>AND</searchBoolType>
  *                        <searchByMotif>true</searchByMotif>
  *                        <setMinPrefixLength>0</setMinPrefixLength>
  *                        <getResultSetLimit>0</getResultSetLimit>
  *                        <searchFields>
  *                            <sortField>Contents</sortField>
  *                            <sortType>SORT_STRING</sortType>
  *                            <sortOrder>SORT_ASC</sortOrder>
  *                        </searchFields>
  *                        <searchFields>
  *                            <sortField>Key</sortField>
  *                            <sortType>SORT_NUMERIC</sortType>
  *                            <sortOrder>SORT_DESC</sortOrder>
  *                        </searchFields>
  *                  </lucene>
  *                 </params>
  *             </search>
  *         </widgets>
  *   </config>
  * </code>
  * 
  * @param    $options    tableau d'options.
  * @access protected
  * @return void
  *
  * @author Etienne de Longeaux <*****@*****.**>
  */
 public function renderLucene($options = null)
 {
     $xmlConfig = $this->getConfigXml();
     $lang = $options['widget-lang'];
     $params = array();
     // if the configXml field of the widget isn't configured correctly.
     try {
         $xmlConfig = new \Zend_Config_Xml($xmlConfig);
     } catch (\Exception $e) {
         return "  \n";
     }
     // if the gedmo widget is defined correctly as a "lucene"
     if ($this->action == "lucene" && $xmlConfig->widgets->get('search') && $xmlConfig->widgets->search->get('controller') && $xmlConfig->widgets->search->get('params')) {
         $controller = $xmlConfig->widgets->search->controller;
         if ($xmlConfig->widgets->search->params->get('template')) {
             $params['template'] = $xmlConfig->widgets->search->params->template;
         } else {
             $params['template'] = "";
         }
         if ($xmlConfig->widgets->search->params->get('MaxResults')) {
             $params['MaxResults'] = $xmlConfig->widgets->search->params->MaxResults;
         } else {
             $params['MaxResults'] = 0;
         }
         if ($xmlConfig->widgets->search->params->get('lucene')) {
             $params = array_merge($params, $xmlConfig->widgets->search->params->lucene->toArray());
             $values = explode(':', $controller);
             $JQcontainer = strtoupper($values[0]);
             $JQservice = strtolower($values[1]);
             //                    print_r($this->renderCache('pi_app_admin.manager.search_lucene', $this->action, "$JQcontainer~$JQservice", $lang, $params));
             //                    krsort($params); // array_multisort
             //                    print_r($params);exit;
             if ($this->isAvailableJqueryExtension($JQcontainer, $JQservice)) {
                 $params['widget-id'] = $options['widget-id'];
                 $params['widget-lifetime'] = $options['widget-lifetime'];
                 $params['widget-cacheable'] = (int) $options['widget-cacheable'] ? true : false;
                 $params['widget-update'] = $options['widget-update'];
                 $params['widget-public'] = $options['widget-public'];
                 $params['widget-ajax'] = (int) $options['widget-ajax'] ? true : false;
                 $params['widget-sluggify'] = (int) $options['widget-sluggify'] ? true : false;
                 $params['cachable'] = (int) $options['widget-cachetemplating'] ? true : false;
                 if ($xmlConfig->widgets->gedmo->params->get('cachable')) {
                     $params['cachable'] = $xmlConfig->widgets->search->params->cachable === 'true' ? true : false;
                 }
                 if ($params['cachable']) {
                     return $this->renderCache('pi_app_admin.manager.search_lucene', $this->action, "{$JQcontainer}~{$JQservice}", $lang, $params);
                 } else {
                     return $this->renderJquery($JQcontainer, $JQservice, $lang, $params);
                 }
             }
         } else {
             throw ExtensionException::optionValueNotSpecified("gedmo navigation", __CLASS__);
         }
     } else {
         throw ExtensionException::optionValueNotSpecified("content", __CLASS__);
     }
 }
Ejemplo n.º 9
0
 /**
  * Sets the render of the Jqext action.
  *
  * <code>
  * 
  *      // Extending jQuery to insert and call tweets of a user name.
  *   <?xml version="1.0"?>
  *   <config>
  *         <widgets>
  *             <content>
  *                 <controller>TWITTER:tweets_blog</controller>
  *                 <params>
  *                     <cachable>false</cachable>
  *                    <action>rendertwitter</action>
  *                    <twitter_id>novediaGroup</twitter_id>
  *                    <template>twitter.html.twig</template>
  *                 </params>
  *             </content>
  *         </widgets>
  *   </config>
  *   
  *   // jquery extension to insert and call blog of an entity.
  *   <?xml version="1.0"?>
  *   <config>
  *         <widgets>
  *             <content>
  *                 <controller>TWITTER:tweets_blog</controller>
  *                 <params>
  *                     <cachable>false</cachable>
  *                    <action>renderblog</action>
  *                    <maxResults>15</maxResults>
  *                    <template>blog.html.twig</template>
  *                    <listenerentity>Sociallink</listenerentity>
  *                 </params>
  *             </content>
  *         </widgets>
  *   </config>
  *   
  * </code>
  * 
  * @param    $options    tableau d'options.
  * @access protected
  * @return void
  *
  * @author Etienne de Longeaux <*****@*****.**>
  */
 public function renderJqext($options = null)
 {
     $xmlConfig = $this->getConfigXml();
     $lang = $options['widget-lang'];
     $params = array();
     // if the configXml field of the widget isn't configured correctly.
     try {
         $xmlConfig = new \Zend_Config_Xml($xmlConfig);
     } catch (\Exception $e) {
         return "  \n";
     }
     // if the gedmo widget is defined correctly as a "jqext"
     if ($this->action == "jqext" && $xmlConfig->widgets->get('content') && $xmlConfig->widgets->content->get('controller') && $xmlConfig->widgets->content->get('params')) {
         $controller = $xmlConfig->widgets->content->controller;
         $params = $xmlConfig->widgets->content->params->toArray();
         $values = explode(':', $controller);
         $JQcontainer = strtoupper($values[0]);
         $JQservice = strtolower($values[1]);
         if ($this->isAvailableJqueryExtension($JQcontainer, $JQservice)) {
             $params['widget-id'] = $options['widget-id'];
             $params['widget-lifetime'] = $options['widget-lifetime'];
             $params['widget-cacheable'] = (int) $options['widget-cacheable'] ? true : false;
             $params['widget-update'] = $options['widget-update'];
             $params['widget-public'] = $options['widget-public'];
             $params['widget-ajax'] = (int) $options['widget-ajax'] ? true : false;
             $params['widget-sluggify'] = (int) $options['widget-sluggify'] ? true : false;
             $params['cachable'] = (int) $options['widget-cachetemplating'] ? true : false;
             if ($xmlConfig->widgets->gedmo->params->get('cachable')) {
                 $params['cachable'] = $xmlConfig->widgets->content->params->cachable === 'true' ? true : false;
             }
             if ($params['cachable']) {
                 return $this->renderCache('pi_app_admin.manager.jqext', $this->action, "{$JQcontainer}~{$JQservice}", $lang, $params);
             } else {
                 return $this->renderJquery($JQcontainer, $JQservice, $lang, $params);
             }
         }
     } else {
         throw ExtensionException::optionValueNotSpecified("content", __CLASS__);
     }
 }
    /**
     * Default render
     *
     * @param array        $result
     * @param array        $options
     * @access private
     * @return string
     *
     * @author (c) Etienne de Longeaux <*****@*****.**>
     * @author (c) Pedro Felix <*****@*****.**>
     */
    private function widgetimportAction($result, $options = null)
    {
        // set Options
        if (isset($options['locale'])) {
            $this->locale = $options['locale'];
        }
        if (!isset($options['template']) || empty($options['template'])) {
            throw ExtensionException::optionValueNotSpecified('template', __CLASS__);
        } else {
            $template = $options['template'];
        }
        // a = floor(a/b)*b + a%b;
        $nb = count($result);
        $q = floor($nb / 3);
        $r = $nb % 3;
        $number_col_1 = $r === 0 ? $q : $q + 1;
        $number_col_2 = $r === 2 ? $q + 1 : $q;
        $number_col_3 = $q;
        $array_col_1 = null;
        $array_col_2 = null;
        $array_col_3 = null;
        $i = 1;
        if (!is_null($result)) {
            foreach ($result as $key => $value) {
                if ($i <= $number_col_1) {
                    $array_col_1[$key] = $value;
                }
                if ($i > $number_col_1 && $i <= $number_col_1 + $number_col_2) {
                    $array_col_2[$key] = $value;
                }
                if ($i > $number_col_1 + $number_col_2) {
                    $array_col_3[$key] = $value;
                }
                $i++;
            }
        }
        $response = $this->container->get('templating')->renderResponse("SfynxTemplateBundle:Template\\Widgetimport:{$template}", array('form_col_1' => $array_col_1, 'form_col_2' => $array_col_2, 'form_col_3' => $array_col_3));
        // We open the buffer.
        ob_start();
        ?>
                
                var PIimportwidget = {
                    
                    jQuery : $,
                    
                    settings : {
                        columns : '.column',
                        widgetSelector: '.widget',
                        handleSelector: '.widget-head',
                        contentSelector: '.widget-content',
                        widgetDefault : {
                            movable: true,
                            removable: true,
                            collapsible: true,
                            editable: true,
                            colorClasses : ['color-yellow', 'color-red', 'color-blue', 'color-white', 'color-orange', 'color-green']
                        },
                        widgetIndividual : {
                            intro : {
                                movable: false,
                                removable: false,
                                collapsible: false,
                                editable: false
                            }
                        }
                    },
    
                    init : function () {
                        this.addWidgetControls();
                        this.makeSortable();
                    },
                    
                    getWidgetSettings : function (id) {
                        var $ = this.jQuery,
                            settings = this.settings;
                        return (id&&settings.widgetIndividual[id]) ? $.extend({},settings.widgetDefault,settings.widgetIndividual[id]) : settings.widgetDefault;
                    },
                    
                    addWidgetControls : function () {
                        var PIimportwidget = this,
                            $ = this.jQuery,
                            settings = this.settings;
                            
                        $(settings.widgetSelector, $(settings.columns)).each(function () {
                            var thisWidgetSettings = PIimportwidget.getWidgetSettings(this.id);
                            if (thisWidgetSettings.removable) {
                                $('<a href="#" class="remove">CLOSE</a>').mousedown(function (e) {
                                    e.stopPropagation();    
                                }).click(function () {
                                    if (confirm('This widget will be removed, ok?')) {
                                        $(this).parents(settings.widgetSelector).animate({
                                            opacity: 0    
                                        },function () {
                                            $(this).wrap('<div/>').parent().slideUp(function () {
                                                $(this).remove();
                                            });
                                        });
                                    }
                                    return false;
                                }).appendTo($(settings.handleSelector, this));
                            }
                            
                            if (thisWidgetSettings.editable) {
                                $('<a href="#" class="edit">EDIT</a>').mousedown(function (e) {
                                    e.stopPropagation();    
                                }).toggle(function () {
                                    $(this).css({backgroundPosition: '-66px 0', width: '55px'})
                                        .parents(settings.widgetSelector)
                                            .find('.edit-box').show().find('input').focus();
                                    return false;
                                },function () {
                                    $(this).css({backgroundPosition: '', width: ''})
                                        .parents(settings.widgetSelector)
                                            .find('.edit-box').hide();
                                    return false;
                                }).appendTo($(settings.handleSelector,this));
                            }
                            
                            if (thisWidgetSettings.collapsible) {
                                $('<a href="#" class="collapse">COLLAPSE</a>').mousedown(function (e) {
                                    e.stopPropagation();    
                                }).toggle(function () {
                                    $(this).css({backgroundPosition: '-38px 0'})
                                        .parents(settings.widgetSelector)
                                            .find(settings.contentSelector).hide();
                                    return false;
                                },function () {
                                    $(this).css({backgroundPosition: ''})
                                        .parents(settings.widgetSelector)
                                            .find(settings.contentSelector).show();
                                    return false;
                                }).prependTo($(settings.handleSelector,this));
                            }
                        });
                        
                    },

                    makeSortable : function () {
                        var PIimportwidget = this,
                            $ = this.jQuery,
                            settings = this.settings,
                            $sortableItems = (function () {
                                var notSortable = '';
                                $(settings.widgetSelector,$(settings.columns)).each(function (i) {
                                    if (!PIimportwidget.getWidgetSettings(this.id).movable) {
                                        if (!this.id) {
                                            this.id = 'widget-no-id-' + i;
                                        }
                                        //notSortable += '#' + this.id + ',';
                                    }
                                });
                                return $('> li:not(' + notSortable + ')', settings.columns);
                            })();
                        
                        $sortableItems.find(settings.handleSelector).css({
                            cursor: 'move'
                        }).mousedown(function (e) {
                            $sortableItems.css({width:''});
                            $(this).parent().css({
                                width: $(this).parent().width() + 'px'
                            });
                        }).mouseup(function () {
                            if (!$(this).parent().hasClass('dragging')) {
                                $(this).parent().css({width:''});
                            } else {
                                $(settings.columns).sortable('disable');
                            }
                        });
    
                        $(settings.columns).sortable({
                            items: $sortableItems,
                            connectWith: $(settings.columns),
                            handle: settings.handleSelector,
                            placeholder: 'widget-placeholder',
                            forcePlaceholderSize: true,
                            revert: 300,
                            delay: 100,
                            opacity: 0.8,
                            containment: 'document',
                            start: function (e,ui) {
                                $(ui.helper).addClass('dragging');
                            },
                            stop: function (e,ui) {
                                $(ui.item).css({width:''}).removeClass('dragging');
                                $(settings.columns).sortable('enable');
                            }
                        });
                    }
                  
                };
    
                PIimportwidget.init();
        <?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 get html content
        $_content_html = $response->getContent();
        //
        if (!isset($options['noJs']) || !$options['noJs']) {
            return $this->renderScript($_content_js, $_content_html, 'cmf/widgetimport/');
        } else {
            return $this->renderScript($_content_js, $_content_html, 'cmf/widgetimport/', 'html');
        }
    }
Ejemplo n.º 11
0
    /**
     * Set progress text for Progress flash dialog.
     *
     * @param    $options    tableau d'options.
     * @access protected
     * @return void
     *
     * @author (c) Etienne de Longeaux <*****@*****.**>
     * @author (c) Pedro Felix <*****@*****.**>
     */
    protected function render($options = null)
    {
        // Options management
        if (!isset($options['id']) || empty($options['id'])) {
            throw ExtensionException::optionValueNotSpecified('id', __CLASS__);
        }
        // We open the buffer.
        ob_start();
        ?>
                jQuery(document).ready(function() {                    
                    $(".block_action_menu").css("display", 'none');
                    $(".widget_action_menu").css("display", 'none');
                    $("<?php 
        echo $options['id'];
        ?>
").click( function() {       
                        if ($(':ui-veneer').is(':visible')){
                            $("sfynx[id^='block__'] h6").css("display", 'none');
                            $(":ui-veneer").veneer( "destroy" );
                            $("sfynx[id^='block__']").off();
                            $("sfynx[id^='widget__']").off();
                        } else {
                            $(".captcha").remove();
                            // we set up the venner on all blocks
                            //$(".block_action_menu").css("display", 'inline-block');
                            //$("sfynx[id^='block__'] h6").css("display", 'block');
                            $("sfynx[id^='block__']").veneer( {disabled: true, title: "<span></span>"} );
                            $("sfynx[id^='block__'] h6").veneer( {collapsible: true, uiBorder: true, title: "WIDGET" } ).parent().css("display", 'both');
                            // we add the admin block Template to all widget
                            $("sfynx[id^='block__']").each(function(index) {
                                var id_block      = $(this).data('id');
                                var id_name_block = $(this).data("name");
                                /* Allow to draggable the block */
                                $("#ui-dialog-title-block__"+id_block+" span").html("ZONE " + id_name_block);
                            });
                            $( "sfynx[id^='block__']" )
                            .mouseenter(function() {
                                $( this ).find("h5.block_action_menu").attr("style", 'display:inline-block !important');
                            })
                            .mouseleave(function() {
                                $( this ).find("h5.block_action_menu").attr("style", 'display:none !important;');
                            });
                            $( "sfynx[id^='widget__']" )
                            .mouseenter(function() {
                                //console.log('enter')
                                $( this ).find("h6.widget_action_menu").attr("style", 'display:block !important');
                            })
                            .mouseleave(function() {
                                //console.log('out')
                                $( this ).find("h6.widget_action_menu").attr("style", 'display:none !important;');
                            });


                            /********************************
                             * copy widget action with draggable/droppable
                             ********************************/     
                            // we draggable all block
                            $("[data-drag^='dragmap_block']").draggable({ zIndex: 99999999999999999 });
                            // we set the tooltip on all titles of block actions.
                            $(".block_action_menu  [title]").tooltip({
                                  position: {
                                      track: true,
                                      my: "center bottom-20",
                                      at: "center top",
                                    }
                            });    
                            $(".widget_action_menu [title]").tooltip({
                                  position: {
                                      track: true,
                                      my: "center bottom-20",
                                      at: "center top",
                                    }
                            });
                                                 
                            var id_start_block = 0;
                            var id_end_block;
                            var id_widget;
                            $("[data-drag^='dragmap_widget']").draggable({
                                // axis: "y", // Le sortable ne s'applique que sur l'axe vertical
                                //containment: ".shoppingList", // Le drag ne peut sortir de l'élément qui contient la liste
                                //handle: ".item", // Le drag ne peut se faire que sur l'élément .item (le texte)
                                distance: 10, // Le drag ne commence qu'à partir de 10px de distance de l'élément
                                // This event is triggered when dragging starts.
                                start: function(event, ui){
                                    id_start_block = $(this).parent().parent().data('id');
                                    id_widget      = $(this).data('id');

                                    $(this).width('227px');
                                    $("[data-drag^='dragmap_block']").css('min-height', '100px');
                                    $("[data-overflow^='visible']").css("overflow","visible") ;
                                    $(".mcontentwrapper, .flexcroll").css("overflow","visible") ;

                                },
                                // This event is triggered when dragging stop.
                                stop: function(event, ui){
                                },
                                zIndex: 99999999999999999
                            });

                            $("[data-drag^='dragmap_block']").droppable({
                                // Lorsque l'on relache un élément sur un block
                                drop: function(event, ui){

                                    if (id_start_block != 0) {
                                        id_end_block = $(this).data("id");    
                                        // On supprimer l'élément de la page, le setTimeout est un fix pour IE (http://dev.jqueryui.com/ticket/4088)
                                        setTimeout(function() { ui.draggable.remove(); }, 1);                                
                                        $("#hProBar").progressbar({ 
                                            value: 100, 
                                            animationOptions: {
                                                duration: 10000
                                            }
                                        });
                                        $.ajax({
                                            url: "<?php 
        echo $this->container->get('router')->generate('admin_widget_movewidget_page');
        ?>
",
                                            data: "id_start_block=" + id_start_block + "&id_end_block=" + id_end_block + "&id_widget=" + id_widget,
                                            datatype: "json",
                                            //type: "POST",
                                            cache: false,
                                            "beforeSend": function ( xhr ) {
                                                //xhr.overrideMimeType("text/plain; charset=x-user-defined");
                                            },
                                            "statusCode": {
                                                404: function() {
                                                }
                                            }            
                                        }).done(function ( response ) {
                                            //var request = response[0].request;
                                            //alert(response);
                                            $("#hProBar").progressbar( "destroy" );
                                            window.location.href= "<?php 
        echo $this->container->get('router')->generate('public_refresh_page');
        ?>
";
                                 	    });
                                    }
                                },
                                // Lorsque l'on passe un élément au dessus d'un block
                                over: function(event, ui){
                                },
                                // Lorsque l'on quitte un block
                                out: function(event, ui){
                                }
                            });    
                        }                        
                    });
                });
        <?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/veneer/');
    }
Ejemplo n.º 12
0
 /**
  * Sets the render of the connexion action.
  *
  * <code>
  *   <?xml version="1.0"?>
  *   <config>
  *         <widgets>
  *             <user>
  *                 <controller>SfynxAuthBundle:User:_connexion_default</controller>
  *                 <params>
  *                     <template>SfynxSmoothnessBundle:Login\\Security:connexion-ajax.html.twig</template>
  *                     <referer_redirection>true</referer_redirection>
  *                 </params>
  *             </user>
  *         </widgets>
  *   </config>
  *  </code>
  * 
  * <code>  
  *  {% set widget_service_params = {"template":"SfynxSmoothnessBundle:Login@@@@@@@@Security:connexion-ajax.html.twig"} %} 
  *  {{ getService('pi_app_admin.manager.authentication').renderSource('SfynxAuthBundle:User~_connexion_default', 'fr_FR', widget_service_params)|raw }}
  * </code>
  *  
  * <code>
  *   <?xml version="1.0"?>
  *   <config>
  *         <widgets>
  *             <user>
  *                 <controller>SfynxAuthBundle:User:_reset_default</controller>
  *                 <params>
  *                     <template>SfynxSmoothnessBundle:Login\\Resetting:reset_content.html.twig</template>
  *                     <path_url_redirection>page_route_name_reset</url_redirection>
  *                 </params>
  *             </user>
  *         </widgets>
  *   </config>
  *  </code>
  *
  * <code>
  *  {% set widget_service_params = {"template":"SfynxSmoothnessBundle:Login@@@@@@@@Resetting:reset_content.html.twig", "url_redirection": path_url('page_lamelee_menuwrapper_monespace', {'locale':locale})~'#profil'} %} 
  *  {{ getService('pi_app_admin.manager.authentication').renderSource('SfynxAuthBundle:User~_reset_default', 'fr_FR', widget_service_params)|raw }}
  * </code>
  *    
  * @param    $options    tableau d'options.
  * @access protected
  * @return void
  *
  * @author Etienne de Longeaux <*****@*****.**>
  */
 public function renderConnexion($options = null)
 {
     $xmlConfig = $this->getConfigXml();
     $lang = $options['widget-lang'];
     $params = array();
     // if the configXml field of the widget isn't configured correctly.
     try {
         $xmlConfig = new \Zend_Config_Xml($xmlConfig);
     } catch (\Exception $e) {
         return "  \n";
     }
     // if the gedmo widget is defined correctly as a "lucene"
     if ($this->action == "connexion" && $xmlConfig->widgets->get('user')) {
         $controller = $xmlConfig->widgets->user->controller;
         if ($this->isAvailableAction($controller)) {
             if ($xmlConfig->widgets->user->get('params')) {
                 $params = $xmlConfig->widgets->user->params->toArray();
             } else {
                 $params = array();
             }
             $params['widget-id'] = $options['widget-id'];
             $params['widget-lifetime'] = $options['widget-lifetime'];
             $params['widget-cacheable'] = (int) $options['widget-cacheable'] ? true : false;
             $params['widget-update'] = $options['widget-update'];
             $params['widget-public'] = $options['widget-public'];
             $params['widget-ajax'] = (int) $options['widget-ajax'] ? true : false;
             $params['widget-sluggify'] = (int) $options['widget-sluggify'] ? true : false;
             return $this->renderService('pi_app_admin.manager.authentication', "{$this->entity}~{$this->method}", $lang, $params);
         } else {
             throw ExtensionException::optionValueNotSpecified("gedmo controller", __CLASS__);
         }
     } else {
         throw ExtensionException::optionValueNotSpecified("content", __CLASS__);
     }
 }
    /**
     * Set progress text for Progress flash dialog.
     *
     * @param    $options    tableau d'options.
     * @access protected
     * @return void
     *
     * @author Etienne de Longeaux <*****@*****.**>
     */
    protected function renderlistAction($options = null)
    {
        if (!isset($options['class']) || empty($options['class'])) {
            throw ExtensionException::optionValueNotSpecified('class', __CLASS__);
        }
        if (!isset($options['img-arrow']) || empty($options['img-arrow'])) {
            throw ExtensionException::optionValueNotSpecified('img-arrow', __CLASS__);
        }
        $em = $this->container->get('doctrine')->getManager();
        $locale = $this->container->get('request')->getLocale();
        $entities = $em->getRepository("SfynxAuthBundle:Langue")->getAllEnabled($locale, 'object', false);
        // if the file doesn't exist, we call an exception
        $img = "bundles/sfynxtemplate/images/arrow/" . $options['img-arrow'];
        $is_file_exist = realpath($this->container->get('kernel')->getRootDir() . '/../web/' . $img);
        if (!$is_file_exist) {
            throw ExtensionException::FileUnDefined('img', __CLASS__);
        }
        $Urlpath = $this->container->get('templating.helper.assets')->getUrl($img);
        // We open the buffer.
        ob_start();
        ?>
					<div class="clear">&nbsp;</div>
					<div class="acc-line">&nbsp;</div>
                    <a href="" class="language-subtitle">Local language</a>
                    
                    <div class="clear">&nbsp;</div>
					<div class="acc-line">&nbsp;</div>
                    <a href=""><?php 
        echo locale_get_display_name(strtolower($locale), strtolower($locale));
        ?>
</a>                    
                    
					<div class="clear">&nbsp;</div>
					<div class="acc-line">&nbsp;</div> 	
                    <a href="" class="language-subtitle"><?php 
        echo $this->container->get('translator')->trans('pi.form.label.field.other');
        ?>
</a>                    
                    
                    <?php 
        foreach ($entities as $key => $entity) {
            $url = $this->container->get('router')->generate('pi_layout_choisir_langue', array('langue' => $entity->getId()));
            if ($entity->getId() != $locale) {
                $name_language = locale_get_display_name(strtolower($entity->getId()), strtolower($locale));
                ?>
					<div class="clear">&nbsp;</div>
					<div class="acc-line">&nbsp;</div> 	
                    <a href="<?php 
                echo $url;
                ?>
"  id="lang_select_<?php 
                echo $entity->getId();
                ?>
" title="<?php 
                echo $name_language;
                ?>
"><?php 
                echo $name_language;
                ?>
</a>
                    <?php 
            }
        }
        ?>
        <?php 
        // We retrieve the contents of the buffer.
        $_content = ob_get_contents();
        // We clean the buffer.
        ob_clean();
        // We close the buffer.
        ob_end_flush();
        return $_content;
    }
 /**
  * Define semantique tree html FORMULAIRE.
  *
  * <code>
  *        {% set options_semantique = {
  *                'id': 'semantique',
  *                'entity':'Organigram',
  *                 'category':category,
  *                'action':'renderDefault',
  *                'menu': 'tree' } 
  *        %}
  *        {{ renderJquery('MENU', 'org-tree-semantique', options_semantique )|raw }}
  * </code>
  * 
  * @param    array $options
  * @access public
  * @return array
  *
  * @author Etienne de Longeaux <*****@*****.**>
  */
 public function treeMenu($options = null)
 {
     // Options management
     if (!isset($options['entity']) || empty($options['entity'])) {
         throw ExtensionException::optionValueNotSpecified('entity', __CLASS__);
     }
     if (!isset($options['category'])) {
         throw ExtensionException::optionValueNotSpecified('category', __CLASS__);
     }
     if (!isset($options['locale'])) {
         $locale = $this->container->get('request')->getLocale();
     } else {
         $locale = $options['locale'];
     }
     $Repository = $this->container->get('pi_app_gedmo.repository');
     $options['node'] = $this->container->get('request')->query->get('node');
     if (isset($options['node']) && !empty($options['node'])) {
         $node = $Repository->getRepository($options['entity'])->findNodeOr404($options['node'], $locale, 'object');
         $query = $Repository->getRepository($options['entity'])->childrenQuery($node, true);
         $nodes = $Repository->getRepository($options['entity'])->findTranslationsByQuery($locale, $query, 'object');
     } else {
         $QueryBuilder = $Repository->getRepository($options['entity'])->getRootNodesQueryBuilder();
         $QueryBuilder->andWhere('node.category = :category')->setParameter('category', $options['category']);
         $query = $QueryBuilder->getQuery();
         $nodes = $Repository->getRepository($options['entity'])->findTranslationsByQuery($locale, $query, 'object');
         $node = null;
     }
     return array('category' => $options['category'], 'node' => $node, 'childs' => $nodes);
 }
    /**
     * Set tiny accordeon with tiny lists .
     *
     * <code>
     *         // tree management
     *         $self = &$this;
     *         $self->category = $category;
     *         $self->NoLayout = $NoLayout;
     *         $self->translator = $this->container->get('translator');
     *         $options = array(
     *                 'decorate' => true,
     *                 'rootOpen' => "\n <div class='acc-section'><div class='acc-content'><ul class='acc'> \n",
     *                 'rootClose' => "\n </ul></div></div> \n",
     *                 'childOpen' => "    <li> \n",        // 'childOpen' => "    <li class='collapsed' > \n",
     *                 'childClose' => "    </li> \n",
     *                 'nodeDecorator' => function($node) use (&$self) {
     *                     
     *                     $tree   = $self->getContainer()->get('doctrine')->getManager()->getRepository($self->_entityName)->findOneById($node['id']);
     *                 
     *                     // define of all url images
     *                     $Urlpath0     = $self->get('templating.helper.assets')->getUrl('bundles/sfynxtemplate/images/icons/tree/plus.png');
     *                     $UrlpathAdd    = $self->get('templating.helper.assets')->getUrl('bundles/sfynxtemplate/images/icons/tree/add.png');
     *                     $Urlpath1     = $self->get('templating.helper.assets')->getUrl('bundles/sfynxtemplate/images/icons/tree/view.png');
     *                     $Urlpath2     = $self->get('templating.helper.assets')->getUrl('bundles/sfynxtemplate/images/icons/tree/up.png');
     *                     $Urlpath3     = $self->get('templating.helper.assets')->getUrl('bundles/sfynxtemplate/images/icons/tree/down.png');
     *                     $Urlpath4     = $self->get('templating.helper.assets')->getUrl('bundles/sfynxtemplate/images/icons/tree/remove.png');
     * 
     *                     $linkNode     = '<h3>'
     *                     . '<img src="'.$Urlpath0.'" height="21px" />&nbsp;&nbsp;&nbsp;' . str_replace('<br>', ' ', $tree->getTitle())
     *                     . '&nbsp;&nbsp;&nbsp; (node: ' .  $node['id'] . ', level : ' .  $node['lvl'] . ')'
     *                     . '</h3>';
     *                     
     *                     if ( ($node['lft'] == -1) && ($node['rgt'] == 0) )   $linkNode .= '<div class="acc-section"><div class="acc-content">';
     *                     if ( ($node['lft'] !== -1) && ($node['rgt'] !== 0) ) $linkNode .= '<div class="acc-section"><div class="acc-content">';
     *                     if ( ($node['lft'] == -1) && ($node['rgt'] !== 0) )  $linkNode .= '<div class="acc-section"><div class="acc-content">';
     *                                         
     *                     $linkAdd    = '<a href="#" class="tree-action" data-url="' . $self->generateUrl('admin_gedmo_menu_new', array("NoLayout" => true, 'category'=>$self->category, 'parent' => $node['id'])) . '" ><img src="'.$UrlpathAdd.'" title="'.$self->translator->trans('pi.add').'"  width="16" /></a>';
     *                     $linkEdit   = '<a href="#" class="tree-action" data-url="' . $self->generateUrl('admin_gedmo_menu_edit', array('id' => $node['id'], "NoLayout" => true)) . '" ><img src="'.$Urlpath1.'" title="'.$self->translator->trans('pi.edit').'"  width="16" /></a>';
     *                     $linkUp        = '<a href="' . $self->generateUrl('admin_gedmo_menu_move_up', array('id' => $node['id'], 'category'=>$self->category, 'NoLayout'=> $self->NoLayout)) . '"><img src="'.$Urlpath2.'" title="'.$self->translator->trans('pi.move-up').'" width="16" /></a>';
     *                     $linkDown     = '<a href="' . $self->generateUrl('admin_gedmo_menu_move_down', array('id' => $node['id'], 'category'=>$self->category, 'NoLayout'=> $self->NoLayout)) . '"><img src="'.$Urlpath3.'" title="'.$self->translator->trans('pi.move-down').'" width="16" /></a>';
     *                     $linkDelete    = '<a href="' . $self->generateUrl('admin_gedmo_menu_node_remove', array('id' => $node['id'], 'category'=>$self->category, 'NoLayout'=> $self->NoLayout)) . '"><img src="'.$Urlpath4.'" title="'.$self->translator->trans('pi.delete').'"  width="16" /></a>';
     *                     
     *                     $linkNode .= $linkAdd . '&nbsp;&nbsp;&nbsp;' . $linkEdit . '&nbsp;&nbsp;&nbsp;' . $linkUp . '&nbsp;&nbsp;&nbsp;' . $linkDown . '&nbsp;&nbsp;&nbsp;' . $linkDelete;
     * 
     *                     if ( ($node['lft'] == -1) && ($node['rgt'] == 0) )  $linkNode .= '</div></div>'; // if ( ($node['lft'] == -1) && ($node['rgt'] !== 0) )
     *                     if ( ($node['lft'] == -1) && ($node['rgt'] !== 0) ) $linkNode .= '</div></div>'; // if ( ($node['lft'] == -1) && ($node['rgt'] !== 0) )
     *                     return $linkNode;
     *                 }
     *         );
     *         
     *         // we repair the tree
     *         $em->getRepository("PiAppGedmoBundle:Menu")->recover();
     *         $result = $em->getRepository("PiAppGedmoBundle:Menu")->verify();
     *         
     *         $node   = $this->container->get('request')->query->get('node');
     *         if (!empty($node) ){
     *             $node  = $em->getRepository("PiAppGedmoBundle:Menu")->findNodeOr404($node, $locale,'object');
     *         } else {
     *             $node = null;
     *         }
     *         
     *         $nodes         = $em->getRepository("PiAppGedmoBundle:Menu")->getAllTree($locale, $category, 'array', false, false, $node);
     *         $tree        = $em->getRepository("PiAppGedmoBundle:Menu")->buildTree($nodes, $options); 
     * </code>
     * 
     * <code>
     *     {% initJquery 'ACCORDEON:tiny' %}
     *     
     * 	{% if tree %}
     * 		<div id="tree">
     * 		    {{ tree|raw }}
     * 		</div>
     * 	{% else %}
     * 		<div class="alert-message info"><p>There are no nodes in tree to display</p></div>
     * 	{% endif %}
     * 	
     * 	{% set options_tiny = {'id': 'acc_'} %}
     * 	{{ renderJquery('ACCORDEON', 'tiny', options_tiny )|raw }}
     * <code/>
     *
     * @param    $options    tableau d'options.
     * @access protected
     * @return void
     *
     * @author Etienne de Longeaux <*****@*****.**> 
     */
    protected function render($options = null)
    {
        /* exemple code html
         
        <ul class="acc" id="acc">
        	<li>
        		<h3>About</h3>
        		<div class="acc-section">
        			<div class="acc-content">
        				<ul class="acc" id="nested">
        					<li>
        						<h3>Nested One</h3>
        						<div class="acc-section">
        							<div class="acc-content">
        								Donec elementum lobortis lorem. Sed aliquet lacus vitae nibh. Sed ullamcorper pharetra augue. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
        							</div>
        						</div>
        					</li>
        					<li>
        						<h3>Nested Two</h3>
        						<div class="acc-section">
        							<div class="acc-content">
        								Vestibulum blandit mauris elementum mauris.
        							</div>
        						</div>
        					</li>
        					<li>
        						<h3>Nested Three</h3>
        						<div class="acc-section">
        							<div class="acc-content">
        								Morbi felis libero, porta non, sagittis ac, consectetur in, sem.
        							</div>
        						</div>
        					</li>
        				</ul>
        				This lightweight (1.2 KB) JavaScript accordion can easily be customized to integrate with any website. For more information visit <a href="http://www.leigeber.com">leigeber.com</a>.
        			</div>
        		</div>
        	</li><li>
        		<h3>Instructions</h3>
        		<div class="acc-section">
        			<div class="acc-content">
        				To initialize an accordion use the following code:<br /><br />
        				<code>
        					var accordion=new TINY.accordion.slider(&quot;accordion&quot;);<br />
        					accordion.init(&quot;accordion&quot;,&quot;h3&quot;,false,0,&quot;selected&quot;);
        				</code><br /><br />
        				You must create a new accordion object before initialization. The parameter taken by accordion.slider is the variable name used for the object. The object.init function takes 5 parameters: the id of the accordion ul, the header element tag, whether the panels should be expandable independently (optional), the index of the initially expanded section (optional) and the class for the active header (optional).
        			</div>
        		</div>
        	</li>
        	<li>
        		<h3>Licensing &amp; Support</h3>
        		<div class="acc-section">
        			<div class="acc-content">
        				This script is provided as-is with no warranty or guarantee. It is available at no cost for any project, non-commercial or commercial. Paid support is available by <a href="http://www.leigeber.com/contact/">clicking here</a>
        			</div>
        		</div>
        	</li>
        </ul>
         
         
         */
        // Options management
        if (!isset($options['id']) || empty($options['id'])) {
            throw ExtensionException::optionValueNotSpecified('id', __CLASS__);
        }
        if (!isset($options['menu']) || $options['menu'] == false) {
            $options['menu'] = false;
        }
        $Urlpath_Moins = $this->container->get('templating.helper.assets')->getUrl('bundles/sfynxtemplate/images/icons/tree/moins.png');
        $Urlpath_Plus = $this->container->get('templating.helper.assets')->getUrl('bundles/sfynxtemplate/images/icons/tree/plus.png');
        // We open the buffer.
        ob_start();
        ?>
            <?php 
        if ($options['menu']) {
            ?>
            <div class="tinyoptions">
                <a href='javascript:accordeon_tab["0"].pr(1)'>Exand All</a> | <a href='javascript:accordeon_tab["0"].pr(-1)'>Collapse All</a>
            </div>
            <?php 
        }
        ?>
       
            <script type="text/javascript">
            //<![CDATA[
                var accordeon_tab = [];
                //var array           = new Array();
                $("#tree ul.acc").each(function(index) {
                        $(this).attr('id','acc_'+index);
                        accordeon_tab[index] = 'acc_'+index;
                });
                for (Val in accordeon_tab){ 
                    //var tinyy = new TINY.accordion.slider("acc_"+Val);
                    //console.log(array[Val]);
                    //array.push(tinyy);
                    //array[Val].init('acc_'+Val,"h3",0,0);
                    var id_name = accordeon_tab[Val];            
                    accordeon_tab[Val] = new TINY.accordion.slider("accordeon_tab["+Val+"]");
                    accordeon_tab[Val].init(id_name,"h3",0,0);
                }
                //var Accordion0=new TINY.accordion.slider("Accordion0");
                //Accordion0.init("acc_0","h3",0,0);
                //var Accordion1=new TINY.accordion.slider("Accordion1");
                //Accordion1.init("acc_1","h3",0,0);        
                jQuery(document).ready(function() {
                    // preload img
                    var moins = '<?php 
        echo $Urlpath_Moins;
        ?>
';
                    var plus  = '<?php 
        echo $Urlpath_Plus;
        ?>
';
                    var choosImg = moins;
                    
                    temp1 = new Image();
                    temp2 = new Image();
                    temp1.src = moins;
                    temp2.src = plus;

                  
                });
            //]]>
            </script>
        <?php 
        // We retrieve the contents of the buffer.
        $_content = ob_get_contents();
        // We clean the buffer.
        ob_clean();
        // We close the buffer.
        ob_end_flush();
        return $_content;
    }
Ejemplo n.º 16
0
 /**
  * Return the metas of a page.
  *
  * @author Etienne de Longeaux <*****@*****.**>
  */
 public function getMetaPageFunction($lang, array $options)
 {
     // we get the param.
     if (empty($lang)) {
         $lang = $this->container->get('request')->getLocale();
     }
     $Uri = $this->container->get('request')->getUri();
     $BasePath = $this->container->get('request')->getUriForPath('');
     $author = str_replace(array('"', "'"), array("’", "’"), $this->container->getParameter('pi_app_admin.layout.meta.author'));
     $copyright = str_replace(array('"', "'"), array("’", "’"), $this->container->getParameter('pi_app_admin.layout.meta.copyright'));
     $description = str_replace(array('"', "'"), array("’", "’"), $this->container->getParameter('pi_app_admin.layout.meta.description'));
     $keywords = str_replace(array('"', "'"), array("’", "’"), $this->container->getParameter('pi_app_admin.layout.meta.keywords'));
     $og_title_add = str_replace(array('"', "'"), array("’", "’"), $this->container->getParameter('pi_app_admin.layout.meta.og_title_add'));
     $og_type = str_replace(array('"', "'"), array("’", "’"), $this->container->getParameter('pi_app_admin.layout.meta.og_type'));
     $og_image = str_replace(array('"', "'"), array("’", "’"), $this->container->getParameter('pi_app_admin.layout.meta.og_image'));
     $og_site_name = str_replace(array('"', "'"), array("’", "’"), $this->container->getParameter('pi_app_admin.layout.meta.og_site_name'));
     // if the file doesn't exist, we call an exception
     $og_image = strip_tags($this->container->get('translator')->trans($og_image));
     $is_file_exist = realpath($this->container->get('kernel')->getRootDir() . '/../web/' . $og_image);
     if (!$is_file_exist) {
         throw ExtensionException::FileUnDefined('img', __CLASS__);
     }
     $og_image = $this->container->get('templating.helper.assets')->getUrl($og_image);
     //
     if (isset($options['title']) && !empty($options['title'])) {
         $title = $options['title'];
     }
     if (isset($options['description']) && !empty($options['description'])) {
         $description = $options['description'];
     }
     if (isset($options['keywords']) && !empty($options['keywords'])) {
         $keywords = $options['keywords'];
     }
     // we get all info of a the current page.
     $options = $this->container->get('pi_app_admin.manager.page')->getPageMetaInfo($lang, $title, $description, $keywords);
     // we create the copyright link
     if (isset($copyright) && !empty($copyright)) {
         $copyright = strip_tags($this->container->get('translator')->trans($copyright));
         $metas[] = "<link rel='copyright' href=\"" . $copyright . "\"/>";
     }
     // we create all meta tags.
     $metas[] = "    <meta charset='" . $this->container->get('twig')->getCharset() . "'/>";
     $metas[] = "    <meta http-equiv='Content-Type'/>";
     $metas[] = "    <meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'/>";
     $metas[] = "    <meta name='generator' content=\"Sfynx\"/>";
     //
     if (isset($author) && !empty($author)) {
         $author = strip_tags($this->container->get('translator')->trans($author));
         $metas[] = "    <meta name='author' content=\"" . $author . "\"/>";
     }
     if (isset($options['description']) && !empty($options['description'])) {
         $metas[] = "    <meta name='description' content=\"" . $options['description'] . "\"/>";
     }
     if (isset($options['keywords']) && !empty($options['keywords'])) {
         $metas[] = "    <meta name='keywords' content=\"" . $options['keywords'] . "\"/>";
     }
     $metas[] = "    <meta property='og:url' content=\"{$Uri}\"/>";
     //
     if (isset($options['title']) && !empty($options['title'])) {
         $metas[] = "    <meta property='og:title' content=\"{$og_title_add}{$options['title']}\"/>";
     }
     if (isset($og_type) && !empty($og_type)) {
         $og_type = strip_tags($this->container->get('translator')->trans($og_type));
         $metas[] = "    <meta property='og:type' content=\"{$og_type}\"/>";
     }
     if (isset($og_image) && !empty($og_image)) {
         $og_image = strip_tags($this->container->get('translator')->trans($og_image));
         $metas[] = "    <meta property='og:image' content=\"{$BasePath}{$og_image}\"/>";
     }
     if (isset($og_site_name) && !empty($og_site_name)) {
         $og_site_name = strip_tags($this->container->get('translator')->trans($og_site_name));
         $og_site_name = str_replace('https://', '', $og_site_name);
         $og_site_name = str_replace('http://', '', $og_site_name);
         $metas[] = "    <meta property='og:site_name' content=\"{$og_site_name}\"/>";
     }
     // additions management
     $additions = $this->container->getParameter('pi_app_admin.layout.meta.additions');
     ksort($additions);
     foreach ($additions as $k => $values) {
         $metas[] = $values;
     }
     return implode(" \n", $metas);
 }
 /**
  * Define page Org html with ul/li balises.
  *
  * @param    array $options
  * @access public
  * @return string
  *
  * @author Etienne de Longeaux <*****@*****.**>
  */
 public function pageMenu()
 {
     $PageManager = $this->container->get('pi_app_admin.manager.page');
     if ($PageManager instanceof PiPageManager) {
         $htmlTree = $PageManager->getChildrenHierarchyRub();
         $htmlTree = $PageManager->setTreeWithPages($htmlTree);
         $htmlTree = $PageManager->setHomePage($htmlTree);
         $htmlTree = $PageManager->setNode($htmlTree);
         return $htmlTree;
     } else {
         throw ExtensionException::serviceUndefined('PiPageManager');
     }
 }
 /**
  * Search all page based on the query.
  *
  * <code>
  *        {% set options_searchlucene = {
  *                'action':'renderpage',
  *                'menu': 'searchpage' 
  *                'template': 'searchlucene-result.html.twig',
  *                'locale': "fr",
  *                "MaxResults":0
  *                'searchBool': "true",
  *                'searchBoolType': "AND",
  *                'searchByMotif': "true",
  *                'setMinPrefixLength': "0",
  *                'getResultSetLimit': "0",
  *                "searchFields": [
  *                                    {"sortField":"Contents","sortType":"SORT_STRING","sortOrder":"SORT_ASC"},
  *                                    {"sortField":"Key","sortType":"SORT_NUMERIC","sortOrder":"SORT_DESC"}
  *                                ]
  *                } 
  *        %}
  *        {{ renderJquery('SEARCH', 'search-lucene', options_searchlucene )|raw }}
  * </code>
  * 
  * @param    array $options
  * @access public
  * @return array
  *
  * @author Etienne de Longeaux <*****@*****.**>
  */
 public function searchpageMenu($options = null)
 {
     // Options management
     if (isset($options['locale'])) {
         $this->locale = $options['locale'];
     }
     $query = $this->container->get('request')->query->get('query_search');
     $searchManager = $this->container->get('pi_app_admin.manager.search_lucene');
     if ($searchManager instanceof PiLuceneManager) {
         return $result_searchpage = $searchManager->searchPage($query, $options, $this->locale);
     } else {
         throw ExtensionException::serviceUndefined('PiSearchLuceneManager');
     }
 }
Ejemplo n.º 19
0
    /**
     * Set wizard onglet.
     *
     * @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['tabs-urls']) || empty($options['tabs-urls']) || !is_array($options['tabs-urls'])) {
            throw ExtensionException::optionValueNotSpecified('tabs-urls', __CLASS__);
        }
        $all_url = null;
        $all_title = null;
        foreach ($options['tabs-urls'] as $key => $infos) {
            if (!isset($infos['title']) || empty($infos['title'])) {
                throw ExtensionException::optionValueNotSpecified('title', __CLASS__);
            }
            if (!isset($infos['route_name']) || empty($infos['route_name'])) {
                throw ExtensionException::optionValueNotSpecified('route_name', __CLASS__);
            }
            if (!isset($infos['params']) || empty($infos['params'])) {
                throw ExtensionException::optionValueNotSpecified('params', __CLASS__);
            }
            $all[$key]['url'] = $this->container->get('sfynx.tool.route.factory')->getRoute($infos['route_name'], $infos['params']);
            $all[$key]['title'] = $infos['title'];
        }
        // We open the buffer.
        ob_start();
        ?>
                $(document).ready(function () {
                        var tab_obj = $("#<?php 
        echo $options['id'];
        ?>
").tabs({
                        });    

                        <?php 
        if ($options['vertical'] == true) {
            ?>
                        tab_obj.addClass( "ui-tabs-vertical ui-helper-clearfix" );
                        $( "#<?php 
            echo $options['id'];
            ?>
 li" ).removeClass( "ui-corner-top" ).addClass( "ui-corner-left" );
                        <?php 
        }
        ?>
    
                });
        <?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="<?php 
        echo $options['id'];
        ?>
">
                <ul>
                    <?php 
        foreach ($all as $key => $info) {
            ?>
                        <li><a href="<?php 
            echo $info['url'];
            ?>
"><?php 
            echo $this->translator->trans($info['title']);
            ?>
</a></li>
                    <?php 
        }
        ?>
                    
                </ul>
            </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/tab/');
    }
Ejemplo n.º 20
0
 /**
  * Sets the render of the slider action.
  *
  * <code>
  *    <?xml version="1.0"?>
  *    <config>
  *        <widgets>
  *            <gedmo>
  *                <controller>PiAppGedmoBundle:Slider:slide-default</controller>
  *                <params>
  *                    <category>new</category>
  *                    <template>slide.html.twig</template>
  *                    <cachable>true</cachable>
  *                  <slider>
  *                      <action>renderDefault</action>
  *                        <menu>entity</menu>
  *                        <class>slide-class</class>
  *                        <id>flexslider</id>
  *                      <boucle_array>false</boucle_array>
  *                          <orderby_date></orderby_date>
  *                          <orderby_position>ASC</orderby_position>
  *                        <MaxResults>4</MaxResults>
  *                        <query_function>getAllAdherents</query_function>
  *                        <searchFields>
  *                          <nameField>field1</nameField>
  *                          <valueField>value1</valueField>
  *                      </searchFields>
  *                        <searchFields>
  *                          <nameField>field2</nameField>
  *                          <valueField>value2</valueField>
  *                      </searchFields>
  *                        <params>
  *                              <animation>slide</animation>
  *                            <slideDirection>horizontal</slideDirection>
  *                            <slideshow>true</slideshow>
  *                            <slideToStart>0</slideToStart>
  *                            <redirection>false</redirection>
  *                            <slideshowSpeed>6000</slideshowSpeed>
  *                            <animationDuration>800</animationDuration>
  *                            <directionNav>true</directionNav>
  *                            <pauseOnAction>true</pauseOnAction>
  *                            <pausePlay>true</pausePlay>
  *                            <controlNav>true</controlNav>
  *                        </params>
  *                  </slider>
  *                </params>
  *            </gedmo>
  *        </widgets>
  *    </config>
  * </code>
  * 
  * @param    $options    tableau d'options.
  * @access public
  * @return void
  *
  * @author Etienne de Longeaux <*****@*****.**>
  */
 public function renderSlider($options = null)
 {
     $xmlConfig = $this->getConfigXml();
     $lang = $options['widget-lang'];
     // if the configXml field of the widget isn't configured correctly.
     try {
         $xmlConfig = new \Zend_Config_Xml($xmlConfig);
     } catch (\Exception $e) {
         return "  \n";
     }
     // if the gedmo widget is defined correctly as an "organigram"
     if ($this->action == "slider" && $xmlConfig->widgets->get('gedmo') && $xmlConfig->widgets->gedmo->get('controller') && $xmlConfig->widgets->gedmo->get('params')) {
         $controller = $xmlConfig->widgets->gedmo->controller;
         if ($this->isAvailableAction($controller)) {
             if ($xmlConfig->widgets->gedmo->params->get('category')) {
                 $category = $xmlConfig->widgets->gedmo->params->category;
             } else {
                 $category = "";
             }
             if ($xmlConfig->widgets->gedmo->params->get('template')) {
                 $template = $xmlConfig->widgets->gedmo->params->template;
             } else {
                 $template = "";
             }
             $params = array();
             if ($xmlConfig->widgets->gedmo->params->get('slider')) {
                 $params = $xmlConfig->widgets->gedmo->params->slider->toArray();
                 $params['entity'] = $this->entity;
                 $params['category'] = $category;
                 $params['template'] = $template;
                 $params['widget-id'] = $options['widget-id'];
                 $params['widget-lifetime'] = $options['widget-lifetime'];
                 $params['widget-cacheable'] = (int) $options['widget-cacheable'] ? true : false;
                 $params['widget-update'] = $options['widget-update'];
                 $params['widget-public'] = $options['widget-public'];
                 $params['widget-ajax'] = (int) $options['widget-ajax'] ? true : false;
                 $params['widget-sluggify'] = (int) $options['widget-sluggify'] ? true : false;
                 $params['cachable'] = (int) $options['widget-cachetemplating'] ? true : false;
                 if ($xmlConfig->widgets->gedmo->params->get('cachable')) {
                     $params['cachable'] = $xmlConfig->widgets->gedmo->params->cachable === 'true' ? true : false;
                 }
                 if ($xmlConfig->widgets->gedmo->params->slider->get('params')) {
                     $params['params'] = $xmlConfig->widgets->gedmo->params->slider->params->toArray();
                 }
                 if (!isset($params['action']) || empty($params['action'])) {
                     $params['action'] = 'renderDefault';
                 }
                 if (!isset($params['menu']) || empty($params['menu'])) {
                     $params['menu'] = 'entity';
                 }
                 if ($params['cachable']) {
                     return $this->renderCache('pi_app_admin.manager.slider', $this->action, $this->entity . "~" . $this->method . "~" . $category, $lang, $params);
                 } else {
                     return $this->renderService('pi_app_admin.manager.slider', $this->entity . "~" . $this->method . "~" . $category, $lang, $params);
                 }
             } else {
                 throw ExtensionException::optionValueNotSpecified("params xmlConfig", __CLASS__);
             }
         } else {
             throw ExtensionException::optionValueNotSpecified("controller configuration", __CLASS__);
         }
     } else {
         throw ExtensionException::optionValueNotSpecified("gedmo", __CLASS__);
     }
 }
 /**
  * renders entities Slider
  *
  * @param array        $options
  * @access public
  * @return string
  *
  * @author Stéphan Mascarell <*****@*****.**>
  */
 public function listentitiesMenu($options = null)
 {
     if (!isset($options['listenerentity']) || empty($options['listenerentity'])) {
         throw ExtensionException::optionValueNotSpecified('listenerentity', __CLASS__);
     } else {
         $myentity = $options['listenerentity'];
     }
     $container = $this->container;
     $em = $container->get('doctrine');
     $lang = $container->get('request')->getLocale();
     $langParameter = $lang;
     $entities = $em->getRepository($myentity)->getAllEnabled($langParameter, 'object');
     $count = count($entities);
     $content = "";
     foreach ($entities as $key => $entity) {
         $itemsLeft = $count - $key;
         $endSlider = $key + 1 === $count ? true : false;
         if ($key === 0 || $key % 8 === 0) {
             $liLoopComplete = true;
             $content .= "<li>\n";
             $content .= "<center>\n";
         } else {
             $liLoopComplete = false;
         }
         if ($key === 0 || $key % 4 === 0) {
             if ($itemsLeft < 4) {
                 if ($liLoopComplete === true) {
                     $content .= "<section class='slide-line center'>\n";
                 } else {
                     $content .= "<section class='slide-line left'>\n";
                 }
             } else {
                 $content .= "<section class='slide-line'>\n";
             }
         }
         if (method_exists($entity, 'getPage') && $entity->getPage() instanceof \Sfynx\CmfBundle\Entity\Page) {
             $routeName = $entity->getPage()->getRouteName();
             $link = $container->get('sfynx.tool.route.factory')->getRoute($routeName);
             $picture = $container->get('sonata.media.twig.extension')->media($entity->getImage(), 'default_small', array('alt' => ''));
         } else {
             $link = "#";
             $picture = "";
         }
         if (method_exists($entity, 'getTitle')) {
             $title = $entity->translate($langParameter)->getTitle();
         } else {
             $title = "";
         }
         $content .= "<a href='{$link}'>\n";
         $content .= $picture;
         $content .= "<div class='infoNews'>{$title}</div>\n";
         $content .= "</a>\n";
         if (($key + 1) % 4 === 0 || $endSlider === true) {
             $content .= "</section>\n";
         }
         if (($key + 1) % 8 === 0 || $endSlider === true) {
             $content .= "</center>\n";
             $content .= "</li>\n";
         }
     }
     return $content;
 }
    /**
     * 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/');
    }
 /**
  * Define semantique tree html FORMULAIRE.
  *
  * <code>
  *        {% set options_breadcrumbe = {
  *                'entity':'Menu',
  *                 'template':'organigram-breadcrumb.html.twig',
  *                'action':'renderDefault',
  *                'menu': 'breadcrumb' } 
  *        %}
  *        {{ renderJquery('MENU', 'org-tree-breadcrumb', options_breadcrumbe )|raw }}
  * </code>
  * 
  * @param    array $options
  * @access public
  * @return array
  *
  * @author Etienne de Longeaux <*****@*****.**>
  */
 public function breadcrumbMenu($options = null)
 {
     // Options management
     if (!isset($options['entity']) || empty($options['entity'])) {
         throw ExtensionException::optionValueNotSpecified('entity', __CLASS__);
     }
     if (!isset($options['node'])) {
         throw ExtensionException::optionValueNotSpecified('node', __CLASS__);
     }
     if (!isset($options['locale'])) {
         $locale = $this->container->get('request')->getLocale();
     } else {
         $locale = $options['locale'];
     }
     $em = $this->container->get('doctrine')->getManager();
     $node = $em->getRepository($options['entity'])->findNodeOr404($options['node'], $locale, 'object');
     //$query         = $em->getRepository($options['entity'])->childrenQuery($node, true);
     //$nodes         = $em->getRepository($options['entity'])->findTranslationsByQuery($locale, $query, 'object');
     return array('node' => $node);
 }
Ejemplo n.º 24
0
 /**
  * @param    $options    tableau d'options.
  * @access protected
  * @return void
  *
  * @author Stephan Mascarell <*****@*****.**>
  * @author <Adel Oustad> <*****@*****.**>
  */
 protected function rendertwitterwithrssAction($options = null)
 {
     if (!isset($options['twitter_id']) || empty($options['twitter_id'])) {
         throw ExtensionException::optionValueNotSpecified('twitter_id', __CLASS__);
     }
     if (!isset($options['template']) || empty($options['template'])) {
         throw ExtensionException::optionValueNotSpecified('template', __CLASS__);
     }
     $template = $options['template'];
     $twitterId = isset($options['twitter_id']) ? $options['twitter_id'] : 'Novediagroup';
     $order = isset($options['order']) ? strtolower($options['order']) : "desc";
     $retrievalNumber = isset($options['retrievalNumber']) ? $options['retrievalNumber'] : 5;
     $refreshInterval = isset($options['refreshInterval']) ? $options['refreshInterval'] : 60000;
     $method_rss = isset($options['method_rss']) ? strtolower($options['method_rss']) : "lire_rss_novedia";
     $jsonUrl = "https://api.twitter.com/1/statuses/user_timeline.json?include_entities=true&include_rts=true&screen_name={$twitterId}&count={$retrievalNumber}&callback=?";
     if (method_exists($this, $method_rss)) {
         $entities_rss = $this->{$method_rss}();
     } else {
         $entities_rss = null;
     }
     $response = $this->container->get('templating')->renderResponse("SfynxTemplateBundle:Template\\Twitter:{$template}", array('jsonUrl' => $jsonUrl, "order" => $order, 'refreshInterval' => $refreshInterval, 'entities_rss' => $entities_rss));
     return $_content = $response->getContent() . " \n";
 }
Ejemplo n.º 25
0
 /**
  * Return the template content with iGoogle plugin.
  *
  * <code>
  *        {% set options_dashboard = {
  *                'action':'default',
  *                'menu': 'default',
  *                'template': 'home.html.twig',
  *                'locale': app.request.locale,
  *                'noJs' : false,
  *            }
  *        %}
  *        {{ renderJquery('TOOL', 'dashboard', options_dashboard )|raw }}
  * </code>
  *
  * @param    array $options
  * @access public
  * @return array
  *
  * @author Etienne de Longeaux <*****@*****.**>
  */
 public function defaultMenu($options = null)
 {
     if (!isset($options['template']) || empty($options['template'])) {
         throw ExtensionException::optionValueNotSpecified('template', __CLASS__);
     } else {
         $template = "SfynxTemplateBundle:Template\\Widgetimport:" . $options['template'];
     }
     $response = $this->container->get('templating')->renderResponse($template, $options);
     return $response->getContent();
 }