/**
  * @see PKPHandler::initialize()
  */
 function initialize($request)
 {
     // Load user-related translations.
     AppLocale::requireComponents(LOCALE_COMPONENT_APP_ADMIN, LOCALE_COMPONENT_APP_MANAGER, LOCALE_COMPONENT_APP_COMMON, LOCALE_COMPONENT_PKP_USER, LOCALE_COMPONENT_PKP_GRID, LOCALE_COMPONENT_PKP_MANAGER);
     // Basic grid configuration.
     $this->setTitle('manager.reviewForms');
     // Grid actions.
     $router = $request->getRouter();
     import('lib.pkp.classes.linkAction.request.AjaxModal');
     $this->addAction(new LinkAction('createReviewForm', new AjaxModal($router->url($request, null, null, 'createReviewForm', null, null), __('manager.reviewForms.create'), 'modal_add_item', true), __('manager.reviewForms.create'), 'add_item'));
     //
     // Grid columns.
     //
     import('lib.pkp.controllers.grid.settings.reviewForms.ReviewFormGridCellProvider');
     $reviewFormGridCellProvider = new ReviewFormGridCellProvider();
     // Review form name.
     $this->addColumn(new GridColumn('name', 'manager.reviewForms.title', null, null, $reviewFormGridCellProvider));
     // Review Form 'in review'
     $this->addColumn(new GridColumn('inReview', 'manager.reviewForms.inReview', null, null, $reviewFormGridCellProvider));
     // Review Form 'completed'.
     $this->addColumn(new GridColumn('completed', 'manager.reviewForms.completed', null, null, $reviewFormGridCellProvider));
     // Review form 'activate/deactivate'
     // if ($element->getActive()) {
     $this->addColumn(new GridColumn('active', 'common.active', null, 'controllers/grid/common/cell/selectStatusCell.tpl', $reviewFormGridCellProvider));
 }
 /**
  * @copydoc PKPHandler::initialize()
  */
 function initialize($request)
 {
     parent::initialize($request);
     // Load user-related translations.
     AppLocale::requireComponents(LOCALE_COMPONENT_PKP_USER, LOCALE_COMPONENT_PKP_MANAGER, LOCALE_COMPONENT_APP_MANAGER);
     // Basic grid configuration.
     $this->setTitle('grid.user.currentUsers');
     // Grid actions.
     $router = $request->getRouter();
     $pluginName = $request->getUserVar('pluginName');
     assert(!empty($pluginName));
     $this->_pluginName = $pluginName;
     $dispatcher = $request->getDispatcher();
     $url = $dispatcher->url($request, ROUTE_PAGE, null, 'manager', 'importexport', array('plugin', $pluginName, 'exportAllUsers'));
     $this->addAction(new LinkAction('exportAllUsers', new RedirectConfirmationModal(__('grid.users.confirmExportAllUsers'), null, $url), __('grid.action.exportAllUsers'), 'export_users'));
     //
     // Grid columns.
     //
     // First Name.
     $cellProvider = new DataObjectGridCellProvider();
     $this->addColumn(new GridColumn('firstName', 'user.firstName', null, null, $cellProvider));
     // Last Name.
     $cellProvider = new DataObjectGridCellProvider();
     $this->addColumn(new GridColumn('lastName', 'user.lastName', null, null, $cellProvider));
     // User name.
     $cellProvider = new DataObjectGridCellProvider();
     $this->addColumn(new GridColumn('username', 'user.username', null, null, $cellProvider));
     // Email.
     $cellProvider = new DataObjectGridCellProvider();
     $this->addColumn(new GridColumn('email', 'user.email', null, null, $cellProvider));
 }
 /**
  * Displays the context settings wizard.
  * @param $args array
  * @param $request Request
  * @return JSONMessage JSON object
  */
 function startWizard($args, $request)
 {
     $templateMgr = TemplateManager::getManager($request);
     AppLocale::requireComponents(LOCALE_COMPONENT_APP_MANAGER, LOCALE_COMPONENT_PKP_MANAGER);
     $this->setupTemplate($request);
     return $templateMgr->fetchJson('controllers/wizard/settings/settingsWizard.tpl');
 }
 /**
  * @copydoc SetupListbuilderHandler::initialize()
  */
 function initialize($request)
 {
     parent::initialize($request);
     AppLocale::requireComponents(LOCALE_COMPONENT_PKP_MANAGER);
     $footerCategoryId = (int) $request->getUserVar('footerCategoryId');
     $context = $request->getContext();
     $footerCategoryDao = DAORegistry::getDAO('FooterCategoryDAO');
     $footerCategory = $footerCategoryDao->getById($footerCategoryId, $context->getId());
     if ($footerCategoryId && !isset($footerCategory)) {
         fatalError('Footer Category does not exist within this context.');
     } else {
         $this->_footerCategoryId = $footerCategoryId;
     }
     // Basic configuration
     $this->setTitle('grid.content.navigation.footer.FooterLink');
     $this->setSourceType(LISTBUILDER_SOURCE_TYPE_TEXT);
     $this->setSaveType(LISTBUILDER_SAVE_TYPE_EXTERNAL);
     $this->setSaveFieldName('footerLinks');
     import('lib.pkp.controllers.listbuilder.content.navigation.FooterLinkListbuilderGridCellProvider');
     // Title column
     $titleColumn = new MultilingualListbuilderGridColumn($this, 'title', 'common.title', null, null, null, null, array('tabIndex' => 1));
     $titleColumn->setCellProvider(new FooterLinkListbuilderGridCellProvider());
     $this->addColumn($titleColumn);
     // Url column
     $urlColumn = new MultilingualListbuilderGridColumn($this, 'url', 'common.url', null, null, null, null, array('tabIndex' => 2));
     $urlColumn->setCellProvider(new FooterLinkListbuilderGridCellProvider());
     $this->addColumn($urlColumn);
 }
