Example #1
0
 public static function tree($from = 'pc', $parent = 'null', $level = 0)
 {
     static $i;
     SK::fetch();
     $allRsnum = CRUD::dataFetch('products_cate');
     $rsnum = CRUD::dataFetch('products_cate', array('parent' => $parent), false, array('sort' => CORE::$cfg["sort"]));
     if ($allRsnum > 1) {
         if (++$i == 1) {
             VIEW::newBlock("TAG_TREE_BLOCK");
         }
         if (empty($rsnum)) {
             return false;
         }
         $dataRow = CRUD::$data;
         foreach ($dataRow as $key => $row) {
             switch ($from) {
                 case "pc":
                     $link = CORE::$manage . "products/cate/sk-parent:{$row["id"]}/";
                     break;
                 case "p":
                     $link = CORE::$manage . "products/sk-parent:{$row["id"]}/";
                     break;
             }
             VIEW::newBlock("TAG_TREE_LIST");
             VIEW::assign(array("TREE_SUBJECT" => $row["subject"], "TREE_LINK" => $link, "TREE_LEVEL" => $level, "TREE_CURRENT" => SK::$args["parent"] == $row["id"] ? 'theme' : ''));
             self::tree($from, $row["id"], $level + 1);
         }
     }
 }
Example #2
0
 public static function fetch()
 {
     SESS::del('SK');
     if (!empty(self::$now)) {
         SESS::write('SK', self::$now);
         $sk_str = urldecode(self::$now);
         $sk_str = str_replace('sk-', '', $sk_str);
         $sk_array = explode("|", $sk_str);
         foreach ($sk_array as $sk_group) {
             list($field, $value) = explode(":", $sk_group);
             if (!empty($value)) {
                 $subCK = preg_match('/^sub-/', $field) ? true : false;
                 $output = false;
                 if ($subCK) {
                     list($prefix, $orignField) = explode('-', $field);
                     $field = $orignField;
                 }
                 switch (true) {
                     case $field == "parent":
                         $output = "{$field} = '{$value}'";
                         break;
                     default:
                         $output = "{$field} like '%{$value}%'";
                         break;
                 }
                 if (!$subCK) {
                     $sk[] = $output;
                 } else {
                     $sub[] = $output;
                     $field = 'SUB_' . $orignField;
                 }
                 self::$args[$field] = $value;
                 VIEW::assignGlobal("SK_" . strtoupper($field), $value);
             }
         }
         if (is_array($sub)) {
             self::$sub = implode(" and ", $sub);
         }
         if (is_array($sk)) {
             return implode(" and ", $sk);
         }
     }
     return false;
 }
Example #3
0
 private static function row()
 {
     $manager = SESS::get("MANAGER");
     $rsnum = CRUD::dataFetch('member', array('sk' => SK::fetch()), false, array('createdate' => 'desc'), false, true);
     if (!empty($rsnum)) {
         VIEW::newBlock("TAG_MEMBER_BLOCK");
         foreach (CRUD::$data as $key => $row) {
             VIEW::newBlock("TAG_MEMBER_LIST");
             foreach ($row as $field => $var) {
                 switch ($field) {
                     case "gender":
                         $gender = $var ? self::$lang["male"] : self::$lang["female"];
                         if (is_null($var)) {
                             $gender = self::$lang["null"];
                         }
                         VIEW::assign("VALUE_" . strtoupper($field), $gender);
                         break;
                     case "verify":
                         $verify = $var ? self::$lang["verify_done"] : self::$lang["verify_code_none"];
                         VIEW::assign("VALUE_" . strtoupper($field), $verify);
                         break;
                     case "status":
                         $status = $var ? self::$lang["status_on"] : self::$lang["status_off"];
                         if (empty($var)) {
                             VIEW::assign("CLASS_STATUS_RED", 'red');
                         }
                         VIEW::assign("VALUE_" . strtoupper($field), $status);
                         break;
                     default:
                         VIEW::assign("VALUE_" . strtoupper($field), $var);
                         break;
                 }
             }
             VIEW::assign('VALUE_NUMBER', PAGE::$start + ++$i);
         }
     } else {
         VIEW::newBlock("TAG_NONE");
     }
 }
Example #4
0
 private static function row()
 {
     #self::cate_list($cate); # 分類選單
     $rsnum = CRUD::dataFetch('products', array('langtag' => CORE::$langtag, 'sk' => SK::fetch()), false, array('sort' => CORE::$cfg["sort"]), false, true);
     if (!empty($rsnum)) {
         $data = CRUD::$data;
         VIEW::newBlock("TAG_PRODUCTS_BLOCK");
         foreach ($data as $key => $row) {
             VIEW::newBlock("TAG_PRODUCTS_LIST");
             foreach ($row as $field => $var) {
                 switch ($field) {
                     case "parent":
                         CRUD::dataFetch('products_cate', array('id' => $var), array('subject'));
                         list($parent) = CRUD::$data;
                         VIEW::assign("VALUE_" . strtoupper($field), $parent["subject"]);
                         break;
                     case "status":
                         $status = $var ? self::$lang["status_on"] : self::$lang["status_off"];
                         if (empty($var)) {
                             VIEW::assign("CLASS_STATUS_RED", 'red');
                         }
                         VIEW::assign("VALUE_" . strtoupper($field), $status);
                         break;
                     default:
                         VIEW::assign("VALUE_" . strtoupper($field), $var);
                         break;
                 }
             }
             IMAGES::load('products', $row["id"]);
             list($image) = IMAGES::$data;
             VIEW::assign(array('VALUE_NUMBER' => PAGE::$start + ++$i, "VALUE_IMAGE" => $image["path"], 'VALUE_LINK' => PRODUCTS::dataLink($row['parent'], $row)));
         }
     } else {
         VIEW::newBlock("TAG_NONE");
     }
     VIEW::assignGlobal("VALUE_PARENT_OPTION", self::cate_select(SK::$args["parent"]));
 }
Example #5
0
 private static function sk_handle(array $uri_array)
 {
     $origin_args = $uri_array;
     $last_args = array_pop($uri_array);
     if (preg_match('/sk-/', $last_args)) {
         SK::$now = preg_replace('/page-([^\\/]+)/', "\$1", $last_args);
         # 載入搜尋參數
         $return_args = $uri_array;
     } else {
         $return_args = $origin_args;
     }
     #self::$uri = implode("/",$return_args);
     return $return_args;
 }