/**
     * Get all authors for a given chapter.
     * @param $chapterId int
     * @param $monographId int
     * @return DAOResultFactory
     */
    function &getAuthors($monographId = null, $chapterId = null)
    {
        $params = array('affiliation', Locale::getPrimaryLocale(), 'affiliation', Locale::getLocale());
        if (isset($monographId)) {
            $params[] = (int) $monographId;
        }
        if (isset($chapterId)) {
            $params[] = (int) $chapterId;
        }
        // get all the monograph_author fields,
        // but replace the primary_contact and seq with monograph_chapter_authors.primary_contact
        $sql = 'SELECT	ma.author_id,
				ma.submission_id,
				mca.chapter_id,
				mca.primary_contact,
				mca.seq,
				ma.first_name,
				ma.middle_name,
				ma.last_name,
				asl.setting_value AS affiliation_l,
				asl.locale,
				aspl.setting_value AS affiliation_pl,
				aspl.locale AS primary_locale,
				ma.country,
				ma.email,
				ma.url,
				ma.user_group_id
			FROM	authors ma
				JOIN monograph_chapter_authors mca ON (ma.author_id = mca.author_id)
				LEFT JOIN author_settings aspl ON (mca.author_id = aspl.author_id AND aspl.setting_name = ? AND aspl.locale = ?)
				LEFT JOIN author_settings asl ON (mca.author_id = asl.author_id AND asl.setting_name = ? AND asl.locale = ?)' . (count($params) > 0 ? ' WHERE' : '') . (isset($monographId) ? ' ma.submission_id = ?' : '') . (isset($monographId) && isset($chapterId) ? ' AND' : '') . (isset($chapterId) ? ' mca.chapter_id = ?' : '') . ' ORDER BY mca.chapter_id, mca.seq';
        $result =& $this->retrieve($sql, $params);
        $returner = new DAOResultFactory($result, $this, '_returnFromRow', array('id'));
        return $returner;
    }
 /**
  * @see Filter::process()
  * @param $input MetadataDescription NLM citation description
  * @return string formatted citation output
  */
 function &process(&$input)
 {
     // Initialize view
     $locale = Locale::getLocale();
     $templateMgr =& TemplateManager::getManager($this->_request);
     // Add the filter's directory as additional template dir so that
     // citation output format templates can include sub-templates in
     // the same folder.
     $templateMgr->template_dir[] = $this->getBasePath();
     // Loop over the statements in the schema and add them
     // to the template
     $propertyNames =& $input->getPropertyNames();
     foreach ($propertyNames as $propertyName) {
         $templateVariable = $input->getNamespacedPropertyId($propertyName);
         if ($input->hasProperty($propertyName)) {
             $propertyLocale = $input->getProperty($propertyName)->getTranslated() ? $locale : null;
             $templateMgr->assign_by_ref($templateVariable, $input->getStatement($propertyName, $propertyLocale));
         } else {
             // Delete potential leftovers from previous calls
             $templateMgr->clear_assign($templateVariable);
         }
     }
     // Let the template engine render the citation
     $templateName = $this->_getCitationTemplate();
     $output = $templateMgr->fetch($templateName);
     // Remove the additional template dir
     array_pop($templateMgr->template_dir);
     return $output;
 }
Beispiel #3
0
 /**
  * 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');
 }
 /**
  * @see Filter::process()
  */
 function &process(&$input)
 {
     // Initialize view
     $locale = Locale::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;
 }
 function register($category, $path)
 {
     if (parent::register($category, $path)) {
         $this->addLocaleData();
         if ($this->getEnabled()) {
             // Add custom locale data for already registered locale files.
             $locale = Locale::getLocale();
             $localeFiles = Locale::getLocaleFiles($locale);
             $journal = Request::getJournal();
             $journalId = $journal->getId();
             $publicFilesDir = Config::getVar('files', 'public_files_dir');
             $customLocalePathBase = $publicFilesDir . DIRECTORY_SEPARATOR . 'journals' . DIRECTORY_SEPARATOR . $journalId . DIRECTORY_SEPARATOR . CUSTOM_LOCALE_DIR . DIRECTORY_SEPARATOR . $locale . DIRECTORY_SEPARATOR;
             import('file.FileManager');
             foreach ($localeFiles as $localeFile) {
                 $customLocalePath = $customLocalePathBase . $localeFile->getFilename();
                 if (FileManager::fileExists($customLocalePath)) {
                     Locale::registerLocaleFile($locale, $customLocalePath, true);
                 }
             }
             // Add custom locale data for all locale files registered after this plugin
             HookRegistry::register('PKPLocale::registerLocaleFile', array(&$this, 'addCustomLocale'));
         }
         return true;
     }
     return false;
 }
