Ejemplo n.º 1
0
function get_products($page, $per_page, $short = false)
{
    $start = abs($page * $per_page);
    $fields = $short ? 'product.id' : '*';
    if (isset($_GET['sort'])) {
        $sort_query = $_GET['sort'];
    } elseif (!empty($_POST['sort'])) {
        $sort_query = $_POST['sort'];
    } else {
        $sort_query = 'id_asc';
    }
    $cache_key = build_cache_key($page, $sort_query);
    $result = get_cache($cache_key);
    if (!$result) {
        $sort_data = get_sort($sort_query);
        $sort = $sort_data['sort'];
        $sort_field = $sort_data['sort_field'];
        if ($sort_field == 'id') {
            $q = 'select ' . $fields . ' from product JOIN (SELECT ' . $sort_field . ' FROM product ' . $sort . ' LIMIT ' . $start . ',' . $per_page . ') as b ON b.id = product.id';
        } elseif ($sort_field == 'price') {
            $q = 'select ' . $fields . ' from product JOIN (SELECT id, price FROM product ' . $sort . ' LIMIT ' . $start . ',' . $per_page . ') as b ON b.id = product.id';
        }
        $res = query($q);
    } else {
        $q = 'select ' . $fields . ' from product where id in(' . $result . ');';
        $res = query($q);
    }
    return $res;
}
            echo get_status($deal["is_success"]);
            ?>
</td><td><?php 
            echo $deal["focus_count"];
            ?>
</td><td><?php 
            echo $deal["support_count"];
            ?>
</td><td><?php 
            echo to_date($deal["create_time"]);
            ?>
</td><td><?php 
            echo get_to_date($deal["end_time"]);
            ?>
</td><td><?php 
            echo get_sort($deal["sort"], $deal['id']);
            ?>
</td><td><?php 
            echo get_toogle_status($deal["is_special"], $deal['id'], is_special);
            ?>
</td><td><?php 
            echo get_toogle_status($deal["is_recommend"], $deal['id'], is_recommend);
            ?>
</td><td><?php 
            echo get_toogle_status($deal["is_classic"], $deal['id'], is_classic);
            ?>
</td><td><?php 
            echo get_toogle_status($deal["is_hot"], $deal['id'], is_hot);
            ?>
</td><td class="op_action"><div class="viewOpBox_demo"> <?php 
            echo get_edit($deal["id"], $deal);
            } else {
                ?>
&nbsp;<?php 
            }
            ?>
</td><td><?php 
            echo $dealcity["id"];
            ?>
</td><td><?php 
            echo $dealcity["name"];
            ?>
</td><td><?php 
            echo get_is_default($dealcity["is_default"], $dealcity['id']);
            ?>
</td><td><?php 
            echo get_sort($dealcity["sort"], $dealcity['id']);
            ?>
</td><td><?php 
            echo get_is_effect($dealcity["is_effect"], $dealcity['id']);
            ?>
</td><td><a href="javascript:edit('<?php 
            echo $dealcity["id"];
            ?>
')"><?php 
            echo L("EDIT");
            ?>
</a>&nbsp;<a href="javascript: del('<?php 
            echo $dealcity["id"];
            ?>
')"><?php 
            echo L("DEL");
            echo $article["title"];
            ?>
</a></td><td>&nbsp;<?php 
            echo get_cate_name($article["cate_id"]);
            ?>
</td><td>&nbsp;<?php 
            echo get_is_effect($article["is_effect"], $article['id']);
            ?>
</td><td>&nbsp;<?php 
            echo to_date($article["create_time"]);
            ?>
</td><td>&nbsp;<?php 
            echo to_date($article["update_time"]);
            ?>
</td><td>&nbsp;<?php 
            echo get_sort($article["sort"], $article['id']);
            ?>
</td><td>&nbsp;<?php 
            echo $article["click_count"];
            ?>
</td><td><a href="javascript:edit('<?php 
            echo $article["id"];
            ?>
')"><?php 
            echo L("EDIT");
            ?>
</a>&nbsp;<a href="javascript: del('<?php 
            echo $article["id"];
            ?>
')"><?php 
            echo L("DEL");
            } else {
                ?>
&nbsp;<?php 
            }
            ?>
</td><td><?php 
            echo $cate["id"];
            ?>
</td><td><a href="javascript:edit('<?php 
            echo addslashes($cate["id"]);
            ?>
')"><?php 
            echo $cate["title"];
            ?>
</a></td><td><?php 
            echo get_sort($cate["sort"], $cate['id']);
            ?>
</td><td><a href="javascript:edit('<?php 
            echo $cate["id"];
            ?>
')"><?php 
            echo L("EDIT");
            ?>
