示例#1
0
 public function getDataById($item_id)
 {
     $fieldArray = array();
     $fieldArray = array_merge($fieldArray, $this->getSelectFieldArray_short());
     $fieldArray = array_merge($fieldArray, $this->getSelectFieldStr_extend());
     $sql = " \n            SELECT\n                " . fieldArrayToSql($fieldArray) . "\n            FROM \n                imagegallery\n            WHERE\n                imagegallery.status > 0\n                AND imagegallery.imagegallery_id = ?\n            LIMIT \n                0,1\n            ";
     $param_ar = array($item_id);
     $result_ar = $this->db->query($sql, $param_ar)->result_array();
     if (@$result_ar[0]["imagegallery_id"] == "") {
         return false;
     }
     return $result_ar[0];
 }
示例#2
0
 public function getFileByHolder($object_table_id, $object_id, $type_id = "", $limit = -1)
 {
     $limit_sql_str = "";
     if ($limit >= 0) {
         $limit_sql_str = " LIMIT 0 , " . intval($limit) . " ";
     }
     $type_id = intval($type_id);
     $extend_where_str = "";
     if ($type_id > 0) {
         $extend_where_str = " AND file_matchto_object.type_id  = {$type_id}";
     }
     $fieldArray = array();
     $fieldArray = array_merge($fieldArray, $this->getSelectFieldArray_veryShort());
     $sql = " \n            SELECT\n                " . fieldArrayToSql($fieldArray) . ",\n                file_matchto_object.type_id AS file_type_id,\n                file_matchto_object.sort_index AS file_sort_index\n            FROM \n                file_matchto_object\n                    INNER JOIN file ON ( file.file_id = file_matchto_object.file_id )\n                    INNER JOIN server ON ( server.server_id = file.server_id )\n            WHERE\n                file_matchto_object.holder_object_table_id = ?\n                AND file_matchto_object.holder_object_id = ?\n                " . $extend_where_str . "\n            ORDER BY \n                file_matchto_object.sort_index ASC\n            " . $limit_sql_str;
     $param_ar = array($object_table_id, $object_id);
     $result_ar = $this->db->query($sql, $param_ar)->result_array();
     if (@$result_ar[0]["file_id"] == "") {
         return array();
     }
     return $result_ar;
 }
示例#3
0
 public function getDataById($product_id, $extend_field = true)
 {
     $fieldArray = array();
     $fieldArray = array_merge($fieldArray, $this->getSelectFieldArray_short());
     if ($extend_field) {
         $fieldArray = array_merge($fieldArray, $this->getSelectFieldArray_extend());
     }
     $sql = " \r\n            SELECT\r\n                " . fieldArrayToSql($fieldArray) . "\r\n            FROM \r\n                package\r\n                    INNER JOIN product_matchto_package ON product_matchto_package.package_id = package.package_id\r\n            WHERE\r\n                product_matchto_package.package_id = {$package_id}\r\n                AND product_matchto_package.product_id = {$product_id}\r\n                AND product.status > 1\r\n            LIMIT \r\n                0,1\r\n            ";
     $result_ar = $this->db->query($sql)->result_array();
     $dataResult = @$result_ar[0];
     if (@$dataResult["product_id"] == "") {
         return false;
     }
     return $dataResult;
 }
示例#4
0
 private function getPromotionInrow($promotion_id)
 {
     $fieldArray = array();
     $fieldArray = array_merge($fieldArray, $this->getSelectFieldArray_short());
     $sql = " \r\n            SELECT\r\n                " . fieldArrayToSql($fieldArray) . "\r\n            FROM \r\n                promotion_row\r\n            WHERE\r\n                promotion_row.status > 0  \r\n            AND \r\n                promotion_row.promotion_id = {$promotion_id}\r\n            LIMIT \r\n                0,1\r\n            ";
     $result_ar = $this->db->query($sql)->result_array();
     $dataResult = @$result_ar[0];
     if (@$dataResult["promotion_row_id"] == "") {
         return false;
     }
     return $dataResult;
 }
