/**
  * Display a list of subscriptions for the current journal.
  */
 function subscriptions()
 {
     SubscriptionManagerHandler::validate();
     SubscriptionManagerHandler::setupTemplate();
     $journal =& Request::getJournal();
     $rangeInfo =& Handler::getRangeInfo('subscriptions');
     $subscriptionDao =& DAORegistry::getDAO('SubscriptionDAO');
     // Get the user's search conditions, if any
     $searchField = Request::getUserVar('searchField');
     $dateSearchField = Request::getUserVar('dateSearchField');
     $searchMatch = Request::getUserVar('searchMatch');
     $search = Request::getUserVar('search');
     $fromDate = Request::getUserDateVar('dateFrom', 1, 1);
     if ($fromDate !== null) {
         $fromDate = date('Y-m-d H:i:s', $fromDate);
     }
     $toDate = Request::getUserDateVar('dateTo', 32, 12, null, 23, 59, 59);
     if ($toDate !== null) {
         $toDate = date('Y-m-d H:i:s', $toDate);
     }
     $subscriptions =& $subscriptionDao->getSubscriptionsByJournalId($journal->getJournalId(), $searchField, $searchMatch, $search, $dateSearchField, $fromDate, $toDate, $rangeInfo);
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->assign_by_ref('subscriptions', $subscriptions);
     $templateMgr->assign('helpTopicId', 'journal.managementPages.subscriptions');
     // Set search parameters
     foreach (SubscriptionManagerHandler::getSearchFormDuplicateParameters() as $param) {
         $templateMgr->assign($param, Request::getUserVar($param));
     }
     $templateMgr->assign('dateFrom', $fromDate);
     $templateMgr->assign('dateTo', $toDate);
     $templateMgr->assign('fieldOptions', SubscriptionManagerHandler::getSearchFieldOptions());
     $templateMgr->assign('dateFieldOptions', SubscriptionManagerHandler::getDateFieldOptions());
     $templateMgr->display('subscription/subscriptions.tpl');
 }
Пример #2
0
 /**
  * Display section editor index page.
  */
 function index($args)
 {
     SectionEditorHandler::validate();
     SectionEditorHandler::setupTemplate();
     $journal =& Request::getJournal();
     $user =& Request::getUser();
     $rangeInfo = Handler::getRangeInfo('submissions');
     // Get the user's search conditions, if any
     $searchField = Request::getUserVar('searchField');
     $dateSearchField = Request::getUserVar('dateSearchField');
     $searchMatch = Request::getUserVar('searchMatch');
     $search = Request::getUserVar('search');
     $fromDate = Request::getUserDateVar('dateFrom', 1, 1);
     if ($fromDate !== null) {
         $fromDate = date('Y-m-d H:i:s', $fromDate);
     }
     $toDate = Request::getUserDateVar('dateTo', 32, 12, null, 23, 59, 59);
     if ($toDate !== null) {
         $toDate = date('Y-m-d H:i:s', $toDate);
     }
     $sectionDao =& DAORegistry::getDAO('SectionDAO');
     $sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO');
     $page = isset($args[0]) ? $args[0] : '';
     $sections =& $sectionDao->getSectionTitles($journal->getJournalId());
     switch ($page) {
         case 'submissionsInEditing':
             $functionName = 'getSectionEditorSubmissionsInEditing';
             $helpTopicId = 'editorial.sectionEditorsRole.submissions.inEditing';
             break;
         case 'submissionsArchives':
             $functionName = 'getSectionEditorSubmissionsArchives';
             $helpTopicId = 'editorial.sectionEditorsRole.submissions.archives';
             break;
         default:
             $page = 'submissionsInReview';
             $functionName = 'getSectionEditorSubmissionsInReview';
             $helpTopicId = 'editorial.sectionEditorsRole.submissions.inReview';
     }
     $submissions =& $sectionEditorSubmissionDao->{$functionName}($user->getUserId(), $journal->getJournalId(), Request::getUserVar('section'), $searchField, $searchMatch, $search, $dateSearchField, $fromDate, $toDate, $rangeInfo);
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->assign('helpTopicId', $helpTopicId);
     $templateMgr->assign('sectionOptions', array(0 => Locale::Translate('editor.allSections')) + $sections);
     $templateMgr->assign_by_ref('submissions', $submissions);
     $templateMgr->assign('section', Request::getUserVar('section'));
     $templateMgr->assign('pageToDisplay', $page);
     $templateMgr->assign('sectionEditor', $user->getFullName());
     // Set search parameters
     $duplicateParameters = array('searchField', 'searchMatch', 'search', 'dateFromMonth', 'dateFromDay', 'dateFromYear', 'dateToMonth', 'dateToDay', 'dateToYear', 'dateSearchField');
     foreach ($duplicateParameters as $param) {
         $templateMgr->assign($param, Request::getUserVar($param));
     }
     $templateMgr->assign('dateFrom', $fromDate);
     $templateMgr->assign('dateTo', $toDate);
     $templateMgr->assign('fieldOptions', array(SUBMISSION_FIELD_TITLE => 'article.title', SUBMISSION_FIELD_AUTHOR => 'user.role.author', SUBMISSION_FIELD_EDITOR => 'user.role.editor'));
     $templateMgr->assign('dateFieldOptions', array(SUBMISSION_FIELD_DATE_SUBMITTED => 'submissions.submitted', SUBMISSION_FIELD_DATE_COPYEDIT_COMPLETE => 'submissions.copyeditComplete', SUBMISSION_FIELD_DATE_LAYOUT_COMPLETE => 'submissions.layoutComplete', SUBMISSION_FIELD_DATE_PROOFREADING_COMPLETE => 'submissions.proofreadingComplete'));
     import('issue.IssueAction');
     $issueAction =& new IssueAction();
     $templateMgr->register_function('print_issue_id', array($issueAction, 'smartyPrintIssueId'));
     $templateMgr->display('sectionEditor/index.tpl');
 }
Пример #3
0
 /**
  * Display proofreader index page.
  */
 function index($args)
 {
     $this->validate();
     $this->setupTemplate();
     $journal =& Request::getJournal();
     $user =& Request::getUser();
     $proofreaderSubmissionDao =& DAORegistry::getDAO('ProofreaderSubmissionDAO');
     // Get the user's search conditions, if any
     $searchField = Request::getUserVar('searchField');
     $dateSearchField = Request::getUserVar('dateSearchField');
     $searchMatch = Request::getUserVar('searchMatch');
     $search = Request::getUserVar('search');
     $fromDate = Request::getUserDateVar('dateFrom', 1, 1);
     if ($fromDate !== null) {
         $fromDate = date('Y-m-d H:i:s', $fromDate);
     }
     $toDate = Request::getUserDateVar('dateTo', 32, 12, null, 23, 59, 59);
     if ($toDate !== null) {
         $toDate = date('Y-m-d H:i:s', $toDate);
     }
     $rangeInfo = Handler::getRangeInfo('submissions');
     $page = isset($args[0]) ? $args[0] : '';
     switch ($page) {
         case 'completed':
             $active = false;
             break;
         default:
             $page = 'active';
             $active = true;
     }
     $sort = Request::getUserVar('sort');
     $sort = isset($sort) ? $sort : 'title';
     $sortDirection = Request::getUserVar('sortDirection');
     $countryField = Request::getUserVar('countryField');
     $submissions = $proofreaderSubmissionDao->getSubmissions($user->getId(), $journal->getId(), $searchField, $searchMatch, $search, $dateSearchField, $fromDate, $toDate, $countryField, $active, $rangeInfo, $sort, $sortDirection);
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->assign('pageToDisplay', $page);
     $templateMgr->assign_by_ref('submissions', $submissions);
     // Set search parameters
     $duplicateParameters = array('searchField', 'searchMatch', 'search', 'dateFromMonth', 'dateFromDay', 'dateFromYear', 'dateToMonth', 'dateToDay', 'dateToYear', 'dateSearchField');
     foreach ($duplicateParameters as $param) {
         $templateMgr->assign($param, Request::getUserVar($param));
     }
     $templateMgr->assign('dateFrom', $fromDate);
     $templateMgr->assign('dateTo', $toDate);
     $templateMgr->assign('fieldOptions', array(SUBMISSION_FIELD_TITLE => 'article.title', SUBMISSION_FIELD_AUTHOR => 'user.role.author', SUBMISSION_FIELD_EDITOR => 'user.role.editor'));
     $templateMgr->assign('dateFieldOptions', array(SUBMISSION_FIELD_DATE_SUBMITTED => 'submissions.submitted', SUBMISSION_FIELD_DATE_COPYEDIT_COMPLETE => 'submissions.copyeditComplete', SUBMISSION_FIELD_DATE_LAYOUT_COMPLETE => 'submissions.layoutComplete', SUBMISSION_FIELD_DATE_PROOFREADING_COMPLETE => 'submissions.proofreadingComplete'));
     $extraFieldDao =& DAORegistry::getDAO('ExtraFieldDAO');
     $countries =& $extraFieldDao->getExtraFieldsList(EXTRA_FIELD_GEO_AREA);
     $templateMgr->assign_by_ref('countries', $countries);
     import('classes.issue.IssueAction');
     $issueAction = new IssueAction();
     $templateMgr->register_function('print_issue_id', array($issueAction, 'smartyPrintIssueId'));
     $templateMgr->assign('helpTopicId', 'editorial.proofreadersRole.submissions');
     $templateMgr->assign('sort', $sort);
     $templateMgr->assign('sortDirection', $sortDirection);
     // Added by igm 9/24/11
     $templateMgr->assign('countryField', $countryField);
     $templateMgr->display('proofreader/index.tpl');
 }
Пример #4
0
 /**
  * Assign form data to user-submitted data.
  */
 function readInputData()
 {
     $this->readUserVars(array('listReviewers', 'selectedFields', 'selectedOrderField', 'order'));
     $this->_data['fromDate'] = Request::getUserDateVar('fromDate', 1, 1);
     if ($this->_data['fromDate'] !== null) {
         $this->_data['fromDate'] = date('Y-m-d', $this->_data['fromDate']);
     }
     $this->_data['toDate'] = Request::getUserDateVar('toDate', 1, 1);
     if ($this->_data['toDate'] !== null) {
         $this->_data['toDate'] = date('Y-m-d', $this->_data['toDate']);
     }
 }