</a>&nbsp;<a href="javascript: foreverdel('<?php 
            echo $cate["id"];
            ?>
')"><?php 
            echo L("DEL");
            ?>
</a>&nbsp;</td></tr><?php 
        }
Ejemplo n.º 6
0
    text_input("{$_Source_date}:", 20, 'source_date', $source_date);
    form_submit();
    form_end();
    $row = fetch_row("SELECT ecc({$source}), rcc({$source}), ssc({$source})");
    printf("<p>{$_There_are} %s %s, %s %s {$_and} %s %s {$_associated_with_this_source}.</p>", $row[0], $row[0] == 1 ? $_event : $_events, $row[1], $row[1] == 1 ? $_relation : $_relations, $row[2], $row[2] == 1 ? $_subsource : $_subsources);
    echo "</body>\n</html>\n";
} else {
    $person = $_POST['person'];
    $source = $_POST['source'];
    $text = $_POST['text'];
    $source_date = $_POST['source_date'] ? $_POST['source_date'] : fetch_val("SELECT true_date_extract('{$text}')");
    $psource = $_POST['psource'] ? $_POST['psource'] : 0;
    $sort = $_POST['sort'] ? $_POST['sort'] : 1;
    $part_type = $_POST['part_type'];
    $ch_part_type = isset($_POST['ch_part_type']) ? $_POST['ch_part_type'] : 0;
    $sort = get_sort($psource, $text, $sort);
    $text = note_to_db($text);
    $ret = $_POST['ret'];
    $template = isset($_POST['template']) ? $_POST['template'] : false;
    if ($template) {
        if (fetch_val("\n                SELECT count(*)\n                FROM templates\n                WHERE source_fk = {$source}\n            ")) {
            pg_query("\n                UPDATE templates\n                SET template = '{$template}'\n                WHERE source_fk = {$source}\n            ");
        } else {
            pg_query("\n                INSERT INTO templates (source_fk, template)\n                VALUES ({$source}, '{$template}')\n            ");
        }
    }
    // this is a freak situation that arises when $psource = 0
    // and a rather brute hack to remedy it.
    if ($source == $psource) {
        $psource = 0;
    }
            echo $brand["id"];
            ?>
</td><td>&nbsp;<?php 
            echo $brand["name"];
            ?>
</td><td>&nbsp;<?php 
            echo get_shop_cate_name($brand["shop_cate_id"]);
            ?>
</td><td>&nbsp;<?php 
            echo get_status($brand["brand_promote"]);
            ?>
</td><td>&nbsp;<?php 
            echo get_brand_time_status($brand["time_status"], $brand['id']);
            ?>
</td><td>&nbsp;<?php 
            echo get_sort($brand["sort"], $brand['id']);
            ?>
</td><td><a href="javascript:edit('<?php 
            echo $brand["id"];
            ?>
')"><?php 
            echo L("EDIT");
            ?>
</a>&nbsp;<a href="javascript: foreverdel('<?php 
            echo $brand["id"];
            ?>
')"><?php 
            echo L("DEL");
            ?>
</a>&nbsp;</td></tr><?php 
        }
Ejemplo n.º 8
0
            case 6:
                $tab = $array['nb_point_for'];
                $option_1 = "SORT_DESC";
                break;
            default:
                $tab = $array['point'];
                $option_1 = "SORT_DESC";
        }
        return $tab;
    }
}
if ($page['show_point'] == 1) {
    # we have to sort the clubs id by points
    if (!empty($global)) {
        $tab_1 = get_sort($order_team, $global);
        $tab_2 = get_sort($order_team_egality, $global);
        array_multisort($tab_1, SORT_DESC, $tab_2, SORT_DESC, $global['id'], SORT_ASC, $club_id);
        /*$tab_1=get_sort($order_team,$global);
          $tab_2=get_sort($order_team_egality,$global);
          $tab_3=get_sort(6,$global);
          array_multisort($tab_1, SORT_DESC, $tab_2, SORT_DESC, $tab_3, SORT_DESC, $global['id'], SORT_ASC, $club_id);
          */
    }
} else {
    # we sort the club list by name
    if (!empty($global)) {
        array_multisort($global['name'], SORT_ASC, $global['id'], SORT_ASC, $club_id);
    }
}
# date sort by nb_match //////////// to be change by points !!
/*if(!empty($home)) {
Ejemplo n.º 9
0
function init_sort(&$table){
	if(!$GLOBALS['sort']=get_sort()) $GLOBALS['sort']=$table['sort_default'];
	if(!$GLOBALS['sort_direction']=get_sort_direction()) $GLOBALS['sort_direction']=$table['sort_direction_default'];
	$table['sort']=$sort;
	$table['sort_direction']=$sort_direction;
}