Example #5
0
 /**
  * Internal function to assign information for the Counter part of a report
  */
 function _assignTemplateCounterXML($templateManager, $begin, $end = '')
 {
     $journal =& Request::getJournal();
     $counterReportDao =& DAORegistry::getDAO('CounterReportDAO');
     $journalDao =& DAORegistry::getDAO('JournalDAO');
     $journalIds = $counterReportDao->getJournalIds();
     if ($end == '') {
         $end = $begin;
     }
     $i = 0;
     foreach ($journalIds as $journalId) {
         $journal =& $journalDao->getById($journalId);
         if (!$journal) {
             continue;
         }
         $entries = $counterReportDao->getMonthlyLogRange($journalId, $begin, $end);
         $journalsArray[$i]['entries'] = $this->_arrangeEntries($entries, $begin, $end);
         $journalsArray[$i]['journalTitle'] = $journal->getLocalizedTitle();
         $journalsArray[$i]['publisherInstitution'] = $journal->getSetting('publisherInstitution');
         $journalsArray[$i]['printIssn'] = $journal->getSetting('printIssn');
         $journalsArray[$i]['onlineIssn'] = $journal->getSetting('onlineIssn');
         $i++;
     }
     $siteSettingsDao =& DAORegistry::getDAO('SiteSettingsDAO');
     $siteTitle = $siteSettingsDao->getSetting('title', AppLocale::getLocale());
     $base_url =& Config::getVar('general', 'base_url');
     $reqUser =& Request::getUser();
     $templateManager->assign_by_ref('reqUser', $reqUser);
     $templateManager->assign_by_ref('journalsArray', $journalsArray);
     $templateManager->assign('siteTitle', $siteTitle);
     $templateManager->assign('base_url', $base_url);
 }
