assign('modTitle', '實績介紹'); //取得左側選單 $sql = "SELECT id, name FROM {$mod}_dir WHERE display=1 AND dir=0"; $result = cm_sqlQuery($sql); $row = null; for($i = 0; $i < $result->num_rows; $i++) { $row[$i] = $result->fetch_assoc(); $row[$i]['link'] = "index.php?mod=$mod&dir=".$row[$i]['id']; if($user) $row[$i]['editLink'] = "[編輯]"; } //若有管理權限, 附加新增選項 if($user) { $row[$i]['name'] = '新增目錄'; $row[$i]['link'] = "index.php?mod=$mod&act=new&table={$mod}_dir&dir=0"; } //輸出左側選單 $smarty->assign('leftMenu', $row); //深度指示條 $depthBar = " > 創作實績"; //若傳來目錄索引或無指定產品, 取得目錄名稱, 子目錄, 及該層產品 if(!$id) { //取得所選目錄 if($dir) { $sql = "SELECT * FROM {$mod}_dir WHERE display=1 AND id=$dir"; $result = cm_sqlQuery($sql); if($result->num_rows) { $row = $result->fetch_assoc(); if($user) { $row['editLink'] = "index.php?mod=$mod&act=edit&table={$mod}_dir&id=".$row['id']; $row['editTag'] = '[編輯]'; } $smarty->assign('dirData', $row); } } else{ $smarty->assign('dirData', array('id'=> 0, 'name' => '創作實績')); } //取得子目錄 //取得頁數 $page = cm_getInput('page', 1); $limit = 'LIMIT '. ($page - 1) . ',' . PRODUCT_LIST_LIMIT; //每頁顯示限制 $sql = "SELECT SQL_CALC_FOUND_ROWS * FROM {$mod}_dir WHERE display=1 AND dir=$dir $limit"; //if(DEBUG) cm_dump($sql); $result = cm_sqlQuery($sql); $row = null; for($i = 0; $i < $result->num_rows; $i++) { $row[$i] = $result->fetch_assoc(); $row[$i]['link'] = 'index.php?mod=creation&dir=' . $row[$i]['id']; $imgFile = UPLOAD_DIR."$mod/{$mod}_dir_{$row[$i]['id']}s.jpg"; if(file_exists($imgFile)) { $row[$i]['imgTag'] = "\"{$row[$i]['name']}\""; $row[$i]['imgLink'] = "\"{$row[$i]['name']}\""; } if($user) { $row[$i]['editLink'] = "index.php?mod=$mod&table={$mod}_dir&id={$row[$i]['id']}&act=edit"; $row[$i]['editTag'] = '[編輯]'; } } //計算頁數並產生分頁 $result = $mysqli->query('SELECT FOUND_ROWS()'); list($totalRows) = $result->fetch_row(); $totalPages = ceil($totalRows / PRODUCT_LIST_LIMIT); //輸出分頁資訊 $smarty->assign('page', $page); $smarty->assign('prevPage', $page - 1); $smarty->assign('nextPage', $page + 1); $smarty->assign('totalPages', $totalPages); $smarty->assign('pageUrl', "index.php?mod=$mod&dir=$dir&page="); //計算深度並產生深度條 $dirDepth = cm_findParent('creation_dir', $dir); $depth = count($dirDepth); foreach($dirDepth as $item) $string .= " > {$item['name']}"; $smarty->assign('depthBar', $depthBar.$string); //深度條 if($user and PRODUCT_DIR_DEPTH - $depth > 1) { $row[$i]['name'] = '新增目錄'; $row[$i]['link'] = "index.php?mod=$mod&act=new&table={$mod}_dir&dir=$dir"; } $smarty->assign('dirList', $row); //取得該層產品 $sql = "SELECT * FROM $mod WHERE display=1 AND dir=$dir"; $result = cm_sqlQuery($sql); $row = null; for($i = 0; $i < $result->num_rows; $i++) { $row[$i] = $result->fetch_assoc(); $row[$i]['link'] = 'index.php?mod=creation&id=' . $row[$i]['id']; $thumbFile = UPLOAD_DIR."$mod/{$mod}_{$row[$i]['id']}_1s.jpg"; if(file_exists($thumbFile)) { $row[$i]['imgTag'] = ""; $row[$i]['imgLink'] = "\"{$row[$i]['name']}\""; } if($user) { //$row[$i]['editLink'] = $row[$i]['link'] . '&act=edit'; //$row[$i]['editTag'] = '[編輯]'; } } if($user and $depth - PRODUCT_DEPTH > 0) { $row[$i]['name'] = '新增實績'; $row[$i]['link'] = "index.php?mod=$mod&act=new&dir=$dir"; } $smarty->assign('itemList', $row); $smarty->assign('contentTemplate', "{$mod}_list.tpl"); //內容樣板 } else //產品內容 { $condition = $id ? "AND id=$id" : "LIMIT 1"; $sql = "SELECT * FROM $mod WHERE display=1 $condition"; $result = cm_sqlQuery($sql); if($result->num_rows) { $row = $result->fetch_assoc(); for($i = 1; $i <= PRODUCT_IMAGE_LIMIT; $i++) { $sourceImage = UPLOAD_DIR."$mod/{$mod}_{$id}_$i.jpg"; $thumbImage = UPLOAD_DIR."$mod/{$mod}_{$id}_{$i}s.jpg"; if(file_exists($thumbImage)) { $row['imgTag'][$i-1] = ""; $row['imgLink'][$i-1] = "{$row['imgTag'][$i-1]}"; } } if($user) $row['editLink'] = "[編輯]"; $smarty->assign('inquireAction', "index.php?mod=contact"); $smarty->assign('contentData', $row); $dir = $row['dir']; //計算深度並產生深度條 if(!empty($table)){ //edited by kyle 2012/07/30 $dirDepth = cm_findParent('creation_dir', $_GET['id']); }else{ $dirDepth = cm_findParent('creation_dir', $dir); } $depth = count($dirDepth); foreach($dirDepth as $item) $string .= " > {$item['name']}"; $smarty->assign('depthBar', $depthBar.$string); //深度條 }else{ //計算深度並產生深度條 //$dirDepth = cm_findParent('creation_dir', $dir); $dirDepth = cm_findParent('creation_dir', $_GET['id']); //edited by kyle 2012/07/30 $depth = count($dirDepth); foreach($dirDepth as $item) $string .= " > {$item['name']}"; $smarty->assign('depthBar', $depthBar.$string); //深度條 } $smarty->assign('goUpUrl', "index.php?mod=$mod&dir=$dir"); $smarty->assign('contentTemplate', "{$mod}_view.tpl"); //內容樣板 } ?> 宇晨石材有限公司---人居景觀生態

 

宇晨石材有限公司

首頁