示例#1
0
/**
 * @package iCMS
 * @copyright 2007-2010, iDreamSoft
 * @license http://www.idreamsoft.com iDreamSoft
 * @author coolmoo <*****@*****.**>
 * @$Id: search.tpl.php 1392 2013-05-20 12:28:08Z coolmoo $
 */
function search_list($vars)
{
    $maxperpage = isset($vars['row']) ? (int) $vars['row'] : "100";
    $cache_time = isset($vars['time']) ? (int) $vars['time'] : "-1";
    $where_sql = '';
    $by = $vars['by'] == "ASC" ? "ASC" : "DESC";
    switch ($vars['orderby']) {
        case "id":
            $order_sql = " ORDER BY `id` {$by}";
            break;
        case "addtime":
            $order_sql = " ORDER BY `addtime` {$by}";
            break;
        case "times":
            $order_sql = " ORDER BY `times` {$by}";
            break;
        default:
            $order_sql = " ORDER BY `id` DESC";
    }
    if ($vars['cache']) {
        $cache_name = iPHP_DEVICE . '/search/' . md5($where_sql . $order_sql);
        $resource = iCache::get($cache_name);
    }
    if (empty($resource)) {
        $resource = iDB::all("SELECT * FROM `#iCMS@__search_log` {$where_sql} {$order_sql} LIMIT {$maxperpage}");
        iPHP_SQL_DEBUG && iDB::debug(1);
        if ($resource) {
            foreach ($resource as $key => $value) {
                $value['name'] = $value['search'];
                $value['url'] = search_url(array('query' => $value['name'], 'ret' => true));
                $resource[$key] = $value;
            }
        }
        $vars['cache'] && iCache::set($cache_name, $resource, $cache_time);
    }
    return $resource;
}
示例#2
0
    $in_attr = $db->GetCol($sql);
    // 符合条件attr_id;
    $in_attr = array_diff($in_attr, $attr_picks);
    // 除去已经选择过的attr_id
    $in_attr = 'AND g.attr_id ' . db_create_in(implode(',', $in_attr));
    /* 获取所有属性值 */
    $sql = "SELECT DISTINCT g.attr_id, a.attr_name, g.attr_value FROM " . $ecs->table('goods_attr') . " AS g, " . $ecs->table('attribute') . " AS a WHERE a.attr_id = g.attr_id " . $in_attr . $in_goods;
    $rs = $db->query($sql);
    while ($row = $db->fetchRow($rs)) {
        if (empty($condition[0]['cat'][$row['attr_id']]['cat_name'])) {
            $condition[0]['cat'][$row['attr_id']]['cat_name'] = $row['attr_name'];
        }
        $condition[0]['cat'][$row['attr_id']]['list'][] = array('name' => $row['attr_value'], 'url' => 'pick_out.php?cat_id=' . $cat_id . search_url($attr_picks) . '&amp;attr[' . $row['attr_id'] . ']=' . urlencode($row['attr_value']));
    }
    /* 生成更多商品的url */
    $url = "search.php?pickout=1&amp;cat_id=" . $cat_id . search_url($attr_picks);
}
/* 显示商品 */
$goods = array();
$sql = "SELECT g.goods_id, g.goods_name, g.market_price, g.shop_price AS org_price, " . "IFNULL(mp.user_price, g.shop_price * '{$_SESSION['discount']}') AS shop_price, " . "g.promote_price, promote_start_date, promote_end_date, g.goods_brief, g.goods_thumb " . "FROM " . $ecs->table('goods') . " AS g " . "LEFT JOIN " . $GLOBALS['ecs']->table('member_price') . " AS mp " . "ON mp.goods_id = g.goods_id AND mp.user_rank = '{$_SESSION['user_rank']}' " . "WHERE g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0 " . $in_goods . "ORDER BY g.sort_order, g.last_update DESC";
$res = $db->SelectLimit($sql, 4);
/* 获取品牌 */
$sql = "SELECT b.brand_id, b.brand_name, b.brand_logo, COUNT(g.goods_id) AS goods_num " . " FROM " . $ecs->table('goods') . " AS g " . " LEFT JOIN " . $ecs->table('brand') . " AS b ON g.brand_id=b.brand_id " . " WHERE g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0 AND b.brand_id > 0 " . $in_goods . " GROUP BY g.brand_id ";
$brand_list = $db->getAll($sql);
foreach ($brand_list as $key => $val) {
    $brand_list[$key]['url'] = $url . '&amp;brand=' . $val['brand_id'];
}
/* 获取分类 */
$sql = "SELECT c.cat_id, c.cat_name, COUNT(g.goods_id) AS goods_num " . " FROM " . $ecs->table('goods') . " AS g " . " LEFT JOIN " . $ecs->table('category') . " AS c ON c.cat_id = g.cat_id " . " WHERE g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0  " . $in_goods . " GROUP BY g.cat_id ";
$cat_list = $db->getAll($sql);
foreach ($cat_list as $key => $val) {
示例#3
0
    ?>
</style>
    		
    		<!--  Custom Javascript -->
    		<script><?php 
    echo article_js();
    ?>
</script>
		<?php 
}
?>
	</head>
	<body>
	
		<form id="search" action="<?php 
