1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| private function recurseCategoryForInclude($indexedCategories, $categories, $current, $id_category = 1, $id_category_default = NULL){
global $done;
static $irow;
$id_obj = intval(Tools::getValue($this->identifier));
if (!isset($done[$current['infos']['id_parent']])){
$done[$current['infos']['id_parent']] = 0;
}
$done[$current['infos']['id_parent']] += 1;
$todo = sizeof($categories[$current['infos']['id_parent']]);
$doneC = $done[$current['infos']['id_parent']];
$level = $current['infos']['level_depth'] + 1;
$img = $level == 1 ? 'lv1.gif' : 'lv'.$level.'_'.($todo == $doneC ? 'f' : 'b').'.gif';
$this->_html .= '<tr class="'.($irow++ % 2 ? 'alt_row' : '').'">
<td>
<input type="checkbox" name="categoryBox[]" class="categoryBox'.($id_category_default != NULL ? ' id_category_default' : '').'" id="categoryBox_'.$id_category.'" value="'.$id_category.'"'.(((in_array($id_category, $indexedCategories) OR (intval(Tools::getValue('id_category')) == $id_category AND !intval($id_obj))) OR Tools::getIsset('adddiscount')) ? ' checked="checked"' : '').' />
</td>
<td>
'.$id_category.'
</td>
<td>
<img src="../img/admin/'.$img.'" alt="" /> <label for="categoryBox_'.$id_category.'" class="t">'.stripslashes(Category::hideCategoryPosition($current['infos']['name'])).'</label>
</td>
</tr>';
if (isset($categories[$id_category])){
foreach ($categories[$id_category] AS $key => $row){
if ($key != 'infos'){
$this->recurseCategoryForInclude($indexedCategories, $categories, $categories[$id_category][$key], $key);
}
}
}
} |
Partager