コード例 #1
0
    private function _displayForm()
    {
        $this->initClassVar();
        if (sizeof($this->errors)) {
            foreach ($this->errors as $error) {
                $this->_html .= $this->displayError($error);
            }
        }
        $menus = AdvancedTopMenuClass::getMenus($this->_cookie->id_lang, false);
        if (!sizeof($menus)) {
            $this->_html .= '<p style="text-align:center;">' . $this->l('No tab') . '</p>';
        } else {
            $this->_html .= '<div class="tabset" id="tabsetMenu">';
            foreach ($menus as $menu) {
                $this->_html .= '<a id="' . $menu['id_menu'] . '" class="tab ' . ($menu['id_menu'] == Tools::getValue('id_menu', false) ? 'sel' : '') . ' {content:\'cont_' . $menu['id_menu'] . '\'}">' . $this->getAdminOutputNameValue($menu, false) . '</a>';
            }
            $this->_html .= '</div>';
            foreach ($menus as $menu) {
                $this->_html .= '<div id="cont_' . $menu['id_menu'] . '">';
                $this->_html .= '<p>';
                $this->_html .= '<b>' . $this->getAdminOutputNameValue($menu, true, 'menu') . '</b>';
                $this->_html .= ' | ' . $this->getAdminOutputPrivacyValue($menu['privacy']);
                $this->_html .= ' | <a href="' . $this->base_config_url . '&editMenu=1&id_menu=' . $menu['id_menu'] . '"><img src="../img/admin/edit.gif" /></a>';
                $this->_html .= ' | <a href="' . $this->base_config_url . '&deleteMenu=1&id_menu=' . $menu['id_menu'] . '" onclick="return confirm(\'' . addcslashes($this->l('Delete item #'), "'") . $menu['id_menu'] . ' ?\');"><img src="../img/admin/delete.gif" /></a>';
                $this->_html .= ' | ' . $this->l('Displayed:') . ' <a href="' . $this->base_config_url . '&activeMenu=1&id_menu=' . $menu['id_menu'] . '" class="ajax_script_load"><img src="../img/admin/' . ($menu['active'] ? 'enabled' : 'disabled') . '.gif" id="imgActiveMenu' . $menu['id_menu'] . '" /></a>';
                $this->_html .= '</p>';
                $columnsWrap = AdvancedTopMenuColumnWrapClass::getMenuColumnsWrap($menu['id_menu'], $this->_cookie->id_lang, false);
                $this->_html .= '<div class="columnWrapSort">';
                if (!sizeof($columnsWrap)) {
                    $this->_html .= '<p style="text-align:center;">' . $this->l('No column') . '</p>';
                } else {
                    foreach ($columnsWrap as $columnWrap) {
                        $this->_html .= '<div class="menuColumnWrap" id="' . $columnWrap['id_wrap'] . '">';
                        $this->_html .= '<p>';
                        $this->_html .= '<img src="' . $this->_path . 'img/arrow-move.png" class="dragWrap" /><b>' . $columnWrap['internal_name'] . '</b>';
                        $this->_html .= ' | ' . $this->getAdminOutputPrivacyValue($columnWrap['privacy']);
                        if ($columnWrap['width']) {
                            $this->_html .= ' | ' . $this->l('Width:') . ' ' . $columnWrap['width'] . 'px';
                        }
                        $this->_html .= ' | <a href="' . $this->base_config_url . '&editColumnWrap=1&id_wrap=' . $columnWrap['id_wrap'] . '&id_menu=' . $menu['id_menu'] . '"><img src="../img/admin/edit.gif" /></a>';
                        $this->_html .= ' | <a href="' . $this->base_config_url . '&deleteColumnWrap=1&id_wrap=' . $columnWrap['id_wrap'] . '&id_menu=' . $menu['id_menu'] . '" onclick="return confirm(\'' . addcslashes($this->l('Delete item #'), "'") . $columnWrap['id_wrap'] . ' ?\');"><img src="../img/admin/delete.gif" /></a>';
                        $this->_html .= ' | ' . $this->l('Displayed:') . ' <a href="' . $this->base_config_url . '&activeColumnWrap=1&id_wrap=' . $columnWrap['id_wrap'] . '" class="ajax_script_load"><img src="../img/admin/' . ($columnWrap['active'] ? 'enabled' : 'disabled') . '.gif" id="imgActiveColumnWrap' . $columnWrap['id_wrap'] . '" /></a>';
                        $this->_html .= '</p>';
                        $columns = AdvancedTopMenuColumnClass::getMenuColums($columnWrap['id_wrap'], $this->_cookie->id_lang, false);
                        $this->_html .= '<div class="columnSort columnSort-' . $columnWrap['id_wrap'] . '">';
                        if (!sizeof($columns)) {
                            $this->_html .= '<p style="text-align:center;">' . $this->l('No group') . '</p>';
                        } else {
                            foreach ($columns as $column) {
                                $columnElements = AdvancedTopMenuElementsClass::getMenuColumnElements($column['id_column'], $this->_cookie->id_lang, false);
                                $this->_html .= '
                      <div class="menuColumn" id="' . $column['id_column'] . '">';
                                $this->_html .= '';
                                $this->_html .= '<img src="' . $this->_path . 'img/arrow-move.png" class="dragColumn" /><b>' . $this->getAdminOutputNameValue($column, true, 'column') . '</b>';
                                $this->_html .= ' | ' . $this->getAdminOutputPrivacyValue($column['privacy']);
                                $this->_html .= ' | <a href="' . $this->base_config_url . '&editColumn=1&id_column=' . $column['id_column'] . '&id_menu=' . $menu['id_menu'] . '"><img src="../img/admin/edit.gif" /></a>';
                                $this->_html .= ' | <a href="' . $this->base_config_url . '&deleteColumn=1&id_column=' . $column['id_column'] . '&id_menu=' . $menu['id_menu'] . '" onclick="return confirm(\'' . addcslashes($this->l('Delete item #'), "'") . $column['id_column'] . ' ?\');"><img src="../img/admin/delete.gif" /></a>';
                                $this->_html .= ' | ' . $this->l('Displayed:') . ' <a href="' . $this->base_config_url . '&activeColumn=1&id_column=' . $column['id_column'] . '" class="ajax_script_load"><img src="../img/admin/' . ($column['active'] ? 'enabled' : 'disabled') . '.gif" id="imgActiveColumn' . $column['id_column'] . '" /></a>';
                                $this->_html .= ' | <form style="display:inline;" action="' . $this->base_config_url . '" method="post"><select name="id_wrap"><option>' . $this->l('Move to Column') . '</option>';
                                foreach ($columnsWrap as $columnWrap2) {
                                    $this->_html .= '<option value="' . intval($columnWrap2['id_wrap']) . '">' . $columnWrap2['internal_name'] . '</option>';
                                }
                                $this->_html .= '</select><input type="hidden" name="id_column" value="' . intval($column['id_column']) . '" /><input type="hidden" name="id_menu" value="' . intval($menu['id_menu']) . '" /><input type="submit" value="' . $this->l('OK') . '" name="submitFastChangeColumn" class="button" /></form>';
                                $this->_html .= '<br /><br />';
                                $this->_html .= '<table cellspacing="0" cellpadding="0" class="table table_sort" style="width:100%">
                      <tbody>
                        <tr class="nodrag nodrop">
                          <th width="50">' . $this->l('ID') . '</th>
                          <th width="100">' . $this->l('Type') . '</th>
                          <th width="150">' . $this->l('Permit') . '</th>
                          <th>' . $this->l('Value') . '</th>
                          <th width="50">' . $this->l('Actions') . '</th>
                          <th width="50">' . $this->l('Displayed:') . '</th>
                        </tr>

                      ';
                                foreach ($columnElements as $columnElement) {
                                    $this->_html .= '<tr id="' . $columnElement['id_element'] . '"><td>' . intval($columnElement['id_element']) . '</td>
                  <td>' . $this->getType($columnElement['type']) . '</td>
                  <td>' . $this->getAdminOutputPrivacyValue($columnElement['privacy']) . '</td>
                  <td>' . $this->getAdminOutputNameValue($columnElement, true, 'element') . '</td>
                  <td> <a href="' . $this->base_config_url . '&editElement=1&id_element=' . $columnElement['id_element'] . '&id_menu=' . $menu['id_menu'] . '"><img src="../img/admin/edit.gif" /></a> <a href="' . $this->base_config_url . '&deleteElement=1&id_element=' . intval($columnElement['id_element']) . '&id_menu=' . $menu['id_menu'] . '" onclick="return confirm(\'' . addcslashes($this->l('Delete item #'), "'") . intval($columnElement['id_element']) . ' ?\');"><img src="../img/admin/delete.gif" /></a></td>';
                                    $this->_html .= ' <td> <a href="' . $this->base_config_url . '&activeElement=1&id_element=' . $columnElement['id_element'] . '" class="ajax_script_load"><img src="../img/admin/' . ($columnElement['active'] ? 'enabled' : 'disabled') . '.gif" id="imgActiveElement' . $columnElement['id_element'] . '" /></a></td>';
                                    $this->_html .= '</tr>';
                                }
                                $this->_html .= '</tbody>
                          </table>
                          </div>';
                            }
                        }
                        $this->_html .= '<br class="clear" /></div>';
                        $this->_html .= '
            <script stype="text/javascript">
            $( ".columnSort-' . $columnWrap['id_wrap'] . '" ).sortable({
              placeholder: "ui-state-highlight",
              delay: 300,
              handle : ".dragColumn",
              update: function(event, ui) {
                var orderColumn = $(this).sortable("toArray");
                saveOrderColumn(orderColumn.join(","));
              }
            });
            </script>';
                        $this->_html .= '</div>';
                    }
                }
                $this->_html .= '</div>';
                $this->_html .= '</div>';
            }
        }
        $this->_html .= ' <br />
                  <br />';
        $this->_html .= '<div id="wrapFormTab"><ul style="height: 30px;" id="formTab">
          <li' . (Tools::getValue('editMenu') && Tools::getValue('id_menu') ? ' class="ui-tabs-selected ui-tabs-active"' : '') . '><a href="' . $this->base_config_url . '&getMenuForm=1' . (Tools::getValue('editMenu') && Tools::getValue('id_menu') ? '&editMenu=1&id_menu=' . Tools::getValue('id_menu') : '') . '"><span><img src="' . $this->_path . 'img/menu.png" />' . (Tools::getValue('editMenu') && Tools::getValue('id_menu') ? $this->l('Edit tab') : $this->l('Add tab')) . '</span></a></li>
          <li' . (Tools::getValue('editColumnWrap') && Tools::getValue('id_wrap') ? ' class="ui-tabs-selected ui-tabs-active"' : '') . '><a href="' . $this->base_config_url . '&getColumnWrapForm=1' . (Tools::getValue('editColumnWrap') && Tools::getValue('id_wrap') ? '&editColumnWrap=1&id_wrap=' . Tools::getValue('id_wrap') : '') . '"><span><img src="' . $this->_path . 'img/column.png" />' . (Tools::getValue('editColumnWrap') && Tools::getValue('id_wrap') ? $this->l('Edit column') : $this->l('Add column')) . '</span></a></li>
          <li' . (Tools::getValue('editColumn') && Tools::getValue('id_column') ? ' class="ui-tabs-selected ui-tabs-active"' : '') . '><a href="' . $this->base_config_url . '&getColumnForm=1' . (Tools::getValue('editColumn') && Tools::getValue('id_column') ? '&editColumn=1&id_column=' . Tools::getValue('id_column') : '') . '"><span><img src="' . $this->_path . 'img/group.png" />' . (Tools::getValue('editColumn') && Tools::getValue('id_column') ? $this->l('Edit item group') : $this->l('Add item group')) . '</span></a></li>
          <li' . (Tools::getValue('editElement') && Tools::getValue('id_element') ? ' class="ui-tabs-selected ui-tabs-active"' : '') . '><a href="' . $this->base_config_url . '&getElementForm=1' . (Tools::getValue('editElement') && Tools::getValue('id_element') ? '&editElement=1&id_element=' . Tools::getValue('id_element') : '') . '"><span><img src="' . $this->_path . 'img/item.png" />' . (Tools::getValue('editElement') && Tools::getValue('id_element') ? $this->l('Edit item') : $this->l('Add item')) . '</span></a></li>
        </ul>
      </div>';
        if (Tools::getValue('editMenu') || Tools::getValue('editColumnWrap') || Tools::getValue('editColumn') || Tools::getValue('editElement')) {
            $this->_html .= '<script type="text/javascript">$(document).ready(function() {
          location.href = "' . $_SERVER['REQUEST_URI'] . '#formTab";
      });</script><br />';
        }
        $this->initColorPicker();
    }