Exemplo n.º 1
0
$objCity = new Model_City($objConnection);
$objDistrict = new Model_District($objConnection);
$intMode = 0;
//add mode
$parentTypes = $objArticleType->getAllArticleType(0, null, 'ParentID=0', 'Level');
$allTypes = $objArticleType->getAllArticleType(0, null, 'ParentID=' . $parentTypes[0][global_mapping::ArticleTypeID], 'Level');
$allCities = $objCity->getAllCity();
//echo 'get city:';
//echo($allCities);
$allDistricts = $objDistrict->getAllDistrict();
$currentPartner = $objPartner->getPartnerByUserID($_SESSION[global_common::SES_C_USERINFO][global_mapping::UserID]);
if ($_pgR["aid"]) {
    //reset partner info
    $currentPartner = null;
    $articleID = $_pgR["aid"];
    $article = $objArticle->getArticleByID($articleID);
    $intMode = 1;
    //edit mode
    $createBy = $article[global_mapping::CreatedBy];
    $currentUserID = $_SESSION[global_common::SES_C_USERINFO][global_mapping::UserID];
    if ($createBy != $currentUserID) {
        global_common::redirectByScript("index.php");
        return;
    }
    //print_r($article[global_mapping::ArticleID]);
    $currentTypes = $objArticle->getArticleTypesByID($article[global_mapping::ArticleID]);
    //print_r($currentTypes);
    $type = $objArticleType->getArticleTypeByID($currentTypes[0]);
    $currentParentType = $type[global_mapping::ParentID];
    //print_r($currentParentType);
    $parentTypes = $objArticleType->getAllArticleType(0, null, 'ParentID=0', 'Level');
Exemplo n.º 2
0
         //echo global_common::convertToXML($arrHeader, array("rs","info"), array(0,$resultID), array(0,1));
         //return;
         if ($resultID) {
             $commentHTML = $objComment->getCommentHTMLByArticle($articleid);
             $arrHeader = global_common::getMessageHeaderArr($banCode);
             //$banCode
             echo global_common::convertToXML($arrHeader, array("rs", "inf", "form"), array(1, 'Gửi bình luận thành công', $commentHTML), array(0, 1, 1));
             return;
         } else {
             echo global_common::convertToXML($arrHeader, array("rs", "info"), array(0, "Input data is invalid"), array(0, 1));
             return;
         }
     } else {
         $modifiedBy = $c_userInfo[global_mapping::UserID];
         $articleID = html_entity_decode($_pgR[global_mapping::ArticleID], ENT_COMPAT, 'UTF-8');
         $currentArticle = $objArticle->getArticleByID($articleID);
         $resultID = $objArticle->update($articleID, null, $title, $fileName, $catalogueID, $content, null, $tags, null, null, $currentArticle[global_mapping::CreatedBy], $currentArticle[global_mapping::CreatedDate], $modifiedBy, global_common::nowSQL(), null, null, 1, null, null, null, null, $companyName, $companyAddress, $companyWebsite, $companyPhone, $adType, $startDate, $endDate, $happyDays, $startHappyHour, $endHappyHour, $addresses, $dictricts, $cities);
         if ($resultID) {
             $arrHeader = global_common::getMessageHeaderArr($banCode);
             //$banCode
             echo global_common::convertToXML($arrHeader, array("rs", "inf"), array(1, 'Cập nhật thành công'), array(0, 1));
             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));
        } else {
            echo global_common::convertToXML($arrHeader, array("rs"), array(0), array(0));
            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_Article::ACT_CHANGE_PAGE) {
    $intPage = $_pgR['p'];
    $outPutHTML = $objArticle->getListArticle($intPage);
    echo global_common::convertToXML($strMessageHeader, array('rs', 'inf'), array(1, $outPutHTML), array(0, 1));
    return;
} elseif ($_pgR['act'] == model_Article::ACT_SHOW_EDIT) {
    $strArticleID = $_pgR['id'];
    $arrArticle = $objArticle->getArticleByID($strArticleID);
    echo global_common::convertToXML($strMessageHeader, array('rs', 'ArticleID', 'Prefix', 'Title', 'FileName', 'ArticleType', 'Content', 'NotificationType', 'Tags', 'CatalogueID', 'SectionID', 'NumView', 'NumComment', 'Status', 'comments', 'RenewedDate', 'RenewedNum'), array(1, 'ArticleID', 'Prefix', 'Title', 'FileName', 'ArticleType', 'Content', 'NotificationType', 'Tags', 'CatalogueID', 'SectionID', 'NumView', 'NumComment', 'Status', 'comments', 'RenewedDate', 'RenewedNum'), array(0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0));
    return;
} elseif ($_pgR["act"] == model_Article::ACT_GET) {
    $sectionID = $_pgR["sect"];
    $arrSection = $objMenu->getAllMenuBySection($sectionID);
    if ($arrSection) {
        $strHTML = $objMenu->outputHTMLMenu($arrSection);
        echo global_common::convertToXML($arrHeader, array("rs", "inf"), array(1, $strHTML), array(0, 1));
        return;
    } else {
        echo global_common::convertToXML($arrHeader, array("rs", 'inf'), array(0, 'Kh?ng c? nh?m h?ng'), array(0, 0));
        return;
    }
} elseif ($_pgR['act'] == model_Article::ACT_DELETE) {
    $IDName = "menu_id";