本文整理汇总了PHP中global_common::cutLast方法的典型用法代码示例。如果您正苦于以下问题:PHP global_common::cutLast方法的具体用法?PHP global_common::cutLast怎么用?PHP global_common::cutLast使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类global_common
的用法示例。
在下文中一共展示了global_common::cutLast方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Model_Manufactory
$objManufactory = new Model_Manufactory($objConnection);
$catID = $_pgR['cid'];
//Just get from "article_list.php"
//$district = $_pgR['ds'];
$keyword = $_pgR['kw'];
$manu = $_pgR['manu'];
$properties = $_pgR['property'];
$filterProperty = '';
foreach ($properties as $key => $info) {
//echo $key;
if ($info) {
$filterProperty .= '(GROUP_CONCAT(\'&&\',propertyid, propertyvalue,\'&&\') LIKE \'%&&' . $key . $info . '&&%\') And ';
}
}
if ($filterProperty) {
$filterProperty = global_common::cutLast($filterProperty, 4);
$filterProperty = '1=1 GROUP BY productid HAVING ' . $filterProperty;
//echo $filterProperty;
$productProperties = $objProductProperty->getAllProductProperty(0, global_mapping::ProductID, $filterProperty);
$productIDs = global_common::getArrayColumn($productProperties, global_mapping::ProductID);
$productInIDs = global_common::convertToQueryIN($productIDs);
}
$search = '';
$_arrCategories = $objArticleType->getAllArticleType(0, null, '`ParentID`=0', 'Level');
//echo $catID;
$cat = $objArticleType->getArticleTypeByID($catID);
//print_r($cat);
$_currentParentCatID = $catID;
if ($cat) {
$_currentParentCatID = $cat[global_mapping::ParentID];
$search = '`' . global_mapping::CatalogueID . '` = ' . $catID . ' ';
示例2: update
public function update($articleid, $prefix, $title, $filename, $articletype, $content, $notificationtype, $tags, $numview, $numcomment, $createdby, $createddate, $modifiedby, $modifieddate, $deletedby, $deleteddate, $isdeleted, $status, $comments, $reneweddate, $renewednum, $companyname, $companyAddress, $companyWebsite, $companyPhone, $adType, $startDate, $endDate, $happyDays, $startHappyHour, $endHappyHour, $addresses, $dictricts, $cities)
{
$strTableName = self::TBL_SL_ARTICLE;
$strSQL = global_common::prepareQuery(self::SQL_UPDATE_SL_ARTICLE, array($strTableName, global_common::escape_mysql_string($articleid), global_common::escape_mysql_string($prefix), global_common::escape_mysql_string($title), global_common::escape_mysql_string($filename), global_common::escape_mysql_string($content), global_common::escape_mysql_string($notificationtype), global_common::escape_mysql_string($tags), global_common::escape_mysql_string($numview), global_common::escape_mysql_string($numcomment), global_common::escape_mysql_string($createdby), global_common::escape_mysql_string($createddate), global_common::escape_mysql_string($modifiedby), global_common::escape_mysql_string($modifieddate), global_common::escape_mysql_string($deletedby), global_common::escape_mysql_string($deleteddate), global_common::escape_mysql_string($isdeleted), global_common::escape_mysql_string($status), global_common::escape_mysql_string($comments), global_common::escape_mysql_string($reneweddate), global_common::escape_mysql_string($renewednum), global_common::escape_mysql_string($companyname), global_common::escape_mysql_string($companyAddress), global_common::escape_mysql_string($companyWebsite), global_common::escape_mysql_string($companyPhone), global_common::escape_mysql_string($adType), '\'' . global_common::formatDateTimeSQL($startDate) . '\'', global_common::formatDateTimeSQL($endDate) ? '\'' . global_common::formatDateTimeSQL($endDate) . '\'' : 'null', global_common::escape_mysql_string($happyDays), $startHappyHour ? '\'' . $startHappyHour . '\'' : 'null', $endHappyHour ? '\'' . $endHappyHour . '\'' : 'null', global_common::escape_mysql_string($addresses), global_common::escape_mysql_string($dictricts), global_common::escape_mysql_string($cities)));
if (!global_common::ExecutequeryWithCheckExistedTable($strSQL, self::SQL_CREATE_TABLE_SL_ARTICLE, $this->_objConnection, $strTableName)) {
//echo $strSQL;
global_common::writeLog('Error add sl_article:' . $strSQL, 1);
return false;
}
$strSQL = global_common::prepareQuery(global_common::SQL_DELETE_BY_CONDITION, array(self::TBL_SL_ARTICLE_TYPE_ID, global_mapping::ArticleID, $articleid));
if (global_common::ExecutequeryWithCheckExistedTable($strSQL, self::SQL_CREATE_TABLE_SL_ARTICLE_TYPE_ID, $this->_objConnection, self::TBL_SL_ARTICLE_TYPE_ID)) {
$strSQLValueType = '';
foreach ($articletype as $item) {
$strSQLValueType .= '(\'' . $item . '\', \'' . $articleid . '\'),';
}
$strSQLValueType = global_common::cutLast($strSQLValueType);
$strSQL = global_common::prepareQuery(self::SQL_INSERT_SL_ARTICLE_TYPE_ID, array(self::TBL_SL_ARTICLE_TYPE_ID, $strSQLValueType));
if (!global_common::ExecuteMultiqueryWithCheckExistedTable($strSQL, self::SQL_CREATE_TABLE_SL_ARTICLE_TYPE_ID, $this->_objConnection, self::TBL_SL_ARTICLE_TYPE_ID)) {
}
global_common::writeLog('Error add sl_article_type_id:' . $strSQL, 1);
}
return $articleid;
}
示例3: getSQLSelectByTableName
/**
* get sql select articles from multi tables
*
* @param mixed $arrSummary This is a description
* @param mixed $intPage This is a description
* @param mixed $topRow top of article, 0: get all
* @param mixed $selectField This is a description
* @param mixed $whereClause This is a description
* @param mixed $orderBy This is a description
* @return mixed This is the return value description
*
*/
private function getSQLSelectByTableName($arrSummary, $intPage, $topRow, $selectField, $whereClause, $orderBy)
{
if ($orderBy) {
$orderBy = ' ORDER BY ' . $orderBy;
}
$listArticleID = '';
foreach ($arrSummary as $item) {
$listArticleID = $item[global_mapping::SubContents] . $listArticleID;
}
$arrDocInTable = global_common::getListTableName($listArticleID, $intPage, Model_Article::NUM_PER_PAGE, global_common::SEPARATE_BY_MONTH);
$strSQL = '';
$condition = '';
foreach ($arrDocInTable as $key => $iDoc) {
//print_r($iDoc);
//check endWith ',' and then remove it
if (global_common::endsWith($iDoc, ',')) {
$strDocInTable = global_common::cutLast($iDoc, 1);
}
$strTableName = Model_Article::TBL_SL_ARTICLE . '_' . $key;
if ($whereClause) {
$condition = 'WHERE (' . global_mapping::IsDeleted . ' IS NULL or ' . global_mapping::IsDeleted . ' = \'0\') and `' . global_mapping::ArticleID . '` IN (' . $strDocInTable . ') and ' . $whereClause;
} else {
$condition = 'WHERE (' . global_mapping::IsDeleted . ' IS NULL or ' . global_mapping::IsDeleted . ' = \'0\') and `' . global_mapping::ArticleID . '` IN (' . $strDocInTable . ')';
}
if ($topRow > 0) {
$strSQL .= "(" . global_common::prepareQuery(global_common::SQL_SELECT_FREE_LIMIT, array($selectField, $strTableName, $condition . $orderBy, 0, $topRow)) . " ) UNION ALL ";
} else {
$strSQL .= "(" . global_common::prepareQuery(global_common::SQL_SELECT_FREE, array($selectField, $strTableName, $condition . $orderBy)) . " ) UNION ALL ";
}
}
//xóa bỏ đoạn text UNION ALL cuối chuỗi $strSQL
$strSQL = global_common::cutLast($strSQL, strlen('UNION ALL '));
//echo $strSQL;
return $strSQL;
}
示例4: getUserDetailByMultiTable
/**
* lấy thông tin detail của một vài c_user,c_user_detail
*
* @param string $userList danh sách các id c_user
* @param object $objConnection connect to db
* @param string $selectField các cột sẽ lấy dữ liệu về
* @return array thông tin các user
* GiaTran
*/
private function getUserDetailByMultiTable($userList, $objConnection, $selectField = '*')
{
// build group table - optimize select query
$userList = global_common::splitString($userList);
//print_r($userList);
$arrDocInTable = array();
foreach ($userList as $key) {
$suffix = global_common::getTableSuffixByAlphabet($key);
$arrDocInTable[$suffix] .= '\'' . $key . '\',';
}
foreach ($arrDocInTable as $iDoc) {
$key = global_common::getTableSuffixByAlphabet(substr($iDoc, 1, 2));
$arrDocInTable[$key] = global_common::cutLast($iDoc, 1);
$tbName = global_common::builtTableName(Model_User::TBL_SL_USER, $key);
$selectField = '*';
$strSQL .= "(" . global_common::prepareQuery(global_common::SQL_SELECT_BY_CONDITION1, array($selectField, $tbName, '`UserID` IN (' . $arrDocInTable[$key] . ')')) . ') UNION ALL ';
}
if ($strSQL != '') {
$strSQL = substr($strSQL, 0, strlen($strSQL) - strlen(' UNION ALL '));
}
if ($selectField == '') {
$strSQL = '(select * from (' . $strSQL . ') as tbl_user)';
} else {
$strSQL = '(select ' . $selectField . ' from (' . $strSQL . ') as tbl_user)';
}
//echo $strSQL;
return $objConnection->selectCommand($strSQL);
}
示例5: getCommentByArticle
public function getCommentByArticle(&$intPage, &$total, $articleID, $selectField = '*', $whereClause = '', $orderBy = '')
{
$arrSummary = global_common::getContentIDs($this->_objConnection, $intPage, $articleID, global_common::COMMENT_TYPE);
if ($arrSummary) {
if ($orderBy) {
$orderBy = ' ORDER BY ' . $orderBy;
}
$listCommentID = '';
foreach ($arrSummary as $item) {
$listCommentID = $item[global_mapping::SubContents] . $listCommentID;
}
$IDList = global_common::splitString($listCommentID);
$total = count($IDList);
$arrDocInTable = global_common::getListTableName($listCommentID, $intPage, Model_Comment::NUM_PER_PAGE, global_common::SEPARATE_BY_MONTH);
$strSQL = '';
$condition = '';
foreach ($arrDocInTable as $key => $iDoc) {
//check endWith ',' and then remove it
if (global_common::endsWith($iDoc, ',')) {
$strDocInTable = global_common::cutLast($iDoc, 1);
}
$strTableName = Model_Comment::TBL_SL_COMMENT . '_' . $key;
if ($whereClause) {
$condition = 'WHERE (' . global_mapping::IsDeleted . ' IS NULL or ' . global_mapping::IsDeleted . ' = \'0\') and `' . global_mapping::CommentID . '` IN (' . $strDocInTable . ') and ' . $whereClause;
} else {
$condition = 'WHERE (' . global_mapping::IsDeleted . ' IS NULL or ' . global_mapping::IsDeleted . ' = \'0\') and `' . global_mapping::CommentID . '` IN (' . $strDocInTable . ')';
}
$strSQL .= "(" . global_common::prepareQuery(global_common::SQL_SELECT_FREE, array($selectField, $strTableName, $condition . $orderBy)) . " ) UNION ALL ";
}
//xóa bỏ đoạn text UNION ALL cuối chuỗi $strSQL
$strSQL = global_common::cutLast($strSQL, strlen('UNION ALL '));
$arrResult = $this->_objConnection->selectCommand($strSQL);
$arrResult = global_common::mergeUserInfo($arrResult);
//print_r($arrResult);
return $arrResult;
}
return null;
}