/** * Action that processes a review after submission * @author philipperigaux * */ function processreviewAction() { if (!$this->config->isPhaseOpen(Config::REVIEWING_PHASE)) { $this->view->content = $this->texts->reviewer->review_phase_is_closed; echo $this->view->render("layout"); return; } $this->view->setFile("content", "processreview.xml"); $this->view->setBlock("content", "review"); // Extract the block with marks. $this->view->set_block('review', "review_mark", "review_marks"); // Extracts the block with answers $this->view->set_block('review', "review_answer", "review_answers"); // Actions if the id of a paper is submitted if (isset($_REQUEST['idPaper'])) { $idPaper = $this->getRequest()->getParam("idPaper"); $reviewTbl = new Review(); $review = $reviewTbl->find($idPaper, $this->user->id)->current(); // Check that the paper is REALLY assigned to the reviewer if (is_object($review)) { // Put the review in the database $review->updateFromArray($_POST); // Create the review presentation $this->view->review = $review->showReview($this->view, true); // Resolve the entities replacement $this->view->assign("content", "content"); // Send a mail to confirm review submission $mail = new Mail(Mail::SOME_USER, $this->texts->mail->subj_ack_review, $this->view->getScriptPaths()); $mail->setFormat(Mail::FORMAT_HTML); $mail->setTo($this->user->email); $mail->loadTemplate($this->lang, "ack_review"); $mailViewEngine = $mail->getEngine(); // Fixes a bug: the reviewer namespace is not present, and thus 'reviewer' texts // were not translated. NB: this requires a fix ubn Zmax_Translate_Db as well $this->texts->addTranslation($this->zmax_context->db, $this->zmax_context->locale, array("namespace" => 'reviewer', "view" => $mailViewEngine)); $mailViewEngine->setBlock("template", "template_mark", "template_marks"); $mailViewEngine->setBlock("template", "template_answer", "template_answers"); $instantiatedMail = $review->showReview($mailViewEngine, true, "template"); $mail->setTemplate($instantiatedMail); if ($this->config->mailOnReview == "Y") { $mail->setCopyToChair(true); } $mail->send(); } else { $this->view->content = $this->texts->def->access_denied; } } else { $this->view->content = "Invalid action<br/>"; } echo $this->view->render("layout"); }
/** * Send the status to authors, with anonymous reviews */ function notifyAction() { $db = $this->zmax_context->db; $paperTbl = new Paper(); $paperStatusTbl = new PaperStatus(); // Load the reviews template $this->view->setFile("review", "review4author.xml"); $this->view->setBlock("review", "review_mark", "review_marks"); $this->view->setBlock("review", "review_answer", "review_answers"); // Set the subject $subject = $this->texts->mail->subj_notification; if (isset($_REQUEST['id_paper'])) { // Mail for one paper $idPaper = $_REQUEST['id_paper']; $this->view->setFile("content", "showmessage.xml"); $this->view->setBlock("content", "WARNING_TEMPLATE", " "); $paper = $paperTbl->find($idPaper)->current(); if (!empty($paper->status)) { $paper->putInView($this->view); $this->view->reviews = $paper->showReviews($this->view); $statusRow = $paperStatusTbl->find($paper->status)->current(); $mail = new Mail(Mail::SOME_USER, $subject, $this->view->getScriptPaths()); $mail->setTo($paper->emailContact); $mail->setFormat(Mail::FORMAT_HTML); $mail->loadTemplate($this->lang, $statusRow->mailTemplate); // We know the paper, so we can instantiate the mail entities $this->view->setVar("mailTemplate", $mail->getTemplate()); $this->view->assign("mailTemplate", "mailTemplate"); $mail->setTemplate($this->view->mailTemplate); // Put in the view $mail->putInView($this->view); } else { $this->content = "Cannot send notification without a status<br/>"; } echo $this->view->render("layout"); return; } else { // Batch mail. Check that all papers have a status, // and that there are no missing reviews $this->view->setFile("content", "notify.xml"); $this->view->setBlock("content", "TEMPLATE", "TEMPLATES"); $res = $db->query("SELECT count(*) AS count FROM Paper p, PaperStatus s " . " WHERE p.status = s.id AND final_status != 'Y'"); $p = $res->fetch(Zend_Db::FETCH_OBJ); if ($p->count > 0) { $this->view->content = "Cannot send notification mails: some papers do not have a status"; echo $this->view->render("layout"); exit; } $qReview = "SELECT count(*) AS count FROM Review WHERE overall IS NULL"; $res = $db->query($qReview); $p = $res->fetch(Zend_Db::FETCH_OBJ); if ($p->count > 0) { $this->view->content = "Cannot send notification mails: missing reviews"; echo $this->view->render("layout"); exit; } // OK. Now give the list of the templates that will be used $i = 0; $paperStatusList = $paperStatusTbl->fetchAll("final_status = 'Y'"); $mail = new Mail(Mail::SOME_USER, "", $this->view->getScriptPaths()); foreach ($paperStatusList as $paperStatus) { $this->view->css_class = Config::CssCLass($i++); $paperStatus->putInView($this->view); $mail->loadTemplate($this->lang, $paperStatus->mailTemplate); $this->view->setVar("template_content-{$paperStatus->id}", $mail->getTemplate()); $this->view->assign("template_content", "template_content-{$paperStatus->id}"); $this->view->append("TEMPLATES", "TEMPLATE"); } // Send the notification mails. $messages = ""; if (isset($_REQUEST['confirmed']) or isset($_REQUEST['export'])) { PaperRow::$loadAbstracts = false; $papers = $paperTbl->fetchAll(); $mail = new Mail(Mail::SOME_USER, $subject, $this->view->getScriptPaths()); $mail->setFormat(Mail::FORMAT_HTML); $mail->setCopyToChair(true); foreach ($papers as $paper) { $statusRow = $paperStatusTbl->find($paper->status)->current(); $mail->setTo($paper->emailContact); $mail->loadTemplate($this->lang, $statusRow->mailTemplate); $paper->putInView($mail->getEngine()); $mail->getEngine()->reviews = $paper->showReviews($this->view); if (isset($_REQUEST['confirmed'])) { $mail->send(); } else { $messages .= $mail->getMessage() . "\n\n"; } } } } if (isset($_REQUEST['export'])) { header("Content-disposition: attachment; filename=notificationMails.txt"); header("Content-Type: application/force-download"); header("Content-Transfer-Encoding: text\n"); header("Content-Length: " . strlen($messages)); header("Pragma: no-cache"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0, public"); header("Expires: 0"); echo $messages; } else { echo $this->view->render("layout"); } }
function acceptAction() { // Check that this is the true reviewer $email = $this->getRequest()->getParam("email"); $password = $this->getRequest()->getParam("password"); $idSession = session_id(); // Delete the curent session if any $this->deleteCurrentSession(); // Get the user, mark as "confirmed", and show some instructions $user = new User(); $this->user = $user->findByEmail($email); // User not found? Probably an attempt to enter the system without auth. if (!is_object($this->user)) { $this->_redirect($this->view->base_url . "/"); } // Set the default password $this->user->invitation_confirmed = 'Y'; $password = $this->user->defaultPassword($this->config->passwordGenerator); $this->user->password = md5($password); $this->user->save(); $this->user->putInView($this->view); // Send a message to the chair $mail = new Mail(Mail::PC_CHAIR, $this->texts->mail->subj_accept_invitation, $this->view->getScriptPaths()); $mail->setFormat(Mail::FORMAT_HTML); $mail->loadTemplate($this->lang, "accept_invitation"); $mail->getEngine()->invited_user = $this->user->fullName(); $mail->send(); // Send a message to the user with instructions $mail->setTo($email); $mail->loadTemplate($this->lang, "reviewer_instructions"); $this->config->putInView($mail->getEngine()); $mail->getEngine()->password = $password; $mail->send(); $this->view->setFile("content", "accept.xml"); echo $this->view->render("layout"); }
/** * Process a new submission */ function processAction() { if (!$this->config->submissionClosed()) { $form_mode = $this->getRequest()->getParam("form_mode"); if (empty($form_mode)) { throw new Zmax_Exception("Invalid action request (Author::process)"); } if ($this->config->two_phases_submission == "N") { $upload = true; } else { $upload = false; } // Check whether the file has been uploaded if (isset($_FILES['paper']['tmp_name']) and file_exists($_FILES['paper']['tmp_name'])) { $file = $_FILES['paper']; } else { $file = array("tmp_name" => "none"); } // Try to insert or update the paper $paper = new Paper(); $data = array("title" => $_POST['title'], "topic" => $_POST['topic'], "nb_authors_in_form" => $_POST['nb_authors_in_form']); if ($form_mode == "insert") { // Instantiate a new paper. Fill with the post params. $paperRow = $paper->createRow(); $paperRow->setFilterData(true); $paperRow->setFromArray($data); } else { // The paper exists. First: load from the DB $id = $this->getRequest()->getParam("id"); $paperRow = $paper->find($id)->current(); // Second: update its content from the form post $paperRow->updateFromArray($data); } // Look whether the user asks for an additional author if (isset($_REQUEST['addAuthor'])) { $this->view->setFile("content", "submit.xml"); $paperRow->nb_authors_in_form++; $this->view->form_mode = $form_mode; $this->view->form_submit = $paperRow->form($this->user, $this->view); echo $this->view->render("layout"); return; } // First, check the content $ok = $paperRow->checkRequest($this->user, $file, $upload, $this->zmax_context->texts); // Error? if (!$ok) { // Error reporting $this->view->setFile("content", "submit_error.xml"); $messages = $paperRow->getMessages(); $this->view->setBlock("content", "ERROR", "ERRORS"); foreach ($messages as $message) { $this->view->ERROR_MESSAGE = $message; // NB: parsing is done twice because of abstract codes indirection $this->view->assign("message", "ERROR"); $this->view->append("ERRORS", "message"); } $this->view->form_mode = $form_mode; $this->view->form_submit = $paperRow->form($this->user, $this->view); } else { // Save the paper $paperRow->saveAll(); // Put in the view $paperRow->putInView($this->view); // Store the file if any if ($upload) { // get the required file in the submission phase (assume there is only one) $requiredFileTbl = new RequiredFile(); $requiredFiles = $requiredFileTbl->fetchAll(); foreach ($requiredFiles as $requiredFile) { if ($requiredFile->id_phase == Config::SUBMISSION_PHASE and $requiredFile->file_extension == "pdf") { $required = $requiredFile; } } if (!isset($required)) { throw new Zmax_Exception("Unable to determine the file required in submission phase. Stop"); } $paperRow->storeFile($required, $file); } // Get the mail template if ($form_mode == "insert") { $mailContent = "ack_submit"; $this->view->setFile("content", "ack_submit.xml"); } else { $mailContent = "ack_edit"; $this->view->setFile("content", "ack_edit.xml"); } // Send a mail to ack the submission $mail = new Mail(Mail::SOME_USER, $this->texts->mail->subj_new_submission, $this->view->getScriptPaths()); $mail->setTo($paperRow->emailContact); $mail->loadTemplate($this->lang, $mailContent); $mail->setFormat(Mail::FORMAT_HTML); if ($this->config->mailOnAbstract == "Y") { $mail->setCopyToChair(true); } $mailView = $mail->getEngine(); $paperRow->putInView($mailView); $this->config->putInView($mailView); $mail->send(); } } else { // Submission is closed $this->view->content = $this->zmax_context->texts->author->abstract_submission_closed; } // Two instantiation for ref. solving $this->view->assign("content", "content"); echo $this->view->render("layout"); }
public function actionNewRegister() { if (isset($_POST['name'])) { if (UsersModel::model()->where("`login`='" . $_POST['name'] . "'")->findRow()) { //$this->redirect("/register"); $this->view("error", array("message" => Lang::get("login_exist")), false); } else { $model = new UsersModel(); $model->login = $_POST['name']; $model->password = md5($_POST['password1']); $model->email = $_POST['email']; $model->is_admin = 0; $model->status = 0; $model->hash = md5($model->login . $model->password . $model->email . "hash"); $model->type = 1; $model->save(); $mail = new Mail(); $mail->to = $model->email; $mail->subject = Lang::get("activate_subject"); $mail->text = Mail::loadTemplate("activation", array("name" => $model->login, "href" => "http://" . $_SERVER['HTTP_HOST'] . "/activate/" . $model->hash)); $mail->send(); $this->view("success", array("message" => Lang::get("register_succses")), false); $this->redirect("/personality"); } } $this->view("newregister", array(), false); }
public function actionGenerate() { $model = new CodeModel(); $message = false; $codes = CodeModel::model()->findAll(); if (isset($_POST['Code'])) { if ($_POST['Code']['count'] * 1 == 0) { $_POST['Code']['count'] = 1; } $model->setAttrs($_POST['Code']); $model->code = $this->generateCode(); $model->save(); $mail = new Mail(); $mail->to = $model->email; $mail->subject = "Код активации"; $mail->text = $mail->loadTemplate("code", array("code" => $model->code, "href" => "http://" . $_SERVER['HTTP_HOST'] . "/abonem/activate", "months" => $model->months)); $r = $mail->send(); $message = "Код активации был сгенерирован и отправлен на email. Код активации: " . $model->code; $model = new CodeModel(); } $this->view("admin/generate", array("model" => $model, "message" => $message, "codes" => $codes), false); }