Beispiel #1
0
 /**
  * Method de gui mail
  *
  * @param string $to Email cua nguoi nhan
  * @param string $toname Ten cua nguoi nhan
  * @param string $subject Chu de cua mail
  * @param string $content Noi dung cua mail
  * @param string $attactment Attachment - hien tai ko co dung
  * @param string $sender Email dung de login SMTP
  * @param string $senderPass Pass cua email dung de login SMTP
  * @param string $senderName Ten nguoi gui
  * @param string $useGoogleSMTP Cho biet co dung SMTP cua google de gui hay khong. Chi co gui mail truc tiep moi dung
  * @return bool true->thanh cong, false->that bai
  *
  */
 public function send($to, $toname, $subject, $content, $attactment, $sender, $senderPass, $senderName, $useGoogleSMTP = 1)
 {
     try {
         //error_reporting(E_ALL);
         $mail = new PHPMailer();
         //$mail->AddReplyTo($replyto,$fullname);
         $mail->From = $sender;
         $mail->FromName = $senderName;
         $mail->Subject = $subject;
         $mail->Body = $content;
         $mail->AltBody = "To view the message, please use an HTML compatible email viewer!";
         // optional, comment out and test
         $mail->WordWrap = 50;
         // set word wrap
         $mail->MsgHTML($content);
         $arrAddress = explode(";", $to);
         foreach ($arrAddress as $address) {
             $mail->AddAddress($address, $toname);
         }
         $mail->IsHTML(true);
         // send as HTML
         $mail->IsSMTP();
         $mail->SMTPAuth = true;
         $mail->SMTPSecure = "ssl";
         $mail->Host = "smtp.gmail.com";
         // sets GMAIL as the SMTP server
         $mail->Port = '465';
         // set the SMTP port for the GMAIL server
         $mail->Username = $sender;
         $mail->Password = $senderPass;
         $mail->CharSet = 'utf-8';
         //echo $sender;
         //echo $senderPass;
         if (!$mail->Send()) {
             global_common::writeLog("Mailer Error: " . $mail->ErrorInfo, 0, "sendmail.php");
             return false;
         } else {
             return true;
         }
     } catch (Exception $e) {
         global_common::writeLog("Mailer Error: " . $e->getMessage(), 0, "sendmail.php");
         return false;
     }
 }
 public function activeAdvertising($adID, $isActivate)
 {
     $strTableName = self::TBL_SL_ADVERTISING;
     $strSQL = global_common::prepareQuery(self::SQL_ACTIVE_SL_ADVERTISING, array($strTableName, global_common::escape_mysql_string($adID), $isActivate));
     //echo $strSQL;
     if (!global_common::ExecutequeryWithCheckExistedTable($strSQL, self::SQL_CREATE_TABLE_SL_ADVERTISING, $this->_objConnection, $strTableName)) {
         //echo $strSQL;
         global_common::writeLog('Error add sl_article:' . $strSQL, 1);
         return false;
     }
     return $adID;
 }
 /**
  * Get Article with input is sql script
  *
  * @param mixed $strSQL This is a description
  * @return mixed This is the return value description
  *
  */
 private function getArticlesFromDB($strSQL)
 {
     $arrResult = $this->_objConnection->selectCommand($strSQL);
     if (!$arrResult) {
         global_common::writeLog('get sl_article from DB:' . $strSQL, 1, $_mainFrame->pPage);
         return null;
     }
     $count = count($arrResult);
     for ($i = 0; $i < $count; $i++) {
         //print_r($arrResult[$i]);
         $arrResult[$i][global_mapping::Content] = stripslashes($arrResult[$i][global_mapping::Content]);
     }
     return global_common::mergeUserInfo($arrResult);
 }
 public function getTrackerUser($userID, $storeID)
 {
     $strSQL .= global_common::prepareQuery(global_common::SQL_SELECT_FREE, array('*', self::TBL_SL_TRACKER, 'WHERE UserID = \'' . $userID . '\' And Value = \'' . $storeID . '\' '));
     //echo '<br>SQL:'.$strSQL;
     $arrResult = $this->_objConnection->selectCommand($strSQL);
     if (!$arrResult) {
         global_common::writeLog('get SL_TRACKER User:' . $strSQL, 1, $_mainFrame->pPage);
         return null;
     }
     //print_r($arrResult);
     return $arrResult[0];
 }
