示例#1
0
 function test_save()
 {
     $name = "Nike";
     $test_brand = new brand($name, $id);
     $test_brand->save();
     $result = Brand::getAll();
     $this->assertEquals($test_brand, $result[0]);
 }
示例#2
0
 function init()
 {
     global $_G;
     $brand = new brand();
     $brand->_init_env();
     $brand->_init_config();
     $brand->check_install();
     $brand->_init_input();
     $brand->_init_db();
     $brand->_init_cache();
     if (!defined('IN_BRAND_UPDATE')) {
         $brand->auth();
     }
 }
示例#3
0
					WHERE catalog.brand=brand.id and catalog.status=1 and brand.status=1 ' . $_filter . ' 
					ORDER BY ' . $_sort . ' 
					LIMIT ' . $limit;
    // выполняем запрос + при необходимости выводим сам запрос
    $result = mysql::query($_sql, 0);
    // наименование бренда
    $_brand = ___findpole('select pole from brand where id=' . $id, 'pole');
    if ($result) {
        $_str .= system::show_tpl(array('result' => $result, '_brand' => $_brand), 'frontend/catalog/brand/list.php');
    } else {
        $_str .= 'У данного бренда товары отсутствуют.';
    }
} else {
    // выводим все бренды
    // get limit
    $limit = pager::pager_limit(brand::get_count(), mysql::query_findpole('select zna from config where id=47', 'zna'));
    // строим запрос
    $_sql = 'SELECT
					brand.*,
					count(catalog.id) as count
				FROM
					brand
				Left Outer Join catalog ON brand.id=catalog.brand
				WHERE brand.id>0 and brand.status=1
				GROUP BY
					brand.id
				order by brand.sort
				LIMIT ' . $limit;
    // выполняем запрос + при необходимости выводим сам запрос
    $result = mysql::query($_sql, 0);
    $_str .= system::show_tpl(array('result' => $result), 'frontend/catalog/brand/all_brands.php');
示例#4
0
							
							<?php 
    if ($obj->count > 0) {
        ?>
							</a>
							<?php 
    }
    ?>
							
                            <div style="">
							<div class="bold"><?php 
    echo $obj->pole;
    ?>
</div>
                            <?php 
    echo $obj->text;
    ?>
                            </div>
                        </div>	
	
	<?php 
}
?>

		</div>
		
	<?php 
// pager
echo brand::get_count() > mysql::query_findpole('select zna from config where id=47', 'zna') ? pager::pager_J("brand", mysql::query_findpole('select zna from config where id=47', 'zna'), brand::get_count(), intval($_GET['page'])) : '';
?>
		
 public function get_activity($brand_id)
 {
     $brand_data = brand::find($brand_id, array('title'));
     $campaigns = BrandCampaign::where('brand_campaign.brand_id', '=', $brand_id)->left_join('campaign', 'campaign.id', '=', 'brand_campaign.campaign_id')->left_join('campaign_author', 'campaign_author.id', '=', 'campaign.author_id')->get(array('brand_campaign.*', 'campaign.campaign_title', 'campaign.author_id', 'campaign.campaign_rating', 'campaign.campaign_price', 'campaign.campaign_status', 'campaign.created_at', 'campaign.updated_at'));
     if (empty($campaigns)) {
         return Redirect::to_route('brand_admin')->with('errors', 'Brand Activity not founded !');
     }
     return View::make('admin/brand/activity')->with('campaigns', $campaigns)->with('brand_title', $brand_data->title);
 }
示例#6
0
						&nbsp;&nbsp;&nbsp;&nbsp;
						<a <?php 
echo catalog::get_curent_type_sort(2);
?>
 href="<?php 
echo general::link('brand/id/' . $_GET['id'] . '/type_sort/2');
?>
">Я>А</a> </div>
                    </div><!-- .srt_block-->

                    <div class="tovar_list_3">
					
	<?php 
foreach ($result as $obj) {
    ?>
	
				<?php 
    echo system::show_tpl(array('obj' => $obj, 'level' => ''), '/frontend/catalog/list_index.php');
    ?>
	
	<?php 
}
?>
	
                    </div><!-- .tovar_list_3-->	
	
	
	<?php 
