当前位置: 首页>>代码示例>>PHP>>正文


PHP Build::bcatid方法代码示例

本文整理汇总了PHP中Build::bcatid方法的典型用法代码示例。如果您正苦于以下问题:PHP Build::bcatid方法的具体用法?PHP Build::bcatid怎么用?PHP Build::bcatid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Build的用法示例。


在下文中一共展示了Build::bcatid方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Build

 function Build($row)
 {
     Module::Module($row);
     ##################################################################################################
     $build_catids = @CGlobal::$configs['BuildCatIDs']['conf_val'];
     if ($build_catids != '') {
         $arr = explode(',', $build_catids);
         $build_catids = '';
         $last = 0;
         if ($arr) {
             foreach ($arr as $catid) {
                 if (isset(CGlobal::$allCategories[$catid]) && CGlobal::$allCategories[$catid]['status'] != 'HIDE') {
                     $build_catids .= ($build_catids != '' ? ',' : '') . $catid;
                     Build::$cats[$catid] = array('id' => $catid, 'name' => CGlobal::$allCategories[$catid]['name'], 'recomend' => str_replace(chr(13) . chr(10), "<br />", CGlobal::$allCategories[$catid]['recomend']), 'img' => AZLib::getImageThumb("category/{$catid}.gif", 40, 40, 0, 0), 'item_id' => 0, 'item_name' => '', 'item_url' => '', 'item_price' => '', 'item_warranty' => '', 'list_brief' => '');
                     if ($last) {
                         Build::$cats[$last]['next_id'] = $catid;
                     }
                     $last = $catid;
                 }
             }
         }
     }
     self::$bcatid = (int) Url::get('bcatid');
     if (self::$bcatid) {
         if (isset(Build::$cats[self::$bcatid])) {
             self::$bcat = Build::$cats[self::$bcatid];
         } else {
             Url::redirect_current(array('mode'));
         }
     } else {
         self::$bcat = reset(Build::$cats);
         if (self::$bcat) {
             self::$bcatid = (int) self::$bcat['id'];
         }
     }
     ##################################################################################################
     $item_ids = '';
     $build_ids = isset($_SESSION['build_ids']) ? $_SESSION['build_ids'] : '';
     $build_price = 0;
     if ($build_ids != '') {
         $items = array();
         $re = DB::query("SELECT * FROM item WHERE id IN(" . $build_ids . ") AND status=1 AND price>0 AND quantity>0 ORDER BY find_in_set(category_id,'" . $build_catids . "')");
         if ($re) {
             while ($item = mysql_fetch_assoc($re)) {
                 if (isset(Build::$cats[$item['category_id']]) && Build::$cats[$item['category_id']]['item_id'] == 0) {
                     Build::$price += $item['price'];
                     $item_ids .= ($item_ids != '' ? ',' : '') . $item['id'];
                     if (isset(CGlobal::$allCategories[$item['category_id']])) {
                         $item_url = WEB_DIR . CGlobal::$allCategories[$item['category_id']]['nice_name'] . "/p{$item['id']}/" . AZLib::safe_title($item['name']) . ".html";
                     } else {
                         $item_url = WEB_DIR . "p{$item['id']}/" . AZLib::safe_title($item['name']) . ".html";
                     }
                     if ($item['list_brief'] == '') {
                         $item['list_brief'] = $item['brief'];
                     }
                     $item['list_brief'] = preg_replace("/\\[([\\s]*[0-9]{1,2}[\\s]*)\\]/eis", " ", $item['list_brief']);
                     $item['list_brief'] = str_replace(array("'", "\""), array("", " "), $item['list_brief']);
                     $item['list_brief'] = AZLib::word_limit($item['list_brief'], 50, '');
                     Build::$items[$item['id']] = $item;
                     Build::$cats[$item['category_id']]['item_id'] = $item['id'];
                     Build::$cats[$item['category_id']]['item_name'] = $item['name'];
                     Build::$cats[$item['category_id']]['item_url'] = $item_url;
                     Build::$cats[$item['category_id']]['item_price'] = number_format($item['price'], 0, ',', '.') . " VNĐ";
                     Build::$cats[$item['category_id']]['item_warranty'] = $item['warranty'];
                     Build::$cats[$item['category_id']]['list_brief'] = $item['list_brief'];
                 }
             }
         }
     }
     $item_id = (int) Url::get('item_id');
     $bcatid = (int) Url::get('bcatid');
     if ($item_id && $bcatid) {
         $item = Item::get_item($item_id);
         if ($item && $item['status'] == 1 && $item['price'] > 0 && $item['quantity'] > 0 && isset(Build::$cats[$item['category_id']])) {
             if (!isset(Build::$items[$item['id']])) {
                 if (Build::$cats[$item['category_id']]['item_id'] > 0) {
                     unset(Build::$items[Build::$cats[$item['category_id']]['item_id']]);
                 }
                 Build::$items[$item['id']] = $item;
                 //$item_ids	.=	($item_ids!='' ? ',' : '')	.	$item['id'];
                 $item_ids = implode(',', array_keys(Build::$items));
                 $_SESSION['build_ids'] = "{$item_ids}";
                 $last = 0;
                 foreach (array_keys(Build::$cats) as $catid) {
                     if ($last == self::$bcatid) {
                         Url::redirect_current(array('mode', 'bcatid' => $catid), '#select_item');
                     }
                     $last = $catid;
                 }
             }
         }
         Url::redirect_current(array('mode', 'bcatid'));
     }
     $_SESSION['build_ids'] = "{$item_ids}";
     $cmd = Url::get('cmd');
     switch ($cmd) {
         case 'success':
             require_once 'forms/BuildSuccess.php';
             $this->add_form(new BuildSuccessForm());
             break;
//.........这里部分代码省略.........
开发者ID:duynhan07,项目名称:elink,代码行数:101,代码来源:class.php


注:本文中的Build::bcatid方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。