Пример #5
0
 /**
  * Display a list of registrations for the current scheduled conference.
  */
 function registration()
 {
     $this->validate();
     $this->setupTemplate();
     $schedConf =& Request::getSchedConf();
     $rangeInfo =& Handler::getRangeInfo('registrations', array());
     $registrationDao =& DAORegistry::getDAO('RegistrationDAO');
     // Get the user's search conditions, if any
     $searchField = Request::getUserVar('searchField');
     $dateSearchField = Request::getUserVar('dateSearchField');
     $searchMatch = Request::getUserVar('searchMatch');
     $search = Request::getUserVar('search');
     $sort = Request::getUserVar('sort');
     //$sort = isset($sort) ? $sort : 'user';
     $sort = isset($sort) ? $sort : 'registered';
     $sortDirection = Request::getUserVar('sortDirection');
     $sortDirection = isset($sortDirection) ? $sortDirection : SORT_DIRECTION_DESC;
     $fromDate = Request::getUserDateVar('dateFrom', 1, 1);
     if ($fromDate !== null) {
         $fromDate = date('Y-m-d H:i:s', $fromDate);
     }
     $toDate = Request::getUserDateVar('dateTo', 32, 12, null, 23, 59, 59);
     if ($toDate !== null) {
         $toDate = date('Y-m-d H:i:s', $toDate);
     }
     while (true) {
         $registrations =& $registrationDao->getRegistrationsBySchedConfId($schedConf->getId(), $searchField, $searchMatch, $search, $dateSearchField, $fromDate, $toDate, $rangeInfo, $sort, $sortDirection);
         if ($registrations->isInBounds()) {
             break;
         }
         unset($rangeInfo);
         $rangeInfo =& $registrations->getLastPageRangeInfo();
         unset($registrations);
     }
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->assign_by_ref('registrations', $registrations);
     $templateMgr->assign('helpTopicId', 'conference.currentConferences.registration');
     // Set search parameters
     foreach ($this->getSearchFormDuplicateParameters() as $param) {
         $templateMgr->assign($param, Request::getUserVar($param));
     }
     $templateMgr->assign('dateFrom', $fromDate);
     $templateMgr->assign('dateTo', $toDate);
     $templateMgr->assign('fieldOptions', $this->getSearchFieldOptions());
     $templateMgr->assign('dateFieldOptions', $this->getDateFieldOptions());
     $templateMgr->assign('sort', $sort);
     $templateMgr->assign('sortDirection', $sortDirection);
     $templateMgr->display('registration/registrations.tpl');
 }
Пример #6
0
 /**
  * Display a list of subscriptions for the current journal.
  */
 function subscriptions($institutional = false)
 {
     $journal =& Request::getJournal();
     $rangeInfo =& PKPHandler::getRangeInfo('subscriptions');
     if ($institutional) {
         $subscriptionDao =& DAORegistry::getDAO('InstitutionalSubscriptionDAO');
         $templateFile = 'subscription/institutionalSubscriptions.tpl';
         $fieldOptions = SubscriptionAction::getInstitutionalSearchFieldOptions();
     } else {
         $subscriptionDao =& DAORegistry::getDAO('IndividualSubscriptionDAO');
         $templateFile = 'subscription/individualSubscriptions.tpl';
         $fieldOptions = SubscriptionAction::getIndividualSearchFieldOptions();
     }
     // Subscription status
     $statusOptions =& $subscriptionDao->getStatusOptions();
     $filterStatus = Request::getUserVar('filterStatus') == 0 ? null : Request::getUserVar('filterStatus');
     // Get the user's search conditions, if any
     $searchField = Request::getUserVar('searchField');
     $dateSearchField = Request::getUserVar('dateSearchField');
     $searchMatch = Request::getUserVar('searchMatch');
     $search = Request::getUserVar('search');
     $fromDate = Request::getUserDateVar('dateFrom', 1, 1);
     if ($fromDate !== null) {
         $fromDate = date('Y-m-d H:i:s', $fromDate);
     }
     $toDate = Request::getUserDateVar('dateTo', 32, 12, null, 23, 59, 59);
     if ($toDate !== null) {
         $toDate = date('Y-m-d H:i:s', $toDate);
     }
     $subscriptions =& $subscriptionDao->getSubscriptionsByJournalId($journal->getId(), $filterStatus, $searchField, $searchMatch, $search, $dateSearchField, $fromDate, $toDate, $rangeInfo);
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->assign_by_ref('subscriptions', $subscriptions);
     $templateMgr->assign('helpTopicId', 'journal.managementPages.subscriptions');
     // Set search parameters
     foreach (SubscriptionAction::getSearchFormDuplicateParameters() as $param) {
         $templateMgr->assign($param, Request::getUserVar($param));
     }
     $templateMgr->assign('dateFrom', $fromDate);
     $templateMgr->assign('dateTo', $toDate);
     $templateMgr->assign('filterStatus', Request::getUserVar('filterStatus'));
     $templateMgr->assign('statusOptions', array(0 => 'manager.subscriptions.allStatus') + $statusOptions);
     $templateMgr->assign('fieldOptions', $fieldOptions);
     $templateMgr->assign('dateFieldOptions', SubscriptionAction::getDateFieldOptions());
     $templateMgr->display($templateFile);
 }
 /**
  * Display the form.
  */
 function display(&$args)
 {
     $journal =& Request::getJournal();
     $journalId = $journal->getId();
     $user =& Request::getUser();
     $userDao =& DAORegistry::getDAO('UserDAO');
     $ercMembers =& $userDao->getUsersWithReviewerRole($journalId);
     $fromDate = Request::getUserDateVar('dateFrom', 1, 1);
     if ($fromDate !== null) {
         $fromDate = date('Y-m-d H:i:s', $fromDate);
     }
     $toDate = Request::getUserDateVar('dateTo', 32, 12, null, 23, 59, 59);
     if ($toDate !== null) {
         $toDate = date('Y-m-d H:i:s', $toDate);
     }
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->assign_by_ref('members', $ercMembers);
     $templateMgr->assign('dateFrom', $fromDate);
     $templateMgr->assign('dateTo', $toDate);
     parent::display();
 }
Пример #8
0
 function meetings()
 {
     $this->validate();
     $this->setupTemplate(true);
     $journal =& Request::getJournal();
     $journalId = $journal->getId();
     $user =& Request::getUser();
     $userId = $user->getId();
     $meetingDao = DAORegistry::getDAO('MeetingDAO');
     $meetingSectionDecisionDao = DAORegistry::getDAO('MeetingSectionDecisionDAO');
     $sectionDecisionDao = DAORegistry::getDAO('SectionDecisionDAO');
     $ercReviewersDao = DAORegistry::getDAO('ErcReviewersDAO');
     $sort = Request::getUserVar('sort');
     $sort = isset($sort) ? $sort : 'id';
     $sortDirection = Request::getUserVar('sortDirection');
     $rangeInfo = Handler::getRangeInfo('meetings');
     $fromDate = Request::getUserDateVar('dateFrom', 1, 1);
     if ($fromDate != null) {
         $fromDate = date('Y-m-d H:i:s', $fromDate);
     }
     $toDate = Request::getUserDateVar('dateTo', 32, 12, null, 23, 59, 59);
     if ($toDate != null) {
         $toDate = date('Y-m-d H:i:s', $toDate);
     }
     $status = Request::getUserVar('status');
     $replyStatus = Request::getUserVar('replyStatus');
     $meetingsToArray = $meetings = $meetingDao->getMeetingsByReviewerId($userId, $sort, $rangeInfo, $sortDirection, $status, $replyStatus, $fromDate, $toDate);
     $map = array();
     $meetingsArray = $meetingsToArray->toArray();
     foreach ($meetingsArray as $meeting) {
         $mSectionDecisions = $meetingSectionDecisionDao->getMeetingSectionDecisionsByMeetingId($meeting->getId());
         $sectionDecisions = array();
         foreach ($mSectionDecisions as $mSectionDecision) {
             $sectionDecision = $sectionDecisionDao->getSectionDecision($mSectionDecision->getSectionDecisionId());
             array_push($sectionDecisions, $sectionDecision);
         }
         $map[$meeting->getId()] = $sectionDecisions;
     }
     $meetings = $meetingDao->getMeetingsByReviewerId($userId, $sort, $rangeInfo, $sortDirection, $status, $replyStatus, $fromDate, $toDate);
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->assign_by_ref('meetings', $meetings);
     $templateMgr->assign_by_ref('submissions', $sectionDecisions);
     $templateMgr->assign_by_ref('map', $map);
     $templateMgr->assign('sort', $sort);
     $templateMgr->assign('rangeInfo', count($meetings));
     $templateMgr->assign('sortDirection', $sortDirection);
     $templateMgr->assign('baseUrl', Config::getVar('general', "base_url"));
     $templateMgr->assign('dateFrom', $fromDate);
     $templateMgr->assign('dateTo', $toDate);
     $templateMgr->assign('status', $status);
     $templateMgr->assign('replyStatus', $replyStatus);
     $templateMgr->assign('userId', $userId);
     $templateMgr->assign('isReviewer', !$ercReviewersDao->isExternalReviewer($journalId, $userId));
     // Set search parameters
     $duplicateParameters = array('dateFromMonth', 'dateFromDay', 'dateFromYear', 'dateToMonth', 'dateToDay', 'dateToYear', 'status', 'replyStatus');
     foreach ($duplicateParameters as $param) {
         $templateMgr->assign($param, Request::getUserVar($param));
     }
     $templateMgr->display('reviewer/meetings.tpl');
 }
Пример #9
0
 /**
  * Show advanced search results.
  */
 function advancedResults()
 {
     parent::validate();
     SearchHandler::setupTemplate(true);
     $rangeInfo = Handler::getRangeInfo('search');
     $searchJournalId = Request::getUserVar('searchJournal');
     if (!empty($searchJournalId)) {
         $journalDao =& DAORegistry::getDAO('JournalDAO');
         $journal =& $journalDao->getJournal($searchJournalId);
     } else {
         $journal =& Request::getJournal();
     }
     // Load the keywords array with submitted values
     $keywords = array(null => ArticleSearch::parseQuery(Request::getUserVar('query')));
     $keywords[ARTICLE_SEARCH_AUTHOR] = ArticleSearch::parseQuery(Request::getUserVar('author'));
     $keywords[ARTICLE_SEARCH_TITLE] = ArticleSearch::parseQuery(Request::getUserVar('title'));
     $keywords[ARTICLE_SEARCH_DISCIPLINE] = ArticleSearch::parseQuery(Request::getUserVar('discipline'));
     $keywords[ARTICLE_SEARCH_SUBJECT] = ArticleSearch::parseQuery(Request::getUserVar('subject'));
     $keywords[ARTICLE_SEARCH_TYPE] = ArticleSearch::parseQuery(Request::getUserVar('type'));
     $keywords[ARTICLE_SEARCH_COVERAGE] = ArticleSearch::parseQuery(Request::getUserVar('coverage'));
     $keywords[ARTICLE_SEARCH_GALLEY_FILE] = ArticleSearch::parseQuery(Request::getUserVar('fullText'));
     $keywords[ARTICLE_SEARCH_SUPPLEMENTARY_FILE] = ArticleSearch::parseQuery(Request::getUserVar('supplementaryFiles'));
     $fromDate = Request::getUserDateVar('dateFrom', 1, 1);
     if ($fromDate !== null) {
         $fromDate = date('Y-m-d H:i:s', $fromDate);
     }
     $toDate = Request::getUserDateVar('dateTo', 32, 12, null, 23, 59, 59);
     if ($toDate !== null) {
         $toDate = date('Y-m-d H:i:s', $toDate);
     }
     $results =& ArticleSearch::retrieveResults($journal, $keywords, $fromDate, $toDate, $rangeInfo);
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->assign_by_ref('results', $results);
     SearchHandler::assignAdvancedSearchParameters($templateMgr);
     $templateMgr->display('search/searchResults.tpl');
 }