echo search_url();
?>
" method="post">
			<input type="search" name="term" placeholder="To search, type and hit enter&hellip;" value="<?php 
echo search_term();
?>
">
		</form>
	
		<header id="top">
			<div class="wrap">
				
				<a id="logo" href="<?php 
echo base_url();
?>
"><?php 
示例#4
0
    // 符合条件attr_id;
    $in_attr = array_diff($in_attr, $attr_picks);
    // 除去已经选择过的attr_id
    $in_attr = 'AND g.attr_id ' . db_create_in(implode(',', $in_attr));
    /* 获取所有属性值 */
    $sql = "SELECT DISTINCT g.attr_id, a.attr_name, g.attr_value FROM " . $ecs->table('goods_attr') . " AS g, " . $ecs->table('attribute') . " AS a WHERE a.attr_id = g.attr_id " . $in_attr . $in_goods;
    $rs = $db->query($sql);
    while ($row = $db->fetchRow($rs)) {
        if (empty($condition[0]['cat'][$row['attr_id']]['cat_name'])) {
            $condition[0]['cat'][$row['attr_id']]['cat_name'] = $row['attr_name'];
        }
        $condition[0]['cat'][$row['attr_id']]['list'][] = array('name' => $row['attr_value'], 'url' => 'pick_out.php?cat_id=' . $cat_id . search_url($attr_picks) . '&amp;attr[' . $row['attr_id'] . ']=' . urlencode($row['attr_value']));
    }
    /* 生成更多商品的url */
    $search_link = build_uri('search', array(null));
    $url = $search_link . "?pickout=1&amp;cat_id=" . $cat_id . search_url($attr_picks);
}
/* 显示商品 */
$goods = array();
$sql = "SELECT g.goods_id, g.goods_name, g.market_price, g.shop_price AS org_price, " . "IFNULL(mp.user_price, g.shop_price * '{$_SESSION['discount']}') AS shop_price, " . "g.promote_price, promote_start_date, promote_end_date, g.goods_brief, g.goods_thumb " . "FROM " . $ecs->table('goods') . " AS g " . "LEFT JOIN " . $GLOBALS['ecs']->table('member_price') . " AS mp " . "ON mp.goods_id = g.goods_id AND mp.user_rank = '{$_SESSION['user_rank']}' " . "WHERE g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0 " . $in_goods . "ORDER BY g.sort_order, g.last_update DESC";
$res = $db->SelectLimit($sql, 4);
/* 获取品牌 */
$sql = "SELECT b.brand_id, b.brand_name, b.brand_logo, COUNT(g.goods_id) AS goods_num " . " FROM " . $ecs->table('goods') . " AS g " . " LEFT JOIN " . $ecs->table('brand') . " AS b ON g.brand_id=b.brand_id " . " WHERE g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0 AND b.brand_id > 0 " . $in_goods . " GROUP BY g.brand_id ";
$brand_list = $db->getAll($sql);
foreach ($brand_list as $key => $val) {
    $brand_list[$key]['url'] = $url . '&amp;brand=' . $val['brand_id'];
}
/* 获取分类 */
$sql = "SELECT c.cat_id, c.cat_name, COUNT(g.goods_id) AS goods_num " . " FROM " . $ecs->table('goods') . " AS g " . " LEFT JOIN " . $ecs->table('category') . " AS c ON c.cat_id = g.cat_id " . " WHERE g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0  " . $in_goods . " GROUP BY g.cat_id ";
$cat_list = $db->getAll($sql);
foreach ($cat_list as $key => $val) {
示例#5
0
    ?>


	</tbody>
	</table>
	</div>
	<?php 
}
function jakoblist_dashboard()
{
    add_object_page('Bücherliste', 'Bücherliste', 10, 'jakoblist', 'jakoblist_manage');
    add_submenu_page('jakoblist', 'Verwalten', 'Bücherliste verwalten', 10, 'jakoblist', 'jakoblist_manage');
    add_submenu_page('jakoblist', 'Buch hinzufügen', 'Hinzufügen', 10, 'jakoblist_edit', 'jakoblist_edit');
    /*add_submenu_page('jakoblist', 'remove', 'remove', 10, 'jakoblist_remove', 'jakoblist_remove');*/
}
add_shortcode('jakoblist_output', 'jakoblist_output');
add_action('admin_menu', 'jakoblist_dashboard');
if ($_GET["func"] == "jakoblist_remove") {
    jakoblist_remove();
}
if ($_GET["func"] == "jakoblist_edit") {
    jakoblist_edit();
}
if ($_GET["func"] == "jakoblist_add") {
    jakoblist_add();
}
/*if ($_GET["func"] == 'search') jakoblist_search();*/
if (isset($_POST["search"])) {
    search_url();
}
/*if ($_GET["page"] == "jakoblist_edit") jakoblist_editt();*/
示例#6
0
// Si deux options de nom ont été entrées il y a un conflit donc on termine le programme
if (isset($nom) && $nom > 3) {
    echo "\nErreur: il ne peut y avoir qu'une seule option de nom\n";
    return;
}
// Si l'option l a été utilisée on vérifie que l'argument suivant est un nombre sinon on termine le programme
if (isset($nombre) && $nombre > 0) {
    if (nombre_correct($nombre, $argv)) {
        $nombre_image = intval($argv[2]);
        $argument++;
    } else {
        return;
    }
}
// On cherche toutes les URLs d'images et on les stocke dans un tableau
$images = search_url($argv, $argument);
echo "\n" . count($images) . " images vont être utilisées.\n\n";
// Si des images ont été trouvées
if (count($images) > 0) {
    // Si l'option s est utilisée on trie le tableau, les images seront donc triées selon leurs URLs
    if ($sort != 0) {
        sort($images);
    }
    $images_par_page = count($images);
    if ($nombre > 0) {
        $images_par_page = $nombre_image;
    }
    $x_max = get_x_max($images_par_page);
    $montage_image = create_montage_image($x_max);
    // Création du tableau qui permettra d'avoir une image dont la hauteur dépend de la colonne la plus grande
    $dimensions_colonne = [];
示例#7
0
    ?>
&sort=expanded">Expanded</a> | <a <?php 
    print $query_vars['sort'] == 'title' ? 'class="current-sort"' : "";
    ?>
 href="<?php 
    echo search_url($query_vars, array('sort'));
    ?>
&sort=title">Title</a>
		<?php 
    if ($section == 'housing') {
        ?>
    | <a <?php 
        print $query_vars['sort'] == 'map' ? 'class="current-sort"' : "";
        ?>
 href="<?php 
        echo search_url($query_vars, array('sort'));
        ?>
&sort=map">Map</a>
    <?php 
    }
    ?>
			<br />
		</div>
	<?php 
}
?>