Example #6
0
 /**
  * Constructor.
  * @param $args array script arguments
  */
 function FileLoader($args)
 {
     parent::ScheduledTask($args);
     // Set an initial process id and load translations (required
     // for email notifications).
     AppLocale::requireComponents(LOCALE_COMPONENT_PKP_ADMIN);
     $this->_newProcessId();
     // Canonicalize the base path.
     $basePath = rtrim($args[0], DIRECTORY_SEPARATOR);
     $basePathFolder = basename($basePath);
     // We assume that the parent folder of the base path
     // does already exist and can be canonicalized.
     $basePathParent = realpath(dirname($basePath));
     if ($basePathParent === false) {
         $basePath = null;
     } else {
         $basePath = $basePathParent . DIRECTORY_SEPARATOR . $basePathFolder;
     }
     $this->_basePath = $basePath;
     // Configure paths.
     if (!is_null($basePath)) {
         $this->_stagePath = $basePath . DIRECTORY_SEPARATOR . FILE_LOADER_PATH_STAGING;
         $this->_archivePath = $basePath . DIRECTORY_SEPARATOR . FILE_LOADER_PATH_ARCHIVE;
         $this->_rejectPath = $basePath . DIRECTORY_SEPARATOR . FILE_LOADER_PATH_REJECT;
         $this->_processingPath = $basePath . DIRECTORY_SEPARATOR . FILE_LOADER_PATH_PROCESSING;
     }
     // Set admin email and name.
     $siteDao = DAORegistry::getDAO('SiteDAO');
     /* @var $siteDao SiteDAO */
     $site = $siteDao->getSite();
     /* @var $site Site */
     $this->_adminEmail = $site->getLocalizedContactEmail();
     $this->_adminName = $site->getLocalizedContactName();
 }
 /**
  * Return a mapping of workflow stages and its translation keys.
  * @return array
  */
 static function getWorkflowStageTranslationKeys()
 {
     $applicationStages = Application::getApplicationStages();
     AppLocale::requireComponents(LOCALE_COMPONENT_PKP_SUBMISSION, LOCALE_COMPONENT_APP_SUBMISSION);
     static $stageMapping = array(WORKFLOW_STAGE_ID_SUBMISSION => 'submission.submission', WORKFLOW_STAGE_ID_INTERNAL_REVIEW => 'workflow.review.internalReview', WORKFLOW_STAGE_ID_EXTERNAL_REVIEW => 'workflow.review.externalReview', WORKFLOW_STAGE_ID_EDITING => 'submission.editorial', WORKFLOW_STAGE_ID_PRODUCTION => 'submission.production');
     return array_intersect_key($stageMapping, array_flip($applicationStages));
 }
 /**
  * Handle a cache miss
  * @param $cache GenericCache
  * @param $id mixed ID that wasn't found in the cache
  * @return null
  */
 function _cacheMiss($cache, $id)
 {
     $allCodelistItems =& Registry::get('all' . $this->getName() . 'CodelistItems', true, null);
     if ($allCodelistItems === null) {
         // Add a locale load to the debug notes.
         $notes =& Registry::get('system.debug.notes');
         $locale = $cache->cacheId;
         if ($locale == null) {
             $locale = AppLocale::getLocale();
         }
         $filename = $this->getFilename($locale);
         $notes[] = array('debug.notes.codelistItemListLoad', array('filename' => $filename));
         // Reload locale registry file
         $xmlDao = new XMLDAO();
         $nodeName = $this->getName();
         // i.e., subject
         $data = $xmlDao->parseStruct($filename, array($nodeName));
         // Build array with ($charKey => array(stuff))
         if (isset($data[$nodeName])) {
             foreach ($data[$nodeName] as $codelistData) {
                 $allCodelistItems[$codelistData['attributes']['code']] = array($codelistData['attributes']['text']);
             }
         }
         if (is_array($allCodelistItems)) {
             asort($allCodelistItems);
         }
         $cache->setEntireCache($allCodelistItems);
     }
     return null;
 }
 function sendReminder($subscription, $journal, $emailKey)
 {
     $userDao = DAORegistry::getDAO('UserDAO');
     $subscriptionTypeDao = DAORegistry::getDAO('SubscriptionTypeDAO');
     $journalName = $journal->getLocalizedName();
     $user = $userDao->getById($subscription->getUserId());
     if (!isset($user)) {
         return false;
     }
     $subscriptionType = $subscriptionTypeDao->getSubscriptionType($subscription->getTypeId());
     $subscriptionName = $journal->getSetting('subscriptionName');
     $subscriptionEmail = $journal->getSetting('subscriptionEmail');
     $subscriptionPhone = $journal->getSetting('subscriptionPhone');
     $subscriptionMailingAddress = $journal->getSetting('subscriptionMailingAddress');
     $subscriptionContactSignature = $subscriptionName;
     AppLocale::requireComponents(LOCALE_COMPONENT_PKP_USER, LOCALE_COMPONENT_APP_COMMON);
     if ($subscriptionMailingAddress != '') {
         $subscriptionContactSignature .= "\n" . $subscriptionMailingAddress;
     }
     if ($subscriptionPhone != '') {
         $subscriptionContactSignature .= "\n" . AppLocale::Translate('user.phone') . ': ' . $subscriptionPhone;
     }
     $subscriptionContactSignature .= "\n" . AppLocale::Translate('user.email') . ': ' . $subscriptionEmail;
     $paramArray = array('subscriberName' => $user->getFullName(), 'journalName' => $journalName, 'subscriptionType' => $subscriptionType->getSummaryString(), 'expiryDate' => $subscription->getDateEnd(), 'username' => $user->getUsername(), 'subscriptionContactSignature' => $subscriptionContactSignature);
     import('lib.pkp.classes.mail.MailTemplate');
     $mail = new MailTemplate($emailKey, $journal->getPrimaryLocale(), $journal, false);
     $mail->setReplyTo($subscriptionEmail, $subscriptionName);
     $mail->addRecipient($user->getEmail(), $user->getFullName());
     $mail->setSubject($mail->getSubject($journal->getPrimaryLocale()));
     $mail->setBody($mail->getBody($journal->getPrimaryLocale()));
     $mail->assignParams($paramArray);
     $mail->send();
 }
 /**
  * Retrieve subscription type name by ID.
  * @param $typeId int
  * @return string
  */
 function getSubscriptionTypeName($typeId)
 {
     $result = $this->retrieve('SELECT COALESCE(l.setting_value, p.setting_value) FROM subscription_type_settings l LEFT JOIN subscription_type_settings p ON (p.type_id = ? AND p.setting_name = ? AND p.locale = ?) WHERE l.type_id = ? AND l.setting_name = ? AND l.locale = ?', array($typeId, 'name', AppLocale::getLocale(), $typeId, 'name', AppLocale::getPrimaryLocale()));
     $returner = isset($result->fields[0]) ? $result->fields[0] : false;
     $result->Close();
     return $returner;
 }
