示例#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");
示例#2
0
 */
require "../libraries/common.inc.php";
require "room.share.php";
require PHPB2B_ROOT . 'libraries/page.class.php';
check_permission("offer");
$tpl_file = "offer";
$page = new Pages();
uses("trade", "tradefield", "product", "tag", "attachment", "form", "typeoption", "point", "industry", "area");
$attachment = new Attachment("pic");
$area = new Areas();
$industry = new Industries();
$form = new Forms();
$point = new Points();
$tradefield = new Tradefields();
$tag = new Tags();
$trade = new Trades();
$trade_controller = new Trade();
$typeoption = new Typeoption();
$conditions = array();
$conditions[] = "member_id = " . $the_memberid;
setvar("TradeTypes", $trade_controller->getTradeTypes());
setvar("TradeNames", $trade_controller->getTradeTypeNames());
$tmp_personalinfo = $memberinfo;
setvar("MemberInfo", $tmp_personalinfo);
$expires = $trade_controller->getOfferExpires();
setvar("TradeTypes", $trade_controller->getTradeTypes());
setvar("PhoneTypes", $typeoption->get_cache_type("phone_type"));
setvar("ImTypes", $typeoption->get_cache_type("im_type"));
setvar("OfferExpires", $expires);
setvar("Countries", $countries = cache_read("country"));
if (isset($company_id)) {
示例#3
0
/**
 *      [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: 2116 $
 */
function smarty_block_offer($params, $content, &$smarty, &$repeat)
{
    global $_PB_CACHE;
    $conditions[] = "t.status='1'";
    $param_count = count($smarty->_tag_stack);
    if (empty($params['name'])) {
        $params['name'] = "offer";
    }
    if (!class_exists("Trades")) {
        uses("trade");
        $trade = new Trades();
        $trade_controller = new Trade();
    } else {
        $trade = new Trades();
        $trade_controller = new Trade();
    }
    if ($_PB_CACHE['setting']['offer_expire_method']) {
        switch ($_PB_CACHE['setting']['offer_expire_method']) {
            case "2":
                $conditions[] = "t.expire_time>" . $trade->timestamp;
                break;
            case "3":
                $conditions[] = "t.expire_time>" . $trade->timestamp;
                break;
            default:
                break;
        }
    }
    if (isset($params['type'])) {
        $type = explode(",", $params['type']);
        $type = array_unique($type);
        foreach ($type as $val) {
            switch ($val) {
                case 'image':
                    $conditions[] = "t.picture!=''";
                    break;
                case 'urgent':
                    $conditions[] = "t.if_urgent='1'";
                    break;
                case 'company':
                    $conditions[] = "t.company_id>0";
                    break;
                case 'commend':
                    $conditions[] = "t.if_commend>0";
                    break;
                default:
                    break;
            }
        }
    }
    if (isset($params['industryid'])) {
        if (isset($params['depth'])) {
            $depth = intval($params['depth']);
            if ($depth) {
                if (class_exists("Industries")) {
                    $industry = new Industries();
                    $industry_controller = new Industry();
                } else {
                    uses("industry");
                    $industry = new Industries();
                    $industry_controller = new Industry();
                }
                $ids_s = $industry->getConditionIds($params['industryid']);
                if (is_array($ids_s)) {
                    $ids_s = array_filter($ids_s);
                    $conditions['industry'] = "t.industry_id IN (" . implode(",", $ids_s) . ")";
                } else {
                    $conditions['industry'] = "t.industry_id='" . $ids_s . "'";
                }
            }
        } else {
            $conditions[] = "t.industry_id = '" . $params['industryid'] . "'";
        }
    }
    if (isset($params['areaid'])) {
        if (isset($params['depth'])) {
            $depth = intval($params['depth']);
            if ($depth) {
                global $industry;
                $ids_s = $industry->getConditionIds($params['areaid']);
                if (is_array($ids_s)) {
                    $ids_s = array_filter($ids_s);
                    $conditions['area'] = "t.area_id IN (" . implode(",", $ids_s) . ")";
                } else {
                    $conditions['area'] = "t.area_id='" . $ids_s . "'";
                }
            }
        } else {
            $conditions['area'] = "t.area_id = '" . $params['areaid'] . "'";
        }
    }
    if (!empty($_GET['industryid'])) {
        $conditions['industry'] = "t.industry_id=" . intval($_GET['industryid']);
    }
    if (!empty($_GET['areaid'])) {
        $conditions['area'] = "t.area_id=" . intval($_GET['areaid']);
    }
    if (isset($params['exclude'])) {
        $conditions[] = $trade->getExcludeIds($params['exclude']);
    }
    if (isset($params['include'])) {
        $conditions[] = $trade->getIncludeIds($params['include']);
    }
    if (isset($params['country_id'])) {
        $conditions[] = "t.country_id='" . $params['country_id'] . "'";
    }
    if (isset($params['expday'])) {
        $conditions[] = "t.expire_time<'" . ($params['expday'] * 86400 + $trade->timestamp) . "'";
    }
    if (isset($params['subday'])) {
        $conditions[] = "t.submit_time>'" . ($trade->timestamp - $params['expireday'] * 86400) . "'";
    }
    if (isset($params['typeid'])) {
        if (!empty($params['typeid'])) {
            if (strpos($params['typeid'], ",") > 0) {
                $tmp_ids = explode(",", $params['typeid']);
                $conditions[] = "t.type_id in ('" . implode("','", $tmp_ids) . "')";
            } else {
                $conditions[] = "t.type_id='" . $params['typeid'] . "'";
            }
        }
    }
    if (isset($params['urgent'])) {
        $conditions[] = "t.if_urgent='1'";
    }
    if (!empty($params['memberid'])) {
        $conditions[] = "t.member_id='" . $params['memberid'] . "'";
    }
    if (!empty($params['companyid'])) {
        $conditions[] = "t.company_id='" . $params['companyid'] . "'";
    }
    if (isset($params['cash'])) {
        $conditions[] = "t.require_point>0";
    }
    $trade->setCondition($conditions);
    $orderby = null;
    $orderby = isset($params['orderby']) ? " ORDER BY " . trim($params['orderby']) . " " : " ORDER BY modified DESC";
    $limit = $offset = 0;
    if (isset($params['row'])) {
        $limit = $params['row'];
    }
    if (isset($params['start'])) {
        $offset = $params['start'];
    }
    if (isset($_GET['pos'])) {
        $offset = intval($_GET['pos']);
    }
    $trade->setLimitOffset($offset, $limit);
    $mysql_limit = $trade->getLimitOffset();
    if (isset($params['limit'])) {
        $mysql_limit = " " . trim($params['limit']);
    }
    if (!$params['recursive']) {
        $sql = "SELECT *,title as name,title as fulltitle,content as fullcontent FROM {$trade->table_prefix}trades t " . $trade->getCondition() . "{$orderby}" . $mysql_limit;
    } else {
        $sql = "SELECT *,content as fullcontent FROM {$trade->table_prefix}trades t " . $trade->getCondition() . " ORDER BY t.display_order ASC,t.id DESC" . $mysql_limit;
    }
    $offer_typenames = $trade_controller->getTradeTypes();
    if (empty($smarty->blockvars[$param_count])) {
        $smarty->blockvars[$param_count] = $trade->GetArray($sql);
        if (!$smarty->blockvars[$param_count]) {
            return $repeat = false;
        }
    }
    if (!function_exists("smarty_function_the_url")) {
        require "function.the_url.php";
    }
    if (list($key, $item) = each($smarty->blockvars[$param_count])) {
        $repeat = true;
        $item['rownum'] = $key;
        $item['iteration'] = ++$key;
        $url = smarty_function_the_url(array("id" => $item['id'], "typeid" => $item['type_id'], "module" => "offer"));
        $item['url'] = $url;
        $item['title'] = strip_tags($item['title']);
        $item['content'] = strip_tags($item['content']);
        if (isset($params['titlelen'])) {
            $item['title'] = mb_substr($item['title'], 0, $params['titlelen']);
        }
        if (isset($params['infolen'])) {
            $item['content'] = mb_substr($item['content'], 0, $params['infolen']);
        }
        if (isset($params['titlestart'])) {
            $item['title'] = $params['titlestart'] . $item['title'];
        }
        $item['pubdate'] = df($item['submit_time']);
        $item['typeid'] = $item['type_id'];
        $item['typename'] = $offer_typenames[$item['type_id']];
        $item['src'] = $item['thumb'] = URL . "attachment/" . $item['picture'] . ".small.jpg";
        $item['link'] = '<a title="' . $item['fulltitle'] . '" href="' . $url . '">' . $item['title'] . '</a>';
        $item['style'] = parse_highlight($item['highlight']);
        $smarty->assign($params['name'], $item);
    } else {
        $repeat = false;
        reset($smarty->blockvars[$param_count]);
    }
    if (!is_null($content)) {
        print $content;
    }
    if (!$repeat) {
        $smarty->blockvars[$param_count] = array();
    }
}
示例#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");
 }