Пример #10
0
 /**
  * Show advanced search results.
  */
 function advancedResults()
 {
     parent::validate();
     SearchHandler::setupTemplate(true);
     $rangeInfo = Handler::getRangeInfo('search');
     $publishedPaperDao =& DAORegistry::getDAO('PublishedPaperDAO');
     $searchConferenceId = Request::getUserVar('searchConference');
     if (!empty($searchConferenceId)) {
         $conferenceDao =& DAORegistry::getDAO('ConferenceDAO');
         $conference =& $conferenceDao->getConference($searchConferenceId);
         $yearRange = $publishedPaperDao->getPaperYearRange($conference->getId());
     } else {
         $conference =& Request::getConference();
         $yearRange = $publishedPaperDao->getPaperYearRange(null);
     }
     // Load the keywords array with submitted values
     $keywords = array(null => PaperSearch::parseQuery(Request::getUserVar('query')));
     $keywords[PAPER_SEARCH_AUTHOR] = PaperSearch::parseQuery(Request::getUserVar('author'));
     $keywords[PAPER_SEARCH_TITLE] = PaperSearch::parseQuery(Request::getUserVar('title'));
     $keywords[PAPER_SEARCH_DISCIPLINE] = PaperSearch::parseQuery(Request::getUserVar('discipline'));
     $keywords[PAPER_SEARCH_SUBJECT] = PaperSearch::parseQuery(Request::getUserVar('subject'));
     $keywords[PAPER_SEARCH_TYPE] = PaperSearch::parseQuery(Request::getUserVar('type'));
     $keywords[PAPER_SEARCH_COVERAGE] = PaperSearch::parseQuery(Request::getUserVar('coverage'));
     $keywords[PAPER_SEARCH_GALLEY_FILE] = PaperSearch::parseQuery(Request::getUserVar('fullText'));
     $keywords[PAPER_SEARCH_SUPPLEMENTARY_FILE] = PaperSearch::parseQuery(Request::getUserVar('supplementaryFiles'));
     $fromDate = Request::getUserDateVar('dateFrom', 1, 1);
     if ($fromDate !== null) {
         $fromDate = date('Y-m-d H:i:s', $fromDate);
     }
     $toDate = Request::getUserDateVar('dateTo', 32, 12, null, 23, 59, 59);
     if ($toDate !== null) {
         $toDate = date('Y-m-d H:i:s', $toDate);
     }
     $results =& PaperSearch::retrieveResults($conference, $keywords, $fromDate, $toDate, $rangeInfo);
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->setCacheability(CACHEABILITY_NO_STORE);
     $templateMgr->assign_by_ref('results', $results);
     SearchHandler::_assignAdvancedSearchParameters($templateMgr, $yearRange);
     $templateMgr->display('search/searchResults.tpl');
 }
Пример #11
0
 /**
  * Display editor submission queue pages.
  */
 function submissions($args)
 {
     EditorHandler::validate();
     EditorHandler::setupTemplate(EDITOR_SECTION_SUBMISSIONS);
     $journal =& Request::getJournal();
     $journalId = $journal->getJournalId();
     $user =& Request::getUser();
     $editorSubmissionDao =& DAORegistry::getDAO('EditorSubmissionDAO');
     $sectionDao =& DAORegistry::getDAO('SectionDAO');
     $page = isset($args[0]) ? $args[0] : '';
     $sections =& $sectionDao->getSectionTitles($journalId);
     // Get the user's search conditions, if any
     $searchField = Request::getUserVar('searchField');
     $dateSearchField = Request::getUserVar('dateSearchField');
     $searchMatch = Request::getUserVar('searchMatch');
     $search = Request::getUserVar('search');
     $fromDate = Request::getUserDateVar('dateFrom', 1, 1);
     if ($fromDate !== null) {
         $fromDate = date('Y-m-d H:i:s', $fromDate);
     }
     $toDate = Request::getUserDateVar('dateTo', 32, 12, null, 23, 59, 59);
     if ($toDate !== null) {
         $toDate = date('Y-m-d H:i:s', $toDate);
     }
     $rangeInfo = Handler::getRangeInfo('submissions');
     switch ($page) {
         case 'submissionsUnassigned':
             $functionName = 'getEditorSubmissionsUnassigned';
             $helpTopicId = 'editorial.editorsRole.submissions.unassigned';
             break;
         case 'submissionsInEditing':
             $functionName = 'getEditorSubmissionsInEditing';
             $helpTopicId = 'editorial.editorsRole.submissions.inEditing';
             break;
         case 'submissionsArchives':
             $functionName = 'getEditorSubmissionsArchives';
             $helpTopicId = 'editorial.editorsRole.submissions.archives';
             break;
         default:
             $page = 'submissionsInReview';
             $functionName = 'getEditorSubmissionsInReview';
             $helpTopicId = 'editorial.editorsRole.submissions.inReview';
     }
     $filterEditor = isset($args[1]) ? $args[1] : '';
     if ($filterEditor == 'filterEditor') {
         $user->updateSetting('filterEditor', 'filterEditor', 'string', $journalId);
     } elseif ($filterEditor == 'allEditors') {
         $user->updateSetting('filterEditor', 'allEditors', 'string', $journalId);
     } else {
         $filterEditor = $user->getSetting('filterEditor', $journalId);
         if (!$filterEditor) {
             $user->updateSetting('filterEditor', 'allEditors', 'string', $journalId);
         }
     }
     if ($filterEditor == 'filterEditor') {
         $editorId = $user->getUserId();
     } else {
         $editorId = 0;
     }
     $submissions =& $editorSubmissionDao->{$functionName}($journalId, Request::getUserVar('section'), $editorId, $searchField, $searchMatch, $search, $dateSearchField, $fromDate, $toDate, $rangeInfo);
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->assign('pageToDisplay', $page);
     $templateMgr->assign('editor', $user->getFullName());
     $templateMgr->assign('sectionOptions', array(0 => Locale::Translate('editor.allSections')) + $sections);
     $templateMgr->assign_by_ref('submissions', $submissions);
     $templateMgr->assign('section', Request::getUserVar('section'));
     $templateMgr->assign('filterEditor', $filterEditor);
     // Set search parameters
     foreach (EditorHandler::getSearchFormDuplicateParameters() as $param) {
         $templateMgr->assign($param, Request::getUserVar($param));
     }
     $templateMgr->assign('dateFrom', $fromDate);
     $templateMgr->assign('dateTo', $toDate);
     $templateMgr->assign('fieldOptions', EditorHandler::getSearchFieldOptions());
     $templateMgr->assign('dateFieldOptions', EditorHandler::getDateFieldOptions());
     import('issue.IssueAction');
     $issueAction =& new IssueAction();
     $templateMgr->register_function('print_issue_id', array($issueAction, 'smartyPrintIssueId'));
     $templateMgr->assign('helpTopicId', $helpTopicId);
     $templateMgr->display('editor/submissions.tpl');
 }
Пример #12
0
 /**
  * Assign form data to user-submitted data.
  */
 function readInputData()
 {
     $this->readUserVars(array('name', 'description', 'notPublic', 'code'));
     $this->_data['openDate'] = Request::getUserDateVar('openDate');
     $this->_data['closeDate'] = Request::getUserDateVar('closeDate');
 }
Пример #13
0
 /**
  * Assign form data to user-submitted data.
  */
 function readInputData()
 {
     $this->readUserVars(array('typeId', 'title', 'descriptionShort', 'description', 'dateExpireYear', 'dateExpireMonth', 'dateExpireDay'));
     $this->_data['dateExpire'] = Request::getUserDateVar('dateExpire');
 }
Пример #14
0
 /**
  * Adds specified user date variables to input data. 
  * @param $vars array the names of the date variables to read
  */
 function readUserDateVars($vars)
 {
     foreach ($vars as $k) {
         $this->setData($k, Request::getUserDateVar($k));
     }
 }
Пример #15
0
 /**
  * Show advanced search results.
  */
 function advancedResults()
 {
     $this->validate();
     $this->setupTemplate(true);
     $query = Request::getUserVar('query');
     $fromDate = Request::getUserVar('dateFrom');
     if (!$fromDate) {
         $fromDate = Request::getUserDateVar('dateFrom', 1, 1);
     }
     $toDate = Request::getUserVar('dateTo');
     if (!$toDate) {
         $toDate = Request::getUserDateVar('dateTo', 32, 12, null, 23, 59, 59);
     }
     $country = Request::getUserVar('proposalCountry');
     $status = Request::getUserVar('status');
     if ($status != '1' && $status != '2') {
         $status = false;
     }
     $rangeInfo =& Handler::getRangeInfo('search');
     $sort = Request::getUserVar('sort');
     $sort = isset($sort) ? $sort : 'title';
     $sortDirection = Request::getUserVar('sortDirection');
     $sortDirection = isset($sortDirection) && ($sortDirection == SORT_DIRECTION_ASC || $sortDirection == SORT_DIRECTION_DESC) ? $sortDirection : SORT_DIRECTION_ASC;
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->assign('dateFrom', $fromDate);
     $templateMgr->assign('dateTo', $toDate);
     if ($fromDate == '--') {
         $fromDate = null;
     }
     if ($toDate == '--') {
         $toDate = null;
     }
     if ($fromDate !== null) {
         $fromDate = date('Y-m-d H:i:s', $fromDate);
     }
     if ($toDate !== null) {
         $toDate = date('Y-m-d H:i:s', $toDate);
     }
     $articleDao =& DAORegistry::getDAO('ArticleDAO');
     $extraFieldDao =& DAORegistry::getDAO('ExtraFieldDAO');
     $results =& $articleDao->searchProposalsPublic($query, $fromDate, $toDate, $country, $status, $rangeInfo, $sort, $sortDirection);
     $templateMgr->assign('formattedDateFrom', $fromDate);
     $templateMgr->assign('formattedDateTo', $toDate);
     $templateMgr->assign('statusFilter', $status);
     $templateMgr->assign_by_ref('results', $results);
     $templateMgr->assign('query', $query);
     $templateMgr->assign('region', $country);
     $extraField =& $extraFieldDao->getExtraField($country);
     $templateMgr->assign('country', isset($extraField) ? $extraField->getLocalizedExtraFieldName() : null);
     $templateMgr->assign('countryCode', $country);
     $templateMgr->assign('proposalCountries', $extraFieldDao->getExtraFieldsList(EXTRA_FIELD_GEO_AREA));
     $templateMgr->assign('sort', $sort);
     $templateMgr->assign('sortDirection', $sortDirection);
     $templateMgr->assign('count', $results->getCount());
     $templateMgr->assign('dateFrom', $fromDate);
     $templateMgr->assign('dateTo', $toDate);
     $templateMgr->display('search/searchResults.tpl');
 }
