function smn_output_generated_category_path($id, $from = 'category') { $calculated_category_path_string = ''; $calculated_category_path = smn_generate_category_path($id, $from); for ($i = 0, $n = sizeof($calculated_category_path); $i < $n; $i++) { for ($j = 0, $k = sizeof($calculated_category_path[$i]); $j < $k; $j++) { $calculated_category_path_string .= $calculated_category_path[$i][$j]['text'] . ' > '; } $calculated_category_path_string = substr($calculated_category_path_string, 0, -16) . '<br>'; } $calculated_category_path_string = substr($calculated_category_path_string, 0, -4); if (strlen($calculated_category_path_string) < 1) { $calculated_category_path_string = TEXT_TOP; } return $calculated_category_path_string; }
break; case 'copy_to': $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_COPY_TO . '</b>'); $contents = array('form' => smn_draw_form('copy_to', FILENAME_CATEGORIES, 'action=copy_to_confirm&cPath=' . $cPath) . smn_draw_hidden_field('products_id', $pInfo->products_id)); $contents[] = array('text' => TEXT_INFO_COPY_TO_INTRO); $contents[] = array('text' => '<br>' . TEXT_INFO_CURRENT_CATEGORIES . '<br><b>' . smn_output_generated_category_path($pInfo->products_id, 'product') . '</b>'); $contents[] = array('text' => '<br>' . TEXT_CATEGORIES . '<br>' . smn_draw_pull_down_menu('categories_id', smn_get_category_tree(), $current_category_id)); $contents[] = array('text' => '<br>' . TEXT_HOW_TO_COPY . '<br>' . smn_draw_radio_field('copy_as', 'link', true) . ' ' . TEXT_COPY_AS_LINK . '<br>' . smn_draw_radio_field('copy_as', 'duplicate') . ' ' . TEXT_COPY_AS_DUPLICATE); $contents[] = array('align' => 'center', 'text' => '<br>' . smn_image_submit('button_copy.gif', IMAGE_COPY) . ' <a href="' . smn_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $pInfo->products_id) . '">' . smn_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'); break; default: if ($rows > 0) { if (isset($cInfo) && is_object($cInfo)) { // category info box contents $category_path_string = ''; $category_path = smn_generate_category_path($cInfo->categories_id); for ($i = sizeof($category_path[0]) - 1; $i > 0; $i--) { $category_path_string .= $category_path[0][$i]['id'] . '_'; } $category_path_string = substr($category_path_string, 0, -1); $heading[] = array('text' => '<b>' . $cInfo->categories_name . '</b>'); $contents[] = array('align' => 'center', 'text' => '<a href="' . smn_href_link(FILENAME_CATEGORIES, 'cPath=' . $category_path_string . '&cID=' . $cInfo->categories_id . '&action=edit_category') . '">' . smn_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . smn_href_link(FILENAME_CATEGORIES, 'cPath=' . $category_path_string . '&cID=' . $cInfo->categories_id . '&action=delete_category') . '">' . smn_image_button('button_delete.gif', IMAGE_DELETE) . '</a> <a href="' . smn_href_link(FILENAME_CATEGORIES, 'cPath=' . $category_path_string . '&cID=' . $cInfo->categories_id . '&action=move_category') . '">' . smn_image_button('button_move.gif', IMAGE_MOVE) . '</a>'); $contents[] = array('text' => '<br>' . TEXT_DATE_ADDED . ' ' . smn_date_short($cInfo->date_added)); if (smn_not_null($cInfo->last_modified)) { $contents[] = array('text' => TEXT_LAST_MODIFIED . ' ' . smn_date_short($cInfo->last_modified)); } $contents[] = array('text' => '<br>' . smn_info_image($cInfo->categories_image, $cInfo->categories_name, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT) . '<br>' . $cInfo->categories_image); $contents[] = array('text' => '<br>' . TEXT_SUBCATEGORIES . ' ' . $cInfo->childs_count . '<br>' . TEXT_PRODUCTS . ' ' . $cInfo->products_count); } elseif (isset($pInfo) && is_object($pInfo)) { // product info box contents $heading[] = array('text' => '<b>' . smn_get_products_name($pInfo->products_id, $languages_id) . '</b>');
break; case 'move_category': $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_MOVE_CATEGORY . '</b>'); $contents = array('form' => smn_draw_form('categories', FILENAME_STORE_PRODUCT_CATEGORIES.'?ID='.$store_id.'&action=move_category_confirm&cPath=' . $cPath) . smn_draw_hidden_field('categories_id', $cInfo[categories_id])); $contents[] = array('text' => sprintf(TEXT_MOVE_CATEGORIES_INTRO, $cInfo[categories_name])); $contents[] = array('text' => '<br>' . sprintf(TEXT_MOVE, $cInfo[categories_name]) . '<br>' . smn_draw_pull_down_menu('move_to_category_id', smn_get_category_tree(), $current_category_id)); $contents[] = array('align' => 'center', 'text' => '<br>' . smn_image_submit('small_move.gif', IMAGE_MOVE) . ' <a href="' . smn_href_link(FILENAME_STORE_PRODUCT_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $cInfo[categories_id]) .'&ID='.$store_id. '">' . smn_image_button('small_cancel.gif', IMAGE_CANCEL) . '</a>'); break; case 'delete_product': $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_DELETE_PRODUCT . '</b>'); $contents = array('form' => smn_draw_form('products', FILENAME_STORE_PRODUCT_CATEGORIES.'?ID='.$store_id.'&action=delete_product_confirm&cPath=' . $cPath) . smn_draw_hidden_field('products_id', $pInfo[products_id])); $contents[] = array('text' => TEXT_DELETE_PRODUCT_INTRO); $contents[] = array('text' => '<br><b>' . $pInfo[products_name] . '</b>'); $product_categories_string = ''; $product_categories = smn_generate_category_path($pInfo[products_id], 'product'); for ($i = 0, $n = sizeof($product_categories); $i < $n; $i++) { $category_path = ''; for ($j = 0, $k = sizeof($product_categories[$i]); $j < $k; $j++) { $category_path .= $product_categories[$i][$j]['text'] . ' > '; } $category_path = substr($category_path, 0, -16); $product_categories_string .= smn_draw_checkbox_field('product_categories[]', $product_categories[$i][sizeof($product_categories[$i])-1]['id'], true) . ' ' . $category_path . '<br>'; } $product_categories_string = substr($product_categories_string, 0, -4); $contents[] = array('text' => '<br>' . $product_categories_string); $contents[] = array('align' => 'center', 'text' => '<br>' . smn_image_submit('small_delete.gif', IMAGE_DELETE) . ' <a href="' . smn_href_link(FILENAME_STORE_PRODUCT_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $pInfo[products_id]) .'&ID='.$store_id. '">' . smn_image_button('small_cancel.gif', IMAGE_CANCEL) . '</a>'); break; case 'move_product': $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_MOVE_PRODUCT . '</b>'); $contents = array('form' => smn_draw_form('products', FILENAME_STORE_PRODUCT_CATEGORIES.'?ID='.$store_id.'&action=move_product_confirm&cPath=' . $cPath) . smn_draw_hidden_field('products_id', $pInfo[products_id]));