本文整理汇总了PHP中PKPHandler::getRangeInfo方法的典型用法代码示例。如果您正苦于以下问题:PHP PKPHandler::getRangeInfo方法的具体用法?PHP PKPHandler::getRangeInfo怎么用?PHP PKPHandler::getRangeInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PKPHandler
的用法示例。
在下文中一共展示了PKPHandler::getRangeInfo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* Display record list or archive list.
*/
function index($args)
{
$this->validate();
$templateMgr =& TemplateManager::getManager();
$archiveDao =& DAORegistry::getDAO('ArchiveDAO');
$recordDao =& DAORegistry::getDAO('RecordDAO');
$archiveId = array_shift($args);
$archive = null;
if (($archive =& $archiveDao->getArchive($archiveId)) || $archiveId == 'all') {
$this->setupTemplate($archive, true);
$rangeInfo = PKPHandler::getRangeInfo('records');
$sortOrderDao =& DAORegistry::getDAO('SortOrderDAO');
$sortOrderId = Request::getUserVar('sortOrderId');
$sortOrder =& $sortOrderDao->getSortOrder($sortOrderId);
if ($sortOrder) {
$templateMgr->assign('sortOrderId', $sortOrderId);
}
$sortOrders =& $sortOrderDao->getSortOrders();
$templateMgr->assign_by_ref('sortOrders', $sortOrders);
// The user has chosen an archive or opted to browse all
$records =& $recordDao->getRecords($archive ? (int) $archiveId : null, true, $sortOrder, $rangeInfo);
$templateMgr->assign_by_ref('records', $records);
$templateMgr->assign_by_ref('archive', $archive);
$templateMgr->display('browse/records.tpl');
} else {
$this->setupTemplate($archive);
// List archives for the user to browse.
$rangeInfo = PKPHandler::getRangeInfo('archives');
$archives =& $archiveDao->getArchives(true, $rangeInfo);
$templateMgr->assign_by_ref('archives', $archives);
$templateMgr->display('browse/index.tpl');
}
}
示例2: index
/**
* Display the index page for RT administration tasks.
*/
function index($args = array())
{
$this->validate();
$templateMgr =& TemplateManager::getManager();
$archiveId = (int) array_shift($args);
$archiveDao =& DAORegistry::getDAO('ArchiveDAO');
$this->setupTemplate(false, $archiveId);
if (($archive =& $archiveDao->getArchive($archiveId, false)) || $archiveId == 0) {
$site =& Request::getSite();
$rtDao =& DAORegistry::getDAO('RTDAO');
$version = $rtDao->getVersion($archive ? $archive->getSetting('rtVersionId') : $site->getSetting('rtVersionId'), $archive ? $archive->getArchiveId() : 0);
// Display the administration menu for this archive.
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign_by_ref('version', $version);
$templateMgr->assign_by_ref('archiveId', $archiveId);
$templateMgr->assign_by_ref('versions', $rtDao->getVersions($archive ? $archive->getArchiveId() : null));
$templateMgr->display('rtadmin/index.tpl');
} else {
// List archives for the user administer.
$rangeInfo = PKPHandler::getRangeInfo('archives');
$archives =& $archiveDao->getArchives(false, $rangeInfo);
$templateMgr->assign_by_ref('archives', $archives);
$templateMgr->display('rtadmin/archives.tpl');
}
}
示例3: versions
function versions($args)
{
$archiveId = (int) array_shift($args);
$this->validate();
$this->setupTemplate(true, $archiveId);
$rtDao =& DAORegistry::getDAO('RTDAO');
$rangeInfo = PKPHandler::getRangeInfo('versions');
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign_by_ref('versions', $rtDao->getVersions($archiveId, $rangeInfo));
$templateMgr->assign('archiveId', $archiveId);
$templateMgr->display('rtadmin/versions.tpl');
}
示例4: adminCrosswalks
/**
* Display indexing information.
*/
function adminCrosswalks()
{
parent::validate();
MysqlIndexAdminHandler::setupTemplate(false);
$rangeInfo = PKPHandler::getRangeInfo('crosswalks');
$crosswalkDao =& DAORegistry::getDAO('CrosswalkDAO');
$crosswalks =& $crosswalkDao->getCrosswalks($rangeInfo);
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign_by_ref('crosswalks', $crosswalks);
$plugin =& MysqlIndexAdminHandler::getPlugin();
$templateMgr->display($plugin->getTemplatePath() . 'crosswalks.tpl');
}
示例5: index
/**
* Administer the search form.
*/
function index($args)
{
$this->validate();
$this->setupTemplate(true);
$templateMgr =& TemplateManager::getManager();
$plugin =& $this->getPlugin();
$rangeInfo = PKPHandler::getRangeInfo('searchFormElements');
$searchFormElementDao =& DAORegistry::getDAO('SearchFormElementDAO');
$searchFormElements =& $searchFormElementDao->getSearchFormElements($rangeInfo);
$templateMgr->assign_by_ref('searchFormElements', $searchFormElements);
$templateMgr->display($plugin->getTemplatePath() . 'searchForm.tpl');
}
示例6: sortOrders
/**
* Display a list of the sort orders configured on the site.
*/
function sortOrders()
{
$this->validate();
$this->setupTemplate();
$rangeInfo = PKPHandler::getRangeInfo('sortOrders');
$sortOrderDao =& DAORegistry::getDAO('SortOrderDAO');
$sortOrders =& $sortOrderDao->getSortOrders($rangeInfo);
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign_by_ref('sortOrders', $sortOrders);
if ($rangeInfo) {
$templateMgr->assign('sortOrderPage', $rangeInfo->getPage());
}
$templateMgr->display('admin/sortOrders.tpl');
}
示例7: setOptions
/**
* @see GridFeature::setOptions()
* @param $request PKPRequest
* @param $grid Grid
*/
function setOptions($request, $grid)
{
// Get the default items per page setting value.
$rangeInfo = PKPHandler::getRangeInfo($request, $grid->getId());
$defaultItemsPerPage = $rangeInfo->getCount();
// Check for a component level items per page setting.
$componentItemsPerPage = $request->getUserVar($this->_getItemsPerPageParamName($grid->getId()));
if ($componentItemsPerPage) {
$currentItemsPerPage = $componentItemsPerPage;
} else {
$currentItemsPerPage = $defaultItemsPerPage;
}
$iterator = $this->getItemIterator();
$options = array('itemsPerPageParamName' => $this->_getItemsPerPageParamName($grid->getId()), 'defaultItemsPerPage' => $defaultItemsPerPage, 'currentItemsPerPage' => $currentItemsPerPage, 'itemsTotal' => $iterator->getCount(), 'pageParamName' => PKPHandler::getPageParamName($grid->getId()), 'currentPage' => $iterator->getPage());
$this->addOptions($options);
parent::setOptions($request, $grid);
}
示例8: subscriptions
/**
* Display a list of subscriptions for the current journal.
*/
function subscriptions($institutional = false)
{
$journal =& Request::getJournal();
$rangeInfo =& PKPHandler::getRangeInfo('subscriptions');
if ($institutional) {
$subscriptionDao =& DAORegistry::getDAO('InstitutionalSubscriptionDAO');
$templateFile = 'subscription/institutionalSubscriptions.tpl';
$fieldOptions = SubscriptionAction::getInstitutionalSearchFieldOptions();
} else {
$subscriptionDao =& DAORegistry::getDAO('IndividualSubscriptionDAO');
$templateFile = 'subscription/individualSubscriptions.tpl';
$fieldOptions = SubscriptionAction::getIndividualSearchFieldOptions();
}
// Subscription status
$statusOptions =& $subscriptionDao->getStatusOptions();
$filterStatus = Request::getUserVar('filterStatus') == 0 ? null : Request::getUserVar('filterStatus');
// Get the user's search conditions, if any
$searchField = Request::getUserVar('searchField');
$dateSearchField = Request::getUserVar('dateSearchField');
$searchMatch = Request::getUserVar('searchMatch');
$search = Request::getUserVar('search');
$fromDate = Request::getUserDateVar('dateFrom', 1, 1);
if ($fromDate !== null) {
$fromDate = date('Y-m-d H:i:s', $fromDate);
}
$toDate = Request::getUserDateVar('dateTo', 32, 12, null, 23, 59, 59);
if ($toDate !== null) {
$toDate = date('Y-m-d H:i:s', $toDate);
}
$subscriptions =& $subscriptionDao->getSubscriptionsByJournalId($journal->getId(), $filterStatus, $searchField, $searchMatch, $search, $dateSearchField, $fromDate, $toDate, $rangeInfo);
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign_by_ref('subscriptions', $subscriptions);
$templateMgr->assign('helpTopicId', 'journal.managementPages.subscriptions');
// Set search parameters
foreach (SubscriptionAction::getSearchFormDuplicateParameters() as $param) {
$templateMgr->assign($param, Request::getUserVar($param));
}
$templateMgr->assign('dateFrom', $fromDate);
$templateMgr->assign('dateTo', $toDate);
$templateMgr->assign('filterStatus', Request::getUserVar('filterStatus'));
$templateMgr->assign('statusOptions', array(0 => 'manager.subscriptions.allStatus') + $statusOptions);
$templateMgr->assign('fieldOptions', $fieldOptions);
$templateMgr->assign('dateFieldOptions', SubscriptionAction::getDateFieldOptions());
$templateMgr->display($templateFile);
}
示例9: contexts
function contexts($args)
{
$this->validate();
$rtDao =& DAORegistry::getDAO('RTDAO');
$rangeInfo = PKPHandler::getRangeInfo('contexts');
$archiveId = array_shift($args);
$versionId = array_shift($args);
$version =& $rtDao->getVersion($versionId, $archiveId);
if ($version) {
$this->setupTemplate(true, $archiveId, $version);
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign('archiveId', $archiveId);
$templateMgr->assign_by_ref('version', $version);
import('core.ArrayItemIterator');
$templateMgr->assign_by_ref('contexts', new ArrayItemIterator($version->getContexts(), $rangeInfo->getPage(), $rangeInfo->getCount()));
$templateMgr->display('rtadmin/contexts.tpl');
} else {
Request::redirect(null, 'versions');
}
}
示例10: archives
/**
* Display a list of the archives hosted on the site.
*/
function archives()
{
$this->validate();
$this->setupTemplate();
$rangeInfo = PKPHandler::getRangeInfo('archives');
$sort = Request::getUserVar('sort');
$sort = isset($sort) ? $sort : 'title';
$sortDirection = Request::getUserVar('sortDirection');
// Load the harvester plugins so we can display names.
$plugins =& PluginRegistry::loadCategory('harvesters');
$archiveDao =& DAORegistry::getDAO('ArchiveDAO');
$archives =& $archiveDao->getArchives(false, $rangeInfo, $sort, $sortDirection);
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign_by_ref('archives', $archives);
$templateMgr->assign('harvesters', $plugins);
if ($rangeInfo) {
$templateMgr->assign('archivesPage', $rangeInfo->getPage());
}
$templateMgr->assign('sort', $sort);
$templateMgr->assign('sortDirection', $sortDirection);
$templateMgr->display('admin/archives.tpl');
}
示例11: byUrl
/**
* Display search results from a URL-based search.
*/
function byUrl($args, &$request)
{
$this->validate();
list($crosswalks, $fields, $archives) = $this->setupTemplate($request);
$plugin =& $this->getPlugin();
$plugin->import('Search');
$rangeInfo = PKPHandler::getRangeInfo('search');
$query = $request->getUserVar('query');
$forwardParams = array();
$keywords = array('all' => Search::parseQuery($query), 'crosswalk' => array(), 'field' => array(), 'date-from' => array(), 'date-to' => array());
$dates = array('field' => array(), 'crosswalk' => array());
import('classes.field.Field');
if (is_array($fields)) {
foreach ($fields as $field) {
switch ($field->getType()) {
case FIELD_TYPE_DATE:
$varName = $field->getName();
$dateFromName = "{$varName}-from";
$dateToName = "{$varName}-to";
$dateFrom = $request->getUserVar($dateFromName);
$dateTo = $request->getUserVar($dateToName);
$dates['field'][$field->getFieldId()] = array($dateFrom, $dateTo);
foreach (array('Month', 'Day', 'Year') as $datePart) {
$forwardParams[$dateFromName . $datePart] = $request->getUserVar($dateFromName . $datePart);
$forwardParams[$dateToName . $datePart] = $request->getUserVar($dateToName . $datePart);
}
break;
case FIELD_TYPE_STRING:
case FIELD_TYPE_SELECT:
$value = $request->getUserVar($field->getName());
if (!empty($value)) {
$forwardParams[$field->getName()] = $value;
if (is_array($value)) {
$value = '"' . implode('" OR "', $value) . '"';
}
$keywords['field'][$field->getFieldId()] = Search::parseQuery($value);
}
break;
}
}
}
if (is_array($crosswalks)) {
foreach ($crosswalks as $crosswalk) {
switch ($crosswalk->getType()) {
case FIELD_TYPE_DATE:
$varName = $crosswalk->getPublicCrosswalkId();
$dateFromName = "{$varName}-from";
$dateToName = "{$varName}-to";
$dateFrom = $request->getUserVar($dateFromName);
$dateTo = $request->getUserVar($dateToName);
$dates['crosswalk'][$crosswalk->getCrosswalkId()] = array($dateFrom, $dateTo);
foreach (array('Month', 'Day', 'Year') as $datePart) {
$forwardParams[$dateFromName . $datePart] = $request->getUserVar($dateFromName . $datePart);
$forwardParams[$dateToName . $datePart] = $request->getUserVar($dateToName . $datePart);
}
break;
case FIELD_TYPE_SELECT:
case FIELD_TYPE_STRING:
$value = $request->getUserVar($crosswalk->getPublicCrosswalkId());
if (!empty($value)) {
$forwardParams[$crosswalk->getPublicCrosswalkId()] = $value;
if (is_array($value)) {
$value = '"' . implode('" OR "', $value) . '"';
}
$keywords['crosswalk'][$crosswalk->getCrosswalkId()] = Search::parseQuery($value);
}
}
}
}
$archiveIds = array();
if (empty($archives)) {
$archiveIds = null;
}
foreach ($archives as $archive) {
if (is_object($archive)) {
$archiveIds[] = $archive->getArchiveId();
}
}
$results =& Search::retrieveResults($keywords, $dates, $archiveIds, $rangeInfo);
$templateMgr =& TemplateManager::getManager($request);
// Give the results page access to the search parameters
$templateMgr->assign('isAdvanced', $request->getUserVar('isAdvanced'));
$templateMgr->assign('importance', $request->getUserVar('importance'));
// Field importance
foreach ($forwardParams as $key => $value) {
if ($value == '') {
unset($forwardParams[$key]);
}
}
$templateMgr->assign('forwardParams', $forwardParams);
$templateMgr->assign_by_ref('results', $results);
$plugin =& $this->getPlugin();
$templateMgr->display($plugin->getTemplatePath() . 'results.tpl');
}
示例12: getGridRangeInfo
/**
* Get grid range info.
* @param $request PKPRequest
* @param $rangeName string The grid id.
* @param $contextData mixed
* @return DBResultRange
*/
function getGridRangeInfo($request, $rangeName, $contextData = null)
{
$rangeInfo = parent::getRangeInfo($request, $rangeName, $contextData);
$this->callFeaturesHook('getGridRangeInfo', array('request' => &$request, 'grid' => &$this, 'rangeInfo' => $rangeInfo));
return $rangeInfo;
}
示例13: showNoRole
/**
* Show users with no role.
*/
function showNoRole()
{
$this->validate();
$userDao =& DAORegistry::getDAO('UserDAO');
$templateMgr =& TemplateManager::getManager();
parent::setupTemplate(true);
$rangeInfo = PKPHandler::getRangeInfo('users');
$users =& $userDao->getUsersWithNoRole(true, $rangeInfo);
$templateMgr->assign('omitSearch', true);
$templateMgr->assign_by_ref('users', $users);
$templateMgr->assign_by_ref('thisUser', Request::getUser());
$templateMgr->assign('helpTopicId', 'journal.users.index');
$templateMgr->display('manager/people/searchUsers.tpl');
}
示例14: searchResults
/**
* Display search results.
*/
function searchResults()
{
ZendSearchHandler::setupTemplate();
$plugin =& PluginRegistry::getPlugin('generic', 'ZendSearchPlugin');
$isUsingSolr = $plugin->isUsingSolr();
if ($isUsingSolr) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $plugin->getSetting('solrUrl') . '/select');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_ENCODING, '');
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($ch, CURLOPT_DNS_USE_GLOBAL_CACHE, 0);
curl_setopt($ch, CURLOPT_POST, 1);
$query = '';
} else {
$index =& $plugin->getIndex();
$query = new Zend_Search_Lucene_Search_Query_Boolean();
}
$q = Request::getUserVar('q');
if (!empty($q)) {
if ($isUsingSolr) {
$query .= 'text:"' . ZendSearchHandler::luceneEscape($q) . '" ';
} else {
$query->addSubquery(Zend_Search_Lucene_Search_QueryParser::parse($q));
}
}
$searchFormElementDao =& DAORegistry::getDAO('SearchFormElementDAO');
$searchFormElements =& $searchFormElementDao->getSearchFormElements();
while ($searchFormElement =& $searchFormElements->next()) {
$searchFormElementId = $searchFormElement->getSearchFormElementId();
$symbolic = $searchFormElement->getSymbolic();
switch ($searchFormElement->getType()) {
case SEARCH_FORM_ELEMENT_TYPE_SELECT:
case SEARCH_FORM_ELEMENT_TYPE_STRING:
$term = Request::getUserVar($symbolic);
if (!empty($term)) {
if ($isUsingSolr) {
$query .= $symbolic . ':"' . ZendSearchHandler::luceneEscape($term) . '" ';
} else {
$query->addSubquery(new Zend_Search_Lucene_Search_Query_Term(new Zend_Search_Lucene_Index_Term($term, $symbolic)), true);
}
}
break;
case SEARCH_FORM_ELEMENT_TYPE_DATE:
$from = Request::getUserDateVar($symbolic . '-from');
$to = Request::getUserDateVar($symbolic . '-to');
if (!empty($from) && !empty($to)) {
if ($isUsingSolr) {
$query .= $symbolic . ':[' . strftime('%Y-%m-%dT%H:%M:%SZ', $from) . ' TO ' . strftime('%Y-%m-%dT%H:%M:%SZ', $to) . '] ';
} else {
$fromTerm = new Zend_Search_Lucene_Index_Term($from, $symbolic);
$toTerm = new Zend_Search_Lucene_Index_Term($to, $symbolic);
$query->addSubquery(new Zend_Search_Lucene_Search_Query_Range($fromTerm, $toTerm, true), true);
}
}
break;
default:
fatalError('Unknown element type!');
}
unset($searchFormElement);
}
$rangeInfo =& PKPHandler::getRangeInfo('results');
if ($isUsingSolr) {
$itemsPerPage = Config::getVar('interface', 'items_per_page');
curl_setopt($ch, CURLOPT_POSTFIELDS, 'q=' . trim(urlencode($query)) . '&rows=' . urlencode($itemsPerPage) . ($rangeInfo ? '&start=' . $rangeInfo->getPage() * $itemsPerPage : ''));
$data = curl_exec($ch);
$xmlParser = new XMLParser();
$result = null;
$numFound = 0;
@($result =& $xmlParser->parseTextStruct($data, array('str', 'result')));
$recordIds = array();
if ($result) {
foreach ($result as $nodeSet) {
foreach ($nodeSet as $node) {
if (isset($node['attributes']['name']) && $node['attributes']['name'] == 'id') {
$recordIds[] = $node['value'];
} elseif (isset($node['attributes']['numFound'])) {
$numFound = $node['attributes']['numFound'];
}
}
}
}
$plugin->import('SolrResultIterator');
$resultsIterator =& SolrResultIterator::fromRangeInfo($recordIds, $numFound, $rangeInfo);
unset($recordIds);
} else {
$resultsArray = $index->find($query);
$plugin->import('ZendSearchResultIterator');
$resultsIterator =& ZendSearchResultIterator::fromRangeInfo($resultsArray, $rangeInfo);
unset($resultsArray);
}
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign_by_ref('recordDao', DAORegistry::getDAO('RecordDAO'));
$templateMgr->assign_by_ref('results', $resultsIterator);
$templateMgr->assign_by_ref('q', $q);
//.........这里部分代码省略.........
示例15: enrollSearch
/**
* Search for users to enroll in a specific role.
* @param $args array first parameter is the selected role ID
*/
function enrollSearch($args)
{
$this->validate();
$roleDao =& DAORegistry::getDAO('RoleDAO');
$userDao =& DAORegistry::getDAO('UserDAO');
$roleId = (int) (isset($args[0]) ? $args[0] : Request::getUserVar('roleId'));
$templateMgr =& TemplateManager::getManager();
$this->setupTemplate(true);
$searchType = null;
$searchMatch = null;
$search = Request::getUserVar('search');
$searchInitial = Request::getUserVar('searchInitial');
if (isset($search)) {
$searchType = Request::getUserVar('searchField');
$searchMatch = Request::getUserVar('searchMatch');
} else {
if (isset($searchInitial)) {
$searchInitial = String::strtoupper($searchInitial);
$searchType = USER_FIELD_INITIAL;
$search = $searchInitial;
}
}
$sort = Request::getUserVar('sort');
$sort = isset($sort) ? $sort : 'name';
$sortDirection = Request::getUserVar('sortDirection');
$rangeInfo = PKPHandler::getRangeInfo('users');
$users =& $userDao->getUsersByField($searchType, $searchMatch, $search, true, $rangeInfo, $sort, $sortDirection);
$templateMgr->assign('searchField', $searchType);
$templateMgr->assign('searchMatch', $searchMatch);
$templateMgr->assign('search', $search);
$templateMgr->assign('searchInitial', Request::getUserVar('searchInitial'));
$templateMgr->assign('roleId', $roleId);
$templateMgr->assign('roleName', $roleDao->getRoleName($roleId));
$fieldOptions = array(USER_FIELD_FIRSTNAME => 'user.firstName', USER_FIELD_LASTNAME => 'user.lastName', USER_FIELD_USERNAME => 'user.username', USER_FIELD_EMAIL => 'user.email');
$templateMgr->assign('fieldOptions', $fieldOptions);
$templateMgr->assign_by_ref('users', $users);
$templateMgr->assign_by_ref('thisUser', Request::getUser());
$templateMgr->assign('alphaList', explode(' ', Locale::translate('common.alphaList')));
$templateMgr->assign('sort', $sort);
$templateMgr->assign('sortDirection', $sortDirection);
$templateMgr->display('admin/people/searchUsers.tpl');
}