Пример #16
0
 /**
  * Display section editor index page.
  */
 function index($args)
 {
     $this->validate();
     $this->setupTemplate();
     $journal =& Request::getJournal();
     $user =& Request::getUser();
     $rangeInfo = Handler::getRangeInfo('submissions');
     // Get the user's search conditions, if any
     $searchField = Request::getUserVar('searchField');
     $dateSearchField = Request::getUserVar('dateSearchField');
     $searchMatch = Request::getUserVar('searchMatch');
     $search = Request::getUserVar('search');
     $fromDate = Request::getUserDateVar('dateFrom', 1, 1);
     if ($fromDate !== null) {
         $fromDate = date('Y-m-d H:i:s', $fromDate);
     }
     $toDate = Request::getUserDateVar('dateTo', 32, 12, null, 23, 59, 59);
     if ($toDate !== null) {
         $toDate = date('Y-m-d H:i:s', $toDate);
     }
     $sectionDao =& DAORegistry::getDAO('SectionDAO');
     $sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO');
     $page = isset($args[0]) ? $args[0] : '';
     $sections =& $sectionDao->getSectionTitles($journal->getId());
     $sort = Request::getUserVar('sort');
     $sort = isset($sort) ? $sort : 'title';
     $sortDirection = Request::getUserVar('sortDirection');
     $filterSectionOptions = array(FILTER_SECTION_ALL => Locale::Translate('editor.allSections')) + $sections;
     switch ($page) {
         case 'waitingForResubmissions':
             $functionName = 'getSectionEditorWaitingForSubmissionsIterator';
             break;
         case 'submissionsInReview':
             $functionName = 'getSectionEditorSubmissionsInReviewIterator';
             break;
         case 'submissionsApproved':
             $functionName = 'getSectionEditorSubmissionsApprovedIterator';
             break;
         case 'submissionsCompleted':
             $functionName = 'getSectionEditorSubmissionsCompletedIterator';
             break;
         case 'submissionsArchives':
             $functionName = 'getSectionEditorSubmissionsArchivesIterator';
             break;
         default:
             $page = 'submissionsSubmitted';
             $functionName = 'getSectionEditorSubmissionsSubmittedIterator';
     }
     $submissions =& $sectionEditorSubmissionDao->{$functionName}($user->getSecretaryCommitteeId(), $journal->getId(), $searchField, $searchMatch, $search, $dateSearchField, $fromDate, $toDate, $rangeInfo, $sort, $sortDirection);
     $templateMgr =& TemplateManager::getManager();
     //$templateMgr->assign('helpTopicId', $helpTopicId);
     $templateMgr->assign('sectionOptions', $filterSectionOptions);
     $templateMgr->assign_by_ref('submissions', $submissions);
     // EL on February 19th 2013
     //$templateMgr->assign('filterSection', $filterSection);
     $templateMgr->assign('pageToDisplay', $page);
     $templateMgr->assign('sectionEditor', $user->getFullName());
     // Set search parameters
     $duplicateParameters = array('searchField', 'searchMatch', 'search', 'dateFromMonth', 'dateFromDay', 'dateFromYear', 'dateToMonth', 'dateToDay', 'dateToYear', 'dateSearchField');
     foreach ($duplicateParameters as $param) {
         $templateMgr->assign($param, Request::getUserVar($param));
     }
     $templateMgr->assign('dateFrom', $fromDate);
     $templateMgr->assign('dateTo', $toDate);
     $templateMgr->assign('fieldOptions', array(SUBMISSION_FIELD_TITLE => 'article.title', SUBMISSION_FIELD_AUTHOR => 'user.role.author', SUBMISSION_FIELD_EDITOR => 'user.role.editor'));
     $templateMgr->assign('dateFieldOptions', array(SUBMISSION_FIELD_DATE_SUBMITTED => 'submissions.submitted', SUBMISSION_FIELD_DATE_COPYEDIT_COMPLETE => 'submissions.copyeditComplete', SUBMISSION_FIELD_DATE_LAYOUT_COMPLETE => 'submissions.layoutComplete', SUBMISSION_FIELD_DATE_PROOFREADING_COMPLETE => 'submissions.proofreadingComplete'));
     $extraFieldDao =& DAORegistry::getDAO('ExtraFieldDAO');
     $countries =& $extraFieldDao->getExtraFieldsList(EXTRA_FIELD_GEO_AREA);
     $templateMgr->assign_by_ref('countries', $countries);
     import('classes.issue.IssueAction');
     $issueAction = new IssueAction();
     $templateMgr->register_function('print_issue_id', array($issueAction, 'smartyPrintIssueId'));
     $templateMgr->assign('sort', $sort);
     $templateMgr->assign('sortDirection', $sortDirection);
     $templateMgr->assign('ercId', $user->getSecretaryCommitteeId());
     $templateMgr->display('sectionEditor/index.tpl');
 }
 /**
  * Assign form data to user-submitted data.
  */
 function readInputData()
 {
     $this->readUserVars(array('status', 'userId', 'typeId', 'dateStartYear', 'dateStartMonth', 'dateStartDay', 'dateEndYear', 'dateEndMonth', 'dateEndDay', 'userSalutation', 'userFirstName', 'userMiddleName', 'userLastName', 'userInitials', 'userGender', 'userAffiliation', 'userUrl', 'userEmail', 'userPhone', 'userFax', 'userMailingAddress', 'userCountry', 'membership', 'referenceNumber', 'notes', 'notifyEmail'));
     $this->_data['dateStart'] = Request::getUserDateVar('dateStart');
     $this->_data['dateEnd'] = Request::getUserDateVar('dateEnd');
     // Ensure user email is provided and does not already exist
     $this->addCheck(new FormValidatorEmail($this, 'userEmail', 'required', 'user.profile.form.emailRequired'));
     $this->addCheck(new FormValidatorCustom($this, 'userEmail', 'required', 'user.register.form.emailExists', array(DAORegistry::getDAO('UserDAO'), 'userExistsByEmail'), array($this->getData('userId'), true), true));
     // If subscription type requires it, membership is provided
     $subscriptionTypeDao =& DAORegistry::getDAO('SubscriptionTypeDAO');
     $needMembership = $subscriptionTypeDao->getSubscriptionTypeMembership($this->getData('typeId'));
     if ($needMembership) {
         $this->addCheck(new FormValidator($this, 'membership', 'required', 'manager.subscriptions.form.membershipRequired'));
     }
     // If subscription type requires it, start and end dates are provided
     $nonExpiring = $subscriptionTypeDao->getSubscriptionTypeNonExpiring($this->getData('typeId'));
     if (!$nonExpiring) {
         // Start date is provided and is valid
         $this->addCheck(new FormValidator($this, 'dateStartYear', 'required', 'manager.subscriptions.form.dateStartRequired'));
         $this->addCheck(new FormValidatorCustom($this, 'dateStartYear', 'required', 'manager.subscriptions.form.dateStartValid', create_function('$dateStartYear', '$minYear = date(\'Y\') + SUBSCRIPTION_YEAR_OFFSET_PAST; $maxYear = date(\'Y\') + SUBSCRIPTION_YEAR_OFFSET_FUTURE; return ($dateStartYear >= $minYear && $dateStartYear <= $maxYear) ? true : false;')));
         $this->addCheck(new FormValidator($this, 'dateStartMonth', 'required', 'manager.subscriptions.form.dateStartRequired'));
         $this->addCheck(new FormValidatorCustom($this, 'dateStartMonth', 'required', 'manager.subscriptions.form.dateStartValid', create_function('$dateStartMonth', 'return ($dateStartMonth >= 1 && $dateStartMonth <= 12) ? true : false;')));
         $this->addCheck(new FormValidator($this, 'dateStartDay', 'required', 'manager.subscriptions.form.dateStartRequired'));
         $this->addCheck(new FormValidatorCustom($this, 'dateStartDay', 'required', 'manager.subscriptions.form.dateStartValid', create_function('$dateStartDay', 'return ($dateStartDay >= 1 && $dateStartDay <= 31) ? true : false;')));
         // End date is provided and is valid
         $this->addCheck(new FormValidator($this, 'dateEndYear', 'required', 'manager.subscriptions.form.dateEndRequired'));
         $this->addCheck(new FormValidatorCustom($this, 'dateEndYear', 'required', 'manager.subscriptions.form.dateEndValid', create_function('$dateEndYear', '$minYear = date(\'Y\') + SUBSCRIPTION_YEAR_OFFSET_PAST; $maxYear = date(\'Y\') + SUBSCRIPTION_YEAR_OFFSET_FUTURE; return ($dateEndYear >= $minYear && $dateEndYear <= $maxYear) ? true : false;')));
         $this->addCheck(new FormValidator($this, 'dateEndMonth', 'required', 'manager.subscriptions.form.dateEndRequired'));
         $this->addCheck(new FormValidatorCustom($this, 'dateEndMonth', 'required', 'manager.subscriptions.form.dateEndValid', create_function('$dateEndMonth', 'return ($dateEndMonth >= 1 && $dateEndMonth <= 12) ? true : false;')));
         $this->addCheck(new FormValidator($this, 'dateEndDay', 'required', 'manager.subscriptions.form.dateEndRequired'));
         $this->addCheck(new FormValidatorCustom($this, 'dateEndDay', 'required', 'manager.subscriptions.form.dateEndValid', create_function('$dateEndDay', 'return ($dateEndDay >= 1 && $dateEndDay <= 31) ? true : false;')));
     }
     // If notify email is requested, ensure subscription contact name and email exist.
     if ($this->_data['notifyEmail'] == 1) {
         $this->addCheck(new FormValidatorCustom($this, 'notifyEmail', 'required', 'manager.subscriptions.form.subscriptionContactRequired', create_function('', '$journal =& Request::getJournal(); $journalSettingsDao =& DAORegistry::getDAO(\'JournalSettingsDAO\'); $subscriptionName = $journalSettingsDao->getSetting($journal->getId(), \'subscriptionName\'); $subscriptionEmail = $journalSettingsDao->getSetting($journal->getId(), \'subscriptionEmail\'); return $subscriptionName != \'\' && $subscriptionEmail != \'\' ? true : false;'), array()));
     }
 }
Пример #18
0
 /**
  * Assign form data to user-submitted data.
  */
 function readInputData()
 {
     $this->readUserVars(array('name', 'description', 'cost', 'currency', 'access', 'institutional', 'membership', 'notPublic', 'code', 'registrationOptionCosts'));
     $this->_data['openDate'] = Request::getUserDateVar('openDate');
     $this->_data['closeDate'] = Request::getUserDateVar('closeDate');
     $this->_data['expiryDate'] = Request::getUserVar('expiryDate') ? Request::getUserDateVar('expiryDate') : null;
 }
