Copyright (C) 2006 OrangeHRM Inc., http://www.orangehrm.com OrangeHRM is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. OrangeHRM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
상속: extends sfPager, implements Serializable
예제 #1
0
파일: ecole.php 프로젝트: bontiv/intrateb
/**
 * Affiche la liste des écoles
 * Permet d'afficher une page avec la liste des écoles (page par défaut du module).
 */
function ecole_index()
{
    global $pdo, $tpl;
    $pager = new SimplePager('user_types');
    $pager->run($tpl);
    $tpl->display('ecole_index.tpl');
    quit();
}
예제 #2
0
파일: event.php 프로젝트: bontiv/intrateb
function event_archive()
{
    global $tpl;
    $p = new SimplePager('events', 'WHERE `event_end` < NOW()');
    $p->run($tpl);
    $tpl->display('event_index.tpl');
    quit();
}
예제 #3
0
파일: beers.php 프로젝트: bontiv/intrateb
/**
 * Permet d'afficher la liste des bières
 * @global type $pdo
 * @global type $tpl
 */
function beers_index()
{
    global $pdo, $tpl;
    if (isset($_POST['search'])) {
        header('location: ' . urldup(array('search' => $_POST['search'])));
        quit();
    }
    $where = '';
    if (isset($_GET['search'])) {
        $where = 'WHERE beer_name LIKE ? ';
    }
    $pager = new SimplePager('beers', $where . 'ORDER BY beer_name ASC', 'p', 20);
    if (isset($_GET['search'])) {
        $pager->bindValue(1, "%{$_GET['search']}%");
    }
    $pager->run($tpl);
    display();
}
 public function execute($request)
 {
     $head = sfYaml::load(sfConfig::get('sf_app_dir') . '/lib/list/seller_list.yml');
     $sellerlist_headers = array($head['listSeller']['header1'], $head['listSeller']['header2'], $head['listSeller']['header3'], $head['listSeller']['header4']);
     $columns = 'id,name,address,tp_hp';
     $recordsLimit = 5;
     //have to take from lists
     if (!$request->hasParameter('pageNo')) {
         $pageNo = 1;
     } else {
         $pageNo = $request->getParameter('pageNo', 1);
     }
     $pager = new SimplePager('Seller', $recordsLimit);
     $pager->setPage($pageNo);
     $pager->setNumResults($this->getSellerService()->countSellers());
     $pager->init();
     $offset = $pager->getOffset();
     $offset = empty($offset) ? 0 : $offset;
     $paramHolder = new sfParameterHolder();
     $paramHolder->set('columns', $columns);
     $paramHolder->set('offset', $offset);
     $paramHolder->set('limit', $recordsLimit);
     $sellerlist_data = $this->getSellerService()->getSellers($paramHolder);
     $listContainer = new ListContainer();
     $listContainer->setListName('SellerList');
     $listContainer->setListHeaders($sellerlist_headers);
     $listContainer->setListContent($sellerlist_data);
     $listContainer->setRowLink("seller/showSeller?id=");
     $listContainer->setPager($pager);
     $this->listcontainer = $listContainer;
 }
 /**
  * Execute /../stock/listItem
  * 
  * @param type $request 
  */
 public function execute($request)
 {
     $head = sfYaml::load(sfConfig::get('sf_app_dir') . '/lib/list/item_list.yml');
     $itemlist_headers = array($head['listItem']['header1'], $head['listItem']['header2'], $head['listItem']['header3'], $head['listItem']['header6']);
     $columns = 'id,name,sales_unit_price,stock_available';
     $recordsLimit = 5;
     //have to take from lists
     if (!$request->hasParameter('pageNo')) {
         $pageNo = 1;
     } else {
         $pageNo = $request->getParameter('pageNo', 1);
     }
     $pager = new SimplePager('Item', $recordsLimit);
     $pager->setPage($pageNo);
     $pager->setNumResults($this->getItemService()->countItems());
     $pager->init();
     $offset = $pager->getOffset();
     $offset = empty($offset) ? 0 : $offset;
     $paramHolder = new sfParameterHolder();
     $paramHolder->set('columns', $columns);
     $paramHolder->set('offset', $offset);
     $paramHolder->set('limit', $recordsLimit);
     $itemlist_data = $this->getItemService()->getItems($paramHolder);
     $listContainer = new ListContainer();
     $listContainer->setListName('ItemList');
     $listContainer->setListHeaders($itemlist_headers);
     $listContainer->setListContent($itemlist_data);
     $listContainer->setRowLink("stock/showItem?id=");
     $listContainer->setPager($pager);
     $this->listcontainer = $listContainer;
 }
 /**
  *
  * @param sfRequest $request 
  */
 public function execute($request)
 {
     $this->setTemplateVariables();
     $this->params = array();
     foreach ($this->getVarHolder()->getAll() as $param => $val) {
         $this->params[$param] = $val;
     }
     $recordsLimit = self::$itemsPerPage;
     //sfConfig::get('app_items_per_page');
     $pageNo = $request->getParameter('pageNo', 1);
     if (self::$pageNumber) {
         $pageNo = self::$pageNumber;
     } else {
         $pageNo = $request->getParameter('pageNo', 1);
     }
     $numberOfRecords = self::$numberOfRecords;
     //replace with the count of all the records(self::$listData instanceof Doctrine_Collection) ? self::$listData->count() : count(self::$listData); // TODO: Remove the dependancy of ORM here; Use a Countable interface and a Iterator interface
     $pager = new SimplePager($this->className, $recordsLimit);
     $pager->setPage($pageNo);
     $pager->setNumResults($numberOfRecords);
     $pager->init();
     $offset = $pager->getOffset();
     $offset = empty($offset) ? 0 : $offset;
     $this->offset = $offset;
     $this->pager = $pager;
     $this->recordLimit = $recordsLimit;
     $this->currentSortField = $request->getParameter('sortField', '');
     $this->currentSortOrder = $request->getParameter('sortOrder', '');
     $this->showGroupHeaders = self::$configurationFactory->showGroupHeaders();
     $this->headerGroups = self::$configurationFactory->getHeaderGroups();
     $this->columns = self::$configurationFactory->getHeaders();
     $this->data = self::$listData;
     $this->className = self::$configurationFactory->getClassName();
     $this->partial = self::$headerPartial;
     $this->footerPartial = self::$footerPartial;
     $this->listForm = empty(self::$listForm) ? new DefaultListForm(array(), array(), true) : self::$listForm;
     $this->applyRuntimeDefinitions();
     $this->makePluginCalls();
 }