Beispiel #5
0
 public function getAllAdvertising($intPage = 0, $selectField = '*', $whereClause = '', $orderBy = '', &$total)
 {
     if (!$selectField) {
         $selectField = '*';
     }
     if ($whereClause) {
         $whereClause = ' WHERE ' . $whereClause;
     }
     if ($orderBy) {
         $orderBy = ' ORDER BY ' . $orderBy;
     }
     if ($intPage > 0) {
         $strSQL .= global_common::prepareQuery(global_common::SQL_SELECT_FREE, array($selectField, Model_Advertising::TBL_SL_ADVERTISING, $whereClause . $orderBy . ' limit ' . ($intPage - 1) * self::NUM_PER_PAGE . ',' . self::NUM_PER_PAGE));
         $strSQLCount .= global_common::prepareQuery(global_common::SQL_SELECT_FREE, array('count(*)', Model_Advertising::TBL_SL_ADVERTISING, $whereClause . $orderBy));
     } else {
         $strSQL .= global_common::prepareQuery(global_common::SQL_SELECT_FREE, array($selectField, Model_Advertising::TBL_SL_ADVERTISING, $whereClause . $orderBy));
     }
     //echo '<br>SQL:'.$strSQL;
     $arrResult = $this->_objConnection->selectCommand($strSQL);
     if (!$arrResult) {
         global_common::writeLog('get All sl_advertising:' . $strSQL, 1, $_mainFrame->pPage);
         return null;
     }
     if ($strSQLCount) {
         //echo '<br>$strSQLCount:'.$strSQLCount;
         $arrTotal = $this->_objConnection->selectCommand($strSQLCount);
         $total = $arrTotal[0][0];
     }
     $objAdType = new Model_AdType($this->_objConnection);
     $allAdType = $objAdType->getAllAdType(0, null, null, null);
     $adTypes = array();
     foreach ($allAdType as $key => $info) {
         $adTypes[$info[global_mapping::AdTypeID]] = $info;
         unset($allAdType[$key]);
     }
     $count = count($arrResult);
     for ($index = 0; $index < $count; $index++) {
         $arrResult[$index][global_mapping::AdTypeName] = $adTypes[$arrResult[$index][global_mapping::AdTypeID]][global_mapping::AdTypeName];
     }
     //print_r($arrResult);
     return $arrResult;
 }
 /**
  * thực hiện lấy media link từ một url
  *
  * @param string $urlMedia địa chỉ của một page media
  * @return string chuỗi media link
  * @author TinhDoan added [20101027]
  *
  */
 public function getMediaLinkFromURL($urlMedia)
 {
     // lấy nội dung của page
     $content = self::getContentWebPage($urlMedia);
     global_common::writeLog("1.getMediaLinkFromURL: http_code: " . $content["http_code"], 1, "global_editor.php");
     global_common::writeLog("1.getMediaLinkFromURL: location: " . $content["location"], 1, "global_editor.php");
     global_common::writeLog("1.getMediaLinkFromURL: content: " . $content["content"], 1, "global_editor.php");
     if ($content['http_code'] == 200) {
         if (strncasecmp("application/x-shockwave-flash", $content["content_type"], 29) == 0) {
             global_common::writeLog("1.getMediaLinkFromURL: location: " . $content["location"], 1, "global_editor.php");
             if (!array_key_exists('location', $content)) {
                 $content["location"] = $urlMedia;
             }
             return "width:'420',height:'320',movie:'" . $content["location"] . "'";
         }
         // thực hiện lấy url media new từ nội dung vừa đọc được
         $newURLMedia = self::getMediaLinkFromContent($content["content"]);
         // nếu không lấy được new media link từ nội dung của page media
         if ($newURLMedia == "") {
             // thực hiện lấy new media link từ url media trước đó
             $newURLMedia = self::trygetMediaLinkFromURL($urlMedia);
         }
         // nếu lấy được new media link
         if ($newURLMedia) {
             // thực hiện lấy media link lại từ địa chỉ new media link
             return self::getMediaLinkFromURL($newURLMedia);
         }
     }
     return "";
 }