Example #11
0
 /**
  * Fetch the form.
  */
 function fetch($request)
 {
     $templateMgr = TemplateManager::getManager($request);
     $journal = $request->getJournal();
     // set up the accessibility options pulldown
     $templateMgr->assign('enableDelayedOpenAccess', $journal->getSetting('enableDelayedOpenAccess'));
     $templateMgr->assign('accessOptions', array(ISSUE_ACCESS_OPEN => AppLocale::Translate('editor.issues.openAccess'), ISSUE_ACCESS_SUBSCRIPTION => AppLocale::Translate('editor.issues.subscription')));
     if ($this->issue) {
         $templateMgr->assign('issue', $this->issue);
         $templateMgr->assign('issueId', $this->issue->getId());
     }
     // Cover image preview
     $coverImage = null;
     if ($this->issue) {
         $coverImage = $this->issue->getCoverImage();
     }
     // Cover image delete link action
     if ($coverImage) {
         import('lib.pkp.classes.linkAction.LinkAction');
         import('lib.pkp.classes.linkAction.request.RemoteActionConfirmationModal');
         $router = $request->getRouter();
         $deleteCoverImageLinkAction = new LinkAction('deleteCoverImage', new RemoteActionConfirmationModal($request->getSession(), __('common.confirmDelete'), null, $router->url($request, null, null, 'deleteCoverImage', null, array('coverImage' => $coverImage, 'issueId' => $this->issue->getId())), 'modal_delete'), __('common.delete'), null);
         $templateMgr->assign('deleteCoverImageLinkAction', $deleteCoverImageLinkAction);
     }
     return parent::fetch($request);
 }