<!-- <div id="search-query" class="text-center">
    <div id="sort-container">
    <div class="controls"> -->
/**
 * Prints a standard search form for users who don't want to create their own.
 * @param bool $echo Whether or not to echo the results.
 */
function library_search_form($echo = true)
{
    $options = get_option('nowReadingOptions');
    $html = '
	<form method="get" action="' . search_url(0) . '">
	';
    if (!$options['useModRewrite']) {
        $html .= '<input type="hidden" name="now_reading_search" value="1" />';
    }
    $html .= '
		<input type="text" name="q" /> <input type="submit" value="' . __("Search Library", NRTD) . '" />
	</form>
	';
    if ($echo) {
        echo $html;
    }
    return $html;
}
           	<h2><center>Disponibilité d'un ouvrage en BU</center></h2>
           	<br><br>
           	<br><center>
    	<?php 
        switch ($nb_select) {
            case 0:
                echo "Vous devez sélectionner au moins une localisation dans le fichier localisation.js !";
                break;
            default:
                echo "Différentes localisations possibles :<br>";
                ?>
                    	<?php 
                for ($i = 0; $i < sizeof($json['localisation']); $i++) {
                    if ($json['localisation'][$i]['select']) {
                        //preparation de l'URL :
                        $url = search_url($json['localisation'][$i]['URL'], $json['localisation'][$i]['type']);
                        ?>
                       		<a href="<?php 
                        echo $url;
                        ?>
"><?php 
                        echo $json['localisation'][$i]['name'];
                        ?>
</a>
                       		<br>
                     	<?php 
                    }
                }
                ?>
                     	</center>
                  	</form>