本文整理匯總了PHP中ImportExportPlugin類的典型用法代碼示例。如果您正苦於以下問題:PHP ImportExportPlugin類的具體用法?PHP ImportExportPlugin怎麽用?PHP ImportExportPlugin使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了ImportExportPlugin類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getTemplateVarsFromRowColumn
/**
* Extracts variables for a given column from a data element
* so that they may be assigned to template before rendering.
*
* @copydoc DataObjectGridCellProvider::getTemplateVarsFromRowColumn()
*/
function getTemplateVarsFromRowColumn($row, $column)
{
$publishedIssue = $row->getData();
$columnId = $column->getId();
assert(is_a($publishedIssue, 'Issue') && !empty($columnId));
switch ($columnId) {
case 'identification':
return array('label' => '');
case 'published':
return array('label' => $publishedIssue->getDatePublished());
case 'pubId':
return array('label' => $publishedIssue->getStoredPubId($this->_plugin->getPubIdType()));
case 'status':
$status = $publishedIssue->getData($this->_plugin->getDepositStatusSettingName());
$statusNames = $this->_plugin->getStatusNames();
$statusActions = $this->_plugin->getStatusActions($publishedIssue);
if ($status) {
if (array_key_exists($status, $statusActions)) {
$label = '';
} else {
assert(array_key_exists($status, $statusNames));
$label = $statusNames[$status];
}
} else {
$label = $statusNames[DOI_EXPORT_STATUS_NOT_DEPOSITED];
}
return array('label' => $label);
}
}
示例2: getTemplateVarsFromRowColumn
/**
* Extracts variables for a given column from a data element
* so that they may be assigned to template before rendering.
*
* @copydoc DataObjectGridCellProvider::getTemplateVarsFromRowColumn()
*/
function getTemplateVarsFromRowColumn($row, $column)
{
$publishedSubmissionGalley = $row->getData();
$columnId = $column->getId();
assert(is_a($publishedSubmissionGalley, 'ArticleGAlley') && !empty($columnId));
switch ($columnId) {
case 'id':
return array('label' => $publishedSubmissionGalley->getId());
case 'title':
return array('label' => '');
case 'issue':
return array('label' => '');
case 'galley':
return array('label' => $publishedSubmissionGalley->getGalleyLabel());
case 'pubId':
return array('label' => $publishedSubmissionGalley->getStoredPubId($this->_plugin->getPubIdType()));
case 'status':
$status = $publishedSubmissionGalley->getData($this->_plugin->getDepositStatusSettingName());
$statusNames = $this->_plugin->getStatusNames();
$statusActions = $this->_plugin->getStatusActions($publishedSubmissionGalley);
if ($status) {
if (array_key_exists($status, $statusActions)) {
$label = '';
} else {
assert(array_key_exists($status, $statusNames));
$label = $statusNames[$status];
}
} else {
$label = $statusNames[DOI_EXPORT_STATUS_NOT_DEPOSITED];
}
return array('label' => $label);
}
}
示例3: 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();
}
}
示例4: 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;
}
}
示例5: 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();
}
}
示例6: 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;
}
}
示例7: loadData
/**
* @copydoc GridHandler::loadData()
*/
protected function loadData($request, $filter)
{
$context = $request->getContext();
list($statusId) = $this->getFilterValues($filter);
$pubIdStatusSettingName = null;
if ($statusId) {
$pubIdStatusSettingName = $this->_plugin->getDepositStatusSettingName();
}
$issueDao = DAORegistry::getDAO('IssueDAO');
return $issueDao->getByPubIdType($this->_plugin->getPubIdType(), $context ? $context->getId() : null, $pubIdStatusSettingName, $statusId, $this->getGridRangeInfo($request, $this->getId()));
}
示例8: 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');
}
}
示例9: 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');
}
}
示例10: loadData
/**
* @copydoc GridHandler::loadData()
*/
protected function loadData($request, $filter)
{
$publishedArticleDao = DAORegistry::getDAO('PublishedArticleDAO');
$context = $request->getContext();
list($search, $column, $issueId, $statusId) = $this->getFilterValues($filter);
$title = $author = null;
if ($column == 'title') {
$title = $search;
} elseif ($column == 'author') {
$author = $search;
}
$pubIdStatusSettingName = null;
if ($statusId) {
$pubIdStatusSettingName = $this->_plugin->getDepositStatusSettingName();
}
return $publishedArticleDao->getExportable($context->getId(), null, $title, $author, $issueId, $pubIdStatusSettingName, $statusId, $this->getGridRangeInfo($request, $this->getId()));
}
示例11: 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');
}
}
示例12: 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');
}
}
示例13: 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');
}
}
示例14: 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');
}
}
示例15: 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');
}
}