Beispiel #7
0
            $userUpdate[global_mapping::Avatar] = $fileName;
            //echo $fileName;
            //echo $userUpdate[global_mapping::IsActive];
            $result = $objUser->update($userUpdate[global_mapping::UserID], $userUpdate[global_mapping::UserName], $userUpdate[global_mapping::Password], $userUpdate[global_mapping::FullName], $userUpdate[global_mapping::BirthDate], $userUpdate[global_mapping::Address], $userUpdate[global_mapping::Phone], $userUpdate[global_mapping::Email], $userUpdate[global_mapping::Sex], $userUpdate[global_mapping::Identity], $userUpdate[global_mapping::RoleID], $userUpdate[global_mapping::UserRankID], $userUpdate[global_mapping::Avatar], $userUpdate[global_mapping::AccountID], $userUpdate[global_mapping::IsActive]);
            //echo $result;
            $_SESSION[global_common::SES_C_USERINFO] = $currentUser = $userUpdate;
            move_uploaded_file($_FILES["file"]["tmp_name"], $fileName);
            //}
            //else
            //{
            //	move_uploaded_file($_FILES["file"]["tmp_name"],
            //			global_common::FOLDER_AVATAR  . $currentUser[global_mapping::UserID].$_FILES["file"]["name"]);
            //}
        }
    } else {
        global_common::writeLog("Invalid file");
        //echo "Invalid file";
    }
    //return;
}
?>

<?php 
include_once 'include/_header.inc';
include_once 'include/_menu.inc';
//print_r($currentUser);
?>

<div id="profile-page" class="page-content">
	<div class="row-fluid">
		<div class="span12">
 public function getAllCommentBad($intPage = 0, $selectField = '*', $whereClause = '', $orderBy = '')
 {
     if ($whereClause) {
         $whereClause = ' WHERE ' . $whereClause;
     }
     if ($orderBy) {
         $orderBy = ' ORDER BY ' . $orderBy;
     }
     if ($intPage > 0) {
         $strSQL .= global_common::prepareQuery(global_common::SQL_SELECT_FREE, array($selectField, Model_CommentBad::TBL_SL_COMMENT_BAD, $whereClause . $orderBy . ' limit ' . ($intPage - 1) * self::NUM_PER_PAGE . ',' . self::NUM_PER_PAGE));
     } else {
         $strSQL .= global_common::prepareQuery(global_common::SQL_SELECT_FREE, array($selectField, Model_CommentBad::TBL_SL_COMMENT_BAD, $whereClause . $orderBy));
     }
     //echo '<br>SQL:'.$strSQL;
     $arrResult = $this->_objConnection->selectCommand($strSQL);
     if (!$arrResult) {
         global_common::writeLog('get All sl_comment_bad:' . $strSQL, 1, $_mainFrame->pPage);
         return null;
     }
     //echo 'Merge bad comment info';
     //print_r($arrResult);
     $arrResult = global_common::mergeUserInfo($arrResult);
     //echo 'End Merge bad comment info';
     //print_r($arrResult);
     return $arrResult;
 }
Beispiel #9
0
 private function getCacheInfoBykey($arrInfo, $type, $keyInfo)
 {
     // TODO: DoNguyen - Đặt tên biến sai quy định: $KeyInfo -> $keyInfo (viết thường ký tự đầu của chữ đầu)
     switch ($type) {
         case 'xml':
             $key = 'cxiID';
             break;
         case 'sql':
             $key = 'csiID';
             break;
         case 'business':
             $key = 'cbiID';
             break;
     }
     // tim keyInfo trong $arrInfo
     foreach ($arrInfo as $item) {
         $attr = $item['attribute'];
         if ($attr) {
             if ($attr[$key] == 'default') {
                 $keyDefault = $attr;
             }
             if ($attr[$key] == $keyInfo) {
                 $cacheInfo = $attr;
                 break;
             }
         }
     }
     // Neu keyInfo khong co trong list item
     if (!$cacheInfo) {
         global_common::writeLog('Không tìm thấy keyInfo, sử dụng default key', 0);
         $cacheInfo = $keyDefault;
     }
     return $cacheInfo;
 }