Пример #19
0
 /**
  * Display section editor index page.
  */
 function index($args, &$request)
 {
     $this->validate();
     $this->setupTemplate();
     $journal =& Request::getJournal();
     $journalId = $journal->getId();
     $user =& Request::getUser();
     $rangeInfo = Handler::getRangeInfo('submissions');
     // Get the user's search conditions, if any
     $searchField = Request::getUserVar('searchField');
     $dateSearchField = Request::getUserVar('dateSearchField');
     $searchMatch = Request::getUserVar('searchMatch');
     $search = Request::getUserVar('search');
     $fromDate = Request::getUserDateVar('dateFrom', 1, 1);
     if ($fromDate !== null) {
         $fromDate = date('Y-m-d H:i:s', $fromDate);
     }
     $toDate = Request::getUserDateVar('dateTo', 32, 12, null, 23, 59, 59);
     if ($toDate !== null) {
         $toDate = date('Y-m-d H:i:s', $toDate);
     }
     $sectionDao =& DAORegistry::getDAO('SectionDAO');
     $sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO');
     $page = isset($args[0]) ? $args[0] : '';
     $sections =& $sectionDao->getSectionTitles($journal->getId());
     $sort = Request::getUserVar('sort');
     $sort = isset($sort) ? $sort : 'id';
     $sortDirection = Request::getUserVar('sortDirection');
     $filterSectionOptions = array(FILTER_SECTION_ALL => AppLocale::Translate('editor.allSections')) + $sections;
     switch ($page) {
         case 'submissionsInEditing':
             $functionName = 'getSectionEditorSubmissionsInEditing';
             $helpTopicId = 'editorial.sectionEditorsRole.submissions.inEditing';
             break;
         case 'submissionsArchives':
             $functionName = 'getSectionEditorSubmissionsArchives';
             $helpTopicId = 'editorial.sectionEditorsRole.submissions.archives';
             break;
         default:
             $page = 'submissionsInReview';
             $functionName = 'getSectionEditorSubmissionsInReview';
             $helpTopicId = 'editorial.sectionEditorsRole.submissions.inReview';
     }
     $filterSection = Request::getUserVar('filterSection');
     if ($filterSection != '' && array_key_exists($filterSection, $filterSectionOptions)) {
         $user->updateSetting('filterSection', $filterSection, 'int', $journalId);
     } else {
         $filterSection = $user->getSetting('filterSection', $journalId);
         if ($filterSection == null) {
             $filterSection = FILTER_SECTION_ALL;
             $user->updateSetting('filterSection', $filterSection, 'int', $journalId);
         }
     }
     $submissions =& $sectionEditorSubmissionDao->{$functionName}($user->getId(), $journal->getId(), $filterSection, $searchField, $searchMatch, $search, $dateSearchField, $fromDate, $toDate, $rangeInfo, $sort, $sortDirection);
     // If only result is returned from a search, fast-forward to it
     if ($search && $submissions && $submissions->getCount() == 1) {
         $submission =& $submissions->next();
         $request->redirect(null, null, 'submission', array($submission->getId()));
     }
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->assign('helpTopicId', $helpTopicId);
     $templateMgr->assign('sectionOptions', $filterSectionOptions);
     $templateMgr->assign_by_ref('submissions', $submissions);
     $templateMgr->assign('filterSection', $filterSection);
     $templateMgr->assign('pageToDisplay', $page);
     $templateMgr->assign('sectionEditor', $user->getFullName());
     // Set search parameters
     $duplicateParameters = array('searchField', 'searchMatch', 'search', 'dateFromMonth', 'dateFromDay', 'dateFromYear', 'dateToMonth', 'dateToDay', 'dateToYear', 'dateSearchField');
     foreach ($duplicateParameters as $param) {
         $templateMgr->assign($param, Request::getUserVar($param));
     }
     $templateMgr->assign('dateFrom', $fromDate);
     $templateMgr->assign('dateTo', $toDate);
     $templateMgr->assign('fieldOptions', array(SUBMISSION_FIELD_TITLE => 'article.title', SUBMISSION_FIELD_ID => 'article.submissionId', SUBMISSION_FIELD_AUTHOR => 'user.role.author', SUBMISSION_FIELD_EDITOR => 'user.role.editor'));
     $templateMgr->assign('dateFieldOptions', array(SUBMISSION_FIELD_DATE_SUBMITTED => 'submissions.submitted', SUBMISSION_FIELD_DATE_COPYEDIT_COMPLETE => 'submissions.copyeditComplete', SUBMISSION_FIELD_DATE_LAYOUT_COMPLETE => 'submissions.layoutComplete', SUBMISSION_FIELD_DATE_PROOFREADING_COMPLETE => 'submissions.proofreadingComplete'));
     import('classes.issue.IssueAction');
     $issueAction = new IssueAction();
     $templateMgr->register_function('print_issue_id', array($issueAction, 'smartyPrintIssueId'));
     $templateMgr->assign('sort', $sort);
     $templateMgr->assign('sortDirection', $sortDirection);
     $templateMgr->display('sectionEditor/index.tpl');
 }
Пример #20
0
 /**
  * Display search results.
  */
 function searchResults()
 {
     ZendSearchHandler::setupTemplate();
     $plugin =& PluginRegistry::getPlugin('generic', 'ZendSearchPlugin');
     $isUsingSolr = $plugin->isUsingSolr();
     if ($isUsingSolr) {
         $ch = curl_init();
         curl_setopt($ch, CURLOPT_URL, $plugin->getSetting('solrUrl') . '/select');
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
         curl_setopt($ch, CURLOPT_TIMEOUT, 10);
         curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
         curl_setopt($ch, CURLOPT_ENCODING, '');
         curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
         curl_setopt($ch, CURLOPT_DNS_USE_GLOBAL_CACHE, 0);
         curl_setopt($ch, CURLOPT_POST, 1);
         $query = '';
     } else {
         $index =& $plugin->getIndex();
         $query = new Zend_Search_Lucene_Search_Query_Boolean();
     }
     $q = Request::getUserVar('q');
     if (!empty($q)) {
         if ($isUsingSolr) {
             $query .= 'text:"' . ZendSearchHandler::luceneEscape($q) . '" ';
         } else {
             $query->addSubquery(Zend_Search_Lucene_Search_QueryParser::parse($q));
         }
     }
     $searchFormElementDao =& DAORegistry::getDAO('SearchFormElementDAO');
     $searchFormElements =& $searchFormElementDao->getSearchFormElements();
     while ($searchFormElement =& $searchFormElements->next()) {
         $searchFormElementId = $searchFormElement->getSearchFormElementId();
         $symbolic = $searchFormElement->getSymbolic();
         switch ($searchFormElement->getType()) {
             case SEARCH_FORM_ELEMENT_TYPE_SELECT:
             case SEARCH_FORM_ELEMENT_TYPE_STRING:
                 $term = Request::getUserVar($symbolic);
                 if (!empty($term)) {
                     if ($isUsingSolr) {
                         $query .= $symbolic . ':"' . ZendSearchHandler::luceneEscape($term) . '" ';
                     } else {
                         $query->addSubquery(new Zend_Search_Lucene_Search_Query_Term(new Zend_Search_Lucene_Index_Term($term, $symbolic)), true);
                     }
                 }
                 break;
             case SEARCH_FORM_ELEMENT_TYPE_DATE:
                 $from = Request::getUserDateVar($symbolic . '-from');
                 $to = Request::getUserDateVar($symbolic . '-to');
                 if (!empty($from) && !empty($to)) {
                     if ($isUsingSolr) {
                         $query .= $symbolic . ':[' . strftime('%Y-%m-%dT%H:%M:%SZ', $from) . ' TO ' . strftime('%Y-%m-%dT%H:%M:%SZ', $to) . '] ';
                     } else {
                         $fromTerm = new Zend_Search_Lucene_Index_Term($from, $symbolic);
                         $toTerm = new Zend_Search_Lucene_Index_Term($to, $symbolic);
                         $query->addSubquery(new Zend_Search_Lucene_Search_Query_Range($fromTerm, $toTerm, true), true);
                     }
                 }
                 break;
             default:
                 fatalError('Unknown element type!');
         }
         unset($searchFormElement);
     }
     $rangeInfo =& PKPHandler::getRangeInfo('results');
     if ($isUsingSolr) {
         $itemsPerPage = Config::getVar('interface', 'items_per_page');
         curl_setopt($ch, CURLOPT_POSTFIELDS, 'q=' . trim(urlencode($query)) . '&rows=' . urlencode($itemsPerPage) . ($rangeInfo ? '&start=' . $rangeInfo->getPage() * $itemsPerPage : ''));
         $data = curl_exec($ch);
         $xmlParser = new XMLParser();
         $result = null;
         $numFound = 0;
         @($result =& $xmlParser->parseTextStruct($data, array('str', 'result')));
         $recordIds = array();
         if ($result) {
             foreach ($result as $nodeSet) {
                 foreach ($nodeSet as $node) {
                     if (isset($node['attributes']['name']) && $node['attributes']['name'] == 'id') {
                         $recordIds[] = $node['value'];
                     } elseif (isset($node['attributes']['numFound'])) {
                         $numFound = $node['attributes']['numFound'];
                     }
                 }
             }
         }
         $plugin->import('SolrResultIterator');
         $resultsIterator =& SolrResultIterator::fromRangeInfo($recordIds, $numFound, $rangeInfo);
         unset($recordIds);
     } else {
         $resultsArray = $index->find($query);
         $plugin->import('ZendSearchResultIterator');
         $resultsIterator =& ZendSearchResultIterator::fromRangeInfo($resultsArray, $rangeInfo);
         unset($resultsArray);
     }
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->assign_by_ref('recordDao', DAORegistry::getDAO('RecordDAO'));
     $templateMgr->assign_by_ref('results', $resultsIterator);
     $templateMgr->assign_by_ref('q', $q);
     $templateMgr->display($plugin->getTemplatePath() . 'results.tpl');
 }
