本文整理汇总了PHP中Handler类的典型用法代码示例。如果您正苦于以下问题:PHP Handler类的具体用法?PHP Handler怎么用?PHP Handler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Handler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: HandleAdminData
function HandleAdminData($obj, $post, $url = null)
{
$handler = new Handler($obj);
try {
$handler->Handle($post);
if (!empty($url)) {
header("Location: /admin/{$url}");
exit;
}
} catch (Exception $e) {
global $smarty;
$smarty->assign('error_txt', $e->getMessage());
}
}
示例2: conferenceEventLogType
/**
* View conference event log by record type.
*/
function conferenceEventLogType($args)
{
$assocType = isset($args[1]) ? (int) $args[0] : null;
$assocId = isset($args[2]) ? (int) $args[1] : null;
$this->validate();
$this->setupTemplate(true);
$conference =& Request::getConference();
$rangeInfo =& Handler::getRangeInfo('eventLogEntries', array($assocType, $assocId));
$logDao =& DAORegistry::getDAO('ConferenceEventLogDAO');
while (true) {
$eventLogEntries =& $logDao->getConferenceLogEntriesByAssoc($conference->getId(), null, $assocType, $assocId, $rangeInfo);
if ($eventLogEntries->isInBounds()) {
break;
}
unset($rangeInfo);
$rangeInfo =& $eventLogEntries->getLastPageRangeInfo();
unset($eventLogEntries);
}
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign('showBackLink', true);
$templateMgr->assign('isDirector', Validation::isDirector());
$templateMgr->assign_by_ref('conference', $conference);
$templateMgr->assign_by_ref('eventLogEntries', $eventLogEntries);
$templateMgr->display('manager/conferenceEventLog.tpl');
}
示例3: configure
/**
* [configure description]
* @param array $params [description]
* @return [type] [description]
*/
public static function configure(array $params)
{
extract($params);
/**
* Setting the default date timezone
*/
date_default_timezone_set($timezone);
/**
* Setting the default charset encoding
*/
mb_internal_encoding($charset);
ini_set('default_charset', $charset);
define('URL', $url);
/**
* Determing that the $web_path is a real directory
* @var string $web_path
*/
if (is_dir($web_path)) {
if (realpath($web_path) !== false) {
define('WEBPATH', (isset($_SERVER['HTTPS']) ? 'https://' : 'http://') . getenv('HTTP_HOST') . '/' . $web_path . '/');
}
} else {
if (!is_dir($web_path)) {
Handler::handler(E_USER_ERROR, 'The ' . $web_path . ' is not a valid directory', 'index.php', 146);
}
}
}
示例4: authorize
/**
* @copydoc PKPHandler::authorize()
*/
function authorize($request, &$args, $roleAssignments)
{
// User must be logged in
import('lib.pkp.classes.security.authorization.UserRequiredPolicy');
$this->addPolicy(new UserRequiredPolicy($request));
return parent::authorize($request, $args, $roleAssignments);
}
示例5: display
function display(&$args, $request)
{
$templateMgr =& TemplateManager::getManager();
parent::display($args, $request);
$issueDao =& DAORegistry::getDAO('IssueDAO');
$publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
$articleGalleyDao =& DAORegistry::getDAO('ArticleGalleyDAO');
$journal =& Request::getJournal();
switch (array_shift($args)) {
case 'exportGalley':
$articleId = array_shift($args);
$galleyId = array_shift($args);
$article =& $publishedArticleDao->getPublishedArticleByArticleId($articleId);
$galley =& $articleGalleyDao->getGalley($galleyId, $articleId);
if ($article && $galley && ($issue =& $issueDao->getIssueById($article->getIssueId(), $journal->getId()))) {
$this->exportArticle($journal, $issue, $article, $galley);
break;
}
default:
// Display a list of articles for export
$this->setBreadcrumbs();
AppLocale::requireComponents(LOCALE_COMPONENT_PKP_SUBMISSION);
$publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
$rangeInfo = Handler::getRangeInfo('articles');
$articleIds = $publishedArticleDao->getPublishedArticleIdsAlphabetizedByJournal($journal->getId(), false);
$totalArticles = count($articleIds);
$articleIds = array_slice($articleIds, $rangeInfo->getCount() * ($rangeInfo->getPage() - 1), $rangeInfo->getCount());
import('lib.pkp.classes.core.VirtualArrayIterator');
$iterator = new VirtualArrayIterator(ArticleSearch::formatResults($articleIds), $totalArticles, $rangeInfo->getPage(), $rangeInfo->getCount());
$templateMgr->assign_by_ref('articles', $iterator);
$templateMgr->display($this->getTemplatePath() . 'index.tpl');
break;
}
}
示例6: backIssues
/**
* Displays the listings of back (published) issues
*/
function backIssues($args, $request)
{
$this->validate();
$this->setupTemplate(EDITOR_SECTION_ISSUES);
$journal =& $request->getJournal();
$issueDao =& DAORegistry::getDAO('IssueDAO');
$rangeInfo = Handler::getRangeInfo('issues');
$templateMgr =& TemplateManager::getManager();
$templateMgr->addJavaScript('lib/pkp/js/lib/jquery/plugins/jquery.tablednd.js');
$templateMgr->addJavaScript('lib/pkp/js/functions/tablednd.js');
$templateMgr->assign_by_ref('issues', $issueDao->getPublishedIssues($journal->getId(), $rangeInfo));
$allIssuesIterator = $issueDao->getPublishedIssues($journal->getId());
$issueMap = array();
while ($issue =& $allIssuesIterator->next()) {
$issueMap[$issue->getId()] = $issue->getIssueIdentification();
unset($issue);
}
$templateMgr->assign('allIssues', $issueMap);
$templateMgr->assign('rangeInfo', $rangeInfo);
$currentIssue =& $issueDao->getCurrentIssue($journal->getId());
$currentIssueId = $currentIssue ? $currentIssue->getId() : null;
$templateMgr->assign('currentIssueId', $currentIssueId);
$templateMgr->assign('helpTopicId', 'publishing.index');
$templateMgr->assign('usesCustomOrdering', $issueDao->customIssueOrderingExists($journal->getId()));
$templateMgr->display('editor/issues/backIssues.tpl');
}
示例7: searches
function searches($args)
{
$this->validate();
$journal = Request::getJournal();
$rtDao =& DAORegistry::getDAO('RTDAO');
$rangeInfo = Handler::getRangeInfo('searches');
$versionId = isset($args[0]) ? $args[0] : 0;
$version =& $rtDao->getVersion($versionId, $journal->getId());
$contextId = isset($args[1]) ? $args[1] : 0;
$context =& $rtDao->getContext($contextId);
if ($context && $version && $context->getVersionId() == $version->getVersionId()) {
$this->setupTemplate(true, $version, $context);
$templateMgr =& TemplateManager::getManager();
$templateMgr->addJavaScript('lib/pkp/js/jquery.tablednd_0_5.js');
$templateMgr->addJavaScript('lib/pkp/js/tablednd.js');
$templateMgr->assign_by_ref('version', $version);
$templateMgr->assign_by_ref('context', $context);
import('lib.pkp.classes.core.ArrayItemIterator');
$templateMgr->assign_by_ref('searches', new ArrayItemIterator($context->getSearches(), $rangeInfo->getPage(), $rangeInfo->getCount()));
$templateMgr->assign('helpTopicId', 'journal.managementPages.readingTools.contexts');
$templateMgr->display('rtadmin/searches.tpl');
} else {
Request::redirect(null, null, 'versions');
}
}
示例8: LuceneHandler
/**
* Constructor
* @param $request Request
*/
function LuceneHandler(&$request)
{
parent::Handler();
$router =& $request->getRouter();
$journal =& $router->getContext($request);
$this->addCheck(new HandlerValidatorCustom($this, false, null, null, create_function('$journal', 'return !$journal || $journal->getSetting(\'publishingMode\') != PUBLISHING_MODE_NONE;'), array($journal)));
}
示例9: emails
/**
* Display a list of the emails within the current conference.
*/
function emails()
{
$this->validate();
$this->setupTemplate(true);
$conference =& Request::getConference();
$rangeInfo = Handler::getRangeInfo('emails', array());
$emailTemplateDao =& DAORegistry::getDAO('EmailTemplateDAO');
$emailTemplatesArray =& $emailTemplateDao->getEmailTemplates(Locale::getLocale(), $conference->getId());
import('core.ArrayItemIterator');
if ($rangeInfo && $rangeInfo->isValid()) {
while (true) {
$emailTemplates = new ArrayItemIterator($emailTemplatesArray, $rangeInfo->getPage(), $rangeInfo->getCount());
if ($emailTemplates->isInBounds()) {
break;
}
unset($rangeInfo);
$rangeInfo =& $emailTemplates->getLastPageRangeInfo();
unset($emailTemplates);
}
} else {
$emailTemplates = new ArrayItemIterator($emailTemplatesArray);
}
$templateMgr =& TemplateManager::getManager();
// The bread crumbs depends on whether we're doing scheduled conference or conference
// management. FIXME: this is going to be a common situation, and this isn't
// an elegant way of testing for it.
if (Request::getRequestedPage() === 'manager') {
$templateMgr->assign('pageHierarchy', array(array(Request::url(null, 'index', 'manager'), 'manager.conferenceSiteManagement')));
} else {
$templateMgr->assign('pageHierarchy', array(array(Request::url(null, null, 'manager'), 'manager.schedConfManagement')));
}
$templateMgr->assign_by_ref('emailTemplates', $emailTemplates);
$templateMgr->assign('helpTopicId', 'conference.generalManagement.emails');
$templateMgr->display('manager/emails/emails.tpl');
}
示例10: authorize
/**
* @see PKPHandler::authorize()
* @param $request PKPRequest
* @param $args array
* @param $roleAssignments array
*/
function authorize(&$request, $args, $roleAssignments)
{
$stageId = $request->getUserVar('stageId');
import('classes.security.authorization.OmpWorkflowStageAccessPolicy');
$this->addPolicy(new OmpWorkflowStageAccessPolicy($request, $args, $roleAssignments, 'monographId', $stageId));
return parent::authorize($request, $args, $roleAssignments);
}
示例11: authorize
/**
* @copydoc PKPHandler::authorize()
*/
function authorize($request, &$args, $roleAssignments)
{
$stageId = (int) $request->getUserVar('stageId');
import('classes.security.authorization.WorkflowStageAccessPolicy');
$this->addPolicy(new WorkflowStageAccessPolicy($request, $args, $roleAssignments, 'submissionId', $stageId));
return parent::authorize($request, $args, $roleAssignments);
}
示例12: handle
/**
* Handle the request.
*
* This approach by using a template method pattern ensures you that
* each subclass will not forget to call the successor. Beside, the returned
* boolean value indicates you if the request have been processed or not.
*
* @param Request $req
*
* @return bool
*/
public final function handle(Request $req)
{
$req->forDebugOnly = get_called_class();
$processed = $this->processing($req);
if (!$processed) {
// the request has not been processed by this handler => see the next
if (!is_null($this->successor)) {
$processed = $this->successor->handle($req);
}
}
return $processed;
}
示例13: __construct
public function __construct($type = USE_ECHO, $separator = self::DEFAULT_SEPARATOR, $expandArrays = true)
{
parent::__construct(null);
$this->_type = $type;
$this->_separator = $separator;
$this->_expandArrays = $expandArrays;
}
示例14: testGenerateOutputWithFlairException
/**
* tests that output is generated as expected using no template and a Flair exception
*
* @author Daniel Sherman
* @test
* @depends testConstruct
* @depends testGenerateDefaultOutput
* @covers ::generateOutput
*/
public function testGenerateOutputWithFlairException()
{
$stub = $this->getMockBuilder('Flair\\Exception\\Exception')->disableOriginalConstructor()->getMock();
$stub->method('getId')->willReturn('123456789');
$this->expectOutputString('Issue: 123456789');
self::$handler->generateOutput($stub);
}
示例15: setupTemplate
/**
* Setup common template variables.
* @param $subclass boolean set to true if caller is below this handler in the hierarchy
*/
function setupTemplate($subclass = false)
{
parent::setupTemplate();
$templateMgr =& TemplateManager::getManager();
$templateMgr->setCacheability(CACHEABILITY_PUBLIC);
$templateMgr->assign('pageHierachy', array(array(Request::url(null, null, 'announcements'), 'announcement.announcements')));
}