Example #1
0
 public function getInstance()
 {
     if (self::$instance == NULL) {
         // If instance is not created yet, will create it.
         self::$instance = new PbModel();
     }
     return self::$instance;
 }
Example #2
0
 function Productcategories()
 {
     parent::__construct();
 }
Example #3
0
 function Productprices()
 {
     parent::__construct();
 }
Example #4
0
 function Countries()
 {
     parent::__construct();
 }
Example #5
0
 function Tags()
 {
     parent::__construct();
 }
Example #6
0
 function Keywords()
 {
     parent::__construct();
 }
Example #7
0
 function Settings()
 {
     $class_name = $this->name;
     $this->Setting =& new $class_name();
     parent::__construct();
 }
Example #8
0
 function Companies()
 {
     parent::__construct();
     $this->validate['name']['message'] = L("please_input_companyname");
     $this->validate['description']['message'] = L("please_input_companydesc");
 }
Example #9
0
 function PromotionCustomers()
 {
     parent::__construct();
 }
Example #10
0
 function Expotypes()
 {
     parent::__construct();
 }
Example #11
0
 function Membergroups()
 {
     parent::__construct();
 }
Example #12
0
 function Promotions()
 {
     parent::__construct();
 }
Example #13
0
 function Friendlinks()
 {
     parent::__construct();
 }
