コード例 #1
0
    /** 
     * Body of this method almost fully duplicated the parent::displayForm()
     */
    public function displayForm($token = NULL)
    {
        global $currentIndex;
        parent::displayForm();
        if (!($obj = $this->loadObject(true))) {
            return;
        }
        ?>
        
        <script type="text/javascript">
            function loadTab(id) { 
                <?php 
        if ($obj->id) {
            ?>
                if (toload[id]) {
		          toload[id] = false;
		              $.post(
						"<?php 
            echo dirname($currentIndex);
            ?>
/ajax_ex_features.php", 
                        {
                            ajaxProductTab: id, 
                            id_product: <?php 
            echo $obj->id;
            ?>
,
							token: '<?php 
            echo Tools::getValue('token');
            ?>
',
							id_category: <?php 
            echo (int) Tools::getValue('id_category');
            ?>
                        },
						function(rep) {
						  $("#step" + id).html(rep);var languages = new Array();
						  if (id == 3)
						      populate_attrs();
						  if (id == 7) {
						      $('#addAttachment').click(function() {
								    return !$('#selectAttachment1 option:selected').remove().appendTo('#selectAttachment2');
								});
                              $('#removeAttachment').click(function() {
								    return !$('#selectAttachment2 option:selected').remove().appendTo('#selectAttachment1');
								});
						      $('#product').submit(function() {
								$('#selectAttachment1 option').each(function(i) {
								    $(this).attr("selected", "selected");
								});
						      });
		                  }
                          
                          //functional for slide of feature groups
      		              $('.header_module_toggle, .module_toggle_all').unbind('click').click(function(){
                            var id = $(this).attr('id');
                            if (id == 'all_open')
                            $('.tab_module_content').each(function(){
                            	$(this).slideDown();
                            	$('#all_open').hide();
                            	$('#all_close').show();
                            	$('.header_module_img').each(function(){
                            		$(this).attr('src', '../img/admin/less.png');
                            	});
                            });
                            else if (id == 'all_close')
                            $('.tab_module_content').each(function(){
                            	$('#all_open').show();
                            	$('#all_close').hide();
                            	$(this).slideUp();
                            	$('.header_module_img').each(function(){
                            		$(this).attr('src', '../img/admin/more.png');
                            	});
                            });
                            else {
                            if ($('#'+id+'_content').css('display') == 'none')
                            	$('#'+id+'_img').attr('src', '../img/admin/less.png');
                            else
                            	$('#'+id+'_img').attr('src', '../img/admin/more.png');
                            
                            $('#'+$(this).attr('id')+'_content').slideToggle();
                            }
                            return false;
                            });
						}
			           )
			         }
                <?php 
        }
        ?>
		      }
        </script>
        <?php 
    }