Beispiel #6
0
 /**
  * Save group group.
  * @see Form::execute()
  */
 function execute()
 {
     $groupDao =& DAORegistry::getDAO('GroupDAO');
     $press =& Request::getPress();
     if (!isset($this->group)) {
         $this->group = $groupDao->newDataObject();
     }
     $this->group->setAssocType(ASSOC_TYPE_PRESS);
     $this->group->setAssocId($press->getId());
     $this->group->setTitle($this->getData('title'), Locale::getLocale());
     // Localized
     $this->group->setContext($this->getData('context'));
     // Eventually this will be a general Groups feature; for now,
     // we're just using it to display press team entries in About.
     $this->group->setAboutDisplayed(true);
     // Update or insert group group
     if ($this->group->getId() != null) {
         $groupDao->updateObject($this->group);
     } else {
         $this->group->setSequence(REALLY_BIG_NUMBER);
         $groupDao->insertGroup($this->group);
         // Re-order the groups so the new one is at the end of the list.
         $groupDao->resequenceGroups($this->group->getAssocType(), $this->group->getAssocId());
     }
     return true;
 }
 function initialize(&$request)
 {
     parent::initialize($request);
     // Basic grid configuration
     $this->setId('preparedEmailsGrid');
     $this->setTitle('grid.preparedEmails.currentList');
     Locale::requireComponents(array(LOCALE_COMPONENT_PKP_MANAGER));
     // Elements to be displayed in the grid
     $press =& $request->getPress();
     $emailTemplateDao =& DAORegistry::getDAO('EmailTemplateDAO');
     /* @var $emailTemplateDao EmailTemplateDAO */
     $emailTemplates =& $emailTemplateDao->getEmailTemplates(Locale::getLocale(), $press->getId());
     $rowData = array();
     foreach ($emailTemplates as $emailTemplate) {
         $rowData[$emailTemplate->getEmailKey()] = $emailTemplate;
     }
     $this->setGridDataElements($rowData);
     // Grid actions
     import('lib.pkp.classes.linkAction.LinkAction');
     import('lib.pkp.classes.linkAction.request.ConfirmationModal');
     $router =& $request->getRouter();
     $this->addAction(new LinkAction('resetAll', new ConfirmationModal(__('manager.emails.resetAll.message'), null, $router->url($request, null, 'grid.settings.preparedEmails.PreparedEmailsGridHandler', 'resetAllEmails')), __('manager.emails.resetAll'), 'delete'));
     import('controllers.grid.settings.preparedEmails.linkAction.EditEmailLinkAction');
     $addEmailLinkAction =& new EditEmailLinkAction($request);
     $this->addAction($addEmailLinkAction);
     // Columns
     import('controllers.grid.settings.preparedEmails.PreparedEmailsGridCellProvider');
     $cellProvider =& new PreparedEmailsGridCellProvider();
     $this->addColumn(new GridColumn('name', 'common.name', null, 'controllers/grid/gridCell.tpl', $cellProvider));
     $this->addColumn(new GridColumn('sender', 'email.sender', null, 'controllers/grid/gridCell.tpl', $cellProvider));
     $this->addColumn(new GridColumn('recipient', 'email.recipient', null, 'controllers/grid/gridCell.tpl', $cellProvider));
     $this->addColumn(new GridColumn('subject', 'common.subject', null, 'controllers/grid/gridCell.tpl', $cellProvider));
     $this->addColumn(new GridColumn('enabled', 'common.enabled', null, 'controllers/grid/common/cell/checkMarkCell.tpl', $cellProvider));
 }
