PageRenderTime 55ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/AdminModuleMenu.php

https://github.com/clearnet/jbx_menu
PHP | 1094 lines | 1030 code | 46 blank | 18 comment | 136 complexity | ab0dd0557cc2ac9d3733103ac4d57329 MD5 | raw file

Large files files are truncated, but you can click here to view the full file

  1. <?php
  2. require_once _PS_CLASS_DIR_ . 'AdminTab.php';
  3. require_once _PS_MODULE_DIR_ . 'jbx_menu/menu.class.php';
  4. require_once _PS_MODULE_DIR_ . 'jbx_menu/jbx_menu.php';
  5. class AdminModuleMenu extends AdminTab
  6. {
  7. private $_module = 'jbx_menu';
  8. private $_modulePath = '';
  9. private $_html = '';
  10. private $_config = array(
  11. 'MENU_CATEGORIES_ZERO',
  12. 'MENU_CATEGORIES_NUM',
  13. 'MENU_LEVEL',
  14. 'MENU_WIDTH',
  15. 'MENU_INDEX',
  16. 'MENU_HEIGHT',
  17. 'MENU_MENU_COLOR',
  18. 'MENU_MENU_LIGHT',
  19. 'MENU_ITEM_COLOR',
  20. 'MENU_ITEM_HOVER_COLOR',
  21. 'MENU_ITEM_SIZE',
  22. 'MENU_TEXT_OVER_UNDERLINE',
  23. 'MENU_TEXT_OVER_ITALIC',
  24. 'MENU_TEXT_OVER_BOLD',
  25. 'MENU_TEXT_OVER_COLOR',
  26. 'MENU_TEXT_UNDERLINE',
  27. 'MENU_TEXT_ITALIC',
  28. 'MENU_TEXT_BOLD',
  29. 'MENU_TEXT_COLOR',
  30. 'MENU_TEXT_SIZE',
  31. 'MENU_TEXT_VERTICAL',
  32. 'MENU_LANG',
  33. 'MENU_SEARCH',
  34. 'MENU_BUTTON',
  35. 'MENU_COMPLETION',
  36. 'MENU_ICONS',
  37. 'MENU_HOOK',
  38. 'MENU_CACHE_ENABLE',
  39. 'MENU_STYLES_ENABLE',
  40. 'MENU_ALLOW_OPTIONS',
  41. );
  42. public function __construct() {
  43. $this->_modulePath = _PS_MODULE_DIR_ . $this->_module . DIRECTORY_SEPARATOR;
  44. //$this->_importLang();
  45. parent::__construct();
  46. }
  47. public function display() {
  48. $this->_displayHeades();
  49. $this->_displayItemsList();
  50. $this->_displayItemAdd();
  51. if ($this->_isAdmin() || (bool) Configuration::get('MENU_ALLOW_OPTIONS')) {
  52. $this->_displayOptionsForm();
  53. }
  54. echo $this->_html;
  55. }
  56. public function postProcess() {
  57. global $currentIndex;
  58. $id_menu = Tools::getValue('id_menu');
  59. Menu::forceCache();
  60. if (Tools::isSubmit('submitOptions')) {
  61. foreach ($this->_config as $key) {
  62. $key = subStr(strToLower($key), 5, strLen($key));
  63. Configuration::updateValue('MENU_' . strToUpper($key), Tools::getValue($key, 0));
  64. if ($key == 'menu_color' && Menu::haveGd()) {
  65. // LIGHT CALCUL
  66. $light = (int)Tools::getValue('menu_light', 100)-150;
  67. $img = imageCreateFromGif(_PS_MODULE_DIR_ . 'jbx_menu/gfx/menu/menu_orig.gif');
  68. Menu::colorize($img, Tools::getValue($key, '000000'), $light);
  69. imageGif($img, _PS_MODULE_DIR_ . 'jbx_menu/gfx/menu/menu.gif');
  70. imagedestroy($img);
  71. // OVER
  72. $img = imageCreateFromGif(_PS_MODULE_DIR_ . 'jbx_menu/gfx/menu/hover_orig.gif');
  73. Menu::colorize($img, Tools::getValue($key, '000000'), $light);
  74. imageGif($img, _PS_MODULE_DIR_ . 'jbx_menu/gfx/menu/hover.gif');
  75. imagedestroy($img);
  76. }
  77. }
  78. Menu::createCssCache();
  79. $this->_upload('menu');
  80. $this->_upload('hover');
  81. Tools::redirectAdmin($currentIndex.'&conf=4&token='.$this->token);
  82. }
  83. else if (Tools::isSubmit('submitItem')) {
  84. // For Edit;
  85. $id_menu = Tools::isSubmit('edit') ? intVal(Tools::getValue('id_menu')) : null;
  86. $title = Tools::getValue('title');
  87. $id_parent = intval(Tools::getValue('id_parent'));
  88. $id_category = intval(Tools::getValue('id_category'));
  89. $id_product = intval(Tools::getValue('id_product'));
  90. $id_cms = intval(Tools::getValue('id_cms'));
  91. $id_manufacturer = intval(Tools::getValue('id_manufacturer'));
  92. $id_supplier = intval(Tools::getValue('id_supplier'));
  93. $type = trim(Tools::getValue('type'));
  94. $level = intval(Tools::getValue('category_level'));
  95. $ignore = Tools::getValue('category_ignore');
  96. $link = Tools::getValue('link');
  97. $logged = Tools::getValue('logged', 0);
  98. $new_window = Tools::getValue('new_window', 0);
  99. $css = Tools::getValue('css', '');
  100. $item = new Menu($id_menu);
  101. // Spec. Position with parent ID
  102. if ($item->id_parent != $id_parent) {
  103. $reorder = array($item->id_parent, $id_parent);
  104. }
  105. $item->id_parent = $id_parent;
  106. $item->title = $title;
  107. $item->css = $css;
  108. //Tools::d($_POST);exit;
  109. $item->new_window = $new_window;
  110. $item->logged = $logged;
  111. switch ($type) {
  112. case 'category':
  113. $fieldsRequired = array('id_category'=>'isUnsignedInt');
  114. if ($this->_fieldsValidate($fieldsRequired)) {
  115. $item->id_item = $id_category;
  116. $item->type = 'category'; // $this->l('Category');
  117. $item->level = $level;
  118. $item->ignore = $ignore;
  119. $item->save();
  120. $id = $item->id;
  121. }
  122. else {
  123. $this->_errors[] = $this->l('You must enter the required fields');
  124. }
  125. break;
  126. case 'product':
  127. $fieldsRequired = array('id_product'=>'isUnsignedInt');
  128. if ($this->_fieldsValidate($fieldsRequired)) {
  129. $item->id_item = $id_product;
  130. $item->type = 'product'; // $this->l('Product');
  131. $item->save();
  132. $id = $item->id;
  133. }
  134. else {
  135. $this->_errors[] = $this->l('You must enter the required fields');
  136. }
  137. break;
  138. case 'cms':
  139. $fieldsRequired = array('id_cms'=>'isUnsignedInt');
  140. if ($this->_fieldsValidate($fieldsRequired)) {
  141. $item->id_item = $id_cms;
  142. $item->type = 'cms'; // $this->l('Cms');
  143. $item->save();
  144. $id = $item->id;
  145. }
  146. else {
  147. $this->_errors[] = $this->l('You must enter the required fields');
  148. }
  149. break;
  150. case 'manufacturers':
  151. $fieldsRequired = array('title'=>'isGenericName');
  152. if ($this->_fieldsValidate($fieldsRequired)) {
  153. $item->type = 'manufacturers'; // $this->l('Manufacturers');
  154. $item->save();
  155. $id = $item->id;
  156. }
  157. else {
  158. $this->_errors[] = $this->l('You must enter the required fields');
  159. }
  160. break;
  161. case 'manufacturer':
  162. $fieldsRequired = array('id_manufacturer'=>'isUnsignedInt');
  163. if ($this->_fieldsValidate($fieldsRequired)) {
  164. $item->id_item = $id_manufacturer;
  165. $item->type = 'manufacturer'; // $this->l('Manufacturer');
  166. $item->save();
  167. $id = $item->id;
  168. }
  169. else {
  170. $this->_errors[] = $this->l('You must enter the required fields');
  171. }
  172. break;
  173. case 'suppliers':
  174. $fieldsRequired = array('title'=>'isGenericName');
  175. if ($this->_fieldsValidate($fieldsRequired)) {
  176. $item->type = 'suppliers'; // $this->l('Suppliers');
  177. $item->save();
  178. $id = $item->id;
  179. }
  180. else {
  181. $this->_errors[] = $this->l('You must enter the required fields');
  182. }
  183. break;
  184. case 'supplier':
  185. $fieldsRequired = array('id_supplier'=>'isUnsignedInt');
  186. if ($this->_fieldsValidate($fieldsRequired)) {
  187. $item->id_item = $id_supplier;
  188. $item->type = 'supplier'; // $this->l('Supplier');
  189. $item->save();
  190. $id = $item->id;
  191. }
  192. else {
  193. $this->_errors[] = $this->l('You must enter the required fields');
  194. }
  195. break;
  196. case 'link':
  197. $fieldsRequired = array('title'=>'isGenericName', 'link'=>'isCleanHtml');
  198. if ($this->_fieldsValidate($fieldsRequired)) {
  199. $item->type = 'link'; // $this->l('Link');
  200. $item->link = $link;
  201. $item->save();
  202. $id = $item->id;
  203. }
  204. else {
  205. $this->_errors[] = $this->l('You must enter the required fields');
  206. }
  207. break;
  208. }
  209. if (isset($id)) {
  210. if (isset($reorder) && is_array($reorder) && !is_null($id_menu)) {
  211. foreach ($reorder as $id_parent) {
  212. Menu::remakePosition(intval($id_parent));
  213. }
  214. }
  215. if (($filename = $this->_getFilename($id))) {
  216. //@unlink($filename);
  217. }
  218. $this->_uploadIcon($id);
  219. Tools::redirectAdmin($currentIndex . '&conf=' . (is_null($id_menu) ? 3 : 4) . '&token=' . $this->token);
  220. }
  221. }
  222. else if (Tools::isSubmit('up')) {
  223. if (Menu::setUpPosition($id_menu)) {
  224. $this->_displayConfirmation($this->l('ok'));
  225. }
  226. else {
  227. $this->_errors[] = $this->l('Unable to up this item.');
  228. }
  229. }
  230. else if (Tools::isSubmit('down')) {
  231. if (Menu::setDownPosition($id_menu)) {
  232. $this->_displayConfirmation($this->l('ok'));
  233. }
  234. else {
  235. $this->_errors[] = $this->l('Unable to down this item.');
  236. }
  237. }
  238. else if (Tools::isSubmit('delete')) {
  239. $menu = new Menu($id_menu);
  240. $menu->delete();
  241. Tools::redirectAdmin($currentIndex . '&conf=1&token=' . $this->token);
  242. }
  243. else if (Tools::isSubmit('deleteIcon')) {
  244. $filename = $this->_getFilename($id_menu);
  245. $success = false;
  246. if ($filename) {
  247. if (@unlink($filename)) {
  248. $success = true;
  249. }
  250. }
  251. if ($success) {
  252. Tools::redirectAdmin($currentIndex . '&conf=1&token=' . $this->token);
  253. }
  254. else {
  255. $this->_errors[] = $this->l('Unable to delete this icon.');
  256. }
  257. }
  258. }
  259. private function _displayConfirmation($string) {
  260. $this->_html .= '<div class="conf confirm"><img src="../img/admin/ok.gif" /> ' . $string . '</div>';
  261. }
  262. private function _fieldsValidate($fields) {
  263. foreach ($fields as $field => $values) {
  264. if (!is_array($values)) {
  265. $values = array($field=>$values);
  266. }
  267. foreach ($values as $field => $method) {
  268. $_values = Tools::getValue($field, $method == 'isUnsignedInt' ? 0 : '');
  269. if (!is_array($_values)) {
  270. $_values = array($_values);
  271. }
  272. foreach ($_values as $value) {
  273. $return = call_user_func(array('Validate', $method), $value);
  274. if (!$return || ($method == 'isUnsignedInt' && intval(Tools::getValue($field, 0)) === 0)) {
  275. return false;
  276. }
  277. }
  278. }
  279. }
  280. return true;
  281. }
  282. private function _upload($fieldname) {
  283. $allowedTypes = array(1); // Gif
  284. $dirname = $this->_modulePath . 'gfx/menu/';
  285. if (!isset($_FILES[$fieldname])) {
  286. return;
  287. }
  288. $name = $_FILES[$fieldname]['name'];
  289. $type = $_FILES[$fieldname]['type'];
  290. $size = $_FILES[$fieldname]['size'];
  291. $erro = $_FILES[$fieldname]['error'];
  292. $tmpn = $_FILES[$fieldname]['tmp_name'];
  293. if ($erro == 4) {
  294. return;
  295. }
  296. list($width, $height, $type_num, $attr) = getimagesize($tmpn);
  297. if (file_exists($dirname) && is_dir($dirname) && is_writable($dirname)) {
  298. if(!in_array($type_num, $allowedTypes)) {
  299. $this->_errors[] = $this->l('Bad type of your icon.');
  300. return;
  301. }
  302. $ext = '.gif';
  303. return move_uploaded_file($tmpn, $dirname . $fieldname . $ext) &&
  304. copy($dirname . $fieldname . $ext, $dirname . $fieldname . '_orig' . $ext);
  305. }
  306. }
  307. private function _uploadIcon($id) {
  308. $allowedTypes = array(1, 2, 3);
  309. $dirname = $this->_modulePath . 'gfx/icons/';
  310. if (file_exists($dirname) && is_dir($dirname) && is_writable($dirname)) {
  311. $fieldname = 'icon';
  312. if (!isset($_FILES[$fieldname])) {
  313. return;
  314. }
  315. $name = $_FILES[$fieldname]['name'];
  316. $type = $_FILES[$fieldname]['type'];
  317. $size = $_FILES[$fieldname]['size'];
  318. $erro = $_FILES[$fieldname]['error'];
  319. $tmpn = $_FILES[$fieldname]['tmp_name'];
  320. list($width, $height, $type_num, $attr) = getimagesize($tmpn);
  321. if(!in_array($type_num, $allowedTypes)) {
  322. $this->_errors[] = $this->l('Bad type of your icon.');
  323. return;
  324. }
  325. $exts = array(1 => '.gif', '.jpg', '.png');
  326. $ext = $exts[$type_num];
  327. return move_uploaded_file($tmpn, $dirname . $id . $ext);
  328. }
  329. else {
  330. $this->_errors[] = $this->l('Unable to write in') . ' <b>' . $dirname . '</b>.';
  331. }
  332. }
  333. private function _displayHeades() {
  334. global $currentIndex;
  335. $this->_html .= '
  336. <link rel="stylesheet" media="screen" type="text/css" href="' . _MODULE_DIR_ . $this->_module . '/css/tab.css" />
  337. <link rel="stylesheet" media="screen" type="text/css" href="' . _MODULE_DIR_ . $this->_module . '/css/colorpicker.css" />
  338. <script type="text/javascript" src="' . _MODULE_DIR_ . $this->_module . '/js/colorpicker.js"></script>
  339. <script type="text/javascript" src="' . _MODULE_DIR_ . $this->_module . '/js/tab.js"></script>';
  340. $this->_html .= "
  341. <script type=\"text/javascript\">
  342. var txt_select_list = '" . $this->l('You must select an item from the list !', __CLASS__, true, false) . "';
  343. var txt_delete = '" . $this->l('Are you sure you want to remove this menu and its submenus ?', __CLASS__, true, false) . "';
  344. var base_dir = '" . $currentIndex . "&token=" . $this->token . "';
  345. $(document).ready(function(){
  346. addPicker('colorText', '" . Configuration::get('MENU_TEXT_COLOR') . "', 0);
  347. addPicker('colorTextOver', '" . Configuration::get('MENU_TEXT_OVER_COLOR') . "', 0);
  348. addPicker('colorMenu', '" . Configuration::get('MENU_MENU_COLOR') . "', 1);
  349. addPicker('colorItem', '" . Configuration::get('MENU_ITEM_COLOR') . "', 0);
  350. addPicker('colorItemHover', '" . Configuration::get('MENU_ITEM_HOVER_COLOR') . "', 0);
  351. });
  352. </script>";
  353. }
  354. private function _displayItemsList() {
  355. global $cookie;
  356. $this->_html .= '<h2>' . $this->l('List of items') . '</h2>';
  357. $items = Menu::getItems($cookie->id_lang);
  358. if (count($items)) {
  359. $this->_html .= '
  360. <fieldset>
  361. <legend>
  362. <img src="' . _MODULE_DIR_ . $this->_module . '/logo.gif" /> ' . $this->l('Menu') . '
  363. </legend>
  364. <div style="float:left;width:400px;">
  365. <select id="items" size="10" style="width:100%;height:285px;">';
  366. $this->_html .= $this->_showOption($items, $cookie->id_lang, 0, Tools::getValue('id_menu', 0));
  367. $this->_html .= '
  368. </select>
  369. </div>
  370. <div style="float:left;margin-left:10px;">
  371. <img src="' . _PS_ADMIN_IMG_ . '/up.gif" alt="up" class="pointer action" style="margin-top:10px;" /><br />
  372. <img src="' . _PS_ADMIN_IMG_ . '/edit.gif" alt="edit" class="pointer action" style="margin-top:100px;" /><br />
  373. <img src="' . _PS_ADMIN_IMG_ . '/delete.gif" alt="delete" class="pointer action" style="margin-top:10px;" /><br />
  374. <img src="' . _PS_ADMIN_IMG_ . '/down.gif" alt="down" class="pointer action" style="margin-top:105px;" /><br />
  375. </div>
  376. </fieldset><br />';
  377. }
  378. else {
  379. $this->_html .= '<p class="bold center">
  380. ' . $this->l('Your menu is fully empty !!!'). '
  381. </p>';
  382. }
  383. }
  384. private function _showOption($items, $id_lang, $level = 0, $itemSelected = 0, $ignoreItems = array()) {
  385. foreach ($items as $item) {
  386. $value = $item['id_menu'];
  387. if (in_array($item['id_menu'], $ignoreItems)) {
  388. continue;
  389. }
  390. $this->_html .= '<option value="' . $value . '" ' .
  391. (intVal($itemSelected) == $item['id_menu'] ? 'selected=""' : '') .
  392. ' style="padding-left: ' . ($level*15) . 'px;">' .
  393. Menu::getTitle($item['id_menu'], $id_lang) . ' (' . $this->l(ucFirst($item['type'])) . ')' .
  394. '</option>' . PHP_EOL;
  395. if (isset($item['childrens']) && count($item['childrens'])) {
  396. $this->_showOption($item['childrens'], $id_lang, $level+1, $itemSelected, $ignoreItems);
  397. }
  398. }
  399. }
  400. private function _displayItemAdd() {
  401. global $cookie, $currentIndex;
  402. $id_menu = Tools::isSubmit('edit') ? intVal(Tools::getValue('id_menu')) : 0;
  403. $menu = new Menu($id_menu);
  404. $id_lang = $cookie->id_lang;
  405. $defaultLanguage = intval(Configuration::get('PS_LANG_DEFAULT'));
  406. $iso = Language::getIsoById(intval($cookie->id_lang));
  407. $languages = Language::getLanguages();
  408. $divLangName = 'title造link';
  409. $this->_html .= '
  410. <script type="text/javascript">id_language = Number(' . $defaultLanguage . ');</script>
  411. <form action="" method="post" enctype="multipart/form-data">
  412. <fieldset>
  413. <legend>
  414. <img src="' . _MODULE_DIR_ . $this->_module . '/gfx/tab/add.gif" alt="" title="" /> ' . $this->l('Add item') . '
  415. </legend>
  416. <label for="type">' . $this->l('Type:') . '</label>
  417. <div class="margin-form">
  418. <select name="type" onchange="$(\'.case\').addClass(\'hide\');$(\'.case_\'+$(this).val()).removeClass(\'hide\');">
  419. <option value="">-- ' . $this->l('Select an item type') . ' --</option>
  420. <option value="category" ' . ($menu->type == 'category' && (Tools::isSubmit('edit')) ? 'selected=""' : '') . '>' . $this->l('Categories') . '</option>
  421. <option value="product"' . ($menu->type == 'product' && (Tools::isSubmit('edit')) ? 'selected=""' : '') . '>' . $this->l('Products') . '</option>
  422. <option value="cms"' . ($menu->type == 'cms' && (Tools::isSubmit('edit')) ? 'selected=""' : '') . '>' . $this->l('CMS') . '</option>
  423. <option value="manufacturers"' . ($menu->type == 'manufacturers' && (Tools::isSubmit('edit')) ? 'selected=""' : '') . '>' . $this->l('Manufacturers List') . '</option>
  424. <option value="manufacturer"' . ($menu->type == 'manufacturer' && (Tools::isSubmit('edit')) ? 'selected=""' : '') . '>' . $this->l('Manufacturer') . '</option>
  425. <option value="suppliers"' . ($menu->type == 'suppliers' && (Tools::isSubmit('edit')) ? 'selected=""' : '') . '>' . $this->l('Suppliers List') . '</option>
  426. <option value="supplier"' . ($menu->type == 'supplier' && (Tools::isSubmit('edit')) ? 'selected=""' : '') . '>' . $this->l('Supplier') . '</option>
  427. <option value="link"' . ($menu->type == 'link' && (Tools::isSubmit('edit')) ? 'selected=""' : '') . '>' . $this->l('Links') . '</option>
  428. </select><sup> *</sup>
  429. <!-- <p class="clear">...</p> -->
  430. </div>
  431. <label for="type">' . $this->l('Parent Item:') . '</label>
  432. <div class="margin-form">
  433. <select name="id_parent">
  434. <option value="0">-- ' . $this->l('Choose a parent item') . ' --</option>';
  435. $items = Menu::getItems($id_lang);
  436. $this->_html .= $this->_showOption($items, $id_lang, 0, $menu->id_parent, array($menu->id));
  437. $this->_html .= '
  438. </select>
  439. </div>
  440. <!-- 2010-02-22 12:40:43 -->
  441. <label for="css">' . $this->l('CSS ID:') . '</label>
  442. <div class="margin-form">
  443. <input type="text" name="css" id="css" value="' . (!is_null($menu->id) ? $menu->css : '') . '" />
  444. <p class="clear">' . $this->l('Use this option to set a CSS ID to this item.') . '</p>
  445. </div>
  446. <!-- /2010-02-22 12:40:43 -->
  447. <!-- INT -->
  448. <label for="title">' . $this->l('Title:') . '</label>
  449. <div class="margin-form">';
  450. foreach ($languages as $language) {
  451. $this->_html .= '
  452. <div id="title_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $defaultLanguage ? 'block' : 'none').'; float: left;">
  453. <input type="text" name="title['.$language['id_lang'].']" value="' . (!is_null($menu->id) ? $menu->title[$language['id_lang']] : '') .
  454. '" class="'.($language['id_lang'] != $defaultLanguage ? 'clone' : 'cloneParent').'" /><sup class="case case_link hide"> *</sup>
  455. </div>';
  456. }
  457. ob_start();
  458. $this->displayFlags($languages, $defaultLanguage, $divLangName, 'title');
  459. $this->_html .= ob_get_contents();
  460. ob_end_clean();
  461. $this->_html .= '
  462. <p class="clear">' . $this->l('If you leave the field blank, the default title will be used.') . '</p>
  463. </div>
  464. <!-- INT -->
  465. <!-- 2009-12-14 09:56:32 -->
  466. <label for="logged">' . $this->l('Must be logged:') . '</label>
  467. <div class="margin-form">
  468. <input type="checkbox" id="logged" name="logged" value="1"' . (!is_null($menu->id) && $menu->logged ? ' checked=""' : '') . '/>
  469. <p class="clear">' . $this->l('User must be logged.') . '</p>
  470. </div>
  471. <!-- /2009-12-14 09:56:32 -->
  472. <div class="case_category case ' . ($menu->type == 'category' && (Tools::isSubmit('edit')) ? '' : 'hide'). '">
  473. <label for="category_level">' . $this->l('Level:') . '</label>
  474. <div class="margin-form">
  475. <input type="text" name="category_level" id="category_level" value="' . (!is_null($menu->id) ? $menu->level : '0') .'" size="5" />
  476. <p class="clear">' . $this->l('Maximum level of unfolding, leave 0 for all.') . '</p>
  477. </div>
  478. <label for="id_category">' . $this->l('Category:') . '</label>
  479. <div class="margin-form">
  480. <select name="id_category" id="id_category" size="10">';
  481. $this->_getCategoryOption(1, $cookie->id_lang, true, (!is_null($menu->id)) ? $menu->id_item : null);
  482. $this->_html .= '
  483. </select><sup> *</sup>
  484. <p class="clear">' . $this->l('Start category') . '</p>
  485. </div>
  486. <label for="category_ignore">' . $this->l('Categories to ignore:') . '</label>
  487. <div class="margin-form">
  488. <input type="text" name="category_ignore" id="category_ignore" value="' . (!is_null($menu->id) ? $menu->ignore : '') .'" />
  489. <p class="clear">' . $this->l('Separate with comma. (id1,id2,...)') . '</p>
  490. </div>
  491. </div>
  492. <div class="case_product case ' . ($menu->type == 'product' && (Tools::isSubmit('edit')) ? '' : 'hide'). '">
  493. <label for="id_product">' . $this->l('Product ID:') . '</label>
  494. <div class="margin-form">
  495. <input type="text" name="id_product" id="id_product" size="6" />
  496. <!--
  497. <select name="id_product" id="id_product">';
  498. $this->_html .= '
  499. </select><sup> *</sup>
  500. -->
  501. </div>
  502. </div>
  503. <div class="case_cms case ' . ($menu->type == 'cms' && (Tools::isSubmit('edit')) ? '' : 'hide'). '">
  504. <label for="id_cms">' . $this->l('CMS Page:') . '</label>
  505. <div class="margin-form">
  506. <select name="id_cms" id="id_cms">';
  507. $_cms = CMS::listCms($cookie->id_lang);
  508. foreach($_cms as $cms)
  509. $this->_html .= '<option value="' . $cms['id_cms'] . '"
  510. ' . ((!is_null($menu->id) && $menu->id_item == $cms['id_cms']) ? 'selected=""' : '') . '
  511. >' .
  512. $cms['meta_title'] . '</option>';
  513. $this->_html .= '
  514. </select><sup> *</sup>
  515. </div>
  516. </div>
  517. <div class="case_manufacturer case ' . ($menu->type == 'manufacturer' && (Tools::isSubmit('edit')) ? '' : 'hide'). '">
  518. <label for="manufacturer_id">' . $this->l('Manufacturer:') . '</label>
  519. <div class="margin-form">
  520. <select name="id_manufacturer" id="id_manufacturer">';
  521. $manufacturers = Manufacturer::getManufacturers(false, $cookie->id_lang);
  522. foreach($manufacturers as $manufacturer)
  523. $this->_html .= '<option value="' . $manufacturer['id_manufacturer'] . '"
  524. ' . ((!is_null($menu->id) && $menu->id_item == $manufacturer['id_manufacturer']) ? 'selected=""' : '') . '
  525. >' . $manufacturer['name'] . '</option>';
  526. $this->_html .= '
  527. </select>
  528. </div>
  529. </div>
  530. <div class="case_supplier case ' . ($menu->type == 'supplier' && (Tools::isSubmit('edit')) ? '' : 'hide'). '">
  531. <label for="id_supplier">' . $this->l('Supplier:') . '</label>
  532. <div class="margin-form">
  533. <select name="id_supplier" id="id_supplier">';
  534. $suppliers = Supplier::getSuppliers(false, $cookie->id_lang);
  535. foreach($suppliers as $supplier)
  536. $this->_html .= '<option value="' . $supplier['id_supplier'] . '"
  537. ' . ((!is_null($menu->id) && $menu->id_item == $supplier['id_supplier']) ? 'selected=""' : '') . '
  538. >' . $supplier['name'] . '</option>';
  539. $this->_html .= '
  540. </select><sup> *</sup>
  541. </div>
  542. </div>
  543. <div class="case_link case ' . ($menu->type == 'link' && (Tools::isSubmit('edit')) ? '' : 'hide'). '">
  544. <label for="link">' . $this->l('URL:') . '</label>
  545. <div class="margin-form">';
  546. foreach ($languages as $language) {
  547. $this->_html .= '
  548. <div id="link_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $defaultLanguage ? 'block' : 'none').'; float: left;">
  549. <input type="text" name="link['.$language['id_lang'].']" value="' . (!is_null($menu->id) ? $menu->link[$language['id_lang']] : '') .
  550. '" class="'.($language['id_lang'] != $defaultLanguage ? 'clone' : 'cloneParent').'" /><sup> *</sup>
  551. </div>';
  552. }
  553. ob_start();
  554. $this->displayFlags($languages, $defaultLanguage, $divLangName, 'link');
  555. $this->_html .= ob_get_contents();
  556. ob_end_clean();
  557. $this->_html .= '
  558. <p class="clear">&nbsp;</p>
  559. </div>
  560. </div>
  561. <!-- v5.6.5 -->
  562. <label for="new_window">' . $this->l('New window:') . '</label>
  563. <div class="margin-form">
  564. <input type="checkbox" id="new_window" name="new_window" value="1"' . (!is_null($menu->id) && $menu->new_window ? ' checked=""' : '') . '/>
  565. <p class="clear">' . $this->l('On click, open link in new window.') . '</p>
  566. </div>
  567. <label for="icon">' . $this->l('Icon:') . '</label>
  568. <div class="margin-form">
  569. <input type="file" name="icon" id="icon" /><br />';
  570. $filename = $this->_getFilename($menu->id);
  571. if ($filename) {
  572. $this->_html .= '
  573. <div id="image" style="float: none; width: 100px;">
  574. <img src="' . $filename . '?refresh=' . rand(1, 10) . '" />
  575. <a href="' . $_SERVER['REQUEST_URI'] . '&deleteIcon"><img src="' . _PS_ADMIN_IMG_ . '/delete.gif" alt="" /></a>
  576. </div>';
  577. }
  578. $this->_html .= '
  579. </div>
  580. <div class="clear center">
  581. <input type="submit" name="submitItem" value="' . $this->l(' Save item ') . '" class="button" />
  582. </div>
  583. </fieldset>
  584. </form>';
  585. }
  586. private function _getFilename($id) {
  587. if (is_null($id)) {
  588. return false;
  589. }
  590. $base = '../modules/jbx_menu/gfx/icons/';
  591. $exts = array('.gif', '.jpg', '.png');
  592. foreach ($exts as $ext) {
  593. $filename = $base . $id . $ext;
  594. if (file_exists($filename)) {
  595. return $filename;
  596. }
  597. }
  598. return false;
  599. }
  600. private function _displayOptionsForm() {
  601. if (Menu::haveGd()) {
  602. $base = _MODULE_DIR_ . $this->_module . '/colorize.php?preview&color=';
  603. $bgMenu = $base . Configuration::get('MENU_MENU_COLOR') . '&light=' . Configuration::get('MENU_MENU_LIGHT');
  604. $bgMenuAlt = $base . '#COLOR#' . '&light=#LIGHT#';
  605. }
  606. else {
  607. $bgMenu = _MODULE_DIR_ . $this->_module . '/gfx/menu/menu.gif';
  608. $bgMenuAlt = $bgMenu;
  609. }
  610. $this->_html .= '<br />
  611. <form action="" method="post" enctype="multipart/form-data">
  612. <fieldset>
  613. <legend>
  614. <img src="' . _MODULE_DIR_ . $this->_module . '/gfx/tab/settings.gif" alt="" title="" /> ' . $this->l('Settings') . '
  615. </legend>
  616. <div style="margin-left:50px;overflow-x:hidden;width:845px;">
  617. <label class="clean bold">' . $this->l('Menu Background Color Preview') . '</label>
  618. <p class="center">';
  619. $this->_html .= '
  620. <img src="' . $bgMenu . '"
  621. alt="' . $bgMenuAlt . '"
  622. title="' . $this->l('Menu Background Color Preview') . '"
  623. id="menuBackgroundImage" width="100%" height="30" style="border-radius:7px;-moz-border-radius:7px;-webkit-border-radius:7px;" />';
  624. $this->_html .= '
  625. </p>
  626. </div>
  627. <div class="firstColumn left">';
  628. // $this->l('Yes'); $this->l('No');
  629. // $this->l('Show lang ?'); $this->l('Show lang menu into your menu.');
  630. //$this->_html .= $this->_displayInputRadio('Show lang ?', 'lang', Configuration::get('MENU_LANG'), 'Show lang menu into your menu.');
  631. // $this->l('Show search bar ?'); $this->l('Show search field into your menu.');
  632. $this->_html .= $this->_displayInputRadio('Show search bar ?', 'search', Configuration::get('MENU_SEARCH'), 'Show search field into your menu.');
  633. // $this->l('Show search button ?'); $this->l('Show button to run search request.');
  634. $this->_html .= $this->_displayInputRadio('Show search button ?', 'button', Configuration::get('MENU_BUTTON'), 'Show button to run search request.');
  635. // $this->l('Use auto-completion ?'); $this->l('Use auto-completion with search bar.');
  636. $this->_html .= $this->_displayInputRadio('Use auto-completion ?', 'completion', Configuration::get('MENU_COMPLETION'), 'Use auto-completion with search bar.');
  637. // $this->l('Show icons ?'); $this->l('Show image with the items of menu.');
  638. $this->_html .= $this->_displayInputRadio('Show icons ?', 'icons', Configuration::get('MENU_ICONS'), 'Show image with the items of menu.');
  639. // $this->l('Hook to Use ?'); $this->l('Choose the best method to attach your menu to your theme.');
  640. $this->_html .= $this->_displayInputRadio('Hook to Use ?', 'hook', Configuration::get('MENU_HOOK'), 'Choose the best method to attach your menu to your theme.', array('Top'=>'top', 'Menu'=>'menu'));
  641. // $this->l('Use cache ?'); $this->l('Use cache for best performances.');
  642. $this->_html .= $this->_displayInputRadio('Use cache ?', 'cache_enable', Configuration::get('MENU_CACHE_ENABLE'), 'Use cache for best performances.');
  643. // $this->l('Use styles ?'); $this->l('Use styles for non-developers');
  644. $this->_html .= $this->_displayInputRadio('Use styles ?', 'styles_enable', Configuration::get('MENU_STYLES_ENABLE'), 'Use styles for non-developers.');
  645. if ($this->_isAdmin()) {
  646. // $this->l('Allow options ?'); $this->l('Admin only. Use this for disable or enable options.');
  647. $this->_html .= $this->_displayInputRadio('Allow options ?', 'allow_options', Configuration::get('MENU_ALLOW_OPTIONS'), 'Admin only. Use this for disable or enable options.');
  648. }
  649. $this->_html .= '
  650. </div>
  651. <div class="lastColumn left">
  652. <p class="clear">
  653. <div class="columnTdLeft columnColorSelector">
  654. <label class="clean bold" for="colorText">
  655. ' . $this->l('Text') . '
  656. <img src="' . _MODULE_DIR_ . $this->_module . '/gfx/tab/help.png"
  657. alt=""
  658. title="' . $this->l('Change color to the text of items of your menu.') . '"
  659. class="help middle" />
  660. </label>
  661. </div>
  662. <div class="columnTdCenter">
  663. <div id="colorTextContener" class="colorSelector"><div style="background-color: #' . Configuration::get('MENU_TEXT_COLOR') . ';"></div></div>
  664. <input type="hidden" name="text_color" id="colorText" value="' . Configuration::get('MENU_TEXT_COLOR') . '" />
  665. </div>
  666. <div class="columnTdRight columnColorSelector default">
  667. <img src="' . _MODULE_DIR_ . $this->_module . '/gfx/tab/text_bold.png" alt="' . $this->l('B') . '" title="' . $this->l('B') . '" class="middle" />&nbsp;
  668. <input type="checkbox" name="text_bold" id="text_bold" value="1" class="pointer middle" ' . (Configuration::get('MENU_TEXT_BOLD') ? 'checked=""' : '') . ' />&nbsp;
  669. <img src="' . _MODULE_DIR_ . $this->_module . '/gfx/tab/text_italic.png" alt="' . $this->l('I') . '" title="' . $this->l('I') . '" class="middle" />&nbsp;
  670. <input type="checkbox" name="text_italic" id="text_italic" value="1" class="pointer middle" ' . (Configuration::get('MENU_TEXT_ITALIC') ? 'checked=""' : '') . ' />&nbsp
  671. <img src="' . _MODULE_DIR_ . $this->_module . '/gfx/tab/text_underline.png" alt="' . $this->l('U') . '" title="' . $this->l('U') . '" class="middle" />&nbsp;
  672. <input type="checkbox" name="text_underline" id="text_underline" value="1" class="pointer middle" ' . (Configuration::get('MENU_TEXT_UNDERLINE') ? 'checked=""' : '') . ' />&nbsp;
  673. </div>
  674. </p>
  675. <!-- 12/12/2009 11:35:44 -->
  676. <p class="clear">
  677. <div class="columnTdLeft">
  678. <label class="clean bold" for="text_size">
  679. ' . $this->l('Size of text tabs') . '
  680. <img src="' . _MODULE_DIR_ . $this->_module . '/gfx/tab/help.png"
  681. alt=""
  682. title="' . $this->l('Set a size of text of tabs.') . '"
  683. class="help middle" />
  684. </label>
  685. </div>
  686. <div class="columnTdRight">
  687. <input type="text" name="text_size" id="text_size" value="' . Configuration::get('MENU_TEXT_SIZE') . '" size="6" class="right" />
  688. <i>(' . $this->l('Default value:') . ' 12)</i>
  689. </div>
  690. </p>
  691. <p class="clear">
  692. <div class="columnTdLeft">
  693. <label class="clean bold" for="text_vertical">
  694. ' . $this->l('Vertical alignment of tabs') . '
  695. <img src="' . _MODULE_DIR_ . $this->_module . '/gfx/tab/help.png"
  696. alt=""
  697. title="' . $this->l('Set a vertical alignment of tabs.') . '"
  698. class="help middle" />
  699. </label>
  700. </div>
  701. <div class="columnTdRight">
  702. <input type="text" name="text_vertical" id="text_vertical" value="' . Configuration::get('MENU_TEXT_VERTICAL') . '" size="6" class="right" />
  703. <i>(' . $this->l('Default value:') . ' 7)</i>
  704. </div>
  705. </p>
  706. <!-- / 12/12/2009 11:35:44 -->
  707. <p class="clear">
  708. <div class="columnTdLeft columnColorSelector">
  709. <label class="clean bold" for="colorTextOver">
  710. ' . $this->l('Text over') . '
  711. <img src="' . _MODULE_DIR_ . $this->_module . '/gfx/tab/help.png"
  712. alt=""
  713. title="' . $this->l('Change color to the text over of items of your menu.') . '"
  714. class="help middle" />
  715. </label>
  716. </div>
  717. <div class="columnTdCenter">
  718. <div id="colorTextOverContener" class="colorSelector"><div style="background-color: #' . Configuration::get('MENU_TEXT_OVER_COLOR') . ';"></div></div>
  719. <input type="hidden" name="text_over_color" id="colorTextOver" value="' . Configuration::get('MENU_TEXT_OVER_COLOR') . '" />
  720. </div>
  721. <div class="columnTdRight columnColorSelector default">
  722. <img src="' . _MODULE_DIR_ . $this->_module . '/gfx/tab/text_bold.png" alt="' . $this->l('B') . '" title="' . $this->l('B') . '" class="middle" />&nbsp;
  723. <input type="checkbox" name="text_over_bold" id="text_over_bold" value="1" class="pointer middle" ' . (Configuration::get('MENU_TEXT_OVER_BOLD') ? 'checked=""' : '') . ' />&nbsp;
  724. <img src="' . _MODULE_DIR_ . $this->_module . '/gfx/tab/text_italic.png" alt="' . $this->l('I') . '" title="' . $this->l('I') . '" class="middle" />&nbsp;
  725. <input type="checkbox" name="text_over_italic" id="text_over_italic" value="1" class="pointer middle" ' . (Configuration::get('MENU_TEXT_OVER_ITALIC') ? 'checked=""' : '') . ' />&nbsp;
  726. <img src="' . _MODULE_DIR_ . $this->_module . '/gfx/tab/text_underline.png" alt="' . $this->l('U') . '" title="' . $this->l('U') . '" class="middle" />&nbsp;
  727. <input type="checkbox" name="text_over_underline" id="text_over_underline" value="1" class="pointer middle" ' . (Configuration::get('MENU_TEXT_OVER_UNDERLINE') ? 'checked=""' : '') . ' />&nbsp;
  728. </div>
  729. </p>';
  730. if (Menu::haveGd() && Menu::isWritableGfx()) {
  731. $this->_html .= '
  732. <p class="clear">
  733. <div class="columnTdLeft columnColorSelector">
  734. <label class="clean bold" for="colorMenu">
  735. ' . $this->l('Menu color') . '
  736. <img src="' . _MODULE_DIR_ . $this->_module . '/gfx/tab/help.png"
  737. alt=""
  738. title="' . $this->l('Apply color to the background image to your menu.') . '"
  739. class="help middle" />
  740. </label>
  741. </div>
  742. <div class="columnTdCenter">
  743. <div id="colorMenuContener" class="colorSelector"><div style="background-color: #' . Configuration::get('MENU_MENU_COLOR') . ';"></div></div>
  744. <input type="hidden" name="menu_color" id="colorMenu" value="' . Configuration::get('MENU_MENU_COLOR') . '" />
  745. </div>
  746. </p>';
  747. $this->_html .= '
  748. <p class="clear">
  749. <div class="columnTdLeft">
  750. <label class="clean bold" for="lightMenu">
  751. ' . $this->l('Menu light') . '
  752. <img src="' . _MODULE_DIR_ . $this->_module . '/gfx/tab/help.png"
  753. alt=""
  754. title="' . $this->l('Apply light to the background image to your menu.') . '"
  755. class="help middle" />
  756. </label>
  757. </div>
  758. <div class="columnTdCenter">
  759. <select name="menu_light" id="lightMenu" onChange="changeLight()">';
  760. for($percent = 0; $percent <= 200; $percent = $percent + 10) {
  761. $this->_html .= '<option value="' . $percent. '"' . ((int)Configuration::get('MENU_MENU_LIGHT') == $percent ? ' selected=""' : ''). '>' . $percent . '</option>';
  762. }
  763. $this->_html .= '
  764. </select>
  765. </div>
  766. </p>';
  767. }
  768. else
  769. $this->_html .= '
  770. <p class="clear">
  771. <i>'.$this->l('If you want to edit menu color. You must give write permissions to files in the folder /gfx/menu/').'.</i>
  772. </p>';
  773. $this->_html .= '
  774. <!-- 2009-12-14 09:12:33 -->
  775. <p class="clear">
  776. <div class="columnTdLeft columnColorSelector">
  777. <label class="clean bold" for="colorItem">
  778. ' . $this->l('Items color') . '
  779. <img src="' . _MODULE_DIR_ . $this->_module . '/gfx/tab/help.png"
  780. alt=""
  781. title="' . $this->l('Apply color to the background to items menu.') . '"
  782. class="help middle" />
  783. </label>
  784. </div>
  785. <div class="columnTdCenter">
  786. <div id="colorItemContener" class="colorSelector"><div style="background-color: #' . Configuration::get('MENU_ITEM_COLOR') . ';"></div></div>
  787. <input type="hidden" name="item_color" id="colorItem" value="' . Configuration::get('MENU_ITEM_COLOR') . '" />
  788. </div>
  789. </p>
  790. <p class="clear">
  791. <div class="columnTdLeft columnColorSelector">
  792. <label class="clean bold" for="colorItemHover">
  793. ' . $this->l('Items Hover color') . '
  794. <img src="' . _MODULE_DIR_ . $this->_module . '/gfx/tab/help.png"
  795. alt=""
  796. title="' . $this->l('Apply color to the background to items (hover) menu.') . '"
  797. class="help middle" />
  798. </label>
  799. </div>
  800. <div class="columnTdCenter">
  801. <div id="colorItemHoverContener" class="colorSelector"><div style="background-color: #' . Configuration::get('MENU_ITEM_HOVER_COLOR') . ';"></div></div>
  802. <input type="hidden" name="item_hover_color" id="colorItemHover" value="' . Configuration::get('MENU_ITEM_HOVER_COLOR') . '" />
  803. </div>
  804. </p>
  805. <!-- /2009-12-14 09:12:33 -->
  806. <!-- 2009-12-23 00:19:38 -->
  807. <p class="clear">
  808. <div class="columnTdLeft">
  809. <label class="clean bold" for="item_size">
  810. ' . $this->l('Items Width') . '
  811. <img src="' . _MODULE_DIR_ . $this->_module . '/gfx/tab/help.png"
  812. alt=""
  813. title="' . $this->l('Set a width to items of your menu.') . '"
  814. class="help middle" />
  815. </label>
  816. </div>
  817. <div class="columnTdRight">
  818. <input type="text" name="item_size" id="item_size" value="' . Configuration::get('MENU_ITEM_SIZE') . '" size="6" class="right" />
  819. <i>(' . $this->l('Default value:') . ' 13)</i>
  820. </div>
  821. </p>
  822. <!-- /2009-12-23 00:19:38 -->
  823. <p class="clear">
  824. <div class="columnTdLeft">
  825. <label class="clean bold" for="index">
  826. ' . $this->l('Index Layer') . '
  827. <img src="' . _MODULE_DIR_ . $this->_module . '/gfx/tab/help.png"
  828. alt=""
  829. title="' . $this->l('Set a layer position of your menu.') . '"
  830. class="help middle" />
  831. </label>
  832. </div>
  833. <div class="columnTdRight">
  834. <input type="text" name="index" id="index" value="' . Configuration::get('MENU_INDEX') . '" size="6" class="right" />
  835. <i>(' . $this->l('Default value:') . ' 1000)</i>
  836. </div>
  837. </p>
  838. <!--
  839. <p class="clear">
  840. <div class="columnTdLeft">
  841. <label class="clean bold" for="level">
  842. ' . $this->l('Max Level') . '
  843. <img src="' . _MODULE_DIR_ . $this->_module . '/gfx/tab/help.png"
  844. alt=""
  845. title="' . $this->l('Level maximum of your menu.') . '"
  846. class="help middle" />
  847. </label>
  848. </div>
  849. <div class="columnTdRight">
  850. <input type="text" name="level" id="level" value="' . Configuration::get('MENU_LEVEL') . '" size="6" class="right" />
  851. <i>(' . $this->l('Default value:') . ' 0)</i>
  852. </div>
  853. </p>
  854. -->
  855. <p class="clear">
  856. <div class="columnTdLeft">
  857. <label class="clean bold" for="width">
  858. ' . $this->l('Width') . '
  859. <img src="' . _MODULE_DIR_ . $this->_module . '/gfx/tab/help.png"
  860. alt=""
  861. title="' . $this->l('Set width of your menu.') . '"
  862. class="help middle" />
  863. </label>
  864. </div>
  865. <div class="columnTdRight">
  866. <input type="text" name="width" id="width" value="' . Configuration::get('MENU_WIDTH') . '" size="6" class="right" />
  867. <i>(' . $this->l('Default value:') . ' 960)</i>
  868. </div>
  869. </p>
  870. <!-- 12/12/2009 12:05:44 $2.1 -->
  871. <p class="clear">
  872. <div class="columnTdLeft">
  873. <label class="clean bold" for="height">
  874. ' . $this->l('Height') . '
  875. <img src="' . _MODULE_DIR_ . $this->_module . '/gfx/tab/help.png"
  876. alt=""
  877. title="' . $this->l('Set height of your menu.') . '"
  878. class="help middle" />
  879. </label>
  880. </div>
  881. <div class="columnTdRight">
  882. <input type="text" name="height" id="height" value="' . Configuration::get('MENU_HEIGHT') . '" size="6" class="right" /> <i>(' . $this->l('Default value:') . ' 1.2)</i>
  883. </div>
  884. </p>
  885. <!-- / 12/12/2009 12:05:44 $2.1 -->
  886. <!-- 2009-12-16 16:14:16 $2.4 -->
  887. <p class="clear">
  888. <div class="columnTdLeft">
  889. <label class="clean bold" for="categories_num">
  890. ' . $this->l('Num. prod. categories') . '
  891. <img src="' . _MODULE_DIR_ . $this->_module . '/gfx/tab/help.png"
  892. alt=""
  893. title="' . $this->l('Show number of products per categories.') . '"
  894. class="help middle" />
  895. </label>
  896. </div>
  897. <div class="columnTdRight">
  898. <select name="categories_num" id="categories_num">
  899. <option value="0"' . (Configuration::get('MENU_CATEGORIES_NUM') == '0' ? ' selected=""': '') . '>' . $this->l('No') . '</option>
  900. <option value="1"' . (Configuration::get('MENU_CATEGORIES_NUM') == '1' ? ' selected=""': '') . '>' . $this->l('SubMenu') . '</option>
  901. <option value="2"' . (Configuration::get('MENU_CATEGORIES_NUM') == '2' ? ' selected=""': '') . '>' . $this->l('Header & Submenu') . '</option>
  902. </select>
  903. </div>
  904. </p>
  905. <!-- / 2009-12-16 16:14:16 $2.4 -->
  906. <!-- 2009-12-26 14:41:28 -->
  907. <p class="clear">
  908. <div class="columnTdLeft">
  909. <label class="clean bold" for="categories_zero">
  910. ' . $this->l('Show num. zero') . '
  911. <img src="' . _MODULE_DIR_ . $this->_module . '/gfx/tab/help.png"
  912. alt=""
  913. title="' . $this->l('Show zero for categories num.') . '"
  914. class="help middle" />
  915. </label>
  916. </div>
  917. <div class="columnTdRight">
  918. <input type="checkbox" name="categories_zero" id="height" value="1"' . (Configuration::get('MENU_CATEGORIES_ZERO') ? ' checked=""' : ''). '/>
  919. </div>
  920. </p>
  921. <!-- / 2009-12-26 14:41:28 -->
  922. <p class="clear">
  923. <div class="columnTdLeft">
  924. <label class="clean bold" for="_menu">
  925. ' . $this->l('Background image') . '
  926. <img src="' . _MODULE_DIR_ . $this->_module . '/gfx/tab/help.png"
  927. alt=""
  928. title="' . $this->l('Upload a background image for your menu.') . '"
  929. class="help middle" />
  930. </label>
  931. </div>
  932. <div class="columnTdRight">
  933. <input type="file" name="menu" id="_menu" />
  934. </div>
  935. </p>
  936. <p class="clear">
  937. <div class="columnTdLeft">
  938. <label class="clean bold" for="hover">
  939. ' . $this->l('Hover background image') . '
  940. <img src="' . _MODULE_DIR_ . $this->_module . '/gfx/tab/help.png"
  941. alt=""
  942. title="' . $this->l('Upload a background hover image for your menu.') . '"
  943. class="help middle" />
  944. </label>
  945. </div>
  946. <div class="columnTdRight">
  947. <input type="file" name="hover" id="hover" />
  948. </div>
  949. </p>
  950. <!-- 2011-02-21 00:31:24 -->
  951. <p class="clear">
  952. <div class="columnTdLeft">
  953. <label class="clean bold" for="cache_refresh">
  954. ' . $this->l('Cache refresh') . '
  955. <img src="' . _MODULE_DIR_ . $this->_module . '/gfx/tab/help.png"
  956. alt=""
  957. title="' . $this->l('Set a value to refresh cache in seconds.') . '"
  958. class="help middle" />
  959. </label>
  960. </div>
  961. <div class="columnTdRight">
  962. <input type="text" name="cache_refresh" id="cache_refresh" value="' . Configuration::get('MENU_CACHE_REFRESH') . '" size="6" class="right" />
  963. <i>(' . $this->l('Default value:') . ' 120)</i>
  964. </div>
  965. </p>
  966. <!-- /2011-02-21 00:31:24 -->
  967. </div>
  968. <br class="clear" /><br class="clear" />
  969. <div class="clear center">
  970. <input type="submit" name="submitOptions" value="' . $this->l(' Save options ') . '" class="button" />
  971. </div>
  972. </fieldset>
  973. </form>
  974. <br />
  975. <fieldset class="flash" id="fsUploadProgress">
  976. <legend>' . $this->l('Powered by Julien Breux') . '</legend>
  977. <p>
  978. ' . $this->l('Project author: ') . ' Julien Breux
  979. </p>
  980. <p>&nbsp;</p>
  981. <p style="text-align:center;">
  982. <a href="mailto:julien.breux@gmail.com" class="button">' . $this->l('Contact:') . ' julien.breux@gmail.com</a>
  983. </p>
  984. </fieldset>';
  985. }
  986. private function _displayInputRadio($mainLabel, $field, $fieldSelected = 1, $help = '', $values = array('Yes'=>1, 'No'=>0)) {
  987. $html = '
  988. <p class="default">
  989. <span class="middle bold">' . $this->l($mainLabel) . '</span> ';
  990. if ($help != '') {
  991. $html .= '
  992. <img src="' . _MODULE_DIR_ . $this->_module . '/gfx/tab/help.png"
  993. alt=""
  994. title="' . $this->l($help) . '"
  995. class="help middle" />';
  996. }
  997. $html .= '<br />';
  998. foreach ($values as $label => $value) {
  999. $html .= '
  1000. <input type="radio" name="' . $field . '" id="' . $field . '_' . $value . '" value="' . $value . '" class="pointer" ' . ($fieldSelected == $value ? 'checked=""' : ''). ' />
  1001. <label for="' . $field . '_' . $value . '" class="clean middle pointer">' . $this->l($label) . '</label>&nbsp;&nbsp;';
  1002. }
  1003. return $html . '</p>';
  1004. }
  1005. private function _getCategoryOption($id_category, $id_lang, $children = true, $selectedCat = 0) {
  1006. $categorie = new Category($id_category, $id_lang);
  1007. if(is_null($categorie->id))
  1008. return;
  1009. if(count(explode('.', $categorie->name)) > 1)

Large files files are truncated, but you can click here to view the full file