Example #1
0
 /**
  * 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");
 }
 /**
  * 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");
 }
 /**
  * Show the list of papers with a given status
  */
 function acceptedAction()
 {
     // There should be a 'status' parameter
     $paperTbl = new Paper();
     $paperStatusTbl = new PaperStatus();
     $status = $this->getRequest()->getParam("status");
     $paperStatus = $paperStatusTbl->find($status)->current();
     // Is the 'text' format required ?
     if (isset($_REQUEST['format']) and $_REQUEST['format'] == "text") {
         $textFormat = true;
         $this->view->setFile("content", "accepted_simple.txt");
     } else {
         $textFormat = false;
         $this->view->setFile("content", "accepted_simple.xml");
     }
     $this->view->setBlock("content", "PAPER", "PAPERS");
     $paperStatus->putInView($this->view);
     $paperTbl = new Paper();
     $no = 1;
     $papers = $paperTbl->fetchAll("status='{$status}'");
     foreach ($papers as $paper) {
         $paper->putInView($this->view);
         $this->view->no = $no++;
         $this->view->append("PAPERS", "PAPER");
     }
     //Function from MyReview V1. Allows assignment of accepted papers to sessions.
     /* AdmListAcceptedPapers ($_REQUEST['status'], $this->view, $this->db_v1,
     		 1, $this->zmax_context->texts);*/
     if ($textFormat) {
         Header("Content-type: text/plain");
         $this->view->assign("result", "content");
         echo utf8_decode($this->view->result);
     } else {
         echo $this->view->render("layout");
     }
 }