本文整理匯總了PHP中ImportExportPlugin::display方法的典型用法代碼示例。如果您正苦於以下問題:PHP ImportExportPlugin::display方法的具體用法?PHP ImportExportPlugin::display怎麽用?PHP ImportExportPlugin::display使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ImportExportPlugin
的用法示例。
在下文中一共展示了ImportExportPlugin::display方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: 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;
}
}
示例2: display
/**
* Display the plugin.
* @param $args array
* @param $request PKPRequest
*/
function display($args, $request)
{
$templateMgr = TemplateManager::getManager($request);
$context = $request->getContext();
parent::display($args, $request);
$templateMgr->assign('plugin', $this);
switch (array_shift($args)) {
case 'index':
case '':
$templateMgr->display($this->getTemplatePath() . 'index.tpl');
break;
case 'uploadImportXML':
$user = $request->getUser();
import('lib.pkp.classes.file.TemporaryFileManager');
$temporaryFileManager = new TemporaryFileManager();
$temporaryFile = $temporaryFileManager->handleUpload('uploadedFile', $user->getId());
if ($temporaryFile) {
$json = new JSONMessage(true);
$json->setAdditionalAttributes(array('temporaryFileId' => $temporaryFile->getId()));
} else {
$json = new JSONMessage(false, __('common.uploadFailed'));
}
return $json->getString();
case 'importBounce':
$json = new JSONMessage(true);
$json->setEvent('addTab', array('title' => __('plugins.importexport.users.results'), 'url' => $request->url(null, null, null, array('plugin', $this->getName(), 'import'), array('temporaryFileId' => $request->getUserVar('temporaryFileId')))));
return $json->getString();
case 'import':
$temporaryFileId = $request->getUserVar('temporaryFileId');
$temporaryFileDao = DAORegistry::getDAO('TemporaryFileDAO');
$user = $request->getUser();
$temporaryFile = $temporaryFileDao->getTemporaryFile($temporaryFileId, $user->getId());
if (!$temporaryFile) {
$json = new JSONMessage(true, __('plugins.importexport.users.uploadFile'));
return $json->getString();
}
$temporaryFilePath = $temporaryFile->getFilePath();
libxml_use_internal_errors(true);
$users = $this->importUsers(file_get_contents($temporaryFilePath), $context, $user);
$validationErrors = array_filter(libxml_get_errors(), create_function('$a', 'return $a->level == LIBXML_ERR_ERROR || $a->level == LIBXML_ERR_FATAL;'));
$templateMgr->assign('validationErrors', $validationErrors);
libxml_clear_errors();
$templateMgr->assign('users', $users);
$json = new JSONMessage(true, $templateMgr->fetch($this->getTemplatePath() . 'results.tpl'));
return $json->getString();
case 'export':
$exportXml = $this->exportUsers((array) $request->getUserVar('selectedUsers'), $request->getContext(), $request->getUser());
header('Content-type: application/xml');
echo $exportXml;
break;
case 'exportAllUsers':
$exportXml = $this->exportAllUsers($request->getContext(), $request->getUser());
header('Content-type: application/xml');
echo $exportXml;
break;
default:
$dispatcher = $request->getDispatcher();
$dispatcher->handle404();
}
}
示例3: display
/**
* Display the plugin.
* @param $args array
* @param $request PKPRequest
*/
function display($args, $request)
{
$templateMgr = TemplateManager::getManager($request);
$journal = $request->getJournal();
parent::display($args, $request);
$templateMgr->assign('plugin', $this);
switch (array_shift($args)) {
case 'index':
case '':
$templateMgr->display($this->getTemplatePath() . 'index.tpl');
break;
case 'uploadImportXML':
$user = $request->getUser();
import('lib.pkp.classes.file.TemporaryFileManager');
$temporaryFileManager = new TemporaryFileManager();
$temporaryFile = $temporaryFileManager->handleUpload('uploadedFile', $user->getId());
if ($temporaryFile) {
$json = new JSONMessage(true);
$json->setAdditionalAttributes(array('temporaryFileId' => $temporaryFile->getId()));
} else {
$json = new JSONMessage(false, __('common.uploadFailed'));
}
return $json->getString();
case 'importBounce':
$json = new JSONMessage(true);
$json->setEvent('addTab', array('title' => __('plugins.importexport.native.results'), 'url' => $request->url(null, null, null, array('plugin', $this->getName(), 'import'), array('temporaryFileId' => $request->getUserVar('temporaryFileId')))));
return $json->getString();
case 'import':
$temporaryFileId = $request->getUserVar('temporaryFileId');
$temporaryFileDao = DAORegistry::getDAO('TemporaryFileDAO');
$user = $request->getUser();
$temporaryFile = $temporaryFileDao->getTemporaryFile($temporaryFileId, $user->getId());
if (!$temporaryFile) {
$json = new JSONMessage(true, __('plugins.inportexport.native.uploadFile'));
return $json->getString();
}
$temporaryFilePath = $temporaryFile->getFilePath();
$submissions = $this->importSubmissions(file_get_contents($temporaryFilePath), $journal, $user);
$templateMgr->assign('submissions', $submissions);
$json = new JSONMessage(true, $templateMgr->fetch($this->getTemplatePath() . 'results.tpl'));
return $json->getString();
case 'exportSubmissions':
$exportXml = $this->exportSubmissions((array) $request->getUserVar('selectedSubmissions'), $request->getContext(), $request->getUser());
header('Content-type: application/xml');
echo $exportXml;
break;
case 'exportIssues':
$exportXml = $this->exportIssues((array) $request->getUserVar('selectedIssues'), $request->getContext(), $request->getUser());
header('Content-type: application/xml');
echo $exportXml;
break;
default:
$dispatcher = $request->getDispatcher();
$dispatcher->handle404();
}
}
示例4: display
/**
* Display the plugin.
* @param $args array
* @param $request PKPRequest
*/
function display($args, $request)
{
$templateMgr = TemplateManager::getManager($request);
parent::display($args, $request);
switch (array_shift($args)) {
case 'index':
case '':
$templateMgr->display($this->getTemplatePath() . '/index.tpl');
break;
}
}
示例5: display
function display(&$args)
{
$templateMgr =& TemplateManager::getManager();
parent::display($args);
$issueDao =& DAORegistry::getDAO('IssueDAO');
$journal =& Request::getJournal();
switch (array_shift($args)) {
case 'exportIssues':
$issueIds = Request::getUserVar('issueId');
if (!isset($issueIds)) {
$issueIds = array();
}
$issues = array();
foreach ($issueIds as $issueId) {
$issue =& $issueDao->getIssueById($issueId);
if (!$issue) {
Request::redirect();
}
$issues[] =& $issue;
}
$this->exportIssues($journal, $issues);
break;
case 'exportIssue':
$issueId = array_shift($args);
$issue =& $issueDao->getIssueById($issueId);
if (!$issue) {
Request::redirect();
}
$issues = array($issue);
$this->exportIssues($journal, $issues);
break;
case 'issues':
// Display a list of issues for export
$this->setBreadcrumbs(array(), true);
Locale::requireComponents(array(LOCALE_COMPONENT_OJS_EDITOR));
$issueDao =& DAORegistry::getDAO('IssueDAO');
$issues =& $issueDao->getIssues($journal->getId(), Handler::getRangeInfo('issues'));
$siteDao =& DAORegistry::getDAO('SiteDAO');
$site = $siteDao->getSite();
$organization = $site->getLocalizedTitle();
$templateMgr->assign_by_ref('issues', $issues);
$templateMgr->assign_by_ref('organization', $organization);
$templateMgr->display($this->getTemplatePath() . 'issues.tpl');
break;
default:
$this->setBreadcrumbs();
$templateMgr->display($this->getTemplatePath() . 'index.tpl');
}
}
示例6: display
/**
* Display the plugin
* @param $args array
*/
function display(&$args, $request)
{
$templateMgr =& TemplateManager::getManager();
parent::display($args, $request);
$journal =& Request::getJournal();
switch (array_shift($args)) {
case 'export':
// export an xml file with the journal's information
$this->exportJournal($journal);
break;
default:
$this->setBreadcrumbs();
$templateMgr->display($this->getTemplatePath() . 'index.tpl');
}
}
示例7: display
function display(&$args)
{
parent::display($args);
switch (array_shift($args)) {
case 'exportIssue':
// The actual issue export code would go here
break;
default:
// Display a list of issues for export
$journal =& Request::getJournal();
$issueDao =& DAORegistry::getDAO('IssueDAO');
$issues =& $issueDao->getIssues($journal->getJournalId(), Handler::getRangeInfo('issues'));
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign_by_ref('issues', $issues);
$templateMgr->display($this->getTemplatePath() . 'issues.tpl');
}
}
示例8: display
/**
* Display the plugin
* @param $args array
*/
function display(&$args, $request)
{
$templateMgr = TemplateManager::getManager($request);
parent::display($args, $request);
$journal = $request->getJournal();
switch (array_shift($args)) {
case 'export':
// export an xml file with the journal's information
$this->exportJournal($journal);
break;
case 'contact':
// present a form autofilled with journal information to send to the DOAJ representative
$this->contact($journal);
break;
default:
$templateMgr->display($this->getTemplatePath() . 'index.tpl');
}
}
示例9: display
function display(&$args)
{
$templateMgr =& TemplateManager::getManager();
parent::display($args);
$request =& $this->getRequest();
$conference =& $request->getConference();
switch (array_shift($args)) {
case 'exportPaper':
$paperIds = array(array_shift($args));
// $result = array_shift(PaperSearch::formatResults($paperIds));
// $this->exportPaper($conference, $result['track'], $result['section'], $result['publishedPaper']);
$result = PaperSearch::formatResults($paperIds);
$this->exportPapers($result);
break;
case 'exportPapers':
$paperIds = $request->getUserVar('paperId');
if (!isset($paperIds)) {
$paperIds = array();
} else {
array_pop($paperIds);
}
$results =& PaperSearch::formatResults($paperIds);
$this->exportPapers($results);
break;
case 'papers':
// Display a list of papers for export
$this->setBreadcrumbs(array(), true);
$publishedPaperDao = DAORegistry::getDAO('PublishedPaperDAO');
$rangeInfo = Handler::getRangeInfo($request, 'papers');
$paperIds = $publishedPaperDao->getPublishedPaperIdsAlphabetizedBySchedConf($conference->getId());
$totalPapers = count($paperIds);
if ($rangeInfo->isValid()) {
$paperIds = array_slice($paperIds, $rangeInfo->getCount() * ($rangeInfo->getPage() - 1), $rangeInfo->getCount());
}
import('lib.pkp.classes.core.VirtualArrayIterator');
$iterator = new VirtualArrayIterator(PaperSearch::formatResults($paperIds), $totalPapers, $rangeInfo->getPage(), $rangeInfo->getCount());
$templateMgr->assign_by_ref('papers', $iterator);
$templateMgr->display($this->getTemplatePath() . 'papers.tpl');
break;
default:
$this->setBreadcrumbs();
$templateMgr->display($this->getTemplatePath() . 'index.tpl');
}
}
示例10: display
function display(&$args, $request)
{
parent::display($args, $request);
$templateMgr =& TemplateManager::getManager();
$journal =& $request->getJournal();
switch (array_shift($args)) {
case 'export':
@set_time_limit(0);
$errors = array();
$success = $this->handleExport($journal, $errors);
if ($success === false) {
return $errors;
}
break;
case 'import':
AppLocale::requireComponents(LOCALE_COMPONENT_OJS_EDITOR, LOCALE_COMPONENT_OJS_AUTHOR);
import('classes.file.TemporaryFileManager');
$temporaryFileManager = new TemporaryFileManager();
if ($existingFileId = $request->getUserVar('temporaryFileId')) {
// The user has just entered more context. Fetch an existing file.
$temporaryFile = $temporaryFileManager->getFile($existingFileId, $user->getId());
} else {
$user = Request::getUser();
$temporaryFile = $temporaryFileManager->handleUpload('importFile', $user->getId());
}
if (!$temporaryFile) {
$templateMgr->assign('error', 'plugins.importexport.fullJournal.error.uploadFailed');
return $templateMgr->display($this->getTemplatePath() . 'importError.tpl');
}
@set_time_limit(0);
$errors = array();
if ($this->handleImport($temporaryFile->getFilePath(), $errors)) {
return $templateMgr->display($this->getTemplatePath() . 'importSuccess.tpl');
} else {
$templateMgr->assign_by_ref('errors', $errors);
return $templateMgr->display($this->getTemplatePath() . 'importError.tpl');
}
break;
default:
$this->setBreadcrumbs();
$templateMgr->display($this->getTemplatePath() . 'index.tpl');
}
}
示例11: display
/**
* Display the plugin
* @param $args array
*/
function display(&$args)
{
$templateMgr =& TemplateManager::getManager();
parent::display($args);
$journal =& Request::getJournal();
switch (array_shift($args)) {
case 'export':
// export an xml file with the journal's information
$this->exportJournal($journal);
break;
case 'email':
// present a form autofilled with journal information to send to the DOAJ representative
$this->emailRep($journal, Request::getUserVar('send'));
break;
default:
$this->setBreadcrumbs();
$templateMgr->display($this->getTemplatePath() . 'index.tpl');
}
}
示例12: display
/**
* Display the plugin.
* @param $args array
* @param $request PKPRequest
*/
function display($args, $request)
{
$templateMgr = TemplateManager::getManager($request);
$press = $request->getPress();
parent::display($args, $request);
$templateMgr->assign('plugin', $this);
switch (array_shift($args)) {
case 'index':
case '':
$templateMgr->display($this->getTemplatePath() . 'index.tpl');
break;
case 'export':
$exportXml = $this->exportSubmissions((array) $request->getUserVar('selectedSubmissions'), $request->getContext(), $request->getUser());
header('Content-type: application/xml');
echo $exportXml;
break;
default:
$dispatcher = $request->getDispatcher();
$dispatcher->handle404();
}
}
示例13: display
function display(&$args)
{
$templateMgr =& TemplateManager::getManager();
parent::display($args);
$conference =& Request::getConference();
switch (array_shift($args)) {
case 'exportschedConf':
$conferenceDAO =& DAORegistry::getDAO('ConferenceDAO');
$schedConfDAO =& DAORegistry::getDAO('SchedConfDAO');
$schedConfId = array_shift($args);
if ($schedConfId) {
$schedConf =& $schedConfDAO->getSchedConf($schedConfId);
$this->exportSchedConf($conference, $schedConf);
return true;
} else {
$schedConfIds = Request::getUserVar('SchedConfId');
$this->exportSchedConfs($conference, $schedConfIds);
return true;
}
break;
case 'schedConfs':
// Display a list of Scheduled Conferences for export
$this->setBreadcrumbs(array(), true);
$templateMgr =& TemplateManager::getManager();
$schedConfDao =& DAORegistry::getDAO('SchedConfDAO');
$currentSchedConfs =& $schedConfDao->getCurrentSchedConfs($conference->getId());
$siteDao =& DAORegistry::getDAO('SiteDAO');
$site = $siteDao->getSite();
$organization = $site->getLocalizedTitle();
$templateMgr->assign_by_ref('organization', $organization);
$templateMgr->assign_by_ref('schedConfs', $currentSchedConfs);
$templateMgr->display($this->getTemplatePath() . 'schedConfs.tpl');
break;
default:
$this->setBreadcrumbs();
$templateMgr->display($this->getTemplatePath() . 'index.tpl');
}
}
示例14: display
/**
* Display the plugin
* @param $args array
*
* This supports the following actions:
* - unregistered, issues, articles: lists with exportable objects
* - markRegistered: mark a single object (article, issue) as registered
* - export: export a single object (article, issue)
*/
function display($args, $request)
{
$templateMgr = TemplateManager::getManager();
parent::display($args, $request);
$journal = $request->getJournal();
switch (array_shift($args)) {
case 'unregistered':
return $this->_displayArticleList($templateMgr, $journal, true);
break;
case 'issues':
return $this->_displayIssueList($templateMgr, $journal);
break;
case 'articles':
return $this->_displayArticleList($templateMgr, $journal);
break;
case 'process':
return $this->_process($request, $journal);
break;
default:
$this->setBreadcrumbs();
$templateMgr->display($this->getTemplatePath() . 'index.tpl');
}
}
示例15: display
function display(&$args, $request)
{
$templateMgr =& TemplateManager::getManager();
parent::display($args, $request);
$issueDao =& DAORegistry::getDAO('IssueDAO');
$journal =& $request->getJournal();
switch (array_shift($args)) {
case 'exportIssues':
$issueIds = $request->getUserVar('issueId');
if (!isset($issueIds)) {
$issueIds = array();
}
$issues = array();
foreach ($issueIds as $issueId) {
$issue =& $issueDao->getIssueById($issueId, $journal->getId());
if (!$issue) {
$request->redirect();
}
$issues[] =& $issue;
unset($issue);
}
$this->exportIssues($journal, $issues);
break;
case 'exportIssue':
$issueId = array_shift($args);
$issue =& $issueDao->getIssueById($issueId, $journal->getId());
if (!$issue) {
$request->redirect();
}
$this->exportIssue($journal, $issue);
break;
case 'exportArticle':
$articleIds = array(array_shift($args));
$result = array_shift(ArticleSearch::formatResults($articleIds));
$this->exportArticle($journal, $result['issue'], $result['section'], $result['publishedArticle']);
break;
case 'exportArticles':
$articleIds = $request->getUserVar('articleId');
if (!isset($articleIds)) {
$articleIds = array();
}
$results =& ArticleSearch::formatResults($articleIds);
$this->exportArticles($results);
break;
case 'issues':
// Display a list of issues for export
$this->setBreadcrumbs(array(), true);
AppLocale::requireComponents(LOCALE_COMPONENT_OJS_EDITOR);
$issueDao =& DAORegistry::getDAO('IssueDAO');
$issues =& $issueDao->getIssues($journal->getId(), Handler::getRangeInfo('issues'));
$templateMgr->assign_by_ref('issues', $issues);
$templateMgr->display($this->getTemplatePath() . 'issues.tpl');
break;
case 'articles':
// Display a list of articles for export
$this->setBreadcrumbs(array(), true);
$publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
$rangeInfo = Handler::getRangeInfo('articles');
$articleIds = $publishedArticleDao->getPublishedArticleIdsAlphabetizedByJournal($journal->getId(), false);
$totalArticles = count($articleIds);
if ($rangeInfo->isValid()) {
$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() . 'articles.tpl');
break;
case 'import':
AppLocale::requireComponents(LOCALE_COMPONENT_OJS_EDITOR, LOCALE_COMPONENT_OJS_AUTHOR);
import('classes.file.TemporaryFileManager');
$issueDao =& DAORegistry::getDAO('IssueDAO');
$sectionDao =& DAORegistry::getDAO('SectionDAO');
$user =& $request->getUser();
$temporaryFileManager = new TemporaryFileManager();
if ($existingFileId = $request->getUserVar('temporaryFileId')) {
// The user has just entered more context. Fetch an existing file.
$temporaryFile = $temporaryFileManager->getFile($existingFileId, $user->getId());
} else {
$temporaryFile = $temporaryFileManager->handleUpload('importFile', $user->getId());
}
$context = array('journal' => $journal, 'user' => $user);
if ($sectionId = $request->getUserVar('sectionId')) {
$context['section'] = $sectionDao->getSection($sectionId);
}
if ($issueId = $request->getUserVar('issueId')) {
$context['issue'] = $issueDao->getIssueById($issueId, $journal->getId());
}
if (!$temporaryFile) {
$templateMgr->assign('error', 'plugins.importexport.native.error.uploadFailed');
return $templateMgr->display($this->getTemplatePath() . 'importError.tpl');
}
$doc =& $this->getDocument($temporaryFile->getFilePath());
if (substr($this->getRootNodeName($doc), 0, 7) === 'article') {
// Ensure the user has supplied enough valid information to
// import articles within an appropriate context. If not,
// prompt them for the.
if (!isset($context['issue']) || !isset($context['section'])) {
$issues =& $issueDao->getIssues($journal->getId(), Handler::getRangeInfo('issues'));
$templateMgr->assign_by_ref('issues', $issues);
//.........這裏部分代碼省略.........