/** * 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'); } }
/** * 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'); } }
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))); } }
/** * 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'); }
/** * 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'); }
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'); }
/** * 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'); }
/** * @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); }
/** * 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); }
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'); } }
/** * 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'); }
function Handler() { parent::PKPHandler(); }
/** * @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); }
/** * @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); }
/** * 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'); }
/** * Constructor */ function __construct() { parent::__construct(); }
/** * @see PKPHandler::authorize() */ function authorize(&$request, $args, $roleAssignments) { import('lib.pkp.classes.security.authorization.PKPAuthenticatedAccessPolicy'); $this->addPolicy(new PKPAuthenticatedAccessPolicy($request, array('changeActingAsUserGroup', 'setUserSetting'))); return parent::authorize($request, $args, $roleAssignments); }
/** * @see PKPHandler::authorize() */ function authorize(&$request, $args, $roleAssignments) { import('lib.pkp.classes.security.authorization.PKPProcessAccessPolicy'); $this->addPolicy(new PKPProcessAccessPolicy($request, $args, 'checkAllCitations')); return parent::authorize($request, $args, $roleAssignments); }
/** * @see PKPHandler::initialize() * @param $request PKPRequest */ function initialize(&$request) { parent::initialize($request); // Load grid-specific translations Locale::requireComponents(array(LOCALE_COMPONENT_PKP_GRID)); }
/** * 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'); }
/** * 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); $templateMgr->display($plugin->getTemplatePath() . 'results.tpl'); }
/** * Return the DBResultRange structure and misc. variables describing the current page of a set of pages. * @param $rangeName string Symbolic name of range of pages; must match the Smarty {page_list ...} name. * @param $contextData array If set, this should contain a set of data that are required to * define the context of this request (for maintaining page numbers across requests). * To disable persistent page contexts, set this variable to null. * @return array ($pageNum, $dbResultRange) */ function &getRangeInfo($rangeName, $contextData = null) { //FIXME: is there any way to get around calling a Request (instead of a PKPRequest) here? $context =& Request::getContext(); $pageNum = PKPRequest::getUserVar($rangeName . 'Page'); if (empty($pageNum)) { $session =& PKPRequest::getSession(); $pageNum = 1; // Default to page 1 if ($session && $contextData !== null) { // See if we can get a page number from a prior request $contextHash = PKPHandler::hashPageContext($contextData); if (PKPRequest::getUserVar('clearPageContext')) { // Explicitly clear the old page context $session->unsetSessionVar("page-{$contextHash}"); } else { $oldPage = $session->getSessionVar("page-{$contextHash}"); if (is_numeric($oldPage)) { $pageNum = $oldPage; } } } } else { $session =& PKPRequest::getSession(); if ($session && $contextData !== null) { // Store the page number $contextHash = PKPHandler::hashPageContext($contextData); $session->setSessionVar("page-{$contextHash}", $pageNum); } } if ($context) { $count = $context->getSetting('itemsPerPage'); } if (!isset($count)) { $count = Config::getVar('interface', 'items_per_page'); } import('db.DBResultRange'); if (isset($count)) { $returner = new DBResultRange($count, $pageNum); } else { $returner = new DBResultRange(-1, -1); } return $returner; }
/** * Show users with no role. * Last update: EL on February 13th 2013 */ function showNoRole() { $this->validate(); $userDao =& DAORegistry::getDAO('UserDAO'); // For sending the list of ERCs to the template // EL on February 13th 2013 $sectionDao =& DAORegistry::getDAO('SectionDAO'); $journalDao =& DAORegistry::getDAO('JournalDAO'); $journal =& $journalDao->getJournalByPath(Request::getRequestedJournalPath()); $templateMgr =& TemplateManager::getManager(); parent::setupTemplate(true); $rangeInfo = PKPHandler::getRangeInfo('users'); $users =& $userDao->getUsersWithNoRole(true, $rangeInfo); // Send the list of IRBs to the template $templateMgr->assign('sections', $sectionDao->getJournalSections($journal->getId())); $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'); }
/** * @see PKPHandler::initialize() */ function initialize(&$request, $args = null) { parent::initialize($request, $args); // Load grid-specific translations AppLocale::requireComponents(array(LOCALE_COMPONENT_PKP_GRID, LOCALE_COMPONENT_APPLICATION_COMMON)); }
/** * @see PKPHandler::authorize() * @param $request PKPRequest * @param $args array * @param $roleAssignments array */ function authorize($request, &$args, $roleAssignments) { import('classes.security.authorization.OmpPublishedMonographAccessPolicy'); $this->addPolicy(new OmpPublishedMonographAccessPolicy($request, $args, $roleAssignments, 'submissionId', false)); return parent::authorize($request, $args, $roleAssignments); }
/** * 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'); }
/** * @see PKPHandler::initialize() * @param $request PKPRequest * @param $args array optional */ function initialize($request, $args = null) { parent::initialize($request, $args); // Load grid-specific translations AppLocale::requireComponents(LOCALE_COMPONENT_PKP_GRID, LOCALE_COMPONENT_APP_COMMON); // Give a chance to grid add features before calling hooks. // Because we must control when features are added to a grid, // this is the only place that should use the _addFeature() method. $this->_addFeatures($this->initFeatures($request, $args)); $this->callFeaturesHook('gridInitialize', array('grid' => &$this)); }
/** * @see PKPHandler::initialize() * @param $request PKPRequest * @param $args array optional */ function initialize($request, $args = null) { parent::initialize($request, $args); // Load grid-specific translations AppLocale::requireComponents(LOCALE_COMPONENT_PKP_GRID, LOCALE_COMPONENT_APP_COMMON); if ($this->getFilterForm() && $this->isFilterFormCollapsible()) { import('lib.pkp.classes.linkAction.request.NullAction'); $this->addAction(new LinkAction('search', new NullAction(), __('common.search'), 'search_extras_expand')); } // Give a chance to grid add features before calling hooks. // Because we must control when features are added to a grid, // this is the only place that should use the _addFeature() method. $this->_addFeatures($this->initFeatures($request, $args)); $this->callFeaturesHook('gridInitialize', array('grid' => &$this)); }