예제 #1
0
function ws_search_events($state, $keyword, $past, $featured, $offset)
{
    $past_only = $past == 'y' ? true : false;
    $options = array('state' => $state, "past_zhaohus" => $past_only, 'past_only' => $past_only, 'offset' => $offset, 'limit' => ZHAOHU_MANAGER_SEARCH_LIST_LIMIT, 'featured_only' => $featured);
    $res = find_zhaohus_by_tag_title($options, $keyword);
    $entities = $res["entities"];
    $total_count = $res["count"];
    $count = count($entities);
    $events = array();
    if ($entities) {
        foreach ($entities as $entity) {
            $events[] = ws_entity2event($entity, false);
        }
    }
    $result = array();
    $result['entities'] = $events;
    $result['subtype'] = 'zhaohu';
    $result['count'] = $count;
    $result['batch_size'] = ZHAOHU_MANAGER_SEARCH_LIST_LIMIT;
    $result['has_more'] = $total_count > $offset + $count;
    $result['total_count'] = $total_count;
    return $result;
}
예제 #2
0
<?php

$state = get_input("state");
$city = get_input("city");
$tag = get_input("tag");
$past = get_input("past");
$offset = get_input("offset", 0);
$past_only = $past == 'y' ? true : false;
//$featured_zhaohu = get_input("featured", "n"); //featured=y
$unfeatured_only = get_input("unfeatured_only", "n");
$options = array('state' => $state, "past_zhaohus" => $past_only, 'past_only' => $past_only, 'offset' => $offset, 'limit' => ZHAOHU_MANAGER_SEARCH_LIST_LIMIT, 'unfeatured_only' => $unfeatured_only);
$res = find_zhaohus_by_tag_title($options, $tag);
//$res = find_zhaohus_feature_up($options, $tag);
$entities = $res["entities"];
$count = $res["count"];
if (!$entities) {
    $content = elgg_echo('zhaohu:noresults');
} else {
    $content = elgg_view("zhaohu_manager/findResult", array("entities" => $entities, "count" => $count, "offset" => $offset, "limit" => ZHAOHU_MANAGER_SEARCH_LIST_LIMIT));
}
echo $content;
exit;
예제 #3
0
function find_zhaohus_feature_up($options, $tag)
{
    $options['featured_only'] = 'y';
    $featured_res = find_zhaohus_by_tag_title($options, $tag);
    $featured_entities = $featured_res["entities"];
    $featured_count = $featured_res["count"];
    $featured_guids = array_map("zhaohu_guid_callback", $featured_entities);
    $options['featured_only'] = 'n';
    $res = find_zhaohus_by_tag_title($options, $tag);
    $entities = $res["entities"];
    $count = $res["count"];
    foreach ($entities as $key => $entity) {
        if (in_array($entity->guid, $featured_guids)) {
            unset($entities[$key]);
        }
    }
    $merged = $featured_entities ? array_merge($featured_entities, $entities) : $entities;
    $result = array("entities" => $merged, "count" => $count);
    return $result;
}