예제 #7
0
파일: user.php 프로젝트: bontiv/intrateb
/**
 * Permet d'afficher la liste des utilisateurs
 * @global type $pdo
 * @global type $tpl
 */
function user_index()
{
    global $pdo, $tpl;
    if (isset($_POST['search'])) {
        header('location: ' . urldup(array('search' => $_POST['search'])));
        quit();
    }
    $where = '';
    if (isset($_GET['search'])) {
        $where = 'WHERE user_name LIKE ? ' . 'OR user_lastname LIKE ? ' . 'OR user_firstname LIKE ? ' . 'OR user_email LIKE ? ';
    }
    $pager = new SimplePager('users', $where . 'ORDER BY user_name ASC', 'p', 20);
    if (isset($_GET['search'])) {
        $pager->bindValue(1, "%{$_GET['search']}%");
        $pager->bindValue(2, "%{$_GET['search']}%");
        $pager->bindValue(3, "%{$_GET['search']}%");
        $pager->bindValue(4, "%{$_GET['search']}%");
    }
    $pager->run($tpl);
    $tpl->display('user_index.tpl');
    quit();
}
예제 #8
0
    if (!kleeja_check_form_key('adm_exts')) {
        kleeja_admin_err($lang['INVALID_FORM_KEY'], true, $lang['ERROR'], true, $action, 1);
    }
}
if (isset($_GET['add_new_ext'])) {
    if (!kleeja_check_form_key('adm_exts_new_ext')) {
        kleeja_admin_err($lang['INVALID_FORM_KEY'], true, $lang['ERROR'], true, $action, 1);
    }
}
//show exts
$query = array('SELECT' => '*', 'FROM' => "{$dbprefix}exts");
$result_p = $SQL->build($query);
//pager
$nums_rows = $SQL->num_rows($result_p);
$currentPage = isset($_GET['page']) ? intval($_GET['page']) : 1;
$Pager = new SimplePager($perpage, $nums_rows, $currentPage);
$start = $Pager->getStartRow();
$no_results = false;
if ($nums_rows > 0) {
    $query['LIMIT'] = "{$start}, {$perpage}";
    $result = $SQL->build($query);
    while ($row = $SQL->fetch_array($result)) {
        //make new lovely arrays !!
        $g_sz[$row['id']] = isset($_POST['gsz' . $row['id']]) ? $_POST['gsz' . $row['id']] : $row['gust_size'];
        $u_sz[$row['id']] = isset($_POST['usz' . $row['id']]) ? $_POST['usz' . $row['id']] : $row['user_size'];
        $arr[] = array('id' => $row['id'], 'name' => $row['ext'], 'group' => ch_g(false, $row['group_id'], true), 'g_size' => round($g_sz[$row['id']] / 1024), 'g_allow' => (int) $row['gust_allow'] ? true : false, 'u_size' => round($u_sz[$row['id']] / 1024), 'u_allow' => (int) $row['user_allow'] ? true : false, 'ug_allow' => $row['gust_allow'] && $row['user_allow'] ? true : false);
    }
    $SQL->freeresult($result_p);
    $SQL->freeresult($result);
} else {
    $no_results = true;
예제 #9
0
$Issue = Input::Get('Issue', 'int', 0);
$Language = Input::Get('Language', 'int', 0);
$SectOffs = camp_session_get("SectOffs_" . $Pub . "_" . $Issue . "_" . $Language, 0);
if ($SectOffs < 0) {
    $SectOffs = 0;
}
$ItemsPerPage = 15;
if (!Input::IsValid()) {
    camp_html_display_error($translator->trans('Invalid input: $1', array('$1' => Input::GetErrorString())), $_SERVER['REQUEST_URI']);
    exit;
}
$publicationObj = new Publication($Pub);
$issueObj = new Issue($Pub, $Language, $Issue);
$allSections = Section::GetSections($Pub, $Issue, $Language, null, null, array('ORDER BY' => 'Number', 'LIMIT' => array('START' => $SectOffs, 'MAX_ROWS' => $ItemsPerPage)), true);
$totalSections = Section::GetTotalSections($Pub, $Issue, $Language);
$pager = new SimplePager($totalSections, $ItemsPerPage, "SectOffs_" . $Pub . "_" . $Issue . "_" . $Language, "index.php?Pub={$Pub}&Issue={$Issue}&Language={$Language}&");
$topArray = array('Pub' => $publicationObj, 'Issue' => $issueObj);
camp_html_content_top($translator->trans('Section List'), $topArray);
$controller->view->headTitle($translator->trans('Section List') . ' - Newscoop Admin', 'SET');
?>
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="1" class="action_buttons" style="padding-top: 5px;">
<TR>
	<TD><A HREF="/<?php 
echo $ADMIN;
?>
/issues/?Pub=<?php 
p($Pub);
?>
"><IMG SRC="<?php 
echo $Campsite["ADMIN_IMAGE_BASE_URL"];
?>
예제 #10
0
 ($hook = kleeja_run_hook('begin_filecp')) ? eval($hook) : null;
 //run hook
 $stylee = 'filecp';
 $titlee = $lang['FILECP'];
 $H_FORM_KEYS = kleeja_add_form_key('filecp');
 //no logon before
 if (!$usrcp->name()) {
     kleeja_info($lang['PLACE_NO_YOU'], $lang['USER_PLACE']);
 }
 //te get files and update them !!
 $query = array('SELECT' => 'f.id ,f.name, f.real_filename, f.type, f.folder, f.size', 'FROM' => "{$dbprefix}files f", 'WHERE' => 'f.user='******'ORDER BY' => 'f.id DESC');
 //pager
 $result_p = $SQL->build($query);
 $nums_rows = $SQL->num_rows($result_p);
 $currentPage = isset($_GET['page']) ? intval($_GET['page']) : 1;
 $Pager = new SimplePager($perpage, $nums_rows, $currentPage);
 $start = $Pager->getStartRow();
 $linkgoto = $config['siteurl'] . ($config['mod_writer'] ? 'filecp' : 'ucp.php?go=filecp');
 $page_nums = $Pager->print_nums($linkgoto);
 $action = "ucp.php?go=filecp&amp;page={$currentPage}";
 $total_pages = $Pager->getTotalPages();
 //now, there is no result
 $no_results = false;
 if ($nums_rows != 0) {
     $query['LIMIT'] = "{$start}, {$perpage}";
     ($hook = kleeja_run_hook('qr_select_files_in_filecp')) ? eval($hook) : null;
     //run hook
     $result = $SQL->build($query);
     $sizes = $num = 0;
     $i = $currentPage * $perpage - $perpage;
     while ($row = $SQL->fetch_array($result)) {
예제 #11
0
    $f_poll_order = Input::Get('f_poll_order', 'string');
    $f_poll_assigned = Input::Get('f_poll_assigned', 'string');

    $constraints = array(
        'language_id' => $f_language_id,
        'publication_id' => $f_publication_id,
        'issue_nr' => $f_issue_nr,
        'section_nr' => $f_section_nr,
        'article_nr' => $f_article_nr
    );

    $polls = Poll::getPolls($constraints, $f_poll_assigned, $f_poll_offset, $f_poll_limit, $f_poll_order);

    $param_string = "f_poll_item=$f_poll_item&amp;f_issue_nr=$f_issue_nr&amp;f_language_id=$f_language_id&amp;f_publication_id=$f_publication_id";
    $pager_params = "?$param_string&amp;f_poll_order=$f_poll_order&amp;";
    $pager = new SimplePager(Poll::countPolls($f_language_id), $f_poll_limit, "f_poll_offset", $pager_params, false);

    Poll::countPolls($f_language_id)
    ?>

    <tr>
        <td colspan="2" style="padding: 3px; background-color: #EEE; border-left: 1px solid #8baed1; border-right: 1px solid #8baed1;">
           &nbsp;&nbsp;&nbsp; <?php echo $pager->render(); ?>
        </td>
    </tr>

    <tr>
        <td colspan="2" style="padding: 3px; background-color: #EEE; border-left: 1px solid #8baed1; border-right: 1px solid #8baed1;">
        <TABLE BORDER="0" CELLSPACING="1" CELLPADDING="3" class="table_list" style="padding-top: 5px;" width="95%">
        <?php
        $counter = 0;
예제 #12
0
파일: c_files.php 프로젝트: Saleh7/Kleeja
     $img_types = array('gif', 'jpg', 'png', 'bmp', 'jpeg', 'GIF', 'JPG', 'PNG', 'BMP', 'JPEG');
     $query['WHERE'] = $query['WHERE'] . (empty($query['WHERE']) ? '' : ' AND ') . "f.type NOT IN ('" . implode("', '", $img_types) . "')";
 }
 $query['ORDER BY'] .= isset($_REQUEST['order_way']) && (int) $_REQUEST['order_way'] == 1 ? ' ASC' : ' DESC';
 $nums_rows = 0;
 if ($do_not_query_total_files) {
     $nums_rows = get_actual_stats('files');
 } else {
     $result_p = $SQL->build($query);
     $n_fetch = $SQL->fetch_array($result_p);
     $nums_rows = $n_fetch['total_files'];
     $SQL->freeresult($result_p);
 }
 //pager
 $currentPage = isset($_GET['page']) ? intval($_GET['page']) : 1;
 $Pager = new SimplePager($perpage, $nums_rows, $currentPage);
 $start = $Pager->getStartRow();
 $no_results = false;
 if ($nums_rows > 0) {
     $query['SELECT'] = 'f.*' . ((int) $config['user_system'] == 1 ? ', u.name AS username' : '');
     $query['LIMIT'] = "{$start}, {$perpage}";
     $result = $SQL->build($query);
     $sizes = false;
     $num = 0;
     #if Kleeja integtared we dont want make alot of queries
     $ids_and_names = array();
     while ($row = $SQL->fetch_array($result)) {
         $userfile = $config['siteurl'] . ($config['mod_writer'] ? 'fileuser-' . $row['user'] . '.html' : 'ucp.php?go=fileuser&amp;id=' . $row['user']);
         #for username in integrated user system
         if ($row['user'] != '-1' and (int) $config['user_system'] != 1) {
             if (!in_array($row['user'], $ids_and_names)) {
예제 #13
0
파일: ucp.php 프로젝트: Saleh7/Kleeja
 }
 //to get userdata!!
 $data_user = (int) $config['user_system'] == 1 ? $usrcp->get_data('name, show_my_filecp', $user_id) : array('name' => $usrcp->usernamebyid($user_id), 'show_my_filecp' => '1');
 if (!$data_user['name']) {
     kleeja_err($lang['NOT_EXSIT_USER'], $lang['PLACE_NO_YOU']);
 }
 if (!$data_user['show_my_filecp'] && $usrcp->id() != $user_id && !user_can('enter_acp')) {
     kleeja_info($lang['USERFILE_CLOSED'], $lang['CLOSED_FEATURE']);
 }
 $query = array('SELECT' => 'f.id, f.name, f.real_filename, f.folder, f.type, f.uploads, f.time, f.size', 'FROM' => "{$dbprefix}files f", 'WHERE' => 'f.user='******'ORDER BY' => 'f.id DESC');
 //pager
 $perpage = 16;
 $result_p = $SQL->build($query);
 $nums_rows = $SQL->num_rows($result_p);
 $currentPage = isset($_GET['page']) ? intval($_GET['page']) : 1;
 $Pager = new SimplePager($perpage, $nums_rows, $currentPage);
 $start = $Pager->getStartRow();
 $your_fileuser = $config['siteurl'] . ($config['mod_writer'] ? 'fileuser-' . $usrcp->id() . '.html' : 'ucp.php?go=fileuser&amp;id=' . $usrcp->id());
 $total_pages = $Pager->getTotalPages();
 $linkgoto = $config['siteurl'] . ($config['mod_writer'] ? 'fileuser-' . $user_id . '.html' : 'ucp.php?go=fileuser&amp;id=' . $user_id);
 $page_nums = $Pager->print_nums(str_replace('.html', '', $linkgoto));
 $no_results = true;
 if ((int) $config['user_system'] != 1 && $usrcp->id() != $user_id) {
     $data_user['name'] = $usrcp->usernamebyid($user_id);
 }
 $user_name = !$data_user['name'] ? false : $data_user['name'];
 #set page title
 $titlee = $lang['FILEUSER'] . ': ' . $user_name;
 #there is result ? show them
 if ($nums_rows != 0) {
     $no_results = false;
 public function execute($request)
 {
     $request->setParameter('initialActionName', 'viewDirectory');
     $isPaging = $request->getParameter('hdnAction') == 'search' ? 1 : $request->getParameter('pageNo', 1);
     $pageNumber = $isPaging;
     if (!empty($empNumber) && $this->getUser()->hasAttribute('pageNumber')) {
         $pageNumber = $this->getUser()->getAttribute('pageNumber');
     }
     $noOfRecords = sfConfig::get('app_items_per_page');
     $offset = $pageNumber >= 1 ? ($pageNumber - 1) * $noOfRecords : ($request->getParameter('pageNo', 1) - 1) * $noOfRecords;
     // Reset filters if requested to
     if ($request->hasParameter('reset')) {
         $this->setFilters(array());
         $this->setSortParameter(array("field" => NULL, "order" => NULL));
         $this->setPage(1);
     }
     $this->setForm(new EmployeeDirectorySearchForm($this->getFilters()));
     //handles post method
     if ($request->isMethod('post')) {
         $this->form->bind($request->getParameter($this->form->getName()));
         if ($this->form->isValid()) {
             if ($this->form->getValue('isSubmitted') == 'yes') {
                 $this->setSortParameter(array("field" => NULL, "order" => NULL));
             }
             $this->setFilters($this->form->getValues());
         } else {
             $this->setFilters(array());
         }
         $this->setPage(1);
     }
     //handles get method
     if ($request->isMethod('get')) {
         $sortParam = array("field" => $request->getParameter('sortField'), "order" => $request->getParameter('sortOrder'));
         $this->setSortParameter($sortParam);
         $this->setPage(1);
     }
     $filters = $this->getFilters();
     if (isset($filters['emp_name']) && $filters['emp_name']['empName'] != __('Type for hints...')) {
         if (strpos($filters['emp_name']['empName'], __('Past Employee')) !== false) {
             $filters['termination'] = EmployeeSearchForm::WITH_TERMINATED;
         }
         $filters['employee_name'] = str_replace(' (' . __('Past Employee') . ')', '', $filters['emp_name']['empName']);
     }
     $this->filterApply = !empty($filters);
     $empList = $this->getEmployeeService()->getEmployeeIdList();
     if (count($empList) > 0) {
         $filters['employee_id_list'] = $empList;
         $count = $this->getDirectoryService()->getSearchEmployeeCount($filters);
         $parameterHolder = new EmployeeSearchParameterHolder();
         $parameterHolder->setOrderField($sortField);
         $parameterHolder->setOrderBy($sortOrder);
         $parameterHolder->setLimit($noOfRecords);
         $parameterHolder->setOffset($offset);
         $parameterHolder->setFilters($filters);
         $this->list = $this->getDirectoryService()->searchEmployees($parameterHolder);
     } else {
         $count = 0;
         $list = array();
     }
     $recordsLimit = sfConfig::get('app_items_per_page');
     //self::$itemsPerPage;//
     $pageNo = $request->getParameter('pageNo', 1);
     /*         * if (self::$pageNumber) {
               $pageNo = self::$pageNumber;
               } else { */
     //$pageNo = 1; //$request->getParameter('pageNo', 1);
     //}
     $numberOfRecords = $count;
     //replace with the count of all the records(self::$listData instanceof Doctrine_Collection) ? self::$listData->count() : count(self::$listData); // TODO: Remove the dependancy of ORM here; Use a Countable interface and a Iterator interface
     if ($recordsLimit < $numberOfRecords) {
         $this->isPaginated = TRUE;
     }
     $pager = new SimplePager($this->className, $recordsLimit);
     $pager->setPage($pageNo);
     $pager->setNumResults($numberOfRecords);
     $pager->init();
     $offset = $pager->getOffset();
     $offset = empty($offset) ? 0 : $offset;
     $this->offset = $offset;
     $this->pager = $pager;
     $this->recordLimit = $recordsLimit;
     //$this->currentSortField = $request->getParameter('sortField', '');
     //$this->currentSortOrder = $request->getParameter('sortOrder', '');
 }
예제 #15
0
        if (isset($_GET['admin'])) {
            $admin = (int) $_GET['admin'] == 1 ? "AND admin = 1 " : '';
            $is_search = true;
            $isn_search = false;
            $is_asearch = true;
            $query['WHERE'] = "name != '' {$admin}";
        }
    }
}
$result = $SQL->build($query);
$nums_rows = 0;
$n_fetch = $SQL->fetch_array($result);
$nums_rows = $n_fetch['total_users'];
//pager
$currentPage = isset($_GET['page']) ? intval($_GET['page']) : 1;
$Pager = new SimplePager($perpage, $nums_rows, $currentPage);
$start = $Pager->getStartRow();
$no_results = false;
if ($nums_rows > 0) {
    $query['SELECT'] = '*';
    $query['LIMIT'] = "{$start}, {$perpage}";
    $result = $SQL->build($query);
    while ($row = $SQL->fetch_array($result)) {
        //make new lovely arrays !!
        $ids[$row['id']] = $row['id'];
        $name[$row['id']] = isset($_POST['nm_' . $row['id']]) ? $_POST['nm_' . $row['id']] : $row['name'];
        $mail[$row['id']] = isset($_POST['ml_' . $row['id']]) ? $_POST['ml_' . $row['id']] : $row['mail'];
        $pass[$row['id']] = isset($_POST['ps_' . $row['id']]) ? $_POST['ps_' . $row['id']] : '';
        $admin[$row['id']] = $row['admin'];
        $del[$row['id']] = isset($_POST['del_' . $row['id']]) ? $_POST['del_' . $row['id']] : '';
        $userfile = $config['siteurl'] . ($config['mod_writer'] ? 'fileuser-' . $row['id'] . '.html' : 'ucp.php?go=fileuser&amp;id=' . $row['id']);
예제 #16
0
파일: f_reports.php 프로젝트: Saleh7/Kleeja
    if (strpos($config['queue'], ':' . $current_smt . 'reports:') !== false) {
        kleeja_admin_err($lang['DELETE_PROCESS_IN_WORK'], true, $lang['ERROR'], true, basename(ADMIN_PATH) . '?cp=' . basename(__FILE__, '.php'), 1);
    } else {
        update_config('queue', $config['queue'] . ':' . $current_smt . 'reports:');
        kleeja_admin_info($lang['DELETE_PROCESS_QUEUED'], true, '', true, basename(ADMIN_PATH) . '?cp=' . basename(__FILE__, '.php'));
    }
}
$query = array('SELECT' => '*', 'FROM' => "{$dbprefix}reports r", 'ORDER BY' => 'r.id DESC');
if ($current_smt == 'show_h24') {
    $query['WHERE'] = 'r.time > ' . intval(time() - 3600 * 24);
}
$result = $SQL->build($query);
//pagination
$nums_rows = $SQL->num_rows($result);
$currentPage = isset($_GET['page']) ? intval($_GET['page']) : 1;
$Pager = new SimplePager($perpage, $nums_rows, $currentPage);
$start = $Pager->getStartRow();
$no_results = false;
$del_nums = array();
if ($nums_rows > 0) {
    $query['LIMIT'] = "{$start}, {$perpage}";
    $result = $SQL->build($query);
    while ($row = $SQL->fetch_array($result)) {
        //make new lovely arrays !!
        $arr[] = array('id' => $row['id'], 'name' => $row['name'], 'mail' => $row['mail'], 'url' => $row['url'], 'text' => $row['text'], 'human_time' => kleeja_date($row['time']), 'time' => kleeja_date($row['time'], false), 'ip' => $row['ip'], 'sent' => $row['id'] == $msg_sent, 'ip_finder' => 'http://www.ripe.net/whois?form_type=simple&full_query_string=&searchtext=' . htmlspecialchars($row['ip']) . '&do_search=Search');
        $del[$row['id']] = isset($_POST['del_' . $row['id']]) ? $_POST['del_' . $row['id']] : '';
        $sen[$row['id']] = isset($_POST['v_' . $row['id']]) ? $_POST['v_' . $row['id']] : '';
        //when submit !!
        if (isset($_POST['submit'])) {
            if ($del[$row['id']]) {
                $del_nums[] = $row['id'];
 private function addPagination(&$oQuery, $oTemplate)
 {
     $iPage = (int) (isset($_REQUEST[self::PAGINATION_PARAM]) ? $_REQUEST[self::PAGINATION_PARAM] : 1);
     $oPager = new SimplePager($oQuery, $iPage, $this->iEntriesPerPage);
     if (!$oPager->requiresPagination() || !$oTemplate->hasIdentifier('pagination')) {
         return;
     }
     // Basic page link without page number
     $sBasePageLink = LinkUtil::link(array_merge(FrontendManager::$CURRENT_NAVIGATION_ITEM->getLink(), array(self::PAGINATION_PARAM)));
     $oPager->setPageLinkBase($sBasePageLink);
     $oQuery = $oPager->getQuery();
     $oPagerTemplate = $this->constructTemplate('pagination');
     // All page links including current one
     $iTotalPages = $oPager->getTotalPageCount();
     foreach ($oPager as $oPage) {
         if ($oPage->page === $iPage) {
             $oPageLink = TagWriter::quickTag('span', array(), $oPage->page);
         } else {
             $oPageLink = TagWriter::quickTag('a', array('title' => TranslationPeer::getString('pager.go_to_page', null, null, array('page_number' => $i)), 'href' => $oPage->link), $oPage->page);
         }
         $oPagerTemplate->replaceIdentifierMultiple('page_links', $oPageLink);
     }
     $oPagerTemplate->replaceIdentifier('previous_link', $oPager->getPreviousLink());
     $oPagerTemplate->replaceIdentifier('next_link', $oPager->getNextLink());
     $oTemplate->replaceIdentifier('pagination', $oPagerTemplate);
     return $oPager;
 }
예제 #18
0
	/**
	 * SimplePager, unlike the PEAR Pager class, is a pager made to work
	 * with template-like layouts. The constructor sets up the variables
	 * you need to render the links, and you can render them
	 * however you like.  There is a default render function for
	 * reference.
	 *
	 * @param int $p_totalItems
	 * 		Total number of items.
	 *
	 * @param int $p_itemsPerPage
	 * 		Number of items to display per page.
	 *
	 * @param string $p_offsetVarName
	 * 		The name of the REQUEST variable which holds the order number
	 * 		of the first item on the selected page.
	 *
	 * @param string $p_baseUrl
	 * 		The url to which we attach the offset variable name.
	 *
	 * @param boolean $p_useSessions
	 * 		Set to TRUE if you want the offset item number to be stored in
	 * 		the session so that the user will return to their previous
	 * 		position in the pager when they leave the screen and come back
	 * 		to it.
	 */
	public function SimplePager($p_totalItems, $p_itemsPerPage, $p_offsetVarName,
	                            $p_baseUrl, $p_useSessions = true, $p_width = 10)
	{
	    global $_REQUEST;

		$this->m_urls["links"] = array();
		if ($p_totalItems < 0) {
			$p_totalItems = 0;
		}
		if ($p_itemsPerPage < 1) {
			$p_itemsPerPage = 1;
		}

		// Get the current page number.
		if ($p_useSessions) {
			$this->m_offset = camp_session_get($p_offsetVarName, 0);
		} else {
			$this->m_offset = isset($_REQUEST[$p_offsetVarName]) ? $_REQUEST[$p_offsetVarName] : 0;
		}
		if ($this->m_offset < 0) {
			$this->m_offset = 0;
		} elseif ( ($this->m_offset) > $p_totalItems) {
		    // If the offset is past the total number of items,
		    // reset it.
		    $this->m_offset = 0;
		    if ($p_useSessions) {
		        camp_session_set($p_offsetVarName, 0);
		    }
		}

		// Only generate pager if there is more than one page of information.
		if ($p_totalItems > $p_itemsPerPage) {

			// Generate the offsets into the list.
			$remainder = $p_totalItems % $p_itemsPerPage;
			if ($remainder == 0) {
				$this->m_offsets = SimplePager::_range(0, $p_totalItems-1, $p_itemsPerPage);
			} else {
				$this->m_offsets = SimplePager::_range(0, $p_totalItems, $p_itemsPerPage);
			}

			$this->m_numPages = count($this->m_offsets);
			$this->m_selectedPageNumber = floor($this->m_offset/$p_itemsPerPage)+1;

			if ($p_width > $this->m_numPages) {
				$p_width = $this->m_numPages;
			}

			// Generate the numbered links
			if ($this->m_selectedPageNumber < ($p_width/2 + 1)) {
				$begin = 0;
				$end = $p_width;
			} else if ($this->m_selectedPageNumber > ($this->m_numPages - ($p_width/2))) {
				$begin = $this->m_numPages - $p_width;
				$end = $this->m_numPages;
			} else {
				$begin = $this->m_selectedPageNumber - ceil($p_width/2) - 1;
				$end = $this->m_selectedPageNumber + ceil($p_width/2);
			}
			for ($index = $begin; $index < $end; $index++) {
				$this->m_urls["links"][$index+1] = $p_baseUrl."$p_offsetVarName=".$this->m_offsets[$index];
			}

			// Generate special links.
			if ($this->m_selectedPageNumber > 1) {
    			$this->m_urls["first"] = $p_baseUrl."$p_offsetVarName=".$this->m_offsets[0];
	       		$this->m_urls["previous"] = $p_baseUrl."$p_offsetVarName=".$this->m_offsets[max(0, $this->m_selectedPageNumber-2)];
			}
	       	if ($this->m_selectedPageNumber > 10) {
				$this->m_urls["previous_10_pages"] = $p_baseUrl."$p_offsetVarName=".$this->m_offsets[max(0, $this->m_selectedPageNumber-11)];
			}
			if ($this->m_selectedPageNumber > 100) {
				$this->m_urls["previous_100_pages"] = $p_baseUrl."$p_offsetVarName=".$this->m_offsets[max(0, $this->m_selectedPageNumber-101)];
			}
			if ( ($this->m_numPages > $this->m_selectedPageNumber)) {
    			$this->m_urls["next"] = $p_baseUrl."$p_offsetVarName=".$this->m_offsets[min($this->m_numPages-1, $this->m_selectedPageNumber)];
			}
    		if ( ($this->m_numPages - $this->m_selectedPageNumber) > 9) {
				$this->m_urls["next_10_pages"] = $p_baseUrl."$p_offsetVarName=".$this->m_offsets[min($this->m_numPages-1, $this->m_selectedPageNumber+9)];
			}
			if ( ($this->m_numPages - $this->m_selectedPageNumber) > 99) {
				$this->m_urls["next_100_pages"] = $p_baseUrl."$p_offsetVarName=".$this->m_offsets[min($this->m_numPages-1, $this->m_selectedPageNumber+99)];
			}
			if ( ($this->m_numPages > $this->m_selectedPageNumber)) {
    			$this->m_urls["last"] = $p_baseUrl."$p_offsetVarName=".$this->m_offsets[$this->m_numPages-1];
			}
		}
	} // constructor
예제 #19
0
    $query['ORDER BY'] = "f." . $SQL->escape($_REQUEST['order_by']);
}
if (!isset($_GET['search'])) {
    //display files or display pics and files only in search
    $img_types = array('gif', 'jpg', 'png', 'bmp', 'jpeg', 'tif', 'tiff', 'GIF', 'JPG', 'PNG', 'BMP', 'JPEG', 'TIF', 'TIFF');
    $query['WHERE'] = $query['WHERE'] . (empty($query['WHERE']) ? '' : ' AND ') . "f.type NOT IN ('" . implode("', '", $img_types) . "')";
}
$query['ORDER BY'] .= isset($_REQUEST['order_way']) && (int) $_REQUEST['order_way'] == 1 ? ' ASC' : ' DESC';
$result_p = $SQL->build($query);
$nums_rows = 0;
$n_fetch = $SQL->fetch_array($result_p);
$nums_rows = $n_fetch['total_files'];
$SQL->freeresult($result_p);
//pager
$currentPage = isset($_GET['page']) ? intval($_GET['page']) : 1;
$Pager = new SimplePager($perpage, $nums_rows, $currentPage);
$start = $Pager->getStartRow();
$no_results = false;
if ($nums_rows > 0) {
    $query['SELECT'] = 'f.*' . ((int) $config['user_system'] == 1 ? ', u.name AS username' : '');
    $query['LIMIT'] = "{$start}, {$perpage}";
    $result = $SQL->build($query);
    $sizes = false;
    $num = 0;
    #if Kleeja integtared we dont want make alot of queries
    $ids_and_names = array();
    while ($row = $SQL->fetch_array($result)) {
        $userfile = $config['siteurl'] . ($config['mod_writer'] ? 'fileuser-' . $row['user'] . '.html' : 'ucp.php?go=fileuser&amp;id=' . $row['user']);
        #for username in integrated user system
        if ($row['user'] != '-1' and (int) $config['user_system'] != 1) {
            if (!in_array($row['user'], $ids_and_names)) {
예제 #20
0
$f_log_page_offset = camp_session_get('f_log_page_offset', 0);
if ($f_event_search_id == 0) {
	$f_event_search_id = null;
}

$events = Event::GetEvents();
if ($f_log_page_offset < 0) {
	$f_log_page_offset = 0;
}
$ItemsPerPage = 15;

$logs = Log::GetLogs($f_event_search_id,
	array('LIMIT' => array('MAX_ROWS' => $ItemsPerPage, 'START' => $f_log_page_offset)));
$numLogLines = Log::GetNumLogs($f_event_search_id);

$pager = new SimplePager($numLogLines, $ItemsPerPage, "f_log_page_offset", "index.php?f_event_search_id=".urlencode($f_event_search_id)."&");

$crumbs = array();
$crumbs[] = array(getGS("Configure"), "");
$crumbs[] = array(getGS("Logs"), "");
echo camp_html_breadcrumbs($crumbs);

?>
<p>
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0" class="action_buttons">
<TR>
	<TD ALIGN="RIGHT">
		<FORM METHOD="GET" ACTION="index.php" NAME="">
		<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="1" class="search_dialog">
		<TR>
			<TD><?php  putGS('Event'); ?>:</TD>
예제 #21
0
파일: g_users.php 프로젝트: Saleh7/Kleeja
         $group_name = str_replace(array('{lang.ADMINS}', '{lang.USERS}', '{lang.GUESTS}'), array($lang['ADMINS'], $lang['USERS'], $lang['GUESTS']), $d_groups[$req_group]['data']['group_name']);
         $query['WHERE'] = "name != '' AND group_id =  " . $req_group;
     }
     #show users (all)
 #show users (all)
 case 'users':
     $query['SELECT'] = 'COUNT(id) AS total_users';
     $query['FROM'] = "{$dbprefix}users";
     $query['ORDER BY'] = 'id ASC';
     $result = $SQL->build($query);
     $nums_rows = 0;
     $n_fetch = $SQL->fetch_array($result);
     $nums_rows = $n_fetch['total_users'];
     //pagination
     $currentPage = isset($_GET['page']) ? intval($_GET['page']) : 1;
     $Pager = new SimplePager($perpage, $nums_rows, $currentPage);
     $start = $Pager->getStartRow();
     $no_results = false;
     if ($nums_rows > 0) {
         $query['SELECT'] = 'id, name, founder, group_id, last_visit';
         $query['LIMIT'] = "{$start}, {$perpage}";
         $result = $SQL->build($query);
         while ($row = $SQL->fetch_array($result)) {
             $userfile = $config['siteurl'] . ($config['mod_writer'] ? 'fileuser-' . $row['id'] . '.html' : 'ucp.php?go=fileuser&amp;id=' . $row['id']);
             $arr[] = array('id' => $row['id'], 'name' => $row['name'], 'userfile_link' => $userfile, 'delusrfile_link' => $row['founder'] && (int) $userinfo['founder'] == 0 ? false : basename(ADMIN_PATH) . '?cp=' . basename(__FILE__, '.php') . '&amp;deleteuserfile=' . $row['id'] . (isset($_GET['page']) ? '&amp;page=' . intval($_GET['page']) : ''), 'delusr_link' => $userinfo['id'] == $row['id'] || $row['founder'] && (int) $userinfo['founder'] == 0 ? false : basename(ADMIN_PATH) . '?cp=' . basename(__FILE__, '.php') . '&amp;del_user='******'id'] . (isset($_GET['page']) ? '&amp;page=' . intval($_GET['page']) : ''), 'editusr_link' => $row['founder'] && (int) $userinfo['founder'] == 0 ? false : basename(ADMIN_PATH) . '?cp=' . basename(__FILE__, '.php') . '&amp;smt=edit_user&amp;uid=' . $row['id'] . (isset($_GET['page']) ? '&amp;page=' . intval($_GET['page']) : ''), 'founder' => (int) $row['founder'], 'last_visit' => empty($row['last_visit']) ? $lang['NOT_YET'] : kleeja_date($row['last_visit']), 'group' => str_replace(array('{lang.ADMINS}', '{lang.USERS}', '{lang.GUESTS}'), array($lang['ADMINS'], $lang['USERS'], $lang['GUESTS']), $d_groups[$row['group_id']]['data']['group_name']));
         }
         $SQL->freeresult($result);
     } else {
         $no_results = true;
     }
     //pages