Ejemplo n.º 1
0
<?php

/**
 *      [PHPB2B] Copyright (C) 2007-2099, Ualink Inc. All Rights Reserved.
 *      The contents of this file are subject to the License; you may not use this file except in compliance with the License. 
 *
 *      @version $Revision: 2048 $
 */
if (!defined('IN_PHPB2B')) {
    exit('Not A Valid Entry Point');
}
uses("trade", "tradefield");
$trade = new Trades();
$trade_controller = new Trade();
$conditions = array();
$conditions[] = "Trade.status=1";
if (!empty($member->info['id'])) {
    $conditions[] = "Trade.member_id='" . $member->info['id'] . "'";
}
if (!empty($company->info['id'])) {
    $conditions[] = "Trade.company_id='" . $company->info['id'] . "'";
}
$amount = $trade->findCount(null, $conditions, "Trade.id");
setvar("TradeTypes", $tradetypes = $trade_controller->getTradeTypes());
setvar("TradeNames", $tradenames = $trade_controller->getTradeTypeNames());
setvar("paging", array('total' => $amount));
$space->render("offer");
Ejemplo n.º 2
0
        $vals['submit_time'] = $time_stamp;
        $vals['expire_days'] = 1;
        $vals['expire_time'] = $time_stamp + 24 * 3600 * $vals['expire_days'];
        $conditions[] = "status='1'";
        $result = $trade->save($vals, "update", $id, null, $conditions);
        if (!$result) {
            flash("action_failed");
        } else {
            flash("success");
        }
    }
}
if (isset($_POST['do']) && !empty($_POST['data']['trade'])) {
    pb_submit_check('data');
    $res = $_POST['data']['trade'];
    $now_offer_amount = $trade->findCount(null, "created>" . $today_start . " AND member_id=" . $the_memberid);
    if (isset($_POST['id'])) {
        $id = intval($_POST['id']);
    }
    if ($g['offer_check']) {
        $res['status'] = 0;
        $msg = 'msg_wait_check';
    } else {
        $res['status'] = 1;
        $msg = 'success';
    }
    if (!empty($_FILES['pic']['name'])) {
        $attach_id = empty($id) ? "offer-" . $the_memberid . "-" . ($trade->getMaxId() + 1) : "offer-" . $the_memberid . "-" . $id;
        $attachment->rename_file = $attach_id;
        $attachment->upload_process();
        $res['picture'] = $attachment->file_full_url;
Ejemplo n.º 3
0
        $vals['submit_time'] = $time_stamp;
        $vals['expire_days'] = 1;
        $vals['expire_time'] = $time_stamp + 24 * 3600 * $vals['expire_days'];
        $conditions[] = "status='1'";
        $result = $trade->save($vals, "update", $id, null, $conditions);
        if (!$result) {
            flash("action_failed");
        } else {
            flash("success");
        }
    }
}
if (isset($_POST['do']) && !empty($_POST['data']['trade'])) {
    pb_submit_check('data');
    $res = $_POST['data']['trade'];
    $now_offer_amount = $trade->findCount(null, "created>" . $today_start . " AND member_id=" . $_SESSION['MemberID']);
    if (isset($_POST['id'])) {
        $id = intval($_POST['id']);
    }
    if ($g['offer_check']) {
        $res['status'] = 0;
        $msg = 'msg_wait_check';
    } else {
        $res['status'] = 1;
        $msg = 'success';
    }
    if (!empty($_FILES['pic']['name'])) {
        $attach_id = empty($id) ? "offer-" . $_SESSION['MemberID'] . "-" . ($trade->getMaxId() + 1) : "offer-" . $_SESSION['MemberID'] . "-" . $id;
        $attachment->rename_file = $attach_id;
        $attachment->upload_process();
        $res['picture'] = $attachment->file_full_url;
Ejemplo n.º 4
0
 /**
  * search
  * @list
  */
 function lists()
 {
     global $G, $viewhelper, $pos;
     uses("trade", "industry", "area", "tradefield", "form", "tag");
     $trusttypes = cache_read("trusttype");
     $countries = cache_read("country");
     $membergroups = cache_read("membergroup");
     $area = new Areas();
     $offer = new Tradefields();
     $trade = new Trades();
     $form = new Forms();
     $industry = new Industries();
     $tag = new Tags();
     $conditions = array();
     $industry_id = $area_id = 0;
     $conditions[] = "t.status=1";
     !empty($_GET) && ($_GET = clear_html($_GET));
     if (isset($_GET['navid'])) {
         setvar("nav_id", intval($_GET['navid']));
     }
     $viewhelper->setTitle(L('offer', 'tpl'));
     $viewhelper->setPosition(L('offer', 'tpl'), "index.php?do=offer");
     $trade_types = cache_read("type", "offertype");
     if (isset($_GET['typeid'])) {
         $type_id = intval($_GET['typeid']);
         $conditions[] = "t.type_id='" . $type_id . "'";
         setvar("typeid", $type_id);
         $type_name = $trade_types[$type_id];
         $viewhelper->setTitle($type_name);
         $viewhelper->setPosition($type_name, "index.php?do=offer&action=lists&typeid=" . $type_id);
     }
     if (isset($_GET['industryid'])) {
         $industry_id = intval($_GET['industryid']);
         $tmp_info = $industry->setInfo($industry_id);
         if (!empty($tmp_info)) {
             $sub_ids = $industry->getSubDatas($tmp_info['id']);
             $sub_ids = array_keys($sub_ids);
             $conditions[] = "t.industry_id IN (" . implode(",", $sub_ids) . ")";
             $viewhelper->setTitle($tmp_info['name']);
             $viewhelper->setPosition($tmp_info['name'], "index.php?do=offer&action=lists&industryid=" . $tmp_info['id']);
         }
     }
     if (isset($_GET['areaid'])) {
         $area_id = intval($_GET['areaid']);
         $tmp_info = $area->setInfo($area_id);
         if (!empty($tmp_info)) {
             $sub_ids = $area->getSubDatas($tmp_info['id']);
             $sub_ids = array_keys($sub_ids);
             $conditions[] = "t.area_id IN (" . implode(",", $sub_ids) . ")";
             $viewhelper->setTitle($tmp_info['name']);
             $viewhelper->setPosition($tmp_info['name'], "index.php?do=offer&action=lists&areaid=" . $tmp_info['id']);
         }
     }
     if (isset($_GET['type'])) {
         if ($_GET['type'] == "urgent") {
             $conditions[] = "t.if_urgent='1'";
         }
     }
     if (!empty($_GET['price_start']) || !empty($_GET['price_end'])) {
         $conditions[] = "t.price BETWEEN " . intval($_GET['price_start']) . " AND " . intval($_GET['price_end']);
     }
     if (!empty($_GET['picture'])) {
         $conditions[] = "t.picture!=''";
     }
     if (!empty($_GET['urgent'])) {
         $conditions[] = "t.if_urgent=1";
     }
     if (!empty($_GET['commend'])) {
         $conditions[] = "t.if_commend=1";
     }
     if (!empty($_GET['country'])) {
         $conditions[] = "t.country_id='" . intval($_GET['country']) . "'";
     }
     if (!empty($_GET['sure'])) {
         $conditions[] = "m.trusttype_ids='" . intval($_GET['sure']) . "'";
     }
     if (!empty($_GET['date'])) {
         $d = intval($_GET['date']);
         if ($d <= 7948800) {
             $conditions[] = "t.submit_time<='" . intval($_GET['date']) . "'";
         }
     }
     if (isset($_GET['q'])) {
         $searchkeywords = $_GET['q'];
         $viewhelper->setTitle(L("search_in_keyword", "tpl", $searchkeywords));
         $viewhelper->setPosition(L("search_in_keyword", "tpl", $searchkeywords));
         $conditions[] = "t.title like '%" . $searchkeywords . "%'";
         setvar("highlight_str", $searchkeywords);
     }
     if (isset($_GET['pubdate'])) {
         switch ($_GET['pubdate']) {
             case "l3":
                 $conditions[] = "t.submit_time>" . ($offer->timestamp - 3 * 86400);
                 break;
             case "l10":
                 $conditions[] = "t.submit_time>" . ($offer->timestamp - 10 * 86400);
                 break;
             case "l30":
                 $conditions[] = "t.submit_time>" . ($offer->timestamp - 30 * 86400);
                 break;
             default:
                 break;
         }
     }
     if ($G['setting']['offer_expire_method'] == 2 || $G['setting']['offer_expire_method'] == 3) {
         $conditions[] = "t.expire_time>" . $offer->timestamp;
     }
     $amount = $trade->findCount(null, $conditions, null, "t");
     $result = $trade->getRenderDatas($conditions, $G['setting']['offer_filter']);
     $important_result = $trade->getStickyDatas();
     setvar("StickyItems", $important_result);
     setvar('items', $result);
     setvar('trusttype', $trusttypes);
     setvar('countries', $countries);
     setvar("paging", array('total' => $amount));
     render("offer/list");
 }
Ejemplo n.º 5
0
    }
    if (isset($_GET['pubdate'])) {
        switch ($_GET['pubdate']) {
            case "l3":
                $conditions[] = "t.submit_time>" . ($time_stamp - 3 * 86400);
                break;
            case "l10":
                $conditions[] = "t.submit_time>" . ($time_stamp - 10 * 86400);
                break;
            case "l30":
                $conditions[] = "t.submit_time>" . ($time_stamp - 30 * 86400);
                break;
            default:
                break;
        }
    }
}
if ($_PB_CACHE['setting']['offer_expire_method'] == 2 || $_PB_CACHE['setting']['offer_expire_method'] == 3) {
    $conditions[] = "t.expire_time>" . $time_stamp;
}
$amount = $trade->findCount(null, $conditions, null, "t");
$result = $trade->getRenderDatas($conditions, $_PB_CACHE['setting']['offer_filter']);
$important_result = $trade->getStickyDatas();
if (!empty($important_result)) {
    setvar("StickyItems", $important_result);
}
setvar('items', $result);
setvar('trusttype', $_PB_CACHE['trusttype']);
setvar('country', $_PB_CACHE['country']);
setvar("paging", array('total' => $amount));
render("offer/list");