Beispiel #8
0
 function displayPaymentForm($queuedPaymentId, &$queuedPayment)
 {
     if (!$this->isConfigured()) {
         return false;
     }
     $schedConf =& Request::getSchedConf();
     $user =& Request::getUser();
     $params = array('business' => $this->getSetting($schedConf->getConferenceId(), $schedConf->getId(), 'selleraccount'), 'item_name' => $queuedPayment->getDescription(), 'amount' => $queuedPayment->getAmount(), 'quantity' => 1, 'no_note' => 1, 'no_shipping' => 1, 'currency_code' => $queuedPayment->getCurrencyCode(), 'lc' => String::substr(Locale::getLocale(), 3), 'custom' => $queuedPaymentId, 'notify_url' => Request::url(null, null, 'payment', 'plugin', array($this->getName(), 'ipn')), 'return' => $queuedPayment->getRequestUrl(), 'cancel_return' => Request::url(null, null, 'payment', 'plugin', array($this->getName(), 'cancel')), 'first_name' => $user ? $user->getFirstName() : '', 'last_name' => $user ? $user->getLastname() : '', 'item_number' => 1, 'cmd' => '_xclick');
     $templateMgr =& TemplateManager::getManager();
     switch ($queuedPayment->getType()) {
         case QUEUED_PAYMENT_TYPE_REGISTRATION:
             // Provide registration-specific details to template.
             $registrationDao =& DAORegistry::getDAO('RegistrationDAO');
             $registrationOptionDao =& DAORegistry::getDAO('RegistrationOptionDAO');
             $registrationTypeDao =& DAORegistry::getDAO('RegistrationTypeDAO');
             $registration =& $registrationDao->getRegistration($queuedPayment->getAssocId());
             if (!$registration || $registration->getUserId() != $queuedPayment->getUserId() || $registration->getSchedConfId() != $queuedPayment->getSchedConfId()) {
                 break;
             }
             $registrationOptionIterator =& $registrationOptionDao->getRegistrationOptionsBySchedConfId($schedConf->getId());
             $registrationOptionCosts = $registrationTypeDao->getRegistrationOptionCosts($registration->getTypeId());
             $registrationOptionIds = $registrationOptionDao->getRegistrationOptions($registration->getRegistrationId());
             $templateMgr->assign('registration', $registration);
             $templateMgr->assign('registrationType', $registrationTypeDao->getRegistrationType($registration->getTypeId()));
             $templateMgr->assign('registrationOptions', $registrationOptionIterator->toArray());
             $templateMgr->assign('registrationOptionCosts', $registrationOptionCosts);
             $templateMgr->assign('registrationOptionIds', $registrationOptionIds);
     }
     $templateMgr->assign('params', $params);
     $templateMgr->assign('paypalFormUrl', $this->getSetting($schedConf->getConferenceId(), $schedConf->getId(), 'paypalurl'));
     $templateMgr->display($this->getTemplatePath() . 'paymentForm.tpl');
 }
 /**
  * Extracts variables for a given column from a data element
  * so that they may be assigned to template before rendering.
  * @param $element mixed
  * @param $columnId string
  * @return array
  */
 function getTemplateVarsFromRowColumn(&$row, $column)
 {
     $element =& $row->getData();
     $columnId = $column->getId();
     assert(is_a($element, 'DataObject') && !empty($columnId));
     $roleDao =& DAORegistry::getDAO('RoleDAO');
     /* @var $roleDao RoleDAO */
     switch ($columnId) {
         case 'name':
             $label = $element->getEmailKey();
             return array('label' => str_replace('_', ' ', $label));
         case 'sender':
             $roleId = $element->getFromRoleId();
             $label = $roleDao->getRoleNames(false, array($roleId));
             return array('label' => Locale::translate(array_shift($label)));
         case 'recipient':
             $roleId = $element->getToRoleId();
             $label = $roleDao->getRoleNames(false, array($roleId));
             return array('label' => Locale::translate(array_shift($label)));
         case 'subject':
             $locale = Locale::getLocale();
             $label = $element->getSubject();
             return array('label' => $label);
         case 'enabled':
             return array('isChecked' => $element->getEnabled());
     }
 }
 function addItem($args, &$request)
 {
     $this->setupTemplate();
     $pressSettingsDao =& DAORegistry::getDAO('PressSettingsDAO');
     $divisionDao =& DAORegistry::getDAO('DivisionDAO');
     $press =& $request->getPress();
     $index = 'sourceTitle-' . $this->getId();
     $divisionTitle = $args[$index];
     if (!isset($divisionTitle)) {
         $json = new JSON('false');
         return $json->getString();
     } else {
         // Make sure the item doesn't already exist
         $divisions = $divisionDao->getByTitle($divisionTitle, $press->getId());
         if (isset($divisions)) {
             $json = new JSON('false', Locale::translate('common.listbuilder.itemExists'));
             return $json->getString();
             return false;
         }
         $division =& $divisionDao->newDataObject();
         $division->setTitle($divisionTitle, Locale::getLocale());
         //FIXME: Get locale from form
         $division->setPressId($press->getId());
         $divisionId = $divisionDao->insertObject($division);
         // Return JSON with formatted HTML to insert into list
         $row =& $this->getRowInstance();
         $row->setGridId($this->getId());
         $row->setId($divisionId);
         $rowData = array('item' => $divisionTitle);
         $row->setData($rowData);
         $row->initialize($request);
         $json = new JSON('true', $this->_renderRowInternally($request, $row));
         return $json->getString();
     }
 }
 /**
  * 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->getJournal($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', Locale::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);
 }
 /**
  * Public view book for review details.
  */
 function viewBookForReview($args = array(), &$request)
 {
     $this->setupTemplate(true);
     $journal =& $request->getJournal();
     $journalId = $journal->getId();
     $bfrPlugin =& PluginRegistry::getPlugin('generic', BOOKS_FOR_REVIEW_PLUGIN_NAME);
     $bookId = !isset($args) || empty($args) ? null : (int) $args[0];
     $bfrDao =& DAORegistry::getDAO('BookForReviewDAO');
     // Ensure book for review is valid and for this journal
     if ($bfrDao->getBookForReviewJournalId($bookId) == $journalId) {
         $book =& $bfrDao->getBookForReview($bookId);
         $bfrPlugin->import('classes.BookForReview');
         // Ensure book is still available
         if ($book->getStatus() == BFR_STATUS_AVAILABLE) {
             $isAuthor = Validation::isAuthor();
             import('classes.file.PublicFileManager');
             $publicFileManager = new PublicFileManager();
             $coverPagePath = $request->getBaseUrl() . '/';
             $coverPagePath .= $publicFileManager->getJournalFilesPath($journalId) . '/';
             $templateMgr =& TemplateManager::getManager();
             $templateMgr->assign('coverPagePath', $coverPagePath);
             $templateMgr->assign('locale', Locale::getLocale());
             $templateMgr->assign_by_ref('bookForReview', $book);
             $templateMgr->assign('isAuthor', $isAuthor);
             $templateMgr->display($bfrPlugin->getTemplatePath() . 'bookForReview.tpl');
         }
     }
     $request->redirect(null, 'booksForReview');
 }
 /**
  * Save submission file
  * @param $args array
  * @param $request PKPRequest
  */
 function execute($args, &$request)
 {
     $submissionFileDao =& DAORegistry::getDAO('SubmissionFileDAO');
     /* @var $submissionFileDao SubmissionFileDAO */
     $monographFile =& $submissionFileDao->getLatestRevision($this->_fileId);
     $monographFile->setName($this->getData('name'), Locale::getLocale());
     $submissionFileDao->updateObject($monographFile);
 }
 /**
  * Initialize form data.
  */
 function initData()
 {
     $PagSeguroPlugin =& $this->PagSeguroPlugin;
     $user =& Request::getUser();
     $userId = $user ? $user->getUserId() : null;
     $queuedPayment =& $this->queuedPayment;
     $this->_data = array('email_cobranca' => '*****@*****.**', 'item_name' => $queuedPayment->getDescription(), 'a3' => $queuedPayment->getAmount($args), 'quantity' => 1, 'no_note' => 1, 'no_shipping' => 1, 'currency_code' => $queuedPayment->getCurrencyCode(), 'lc' => String::substr(Locale::getLocale(), 3), 'custom' => $this->key, 'notify_url' => Request::url(null, null, 'payment', 'ipn', array($queuedPayment->getQueuedPaymentId())), 'return' => Request::url(null, null, 'payment', 'return', array($queuedPayment->getQueuedPaymentId())), 'cancel_return' => Request::url(null, null, 'payment', 'cancel', array($queuedPayment->getQueuedPaymentId())), 'first_name' => $user ? $user->getFirstName() : '', 'last_name' => $user ? $user->getLastname() : '', 'city' => '', 'zip' => '', 'item_number' => 1);
 }
 /**
  * Retrieve registration option name by ID.
  * @param $optionId int
  * @return string
  */
 function getRegistrationOptionName($optionId)
 {
     $result =& $this->retrieve('SELECT COALESCE(l.setting_value, p.setting_value) FROM registration_option_settings l LEFT JOIN registration_option_settings p ON (p.option_id = ? AND p.setting_name = ? AND p.locale = ?) WHERE l.option_id = ? AND l.setting_name = ? AND l.locale = ?', array($optionId, 'name', Locale::getLocale(), $optionId, 'name', Locale::getPrimaryLocale()));
     $returner = isset($result->fields[0]) ? $result->fields[0] : false;
     $result->Close();
     unset($result);
     return $returner;
 }
 /**
  * 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', Locale::getLocale(), $typeId, 'name', Locale::getPrimaryLocale()));
     $returner = isset($result->fields[0]) ? $result->fields[0] : false;
     $result->Close();
     unset($result);
     return $returner;
 }
Beispiel #17
0
 /**
  * Get the locale to display help files in.
  * If help isn't available for the current locale,
  * defaults to en_US.
  */
 function getLocale()
 {
     $locale = Locale::getLocale();
     if (!file_exists("help/{$locale}/.")) {
         return 'en_US';
     }
     return $locale;
 }