Пример #21
0
 /**
  * Assign form data to user-submitted data.
  */
 function readInputData()
 {
     $this->readUserVars(array('userId', 'typeId', 'applicationForm', 'survey', 'membership', 'domain', 'ipRange', 'notifyEmail', 'notifyPaymentEmail', 'specialRequests', 'datePaid', 'registrationOptionIds'));
     $this->_data['datePaid'] = Request::getUserVar('paid') ? Request::getUserDateVar('datePaid') : null;
     // If registration type requires it, membership is provided
     $registrationTypeDao =& DAORegistry::getDAO('RegistrationTypeDAO');
     $registrationType =& $registrationTypeDao->getRegistrationType($this->getData('typeId'));
     $needMembership = $registrationType->getMembership();
     if ($needMembership) {
         $this->addCheck(new FormValidator($this, 'membership', 'required', 'manager.registration.form.membershipRequired'));
     }
     // If registration type requires it, domain and/or IP range is provided
     $isInstitutional = $registrationTypeDao->getRegistrationTypeInstitutional($this->getData('typeId'));
     $isOnline = $registrationType->getAccess() != REGISTRATION_TYPE_ACCESS_PHYSICAL ? true : false;
     if ($isInstitutional && $isOnline) {
         $this->addCheck(new FormValidatorCustom($this, 'domain', 'required', 'manager.registration.form.domainIPRangeRequired', create_function('$domain, $ipRange', 'return $domain != \'\' || $ipRange != \'\' ? true : false;'), array($this->getData('ipRange'))));
     }
     // If notify email is requested, ensure registration contact name and email exist.
     if ($this->_data['notifyEmail'] == 1) {
         $this->addCheck(new FormValidatorCustom($this, 'notifyEmail', 'required', 'manager.registration.form.registrationContactRequired', create_function('', '$schedConf =& Request::getSchedConf(); $schedConfSettingsDao =& DAORegistry::getDAO(\'SchedConfSettingsDAO\'); $registrationName = $schedConfSettingsDao->getSetting($schedConf->getId(), \'registrationName\'); $registrationEmail = $schedConfSettingsDao->getSetting($schedConf->getId(), \'registrationEmail\'); return $registrationName != \'\' && $registrationEmail != \'\' ? true : false;'), array()));
     }
     if ($this->_data['notifyPaymentEmail'] == 1) {
         $this->addCheck(new FormValidatorCustom($this, 'notifyPaymentEmail', 'required', 'manager.registration.form.registrationContactRequired', create_function('', '$schedConf =& Request::getSchedConf(); $schedConfSettingsDao =& DAORegistry::getDAO(\'SchedConfSettingsDAO\'); $registrationName = $schedConfSettingsDao->getSetting($schedConf->getId(), \'registrationName\'); $registrationEmail = $schedConfSettingsDao->getSetting($schedConf->getId(), \'registrationEmail\'); return $registrationName != \'\' && $registrationEmail != \'\' ? true : false;'), array()));
     }
 }
Пример #22
0
 function reportGenerator($args)
 {
     parent::validate();
     $journal =& Request::getJournal();
     $fromDate = Request::getUserDateVar('dateFrom', 1, 1);
     if ($fromDate !== null) {
         $fromDate = date('Y-m-d H:i:s', $fromDate);
     }
     $toDate = Request::getUserDateVar('dateTo', 32, 12, null, 23, 59, 59);
     if ($toDate !== null) {
         $toDate = date('Y-m-d H:i:s', $toDate);
     }
     $journalStatisticsDao =& DAORegistry::getDAO('JournalStatisticsDAO');
     $reportType = (int) Request::getUserVar('reportType');
     switch ($reportType) {
         case REPORT_TYPE_EDITOR:
             $report =& $journalStatisticsDao->getEditorReport($journal->getJournalId(), $fromDate, $toDate);
             break;
         case REPORT_TYPE_REVIEWER:
             $report =& $journalStatisticsDao->getReviewerReport($journal->getJournalId(), $fromDate, $toDate);
             break;
         case REPORT_TYPE_SECTION:
             $report =& $journalStatisticsDao->getSectionReport($journal->getJournalId(), $fromDate, $toDate);
             break;
         case REPORT_TYPE_JOURNAL:
         default:
             $reportType = REPORT_TYPE_JOURNAL;
             $report =& $journalStatisticsDao->getJournalReport($journal->getJournalId(), $fromDate, $toDate);
             break;
     }
     $templateMgr =& TemplateManager::getManager();
     header('content-type: text/comma-separated-values');
     header('content-disposition: attachment; filename=report.csv');
     $separator = ',';
     // Display the heading row.
     switch ($reportType) {
         case REPORT_TYPE_EDITOR:
             echo Locale::translate('user.role.editor') . $separator;
             break;
         case REPORT_TYPE_REVIEWER:
             echo Locale::translate('user.role.reviewer') . $separator;
             echo Locale::translate('manager.statistics.reports.singleScore') . $separator;
             echo Locale::translate('user.affiliation') . $separator;
             break;
         case REPORT_TYPE_SECTION:
             echo Locale::translate('section.section') . $separator;
             break;
     }
     echo Locale::translate('article.submissionId');
     for ($i = 0; $i < $report->getMaxAuthors(); $i++) {
         echo $separator . Locale::translate('manager.statistics.reports.author', array('num' => $i + 1));
         echo $separator . Locale::translate('manager.statistics.reports.affiliation', array('num' => $i + 1));
         echo $separator . Locale::translate('manager.statistics.reports.country', array('num' => $i + 1));
     }
     echo $separator . Locale::translate('article.title');
     if ($reportType !== REPORT_TYPE_SECTION) {
         echo $separator . Locale::translate('section.section');
     }
     echo $separator . Locale::translate('submissions.submitted');
     if ($reportType !== REPORT_TYPE_EDITOR) {
         for ($i = 0; $i < $report->getMaxEditors(); $i++) {
             echo $separator . Locale::translate('manager.statistics.reports.editor', array('num' => $i + 1));
         }
     }
     if ($reportType !== REPORT_TYPE_REVIEWER) {
         for ($i = 0; $i < $report->getMaxReviewers(); $i++) {
             echo $separator . Locale::translate('manager.statistics.reports.reviewer', array('num' => $i + 1));
             echo $separator . Locale::translate('manager.statistics.reports.score', array('num' => $i + 1));
             echo $separator . Locale::translate('manager.statistics.reports.recommendation', array('num' => $i + 1));
         }
     }
     echo $separator . Locale::translate('editor.article.decision');
     echo $separator . Locale::translate('manager.statistics.reports.daysToDecision');
     echo $separator . Locale::translate('manager.statistics.reports.daysToPublication');
     echo "\n";
     // Display the report.
     $dateFormatShort = Config::getVar('general', 'date_format_short');
     while ($row =& $report->next()) {
         switch ($reportType) {
             case REPORT_TYPE_EDITOR:
                 echo $row['editor'] . $separator;
                 break;
             case REPORT_TYPE_REVIEWER:
                 echo $row['reviewer'] . $separator;
                 echo $row['score'] . $separator;
                 echo $row['affiliation'] . $separator;
                 break;
             case REPORT_TYPE_SECTION:
                 echo $row['section'] . $separator;
                 break;
         }
         echo $row['articleId'];
         for ($i = 0; $i < $report->getMaxAuthors(); $i++) {
             echo $separator . StatisticsHandler::csvEscape($row['authors'][$i]);
             echo $separator . StatisticsHandler::csvEscape($row['affiliations'][$i]);
             echo $separator . StatisticsHandler::csvEscape($row['countries'][$i]);
         }
         echo $separator . StatisticsHandler::csvEscape($row['title']);
         if ($reportType !== REPORT_TYPE_SECTION) {
             echo $separator . StatisticsHandler::csvEscape($row['section']);
         }
         echo $separator . $row['dateSubmitted'];
         if ($reportType !== REPORT_TYPE_EDITOR) {
             for ($i = 0; $i < $report->getMaxEditors(); $i++) {
                 echo $separator . StatisticsHandler::csvEscape($row['editors'][$i]);
             }
         }
         if ($reportType !== REPORT_TYPE_REVIEWER) {
             for ($i = 0; $i < $report->getMaxReviewers(); $i++) {
                 echo $separator . StatisticsHandler::csvEscape($row['reviewers'][$i]);
                 echo $separator . StatisticsHandler::csvEscape($row['scores'][$i]);
                 echo $separator . StatisticsHandler::csvEscape($row['recommendations'][$i]);
             }
         }
         echo $separator . StatisticsHandler::csvEscape($row['decision']);
         echo $separator . StatisticsHandler::csvEscape($row['daysToDecision']);
         echo $separator . StatisticsHandler::csvEscape($row['daysToPublication']);
         echo "\n";
     }
 }
Пример #23
0
 /**
  * Get the harvest update parameters from the Request object.
  * @param $archive object
  * @return array
  */
 function readUpdateParams(&$archive)
 {
     $this->import('OAIHarvester');
     $returner = array();
     $set = Request::getUserVar('set');
     if (count($set) == 1 && $set[0] == '') {
         $set = null;
     }
     $returner['set'] = $set;
     $dateFrom = Request::getUserDateVar('from', 1, 1);
     $dateTo = Request::getUserDateVar('until', 32, 12, null, 23, 59, 59);
     if (!empty($dateFrom)) {
         $returner['from'] = OAIHarvester::UTCDate($dateFrom);
     }
     if (!empty($dateTo)) {
         $returner['until'] = OAIHarvester::UTCDate($dateTo);
     }
     return $returner;
 }
Пример #24
0
 /**
  * Assign form data to user-submitted data.
  */
 function readInputData()
 {
     $startTime = Request::getUserDateVar('startTime');
     $endTime = Request::getUserDateVar('endTime', strftime('%d', $startTime), strftime('%m', $startTime), strftime('%Y', $startTime));
     $this->setData('startTime', $startTime);
     $this->setData('endTime', $endTime);
 }
Пример #25
0
 /**
  * Adds specified user date variables to input data.
  * @param $vars array the names of the date variables to read
  */
 function readUserDateVars($vars)
 {
     // Call hooks based on the calling entity, assuming
     // this method is only called by a subclass. Results
     // in hook calls named e.g. "papergalleyform::readUserDateVars"
     // Note that class and function names are always lower
     // case.
     HookRegistry::call(strtolower_codesafe(get_class($this) . '::readUserDateVars'), array($this, &$vars));
     foreach ($vars as $k) {
         $this->setData($k, Request::getUserDateVar($k));
     }
 }