Beispiel #10
0
        return;
    } else {
        echo global_common::convertToXML($strMessageHeader, array('rs'), array(0), array(0));
        return;
    }
} elseif ($_pgR["act"] == model_User::ACT_REGISTER) {
    //get user info
    //$c_userInfo = $_SESSION[consts::SES_C_USERINFO];
    //if ($objMenu->getMenuByName($_pgR['name'])) {
    //	echo global_common::convertToXML($arrHeader, array("rs",'info'), array(0,global_common::STRING_NAME_EXIST), array(0,1));
    //	return;
    //}
    $userName = $_pgR['UserName'];
    global_common::writeLog($userName);
    $userName = global_editor::rteSafe(html_entity_decode($userName, ENT_COMPAT, 'UTF-8'));
    global_common::writeLog($userName);
    $password = $_pgR['Password'];
    $password = global_editor::rteSafe(html_entity_decode($password, ENT_COMPAT, 'UTF-8'));
    $fullname = $_pgR['Fullname'];
    $fullname = global_editor::rteSafe(html_entity_decode($fullname, ENT_COMPAT, 'UTF-8'));
    $birthDate = $_pgR['BirthDate'];
    $birthDate = global_editor::rteSafe(html_entity_decode($birthDate, ENT_COMPAT, 'UTF-8'));
    $address = $_pgR['Address'];
    $address = global_editor::rteSafe(html_entity_decode($address, ENT_COMPAT, 'UTF-8'));
    $phone = $_pgR['Phone'];
    $phone = global_editor::rteSafe(html_entity_decode($phone, ENT_COMPAT, 'UTF-8'));
    $email = $_pgR['Email'];
    $email = global_editor::rteSafe(html_entity_decode($email, ENT_COMPAT, 'UTF-8'));
    $sex = $_pgR['Sex'];
    $sex = global_editor::rteSafe(html_entity_decode($sex, ENT_COMPAT, 'UTF-8'));
    $identity = $_pgR['Identity'];
Beispiel #11
0
 public function getAllProperty($intPage = 0, $selectField = '*', $whereClause = '', $orderBy = '')
 {
     if ($whereClause) {
         $whereClause = ' WHERE ' . $whereClause;
     }
     if ($orderBy) {
         $orderBy = ' ORDER BY ' . $orderBy;
     }
     if ($intPage > 0) {
         $strSQL .= global_common::prepareQuery(global_common::SQL_SELECT_FREE, array($selectField, Model_Property::TBL_SL_PROPERTY, $whereClause . $orderBy . ' limit ' . ($intPage - 1) * self::NUM_PER_PAGE . ',' . self::NUM_PER_PAGE));
     } else {
         $strSQL .= global_common::prepareQuery(global_common::SQL_SELECT_FREE, array($selectField, Model_Property::TBL_SL_PROPERTY, $whereClause . $orderBy));
     }
     //echo '<br>SQL:'.$strSQL;
     $arrResult = $this->_objConnection->selectCommand($strSQL);
     if (!$arrResult) {
         global_common::writeLog('get All sl_property:' . $strSQL, 1, $_mainFrame->pPage);
         return null;
     }
     $objDataType = new Model_Datatype($this->_objConnection);
     $allDataType = $objDataType->getAllDatatype();
     $dataTypes = array();
     foreach ($allDataType as $key => $info) {
         $dataTypes[$info[global_mapping::DataTypeID]] = $info;
         unset($dataTypes[$key]);
     }
     $count = count($arrResult);
     for ($index = 0; $index < $count; $index++) {
         $arrResult[$index][global_mapping::DataTypeID] = $dataTypes[$arrResult[$index][global_mapping::DataTypeID]];
     }
     //print_r($arrResult);
     return $arrResult;
 }
Beispiel #12
0
 public function getLatestRetailer($intPage = 0, $whereClause = '', $type, &$total)
 {
     if ($whereClause) {
         $whereClause = ' WHERE ' . $whereClause;
     }
     $orderBy = ' ORDER BY ' . global_mapping::ModifiedDate . ' DESC';
     $strSQL = global_common::prepareQuery(global_common::SQL_SELECT_FREE, array(global_mapping::ProductID, Model_Product::TBL_SL_PRODUCT, $whereClause));
     //echo '<br>SQL:'.$strSQL;
     $products = $this->_objConnection->selectCommand($strSQL);
     if (!$products) {
         global_common::writeLog('get All sl_product:' . $strSQL, 1, $_mainFrame->pPage);
         return null;
     }
     $productIDs = global_common::getArrayColumn($products, global_mapping::ProductID);
     $productIDs = array_unique($productIDs);
     //print_r($productIDs);
     $strQueryIN = global_common::convertToQueryIN($productIDs);
     $whereClause = 'Where ' . global_mapping::ProductID . ' IN (' . $strQueryIN . ')';
     if ($type) {
         $whereClause .= ' And ' . global_mapping::ProductStatusID . '=' . $type;
     }
     $strSQL = global_common::prepareQuery(global_common::SQL_SELECT_FREE, array('*', Model_Retailer::TBL_SL_RETAILER, $whereClause . $orderBy . ' limit ' . ($intPage - 1) * self::NUM_PER_PAGE . ',' . self::NUM_PER_PAGE));
     $arrResult = $this->_objConnection->selectCommand($strSQL);
     //echo $strSQL;
     if (!$arrResult) {
         global_common::writeLog('get All Retailers:' . $strSQL, 1, $_mainFrame->pPage);
         return null;
     }
     $strSQLCount = global_common::prepareQuery(global_common::SQL_SELECT_FREE, array('count(*)', Model_Retailer::TBL_SL_RETAILER, $whereClause));
     //Get details of product to display
     $productIDs = global_common::getArrayColumn($arrResult, global_mapping::ProductID);
     $productIDs = array_unique($productIDs);
     //print_r($productIDs);
     $strQueryIN = global_common::convertToQueryIN($productIDs);
     $productDetails = $this->getProductByIDs($productIDs);
     $convertedProducts = array();
     foreach ($productDetails as $key => $info) {
         $convertedProducts[$info[global_mapping::ProductID]] = $info;
         unset($productDetails[$key]);
     }
     $objStatus = new Model_Status($this->_objConnection);
     $productStatus = $objStatus->getAllStatus();
     $convertedStatus = array();
     foreach ($productStatus as $key => $info) {
         $convertedStatus[$info[global_mapping::StatusID]] = $info;
         unset($productStatus[$key]);
     }
     //echo '<br>$strSQLCount:'.$strSQLCount;
     //Get total results
     if ($strSQLCount) {
         $arrTotal = $this->_objConnection->selectCommand($strSQLCount);
         $total = $arrTotal[0][0];
     }
     //Assign product details to retailers by ProductID
     $count = count($arrResult);
     for ($index = 0; $index < $count; $index++) {
         $arrResult[$index]["Product"] = $convertedProducts[$arrResult[$index][global_mapping::ProductID]];
         $arrResult[$index][global_mapping::StatusName] = $convertedStatus[$arrResult[$index][global_mapping::ProductStatusID]][global_mapping::StatusName];
     }
     //echo 'Before merge comment info';
     $arrResult = global_common::mergeUserInfo($arrResult, $this->_objConnection);
     return $arrResult;
 }
Beispiel #13
0
 public function getArticleTypeByFilter($whereClause, $selectField = '*')
 {
     if ($whereClause) {
         $whereClause = ' WHERE ' . $whereClause;
     }
     $strSQL .= global_common::prepareQuery(global_common::SQL_SELECT_FREE, array($selectField, self::TBL_SL_ARTICLE_TYPE, $whereClause));
     //echo '<br>SQL:'.$strSQL;
     $arrResult = $this->_objConnection->selectCommand($strSQL);
     if (!$arrResult) {
         global_common::writeLog('get All sl_article_type:' . $strSQL, 1, $_mainFrame->pPage);
         return null;
     }
     //print_r($arrResult);
     return $arrResult;
 }
Beispiel #14
0
                    $userRetailer = $objUser->getUserByID($retailer[global_mapping::CreatedBy]);
                    $fullNameRetailer = $userRetailer[global_mapping::FullName];
                    $emailRetailer = $userRetailer[global_mapping::Email];
                    $fullName = $c_userInfo[global_mapping::FullName];
                    $linkArticle = global_common::getHostName() . '/retailer_detail.php?rid=' . $retailerID;
                    $commentDate = global_common::formatDateTimeVN($comment[global_mapping::CreatedDate]);
                    $commentContent = $comment[global_mapping::Content];
                    $linkPolicy = global_common::getHostName() . '/' . global_common::PAGE_TERM_KM;
                    $arrMailContent = global_common::formatMailContent(global_common::TEMPLATE_NEW_COMMENT, null, array(global_common::formatOutputText($fullName), global_common::formatOutputText($fullNameRetailer), $product[global_mapping::ProductName], global_common::formatOutputText($content), $linkArticle));
                    $emailSubject = $arrMailContent[0];
                    $emailContent = $arrMailContent[1];
                    //echo $emailContent;
                    global_mail::send($emailRetailer, $fullNameRetailer, $emailSubject, $emailContent, null, global_common::SUPPORT_MAIL_USERNAME, global_common::SUPPORT_MAIL_PASSWORD, global_common::SUPPORT_MAIL_DISPLAY_NAME);
                }
            } catch (Exception $e) {
                global_common::writeLog($e);
            }
            return;
        } else {
            echo global_common::convertToXML($arrHeader, array("rs", "info"), array(0, "Input data is invalid"), array(0, 1));
            return;
        }
    }
    //else
    //{
    //	echo global_common::convertToXML($arrHeader, array("rs",'info'), array(0,global_common::STRING_REQUIRE_LOGIN), array(0,1));
    //}
    return;
} elseif ($_pgR['act'] == Model_Comment::ACT_CHANGE_PAGE) {
    $intPage = $_pgR['p'];
    $retailerID = $_pgR[global_mapping::RetailerID];
Beispiel #15
0
 public function getAllUser($intPage = 0, $selectField = '*', $whereClause = '', $orderBy = '', &$total)
 {
     if ($whereClause) {
         $whereClause = ' WHERE ' . $whereClause;
     }
     if (!$selectField) {
         $selectField = '*';
     }
     if ($orderBy) {
         $orderBy = ' ORDER BY ' . $orderBy;
     }
     if ($intPage > 0) {
         $strSQL .= global_common::prepareQuery(global_common::SQL_SELECT_FREE, array($selectField, Model_User::TBL_SL_USER, $whereClause . $orderBy . ' limit ' . ($intPage - 1) * self::NUM_PER_PAGE . ',' . self::NUM_PER_PAGE));
         $strSQLCount .= global_common::prepareQuery(global_common::SQL_SELECT_FREE, array('count(*)', Model_User::TBL_SL_USER, $whereClause . $orderBy));
     } else {
         $strSQL .= global_common::prepareQuery(global_common::SQL_SELECT_FREE, array($selectField, Model_User::TBL_SL_USER, $whereClause . $orderBy));
     }
     $arrResult = $this->_objConnection->selectCommand($strSQL);
     if (!$arrResult) {
         global_common::writeLog('get All sl_user:'******'<br>$strSQLCount:'.$strSQLCount;
         $arrTotal = $this->_objConnection->selectCommand($strSQLCount);
         $total = $arrTotal[0][0];
     }
     //print_r($arrResult);
     return $arrResult;
 }
Beispiel #16
0
 public function getAllManufactory($selectField = '*')
 {
     $strSQL .= global_common::prepareQuery(global_common::SQL_SELECT_FREE, array($selectField, self::TBL_SL_MANUFACTORY, ''));
     //echo '<br>SQL:'.$strSQL;
     $arrResult = $this->_objConnection->selectCommand($strSQL);
     if (!$arrResult) {
         global_common::writeLog('get All sl_manufactory:' . $strSQL, 1, $_mainFrame->pPage);
         return null;
     }
     //print_r($arrResult);
     return $arrResult;
 }
Beispiel #17
0
 private function getArticlesFromDB($strSQL)
 {
     $arrResult = $this->_objConnection->selectCommand($strSQL);
     if (!$arrResult) {
         global_common::writeLog('get sl_article from DB:' . $strSQL, 1, $_mainFrame->pPage);
         return null;
     }
     return global_common::mergeUserInfo($arrResult);
 }
Beispiel #18
0
 public function getAllStatus($intPage = 0, $selectField = '*', $whereClause = '', $orderBy = '')
 {
     if ($whereClause) {
         $whereClause = ' WHERE ' . $whereClause . ' and (' . global_mapping::IsDeleted . '=0 or ' . global_mapping::IsDeleted . ' IS NULL)';
     } else {
         $whereClause = ' WHERE (' . global_mapping::IsDeleted . '=0 or ' . global_mapping::IsDeleted . ' IS NULL)';
     }
     if ($orderBy) {
         $orderBy = ' ORDER BY ' . $orderBy;
     }
     if ($intPage > 0) {
         $strSQL .= global_common::prepareQuery(global_common::SQL_SELECT_FREE, array($selectField, Model_Status::TBL_SL_STATUS, $whereClause . $orderBy . ' limit ' . ($intPage - 1) * self::NUM_PER_PAGE . ',' . self::NUM_PER_PAGE));
     } else {
         $strSQL .= global_common::prepareQuery(global_common::SQL_SELECT_FREE, array($selectField, Model_Status::TBL_SL_STATUS, $whereClause . $orderBy));
     }
     //echo '<br>SQL:'.$strSQL;
     $arrResult = $this->_objConnection->selectCommand($strSQL);
     if (!$arrResult) {
         global_common::writeLog('get All sl_status:' . $strSQL, 1, $_mainFrame->pPage);
         return null;
     }
     //print_r($arrResult);
     return $arrResult;
 }
 public function getAllPropertyGroup($intPage = 0, $selectField = '*', $whereClause = '', $orderBy = '', &$total)
 {
     if (!$selectField) {
         $selectField = '*';
     }
     if ($whereClause) {
         $whereClause = ' WHERE ' . $whereClause;
     }
     if ($orderBy) {
         $orderBy = ' ORDER BY ' . $orderBy . ' ,`Order`';
     } else {
         $orderBy = ' ORDER BY `Order`';
     }
     if ($intPage > 0) {
         $strSQL .= global_common::prepareQuery(global_common::SQL_SELECT_FREE, array($selectField, Model_PropertyGroup::TBL_SL_PROPERTY_GROUP, $whereClause . $orderBy . ' limit ' . ($intPage - 1) * self::NUM_PER_PAGE . ',' . self::NUM_PER_PAGE));
     } else {
         $strSQL .= global_common::prepareQuery(global_common::SQL_SELECT_FREE, array($selectField, Model_PropertyGroup::TBL_SL_PROPERTY_GROUP, $whereClause . $orderBy));
     }
     //echo '<br>SQL:'.$strSQL;
     $arrResult = $this->_objConnection->selectCommand($strSQL);
     if (!$arrResult) {
         global_common::writeLog('get All sl_property_group:' . $strSQL, 1, $_mainFrame->pPage);
         return null;
     }
     $total = count($arrResult);
     $objCat = new Model_ArticleType($this->_objConnection);
     $allCats = $objCat->getAllArticleType(0);
     $convertedCats = array();
     foreach ($allCats as $key => $info) {
         $convertedCats[$info[global_mapping::ArticleTypeID]] = $info;
         unset($allCats[$key]);
     }
     $count = count($arrResult);
     for ($index = 0; $index < $count; $index++) {
         $arrResult[$index][global_mapping::ArticleTypeName] = $convertedCats[$arrResult[$index][global_mapping::ArticleTypeID]][global_mapping::ArticleTypeName];
     }
     //print_r($arrResult);
     return $arrResult;
 }
Beispiel #20
0
 public function getAllArticleType($intPage = 0, $selectField = '*', $whereClause = '', $orderBy = '')
 {
     $selectField = $selectField ? $selectField : '*';
     if ($whereClause) {
         $whereClause = ' WHERE ' . $whereClause . ' and (' . global_mapping::IsDeleted . ' is null or ' . global_mapping::IsDeleted . '=0)';
     } else {
         $whereClause = ' WHERE  (' . global_mapping::IsDeleted . ' is null or ' . global_mapping::IsDeleted . ' !=1)';
     }
     if ($orderBy && trim($orderBy) != 'Level') {
         $orderBy = ' ORDER BY Level,' . $orderBy . '';
     } else {
         $orderBy = ' ORDER BY Level';
     }
     if ($intPage > 0) {
         $strSQL .= global_common::prepareQuery(global_common::SQL_SELECT_FREE, array($selectField, Model_ArticleType::TBL_SL_ARTICLE_TYPE, $whereClause . $orderBy . ' limit ' . ($intPage - 1) * self::NUM_PER_PAGE . ',' . self::NUM_PER_PAGE));
     } else {
         $strSQL .= global_common::prepareQuery(global_common::SQL_SELECT_FREE, array($selectField, Model_ArticleType::TBL_SL_ARTICLE_TYPE, $whereClause . $orderBy));
     }
     //echo $strSQL;
     $arrResult = $this->_objConnection->selectCommand($strSQL);
     if (!$arrResult) {
         global_common::writeLog('get All sl_article_type:' . $strSQL, 1, $_mainFrame->pPage);
         return null;
     }
     //print_r($arrResult);
     return $arrResult;
 }
Beispiel #21
0
 public function getMaxValueofField($objConnection, $fieldName, $strTableName)
 {
     $strSQL .= global_common::prepareQuery(global_common::SQL_SELECT_MAX_ID, array($fieldName, $strTableName));
     //echo '<br>SQL:'.$strSQL;
     $arrResult = $objConnection->selectCommand($strSQL);
     if (!$arrResult) {
         global_common::writeLog('get getMaxValueofField:' . $strSQL, 1, $_mainFrame->pPage);
         return null;
     }
     //print_r($arrResult);
     return $arrResult[0]['maxid'];
 }
 public function getAllNumberaire($intPage = 0, $selectField = '*', $whereClause = '', $orderBy = '')
 {
     if ($whereClause) {
         $whereClause = ' WHERE ' . $whereClause;
     }
     if ($orderBy) {
         $orderBy = ' ORDER BY ' . $orderBy;
     }
     if ($intPage > 0) {
         $strSQL .= global_common::prepareQuery(global_common::SQL_SELECT_FREE, array($selectField, Model_Numberaire::TBL_SL_NUMBERAIRE, $whereClause . $orderBy . ' limit ' . ($intPage - 1) * self::NUM_PER_PAGE . ',' . self::NUM_PER_PAGE));
     } else {
         $strSQL .= global_common::prepareQuery(global_common::SQL_SELECT_FREE, array($selectField, Model_Numberaire::TBL_SL_NUMBERAIRE, $whereClause . $orderBy));
     }
     //echo '<br>SQL:'.$strSQL;
     $arrResult = $this->_objConnection->selectCommand($strSQL);
     if (!$arrResult) {
         global_common::writeLog('get All sl_numberaire:' . $strSQL, 1, $_mainFrame->pPage);
         return null;
     }
     //print_r($arrResult);
     return $arrResult;
 }
 function getPriceFromURL($url, $pathCode)
 {
     try {
         $html = file_get_html($url);
         //echo $url;
         if ($html) {
             foreach ($html->find($pathCode) as $e) {
                 $myContent = $e->innertext;
             }
             $myContent = preg_replace('/\\D/', '', $myContent);
             return $myContent;
         } else {
             global_common::writeLog("Can't get price from url:" . $url);
         }
     } catch (exception $ex) {
         global_common::writeLog("Can't get price from url" . $url);
     }
     return -1;
 }
Beispiel #24
0
 public function getAllNotificationType($selectField = '*')
 {
     $strSQL .= global_common::prepareQuery(global_common::SQL_SELECT_FREE, array($selectField, self::TBL_SL_NOTIFICATION_TYPE, ''));
     //echo '<br>SQL:'.$strSQL;
     $arrResult = $this->_objConnection->selectCommand($strSQL);
     if (!$arrResult) {
         global_common::writeLog('get All sl_notification_type:' . $strSQL, 1, $_mainFrame->pPage);
         return null;
     }
     //print_r($arrResult);
     return $arrResult;
 }
 public function getStoreByIDs($arrIDs)
 {
     $arrIDs = global_common::splitString($arrIDs);
     $strQueryIN = global_common::convertToQueryIN($arrIDs);
     if ($strQueryIN) {
         $strQueryIN = global_mapping::StoreID . ' IN (' . $strQueryIN . ')';
     } else {
         $strQueryIN = '1=1';
     }
     $whereClause = 'WHERE ' . $strQueryIN;
     $strSQL .= global_common::prepareQuery(global_common::SQL_SELECT_FREE, array('*', self::TBL_SL_STORE, $whereClause . ' ' . ' limit 0,' . self::NUM_PER_PAGE));
     //echo $strSQL;
     $arrResult = $this->_objConnection->selectCommand($strSQL);
     if (!$arrResult) {
         global_common::writeLog('get getProductByIDs:' . $strSQL, 1, $_mainFrame->pPage);
         return null;
     }
     $objCity = new Model_City($this->_objConnection);
     $objDistrict = new Model_District($this->_objConnection);
     $tempVarCities = $objCity->getAllCity();
     $allCities = null;
     foreach ($tempVarCities as $key => $info) {
         $allCities[$info[global_mapping::CityID]] = $info;
         unset($tempVarCities[$key]);
     }
     $tempDistricts = $objDistrict->getAllDistrict();
     $allDistricts = null;
     foreach ($tempDistricts as $key => $info) {
         $allDistricts[$info[global_mapping::DistrictID]] = $info;
         unset($tempDistricts[$key]);
     }
     // print_r($allDistricts);
     // return;
     $count = count($arrResult);
     $objArticle = new Model_Article($this->_objConnection);
     for ($i = 0; $i < $count; $i++) {
         //echo $arrResult;
         //print_r( $allCities);
         //$arrResult[$i][global_mapping::CityID] = $allCities[$arrResult[$i][global_mapping::CityID]];
         $arrResult[$i][global_mapping::CityName] = $allCities[$arrResult[$i][global_mapping::CityID]][global_mapping::CityName];
         // print_r($arrResult[$i]);
         //return;
         // print_r($allCities[$arrResult[$i][global_mapping::CityID]]);
         //break;
         $arrResult[$i][global_mapping::DistrictName] = $allDistricts[$arrResult[$i][global_mapping::DistrictID]][global_mapping::DistrictName];
         $arrResult[$i][global_mapping::Latitude] = global_common::convertToDecimal($arrResult[$i][global_mapping::Latitude]);
         $arrResult[$i][global_mapping::Longitude] = global_common::convertToDecimal($arrResult[$i][global_mapping::Longitude]);
         $arrArticle = $objArticle->getArticleByStoreID($arrResult[$i][global_mapping::StoreID]);
         $shortDescription = global_common::formatPlanText($arrArticle[0][global_mapping::Content]);
         $arrResult[$i][global_mapping::Content] = global_common::cutString2($shortDescription, 0, 16);
         // print_r($arrResult[$i]);
         //echo $arrResult[$i][global_mapping::DistrictID];
         //echo $allDistricts[$arrResult[$i][global_mapping::DistrictID]][global_mapping::DistrictName];
         //print_r($allDistricts);
         //return ;
     }
     //print_r($stores);
     return $arrResult;
 }