Example #12
0
 /**
  * @see Filter::process()
  */
 function &process(&$input)
 {
     // Initialize view
     $locale = AppLocale::getLocale();
     $application = PKPApplication::getApplication();
     $request = $application->getRequest();
     $templateMgr = TemplateManager::getManager($request);
     // Add the filter's directory as additional template dir so that
     // templates can include sub-templates in the same folder.
     array_unshift($templateMgr->template_dir, $this->getBasePath());
     // Give sub-filters a chance to add their variables
     // to the template.
     $this->addTemplateVars($templateMgr, $input, $request, $locale);
     // Use a base path hash as compile id to make sure that we don't
     // get namespace problems if several filters use the same
     // template names.
     $previousCompileId = $templateMgr->compile_id;
     $templateMgr->compile_id = md5($this->getBasePath());
     // Let the template engine render the citation.
     $output = $templateMgr->fetch($this->getTemplateName());
     // Remove the additional template dir
     array_shift($templateMgr->template_dir);
     // Restore the compile id.
     $templateMgr->compile_id = $previousCompileId;
     return $output;
 }
 /**
  * @copydoc ContextSettingsForm::fetch
  */
 function fetch($request, $params = null)
 {
     $templateMgr = TemplateManager::getManager($request);
     AppLocale::requireComponents(LOCALE_COMPONENT_PKP_SUBMISSION);
     $templateMgr->assign('ccLicenseOptions', array_merge(array('' => 'common.other'), Application::getCCLicenseOptions()));
     return parent::fetch($request, $params);
 }
 /**
  * Check to make sure form conditions are met
  */
 function validate()
 {
     // Ensure all submission types have names in the primary locale
     // as well as numeric word limits (optional)
     $primaryLocale = AppLocale::getPrimaryLocale();
     if (isset($this->_data['paperTypes'])) {
         $paperTypes =& $this->_data['paperTypes'];
         if (!is_array($paperTypes)) {
             return false;
         }
         foreach ($paperTypes as $paperTypeId => $paperType) {
             if (!isset($paperType['name'][$primaryLocale]) || empty($paperType['name'][$primaryLocale])) {
                 $fieldName = 'paperTypeName-' . $paperTypeId;
                 $this->addError($fieldName, __('manager.schedConfSetup.submissions.typeOfSubmission.nameMissing', array('primaryLocale' => $primaryLocale)));
                 $this->addErrorField($fieldName);
             }
             if (isset($paperType['abstractLength']) && !empty($paperType['abstractLength']) && (!is_numeric($paperType['abstractLength']) || $paperType['abstractLength'] <= 0)) {
                 $fieldName = 'paperTypeAbstractLength-' . $paperTypeId;
                 $this->addError($fieldName, __('manager.schedConfSetup.submissions.typeOfSubmission.abstractLengthInvalid'));
                 $this->addErrorField($fieldName);
             }
         }
     }
     return parent::validate();
 }
Example #15
0
 /**
  * Get a piece of data for this object, localized to the current
  * locale if possible.
  * @param $key string
  * @param $preferredLocale string
  * @return mixed
  */
 function &getLocalizedData($key, $preferredLocale = null)
 {
     if (is_null($preferredLocale)) {
         $preferredLocale = AppLocale::getLocale();
     }
     $localePrecedence = array($preferredLocale, $this->getLocale());
     foreach ($localePrecedence as $locale) {
         if (empty($locale)) {
             continue;
         }
         $value =& $this->getData($key, $locale);
         if (!empty($value)) {
             return $value;
         }
         unset($value);
     }
     // Fallback: Get the first available piece of data.
     $data =& $this->getData($key, null);
     if (!empty($data)) {
         return $data[array_shift(array_keys($data))];
     }
     // No data available; return null.
     unset($data);
     $data = null;
     return $data;
 }
 /**
  * Get the filename of the qualifier database
  * @param $locale string
  * @return string
  */
 function getFilename($locale)
 {
     if (!AppLocale::isLocaleValid($locale)) {
         $locale = AppLocale::MASTER_LOCALE;
     }
     return "lib/pkp/locale/{$locale}/bic21qualifiers.xml";
 }
 /**
  * Constructor
  * @param $request Request
  * @param $submissionId int the ID of the submission to present link for
  * to show information about.
  */
 function SubmissionLibraryLinkAction($request, $submissionId)
 {
     $dispatcher = $request->getDispatcher();
     AppLocale::requireComponents(LOCALE_COMPONENT_PKP_EDITOR);
     import('lib.pkp.classes.linkAction.request.AjaxModal');
     parent::LinkAction('editorialHistory', new AjaxModal($dispatcher->url($request, ROUTE_COMPONENT, null, 'modals.documentLibrary.DocumentLibraryHandler', 'documentLibrary', null, array('submissionId' => $submissionId)), __('editor.submissionLibrary'), 'modal_information'), __('editor.submissionLibrary'), 'more_info');
 }