Пример #26
0
 /**
  * Display editor submission queue pages.
  */
 function submissions($args)
 {
     $this->validate();
     $this->setupTemplate(EDITOR_SECTION_SUBMISSIONS);
     $journal =& Request::getJournal();
     $journalId = $journal->getId();
     $user =& Request::getUser();
     $editorSubmissionDao =& DAORegistry::getDAO('EditorSubmissionDAO');
     $sectionDao =& DAORegistry::getDAO('SectionDAO');
     $page = isset($args[0]) ? $args[0] : '';
     $sections =& $sectionDao->getSectionTitles($journalId);
     $sort = Request::getUserVar('sort');
     $sort = isset($sort) ? $sort : 'id';
     $sortDirection = Request::getUserVar('sortDirection');
     $sortDirection = isset($sortDirection) && ($sortDirection == 'ASC' || $sortDirection == 'DESC') ? $sortDirection : 'ASC';
     $filterEditorOptions = array(FILTER_EDITOR_ALL => Locale::Translate('editor.allEditors'), FILTER_EDITOR_ME => Locale::Translate('editor.me'));
     $filterSectionOptions = array(FILTER_SECTION_ALL => Locale::Translate('editor.allSections')) + $sections;
     // Get the user's search conditions, if any
     $searchField = Request::getUserVar('searchField');
     $dateSearchField = Request::getUserVar('dateSearchField');
     $searchMatch = Request::getUserVar('searchMatch');
     $search = Request::getUserVar('search');
     /**
      * Get user's search conditions for research field and regions
      */
     $researchFieldField = Request::getUserVar('researchFieldField');
     $countryField = Request::getUserVar('countryField');
     $fromDate = Request::getUserDateVar('dateFrom', 1, 1);
     if ($fromDate !== null) {
         $fromDate = date('Y-m-d H:i:s', $fromDate);
     }
     $toDate = Request::getUserDateVar('dateTo', 32, 12, null, 23, 59, 59);
     if ($toDate !== null) {
         $toDate = date('Y-m-d H:i:s', $toDate);
     }
     $rangeInfo = Handler::getRangeInfo('submissions');
     switch ($page) {
         case 'submissionsUnassigned':
             $functionName = 'getEditorSubmissionsUnassigned';
             $helpTopicId = 'editorial.editorsRole.submissions.unassigned';
             break;
         case 'submissionsInEditing':
             $functionName = 'getEditorSubmissionsInEditingIterator';
             $helpTopicId = 'editorial.editorsRole.submissions.inEditing';
             break;
         case 'submissionsArchives':
             $functionName = 'getEditorSubmissionsArchives';
             $helpTopicId = 'editorial.editorsRole.submissions.archives';
             break;
         default:
             $page = 'submissionsInReview';
             $functionName = 'getEditorSubmissionsInReviewIterator';
             $helpTopicId = 'editorial.editorsRole.submissions.inReview';
     }
     $filterEditor = Request::getUserVar('filterEditor');
     if ($filterEditor != '' && array_key_exists($filterEditor, $filterEditorOptions)) {
         $user->updateSetting('filterEditor', $filterEditor, 'int', $journalId);
     } else {
         $filterEditor = $user->getSetting('filterEditor', $journalId);
         if ($filterEditor == null) {
             $filterEditor = FILTER_EDITOR_ALL;
             $user->updateSetting('filterEditor', $filterEditor, 'int', $journalId);
         }
     }
     if ($filterEditor == FILTER_EDITOR_ME) {
         $editorId = $user->getId();
     } else {
         $editorId = FILTER_EDITOR_ALL;
     }
     $filterSection = Request::getUserVar('filterSection');
     if ($filterSection != '' && array_key_exists($filterSection, $filterSectionOptions)) {
         $user->updateSetting('filterSection', $filterSection, 'int', $journalId);
     } else {
         $filterSection = $user->getSetting('filterSection', $journalId);
         if ($filterSection == null) {
             $filterSection = FILTER_SECTION_ALL;
             $user->updateSetting('filterSection', $filterSection, 'int', $journalId);
         }
     }
     //workaround for multiple use of iterator in one page 3/21/2012
     $submissions =& $editorSubmissionDao->{$functionName}($journalId, $filterSection, $editorId, $searchField, $searchMatch, $search, $dateSearchField, $fromDate, $toDate, $researchFieldField, $countryField, $rangeInfo, $sort, $sortDirection);
     $submissions1 =& $editorSubmissionDao->{$functionName}($journalId, $filterSection, $editorId, $searchField, $searchMatch, $search, $dateSearchField, $fromDate, $toDate, $researchFieldField, $countryField, $rangeInfo, $sort, $sortDirection);
     $submissions2 =& $editorSubmissionDao->{$functionName}($journalId, $filterSection, $editorId, $searchField, $searchMatch, $search, $dateSearchField, $fromDate, $toDate, $researchFieldField, $countryField, $rangeInfo, $sort, $sortDirection);
     $submissions3 =& $editorSubmissionDao->{$functionName}($journalId, $filterSection, $editorId, $searchField, $searchMatch, $search, $dateSearchField, $fromDate, $toDate, $researchFieldField, $countryField, $rangeInfo, $sort, $sortDirection);
     $submissions4 =& $editorSubmissionDao->{$functionName}($journalId, $filterSection, $editorId, $searchField, $searchMatch, $search, $dateSearchField, $fromDate, $toDate, $researchFieldField, $countryField, $rangeInfo, $sort, $sortDirection);
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->assign('pageToDisplay', $page);
     $templateMgr->assign('editor', $user->getFullName());
     $templateMgr->assign('editorOptions', $filterEditorOptions);
     $templateMgr->assign('sectionOptions', $filterSectionOptions);
     $templateMgr->assign_by_ref('submissions', $submissions);
     $templateMgr->assign_by_ref('submissions1', $submissions1);
     $templateMgr->assign_by_ref('submissions2', $submissions2);
     $templateMgr->assign_by_ref('submissions3', $submissions3);
     $templateMgr->assign_by_ref('submissions4', $submissions4);
     $templateMgr->assign('filterEditor', $filterEditor);
     $templateMgr->assign('filterSection', $filterSection);
     // Set search parameters
     foreach ($this->getSearchFormDuplicateParameters() as $param) {
         $templateMgr->assign($param, Request::getUserVar($param));
     }
     $templateMgr->assign('dateFrom', $fromDate);
     $templateMgr->assign('dateTo', $toDate);
     $templateMgr->assign('fieldOptions', $this->getSearchFieldOptions());
     $templateMgr->assign('dateFieldOptions', $this->getDateFieldOptions());
     $extraFieldDao =& DAORegistry::getDAO('ExtraFieldDAO');
     $countries =& $extraFieldDao->getExtraFieldsList(EXTRA_FIELD_GEO_AREA);
     $templateMgr->assign_by_ref('researchFields', $extraFieldDao->getExtraFieldsList(EXTRA_FIELD_RESEARCH_FIELD));
     $templateMgr->assign_by_ref('countries', $countries);
     import('classes.issue.IssueAction');
     $issueAction = new IssueAction();
     $templateMgr->register_function('print_issue_id', array($issueAction, 'smartyPrintIssueId'));
     $templateMgr->assign('helpTopicId', $helpTopicId);
     $templateMgr->assign('sort', $sort);
     $templateMgr->assign('sortDirection', $sortDirection);
     $templateMgr->assign('researchFieldField', $researchFieldField);
     $templateMgr->assign('countryField', $countryField);
     $templateMgr->display('editor/submissions.tpl');
 }