示例#5
0
<?php

/**
 * PHPB2B :  Opensource B2B Script (http://www.phpb2b.com/)
 * Copyright (C) 2007-2010, Ualink. All Rights Reserved.
 * 
 * Licensed under The Languages Packages Licenses.
 * Support : phpb2b@hotmail.com
 * 
 * @version $Revision: 1393 $
 */
require "../libraries/common.inc.php";
require "room.share.php";
uses("trade");
$trade = new Trade();
$trade_model = new Trades();
if (isset($_POST['del'])) {
    pb_submit_check('id');
    $ids = implode(",", $_POST['id']);
    $ids = "(" . $ids . ")";
    $sql = "DELETE FROM {$tb_prefix}favorites WHERE id IN " . $ids . " AND member_id=" . $_SESSION['MemberID'];
    $res = $pdb->Execute($sql);
    if (!$res) {
        flash("action_failed");
    }
}
if (isset($_POST['do']) && isset($_POST['id'])) {
    if ($trade_model->checkExist($_POST['id'])) {
        $sql = "INSERT INTO {$tb_prefix}favorites (target_id,member_id,type_id,created,modified) VALUE (" . $_POST['id'] . "," . $_SESSION['MemberID'] . ",1," . $time_stamp . "," . $time_stamp . ")";
        $result = $pdb->Execute($sql);
    }
示例#6
0
 public function actionTrades()
 {
     $trades = Trades::model()->findAll();
     Yii::app()->clientScript->registerCoreScript('jquery');
     Yii::app()->clientScript->registerCoreScript('ajaxupload');
     Yii::app()->clientScript->registerCoreScript('datatables');
     Yii::app()->clientScript->registerCoreScript('jTruncate');
     Yii::app()->clientScript->registerCssFile('/css/jquery.dataTables.min.css');
     $this->render('trades', array('trades' => $trades));
 }
示例#7
0
 function getInstance()
 {
     $_this_class = get_class();
     if (!isset(self::$instance[get_class()])) {
         self::$instance = new $_this_class();
     }
     return self::$instance;
 }
示例#8
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: 2075 $
 */
require "../libraries/common.inc.php";
require "room.share.php";
uses("trade", "product");
check_permission("offer");
$product = new Products();
$trade = new Trades();
$trade_controller = new Trade();
$trade_type_names = $trade_controller->getTradeTypes();
$conditions = "member_id = " . $the_memberid;
$amount = $pdb->GetArray("select Trade.type_id as TradeTypeId,count(Trade.id) as CountTrade from " . $trade->getTable(true) . " where " . $conditions . " group by Trade.type_id");
if (is_array($amount)) {
    $stats = array();
    foreach ($amount as $val) {
        $stats[$val['TradeTypeId']] = array("Amount" => $val['CountTrade'], "name" => $trade_type_names[$val['TradeTypeId']]);
    }
}
setvar("UserTradeStat", $stats);
setvar("ProductAmount", $product->findCount(null, $conditions, "Product.id"));
template("stat");
示例#9
0
 public function actionTradeSubmit()
 {
     $cart = new EShoppingCart();
     $cart->init();
     $positions = $cart->getPositions();
     $tradeInfo = "";
     foreach ($positions as $position) {
         if ($position->id != 100) {
             //если это не доставка
             $tradeInfo = $tradeInfo . $position->name . "  " . $tradeInfo . $position->article . " " . $position->attributes . "   -" . $position->count . "шт  (цена за шт.:" . $position->priceForThisCount / $position->count . "р.)  :" . $position->priceForThisCount . "р.\r\n";
         }
     }
     $trade = new Trades();
     $trade->name = $_POST["name"];
     $trade->phone = $_POST["phone"];
     $trade->email = $_POST["email"];
     $trade->address = $_POST["address"];
     $trade->paymentType = $_POST["paymentType"];
     $trade->tradeInfo = $tradeInfo;
     $trade->date = new CDbExpression('NOW()');
     $trade->totalPrice = $_POST["totalPrice"];
     $res = $trade->save();
     if ($res == false) {
         echo "error";
         return;
     }
     $message = "Поступила новвый заказ!\r\n\r\n" . "Номер заказа: " . $trade->id . "\r\n\r\n" . $tradeInfo . "\r\n\r\n";
     $message = $message . "Доставка";
     if ($_POST["address"] == "") {
         $message = $message . ":\r\nсамовывоз";
     } else {
         $message = $message . " +200р.\r\nАдрес:" . $_POST["address"];
     }
     $message = $message . "\r\n\r\nИтого: " . $_POST["totalPrice"] . "р.";
     if ($_POST["paymentType"] == "nal") {
         $message = $message . "\r\n\r\nОплата наличными.";
     } else {
         $message = $message . "\r\n\r\nОплата онлайн.";
     }
     $message = $message . "\r\n\r\nКонтакты:\r\nИмя:" . $_POST["name"] . "\r\nТелефон:" . $_POST["phone"] . "\r\nEmail:" . $_POST["email"];
     mail("*****@*****.**", "Dominanta:Поступила новвый заказ!", $message);
     echo $trade->id;
 }
示例#10
0
 function setInfoById($id)
 {
     $_this =& Trades::getInstance();
     $this->info = $_this->getInfoById($id);
 }
示例#11
0
 *      [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 $
 */
define('CURSCRIPT', 'detail');
require "../libraries/common.inc.php";
require "../share.inc.php";
$positions = $titles = array();
uses("trade", "member", "company", "tradefield", "form", "typeoption", "industry", "area");
$offer = new Tradefields();
$area = new Areas();
$industry = new Industries();
$company = new Companies();
$trade = new Trade();
$trade_model = new Trades();
$member = new Members();
$typeoption = new Typeoption();
$form = new Forms();
setvar("Genders", $typeoption->get_cache_type('gender'));
setvar("PhoneTypes", $typeoption->get_cache_type('phone_type'));
$viewhelper->setTitle(L("offer", "tpl"));
$viewhelper->setPosition(L("offer", "tpl"), "offer/");
if (isset($_GET['title'])) {
    $title = rawurldecode(trim($_GET['title']));
    $res = $trade_model->findByTitle($title);
    $id = $res['id'];
}
if (isset($_GET['id'])) {
    $id = intval($_GET['id']);
}
示例#12
0
 */
require "../libraries/common.inc.php";
require LIB_PATH . 'time.class.php';
uses("trade", "tag", "tradefield", "attachment", "keyword", "membertype", "setting", "typeoption", "area", "industry");
require PHPB2B_ROOT . 'libraries/page.class.php';
require "session_cp.inc.php";
$attachment = new Attachment('pic');
$area = new Areas();
$industry = new Industries();
$setting = new Settings();
$membertype = new Membertypes();
$offer = new Tradefields();
$tag = new Tags();
$keyword = new Keywords();
$typeoption = new Typeoption();
$trade = new Trades();
$trade_controller = new Trade();
$tpl_file = "offer";
$conditions = array();
$page = new Pages();
$trade_names = $trade_controller->getTradeTypes();
setvar("TradeTypes", $trade_names);
if (isset($_POST['batch_commend'])) {
    flash("success");
}
if (isset($_POST['refresh']) && !empty($_POST['id'])) {
    $result = $trade->refresh($_POST['id']);
    if (!$result) {
        flash();
    } else {
        flash("success");
示例#13
0
 */
define('CURSCRIPT', 'post');
require "../libraries/common.inc.php";
require "../share.inc.php";
require LIB_PATH . "validation.class.php";
$validate = new Validation();
if (session_id() == '') {
    require_once LIB_PATH . "session_php.class.php";
    $session = new PbSessions();
}
uses("trade", "member", "tradefield", "tag", "typeoption");
$tag = new Tags();
$offer = new Tradefields();
$typeoption = new Typeoption();
$member = new Members();
$trade = new Trades();
$trade_controller = new Trade();
$tradefield = new Tradefields();
$expires = $trade_controller->getOfferExpires();
setvar("Genders", $typeoption->get_cache_type("gender", null, array("0", "-1")));
setvar("PhoneTypes", $typeoption->get_cache_type("phone_type"));
setvar("ImTypes", $typeoption->get_cache_type("im_type"));
$if_visit_post = $_PB_CACHE['setting']['vis_post'];
if (!$if_visit_post) {
    $smarty->flash('visitor_forbid', URL, 0);
}
capt_check("capt_post_free");
if (isset($_POST['visit_post'])) {
    pb_submit_check('visit_post');
    $trade->setParams();
    $tradefield->setParams();
示例#14
0
/**
 *      [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 $
 */
define('CURSCRIPT', 'list');
require "../libraries/common.inc.php";
require "../share.inc.php";
uses("trade", "industry", "area", "tradefield", "form");
require CACHE_PATH . 'cache_trusttype.php';
require CACHE_PATH . 'cache_country.php';
require CACHE_PATH . 'cache_membergroup.php';
$area = new Areas();
$offer = new Tradefields();
$trade = new Trades();
$trade_controller = new Trade();
$form = new Forms();
$industry = new Industries();
$conditions = array();
$industry_id = $area_id = 0;
$conditions[] = "t.status=1";
if (isset($_GET['navid'])) {
    setvar("nav_id", intval($_GET['navid']));
}
uses("tag");
$tag = new Tags();
$viewhelper->setTitle(L('offer', 'tpl'));
$viewhelper->setPosition(L('offer', 'tpl'), "offer/");
if (isset($_GET['typeid'])) {
    $type_id = intval($_GET['typeid']);