Example #18
0
 /**
  * @copydoc PKPHandler::initialize()
  */
 function initialize($request)
 {
     parent::initialize($request);
     $context = $request->getContext();
     $this->_contextId = $context->getId();
     // Load user-related translations.
     AppLocale::requireComponents(LOCALE_COMPONENT_PKP_USER, LOCALE_COMPONENT_PKP_MANAGER, LOCALE_COMPONENT_APP_MANAGER, LOCALE_COMPONENT_PKP_SUBMISSION);
     // Basic grid configuration.
     $this->setTitle('grid.roles.currentRoles');
     // Add grid-level actions.
     $router = $request->getRouter();
     $this->addAction(new LinkAction('addUserGroup', new AjaxModal($router->url($request, null, null, 'addUserGroup'), __('grid.roles.add'), 'modal_add_role'), __('grid.roles.add'), 'add_role'));
     import('lib.pkp.controllers.grid.settings.roles.UserGroupGridCellProvider');
     $cellProvider = new UserGroupGridCellProvider();
     $workflowStagesLocales = WorkflowStageDAO::getWorkflowStageTranslationKeys();
     // Set array containing the columns info with the same cell provider.
     $columnsInfo = array(1 => array('id' => 'name', 'title' => 'settings.roles.roleName', 'template' => null), 2 => array('id' => 'abbrev', 'title' => 'settings.roles.roleAbbrev', 'template' => null));
     foreach ($workflowStagesLocales as $stageId => $stageTitleKey) {
         $columnsInfo[] = array('id' => $stageId, 'title' => $stageTitleKey, 'template' => 'controllers/grid/common/cell/selectStatusCell.tpl');
     }
     // Add array columns to the grid.
     foreach ($columnsInfo as $columnInfo) {
         $this->addColumn(new GridColumn($columnInfo['id'], $columnInfo['title'], null, $columnInfo['template'], $cellProvider));
     }
 }
Example #19
0
 /**
  * Execute the command
  */
 function execute()
 {
     $stderr = fopen('php://stdout', 'w');
     $locales = AppLocale::getAllLocales();
     $dbConn = DBConnection::getConn();
     foreach ($locales as $locale => $localeName) {
         fprintf($stderr, "Checking {$localeName}...\n");
         $oldTemplatesText = $this->fetchFileVersion('ojs', "locale/{$locale}/emailTemplates.xml", $this->oldTag);
         $newTemplatesText = $this->fetchFileVersion('ojs', "locale/{$locale}/emailTemplates.xml", $this->newTag);
         if ($oldTemplatesText === false || $newTemplatesText === false) {
             fprintf($stderr, "Skipping {$localeName}; could not fetch.\n");
             continue;
         }
         $oldEmails = $this->parseEmails($oldTemplatesText);
         $newEmails = $this->parseEmails($newTemplatesText);
         foreach ($oldEmails['email_text'] as $oi => $junk) {
             $key = $junk['attributes']['key'];
             $ni = null;
             foreach ($newEmails['email_text'] as $ni => $junk) {
                 if ($key == $junk['attributes']['key']) {
                     break;
                 }
             }
             if ($oldEmails['subject'][$oi]['value'] != $newEmails['subject'][$ni]['value']) {
                 echo "UPDATE email_templates_default_data SET subject='" . $dbConn->escape($newEmails['subject'][$ni]['value']) . "' WHERE key='" . $dbConn->escape($key) . "' AND locale='" . $dbConn->escape($locale) . "' AND subject='" . $dbConn->escape($oldEmails['subject'][$oi]['value']) . "';\n";
             }
             if ($oldEmails['body'][$oi]['value'] != $newEmails['body'][$ni]['value']) {
                 echo "UPDATE email_templates_default_data SET body='" . $dbConn->escape($newEmails['body'][$ni]['value']) . "' WHERE key='" . $dbConn->escape($key) . "' AND locale='" . $dbConn->escape($locale) . "' AND body='" . $dbConn->escape($oldEmails['body'][$oi]['value']) . "';\n";
             }
         }
     }
     fclose($stderr);
 }
