public function refreshArticle($articleID, $currentUser) { $currentArticle = $this->getArticleByID($articleID); $renewNum = $currentArticle[global_mapping::RenewedNum]; $renewedDate = $currentArticle[global_mapping::RenewedDate]; $diffDay = global_common::datediff(global_common::getDate(), date('d-m-Y', strtotime($renewedDate)), d); if ($diffDay > 0) { $renewNum = 0; } if ($renewNum < self::NUM_REFRESH) { $renewNum += 1; $title = $currentArticle[global_mapping::Title]; $fileName = $currentArticle[global_mapping::FileName]; $catalogueID = $currentArticle[global_mapping::CatalogueID]; $content = $currentArticle[global_mapping::Content]; $tags = $currentArticle[global_mapping::Tags]; $createdBy = $currentArticle[global_mapping::CreatedBy]; $createdDate = global_common::formatDateTimeVN($currentArticle[global_mapping::CreatedDate]); $modifiedBy = $currentUser[global_mapping::UserID]; $renewedDate = global_common::nowSQL(); $companyName = $currentArticle[global_mapping::CompanyName]; $companyAddress = $currentArticle[global_mapping::CompanyAddress]; $companyWebsite = $currentArticle[global_mapping::CompanyWebsite]; $companyPhone = $currentArticle[global_mapping::CompanyPhone]; $adType = $currentArticle[global_mapping::AdType]; $startDate = global_common::formatDateTimeVN($currentArticle[global_mapping::StartDate]); $endDate = global_common::formatDateTimeVN($currentArticle[global_mapping::EndDate]); $happyDays = $currentArticle[global_mapping::HappyDays]; $startHappyHour = $currentArticle[global_mapping::StartHappyHour]; $endHappyHour = $currentArticle[global_mapping::EndHappyHour]; $addresses = $currentArticle[global_mapping::Addresses]; $dictricts = $currentArticle[global_mapping::Dictricts]; $cities = $currentArticle[global_mapping::Cities]; $resultID = $this->update($articleID, null, $title, $fileName, $catalogueID, $content, null, $tags, $numView, $numComment, $createdBy, $createdDate, $modifiedBy, global_common::nowSQL(), null, null, 0, null, null, $renewedDate, $renewNum, $companyName, $companyAddress, $companyWebsite, $companyPhone, $adType, $startDate, $endDate, $happyDays, $startHappyHour, $endHappyHour, $addresses, $dictricts, $cities); if (!$resultID) { //echo $strSQL; global_common::writeLog('Error refreshArticle sl_article:' . $articleID, 1); return -1; } return self::NUM_REFRESH - $renewNum; } return -1; }