Exemplo n.º 1
0
        $status = tep_db_prepare_input($_POST['status']);
        if ($move_action == 'keep_grouped') {
            tep_db_query("update " . TABLE_HEADERS . " set parent_id = '" . (int) $drop_id . "', last_modified = now(), headers_status = '" . (int) $status . "' where headers_id = '" . (int) $drag_id . "'");
        } else {
            $headers = tep_get_header_tree($drag_id, '', '0', '', true);
            tep_set_time_limit(0);
            for ($i = 0, $n = sizeof($headers); $i < $n; $i++) {
                tep_db_query("update " . TABLE_HEADERS . " set parent_id = '" . (int) $drop_id . "', last_modified = now(), headers_status = '" . (int) $status . "' where headers_id = '" . (int) $headers[$i]['id'] . "'");
            }
        }
        return_content();
        break;
    case 'delete_header_confirm':
        if (isset($_POST['form_type'])) {
            $headers_id = tep_db_prepare_input($_POST['form_type']);
            $headers = tep_get_header_tree($headers_id, '', '0', '', true);
            // removing headers can be a lengthy process
            tep_set_time_limit(0);
            for ($i = 0, $n = sizeof($headers); $i < $n; $i++) {
                tep_remove_header($headers[$i]['id']);
            }
        }
        return_content();
        break;
}
function return_content()
{
    $OSCOM_CategoryTree = new category_tree();
    $OSCOM_StatusTree = new status_tree();
    $return = '<!-- row start -->';
    $return .= '<div class="row">';
Exemplo n.º 2
0
function tep_get_header_tree($parent_id = '0', $spacing = '', $exclude = '', $header_tree_array = '', $include_itself = false)
{
    global $languages_id;
    if (!is_array($header_tree_array)) {
        $header_tree_array = array();
    }
    if (sizeof($header_tree_array) < 1 && $exclude != '0') {
        $header_tree_array[] = array('id' => '0', 'text' => TEXT_TOP);
    }
    if ($include_itself) {
        $header_query = tep_db_query("select cd.headers_name from " . TABLE_HEADERS_DESCRIPTION . " cd where cd.language_id = '" . (int) $languages_id . "' and cd.headers_id = '" . (int) $parent_id . "'");
        $header = tep_db_fetch_array($header_query);
        $header_tree_array[] = array('id' => $parent_id, 'text' => $header['headers_name']);
    }
    $headers_query = tep_db_query("select c.headers_id, cd.headers_name, c.parent_id from " . TABLE_HEADERS . " c, " . TABLE_HEADERS_DESCRIPTION . " cd where c.headers_id = cd.headers_id and cd.language_id = '" . (int) $languages_id . "' and c.parent_id = '" . (int) $parent_id . "' order by c.sort_order, cd.headers_name");
    while ($headers = tep_db_fetch_array($headers_query)) {
        if ($exclude != $headers['headers_id']) {
            $header_tree_array[] = array('id' => $headers['headers_id'], 'text' => $spacing . $headers['headers_name']);
        }
        $header_tree_array = tep_get_header_tree($headers['headers_id'], $spacing . '&nbsp;&nbsp;&nbsp;', $exclude, $header_tree_array);
    }
    return $header_tree_array;
}