当前位置: 首页>>代码示例>>PHP>>正文


PHP ListViewSession::getCurrentPage方法代码示例

本文整理汇总了PHP中ListViewSession::getCurrentPage方法的典型用法代码示例。如果您正苦于以下问题:PHP ListViewSession::getCurrentPage方法的具体用法?PHP ListViewSession::getCurrentPage怎么用?PHP ListViewSession::getCurrentPage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ListViewSession的用法示例。


在下文中一共展示了ListViewSession::getCurrentPage方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: export

/**
 * This function exports all the data for a given module
 * Param $type - module name
 * Return type text
 */
function export($type)
{
    global $log, $list_max_entries_per_page;
    $log->debug("Entering export(" . $type . ") method ...");
    global $adb;
    $focus = 0;
    $content = '';
    if ($type != "") {
        // vtlib customization: Hook to dynamically include required module file.
        // Refer to the logic in setting $currentModule in index.php
        $focus = CRMEntity::getInstance($type);
    }
    $log = LoggerManager::getLogger('export_' . $type);
    $db = PearDatabase::getInstance();
    $oCustomView = new CustomView("{$type}");
    $viewid = $oCustomView->getViewId("{$type}");
    $sorder = $focus->getSortOrder();
    $order_by = $focus->getOrderBy();
    $search_type = $_REQUEST['search_type'];
    $export_data = $_REQUEST['export_data'];
    if (isset($_SESSION['export_where']) && $_SESSION['export_where'] != '' && $search_type == 'includesearch') {
        $where = $_SESSION['export_where'];
    }
    $query = $focus->create_export_query($where);
    if ($search_type != 'includesearch' && $type != 'Calendar') {
        $stdfiltersql = $oCustomView->getCVStdFilterSQL($viewid);
        $advfiltersql = $oCustomView->getCVAdvFilterSQL($viewid);
        if (isset($stdfiltersql) && $stdfiltersql != '') {
            $query .= ' and ' . $stdfiltersql;
        }
        if (isset($advfiltersql) && $advfiltersql != '') {
            $query .= ' and ' . $advfiltersql;
        }
    }
    $params = array();
    if (($search_type == 'withoutsearch' || $search_type == 'includesearch') && $export_data == 'selecteddata') {
        $idstring = explode(";", $_REQUEST['idstring']);
        if ($type == 'Accounts' && count($idstring) > 0) {
            $query .= ' and vtiger_account.accountid in (' . generateQuestionMarks($idstring) . ')';
            array_push($params, $idstring);
        } elseif ($type == 'Contacts' && count($idstring) > 0) {
            $query .= ' and vtiger_contactdetails.contactid in (' . generateQuestionMarks($idstring) . ')';
            array_push($params, $idstring);
        } elseif ($type == 'Potentials' && count($idstring) > 0) {
            $query .= ' and vtiger_potential.potentialid in (' . generateQuestionMarks($idstring) . ')';
            array_push($params, $idstring);
        } elseif ($type == 'Leads' && count($idstring) > 0) {
            $query .= ' and vtiger_leaddetails.leadid in (' . generateQuestionMarks($idstring) . ')';
            array_push($params, $idstring);
        } elseif ($type == 'Products' && count($idstring) > 0) {
            $query .= ' and vtiger_products.productid in (' . generateQuestionMarks($idstring) . ')';
            array_push($params, $idstring);
        } elseif ($type == 'Documents' && count($idstring) > 0) {
            $query .= ' and vtiger_notes.notesid in (' . generateQuestionMarks($idstring) . ')';
            array_push($params, $idstring);
        } elseif ($type == 'HelpDesk' && count($idstring) > 0) {
            $query .= ' and vtiger_troubletickets.ticketid in (' . generateQuestionMarks($idstring) . ')';
            array_push($params, $idstring);
        } elseif ($type == 'Vendors' && count($idstring) > 0) {
            $query .= ' and vtiger_vendor.vendorid in (' . generateQuestionMarks($idstring) . ')';
            array_push($params, $idstring);
        } else {
            if (count($idstring) > 0) {
                // vtlib customization: Hook to make the export feature available for custom modules.
                $query .= " and {$focus->table_name}.{$focus->table_index} in (" . generateQuestionMarks($idstring) . ')';
                array_push($params, $idstring);
                // END
            }
        }
    }
    if (isset($order_by) && $order_by != '') {
        if ($order_by == 'smownerid') {
            $query .= ' ORDER BY user_name ' . $sorder;
        } elseif ($order_by == 'lastname' && $type == 'Documents') {
            $query .= ' ORDER BY vtiger_contactdetails.lastname  ' . $sorder;
        } elseif ($order_by == 'crmid' && $type == 'HelpDesk') {
            $query .= ' ORDER BY vtiger_troubletickets.ticketid  ' . $sorder;
        } else {
            $tablename = getTableNameForField($type, $order_by);
            $tablename = $tablename != '' ? $tablename . "." : '';
            if ($adb->dbType == "pgsql") {
                $query .= ' GROUP BY ' . $tablename . $order_by;
            }
            $query .= ' ORDER BY ' . $tablename . $order_by . ' ' . $sorder;
        }
    }
    if ($export_data == 'currentpage') {
        $current_page = ListViewSession::getCurrentPage($type, $viewid);
        $limit_start_rec = ($current_page - 1) * $list_max_entries_per_page;
        if ($limit_start_rec < 0) {
            $limit_start_rec = 0;
        }
        $query .= ' LIMIT ' . $limit_start_rec . ',' . $list_max_entries_per_page;
    }
    $result = $adb->pquery($query, $params, true, "Error exporting {$type}: " . "<BR>{$query}");
//.........这里部分代码省略.........
开发者ID:nvh3010,项目名称:quancrm,代码行数:101,代码来源:export.php

示例2: getListViewNavigation

 public static function getListViewNavigation($currentRecordId)
 {
     global $currentModule, $current_user, $adb, $log, $list_max_entries_per_page;
     Zend_Json::$useBuiltinEncoderDecoder = true;
     $reUseData = false;
     $displayBufferRecordCount = 10;
     $bufferRecordCount = 15;
     if ($currentModule == 'Documents') {
         $sql = "select folderid from vtiger_notes where notesid=?";
         $params = array($currentRecordId);
         $result = $adb->pquery($sql, $params);
         $folderId = $adb->query_result($result, 0, 'folderid');
     }
     $cv = new CustomView();
     $viewId = $cv->getViewId($currentModule);
     if (!empty($_SESSION[$currentModule . '_DetailView_Navigation' . $viewId])) {
         $recordNavigationInfo = Zend_Json::decode($_SESSION[$currentModule . '_DetailView_Navigation' . $viewId]);
         $pageNumber = 0;
         if (count($recordNavigationInfo) == 1) {
             foreach ($recordNavigationInfo as $recordIdList) {
                 if (in_array($currentRecordId, $recordIdList)) {
                     $reUseData = true;
                 }
             }
         } else {
             $recordList = array();
             $recordPageMapping = array();
             foreach ($recordNavigationInfo as $start => $recordIdList) {
                 foreach ($recordIdList as $index => $recordId) {
                     $recordList[] = $recordId;
                     $recordPageMapping[$recordId] = $start;
                     if ($recordId == $currentRecordId) {
                         $searchKey = count($recordList) - 1;
                     }
                 }
             }
             if ($searchKey > $displayBufferRecordCount - 1 && $searchKey < count($recordList) - $displayBufferRecordCount) {
                 $reUseData = true;
             }
         }
     }
     if ($reUseData === false) {
         $recordNavigationInfo = array();
         if (!empty($_REQUEST['start'])) {
             $start = ListViewSession::getRequestStartPage();
         } else {
             $start = ListViewSession::getCurrentPage($currentModule, $viewId);
         }
         $startRecord = ($start - 1) * $list_max_entries_per_page - $bufferRecordCount;
         if ($startRecord < 0) {
             $startRecord = 0;
         }
         $list_query = $_SESSION[$currentModule . '_listquery'];
         $instance = CRMEntity::getInstance($currentModule);
         $instance->getNonAdminAccessControlQuery($currentModule, $current_user);
         vtlib_setup_modulevars($currentModule, $instance);
         if ($currentModule == 'Documents' && !empty($folderId)) {
             $list_query = preg_replace("/[\n\r\\s]+/", " ", $list_query);
             $hasOrderBy = stripos($list_query, 'order by');
             if ($hasOrderBy > 0) {
                 $list_query = substr($list_query, 0, $hasOrderBy - 1) . " AND vtiger_notes.folderid={$folderId} " . substr($list_query, $hasOrderBy);
             } else {
                 $list_query .= " AND vtiger_notes.folderid={$folderId}";
                 $order_by = $instance->getOrderByForFolder($folderId);
                 $sorder = $instance->getSortOrderForFolder($folderId);
                 $tablename = getTableNameForField($currentModule, $order_by);
                 $tablename = $tablename != '' ? $tablename . "." : '';
                 if (!empty($order_by)) {
                     $list_query .= ' ORDER BY ' . $tablename . $order_by . ' ' . $sorder;
                 }
             }
         }
         if ($start != 1) {
             $recordCount = $list_max_entries_per_page + 2 * $bufferRecordCount;
         } else {
             $recordCount = $list_max_entries_per_page + $bufferRecordCount;
         }
         $list_query .= " LIMIT {$startRecord}, {$recordCount}";
         $resultAllCRMIDlist_query = $adb->pquery($list_query, array());
         $navigationRecordList = array();
         while ($forAllCRMID = $adb->fetch_array($resultAllCRMIDlist_query)) {
             $navigationRecordList[] = $forAllCRMID[$instance->table_index];
         }
         $pageCount = 0;
         $current = $start;
         if ($start == 1) {
             $firstPageRecordCount = $list_max_entries_per_page;
         } else {
             $firstPageRecordCount = $bufferRecordCount;
             $current -= 1;
         }
         $searchKey = array_search($currentRecordId, $navigationRecordList);
         $recordNavigationInfo = array();
         if ($searchKey !== false) {
             foreach ($navigationRecordList as $index => $recordId) {
                 if (!is_array($recordNavigationInfo[$current])) {
                     $recordNavigationInfo[$current] = array();
                 }
                 if ($index == $firstPageRecordCount || $index == $firstPageRecordCount + $pageCount * $list_max_entries_per_page) {
                     $current++;
//.........这里部分代码省略.........
开发者ID:kduqi,项目名称:corebos,代码行数:101,代码来源:ListViewSession.php

示例3: getExportRecordIds

function getExportRecordIds($moduleName, $viewid, $input)
{
    global $adb, $current_user, $list_max_entries_per_page;
    $idstring = vtlib_purify($input['idstring']);
    $export_data = vtlib_purify($input['export_data']);
    if (in_array($moduleName, getInventoryModules()) && $export_data == 'currentpage') {
        $queryGenerator = new QueryGenerator($moduleName, $current_user);
        $queryGenerator->initForCustomViewById($viewid);
        if ($input['query'] == 'true') {
            $queryGenerator->addUserSearchConditions($input);
        }
        $queryGenerator->setFields(array('id'));
        $query = $queryGenerator->getQuery();
        $current_page = ListViewSession::getCurrentPage($moduleName, $viewid);
        $limit_start_rec = ($current_page - 1) * $list_max_entries_per_page;
        if ($limit_start_rec < 0) {
            $limit_start_rec = 0;
        }
        $query .= ' LIMIT ' . $limit_start_rec . ',' . $list_max_entries_per_page;
        $result = $adb->pquery($query, array());
        $idstring = array();
        $focus = CRMEntity::getInstance($moduleName);
        for ($i = 0; $i < $adb->num_rows($result); $i++) {
            $idstring[] = $adb->query_result($result, $i, $focus->table_index);
        }
        $idstring = implode(';', $idstring);
        $export_data = 'selecteddata';
    }
    return $idstring . '#@@#' . $export_data;
}
开发者ID:yunter,项目名称:crm,代码行数:30,代码来源:utils.php

示例4: getListViewNavigation

 function getListViewNavigation($currentRecordId)
 {
     global $currentModule, $current_user, $adb, $log, $list_max_entries_per_page;
     Zend_Json::$useBuiltinEncoderDecoder = true;
     $reUseData = false;
     $displayBufferRecordCount = 10;
     $bufferRecordCount = 15;
     if ($currentModule == 'Documents') {
         $sql = "select folderid from vtiger_notes where notesid=?";
         $params = array($currentRecordId);
         $result = $adb->pquery($sql, $params);
         $folderId = $adb->query_result($result, 0, 'folderid');
     }
     $cv = new CustomView();
     $viewId = $cv->getViewId($currentModule);
     if (!empty($_SESSION[$currentModule . '_DetailView_Navigation' . $viewId])) {
         $recordNavigationInfo = Zend_Json::decode($_SESSION[$currentModule . '_DetailView_Navigation' . $viewId]);
         $pageNumber = 0;
         if (count($recordNavigationInfo) == 1) {
             foreach ($recordNavigationInfo as $recordIdList) {
                 if (in_array($currentRecordId, $recordIdList)) {
                     $reUseData = true;
                 }
             }
         } else {
             $recordList = array();
             $recordPageMapping = array();
             foreach ($recordNavigationInfo as $start => $recordIdList) {
                 foreach ($recordIdList as $index => $recordId) {
                     $recordList[] = $recordId;
                     $recordPageMapping[$recordId] = $start;
                     if ($recordId == $currentRecordId) {
                         $searchKey = count($recordList) - 1;
                     }
                 }
             }
             if ($searchKey > $displayBufferRecordCount - 1 && $searchKey < count($recordList) - $displayBufferRecordCount) {
                 $reUseData = true;
             }
         }
     }
     if ($reUseData === false) {
         $recordNavigationInfo = array();
         if (!empty($_REQUEST['start'])) {
             $start = ListViewSession::getRequestStartPage();
         } else {
             $start = ListViewSession::getCurrentPage($currentModule, $viewId);
         }
         $startRecord = ($start - 1) * $list_max_entries_per_page - $bufferRecordCount;
         if ($startRecord < 0) {
             $startRecord = 0;
         }
         $list_query = $_SESSION[$currentModule . '_listquery'];
         if ($currentModule == 'Documents' && !empty($folderId)) {
             $list_query = preg_replace("/[\n\r\\s]+/", " ", $list_query);
             $findOrderByPosition = stripos($list_query, ' ORDER BY ');
             if ($findOrderByPosition > 0) {
                 $orderByClause = substr($list_query, $findOrderByPosition, strlen($list_query));
                 $list_query = substr($list_query, 0, $findOrderByPosition) . " AND vtiger_notes.folderid={$folderId} " . $orderByClause;
             } else {
                 $list_query .= " AND vtiger_notes.folderid={$folderId}";
             }
         }
         if ($start != 1) {
             $recordCount = $list_max_entries_per_page + 2 * $bufferRecordCount;
         } else {
             $recordCount = $list_max_entries_per_page + $bufferRecordCount;
         }
         if ($adb->dbType == "pgsql") {
             $list_query .= " OFFSET {$startRecord} LIMIT {$recordCount}";
         } else {
             $list_query .= " LIMIT {$startRecord}, {$recordCount}";
         }
         $resultAllCRMIDlist_query = $adb->pquery($list_query, array());
         $navigationRecordList = array();
         while ($forAllCRMID = $adb->fetch_array($resultAllCRMIDlist_query)) {
             $navigationRecordList[] = $forAllCRMID['crmid'];
         }
         $pageCount = 0;
         $current = $start;
         if ($start == 1) {
             $firstPageRecordCount = $list_max_entries_per_page;
         } else {
             $firstPageRecordCount = $bufferRecordCount;
             $current -= 1;
         }
         $searchKey = array_search($currentRecordId, $navigationRecordList);
         $recordNavigationInfo = array();
         if ($searchKey !== false) {
             foreach ($navigationRecordList as $index => $recordId) {
                 if (!is_array($recordNavigationInfo[$current])) {
                     $recordNavigationInfo[$current] = array();
                 }
                 if ($index == $firstPageRecordCount || $index == $firstPageRecordCount + $pageCount * $list_max_entries_per_page) {
                     $current++;
                     $pageCount++;
                 }
                 $recordNavigationInfo[$current][] = $recordId;
             }
         }
//.........这里部分代码省略.........
开发者ID:vtiger-jp,项目名称:vtigercrm-5.1.x-ja,代码行数:101,代码来源:ListViewSession.php


注:本文中的ListViewSession::getCurrentPage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。