Beispiel #18
0
    /**
     * Get the article report data.
     * @param $journalId int
     * @return array
     */
    function getArticleReport($journalId)
    {
        $primaryLocale = Locale::getPrimaryLocale();
        $locale = Locale::getLocale();
        $result =& $this->retrieve('SELECT
				a.article_id AS article_id,
				COALESCE(asl1.setting_value, aspl1.setting_value) AS title,
				COALESCE(asl2.setting_value, aspl2.setting_value) AS abstract,
				u.first_name AS fname,
				u.middle_name AS mname,
				u.last_name AS lname,
				u.email AS email,
				u.affiliation AS affiliation,
				u.country AS country,
				u.phone AS phone,
				u.fax AS fax,
				u.url AS url,
				u.mailing_address AS address,
				COALESCE(usl.setting_value, uspl.setting_value) AS biography,
				COALESCE(sl.setting_value, spl.setting_value) AS section_title,
				a.language AS language
			FROM
				articles a
					LEFT JOIN users u ON a.user_id=u.user_id
					LEFT JOIN user_settings uspl ON (u.user_id=uspl.user_id AND uspl.setting_name = ? AND uspl.locale = ?)
					LEFT JOIN user_settings usl ON (u.user_id=usl.user_id AND usl.setting_name = ? AND usl.locale = ?)
					LEFT JOIN article_settings aspl1 ON (aspl1.article_id=a.article_id AND aspl1.setting_name = ? AND aspl1.locale = ?)
					LEFT JOIN article_settings asl1 ON (asl1.article_id=a.article_id AND asl1.setting_name = ? AND asl1.locale = ?)
					LEFT JOIN article_settings aspl2 ON (aspl2.article_id=a.article_id AND aspl2.setting_name = ? AND aspl2.locale = ?)
					LEFT JOIN article_settings asl2 ON (asl2.article_id=a.article_id AND asl2.setting_name = ? AND asl2.locale = ?)
					LEFT JOIN section_settings spl ON (spl.section_id=a.section_id AND spl.setting_name = ? AND spl.locale = ?)
					LEFT JOIN section_settings sl ON (sl.section_id=a.section_id AND sl.setting_name = ? AND sl.locale = ?)
			WHERE
				a.journal_id = ?
			ORDER BY
				title', array('biography', $primaryLocale, 'biography', $locale, 'title', $primaryLocale, 'title', $locale, 'abstract', $primaryLocale, 'abstract', $locale, 'title', $primaryLocale, 'title', $locale, $journalId));
        $articlesReturner =& new DBRowIterator($result);
        $result =& $this->retrieve('SELECT	MAX(ed.date_decided) AS date,
				ed.article_id AS article_id
			FROM	edit_decisions ed,
				articles a
			WHERE	a.journal_id = ? AND
				a.article_id = ed.article_id
			GROUP BY ed.article_id', array($journalId));
        $decisionDatesIterator =& new DBRowIterator($result);
        $decisions = array();
        $decisionsReturner = array();
        while ($row =& $decisionDatesIterator->next()) {
            $result =& $this->retrieve('SELECT	decision AS decision,
					article_id AS article_id
				FROM	edit_decisions
				WHERE	date_decided = ? AND
					article_id = ?', array($row['date'], $row['article_id']));
            $decisionsReturner[] =& new DBRowIterator($result);
            unset($result);
        }
        return array($articlesReturner, $decisionsReturner);
    }
Beispiel #19
0
 /**
  * Get the localized value of the galley label.
  * @return $string
  */
 function getGalleyLabel()
 {
     $label = $this->getLabel();
     if ($this->getLocale() != Locale::getLocale()) {
         $locales = Locale::getAllLocales();
         $label .= ' (' . $locales[$this->getLocale()] . ')';
     }
     return $label;
 }
 function ContentManager()
 {
     $journal =& Request::getJournal();
     $journalFileManager =& new JournalFileManager($journal);
     // try to current locale
     $lang = Locale::getLocale();
     $this->filePath = $journalFileManager->filesDir . 'content/' . $lang . '/content.xhtml';
     $this->loadContents();
 }
 /**
  * @see OAIMetadataFormat#toXML
  */
 function toXml(&$record, $format = null)
 {
     $response = null;
     if (!HookRegistry::call('OAIMetadataFormat_DC::toXml', array(&$this, $record, &$response))) {
         $article =& $record->getData('article');
         $journal =& $record->getData('journal');
         $section =& $record->getData('section');
         $issue =& $record->getData('issue');
         $galleys =& $record->getData('galleys');
         Locale::requireComponents(array(LOCALE_COMPONENT_APPLICATION_COMMON));
         // Sources contains journal title, issue ID, and pages
         $sources = $this->stripAssocArray((array) $journal->getTitle(null));
         $pages = $article->getPages();
         if (!empty($pages)) {
             $pages = '; ' . $pages;
         }
         foreach ($sources as $key => $source) {
             $sources[$key] .= '; ' . $issue->getIssueIdentification() . $pages;
         }
         // Format creators
         $creators = array();
         $authors = $article->getAuthors();
         for ($i = 0, $num = count($authors); $i < $num; $i++) {
             $authorName = $authors[$i]->getFullName(true);
             $affiliation = $authors[$i]->getLocalizedAffiliation();
             if (!empty($affiliation)) {
                 $authorName .= '; ' . $affiliation;
             }
             $creators[] = $authorName;
         }
         // Publisher
         $publishers = $this->stripAssocArray((array) $journal->getTitle(null));
         // Default
         $publisherInstitution = $journal->getSetting('publisherInstitution');
         if (!empty($publisherInstitution)) {
             $publishers = array($journal->getPrimaryLocale() => $publisherInstitution);
         }
         // Types
         $types = $this->stripAssocArray((array) $section->getIdentifyType(null));
         $types = array_merge_recursive(empty($types) ? array(Locale::getLocale() => Locale::translate('rt.metadata.pkp.peerReviewed')) : $types, $this->stripAssocArray((array) $article->getType(null)));
         // Formats
         $formats = array();
         foreach ($galleys as $galley) {
             $formats[] = $galley->getFileType();
         }
         // Relation
         $relation = array();
         foreach ($article->getSuppFiles() as $suppFile) {
             $relation[] = Request::url($journal->getPath(), 'article', 'downloadSuppFile', array($article->getId(), $suppFile->getFileId()));
         }
         $response = "<oai_dc:dc\n" . "\txmlns:oai_dc=\"http://www.openarchives.org/OAI/2.0/oai_dc/\"\n" . "\txmlns:dc=\"http://purl.org/dc/elements/1.1/\"\n" . "\txmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" . "\txsi:schemaLocation=\"http://www.openarchives.org/OAI/2.0/oai_dc/\n" . "\thttp://www.openarchives.org/OAI/2.0/oai_dc.xsd\">\n" . $this->formatElement('title', $this->stripAssocArray((array) $article->getTitle(null)), true) . $this->formatElement('creator', $creators) . $this->formatElement('subject', array_merge_recursive($this->stripAssocArray((array) $article->getDiscipline(null)), $this->stripAssocArray((array) $article->getSubject(null)), $this->stripAssocArray((array) $article->getSubjectClass(null))), true) . $this->formatElement('description', $this->stripAssocArray((array) $article->getAbstract(null)), true) . $this->formatElement('publisher', $publishers, true) . $this->formatElement('contributor', $this->stripAssocArray((array) $article->getSponsor(null)), true) . $this->formatElement('date', date('Y-m-d', strtotime($issue->getDatePublished()))) . $this->formatElement('type', $types, true) . $this->formatElement('format', $formats) . $this->formatElement('identifier', Request::url($journal->getPath(), 'article', 'view', array($article->getBestArticleId()))) . (($doi = $article->getDOI()) ? $this->formatElement('identifier', $doi, false, array('xsi:type' => 'dcterms:DOI')) : '') . $this->formatElement('source', $sources, true) . $this->formatElement('language', strip_tags($article->getLanguage())) . $this->formatElement('relation', $relation) . $this->formatElement('coverage', array_merge_recursive($this->stripAssocArray((array) $article->getCoverageGeo(null)), $this->stripAssocArray((array) $article->getCoverageChron(null)), $this->stripAssocArray((array) $article->getCoverageSample(null))), true) . $this->formatElement('rights', $this->stripAssocArray((array) $journal->getSetting('copyrightNotice'))) . "</oai_dc:dc>\n";
     }
     return $response;
 }
Beispiel #22
0
 /**
  * determine the correct language for the sharing button. Attempt to use the user's local
  * setting if it is one that AddThis supports. If not, use the language the administrator
  * has chosen.
  *
  * @return string
  * @param $default string
  */
 function sharingLocale($default)
 {
     //getLocal() returns a string like 'en_US'
     $locale = Locale::getLocale();
     $lang = substr($locale, 0, 2);
     $languages = SharingRT::getLanguages();
     if (isset($languages[$lang])) {
         return $lang;
     }
     return $default;
 }
Beispiel #23
0
 protected function dataProcess()
 {
     $papersIterator = $this->getPapersIterator();
     $locale = Locale::getLocale();
     while ($item =& $papersIterator->next()) {
         //make the output
         $paper = new PaperDecorator($item);
         $record = null;
         $record = $this->processRecord($paper, $locale);
         $this->appendRecord($record);
         unset($paper);
     }
 }
 function restoreVersions($deleteBeforeLoad = true)
 {
     import('lib.pkp.classes.rt.RTXMLParser');
     $parser = new RTXMLParser();
     if ($deleteBeforeLoad) {
         $this->dao->deleteVersionsByArchiveId($this->archiveId);
     }
     $versions = $parser->parseAll(RT_DIRECTORY . '/' . Locale::getLocale());
     // FIXME?
     foreach ($versions as $version) {
         $this->dao->insertVersion($this->archiveId, $version);
     }
 }
Beispiel #25
0
 function displayPaymentForm($queuedPaymentId, &$queuedPayment)
 {
     if (!$this->isConfigured()) {
         return false;
     }
     $schedConf =& Request::getSchedConf();
     $user =& Request::getUser();
     $params = array('business' => $this->getSetting($schedConf->getConferenceId(), $schedConf->getId(), 'selleraccount'), 'item_name' => $queuedPayment->getDescription(), 'amount' => $queuedPayment->getAmount(), 'quantity' => 1, 'no_note' => 1, 'no_shipping' => 1, 'currency_code' => $queuedPayment->getCurrencyCode(), 'lc' => String::substr(Locale::getLocale(), 3), 'custom' => $queuedPaymentId, 'notify_url' => Request::url(null, null, 'payment', 'plugin', array($this->getName(), 'ipn')), 'return' => $queuedPayment->getRequestUrl(), 'cancel_return' => Request::url(null, null, 'payment', 'plugin', array($this->getName(), 'cancel')), 'first_name' => $user ? $user->getFirstName() : '', 'last_name' => $user ? $user->getLastname() : '', 'item_number' => 1, 'cmd' => '_xclick');
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->assign('params', $params);
     $templateMgr->assign('paypalFormUrl', $this->getSetting($schedConf->getConferenceId(), $schedConf->getId(), 'paypalurl'));
     $templateMgr->display($this->getTemplatePath() . 'paymentForm.tpl');
 }
    /**
     * Get the registrant report data.
     * @param $conferenceId int
     * @param $schedConfId int
     * @return array
     */
    function getRegistrantReport($conferenceId, $schedConfId)
    {
        $primaryLocale = Locale::getPrimaryLocale();
        $locale = Locale::getLocale();
        $result =& $this->retrieve('SELECT
				r.registration_id AS registration_id,
				r.user_id AS userid,
				u.username AS uname,
				u.first_name AS fname,
				u.middle_name AS mname,
				u.last_name AS lname,
				u.affiliation AS affiliation,
				u.url AS url,
				u.email AS email,
				u.phone AS phone,
				u.fax AS fax,
				u.mailing_address AS address,
				u.country AS country,
				COALESCE(rtsl.setting_value, rtspl.setting_value) AS type,
				r.date_registered AS regdate,
				r.date_paid AS paiddate,
				r.special_requests AS specialreq
			FROM
				registrations r
					LEFT JOIN users u ON r.user_id=u.user_id
					LEFT JOIN registration_type_settings rtsl ON (r.type_id=rtsl.type_id AND rtsl.locale=? AND rtsl.setting_name=?)
					LEFT JOIN registration_type_settings rtspl ON (r.type_id=rtspl.type_id AND rtsl.locale=? AND rtspl.setting_name=?)
			WHERE
				r.sched_conf_id= ?
			ORDER BY
				lname', array($locale, 'name', $primaryLocale, 'name', $schedConfId));
        // prepare an iterator of all the registration information
        $registrationReturner = new DBRowIterator($result);
        $result =& $this->retrieve('SELECT 
				r.registration_id as registration_id,
				roa.option_id as option_id
			FROM
				registrations r 
					LEFT JOIN registration_option_assoc roa ON (r.registration_id = roa.registration_id)
			WHERE 
				r.sched_conf_id= ?', $schedConfId);
        // Prepare an array of registration Options by registration Id
        $registrationOptionDAO =& DAORegistry::getDAO('RegistrationOptionDAO');
        $iterator = new DBRowIterator($result);
        $registrationOptionReturner = array();
        while ($row =& $iterator->next()) {
            $registrationId = $row['registration_id'];
            $registrationOptionReturner[$registrationId] =& $registrationOptionDAO->getRegistrationOptions($registrationId);
        }
        return array($registrationReturner, $registrationOptionReturner);
    }
 /**
  * @see OAIMetadataFormat#toXml
  */
 function toXml(&$record, $format = null)
 {
     $conference =& $record->getData('conference');
     $schedConf =& $record->getData('schedConf');
     $paper =& $record->getData('paper');
     $track =& $record->getData('track');
     $galleys =& $record->getData('galleys');
     // Add page information to sources
     $sources = array($conference->getConferenceTitle() . '; ' . $schedConf->getSchedConfTitle());
     if ($paper->getPages() != '') {
         foreach ($sources as $a => $b) {
             $sources[$a] .= '; ' . $paper->getPages();
         }
     }
     // Get author names
     $creator = array();
     foreach ($paper->getAuthors() as $author) {
         $authorName = $author->getFullName();
         $affiliation = $author->getAffiliation();
         if (!empty($affiliation)) {
             $authorName .= '; ' . $affiliation;
         }
         $creator[] = $authorName;
     }
     // Subjects
     $subjects = array_merge_recursive($this->stripAssocArray((array) $paper->getDiscipline(null)), $this->stripAssocArray((array) $paper->getSubject(null)), $this->stripAssocArray((array) $paper->getSubjectClass(null)));
     // Publishers
     $publishers = $this->stripAssocArray((array) $conference->getTitle(null));
     // Default
     $publisherInstitution = (array) $conference->getSetting('publisherInstitution');
     if (!empty($publisherInstitution)) {
         $publishers = $publisherInstitution;
     }
     // Types
     Locale::requireComponents(array(LOCALE_COMPONENT_APPLICATION_COMMON));
     $this->stripAssocArray((array) $track->getIdentifyType(null));
     $types = array_merge_recursive(empty($types) ? array(Locale::getLocale() => Locale::translate('rt.metadata.pkp.peerReviewed')) : $types, $this->stripAssocArray((array) $paper->getType(null)));
     // Formats
     $format = array();
     foreach ($galleys as $galley) {
         $format[] = $galley->getFileType();
     }
     // Get supplementary files
     $relation = array();
     foreach ($paper->getSuppFiles() as $suppFile) {
         // FIXME replace with correct URL
         $relation[] = Request::url($conference->getPath(), $schedConf->getPath(), 'paper', 'download', array($paperId, $suppFile->getFileId()));
     }
     $response = "<oai_dc:dc\n" . "\txmlns:oai_dc=\"http://www.openarchives.org/OAI/2.0/oai_dc/\"\n" . "\txmlns:dc=\"http://purl.org/dc/elements/1.1/\"\n" . "\txmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" . "\txsi:schemaLocation=\"http://www.openarchives.org/OAI/2.0/oai_dc/\n" . "\thttp://www.openarchives.org/OAI/2.0/oai_dc.xsd\">\n" . $this->formatElement('title', $this->stripAssocArray((array) $paper->getLocalizedTitle(null)), true) . $this->formatElement('creator', $creator) . $this->formatElement('subject', $subjects, true) . $this->formatElement('description', $this->stripAssocArray((array) $paper->getAbstract(null)), true) . $this->formatElement('publisher', $publishers, true) . $this->formatElement('contributor', $this->stripAssocArray((array) $paper->getSponsor(null)), true) . $this->formatElement('date', $paper->getDatePublished()) . $this->formatElement('type', $types, true) . $this->formatElement('format', $format) . $this->formatElement('identifier', Request::url($conference->getPath(), $schedConf->getPath(), 'paper', 'view', array($paper->getBestPaperId()))) . $this->formatElement('source', $sources, true) . $this->formatElement('language', $paper->getLanguage()) . $this->formatElement('relation', $relation) . $this->formatElement('coverage', array_merge_recursive($this->stripAssocArray((array) $paper->getCoverageGeo(null)), $this->stripAssocArray((array) $paper->getCoverageChron(null)), $this->stripAssocArray((array) $paper->getCoverageSample(null))), true) . $this->formatElement('rights', (array) $conference->getSetting('copyrightNotice')) . "</oai_dc:dc>\n";
     return $response;
 }
Beispiel #28
0
 /**
  * Retrieve a proof assignment by article id.
  * @param $articleId int
  * @return ProofAssignment
  */
 function &getProofAssignmentByArticleId($articleId)
 {
     // Opatan Inc. : u.first_name and u.last_name are removed and setting_value
     // of firstName and lastName are added to the selected columns
     $locale = Locale::getLocale();
     $result =& $this->retrieve('SELECT p.*, sf.setting_value AS first_name, sl.setting_value AS last_name, u.email FROM proof_assignments p LEFT JOIN users u ON (p.proofreader_id = u.user_id) LEFT JOIN user_settings sf ON (u.user_id = sf.user_id AND sf.setting_name = ? AND sf.locale = ?) LEFT JOIN user_settings sl ON (u.user_id = sl.user_id AND sl.setting_name = ? AND sl.locale = ?) WHERE p.article_id = ?', array('firstName', $locale, 'lastName', $locale, $articleId));
     $returner = null;
     if ($result->RecordCount() != 0) {
         $returner =& $this->_returnProofAssignmentFromRow($result->GetRowAssoc(false));
     }
     $result->Close();
     unset($result);
     return $returner;
 }
Beispiel #29
0
 /**
  * Retrieve a copy assignment by article ID.
  * @param $articleId int
  * @return CopyAssignment
  */
 function &getCopyAssignmentByArticleId($articleId)
 {
     // Opatan Inc. : u.first_name and u.last_name are removed and setting_value
     // of firstName and lastName are added
     $locale = Locale::getLocale();
     $result =& $this->retrieve('SELECT c.*, a.copyedit_file_id, sf.setting_value AS first_name, sl.setting_value AS last_name FROM copyed_assignments c LEFT JOIN articles a ON (c.article_id = a.article_id) LEFT JOIN users u ON (c.copyeditor_id = u.user_id) LEFT JOIN user_settings sf ON (u.user_id = sf.user_id AND sf.setting_name = ? AND sf.locale = ?) LEFT JOIN user_settings sl ON (u.user_id = sl.user_id AND sl.setting_name = ? AND sl.locale = ?) WHERE c.article_id = ?', array('firstName', $locale, 'lastName', $locale, $articleId));
     $returner = null;
     if ($result->RecordCount() != 0) {
         $returner =& $this->_returnCopyAssignmentFromRow($result->GetRowAssoc(false));
     }
     $result->Close();
     unset($result);
     return $returner;
 }
Beispiel #30
0
 /**
  * Display a list of the emails within the current press.
  */
 function emails()
 {
     $this->setupTemplate(true);
     $rangeInfo = Handler::getRangeInfo('emails');
     $press =& Request::getPress();
     $emailTemplateDao =& DAORegistry::getDAO('EmailTemplateDAO');
     $emailTemplates =& $emailTemplateDao->getEmailTemplates(Locale::getLocale(), $press->getId());
     import('lib.pkp.classes.core.ArrayItemIterator');
     $emailTemplates =& ArrayItemIterator::fromRangeInfo($emailTemplates, $rangeInfo);
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->assign('pageHierarchy', array(array(Request::url(null, 'manager'), 'manager.pressManagement')));
     $templateMgr->assign_by_ref('emailTemplates', $emailTemplates);
     $templateMgr->assign('helpTopicId', 'press.managementPages.emails');
     $templateMgr->display('manager/emails/emails.tpl');
 }