Example #14
0
         $condition[] = 'status=1';
         if (!empty($search_word)) {
             $condition[] = "title LIKE '%{$search_word}%'";
         }
         break;
 }
 $search_controller = new PbController();
 $model_name = htmlspecialchars($do, ENT_QUOTES);
 $model_name = strtolower($search_controller->pluralize(ucwords($model_name)));
 if (!empty($_GET['id'])) {
     $id = intval($_GET['id']);
     $result = $pdb->GetRow("SELECT *" . $extra . " FROM " . $tb_prefix . $model_name . " WHERE id=" . $id);
     setvar("item", $result);
     $tpl_file = "wap/detail";
 } else {
     $model_common = new PbModel();
     $model_common->setCondition($condition);
     //pager
     $pagesize = 10;
     $page = isset($_GET["page"]) ? intval($_GET["page"]) : 1;
     $total = $pdb->GetOne("SELECT count(id) FROM " . $tb_prefix . $model_name . $model_common->getCondition());
     $pagecount = ceil($total / $pagesize);
     if ($page > $pagecount) {
         $page = $pagecount;
     }
     if ($page <= 0) {
         $page = 1;
     }
     $offset = ($page - 1) * $pagesize;
     $pre = $page - 1;
     $next = $page + 1;
Example #15
0
 function Spaces()
 {
     parent::__construct();
 }
Example #16
0
 function Helps()
 {
     parent::__construct();
 }
Example #17
0
 function Markets()
 {
     parent::__construct();
 }
Example #18
0
 function Adzones()
 {
     parent::__construct();
 }
Example #19
0
 function Requests()
 {
     parent::__construct();
 }
Example #20
0
 function Mgame_outs()
 {
     parent::__construct();
 }
Example #21
0
 function Adminfields()
 {
     parent::__construct();
 }
Example #22
0
 function Brands()
 {
     parent::__construct();
 }
Example #23
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: 2075 $
 */
function smarty_block_getdata($params, $content, Smarty_Internal_Template $sTemplate, &$repeat)
{
    $conditions = $orderbys = array();
    $mysql_limit = $mysql_orderby = $image_col = $_seperate = '';
    $target = "_blank";
    extract($params);
    if (!isset($params['assign'])) {
        $assign = 'row';
    }
    if (!empty($params['name'])) {
        $assign = trim($params['name']);
    }
    $C = new PbController();
    $M = new PbModel();
    $M->condition = '';
    //Initial any last conditions
    $_table = $params['module'];
    switch ($params['module']) {
        case "offer":
        case "trade":
            $_table = "trade";
            break;
        case "fair":
        case "expo":
            $_table = "expo";
            break;
        case "announce":
            $_table = "announcement";
            break;
        case "ads":
            $_table = "adses";
            break;
        case "adword":
            $_table = "spread";
            break;
        case "price":
            $_table = "productprice";
            break;
        case "adses":
            break;
        default:
            break;
    }
    if (method_exists($sTemplate, 'get_template_vars')) {
        $_bindex = $sTemplate->getTemplateVars('_bindex');
    } else {
        $_bindex = $sTemplate->getVariable('_bindex')->value;
    }
    if (!$_bindex) {
        $_bindex = array();
    }
    if (isset($params['name'])) {
        if (!isset($_bindex[$params['name']])) {
            $_bindex[$params['name']] = 1;
        } else {
            $_bindex[$params['name']]++;
        }
    }
    $sTemplate->assign('_bindex', $_bindex);
    if (!isset($sTemplate->block_data)) {
        $sTemplate->block_data = array();
    }
    $iTags = count($sTemplate->_tag_stack);
    /**
     * set condition
     */
    $limit = $offset = 0;
    if (isset($params['row'])) {
        $limit = $params['row'];
    }
    if (isset($params['start'])) {
        $offset = $params['start'];
    }
    if (isset($_GET['pos'])) {
        $_pos = intval($_GET['pos']);
        $offset = ceil($_pos / $limit) * $row;
    }
    if (!empty($params['flag'])) {
        $conditions[] = "flag='" . $params['flag'] . "'";
    }
    if ($_table == "industry" or $_table == "area") {
        if (isset($params['parentid'])) {
            if (!empty($params['parentid'])) {
                $conditions['parentid'] = "parent_id='" . intval($params['parentid']) . "' OR id=" . intval($params['parentid']);
            } else {
                $conditions['parentid'] = "parent_id=0";
            }
        } else {
            $conditions['parentid'] = "parent_id=0";
        }
    }
    if (!empty($params['level'])) {
        if ($_table == "newstype") {
            $conditions[] = "level_id='" . $params['level'] . "'";
        } else {
            $conditions[] = "level='" . $params['level'] . "'";
        }
    }
    if (isset($params['type'])) {
        $type = explode(",", $params['type']);
        $type = array_unique($type);
        foreach ($type as $val) {
            switch ($val) {
                case 'image':
                    if ($module == "friendlink") {
                        $image_col = "logo";
                    } else {
                        $image_col = "picture";
                    }
                    $conditions[] = "{$image_col}!=''";
                    break;
                case 'hot':
                    $orderbys[] = "hits DESC";
                    break;
                case 'commend':
                    $conditions[] = "if_commend='1'";
                    break;
                default:
                    break;
            }
        }
    }
    if (isset($params['exclude'])) {
        $conditions[] = $M->getExcludeIds($params['exclude']);
    }
    if (isset($params['include'])) {
        $conditions[] = $M->getIncludeIds($params['include']);
    }
    if (isset($params['orderby'])) {
        $orderbys[] = trim($params['orderby']);
    }
    if (!empty($row) && $row != 'all' && $row != -1) {
        $M->setLimitOffset($offset, $limit);
        $mysql_limit = $M->getLimitOffset();
    }
    if (!empty($params['limit'])) {
        $mysql_limit = " " . trim($params['limit']);
    }
    if (!empty($_GET['producttypeid'])) {
        $conditions[] = "type_id=" . intval($_GET['producttypeid']);
    }
    if (!empty($params['companyid'])) {
        $conditions[] = "company_id=" . intval($params['companyid']);
    }
    if (!empty($params['industryid'])) {
        $conditions[] = "industry_id=" . intval($params['industryid']);
    }
    if (!empty($params['typeid'])) {
        if ($_table == 'adses') {
            $conditions[] = "adzone_id=" . intval($params['typeid']);
        } else {
            $conditions[] = "type_id=" . intval($params['typeid']);
        }
    }
    if (empty($sTemplate->block_data[$iTags])) {
        # ************************************************************************
        # Main content
        $M->setCondition($conditions);
        $M->setOrderby($orderbys);
        $sql = sprintf("SELECT * FROM %s%s %s %s %s", $M->table_prefix, $C->pluralize($_table), $M->getCondition(), $M->getOrderby(), $mysql_limit);
        $sTemplate->block_data[$iTags] = $M->GetArray($sql);
        //如果没有数据,那就不用再执行了(repeat)
        if (!$sTemplate->block_data[$iTags]) {
            return $repeat = false;
        }
        if (isset($stat)) {
            $_total_count = $M->dbstuff->GetOne(sprintf("SELECT count(*) FROM %s%s %s", $M->table_prefix, $C->pluralize($_table), $M->getCondition()));
            $sTemplate->assign('total_count', $_total_count);
            $sTemplate->assign("paging", array('total' => $_total_count));
        }
        # End main content
        # ************************************************************************
    }
    if (!$sTemplate->block_data[$iTags]) {
        $repeat = false;
        return '';
    }
    if (!function_exists("smarty_function_the_url")) {
        require "function.the_url.php";
    }
    $counts = count($sTemplate->block_data[$iTags]);
    if (list($key, $item) = each($sTemplate->block_data[$iTags])) {
        $_title = $_title_full = $_content = $_content_full = '';
        $item['rownum'] = $key;
        $item['iteration'] = ++$key;
        if (!empty($item['url'])) {
            $url = $item['url'];
        } else {
            $url = smarty_function_the_url(array("do" => $module, "id" => $item['id'], "action" => 'detail'));
        }
        if ($module == "company") {
            $url = smarty_function_the_url(array("id" => $item['id'], "do" => "company", "userid" => $item['cache_spacename']));
        } elseif ($module == "tag") {
            $url = smarty_function_the_url(array("do" => "product", "action" => 'lists', "q" => $item['name']));
        }
        $item['url'] = $url;
        if (isset($item['title'])) {
            $_title = $item['name'] = $item['title'];
        } elseif (isset($item['name'])) {
            $_title = $item['title'] = $item['name'];
        } elseif (isset($item['subject'])) {
            $_title = $item['title'] = $item['subject'];
        } elseif (isset($item['word'])) {
            $_title = $item['title'] = $item['word'];
        }
        $_title_full = $_title;
        $item['title'] = $_title = strip_tags(pb_lang_split($_title));
        $_title_full = strip_tags(pb_lang_split($_title_full));
        if (!empty($titlelen)) {
            $_title = mb_substr($_title, 0, $titlelen);
        }
        if (isset($item['description'])) {
            $_content = $item['description'];
        } elseif (isset($item['content'])) {
            $_content = $item['content'];
        }
        if (isset($item['clicked'])) {
            $item['hits'] = $item['clicked'];
        }
        $_content_full = $_content;
        if (!empty($_content) && isset($infolen)) {
            $_content = mb_substr($_content, 0, $infolen);
        }
        if (isset($item['created'])) {
            $item['pubdate'] = df($item['created'], "m-d");
        } elseif (isset($item['submit_time'])) {
            $item['pubdate'] = df($item['submit_time']);
        }
        if (!empty($params['sep'])) {
            $_seperate = $params['sep'];
        }
        $item['content'] = $_content = strip_tags(pb_lang_split($_content));
        //		if($seperate) $_title = ($key==$counts-1)?$_title:$_title.$seperate;
        $item['link'] = '<a title="' . $_title_full . '" href="' . $url . '" target="' . $target . '">' . $_title . '</a>' . $_seperate;
        $media_url = '';
        if (!empty($item['picture'])) {
            $media_url = $item['picture'];
            if (!empty($media_url)) {
                $item['thumb'] = $item['src'] = pb_get_attachmenturl($media_url, '', 'small');
            }
        }
        if (!empty($item['source_url'])) {
            $media_url = $item['source_url'];
            if (!empty($media_url)) {
                $item['thumb'] = $item['src'] = $media_url;
            }
        }
        if (isset($item['highlight'])) {
            $item['style'] = parse_highlight($item['highlight']);
        }
        $sTemplate->assign($assign, $item);
        $repeat = true;
    } else {
        $repeat = false;
        reset($sTemplate->block_data[$iTags]);
        if (isset($params['name'])) {
            unset($_bindex[$params['name']]);
            $sTemplate->assign('_bindex', $_bindex);
        }
    }
    if (!is_null($content)) {
        print $content;
    }
    if (!$repeat) {
        $sTemplate->block_data[$iTags] = array();
    }
}
Example #24
0
 function Newstypes()
 {
     parent::__construct();
 }
Example #25
0
 function Dicts()
 {
     parent::__construct();
 }
Example #26
0
 function Tradetypes()
 {
     parent::__construct();
 }
Example #27
0
 function __construct()
 {
     parent::__construct();
 }
Example #28
0
 function Memberfields()
 {
     parent::__construct();
 }
Example #29
0
 function Payments()
 {
     parent::__construct();
     require APP_ROOT . 'libraries' . DS . 'tinhvan\\http.php';
     require APP_ROOT . 'libraries' . DS . 'tinhvan\\nhhttp.php';
 }
Example #30
0
 function Areas()
 {
     parent::__construct();
 }