Пример #1
0
function getActivities($begin, $end, $results, $conn)
{
    $cnt = 0;
    $resArr = array();
    foreach ($results as $key => $value) {
        if ($cnt < $begin) {
            $cnt++;
            continue;
        }
        if ($cnt == $end) {
            break;
        }
        $timeTips = activityBeginTime($value['begin_date'], $value['end_date']);
        $value['timeTips'] = $timeTips;
        array_push($resArr, $value);
        $cnt++;
    }
    $row_json = json_encode($resArr, JSON_UNESCAPED_UNICODE);
    echo $row_json;
}
Пример #2
0
function printActivityContent($row)
{
    $windowWidth = $_COOKIE["width"];
    $realImageWidth = PIC_WIDTH;
    $realImageHeight = PIC_HEIGHT;
    $imagesWidth = $windowWidth;
    $imagesHeight = $realImageHeight * ($imagesWidth * 1.0 / $realImageWidth);
    // 调用活动开始时间
    $beginTimeTips = activityBeginTime($row['begin_date'], $row['end_date']);
    $ex = $row['direct_link'];
    $list_id = $row["id"];
    echo "<div class=\"items\">";
    echo "<div class=\"items_pic\">";
    if ($ex != null) {
        echo "<a href=\"{$ex}\" class=\"activityLink\" data-id={$list_id} onclick=\"count({$list_id})\">";
    } else {
        echo "<a href=\"activityDetail.php?activityID=" . $row["id"] . "&title=" . urlencode($row["title"]) . "\" class=\"activityLink\" data-id={$list_id} onclick=\"count({$list_id})\">";
    }
    echo "<img class=\"lazy\" src=\"../images/grey.gif\" data-original=\"" . $row["activity_show_pic"] . "\" style=\"width:100%; height:" . $imagesHeight . "px;\">";
    $colorClass = timeLabelColor($beginTimeTips);
    echo "<div class=\"time_valid_label {$colorClass}\">";
    echo "<div class=\"cont\">";
    echo "<img class='time_icon' src='../images/countTime.png'>";
    echo "<p class=\"main_cont\">";
    echo $beginTimeTips;
    echo "</p>";
    echo "</div>";
    echo "</div>";
    echo "<div class=\"items_shadow\">";
    echo "<div class=\"shadow_cont\">";
    echo "<p class=\"shadow_cont_title\">";
    echo $row['title'];
    echo "</p>";
    echo "<p class=\"activity_subhead\">";
    echo $row['subhead'];
    echo "</p>";
    echo "<div class=\"shadow_cont_footer\">";
    echo "<ul>";
    echo "<li class=\"li_date li_width_22\">";
    echo "<img class=\"li_icon\" src=\"../images/date.png\">";
    echo "<span class='li_text'>";
    echo substr($row['begin_date'], 5, 5);
    echo "</span>";
    echo "</li>";
    echo "<li class=\"li_collect li_width_16\">";
    echo "<img class=\"li_icon\" src=\"../images/fav.png\">";
    echo "<span class='li_text'>";
    echo showFavNum($row['fav_num']);
    echo "</span>";
    echo "</li>";
    echo "<li class=\"li_price li_width_28\">";
    echo "<img class=\"li_icon\" src=\"../images/fee.png\">";
    echo "<span class='li_text'>";
    echo $row['fee'];
    echo "</span>";
    echo "</li>";
    echo "<li class=\"li_hold li_width_34\">";
    echo "<img class=\"li_icon\" src=\"../images/hold.png\">";
    echo "<span class='li_text'>";
    echo $row['company'];
    echo "</span>";
    echo "</li>";
    echo "</ul>";
    echo "</div>";
    echo "</div>";
    echo "</div>";
    echo "</a>";
    echo "</div>";
    echo "</div>";
}