Example #20
0
 /**
  * Fetch the modal contents for the monograph selection form
  * @param $args array
  * @param $request PKPRequest
  * @return JSONMessage JSON object
  */
 function fetch($args, $request)
 {
     $templateMgr = TemplateManager::getManager($request);
     AppLocale::requireComponents(LOCALE_COMPONENT_APP_SUBMISSION);
     // submission.select
     return new JSONMessage(true, $templateMgr->fetch('controllers/modals/submissionMetadata/selectMonograph.tpl'));
 }
 /**
  * @see DOIExportPlugin::generateExportFiles()
  */
 function generateExportFiles($request, $exportType, &$objects, $targetPath, $journal, &$errors)
 {
     // Additional locale file.
     AppLocale::requireComponents(array(LOCALE_COMPONENT_APP_EDITOR));
     // Export objects one by one (DataCite does not allow
     // multiple objects per file).
     $this->import('classes.DataciteExportDom');
     $exportFiles = array();
     foreach ($objects as $object) {
         // Generate the export XML.
         $dom = new DataciteExportDom($request, $this, $journal, $this->getCache());
         $doc =& $dom->generate($object);
         if ($doc === false) {
             $this->cleanTmpfiles($targetPath, array_keys($exportFiles));
             $errors =& $dom->getErrors();
             return false;
         }
         // Write the result.
         $exportFile = $this->getTargetFileName($targetPath, $exportType, $object->getId());
         file_put_contents($exportFile, XMLCustomWriter::getXML($doc));
         $fileManager = new FileManager();
         $fileManager->setMode($exportFile, FILE_MODE_MASK);
         $exportFiles[$exportFile] = array(&$object);
         unset($object);
     }
     return $exportFiles;
 }
 function initialize($request)
 {
     parent::initialize($request);
     // Add locale keys
     AppLocale::requireComponents(LOCALE_COMPONENT_APP_SUBMISSION, LOCALE_COMPONENT_PKP_SUBMISSION);
     // Basic configuration
     $this->setTitle('submission.submit.addAuthor');
     $this->setSourceType(LISTBUILDER_SOURCE_TYPE_SELECT);
     $this->setSaveType(LISTBUILDER_SAVE_TYPE_EXTERNAL);
     $this->setSaveFieldName('authors');
     // Fetch and authorize chapter
     $chapterDao = DAORegistry::getDAO('ChapterDAO');
     $monograph = $this->getMonograph();
     $chapter = $chapterDao->getChapter($request->getUserVar('chapterId'), $monograph->getId());
     if ($chapter) {
         // This is an existing chapter
         $this->setChapterId($chapter->getId());
     } else {
         // This is a new chapter
         $this->setChapterId(null);
     }
     // Name column
     $nameColumn = new ListbuilderGridColumn($this, 'name', 'common.name');
     // We can reuse the User cell provider because getFullName
     import('lib.pkp.controllers.listbuilder.users.UserListbuilderGridCellProvider');
     $nameColumn->setCellProvider(new UserListbuilderGridCellProvider());
     $this->addColumn($nameColumn);
 }
Example #23
0
 /**
  * Displays the issue listings in a tabbed interface.
  * @param $args array
  * @param $request PKPRequest
  */
 function index($args, $request)
 {
     $this->setupTemplate($request);
     AppLocale::requireComponents(LOCALE_COMPONENT_APP_EDITOR);
     $templateMgr = TemplateManager::getManager($request);
     $templateMgr->display('manageIssues/issues.tpl');
 }
Example #24
0
 /**
  * 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();
     AppLocale::requireComponents(LOCALE_COMPONENT_PKP_ADMIN, LOCALE_COMPONENT_OJS_ADMIN, LOCALE_COMPONENT_OJS_MANAGER);
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->assign('pageHierarchy', $subclass ? array(array(Request::url(null, 'user'), 'navigation.user'), array(Request::url(null, 'admin'), 'admin.siteAdmin')) : array(array(Request::url(null, 'user'), 'navigation.user')));
 }
Example #25
0
 function _cacheMiss($cache, $id)
 {
     $allLanguages =& Registry::get('allLanguages-' . $cache->cacheId, true, null);
     if ($allLanguages === null) {
         // Add a locale load to the debug notes.
         $notes =& Registry::get('system.debug.notes');
         $locale = $cache->cacheId;
         if ($locale == null) {
             $locale = AppLocale::getLocale();
         }
         $filename = $this->getLanguageFilename($locale);
         $notes[] = array('debug.notes.languageListLoad', array('filename' => $filename));
         // Reload locale registry file
         $xmlDao = new XMLDAO();
         $data = $xmlDao->parseStruct($filename, array('language'));
         // Build array with ($charKey => array(stuff))
         if (isset($data['language'])) {
             foreach ($data['language'] as $languageData) {
                 $allLanguages[$languageData['attributes']['code']] = array($languageData['attributes']['name']);
             }
         }
         if (is_array($allLanguages)) {
             asort($allLanguages);
         }
         $cache->setEntireCache($allLanguages);
     }
     if (isset($allLanguages[$id])) {
         return $allLanguages[$id];
     } else {
         return null;
     }
 }
 /**
  * Display the publication format template (grid + actions).
  * @param $args array
  * @param $request PKPRequest
  * @return JSONMessage JSON object
  */
 function fetchRepresentation($args, $request)
 {
     AppLocale::requireComponents(LOCALE_COMPONENT_PKP_SUBMISSION, LOCALE_COMPONENT_APP_SUBMISSION, LOCALE_COMPONENT_APP_EDITOR);
     $templateMgr = TemplateManager::getManager($request);
     $templateMgr->assign(array('submission' => $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION), 'stageId' => $this->getAuthorizedContextObject(ASSOC_TYPE_WORKFLOW_STAGE), 'representation' => $this->getAuthorizedContextObject(ASSOC_TYPE_REPRESENTATION)));
     return $templateMgr->fetchJson('controllers/tab/workflow/publicationFormat.tpl');
 }
