예제 #1
0
 private function listPublicGroups($offset)
 {
     $sql = "SELECT * FROM groups WHERE active=1 AND type <> 'private' ";
     require_once FRAMEWORK_PATH . 'lib/pagination/pagination.class.php';
     $pagination = new Pagination($this->registry);
     $pagination->setQuery($sql);
     $pagination->setOffset($offset);
     $pagination->setLimit(20);
     $pagination->setMethod('cache');
     $pagination->generatePagination();
     if ($pagination->getNumRowsPage() == 0) {
         $this->registry->getObject('template')->buildFromTemplates('header.tpl.php', 'groups/no-public.tpl.php', 'footer.tpl.php');
     } else {
         $this->registry->getObject('template')->buildFromTemplates('header.tpl.php', 'groups/public.tpl.php', 'footer.tpl.php');
         $this->registry->getObject('template')->getPage()->addTag('groups', array('SQL', $pagination->getCache()));
         $this->registry->getObject('template')->getPage()->addTag('page_number', $pagination->getCurrentPage());
         $this->registry->getObject('template')->getPage()->addTag('num_pages', $pagination->getNumPages());
         if ($pagination->isFirst()) {
             $this->registry->getObject('template')->getPage()->addTag('first', '');
             $this->registry->getObject('template')->getPage()->addTag('previous', '');
         } else {
             $this->registry->getObject('template')->getPage()->addTag('first', "<a href='groups/'>First page</a>");
             $this->registry->getObject('template')->getPage()->addTag('previous', "<a href='groups/" . ($pagination->getCurrentPage() - 2) . "'>Previous page</a>");
         }
         if ($pagination->isLast()) {
             $this->registry->getObject('template')->getPage()->addTag('next', '');
             $this->registry->getObject('template')->getPage()->addTag('last', '');
         } else {
             $this->registry->getObject('template')->getPage()->addTag('first', "<a href='groups/" . $pagination->getCurrentPage() . "'>Next page</a>");
             $this->registry->getObject('template')->getPage()->addTag('previous', "<a href='groups/" . ($pagination->getNumPages() - 1) . "'>Last page</a>");
         }
     }
 }
if (!buckys_check_user_acl(USER_ACL_MODERATOR)) {
    buckys_redirect('/index.php', MSG_PERMISSION_DENIED, MSG_TYPE_ERROR);
}
$classAds = new BuckysAds();
if (isset($_REQUEST['action'])) {
    if (!buckys_check_form_token()) {
        buckys_redirect('/index.php', MSG_INVALID_REQUEST, MSG_TYPE_ERROR);
    }
    if ($_REQUEST['action'] == 'reject-ads') {
        $classAds->rejectAds($_REQUEST['adID']);
        buckys_redirect('/manage_ads.php', MSG_AD_ADS_REJECTED);
    } else {
        if ($_REQUEST['action'] == 'approve-ads') {
            $classAds->approveAds($_REQUEST['adID']);
            buckys_redirect('/manage_ads.php', MSG_AD_ADS_APPROVED);
        }
    }
}
$page = isset($_GET['page']) ? $_GET['page'] : 1;
$totalCount = $classAds->getPendingAdsCount();
//Init Pagination Class
$pagination = new Pagination($totalCount, BuckysAds::$COUNT_PER_PAGE, $page);
$page = $pagination->getCurrentPage();
$objects = $classAds->getPendingAds($page, BuckysAds::$COUNT_PER_PAGE);
buckys_enqueue_javascript('manage_ads.js');
buckys_enqueue_stylesheet('account.css');
buckys_enqueue_stylesheet('moderator.css');
buckys_enqueue_stylesheet('publisher.css');
$TNB_GLOBALS['content'] = 'manage_ads';
$TNB_GLOBALS['title'] = "Moderator Panel";
require DIR_FS_TEMPLATE . $TNB_GLOBALS['template'] . "/" . $TNB_GLOBALS['layout'] . ".php";
예제 #3
0
 /**
  * Lists all schemata.
  */
 public function actionList()
 {
     // Create list for sideBar usage
     if ($this->request->getParam('sideBar')) {
         $schemata = array();
         foreach (Schema::model()->findAll() as $schema) {
             $schemata[] = $schema->SCHEMA_NAME;
         }
         $this->sendJSON($schemata);
     } else {
         $criteria = new CDbCriteria();
         // Pagination
         $pages = new Pagination(Schema::model()->count($criteria));
         $pages->setupPageSize('pageSize', 'schemata');
         $pages->applyLimit($criteria);
         $pages->route = '#schemata';
         // Sort
         $sort = new CSort('Schema');
         $sort->attributes = array('name' => 'SCHEMA_NAME', 'tableCount' => 'tableCount', 'collation' => 'DEFAULT_COLLATION_NAME');
         $sort->defaultOrder = 'SCHEMA_NAME ASC';
         $sort->route = '#schemata';
         $sort->applyOrder($criteria);
         $criteria->group = 'SCHEMA_NAME';
         $criteria->select = 'SCHEMA_NAME, DEFAULT_COLLATION_NAME, COUNT(*) AS tableCount';
         $schemaList = Schema::model()->with(array('tables' => array('select' => 'COUNT(tables.TABLE_NAME) AS tableCount')))->together()->findAll($criteria);
         $this->render('list', array('schemaList' => $schemaList, 'schemaCount' => $pages->getItemCount(), 'schemaCountThisPage' => min($pages->getPageSize(), $pages->getItemCount() - $pages->getCurrentPage() * $pages->getPageSize()), 'pages' => $pages, 'sort' => $sort));
     }
 }
예제 #4
0
파일: posted.php 프로젝트: QoboLtd/wp-sms
					<option value="trash"><?php 
_e('Remove', 'wp-sms');
?>
</option>
				</select>
				<input value="<?php 
_e('Apply', 'wp-sms');
?>
" name="doaction" id="doaction" class="button-secondary action" type="submit"/>
			</div>
			<br class="clear">
		</div>
	</form>
	
	<?php 
if ($get_result) {
    ?>
	<div class="pagination-log">
		<?php 
    echo $Pagination->display();
    ?>
		<p id="result-log">
			<?php 
    echo ' ' . __('Page', 'wp-sms') . ' ' . $Pagination->getCurrentPage() . ' ' . __('From', 'wp-sms') . ' ' . $Pagination->getTotalPages();
    ?>
		</p>
	</div>
	<?php 
}
?>
</div>