示例#5
0
 public function getImageByHolder($object_table_id, $object_id, $type_id = "", $limit = -1)
 {
     $limit_sql_str = "";
     if ($limit >= 0) {
         $limit_sql_str = " LIMIT 0 , " . intval($limit) . " ";
     }
     $fieldArray = array();
     $fieldArray = array_merge($fieldArray, $this->getSelectFieldArray_short());
     $sql = " \n            SELECT\n                " . fieldArrayToSql($fieldArray) . ",\n                image_matchto_object.sort_index AS image_sort_index,\n                image_matchto_object.image_matchto_object_id AS relation_id\n            FROM \n                image_matchto_object\n                    INNER JOIN image ON ( image.image_id = image_matchto_object.image_id )\n                    INNER JOIN server ON ( server.server_id = image.server_id )\n            WHERE\n                image_matchto_object.holder_object_table_id = ?\n                AND image_matchto_object.holder_object_id = ?\n                AND image_matchto_object.type_id = ?\n            ORDER BY \n                image_matchto_object.sort_index ASC\n            " . $limit_sql_str;
     $param_ar = array($object_table_id, $object_id, $type_id);
     $result_ar = $this->db->query($sql, $param_ar)->result_array();
     if (@$result_ar[0]["image_id"] == "") {
         return array();
     }
     return $result_ar;
 }
示例#6
0
 public function getDataById($promotion_id, $extend_field = false)
 {
     $fieldArray = array();
     $fieldArray = array_merge($fieldArray, $this->getSelectFieldArray_short());
     if ($extend_field) {
         $fieldArray = array_merge($fieldArray, $this->getSelectFieldArray_extend());
     }
     $sql = " \r\n            SELECT\r\n                " . fieldArrayToSql($fieldArray) . "\r\n            FROM \r\n                promotion\r\n            WHERE\r\n                promotion.status > 0\r\n            AND\r\n                promotion.promotion_id = {$promotion_id}\r\n            LIMIT \r\n                0,1\r\n            ";
     $result_ar = $this->db->query($sql)->result_array();
     $this->load->model("root_promotion_row_model");
     $WhereStr = "promotion_row.promotion_id = {$promotion_id}";
     $total_row = $this->root_promotion_row_model->getListsTotalRow($WhereStr);
     $WhereStr = "promotion_row.promotion_id = {$promotion_id}";
     $result_ar[0]["promotion_row_array"] = $this->root_promotion_row_model->getLists($cur_page = 1, $per_page = $total_row, $WhereStr, $sortBy_id = "");
     $dataResult = @$result_ar;
     if (@$dataResult[0]["promotion_promotion_id"] == 0) {
         return false;
     }
     return $dataResult;
 }
示例#7
0
 public function getLists($cur_page, $per_page, $tableName, $fieldArray, $WhereStr = "", $sortBy_id = "", $joinStr = "", $extend_field)
 {
     $fieldArray = array_merge($fieldArray, $fieldArray);
     if ($extend_field) {
         $fieldArray = array_merge($fieldArray, $this->getSelectFieldArray_extend());
     }
     if (!$tableName) {
         resDie(array(), "required table name");
     }
     $orderAndLimit_str = $this->getPageNavSql($cur_page, $per_page, $sortBy_id);
     $sql = " \r\n            SELECT\r\n                " . fieldArrayToSql($fieldArray) . "\r\n            FROM \r\n                " . $tableName . "\r\n                " . $joinStr . "\r\n            WHERE\r\n            " . $WhereStr . $orderAndLimit_str;
     $result_ar = $this->db->query($sql)->result_array();
     return $result_ar;
 }
示例#8
0
 public function getDataById($product_id, $extend_field = false)
 {
     $fieldArray = array();
     $fieldArray = array_merge($fieldArray, $this->getSelectFieldArray_short());
     if ($extend_field) {
         $fieldArray = array_merge($fieldArray, $this->getSelectFieldArray_extend());
     }
     $ex_WhereStr = "";
     $ex_paramAr = array();
     if ($this->getProductTypeId() != null) {
         $ex_WhereStr = " AND product.product_type_id = ? ";
         $ex_paramAr = array($this->getProductTypeId());
     }
     $sql = " \r\n            SELECT\r\n                " . fieldArrayToSql($fieldArray) . "\r\n            FROM \r\n                product\r\n                    INNER JOIN product_detail ON product_detail.product_id = product.product_id\r\n            WHERE\r\n                product.product_id = ?\r\n                AND product.status > 0\r\n                " . $ex_WhereStr . "\r\n            LIMIT \r\n                0,1\r\n            ";
     $param_ar = array($product_id);
     $param_ar = array_merge($param_ar, $ex_paramAr);
     $result_ar = $this->db->query($sql, $param_ar)->result_array();
     $dataResult = @$result_ar[0];
     if (@$dataResult["product_id"] == "") {
         return false;
     }
     return $dataResult;
 }