Example #27
0
 /**
  * Fetch
  * @param $request PKPRequest
  * @see Form::fetch()
  */
 function fetch($request)
 {
     $templateMgr = TemplateManager::getManager($request);
     $templateMgr->assign('submissionFileCategories', array(GENRE_CATEGORY_DOCUMENT => __('submission.document'), GENRE_CATEGORY_ARTWORK => __('submission.art'), GENRE_CATEGORY_SUPPLEMENTARY => __('submission.supplementary')));
     AppLocale::requireComponents(LOCALE_COMPONENT_APP_MANAGER);
     return parent::fetch($request);
 }
Example #28
0
 /**
  * Display this galley in some manner.
  *
  * @param $publishedMonograph PublishedMonograph
  * @param $submissionFile SubmissionFile
  */
 function displaySubmissionFile($publishedMonograph, $publicationFormat, $submissionFile)
 {
     $templateMgr = TemplateManager::getManager($this->getRequest());
     $templateFilename = $this->getTemplateFilename();
     if ($templateFilename === null) {
         return '';
     }
     // Set up the viewable file template variables.
     $submissionKeywordDao = DAORegistry::getDAO('SubmissionKeywordDAO');
     $chapterDao = DAORegistry::getDAO('ChapterDAO');
     $genreDao = DAORegistry::getDAO('GenreDAO');
     // Find a good candidate for a publication date
     $publicationDateDao = DAORegistry::getDAO('PublicationDateDAO');
     $publicationDates = $publicationDateDao->getByPublicationFormatId($publicationFormat->getId());
     $bestPublicationDate = null;
     while ($publicationDate = $publicationDates->next()) {
         // 11: Date of first publication; 01: Publication date
         if ($publicationDate->getRole() != '11' && $publicationDate->getRole() != '01') {
             continue;
         }
         if ($bestPublicationDate) {
             $bestPublicationDate = min($bestPublicationDate, $publicationDate->getUnixTime());
         } else {
             $bestPublicationDate = $publicationDate->getUnixTime();
         }
     }
     $templateMgr->assign(array('submissionKeywords' => $submissionKeywordDao->getKeywords($publishedMonograph->getId(), array_merge(array(AppLocale::getLocale()), array_keys(AppLocale::getSupportedLocales()))), 'publishedMonograph' => $publishedMonograph, 'publicationFormat' => $publicationFormat, 'submissionFile' => $submissionFile, 'chapter' => $chapterDao->getChapter($submissionFile->getData('chapterId')), 'genre' => $genreDao->getById($submissionFile->getGenreId()), 'bestPublicationDate' => $bestPublicationDate));
     // Fetch the viewable file template render.
     $templateMgr->assign('viewableFileContent', $templateMgr->fetch($this->getTemplatePath() . $templateFilename));
     // Show the front-end.
     $templateMgr->display('frontend/pages/viewFile.tpl');
 }
Example #29
0
 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;
     }
 }
 /**
  * @see PKPStatisticsHelper::getReportObjectTypesArray()
  */
 protected function getReportObjectTypesArray()
 {
     $objectTypes = parent::getReportObjectTypesArray();
     AppLocale::requireComponents(LOCALE_COMPONENT_APP_EDITOR);
     $objectTypes = $objectTypes + array(ASSOC_TYPE_JOURNAL => __('context.context'), ASSOC_TYPE_SECTION => __('section.section'), ASSOC_TYPE_ISSUE => __('issue.issue'), ASSOC_TYPE_ISSUE_GALLEY => __('editor.issues.galley'), ASSOC_TYPE_ARTICLE => __('article.article'), ASSOC_TYPE_SUBMISSION_FILE => __('submission.galleyFiles'));
     return $objectTypes;
 }