Example #1
0
 public function action_index()
 {
     // Statusモデルから結果を取得する
     $results = Model_Status::find_body_by_username('foo');
     // $resultsをダンプして確認する
     Debug::dump($results);
 }
 * This file was automatically generated By Code Smith 
 * Modifications will be overwritten when code smith is run
 *
 * PLEASE DO NOT MAKE MODIFICATIONS TO THIS FILE
 * Date Created 5/6/2012
 *
 */
/// <summary>
/// Implementations of slstatus represent a Status
///
/// </summary>
chdir("..");
/* TODO: Add code here */
require 'config/globalconfig.php';
include_once 'class/model_status.php';
$objStatus = new Model_Status($objConnection);
if ($_pgR["act"] == model_Status::ACT_ADD) {
    if (global_common::isCLogin()) {
        //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;
        //}
        $statusID = $_pgR['StatusID'];
        $statusID = global_editor::rteSafe(html_entity_decode($statusID, ENT_COMPAT, 'UTF-8'));
        $statusName = $_pgR['StatusName'];
        $statusName = global_editor::rteSafe(html_entity_decode($statusName, ENT_COMPAT, 'UTF-8'));
        $status = $_pgR['Status'];
        $status = global_editor::rteSafe(html_entity_decode($status, ENT_COMPAT, 'UTF-8'));
        $type = $_pgR['Type'];
Example #3
0
include_once 'class/model_user.php';
include_once 'class/model_product.php';
include_once 'class/model_property.php';
include_once 'class/model_productproperty.php';
include_once 'class/model_retailer.php';
include_once 'class/model_status.php';
include_once 'class/model_city.php';
include_once 'class/model_property.php';
include_once 'class/model_productprice.php';
include_once 'class/model_productproperty.php';
include_once 'class/model_propertygroup.php';
include_once 'class/model_datatype.php';
include_once 'class/model_manufactory.php';
include_once 'class/model_city.php';
$objProduct = new Model_Product($objConnection);
$objStatus = new Model_Status($objConnection);
$objCity = new Model_City($objConnection);
$objProductProperty = new Model_ProductProperty($objConnection);
$objArticleType = new Model_ArticleType($objConnection);
$objProductPrice = new Model_ProductPrice($objConnection);
$objProperty = new Model_Property($objConnection);
$objManufactory = new Model_Manufactory($objConnection);
$objRetailer = new Model_Retailer($objConnection);
$page = $_pgR["p"] ? $_pgR["p"] : 1;
$catID = $_pgR["cid"];
$manu = $_pgR["manu"];
$allCats = $objArticleType->getAllArticleType(0, null, '', null);
$allCities = $objCity->getAllCity();
if ($catID == 0) {
    $allCatIDs = '';
} else {
Example #4
0
 public function getProductPriceByProduct($objID, $selectField = '*')
 {
     $selectField = $selectField ? $selectField : '*';
     $strSQL .= global_common::prepareQuery(global_common::SQL_SELECT_FREE, array($selectField, self::TBL_SL_PRODUCT_PRICE, 'WHERE ProductID = \'' . $objID . '\' '));
     //echo '<br>SQL:'.$strSQL;
     $arrResult = $this->_objConnection->selectCommand($strSQL);
     if (!$arrResult) {
         global_common::writeLog('get sl_product_price ByID:' . $strSQL, 1, $_mainFrame->pPage);
         return null;
     }
     $objStatus = new Model_Status($this->_objConnection);
     $allStatus = $objStatus->getAllStatus();
     $statuses = array();
     foreach ($allStatus as $key => $info) {
         $statuses[$info[global_mapping::StatusID]] = $info;
         unset($allStatus[$key]);
     }
     //print_r($statuses);
     $count = count($arrResult);
     for ($index = 0; $index < $count; $index++) {
         //print_r($statuses[$arrResult[$index][global_mapping::TypeID]]);
         if ($statuses[$arrResult[$index][global_mapping::TypeID]]) {
             $pathCode = $statuses[$arrResult[$index][global_mapping::TypeID]][global_mapping::ExtraInfo];
             //echo$arrResult[$index][global_mapping::ProductLink];
             try {
                 $arrResult[$index][global_mapping::Price] = global_common::getPriceFromURL($arrResult[$index][global_mapping::ProductLink], $pathCode);
             } catch (Exception $ex) {
                 //$arrResult[$index]
             }
         }
     }
     //print_r($arrResult);
     return $arrResult;
 }
Example #5
0
require 'config/globalconfig.php';
$_SESSION[global_common::SES_C_CUR_PAGE] = "post_price.php";
include_once 'include/_permission.inc';
include_once 'class/model_articletype.php';
include_once 'class/model_product.php';
include_once 'class/model_comment.php';
include_once 'class/model_user.php';
include_once 'class/model_city.php';
include_once 'class/model_district.php';
include_once 'class/model_status.php';
include_once 'class/model_retailer.php';
$objProduct = new Model_Product($objConnection);
$objArticleType = new Model_ArticleType($objConnection);
$objCity = new Model_City($objConnection);
$objDistrict = new Model_District($objConnection);
$objStatus = new Model_Status($objConnection);
$objRetailer = new Model_Retailer($objConnection);
$productStatuses = $objStatus->getAllStatus(0, '*', global_mapping::Type . '=' . global_common::STATUS_PRODUCT_TYPE);
$intMode = 0;
//add mode
$allCities = $objCity->getAllCity();
//echo 'get city:';
//echo($allCities);
if ($_pgR["pid"]) {
    $currentProduct = $objProduct->getProductByID($_pgR["pid"]);
}
if ($_pgR["rid"]) {
    $retailerID = $_pgR["rid"];
    $retailter = $objRetailer->getRetailerByID($retailerID);
    $intMode = 1;
    //edit mode
Example #6
0
 public function getRetailerByProducts($intPage, $productIds, $type, $city, $status, &$total)
 {
     if (!$selectField) {
         $selectField = '*';
     }
     $arrIDs = global_common::splitString($productIds);
     $strQueryIN = global_common::convertToQueryIN($arrIDs);
     if ($strQueryIN) {
         $strQueryIN = global_mapping::ProductID . ' IN( ' . $strQueryIN . ') and';
     } else {
         $strQueryIN = '1 != and';
     }
     if ($city) {
         $city = ' and `' . global_mapping::CityID . '` = ' . $city . ' ';
     } else {
         $city = ' and 1=1 ';
     }
     if ($type) {
         $type = ' and `' . global_mapping::ProductStatusID . '` = ' . $type . ' ';
     } else {
         $type = ' and 1=1 ';
     }
     if ($status) {
         $status = '  (`' . global_mapping::StatusID . '` = ' . global_common::STATUS_ACTIVE . ' or `' . global_mapping::StatusID . '` is null)';
     } else {
         $status = '  `' . global_mapping::StatusID . '` = ' . global_common::STATUS_INACTIVE;
     }
     if ($intPage > 0) {
         $strSQLCount = global_common::prepareQuery(global_common::SQL_SELECT_FREE, array("count(*)", self::TBL_SL_RETAILER, 'WHERE ' . $strQueryIN . $status . $type . $city));
         $strSQL = global_common::prepareQuery(global_common::SQL_SELECT_FREE, array($selectField, self::TBL_SL_RETAILER, 'WHERE ' . $strQueryIN . $status . $type . $city . $orderBy . ' limit ' . ($intPage - 1) * self::NUM_PER_PAGE . ',' . self::NUM_PER_PAGE));
     } else {
         $strSQL = global_common::prepareQuery(global_common::SQL_SELECT_FREE, array($selectField, self::TBL_SL_RETAILER, 'WHERE ' . $strQueryIN . $status . $type . $city));
     }
     //echo '<br>SQL:'.$strSQL;
     $arrResult = $this->_objConnection->selectCommand($strSQL);
     if (!$arrResult) {
         global_common::writeLog('get sl_retailer ByID:' . $strSQL, 1, $_mainFrame->pPage);
         return null;
     }
     if ($strSQLCount) {
         //echo $strSQLCount;
         $arrTotal = $this->_objConnection->selectCommand($strSQLCount);
         $total = $arrTotal[0][0];
     }
     //echo $total;
     $productIDs = global_common::getArrayColumn($arrResult, global_mapping::ProductID);
     //print_r($productIDs);
     $productIDs = array_unique($productIDs);
     $objProduct = new Model_Product($this->_objConnection);
     $products = $objProduct->getProductByIDs($productIDs);
     $temp = array();
     foreach ($products as $key => $info) {
         $temp[$info[global_mapping::ProductID]] = $info;
         unset($products[$key]);
     }
     $products = $temp;
     //print_r($products);
     $objStatus = new Model_Status($this->_objConnection);
     $allStatus = $objStatus->getAllStatus();
     $statuses = array();
     foreach ($allStatus as $key => $info) {
         $statuses[$info[global_mapping::StatusID]] = $info;
         unset($allStatus[$key]);
     }
     $count = count($arrResult);
     for ($i = 0; $i < $count; $i++) {
         $arrResult[$i][global_mapping::ProductStatus] = $statuses[$arrResult[$i][global_mapping::ProductStatusID]][global_mapping::StatusName];
         $arrResult[$i][global_mapping::ProductName] = $products[$arrResult[$i][global_mapping::ProductID]][global_mapping::ProductName];
     }
     $arrResult = global_common::mergeUserInfo($arrResult, $this->_objConnection);
     //print_r($arrResult);
     return $arrResult;
 }
Example #7
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;
 }