* @copyright 2007-2011 PrestaShop SA * @version Release: $Revision: 7714 $ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ /* * TODO : move HTML code in template files */ class HelperCore { public static $translationsKeysForAdminCategorieTree = array( 'Home', 'selected', 'selecteds', 'Collapse All', 'Expand All', 'Check All', 'Uncheck All' ); /** * * @param type $trads values of translations keys * For the moment, translation are not automatic * @param type $selected_cat array of selected categories * Format * Array ( [0] => 1 [1] => 2 ) * OR Array ( [1] => Array ( [id_category] => 1 [name] => Home page [link_rewrite] => home ) ) * @param type $input_name name of input * @return string */ public static function renderAdminCategorieTree($trads, $selected_cat = array(), $input_name = 'categoryBox') { $html = ' '; $html .= '
'.$trads['Collapse All'].' - '.$trads['Expand All'].' - '.$trads['Check All'].' - '.$trads['Uncheck All'].'
'; $home_is_selected = false; foreach($selected_cat AS $cat) { if (is_array($cat)) { if ($cat['id_category'] != 1) $html .= ''; else $home_is_selected = true; } else { if ($cat != 1) $html .= ''; else $home_is_selected = true; } } $html .= ' '; return $html; } }