// pager
echo brand::get_count_brand() > CATALOG_AT_PAGE ? pager::pager_J("brand/id/" . $_GET['id'], CATALOG_AT_PAGE, brand::get_count_brand(), intval($_GET['page'])) : '';
示例#7
0
        <li class="site-breadcrumbs-list-item separator">/</li>
        <li class="site-breadcrumbs-list-item current">Каталог</li>
        <li class="site-breadcrumbs-list-item separator">/</li>
        <li class="site-breadcrumbs-list-item current">Бренд</li>
    </ul>
</div>
EOF;
MG::set('breadcrumbs', $breadcrumbs);
MG::set('pageTitle', $data['title']);
MG::set('isNotWrapper', true);
?>
<div class="products-wrapper">   
    <?php 
$actionButton = MG::getSetting('actionInCatalog') === "true" ? 'actionBuy' : 'actionView';
$currency = MG::getSetting('currency');
$item = brand::getProductsByBrand($_GET['brand']);
$items = $item['items'];
$brand = $item['brand'];
if (!empty($brand)) {
    ?>
      <h1 class="new-products-title"><?php 
    echo $brand['brand'];
    ?>
</h1> 
      <div class="cat-desc">	        
          <div class="cat-desc-img">
              <img src="<?php 
    echo $brand['url'];
    ?>
" alt="<?php 
    echo $brand['brand'];
示例#8
0
<?php

defined('IN_DESTOON') or exit('Access Denied');
require DT_ROOT . '/module/' . $module . '/common.inc.php';
$MG['brand_limit'] > -1 or dalert(lang('message->without_permission_and_upgrade'), 'goback');
require DT_ROOT . '/include/post.func.php';
include load($module . '.lang');
include load('my.lang');
require MD_ROOT . '/brand.class.php';
$do = new brand($moduleid);
if (in_array($action, array('add', 'edit'))) {
    $FD = cache_read('fields-' . substr($table, strlen($DT_PRE)) . '.php');
    if ($FD) {
        require DT_ROOT . '/include/fields.func.php';
    }
    isset($post_fields) or $post_fields = array();
    $CP = $MOD['cat_property'];
    if ($CP) {
        require DT_ROOT . '/include/property.func.php';
    }
    isset($post_ppt) or $post_ppt = array();
}
$sql = $_userid ? "username='******'" : "ip='{$DT_IP}'";
$limit_used = $limit_free = $need_password = $need_captcha = $need_question = $fee_add = 0;
if (in_array($action, array('', 'add'))) {
    $r = $db->get_one("SELECT COUNT(*) AS num FROM {$table} WHERE {$sql} AND status>1");
    $limit_used = $r['num'];
    $limit_free = $MG['brand_limit'] > $limit_used ? $MG['brand_limit'] - $limit_used : 0;
}
if (check_group($_groupid, $MOD['group_refresh'])) {
    $MOD['credit_refresh'] = 0;
示例#9
0
 *      [品牌空間] (C)2001-2010 Comsenz Inc.
 *      This is NOT a freeware, use is subject to license terms
 *
 *      $Id: common.php 4401 2010-09-13 02:44:25Z fanshengshuai $
 */
define('IN_BRAND', true);
define('B_ROOT', dirname(__FILE__) . DIRECTORY_SEPARATOR);
define('B_VER', '1.2');
define('B_RELEASE', '20100915');
define('D_BUG', '0');
D_BUG ? error_reporting(E_ERROR) : error_reporting(0);
$_SGLOBAL = $_SBLOCK = $_SHTML = $_DCACHE = $_SGET = array();
require_once B_ROOT . './source/function/common.func.php';
require_once B_ROOT . './source/adminfunc/brandpost.func.php';
require_once B_ROOT . './source/class/brand.class.php';
brand::init();
include_once B_ROOT . './language/brand.lang.php';
// 檢查關閉站點
if (!ckfounder($_G['uid']) && $_G['setting']['siteclosed']) {
    if (ACTION != 'auth' && ACTION != 'seccod') {
        showmessage($_G['setting']['siteclosed_reason']);
    }
}
if (!empty($_G['setting']['gzipcompress']) && function_exists('ob_gzhandler')) {
    ob_start('ob_gzhandler');
} else {
    ob_start();
}
@header('Content-Type: text/html; charset=' . $_G['charset']);
$newsiteurl = B_URL;
if (strpos($newsiteurl, '://') === false) {
示例#10
0
 protected function checkBrand($brandDir)
 {
     require_once __DIR__ . '/../lib.php';
     $brand = \brand::search($brandDir);
     if (!$brand) {
         $this->writeLog('not_brand', [$brandDir]);
     }
     return $brand;
 }
示例#11
0
     $all ? msg($MOD['name'] . '生成成功', $this_forward) : dmsg($MOD['name'] . '生成成功', $this_forward);
 }
 $catid = isset($catid) ? intval($catid) : '';
 $sql = $catid ? " AND catid={$catid}" : '';
 if (!isset($fid)) {
     $r = $db->get_one("SELECT min(itemid) AS fid FROM {$table} WHERE status>2 {$sql}");
     $fid = $r['fid'] ? $r['fid'] : 0;
 }
 isset($sid) or $sid = $fid;
 if (!isset($tid)) {
     $r = $db->get_one("SELECT max(itemid) AS tid FROM {$table} WHERE status>2 {$sql}");
     $tid = $r['tid'] ? $r['tid'] : 0;
 }
 if ($update) {
     require MD_ROOT . '/brand.class.php';
     $do = new brand($moduleid);
 }
 isset($num) or $num = 100;
 if ($fid <= $tid) {
     $result = $db->query("SELECT itemid FROM {$table} WHERE status>2 AND itemid>={$fid} {$sql} ORDER BY itemid LIMIT 0,{$num} ");
     if ($db->affected_rows($result)) {
         while ($r = $db->fetch_array($result)) {
             $itemid = $r['itemid'];
             $update ? $do->update($itemid) : tohtml('show', $module);
         }
         $itemid += 1;
     } else {
         $itemid = $fid + $num;
     }
 } else {
     if ($update) {
示例#12
0
<?php

defined('DT_ADMIN') or exit('Access Denied');
require MD_ROOT . '/brand.class.php';
$do = new brand($moduleid);
$menus = array(array('添加' . $MOD['name'], '?moduleid=' . $moduleid . '&action=add'), array($MOD['name'] . '列表', '?moduleid=' . $moduleid), array('审核' . $MOD['name'], '?moduleid=' . $moduleid . '&action=check'), array('未通过' . $MOD['name'], '?moduleid=' . $moduleid . '&action=reject'), array('回收站', '?moduleid=' . $moduleid . '&action=recycle'), array('移动分类', '?moduleid=' . $moduleid . '&action=move'));
if (in_array($action, array('add', 'edit'))) {
    $FD = cache_read('fields-' . substr($table, strlen($DT_PRE)) . '.php');
    if ($FD) {
        require DT_ROOT . '/include/fields.func.php';
    }
    isset($post_fields) or $post_fields = array();
    $CP = $MOD['cat_property'];
    if ($CP) {
        require DT_ROOT . '/include/property.func.php';
    }
    isset($post_ppt) or $post_ppt = array();
}
if ($_catids || $_areaids) {
    require DT_ROOT . '/admin/admin_check.inc.php';
}
if (in_array($action, array('', 'check', 'expire', 'reject', 'recycle'))) {
    $sfields = array('模糊', '标题', '公司名', '联系人', '联系电话', '联系地址', '电子邮件', '联系MSN', '联系QQ', '会员名', '编辑', 'IP', '文件路径', '内容模板');
    $dfields = array('keyword', 'title', 'company', 'truename', 'telephone', 'address', 'email', 'msn', 'qq', 'username', 'editor', 'ip', 'filepath', 'template');
    $sorder = array('结果排序方式', '更新时间降序', '更新时间升序', '添加时间降序', '添加时间升序', '浏览次数降序', '浏览次数升序', '品牌ID降序', '品牌ID升序');
    $dorder = array($MOD['order'], 'edittime DESC', 'edittime ASC', 'addtime DESC', 'addtime ASC', 'hits DESC', 'hits ASC', 'itemid DESC', 'itemid ASC');
    $level = isset($level) ? intval($level) : 0;
    isset($fields) && isset($dfields[$fields]) or $fields = 0;
    isset($order) && isset($dorder[$order]) or $order = 0;
    isset($datetype) && in_array($datetype, array('edittime', 'addtime', 'totime')) or $datetype = 'edittime';
    $fromdate = isset($fromdate) && is_date($fromdate) ? $fromdate : '';