本文整理汇总了PHP中PKPHandler类的典型用法代码示例。如果您正苦于以下问题:PHP PKPHandler类的具体用法?PHP PKPHandler怎么用?PHP PKPHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PKPHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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');
}
}
示例2: 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');
}
}
示例3: Handler
function Handler()
{
parent::PKPHandler();
$journal =& Request::getJournal();
$page = Request::getRequestedPage();
if ($journal && $journal->getSetting('restrictSiteAccess')) {
$this->addCheck(new HandlerValidatorCustom($this, true, null, null, create_function('$page', 'if (!Validation::isLoggedIn() && !in_array($page, Handler::getLoginExemptions())) return false; else return true;'), array($page)));
}
}
示例4: 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');
}
示例5: 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');
}
示例6: 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');
}
示例7: 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');
}
示例8: 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);
}
示例9: 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);
}
示例10: 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');
}
}
示例11: 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');
}
示例12: Handler
function Handler()
{
parent::PKPHandler();
}
示例13: authorize
/**
* @see PKPHandler::authorize()
*/
function authorize(&$request, $args, $roleAssignments)
{
import('lib.pkp.classes.security.authorization.PKPSiteAccessPolicy');
$this->addPolicy(new PKPSiteAccessPolicy($request, array('setUserSetting'), SITE_ACCESS_ALL_ROLES));
return parent::authorize($request, $args, $roleAssignments);
}
示例14: authorize
/**
* @copydoc PKPHandler::authorize()
*/
function authorize($request, &$args, $roleAssignments)
{
import('lib.pkp.classes.security.authorization.PKPSiteAccessPolicy');
$this->addPolicy(new PKPSiteAccessPolicy($request, array('updateUserMessageState', 'suggestUsername'), SITE_ACCESS_ALL_ROLES));
return parent::authorize($request, $args, $roleAssignments);
}
示例15: 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');
}