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; }
$condition .= global_mapping::ArticleTypeID . '=' . $catID . ''; } if ($adTypeID) { if ($condition) { $condition .= ' and ' . global_mapping::AdTypeID . '=' . $adTypeID; } else { $condition .= global_mapping::AdTypeID . '=' . $adTypeID; } } if ($deleted) { $condition .= ' And ' . global_mapping::IsDeleted . '=1'; } else { $condition .= ' And (' . global_mapping::IsDeleted . '=0 or ' . global_mapping::IsDeleted . ' is null)'; } $allAds = $objAdvertising->getAllAdvertising(0, null, $condition, null); $allAdType = $objAdType->getAllAdType(0, null, null, null); $allCats = $objArticleType->getAllArticleType(0, null, 'ParentID=0', null); $_SESSION[global_common::SES_C_CUR_PAGE] = "admin/admin_advertising.php"; include_once 'include/_admin_header.inc'; ?> <script type="text/javascript" src="<?php echo $_objSystem->locateJs('user_advertising.js'); ?> "></script> <div id="admin-advertising"> <div class="row-fluid"> <div class="span12"> <!-- BEGIN PAGE TITLE & BREADCRUMB--> <h3 class="page-title"> Manage Advertising </h3>