function lfGetCSVData() { global $arrAUTHORITY; global $arrWORK; $oquery = new SC_Query(); $cols = "authority,name,department,login_id,work"; $oquery->setwhere("del_flg <> 1"); $oquery->andwhere("member_id <> " . ADMIN_ID); $oquery->setoption("ORDER BY rank DESC"); $list_data = $oquery->select($cols, "dtb_member"); $max = count($list_data); for ($i = 0; $i < $max; $i++) { $line = ""; $line .= "\"" . $arrAUTHORITY[$list_data[$i]['authority']] . "\","; $tmp = ereg_replace("\"", "\"\"", $list_data[$i]['name']); $line .= "\"" . $tmp . "\","; $tmp = ereg_replace("\"", "\"\"", $list_data[$i]['department']); $line .= "\"" . $tmp . "\","; $tmp = ereg_replace("\"", "\"\"", $list_data[$i]['login_id']); $line .= "\"" . $tmp . "\","; $line .= "\"" . $arrWORK[$list_data[$i]['work']] . "\"\n"; $data .= $line; } $header = "\"権限\",\"名前\",\"所属\",\"ログインID\",\"稼働状況\"\n"; return $header . $data; }
function lfGetCat($parent_category_id) { $objQuery = new SC_Query(); if ($parent_category_id == "") { $parent_category_id = '0'; } $col = "category_id, category_name, level, rank, description"; $where = "del_flg = 0 AND parent_category_id = ?"; $objQuery->setoption("ORDER BY rank DESC"); $arrRet = $objQuery->select($col, "dtb_category", $where, array($parent_category_id)); return $arrRet; }
function lfGetMainCat($count_check = false, &$objSubPage) { $objQuery = new SC_Query(); $col = "*"; $from = "dtb_category left join dtb_category_total_count using (category_id)"; // メインカテゴリーとその直下のカテゴリーを取得する。 $where = 'level <= 2 AND del_flg = 0'; // 登録商品数のチェック if ($count_check) { $where .= " AND product_count > 0"; } $objQuery->setoption("ORDER BY rank DESC"); $arrRet = $objQuery->select($col, $from, $where); // メインカテゴリーを抽出する。 $arrMainCat = array(); foreach ($arrRet as $cat) { if ($cat['level'] != 1) { continue; } // 子カテゴリーを持つかどうかを調べる。 $arrChildrenID = SC_Utils_Ex::sfGetUnderChildrenArray($arrRet, 'parent_category_id', 'category_id', $cat['category_id']); $cat['has_children'] = count($arrChildrenID) > 0; $arrMainCat[] = $cat; } $objSubPage->arrCat = $arrMainCat; return $objSubPage; }
/** * カテゴリーツリーの取得を行う. * * 親カテゴリの Value=0 を対象とする * * @param bool $parent_zero 親カテゴリの Value=0 の場合 true * @return array カテゴリツリーの配列 */ function sfGetLevelCatList($parent_zero = true) { $objQuery = new SC_Query(); $col = "category_id, parent_category_id, category_name, level"; $where = "del_flg = 0"; $objQuery->setoption("ORDER BY rank DESC"); $arrRet = $objQuery->select($col, "dtb_category", $where); $max = count($arrRet); for ($cnt = 0; $cnt < $max; $cnt++) { if ($parent_zero) { if ($arrRet[$cnt]['level'] == LEVEL_MAX) { $arrValue[$cnt] = $arrRet[$cnt]['category_id']; } else { $arrValue[$cnt] = ""; } } else { $arrValue[$cnt] = $arrRet[$cnt]['category_id']; } $arrOutput[$cnt] = ""; // 子カテゴリから親カテゴリを検索 $parent_category_id = $arrRet[$cnt]['parent_category_id']; for ($cat_cnt = $arrRet[$cnt]['level']; $cat_cnt > 1; $cat_cnt--) { foreach ($arrRet as $arrCat) { // 親が見つかったら順番に代入 if ($arrCat['category_id'] == $parent_category_id) { $arrOutput[$cnt] = CATEGORY_HEAD . $arrCat['category_name'] . $arrOutput[$cnt]; $parent_category_id = $arrCat['parent_category_id']; } } } $arrOutput[$cnt] .= CATEGORY_HEAD . $arrRet[$cnt]['category_name']; } return array($arrValue, $arrOutput); }
function lfGetCSV($from, $where, $option, $arrval, $arrCsvOutputCols = "") { $cols = SC_Utils_Ex::sfGetCommaList($arrCsvOutputCols); $objQuery = new SC_Query(); $objQuery->setoption($option); $list_data = $objQuery->select($cols, $from, $where, $arrval); $max = count($list_data); if (!isset($data)) { $data = ""; } for ($i = 0; $i < $max; $i++) { // 各項目をCSV出力用に変換する。 $data .= $this->lfMakeCSV($list_data[$i]); } return $data; }