Пример #27
0
 function manage($verb, $args, &$message)
 {
     if (!parent::manage($verb, $args, $message)) {
         return false;
     }
     Locale::requireComponents(array(LOCALE_COMPONENT_APPLICATION_COMMON, LOCALE_COMPONENT_PKP_MANAGER, LOCALE_COMPONENT_PKP_USER));
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->register_function('plugin_url', array(&$this, 'smartyPluginUrl'));
     $journal =& Request::getJournal();
     switch ($verb) {
         case 'settings':
             $this->import('ThesisSettingsForm');
             $form = new ThesisSettingsForm($this, $journal->getId());
             if (Request::getUserVar('save')) {
                 $form->readInputData();
                 if ($form->validate()) {
                     $form->execute();
                     Request::redirect(null, 'manager', 'plugin', array('generic', $this->getName(), 'theses'));
                     return false;
                 } else {
                     $this->setBreadCrumbs(true);
                     $form->display();
                 }
             } else {
                 $this->setBreadCrumbs(true);
                 $form->initData();
                 $form->display();
             }
             return true;
         case 'delete':
             if (!empty($args)) {
                 $thesisId = (int) $args[0];
                 $thesisDao =& DAORegistry::getDAO('ThesisDAO');
                 // Ensure thesis is for this journal
                 if ($thesisDao->getThesisJournalId($thesisId) == $journal->getId()) {
                     $thesisDao->deleteThesisById($thesisId);
                 }
             }
             Request::redirect(null, 'manager', 'plugin', array('generic', $this->getName(), 'theses'));
             return true;
         case 'create':
         case 'edit':
             $thesisId = !isset($args) || empty($args) ? null : (int) $args[0];
             $thesisDao =& DAORegistry::getDAO('ThesisDAO');
             // Ensure thesis is valid and for this journal
             if ($thesisId != null && $thesisDao->getThesisJournalId($thesisId) == $journal->getId() || $thesisId == null) {
                 $this->import('ThesisForm');
                 if ($thesisId == null) {
                     $templateMgr->assign('thesisTitle', 'plugins.generic.thesis.manager.createTitle');
                 } else {
                     $templateMgr->assign('thesisTitle', 'plugins.generic.thesis.manager.editTitle');
                 }
                 $journalSettingsDao =& DAORegistry::getDAO('JournalSettingsDAO');
                 $journalSettings =& $journalSettingsDao->getJournalSettings($journal->getId());
                 $thesisForm = new ThesisForm($this->getName(), $thesisId);
                 $thesisForm->initData();
                 $this->setBreadCrumbs(true);
                 $templateMgr->assign('journalSettings', $journalSettings);
                 $thesisForm->display();
             } else {
                 Request::redirect(null, 'manager', 'plugin', array('generic', $this->getName(), 'theses'));
             }
             return true;
         case 'update':
             $this->import('ThesisForm');
             $thesisId = Request::getUserVar('thesisId') == null ? null : (int) Request::getUserVar('thesisId');
             $thesisDao =& DAORegistry::getDAO('ThesisDAO');
             if ($thesisId != null && $thesisDao->getThesisJournalId($thesisId) == $journal->getId() || $thesisId == null) {
                 $thesisForm = new ThesisForm($this->getName(), $thesisId);
                 $thesisForm->readInputData();
                 if ($thesisForm->validate()) {
                     $thesisForm->execute();
                     if (Request::getUserVar('createAnother')) {
                         Request::redirect(null, 'manager', 'plugin', array('generic', $this->getName(), 'create'));
                     } else {
                         Request::redirect(null, 'manager', 'plugin', array('generic', $this->getName(), 'theses'));
                     }
                 } else {
                     if ($thesisId == null) {
                         $templateMgr->assign('thesisTitle', 'plugins.generic.thesis.manager.createTitle');
                     } else {
                         $templateMgr->assign('thesisTitle', 'plugins.generic.thesis.manager.editTitle');
                     }
                     $journalSettingsDao =& DAORegistry::getDAO('JournalSettingsDAO');
                     $journalSettings =& $journalSettingsDao->getJournalSettings($journal->getId());
                     $this->setBreadCrumbs(true);
                     $templateMgr->assign('journalSettings', $journalSettings);
                     $thesisForm->display();
                 }
             } else {
                 Request::redirect(null, 'manager', 'plugin', array('generic', $this->getName(), 'theses'));
             }
             return true;
         default:
             $this->import('Thesis');
             $searchField = null;
             $searchMatch = null;
             $search = Request::getUserVar('search');
             $dateFrom = Request::getUserDateVar('dateFrom', 1, 1);
             if ($dateFrom !== null) {
                 $dateFrom = date('Y-m-d H:i:s', $dateFrom);
             }
             $dateTo = Request::getUserDateVar('dateTo', 32, 12, null, 23, 59, 59);
             if ($dateTo !== null) {
                 $dateTo = date('Y-m-d H:i:s', $dateTo);
             }
             if (!empty($search)) {
                 $searchField = Request::getUserVar('searchField');
                 $searchMatch = Request::getUserVar('searchMatch');
             }
             $rangeInfo =& Handler::getRangeInfo('theses');
             $thesisDao =& DAORegistry::getDAO('ThesisDAO');
             $theses =& $thesisDao->getThesesByJournalId($journal->getId(), $searchField, $search, $searchMatch, $dateFrom, $dateTo, null, $rangeInfo);
             $templateMgr->assign('theses', $theses);
             $this->setBreadCrumbs();
             // Set search parameters
             $duplicateParameters = array('searchField', 'searchMatch', 'search', 'dateFromMonth', 'dateFromDay', 'dateFromYear', 'dateToMonth', 'dateToDay', 'dateToYear');
             foreach ($duplicateParameters as $param) {
                 $templateMgr->assign($param, Request::getUserVar($param));
             }
             $templateMgr->assign('dateFrom', $dateFrom);
             $templateMgr->assign('dateTo', $dateTo);
             $templateMgr->assign('yearOffsetPast', THESIS_APPROVED_YEAR_OFFSET_PAST);
             $fieldOptions = array(THESIS_FIELD_FIRSTNAME => 'plugins.generic.thesis.manager.studentFirstName', THESIS_FIELD_LASTNAME => 'plugins.generic.thesis.manager.studentLastName', THESIS_FIELD_EMAIL => 'plugins.generic.thesis.manager.studentEmail', THESIS_FIELD_DEPARTMENT => 'plugins.generic.thesis.manager.department', THESIS_FIELD_UNIVERSITY => 'plugins.generic.thesis.manager.university', THESIS_FIELD_TITLE => 'plugins.generic.thesis.manager.title', THESIS_FIELD_ABSTRACT => 'plugins.generic.thesis.manager.abstract', THESIS_FIELD_SUBJECT => 'plugins.generic.thesis.manager.keyword');
             $templateMgr->assign('fieldOptions', $fieldOptions);
             $templateMgr->display($this->getTemplatePath() . 'theses.tpl');
             return true;
     }
 }
 /**
  * Setup common template variables.
  * @param $subclass boolean set to true if caller is below this handler in the hierarchy
  */
 function setupTemplate($subclass = false)
 {
     parent::setupTemplate();
     $templateMgr =& TemplateManager::getManager();
     if ($subclass) {
         $templateMgr->assign('pageHierarchy', array(array(Request::url('search'), 'navigation.search')));
     }
     // Assign prior values, if supplied, to form fields
     $templateMgr->assign('query', Request::getUserVar('query'));
     // Determine the list of schemas that must be supported by the search form
     $publicArchiveIds = Request::getUserVar('archive');
     if (!is_array($publicArchiveIds) && !empty($publicArchiveIds)) {
         $publicArchiveIds = array($publicArchiveIds);
     }
     $archiveIds = Request::getUserVar('archiveIds');
     $archiveDao =& DAORegistry::getDAO('ArchiveDAO');
     $schemaList = array();
     $archives = array();
     $isAllSelected = (!is_array($archiveIds) || empty($archiveIds) || in_array('all', $archiveIds)) && empty($publicArchiveIds);
     if (!$isAllSelected) {
         if (is_array($archiveIds)) {
             foreach ($archiveIds as $archiveId) {
                 $archive =& $archiveDao->getArchive((int) $archiveId);
                 if ($archive && ($schemaPluginName = $archive->getSchemaPluginName()) != '') {
                     array_push($schemaList, $schemaPluginName);
                     $archives[] =& $archive;
                     unset($archive);
                 }
             }
         }
         if (is_array($publicArchiveIds)) {
             foreach ($publicArchiveIds as $publicArchiveId) {
                 $archive =& $archiveDao->getArchiveByPublicArchiveId($publicArchiveId);
                 if ($archive && ($schemaPluginName = $archive->getSchemaPluginName()) != '') {
                     array_push($schemaList, $schemaPluginName);
                 }
                 $archives[] =& $archive;
                 unset($archive);
             }
         }
     } else {
         $archives =& $archiveDao->getArchives();
         $archives =& $archives->toArray();
         foreach ($archives as $archive) {
             if ($archive->getRecordCount() > 0 && ($schemaPluginName = $archive->getSchemaPluginName()) != '') {
                 array_push($schemaList, $schemaPluginName);
             }
             unset($archive);
         }
     }
     $schemaList = array_map(array(DAORegistry::getDAO('SchemaDAO'), 'buildSchema'), array_unique($schemaList));
     import('field.Field');
     if (count($schemaList) == 1) {
         // There is a single schema being searched; make use of all its
         // fields.
         $schema = array_shift($schemaList);
         $fieldDao =& DAORegistry::getDAO('FieldDAO');
         $fields =& $fieldDao->getFields($schema->getSchemaId());
         $fields =& $fields->toArray();
         foreach ($fields as $field) {
             switch ($field->getType()) {
                 case FIELD_TYPE_DATE:
                     $varName = 'field-' . $field->getFieldId();
                     $dateFromName = "{$varName}-from";
                     $dateToName = "{$varName}-to";
                     $dateFrom = Request::getUserDateVar($dateFromName, 1, 1);
                     if (empty($dateFrom)) {
                         $dateFrom = Request::getUserVar($dateFromName);
                     }
                     $templateMgr->assign($dateFromName, $dateFrom);
                     $dateTo = Request::getUserDateVar($dateToName, 32, 12, null, 23, 59, 59);
                     if (empty($dateTo)) {
                         $dateTo = Request::getUserVar($dateToName);
                     }
                     $templateMgr->assign($dateToName, $dateTo);
                     break;
                 case FIELD_TYPE_SELECT:
                 case FIELD_TYPE_STRING:
                     $varName = 'field-' . $field->getFieldId();
                     $templateMgr->assign($varName, Request::getUserVar($varName));
                     break;
             }
         }
         $templateMgr->assign_by_ref('fields', $fields);
         $crosswalks = null;
         // Won't be using crosswalks
     } elseif (count($schemaList) > 1) {
         // Multiple schema are being searched; use crosswalks.
         $crosswalkDao =& DAORegistry::getDAO('CrosswalkDAO');
         $crosswalks =& $crosswalkDao->getCrosswalksForSchemas($schemaList);
         $crosswalks =& $crosswalks->toArray();
         foreach ($crosswalks as $crosswalk) {
             switch ($crosswalk->getType()) {
                 case FIELD_TYPE_DATE:
                     $varName = 'crosswalk-' . $crosswalk->getCrosswalkId();
                     $dateFromName = "{$varName}-from";
                     $dateToName = "{$varName}-to";
                     $dateFrom = Request::getUserDateVar($dateFromName, 1, 1);
                     if (empty($dateFrom)) {
                         $dateFrom = Request::getUserVar($dateFromName);
                     }
                     $templateMgr->assign($dateFromName, $dateFrom);
                     $dateTo = Request::getUserDateVar($dateToName, 32, 12, null, 23, 59, 59);
                     if (empty($dateTo)) {
                         $dateTo = Request::getUserVar($dateToName);
                     }
                     $templateMgr->assign($dateToName, $dateTo);
                     break;
                 case FIELD_TYPE_SELECT:
                 case FIELD_TYPE_STRING:
                 default:
                     $varName = 'crosswalk-' . $crosswalk->getCrosswalkId();
                     $templateMgr->assign($varName, Request::getUserVar($varName));
             }
         }
         $templateMgr->assign_by_ref('crosswalks', $crosswalks);
         $fields = null;
         // Won't be using fields
     } else {
         $fields = null;
         $crosswalks = null;
     }
     $templateMgr->assign('archiveIds', Request::getUserVar('archiveIds'));
     return array($crosswalks, $fields, $archives);
 }
Пример #29
0
 /**
  * Added by igmallare 10/11/2011
  * Generate csv file for the meeting attendance report
  * @param $args (type)
  */
 function generateMeetingAttendanceReport($args)
 {
     parent::validate();
     $this->setupTemplate();
     $ercMembers = Request::getUserVar('ercMembers');
     $fromDate = Request::getUserDateVar('dateFrom', 1, 1);
     if ($fromDate != null) {
         $fromDate = date('Y-m-d H:i:s', $fromDate);
     }
     $toDate = Request::getUserDateVar('dateTo', 32, 12, null, 23, 59, 59);
     if ($toDate != null) {
         $toDate = date('Y-m-d H:i:s', $toDate);
     }
     $meetingDao = DAORegistry::getDAO('MeetingDAO');
     $userDao = DAORegistry::getDAO('UserDAO');
     header('content-type: text/comma-separated-values');
     header('content-disposition: attachment; filename=meetingAttendanceReport-' . date('Ymd') . '.csv');
     $columns = array('lastname' => Locale::translate('user.lastName'), 'firstname' => Locale::translate('user.firstName'), 'middlename' => Locale::translate('user.middleName'), 'meeting_date' => Locale::translate('editor.reports.meetingDate'), 'present' => Locale::translate('editor.reports.isPresent'), 'reason_for_absence' => Locale::translate('editor.reports.reason'));
     $yesNoArray = array('present');
     $yesnoMessages = array(0 => Locale::translate('common.no'), 1 => Locale::translate('common.yes'));
     $fp = fopen('php://output', 'wt');
     String::fputcsv($fp, array_values($columns));
     foreach ($ercMembers as $member) {
         $user = $userDao->getUser($member);
         list($meetingsIterator) = $meetingDao->getMeetingReportByReviewerId($member, $fromDate, $toDate);
         $meetings = array();
         while ($row =& $meetingsIterator->next()) {
             foreach ($columns as $index => $junk) {
                 if (in_array($index, $yesNoArray)) {
                     $columns[$index] = $yesnoMessages[$row[$index]];
                 } elseif ($index == "lastname") {
                     $columns[$index] = $user->getLastName();
                 } elseif ($index == "firstname") {
                     $columns[$index] = $user->getFirstName();
                 } elseif ($index == "middlename") {
                     $columns[$index] = $user->getMiddleName();
                 } else {
                     $columns[$index] = $row[$index];
                 }
             }
             String::fputcsv($fp, $columns);
             unset($row);
         }
     }
     fclose($fp);
 }
Пример #30
0
 /**
  * Adds specified user date variables to input data.
  * @param $vars array the names of the date variables to read
  */
 function readUserDateVars($vars)
 {
     if (checkPhpVersion('4.3.0')) {
         $trace = debug_backtrace();
         // Call hooks based on the calling entity, assuming
         // this method is only called by a subclass. Results
         // in hook calls named e.g. "papergalleyform::readUserDateVars"
         // Note that class and function names are always lower
         // case.
         $value = null;
         HookRegistry::call(strtolower($trace[1]['class'] . '::' . $trace[0]['function']), array(&$this, &$vars));
     }
     foreach ($vars as $k) {
         $this->setData($k, Request::getUserDateVar($k));
     }
 }