public function savePaper(Paper $publication) { if ($this->filetypeAllowed($publication->getFiletype())) { $this->dao->savePaper($publication, $this->path); } else { throw new Exception("Este tipo de arquivo não é aceito pelo sistema."); } }
function test_Create_New_Paper() { //Arrange; $new_paper = new Paper(); $strength = $new_paper->getStrength(); $accuracy = $new_paper->getAccuracy(); $life = $new_paper->getLife(); //Act; $result = [$strength, $accuracy, $life]; //Assert; $this->assertEquals([2, 4, 6], $result); }
/** * Run the database seeds. * * @return void */ public function run() { Model::unguard(); $students = Student::all(); foreach ($students as $student) { Paper::FirstOrcreate(['student_id' => $student->id]); } // $this->call("OthersTableSeeder"); }
public static function findByPapernameAndNums($paper_name, $numbers) { $paper_id = Paper::findId($paper_name); $qlist = Question::find(array('paper_id = :pid: AND number IN ({numbers:array})', 'bind' => array('pid' => $paper_id, 'numbers' => array_values($numbers)))); if (count($qlist) == 0) { throw new Exception("Can not find any questions."); } return $qlist; }
public function __toString() { $attributes = ['id' => 'map', 'data-title' => $this->title]; if ($this->latlng) { $attributes['data-lat'] = $this->lat; $attributes['data-lng'] = $this->lng; } return Paper::tag('div', '', $attributes); }
public function getPapers() { if ($this->papers == null) { $temp = Paper::find(); $this->papers = array(); foreach ($temp as $paper) { $this->papers[$paper->id] = $paper; } } return $this->papers; }
function submission($args) { $paperId = isset($args[0]) ? (int) $args[0] : 0; $this->validate($paperId); $conference =& Request::getConference(); $schedConf =& Request::getSchedConf(); $submission =& $this->submission; $this->setupTemplate(true, $paperId); // FIXME? For comments.readerComments under Status AppLocale::requireComponents(array(LOCALE_COMPONENT_PKP_READER)); $user =& Request::getUser(); $roleDao =& DAORegistry::getDAO('RoleDAO'); $isDirector = $roleDao->roleExists($conference->getId(), $schedConf->getId(), $user->getId(), ROLE_ID_DIRECTOR); $trackDao =& DAORegistry::getDAO('TrackDAO'); $track =& $trackDao->getTrack($submission->getTrackId()); $enableComments = $conference->getSetting('enableComments'); $templateMgr =& TemplateManager::getManager(); $templateMgr->assign_by_ref('submission', $submission); $templateMgr->assign_by_ref('track', $track); $templateMgr->assign_by_ref('submissionFile', $submission->getSubmissionFile()); $templateMgr->assign_by_ref('suppFiles', $submission->getSuppFiles()); $templateMgr->assign_by_ref('reviewFile', $submission->getReviewFile()); $templateMgr->assign_by_ref('reviewMode', $submission->getReviewMode()); $templateMgr->assign('userId', $user->getId()); $templateMgr->assign('isDirector', $isDirector); $templateMgr->assign('enableComments', $enableComments); $templateMgr->assign_by_ref('tracks', $trackDao->getTrackTitles($schedConf->getId())); if ($enableComments) { import('paper.Paper'); $templateMgr->assign('commentsStatus', $submission->getCommentsStatus()); $templateMgr->assign_by_ref('commentsStatusOptions', Paper::getCommentsStatusOptions()); } $publishedPaperDao =& DAORegistry::getDAO('PublishedPaperDAO'); $publishedPaper =& $publishedPaperDao->getPublishedPaperByPaperId($submission->getPaperId()); if ($publishedPaper) { $templateMgr->assign_by_ref('publishedPaper', $publishedPaper); } if ($isDirector) { $templateMgr->assign('helpTopicId', 'editorial.directorsRole.summaryPage'); } $controlledVocabDao =& DAORegistry::getDAO('ControlledVocabDAO'); $templateMgr->assign('sessionTypes', $controlledVocabDao->enumerateBySymbolic('paperType', ASSOC_TYPE_SCHED_CONF, $schedConf->getId())); $templateMgr->assign('mayEditPaper', true); // @author Pulipuli Chen 20160123 $latestFileAry = $this->_getLatestFile($submission); if (is_object($latestFileAry['lastFile'])) { $templateMgr->assign_by_ref('lastFile', $latestFileAry['lastFile']); $templateMgr->assign_by_ref('lastFileType', $latestFileAry['lastFileType']); } $templateMgr->display('trackDirector/submission.tpl'); }
/** * Returns all information about a paper * * @param int $code code of the paper to look for * * @return array all the information in array form splited in 3 categories, * [paper], [author], [tutor] */ function getPaper($code) { /* paper information but keyword */ $result = mysql_fetch_array(mysql_query("select paper_title title, course.course_name course, \n des_spanish, des_english, des_portuguese \n from paper, course \n where paper.code = " . $code . " and\n paper_course = course.code")); $paper = new Paper($code, $result['title'], $result['course']); $paper->addAbstract('spanish', $result['des_spanish']); $paper->addAbstract('english', $result['des_english']); $paper->addAbstract('portuguese', $result['des_portuguese']); /* paper keywords */ $result = mysql_query("select k.keyword_spanish spanish, k.keyword_english english\n from keyword k, terms t\n where t.code_keyword = k.code and\n t.code_paper = " . $code); for ($i = 0; $row = mysql_fetch_array($result); $i++) { $paper->addkeyword(array('spanish' => $row['spanish'], 'english' => $row['english'])); } /* author(s) information but membership(s) */ $result = mysql_query("select a.code code, a.author_name name, \n a.author_lastname lastname, a.author_mail mail, \n a.author_webpage webpage \n from author a, authoring at \n where at.code_author = a.code and at.code_paper = " . $code . "\n order by author_order"); for ($i = 0; $row = mysql_fetch_array($result); $i++) { $author[$i] = array('order' => $i + 1, 'code' => $row['code'], 'name' => $row['name'], 'lastname' => $row['lastname'], 'mail' => $row['mail'], 'webpage' => $row['webpage']); } /* author(s) membership(s) */ for ($i = 0; isset($author[$i]); $i++) { $result = mysql_query("select i.code code, i.institution_name name, \n i.institution_webpage webpage, cit.city_name city, \n cou.country_name country \n from institution i, city cit, country cou, membership mem \n where cit.city_country = cou.code and \n i.institution_city = cit.code and \n mem.code_institution = i.code and \n mem.code_person = " . $author[$i]['code']); for ($j = 0; $row = mysql_fetch_array($result); $j++) { $author[$i]['institution'][$j] = array('code' => $row['code'], 'name' => $row['name'], 'webpage' => $row['webpage'], 'city' => $row['city'], 'country' => $row['country']); } } foreach ($author as $val) { $paper->addAuthor($val['order'], $val['code'], $val['name'], $val['lastname'], $val['mail'], $val['webpage'], $val['institution']); } /* tutor(s) information but membership(s) */ $result = mysql_query("select t.code code, t.tutor_name name, t.tutor_lastname lastname, \n t.tutor_mail mail, t.tutor_webpage webpage \n from tutor t, tutoring tu \n where tu.code_tutor = t.code and tu.code_paper = " . $code); for ($i = 0; $row = mysql_fetch_array($result); $i++) { $tutor[$i] = array('code' => $row['code'], 'name' => $row['name'], 'lastname' => $row['lastname'], 'mail' => $row['mail'], 'webpage' => $row['webpage']); } /* tutor(s) membership(s) */ for ($i = 0; isset($tutor[$i]); $i++) { $result = mysql_query("select i.code code, i.institution_name name, \n i.institution_webpage webpage, cit.city_name city, \n cou.country_name country \n from institution i, city cit, country cou, membership mem \n where cit.city_country = cou.code and \n i.institution_city = cit.code and \n mem.code_institution = i.code and \n mem.code_person = " . $tutor[$i]['code']); for ($j = 0; $row = mysql_fetch_array($result); $j++) { $tutor[$i]['institution'][$j] = array('code' => $row['code'], 'name' => $row['name'], 'webpage' => $row['webpage'], 'city' => $row['city'], 'country' => $row['country']); } } if (isset($tutor)) { foreach ($tutor as $val) { $paper->addTutor($val['code'], $val['name'], $val['lastname'], $val['mail'], $val['webpage'], $val['institution']); } } return $paper; }
function updateSQL($json_array, $class_name) { if ($class_name == 'index') { $this->worklist($json_array, $class_name); } else { foreach ($json_array as $key => $value) { if ($class_name == 'module') { $this->worklist($value, $class_name, 'belong_module', $key); } if ($class_name == 'factor') { $paper_id = Paper::findId($key); $this->worklist($value, $class_name, 'paper_id', $paper_id); } } } }
/** * Send a free mail to someone * */ function freemailAction() { // There must be a 'mailType' parameter $mailType = $this->getRequest()->getParam("mailType"); if (empty($mailType)) { throw new Zmax_Exception("There must a 'mailType' parameter for the 'freemail' action"); } // There could be an 'id paper' param, in which case the // mail relates to this paper. $idPaper = $this->getRequest()->getParam("paper_id"); if (!empty($idPaper)) { $paperTbl = new Paper(); $paper = $paperTbl->fetchAll("id={$idPaper}")->current(); $subject = "About submission #{$idPaper} - '{$paper->title}'"; $body = "About submission #{$idPaper}: '{$paper->title}'" . "(" . $paper->getAuthors() . ")"; } else { $subject = ""; $body = ""; } if ($mailType == Mail::SOME_USER) { // There must be a 'to' parameter $to = $this->getRequest()->getParam("to"); if (empty($to)) { throw new Zmax_Exception("There must a 'to' parameter for the 'freemail' action"); } } else { if ($mailType == Mail::ALL_AUTHORS_ACCEPTED) { // There must be a 'to' parameter $to = $this->texts->mail->to_all_authors_accepted; } else { if ($mailType == Mail::ALL_REVIEWERS) { // There must be a 'to' parameter $to = $this->texts->mail->to_all_reviewers; } else { if ($mailType == Mail::ALL_PARTICIPANTS) { // There must be a 'to' parameter $to = $this->texts->mail->to_all_participants; } else { $to = ""; } } } } // We are all set. Show the form $this->view->setFile("content", "form_mail.xml"); $this->view->mailType = $mailType; $this->view->subject = $subject; $this->view->body = $body; $this->view->to = $to; echo $this->view->render("layout"); }
/** * Constructor. */ function ReviewerSubmission() { parent::Paper(); }
/** * Shows the info on a submission in a secondary window */ function showinfoAction() { $paperTbl = new Paper(); $this->view->setFile("content", "show_info.xml"); $this->view->setBlock("content", "SECTION", "SECTIONS"); $this->view->setBlock("content", "DISCUSSION", "SHOW_DISCUSSION"); $this->view->setBlock("DISCUSSION", "message", "messages"); $this->view->setFile("review", "show_tbl_review.xml"); $this->view->setBlock("review", "review_mark", "review_marks"); $this->view->setBlock("review", "review_answer", "review_answers"); $idPaper = $this->getRequest()->getParam("id_paper"); $paper = $paperTbl->find($idPaper)->current(); if (!is_object($paper)) { throw new Zmax_Exception("showinfo: I am waiting for a valid paper id !?"); } // Default: print only the basic informations. Do not show the reviews // nor the forum $this->view->setBlock("content", "ANSWER", "ANSWERS"); $this->view->setBlock("content", "REVIEWER", "REVIEWERS"); $this->view->setBlock("content", "REVIEWS"); $this->view->setVar("SHOW_DISCUSSION", ""); // instantiate the template for the paper and its dependent objects $paper->putInView($this->view); // Check the context to determine what must be printed if ($this->user->isAdmin() or isset($_REQUEST['in_forum'])) { // It is an administrator. Print everything $this->view->setVar("SHOW_REVIEWS", $paper->showReviews($this->view, true)); // Add the messages if the discussion is opened if ($this->config->discussion_mode != Config::NO_DISCUSSION) { $this->view->messages = Message::display($idPaper, 0, $this->view); $this->view->assign("TMP_DISCUSSION", "DISCUSSION"); $this->view->assign("SHOW_DISCUSSION", "TMP_DISCUSSION"); } } else { if ($paper->hasReviewer($this->user->id)) { // It is a reviewer, $review = $paper->getReview($this->user->id); //check the 'allReviews' parameter if (isset($_REQUEST['allReviews'])) { if ($_REQUEST['allReviews']) { $this->view->SHOW_REVIEWS = $review->showReview($this->view, true); } else { $this->view->SHOW_REVIEWS = $paper->showReviews($this->view, true); } } // Add the messages if the discussion is open // if ($config['discussion_mode'] != NO_DISCUSSION) //$this->view->set_var("FORUM", DisplayMessages($idPaper, 0, $db, false)); } } // Take account of the 'noReview' and 'noForum' parameter if (isset($_REQUEST['noReview'])) { $this->view->REVIEWS = " "; } // if (isSet($_REQUEST['noForum'])) $view->set_var("FORUM", ""); $this->view->assign("action_result", "content"); $this->view->assign("action_result2", "action_result"); echo $this->view->action_result2; }
/** * Constructor. */ function PublishedPaper() { parent::Paper(); }
/** * @type 不更改 * @method $rt->id, $rt->description; ok * @param string $paper_name */ public static function getPaperDetail($paper_name) { self::checkConnect(); return Paper::findFirst(array("name = :name:", 'bind' => array('name' => $paper_name), 'hydration' => \Phalcon\Mvc\Model\Resultset\Simple::HYDRATE_ARRAYS, 'cache' => array('key' => 'paper_detail_name_' . $paper_name))); }
<?php $jsonResponse = new JsonResponse(); if (RequestsPatterns::postParamsSetted('id', 'type')) { if (RequestsPatterns::postParamsSent('id', 'type')) { require_once 'PublicationController.php'; require_once 'PublicationDao.php'; require_once 'Publication.php'; $controller = new PublicationController(new PublicationDao(Connection::connect())); if ($_POST['type'] == 'analysis') { require_once 'Analyse.php'; $publication = new Analyse(null); } elseif ($_POST['type'] == 'paper') { require_once 'Paper.php'; $publication = new Paper(null); } $publication->setId($_POST['id']); try { if ($controller->delete($publication)) { print_r($jsonResponse->response(true, "Publicação excluída com sucesso")->serialize()); } else { print_r($jsonResponse->response(false, "Falha ao excluir a publicação.")->serialize()); } } catch (Exception $err) { print_r($jsonResponse->response(false, $err->getMessage())->serialize()); } } else { print_r($jsonResponse->response(false, "Os parâmetros não podem estar vazios")->serialize()); } } else { print_r($jsonResponse->response(false, "Parâmetros não configurados")->serialize());
/** * Propose the list of papers to reviewers -- ask them to provide bids */ function bidsAction() { $db = $this->zmax_context->db; $this->view->setFile("content", "bids.xml"); $this->view->set_block("content", "PAPER", "PAPERS"); $this->view->set_block("PAPER", "SECTION", "SECTIONS"); $this->view->set_block("content", "GROUPS_LINKS", "LINKS"); $this->view->set_var("size_rating", Config::SIZE_RATING); // Initialize the current interval if (!isset($_REQUEST['iMin'])) { $iMinCur = 1; $iMaxCur = Config::SIZE_RATING; } else { $iMinCur = $_REQUEST['iMin']; $iMaxCur = $_REQUEST['iMax']; } $this->view->set_var("IMIN_CUR", $iMinCur); $this->view->set_var("IMAX_CUR", $iMaxCur); // If rates have been submitted: insert/update in the DB if (isset($_POST['rates'])) { foreach ($_POST['rates'] as $idPaper => $rate) { if ($rate != Config::UNKNOWN_RATING) { $this->user->addBid($idPaper, $rate); } $this->view->message = $this->texts->reviewer->ack_rating; } } else { // Print the main message $this->view->message = $this->texts->reviewer->rating_message; } $this->view->assign("bids_message", "message"); // Get the list of ratings $rateLabels = $db->fetchPairs("SELECT * FROM RateLabel"); $rateLabels = array_merge(array(Config::UNKNOWN_RATING => "?"), $rateLabels); $form = new Formulaire("POST", "RatePapers.php"); /* Select the papers */ $paperTbl = new Paper(); $papers = $paperTbl->fetchAll("1=1", "id"); $i = 0; foreach ($papers as $paper) { // Choose the CSS class $this->view->css_class = Config::CssClass($i++); // Only show the current group if ($iMinCur <= $i and $i <= $iMaxCur) { // Instantiate paper variables $paper->putInView($this->view); // Get the current bid $bid = $paper->getBid($this->user->id); // Show the selection list $this->view->list_bids = Zmax_View_Phplib::selectField("rates[{$paper->id}]", $rateLabels, $bid); /* Instantiate the entities in PAPER_. Put the result in PAPERS */ $this->view->append("PAPERS", "PAPER"); } if ($i > $iMaxCur) { break; } } // Create the groups $nbPapers = Config::countAllPapers(); $nb_groups = $nbPapers / Config::SIZE_RATING + 1; for ($i = 1; $i <= $nb_groups; $i++) { $iMin = ($i - 1) * Config::SIZE_RATING + 1; if ($iMin >= $iMinCur and $iMin <= $iMaxCur) { $link = "<font color=red>{$i}</font>"; } else { $link = $i; } $this->view->LINK = $link; $this->view->IMIN_VALUE = $iMin; $this->view->IMAX_VALUE = $iMin + Config::SIZE_RATING - 1; $this->view->append("LINKS", "GROUPS_LINKS"); } echo $this->view->render("layout"); }
public static function printPapers(Paper $publication) { $html = "<tr>"; $html .= "<td class='name-paper'>" . $publication->title() . "</td>"; $html .= "<td>"; $html .= "<a target='_blank' href='" . LinkController::getBaseURL() . "/publicacao/" . $publication->getSimpleFilename() . "'>"; $html .= "<img class='pdf' title='puclicação' alt='pdf' src='" . LinkController::getBaseURL() . "/images/pdf-icon.jpg'/>"; $html .= "</a>"; $html .= "</td>"; $html .= "</tr>"; echo $html; }
function handlePaperNode(&$conference, &$schedConf, &$paperNode, &$track, &$paper, &$publishedPaper, &$errors, &$user, $isCommandLine, &$dependentItems) { $errors = array(); $conferenceSupportedLocales = array_keys($conference->getSupportedLocaleNames()); // => locales must be set up before $conferencePrimaryLocale = $conference->getPrimaryLocale(); $publishedPaperDao =& DAORegistry::getDAO('PublishedPaperDAO'); $paperDao =& DAORegistry::getDAO('PaperDAO'); $paper = new Paper(); $paper->setSchedConfId($schedConf->getId()); $paper->setUserId($user->getId()); $paper->setTrackId($track->getId()); $paper->setStatus(STATUS_PUBLISHED); $paper->setSubmissionProgress(0); $paper->setCurrentStage(REVIEW_STAGE_ABSTRACT); $paper->setReviewMode(REVIEW_MODE_ABSTRACTS_ALONE); $paper->setDateSubmitted(Core::getCurrentDate()); $paper->stampStatusModified(); $titleExists = false; for ($index = 0; $node = $paperNode->getChildByName('title', $index); $index++) { $locale = $node->getAttribute('locale'); if ($locale == '') { $locale = $conferencePrimaryLocale; } elseif (!in_array($locale, $conferenceSupportedLocales)) { $errors[] = array('plugins.importexport.native.import.error.paperTitleLocaleUnsupported', array('paperTitle' => $node->getValue(), 'locale' => $locale)); return false; } $paper->setTitle($node->getValue(), $locale); $titleExists = true; } if (!$titleExists || $paper->getTitle($conferencePrimaryLocale) == "") { $errors[] = array('plugins.importexport.native.import.error.paperTitleMissing', array('trackTitle' => $track->getLocalizedTitle())); return false; } for ($index = 0; $node = $paperNode->getChildByName('abstract', $index); $index++) { $locale = $node->getAttribute('locale'); if ($locale == '') { $locale = $conferencePrimaryLocale; } elseif (!in_array($locale, $conferenceSupportedLocales)) { $errors[] = array('plugins.importexport.native.import.error.paperAbstractLocaleUnsupported', array('paperTitle' => $paper->getLocalizedTitle(), 'locale' => $locale)); return false; } $paper->setAbstract($node->getValue(), $locale); } if ($indexingNode = $paperNode->getChildByName('indexing')) { for ($index = 0; $node = $indexingNode->getChildByName('discipline', $index); $index++) { $locale = $node->getAttribute('locale'); if ($locale == '') { $locale = $conferencePrimaryLocale; } elseif (!in_array($locale, $conferenceSupportedLocales)) { $errors[] = array('plugins.importexport.native.import.error.paperDisciplineLocaleUnsupported', array('paperTitle' => $paper->getLocalizedTitle(), 'locale' => $locale)); return false; } $paper->setDiscipline($node->getValue(), $locale); } for ($index = 0; $node = $indexingNode->getChildByName('type', $index); $index++) { $locale = $node->getAttribute('locale'); if ($locale == '') { $locale = $conferencePrimaryLocale; } elseif (!in_array($locale, $conferenceSupportedLocales)) { $errors[] = array('plugins.importexport.native.import.error.paperTypeLocaleUnsupported', array('paperTitle' => $paper->getLocalizedTitle(), 'locale' => $locale)); return false; } $paper->setType($node->getValue(), $locale); } for ($index = 0; $node = $indexingNode->getChildByName('subject', $index); $index++) { $locale = $node->getAttribute('locale'); if ($locale == '') { $locale = $conferencePrimaryLocale; } elseif (!in_array($locale, $conferenceSupportedLocales)) { $errors[] = array('plugins.importexport.native.import.error.paperSubjectLocaleUnsupported', array('paperTitle' => $paper->getLocalizedTitle(), 'locale' => $locale)); return false; } $paper->setSubject($node->getValue(), $locale); } for ($index = 0; $node = $indexingNode->getChildByName('subject_class', $index); $index++) { $locale = $node->getAttribute('locale'); if ($locale == '') { $locale = $conferencePrimaryLocale; } elseif (!in_array($locale, $conferenceSupportedLocales)) { $errors[] = array('plugins.importexport.native.import.error.paperSubjectClassLocaleUnsupported', array('paperTitle' => $paper->getLocalizedTitle(), 'locale' => $locale)); return false; } $paper->setSubjectClass($node->getValue(), $locale); } if ($coverageNode = $indexingNode->getChildByName('coverage')) { for ($index = 0; $node = $coverageNode->getChildByName('geographical', $index); $index++) { $locale = $node->getAttribute('locale'); if ($locale == '') { $locale = $conferencePrimaryLocale; } elseif (!in_array($locale, $conferenceSupportedLocales)) { $errors[] = array('plugins.importexport.native.import.error.paperCoverageGeoLocaleUnsupported', array('paperTitle' => $paper->getLocalizedTitle(), 'locale' => $locale)); return false; } $paper->setCoverageGeo($node->getValue(), $locale); } for ($index = 0; $node = $coverageNode->getChildByName('chronological', $index); $index++) { $locale = $node->getAttribute('locale'); if ($locale == '') { $locale = $conferencePrimaryLocale; } elseif (!in_array($locale, $conferenceSupportedLocales)) { $errors[] = array('plugins.importexport.native.import.error.paperCoverageChronLocaleUnsupported', array('paperTitle' => $paper->getLocalizedTitle(), 'locale' => $locale)); return false; } $paper->setCoverageChron($node->getValue(), $locale); } for ($index = 0; $node = $coverageNode->getChildByName('sample', $index); $index++) { $locale = $node->getAttribute('locale'); if ($locale == '') { $locale = $conferencePrimaryLocale; } elseif (!in_array($locale, $conferenceSupportedLocales)) { $errors[] = array('plugins.importexport.native.import.error.paperCoverageSampleLocaleUnsupported', array('paperTitle' => $paper->getLocalizedTitle(), 'locale' => $locale)); return false; } $paper->setCoverageSample($node->getValue(), $locale); } } } for ($index = 0; $node = $paperNode->getChildByName('sponsor', $index); $index++) { $locale = $node->getAttribute('locale'); if ($locale == '') { $locale = $conferencePrimaryLocale; } elseif (!in_array($locale, $conferenceSupportedLocales)) { $errors[] = array('plugins.importexport.native.import.error.paperSponsorLocaleUnsupported', array('paperTitle' => $paper->getLocalizedTitle(), 'locale' => $locale)); return false; } $paper->setSponsor($node->getValue(), $locale); } if ($node = $paperNode->getChildByName('pages')) { $paper->setPages($node->getValue()); } if ($language = $paperNode->getAttribute('language')) { $paper->setLanguage($language); } /* --- Handle authors --- */ $hasErrors = false; for ($index = 0; $node = $paperNode->getChildByName('author', $index); $index++) { if (!NativeImportDom::handleAuthorNode($conference, $schedConf, $node, $track, $paper, $authorErrors)) { $errors = array_merge($errors, $authorErrors); $hasErrors = true; } } if ($hasErrors) { return false; } $paperDao->insertPaper($paper); $dependentItems[] = array('paper', $paper); // Log the import in the paper event log. import('paper.log.PaperLog'); import('paper.log.PaperEventLogEntry'); PaperLog::logEvent($paper->getId(), PAPER_LOG_PAPER_IMPORT, PAPER_LOG_DEFAULT, 0, 'log.imported', array('userName' => $user->getFullName(), 'paperId' => $paper->getId())); // Insert published paper entry. $publishedPaper = new PublishedPaper(); $publishedPaper->setPaperId($paper->getId()); $publishedPaper->setSchedConfId($schedConf->getId()); if ($node = $paperNode->getChildByName('date_published')) { $publishedDate = strtotime($node->getValue()); if ($publishedDate === -1) { $errors[] = array('plugins.importexport.native.import.error.invalidDate', array('value' => $node->getValue())); return false; } else { $publishedPaper->setDatePublished($publishedDate); } } $node = $paperNode->getChildByName('open_access'); $publishedPaper->setSeq(REALLY_BIG_NUMBER); $publishedPaper->setViews(0); $publishedPaper->setPublicPaperId($paperNode->getAttribute('public_id')); $publishedPaper->setPubId($publishedPaperDao->insertPublishedPaper($publishedPaper)); $publishedPaperDao->resequencePublishedPapers($track->getId(), $schedConf->getId()); /* --- Galleys (html or otherwise handled simultaneously) --- */ import('file.PaperFileManager'); $paperFileManager = new PaperFileManager($paper->getId()); /* --- Handle galleys --- */ $hasErrors = false; $galleyCount = 0; for ($index = 0; $index < count($paperNode->children); $index++) { $node =& $paperNode->children[$index]; if ($node->getName() == 'htmlgalley') { $isHtml = true; } elseif ($node->getName() == 'galley') { $isHtml = false; } else { continue; } if (!NativeImportDom::handleGalleyNode($conference, $schedConf, $node, $track, $paper, $galleyErrors, $isCommandLine, $isHtml, $galleyCount, $paperFileManager)) { $errors = array_merge($errors, $galleyErrors); $hasErrors = true; } $galleyCount++; } if ($hasErrors) { return false; } /* --- Handle supplemental files --- */ $hasErrors = false; for ($index = 0; $node = $paperNode->getChildByName('supplemental_file', $index); $index++) { if (!NativeImportDom::handleSuppFileNode($conference, $schedConf, $node, $track, $paper, $suppFileErrors, $isCommandLine, $paperFileManager)) { $errors = array_merge($errors, $suppFileErrors); $hasErrors = true; } } if ($hasErrors) { return false; } // Index the inserted paper. import('search.PaperSearchIndex'); PaperSearchIndex::indexPaperMetadata($paper); PaperSearchIndex::indexPaperFiles($paper); return true; }
/** * Constructor. */ function AuthorSubmission() { parent::Paper(); $this->reviewAssignments = array(); }
function display(&$args) { $conference =& Request::getConference(); $schedConf =& Request::getSchedConf(); AppLocale::requireComponents(array(LOCALE_COMPONENT_APPLICATION_COMMON, LOCALE_COMPONENT_PKP_SUBMISSION, LOCALE_COMPONENT_PKP_USER, LOCALE_COMPONENT_OCS_MANAGER)); header('content-type: text/comma-separated-values; charset=utf-8'); header('content-disposition: attachment; filename=report.csv'); $paperReportDao =& DAORegistry::getDAO('PaperReportDAO'); list($papersIterator, $authorsIterator, $decisionsIteratorsArray) = $paperReportDao->getPaperReport($conference->getId(), $schedConf->getId()); $maxAuthors = $this->getMaxAuthorCount($authorsIterator); $decisions = array(); foreach ($decisionsIteratorsArray as $decisionsIterator) { while ($row =& $decisionsIterator->next()) { $decisions[$row['paper_id']] = $row['decision']; } } AppLocale::requireComponents(array(LOCALE_COMPONENT_OCS_DIRECTOR)); import('classes.paper.Paper'); $decisionMessages = array(SUBMISSION_DIRECTOR_DECISION_INVITE => __('director.paper.decision.invitePresentation'), SUBMISSION_DIRECTOR_DECISION_ACCEPT => __('director.paper.decision.accept'), SUBMISSION_DIRECTOR_DECISION_PENDING_REVISIONS => __('director.paper.decision.pendingRevisions'), SUBMISSION_DIRECTOR_DECISION_DECLINE => __('director.paper.decision.decline'), null => __('plugins.reports.papers.nodecision')); $columns = array('paper_id' => __('paper.submissionId'), 'title' => __('paper.title'), 'abstract' => __('paper.abstract')); for ($a = 1; $a <= $maxAuthors; $a++) { $columns = array_merge($columns, array('fname' . $a => __('user.firstName') . " (" . __('user.role.author') . " {$a})", 'mname' . $a => __('user.middleName') . " (" . __('user.role.author') . " {$a})", 'lname' . $a => __('user.lastName') . " (" . __('user.role.author') . " {$a})", 'country' . $a => __('common.country') . " (" . __('user.role.author') . " {$a})", 'affiliation' . $a => __('user.affiliation') . " (" . __('user.role.author') . " {$a})", 'email' . $a => __('user.email') . " (" . __('user.role.author') . " {$a})", 'url' . $a => __('user.url') . " (" . __('user.role.author') . " {$a})", 'biography' . $a => __('user.biography') . " (" . __('user.role.author') . " {$a})")); } $columns = array_merge($columns, array('track_title' => __('track.title'), 'language' => __('common.language'), 'director_decision' => __('submission.directorDecision'), 'start_time' => __('manager.scheduler.startTime'), 'end_time' => __('manager.scheduler.endTime'), 'building' => __('manager.scheduler.building'), 'room' => __('manager.scheduler.room'), 'status' => __('common.status'))); $fp = fopen('php://output', 'wt'); String::fputcsv($fp, array_values($columns)); import('paper.Paper'); // Bring in getStatusMap function $statusMap =& Paper::getStatusMap(); $controlledVocabDao =& DAORegistry::getDAO('ControlledVocabDAO'); $sessionTypes = $controlledVocabDao->enumerateBySymbolic('paperType', ASSOC_TYPE_SCHED_CONF, $schedConf->getId()); // Load building and room data $buildingDao =& DAORegistry::getDAO('BuildingDAO'); $roomDao =& DAORegistry::getDAO('RoomDAO'); $buildings = $rooms = array(); $buildingsIterator =& $buildingDao->getBuildingsBySchedConfId($schedConf->getId()); while ($building =& $buildingsIterator->next()) { $buildingId = $building->getId(); $buildings[$buildingId] =& $building; $roomsIterator =& $roomDao->getRoomsByBuildingId($buildingId); while ($room =& $roomsIterator->next()) { $roomId = $room->getId(); $rooms[$roomId] =& $room; unset($room); } unset($building); unset($roomsIterator); } unset($buildingsIterator); $authorIndex = 0; while ($row =& $papersIterator->next()) { if (isset($authorsIterator[$row['paper_id']])) { $authorIterator =& $authorsIterator[$row['paper_id']]; $authors = $this->mergeAuthors($authorIterator->toArray()); } else { // No authors for a submission. $authors = array(); } unset($authorIterator); foreach ($columns as $index => $junk) { if ($index == 'director_decision') { if (isset($decisions[$row['paper_id']])) { $columns[$index] = $decisionMessages[$decisions[$row['paper_id']]]; } else { $columns[$index] = $decisionMessages[null]; } } elseif ($index == 'status') { $columns[$index] = __($statusMap[$row[$index]]); } elseif ($index == 'abstract' || $index == 'title' || $index == 'affiliation') { $columns[$index] = html_entity_decode(strip_tags($row[$index]), ENT_QUOTES, 'UTF-8'); } elseif ($index == 'start_time' || $index == 'end_time') { $columns[$index] = $row[$index]; } elseif ($index == 'building') { $columns['building'] = ''; $room =& $rooms[$row['room_id']]; if ($room) { $building =& $buildings[$room->getBuildingId()]; if ($building) { $columns[$index] = $building->getBuildingName(); } } unset($room, $building); } elseif ($index == 'room') { $columns['room'] = ''; $room =& $rooms[$row['room_id']]; if ($room) { $columns[$index] = $room->getRoomName(); } unset($room); } elseif (strstr($index, 'biography') !== false) { // "Convert" HTML to text for export $columns[$index] = isset($authors[$index]) ? html_entity_decode(strip_tags($authors[$index]), ENT_QUOTES, 'UTF-8') : ''; } else { if (isset($row[$index])) { $columns[$index] = $row[$index]; } else { if (isset($authors[$index])) { $columns[$index] = $authors[$index]; } else { $columns[$index] = ''; } } } } String::fputcsv($fp, $columns); $authorIndex++; unset($row); } fclose($fp); }
/** * List of papers with their reviews */ private function papersReviews($view, $templateName, $html = true, $anonymized = false) { $db = Zend_Db_Table::getDefaultAdapter(); $paperTbl = new Paper(); $paperStatusTbl = new PaperStatus(); $criteriaTbl = new Criteria(); $reviewTbl = new Review(); $reviewMarkTbl = new ReviewMark(); $registry = Zend_registry::getInstance(); $config = $registry->get("Config"); $config->putInView($view); // Set the mail types $view->someUser = Mail::SOME_USER; // Extract the block for each paper $view->setBlock($templateName, "PAPER_DETAIL", "PAPERS"); $view->setBlock($templateName, "REVIEW_CRITERIA", "REVIEW_CRITERIAS"); $view->setBlock("PAPER_DETAIL", "PAPER_INFO", "PAPER_DATA"); $view->setBlock("PAPER_DETAIL", "REVIEW_MARK", "REVIEW_MARKS"); $view->setBlock("PAPER_DETAIL", "REVIEWER", "REVIEWER_INFO"); // Header of the table, taken from table Criteria $criterias = $criteriaTbl->fetchAll(); $listCriterias = array(); foreach ($criterias as $criteria) { $criteria->putInView($view); $listCriterias[] = $criteria; $view->append("REVIEW_CRITERIAS", "REVIEW_CRITERIA"); } // Sort the papers on the average 'overall' field $query = "SELECT p.*, round(AVG(overall),4) AS overall " . "FROM Paper p LEFT JOIN Review r ON p.id=r.idPaper " . " WHERE inCurrentSelection='Y' GROUP BY p.id"; $result = $db->query($query); $arrPaper = $rankPaper = array(); while ($paper = $result->fetch(Zend_Db::FETCH_OBJ)) { $arrPaper[$paper->id] = $paper; $rankPaper[$paper->id] = $paper->overall; } // Get the status list $statusList = $db->fetchPairs("SELECT * FROM PaperStatus WHERE final_status='Y'"); // Sort in descending order arsort($rankPaper); reset($rankPaper); // List the papers in order $iPaper = 0; foreach ($rankPaper as $idPaper => $overall) { $paper = $arrPaper[$idPaper]; // Choose the CSS class $view->css_class = Config::CssCLass($iPaper++); $view->paper_id = $paper->id; $view->paper_title = $paper->title; if (!$anonymized) { $view->paper_authors = PaperRow::getPaperAuthors($db, $paper); } else { $view->paper_authors = "[anonymized]"; } $view->paper_email_contact = $paper->emailContact; $view->paper_rank = $iPaper; $view->paper_overall = $overall; $view->form_status = Zmax_View_Phplib::checkboxField("radio", "status[{$paper->id}]", $statusList, $paper->status, array("length" => 2)); // Now, loop on reviews $qRev = "SELECT * FROM Review r, User u " . " WHERE idPaper='{$paper->id}' AND u.id=r.id_user"; $resRev = $db->query($qRev); $countReviews = 0; $mail_reviewers = $comma = ""; while ($review = $resRev->fetch(Zend_Db::FETCH_OBJ)) { $countReviews++; $mail_reviewers .= $comma . $review->email; $comma = ", "; } $view->paper_nb_reviewers = Max(1, $countReviews); //echo "Mail reviewers = $mail_reviewers<br/>"; $view->paper_email_reviewers = $mail_reviewers; $view->append("PAPER_DATA", "PAPER_INFO"); $resRev = $db->query($qRev); $iReview = 0; while ($review = $resRev->fetch(Zend_Db::FETCH_OBJ)) { $iReview++; $view->reviewer_id = $review->id; if ($anonymized == false) { $view->reviewer_fname = $review->first_name; $view->reviewer_lname = $review->last_name; $view->external_reviewer_fname = $review->fname_ext_reviewer; $view->external_reviewer_lname = $review->lname_ext_reviewer; $view->review_comments = $review->comments; } else { $view->reviewer_fname = $iReview; $view->reviewer_lname = ""; $view->external_reviewer_fname = ""; $view->external_reviewer_lname = ""; $view->review_comments = ""; } $view->reviewer_email = $review->email; $view->review_overall = $review->overall; $view->review_summary = $review->summary; $view->review_details = $review->details; if ($review->reviewerExpertise >= 1 and $review->reviewerExpertise <= 3) { $view->reviewer_expertise = Config::$Expertise[$review->reviewerExpertise]; } // Avoid to introduce Latex commands in Latex files .... if (!$html) { $view->review_summary = str_replace("\\", "", $view->review_summary); $view->review_details = str_replace("\\", "", $view->review_details); $view->review_comments = str_replace("\\", "", $view->review_comments); } $view->assign("REVIEWER_INFO", "REVIEWER"); reset($listCriterias); $view->set_var("REVIEW_MARKS", ""); foreach ($listCriterias as $criteria) { $reviewMark = $reviewMarkTbl->find($review->idPaper, $review->id_user, $criteria->id)->current(); if (!is_object($reviewMark)) { $reviewMark = $reviewMarkTbl->createRow(); // for default values } $reviewMark->putInView($view); $view->criteria_label = $criteria->label; $view->append("REVIEW_MARKS", "REVIEW_MARK"); } $view->append("PAPERS", "PAPER_DETAIL"); // The paper data is shown only once for all the reviews $view->set_var("PAPER_DATA", " "); } // Show the paper even without reviewer if ($countReviews == 0) { $review = $reviewTbl->createRow(); $review->putInView($view); $view->set_var("REVIEW_MARKS", ""); foreach ($listCriterias as $id => $label) { $reviewMark = $reviewMarkTbl->createRow(); $reviewMark->putInView($view); $view->append("REVIEW_MARKS", "REVIEW_MARK"); } $view->set_var("REVIEWER_INFO", ""); $view->append("PAPERS", "PAPER_DETAIL"); $view->set_var("PAPER_DATA", ""); } // Summary for the paper if ($html) { $statPaper = Paper::getStats($paper->id, $listCriterias); $markFieldName = "ReviewMark" . "->mark"; $overallFieldName = "review_overall"; $view->set_var("NB_REVIEWERS", 1); if ($html) { $view->set_var("PAPER_DATA", "<td> </td><th>Summary</th>"); } $view->set_var("REVIEWER_INFO", " "); $view->set_var($overallFieldName, $paper->overall); reset($listCriterias); $view->set_var("REVIEW_MARKS", ""); foreach ($listCriterias as $c) { $view->setVar($markFieldName, $statPaper[$c->id]); $view->append("REVIEW_MARKS", "REVIEW_MARK"); } $view->append("PAPERS", "PAPER_DETAIL"); $view->set_var("PAPER_DATA", ""); } } }
* The Initial Developer of the Original Code is C3CRM Team. * Portions created by C3CRM are Copyright (C) 2005 C3CRM * All Rights Reserved. * Contributors: Goodwill Consulting http://www.goodwill.co.id ********************************************************************************/ require_once 'XTemplate/xtpl.php'; require_once 'data/Tracker.php'; require_once 'modules/Paper/Paper.php'; require_once 'modules/Paper/Forms.php'; require_once 'include/JSON.php'; require_once 'modules/Paperformat/Paperformat.php'; global $app_strings; global $app_list_strings; global $mod_strings; global $current_user; $focus = new Paper(); $format = new Paperformat(); if (isset($_REQUEST['record'])) { $focus->retrieve($_REQUEST['record']); } if (isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') { $focus->id = ""; } echo "\n<p>\n"; echo get_module_title($mod_strings['LBL_MODULE_NAME'], $mod_strings['LBL_MODULE_NAME'] . ": " . $focus->fname, true); echo "\n</p>\n"; global $theme; $theme_path = "themes/" . $theme . "/"; $image_path = $theme_path . "images/"; require_once $theme_path . 'layout_utils.php'; $log->info("Paper detail view");
/** * Import papers (including metadata and files). */ function importPapers() { if ($this->hasOption('verbose')) { printf("Importing papers\n"); } import('classes.file.PaperFileManager'); import('classes.search.PaperSearchIndex'); $userDao =& DAORegistry::getDAO('UserDAO'); $roleDao =& DAORegistry::getDAO('RoleDAO'); $trackDao =& DAORegistry::getDAO('TrackDAO'); $paperDao =& DAORegistry::getDAO('PaperDAO'); $publishedPaperDao =& DAORegistry::getDAO('PublishedPaperDAO'); $galleyDao =& DAORegistry::getDAO('PaperGalleyDAO'); $unassignedTrackId = null; $result =& $this->importDao->retrieve('SELECT * FROM papers ORDER by id'); while (!$result->EOF) { $row =& $result->fields; $schedConf =& $this->schedConfMap[$row['cf']]; $schedConfId = $schedConf->getId(); // Bring in the primary user for this paper. $user = $userDao->getUserByUsername(Core::cleanVar($row['login'])); if (!$user) { unset($user); $user = new User(); $user->setUsername(Core::cleanVar($row['login'])); $user->setFirstName(Core::cleanVar($row['first_name'])); $user->setLastName(Core::cleanVar($row['surname'])); $user->setAffiliation(Core::cleanVar($row['affiliation']), Locale::getLocale()); $user->setEmail(Core::cleanVar($row['email'])); $user->setUrl(Core::cleanVar($row['url'])); $user->setBiography(Core::cleanVar($row['bio']), Locale::getLocale()); $user->setLocales(array()); $user->setDateRegistered($row['created']); $user->setDateLastLogin($row['created']); $user->setMustChangePassword(1); $password = Validation::generatePassword(); $user->setPassword(Validation::encryptCredentials($user->getUsername(), $password)); if ($this->hasOption('emailUsers')) { import('classes.mail.MailTemplate'); $mail = new MailTemplate('USER_REGISTER'); $mail->setFrom($schedConf->getSetting('contactEmail'), $schedConf->getSetting('contactName')); $mail->assignParams(array('username' => $user->getUsername(), 'password' => $password, 'conferenceName' => $schedConf->getFullTitle())); $mail->addRecipient($user->getEmail(), $user->getFullName()); $mail->send(); } $user->setDisabled(0); $otherUser =& $userDao->getUserByEmail(Core::cleanVar($row['email'])); if ($otherUser !== null) { // User exists with this email -- munge it to make unique $user->setEmail('ocs-' . Core::cleanVar($row['login']) . '+' . Core::cleanVar($row['email'])); $this->conflicts[] = array(&$otherUser, &$user); } unset($otherUser); $userDao->insertUser($user); // Make this user a author $role = new Role(); $role->setSchedConfId($schedConf->getId()); $role->setConferenceId($schedConf->getConferenceId()); $role->setUserId($user->getId()); $role->setRoleId(ROLE_ID_AUTHOR); $roleDao->insertRole($role); unset($role); } $userId = $user->getId(); // Bring in the basic entry for the paper $paper = new Paper(); $paper->setUserId($userId); $paper->setLocale(Locale::getPrimaryLocale()); $paper->setSchedConfId($schedConfId); $oldTrackId = $row['primary_track_id']; if (!$oldTrackId || !isset($this->trackMap[$oldTrackId])) { $oldTrackId = $row['secondary_track_id']; } if (!$oldTrackId || !isset($this->trackMap[$oldTrackId])) { if (!$unassignedTrackId) { // Create an "Unassigned" track to use for submissions // that didn't have a track in OCS 1.x. $track = new Track(); $track->setSchedConfId($schedConf->getId()); $track->setTitle('UNASSIGNED', Locale::getLocale()); $track->setSequence(REALLY_BIG_NUMBER); $track->setDirectorRestricted(1); $track->setMetaReviewed(1); $unassignedTrackId = $trackDao->insertTrack($track); } $newTrackId = $unassignedTrackId; } else { $newTrackId = $this->trackMap[$oldTrackId]; } $paper->setTrackId($newTrackId); $paper->setTitle(Core::cleanVar($row['title']), Locale::getLocale()); $paper->setAbstract(Core::cleanVar($row['abstract']), Locale::getLocale()); $paper->setDiscipline(Core::cleanVar($row['discipline']), Locale::getLocale()); $paper->setSponsor(Core::cleanVar($row['sponsor']), Locale::getLocale()); $paper->setSubject(Core::cleanVar($row['topic']), Locale::getLocale()); $paper->setLanguage(Core::cleanVar($row['language'])); $paper->setDateSubmitted($row['created']); $paper->setDateStatusModified($row['timestamp']); // $paper->setTypeConst($row['present_format'] == 'multiple' ? SUBMISSION_TYPE_PANEL : SUBMISSION_TYPE_SINGLE); FIXME $paper->setCurrentRound(REVIEW_ROUND_ABSTRACT); $paper->setSubmissionProgress(0); $paper->setPages(''); // Bring in authors $firstNames = split("\n", Core::cleanVar($row['first_name'] . "\n" . $row['add_first_names'])); $lastNames = split("\n", Core::cleanVar($row['surname'] . "\n" . $row['add_surnames'])); $emails = split("\n", Core::cleanVar($row['email'] . "\n" . $row['add_emails'])); $affiliations = split("\n", Core::cleanVar($row['affiliation'] . "\n" . $row['add_affiliations'])); $urls = split("\n", Core::cleanVar($row['url'] . "\n" . $row['add_urls'])); foreach ($emails as $key => $email) { if (empty($email)) { continue; } $author = new Author(); $author->setEmail($email); $author->setFirstName($firstNames[$key]); $author->setLastName($lastNames[$key]); $author->setAffiliation($affiliations[$key], Locale::getLocale()); @$author->setUrl($urls[$key]); // Suppress warnings from inconsistent OCS 1.x data $author->setPrimaryContact($key == 0 ? 1 : 0); $paper->addAuthor($author); unset($author); } switch ($row['accepted']) { case 'true': $paper->setStatus(STATUS_PUBLISHED); $paperId = $paperDao->insertPaper($paper); $publishedPaper = new PublishedPaper(); $publishedPaper->setPaperId($paperId); $publishedPaper->setSchedConfId($schedConfId); $publishedPaper->setDatePublished(Core::getCurrentDate()); $publishedPaper->setSeq(REALLY_BIG_NUMBER); $publishedPaper->setViews(0); $publishedPaperDao->insertPublishedPaper($publishedPaper); $publishedPaperDao->resequencePublishedPapers($paper->getTrackId(), $schedConfId); break; case 'reject': $paper->setStatus(STATUS_DECLINED); $paperId = $paperDao->insertPaper($paper); break; default: $paper->setStatus(STATUS_QUEUED); $paperId = $paperDao->insertPaper($paper); } $this->paperMap[$row['id']] =& $paper; $paperFileManager = new PaperFileManager($paperId); if (!empty($row['paper']) && $row['paper'] != 'PDF') { $format = 'text/html'; $extension = $paperFileManager->getDocumentExtension($format); $fileId = $paperFileManager->writeSubmissionFile('migratedFile' . $extension, $row['paper'], $format); $paper->setSubmissionFileId($fileId); $paperDao->updatePaper($paper); $fileId = $paperFileManager->writePublicFile('migratedGalley' . $extension, $row['paper'], $format); PaperSearchIndex::updateFileIndex($paperId, PAPER_SEARCH_GALLEY_FILE, $fileId); if (strstr($format, 'html')) { $galley = new PaperHTMLGalley(); $galley->setLabel('HTML'); } else { $galley = new PaperGalley(); switch ($format) { case 'application/pdf': $galley->setLabel('PDF'); break; case 'application/postscript': $galley->setLabel('PostScript'); break; case 'application/msword': $galley->setLabel('Word'); break; case 'text/xml': $galley->setLabel('XML'); break; case 'application/powerpoint': $galley->setLabel('Slideshow'); break; default: $galley->setLabel('Untitled'); break; } } $galley->setLocale(Locale::getLocale()); $galley->setPaperId($paperId); $galley->setFileId($fileId); $galleyDao->insertGalley($galley); unset($galley); } elseif ($row['paper'] == 'PDF') { $fileId = $paperFileManager->copySubmissionFile($this->importPath . '/papers/' . $row['pdf'], 'application/pdf'); $paper->setSubmissionFileId($fileId); $paperDao->updatePaper($paper); $fileId = $paperFileManager->copyPublicFile($this->importPath . '/papers/' . $row['pdf'], 'application/pdf'); PaperSearchIndex::updateFileIndex($paperId, PAPER_SEARCH_GALLEY_FILE, $fileId); $galley = new PaperGalley(); $galley->setLabel('PDF'); $galley->setLocale(Locale::getLocale()); $galley->setPaperId($paperId); $galley->setFileId($fileId); $galleyDao->insertGalley($galley); unset($galley); } // FIXME: The following fields from OCS 1.x are UNUSED: // program_insert approach coverage format relation appendix_names appendix_dates // appendix appendix_pdf secondary_track_id multiple_* restrict_access paper_email // delete_paper comment_email unset($user); unset($paper); unset($schedConf); unset($paperFileManager); $result->MoveNext(); } $result->Close(); }
<!--最新专题 start--> <?php $papers = $diseasePage->getPaperListByCategory4HospitalPage(); $paperList = Paper::filterPicOfPapers($papers); if (false == empty($paperList)) { ?> <div class="cate_box2 mb30"> <div class="clearfix cate_title2"> <p class="module2"><a href="<?=$diseasePage::getZhuantiUrl($disease->key, '')?>" target="_blank">最新专题</a></p> <p class="fr pt5"> <a target="_blank" href="<?=$diseasePage::getZhuantiUrl($disease->key, '')?>" class="fs">更多<span class="f8">>></span></a> </p> <i class="b_arrow3"></i> </div> <div class="gray2 fs hdf_visit"> <ul class="visit_box"> <?php $i = 0;
/** * Constructor. */ function TrackDirectorSubmission() { parent::Paper(); $this->reviewAssignments = array(); $this->removedReviewAssignments = array(); }
/** * 查看题目信息 * @param unknown $name * @throws Exception * @return boolean */ public static function checkTKByName($name) { if (self::dataFormatCheck($name) != 1) { throw new Exception("input type is not available!"); } $name = strtoupper(trim($name)); try { $number = 0; switch ($name) { case 'SPM': $number = 60; break; case 'CPI': $number = 230; break; case 'EPQA': $number = 88; break; case 'EPPS': $number = 225; break; case '16PF': $number = 187; break; case 'SCL': $number = 90; break; default: throw new Exception("no this Type data"); } $paper_record = Paper::getListByName($name); if (isset($paper_record->id)) { $data = Question::find(array("paper_id = :paper_id:", 'bind' => array('paper_id' => intval($paper_record->id)))); $data_count = count($data); if ($data_count == 0) { echo "{$name} 数据为空"; return true; } else { if ($data_count == $number) { echo "<h1>" . $name . "题库</h1>"; foreach ($data as $record) { echo "题目编号 <span style='color:red'>" . $record->id; echo "</span><br />"; echo "题目内容 " . $record->topic; echo "<br />"; echo "题目选项 " . $record->options; echo "<br />"; echo "题目所在试卷的题号 <strong>" . $record->number; echo "</strong><br />"; echo "题目所在的试卷好 " . $record->paper_id; echo "<hr />"; } } else { throw new Exception("Database Error or link error"); } } } } catch (Exception $e) { echo $e->getMessage(); } }
private function getCurrentSelection() { $db = Zend_Db_Table::getDefaultAdapter(); $paperTbl = new Paper(); // Initialize the current selection $db->query("UPDATE Paper SET inCurrentSelection='N'"); // crWhere : applies to selection on paper // crJoin : applies to outer join Paper Review $crJoin = $crWhere = " 1 = 1 "; if (isset($_POST['paperQuestions'])) { $paperQuestions = $_POST['paperQuestions']; } else { $paperQuestions = array(); } if (isset($_POST['reviewQuestions'])) { $reviewQuestions = $_POST['reviewQuestions']; } else { $reviewQuestions = array(); } // Take into account the filtering criterias. if ($this->papersWithStatus == SP_ANY_STATUS) { $crWhere .= ""; } else { if ($this->papersWithStatus == SP_NOT_YET_ASSIGNED) { $crWhere .= " AND p.status IS NULL"; // EXISTS (SELECT 'c' FROM PaperStatus s WHERE p.status=s.id AND final_status !='Y') "; } else { $crWhere .= " AND status='" . $this->papersWithStatus . "'"; } } // Full text search on titles? if ($this->papersWithTitle != "Any") { $crWhere .= " AND title LIKE '%" . $this->papersWithTitle . "%' "; } // Show uploaded or not yet uploaded papers? if ($this->papersUploaded == "Y") { $crWhere .= " AND isUploaded = 'Y' "; } if ($this->papersUploaded == "N") { $crWhere .= " AND isUploaded = 'N' "; } // Show papers for a specific reviewer? if ($this->papersWithReviewer != "All") { $crWhere .= " AND id_user='******' "; } // Sort the papers on the average 'overall' field $query = "SELECT DISTINCT p.* FROM Paper p LEFT JOIN Review r ON p.id=r.idPaper" . " WHERE {$crWhere} "; $res = $db->query($query); while ($p = $res->fetch(Zend_Db::FETCH_OBJ)) { $paper = $paperTbl->find($p->id)->current(); $keep = $keep2 = $keep3 = $keep4 = $keep5 = false; $keep6 = $keep7 = true; // Should we consider conflicts? if ($this->papersWithConflict == "Y" and $this->paperInConflict($paper->id)) { $keep = true; } else { if ($this->papersWithConflict == "N" and $this->paperInConflict($paper->id)) { $keep = true; } else { if ($this->papersWithConflict == "A") { $keep = true; } } } // Should we consider missing review? if ($this->papersWithMissingReview == "Y" and $this->missingReview($paper->id)) { $keep2 = true; } else { if ($this->papersWithMissingReview == "N" and !$this->missingReview($paper->id)) { $keep2 = true; } else { if ($this->papersWithMissingReview == "A") { $keep2 = true; } } } // Take care of the filter $overall = $paper->averageMark(); if ($this->papersWithFilter == SP_ABOVE_FILTER and $overall >= $this->papersWithRate) { $keep3 = true; } else { if ($this->papersWithFilter == SP_BELOW_FILTER and $overall <= $this->papersWithRate) { $keep3 = true; } else { if ($this->papersWithFilter == 0) { $keep3 = true; } } } // Take care of authors if ($this->papersWithAuthor != "Any" and !empty($this->papersWithAuthor)) { $authors = $paper->getAuthors(); if (strpos($authors, $this->papersWithAuthor)) { $keep4 = true; } } else { $keep4 = true; } // Show papers for a specific topic? if ($this->papersWithTopic != 0) { $the_topic = $this->papersWithTopic; if ($paper->topic == $the_topic) { $keep5 = true; // OK with the main topic } else { /* FROM V1 -- NO LONGER USED $rt = $db->query ("SELECT * FROM PaperTopic WHERE id_paper='$paper->id' " . " AND id_topic='$the_topic'"); if ($db->objetSuivant($rt)) $keep5 = true; // found in other topics else $keep5 = false; */ } } else { $keep5 = true; } // Now look at the paper question reset($paperQuestions); foreach ($paperQuestions as $id_question => $id_choice) { if ($id_choice != SP_ANY_CHOICE) { // Check that the paper's answer matches the choice $rq = $db->query("SELECT * FROM PaperAnswer WHERE id_paper='{$paper->id}' " . "AND id_question='{$id_question}' AND id_answer='{$id_choice}'"); if (!is_object($rq->fetch(Zend_Db::FETCH_OBJ))) { $keep6 = false; break; } // No need to look further } } // Now look at the review question reset($reviewQuestions); foreach ($reviewQuestions as $id_question => $id_choice) { if ($id_choice != SP_ANY_CHOICE) { // Check that some reviewer's answer matches the choice $rq = $db->query("SELECT * FROM Review r, ReviewAnswer a " . " WHERE id_paper='{$paper->id}' AND r.id_user=a.id_user " . "AND id_question='{$id_question}' AND id_answer='{$id_choice}'"); if (!is_object($rq->fetch(Zend_Db::FETCH_OBJ))) { $keep7 = false; break; } // No need to look further } } //echo "Keep= (1: $keep) (2: $keep2) (3: $keep3) (4: $keep4) (5:$keep5) (6: $keep6) (7: $keep7)<br/>"; if ($keep and $keep2 and $keep3 and $keep4 and $keep5 and $keep6 and $keep7) { // echo "Upate yes<br/>"; $qCS = "UPDATE Paper SET inCurrentSelection='Y' WHERE id='{$paper->id}'"; $db->query($qCS); } } }
} } } /** * 观察者要实现的接口 */ interface Observerable { public function update(); } class Subscriber implements Observerable { public function update() { echo "Callback\n"; } } class Subscriber1 implements Observerable { public function update() { echo "test22222\n"; } } //下面是测试代码 /* 测试 */ $paper = new Paper(); $paper->register(new Subscriber()); $paper->register(new Subscriber1()); //$paper->register(new Subscriber2()); $paper->trigger();
public function writeprojectdetailAction() { try { $manager = $this->session->get('Manager'); $project_id = $manager->project_id; #添加项目判断,是否有被试答题,若有答题则不能更新配置的模块 $result = $this->modelsManager->createBuilder()->columns(array('COUNT(Examinee.id) as count'))->from('Examinee')->join('QuestionAns', 'Examinee.id = QuestionAns.examinee_id AND Examinee.project_id = ' . $project_id)->getQuery()->execute(); $result = $result->toArray(); if ($result[0]['count'] > 0) { $this->dataReturn(array('error' => '已有被试答题,项目模块不可再修改!')); return; } if ($manager) { $module_names = array(); $checkeds = $this->request->getpost('checkeds'); $values = $this->request->getpost('values'); $i = 0; foreach ($checkeds as $value) { if ($value == 'true') { $module_names[] = PmDB::getModuleName($values[$i]); } $i++; } #全选情况 $project_detail_info = array(); $index_names = array(); if (count($module_names) == 10) { $index = Index::find(); foreach ($index as $index_record) { $index_names[] = $index_record->name; } $factor = Factor::find(); $factor_names = array(); foreach ($factor as $factor_record) { $factor_names[] = $factor_record->name; } $question = Question::find(); $examination = array(); foreach ($question as $question_record) { $paper_name = Paper::findFirst($question_record->paper_id)->name; $examination[$paper_name][] = $question_record->number; } $project_detail_info['exam_json'] = json_encode($examination, JSON_UNESCAPED_UNICODE); } else { #所有相关指标名数组 $index_names = PmDB::getIndexName($module_names); #所有相关因子名数组 $factor_names = PmDB::getFactorName($index_names); #所有相关试卷下题目的数组 $examination = PmDB::getQuestionName($factor_names); $project_detail_info['exam_json'] = json_encode($examination, JSON_UNESCAPED_UNICODE); } #因子分类 以及寻找子因子 $factors = PmDB::getAllDividedFactors($factor_names); $project_detail_info['factor_names'] = json_encode($factors, JSON_UNESCAPED_UNICODE); $project_detail_info['module_names'] = implode(',', $module_names); $project_detail_info['index_names'] = implode(',', $index_names); $project_detail_info['project_id'] = $project_id; #插入到project_detail 并更新状态 PmDB::insertProjectDetail($project_detail_info); #模块配置的类型设为true #需求量表的上传设为false $this->dataReturn(array('success' => true)); return; } else { $this->dataBack(array('error' => "您的身份验证出错!请重新登录!")); return; } } catch (Exception $e) { $this->dataReturn(array('error' => $e->getMessage())); return; } }
htmlspecialchars(file_get_contents(__FILE__))); ?> <table align="center" border="1"> <caption align="bottom">How to run and view this script</caption> <tr><td> linux command</td><td>php -S localhost:8000 Test.php </td></tr><tr><td> browse location</td><td>http://localhost:8000/ </td></tr></table> <? Paper::Equation(idlabeltex('Fun:1', 'Euler\'s identity', 'e^{i\pi}+1 = 0')); Paper::Equation(array( 'id' => 'Fun:2', 'tex' => '\nabla^2u = \frac{1}{c^2}\frac{\partial^2u}{\partial t^2}', 'label' => 'Wave equation') ); Paper::Equation(array( 'id' => 'Fun:3', 'tex' => 'F\'(x)=\lim_{\Delta x\to 0}\frac{F(x+\Delta x)-F(x)}{\Delta x}', 'label' => 'Fundamental theorem of calculus') ); ?> One fun equation is <? Paper::EqReference("Fun:1"); ?>. Another is <? Paper::EqReference("Fun:2"); ?>. For sure, <? Paper::EqReference("Fun:3"); ?> is fun too! <? Paper::FigReference("FishEye"); ?> is a strange image but <? Paper::FigReference("NGS"); ?> is more important. <? Paper::Tail(); ?> <?php