Example #1
0
 /**
  * Check that a session is valid
  */
 function putInView(&$view, $html = true)
 {
     // Call the parent method: default behavior
     parent::putInView($view);
     // Now refine. Dates are shown using the required format.
     $reviewDeadline = Zmax_View_Phplib::formatDate($this->reviewDeadline, $this->date_format);
     $name = "Config" . "->reviewDeadline";
     $view->setVar($name, $reviewDeadline);
     $submissionDeadline = Zmax_View_Phplib::formatDate($this->submissionDeadline, $this->date_format);
     $name = "Config" . "->submissionDeadline";
     $view->setVar($name, $submissionDeadline);
     $name = "Config" . "->nb_papers";
     $view->setVar($name, Config::countAllPapers());
     $name = "Config" . "->nb_words";
     $view->setVar($name, 250);
 }
 /**
  * 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");
 }
Example #3
0
 /**
  * Create a form to access a paper
  *
  */
 function form(&$user, &$view)
 {
     $view->setFile("form_submit", "form_submit.xml");
     $view->setBlock("form_submit", "ABSTRACT", "ABSTRACTS");
     $view->setBlock("form_submit", "FILE_UPLOAD");
     $view->setBlock("form_submit", "AUTHOR", "AUTHORS");
     $view->setBlock("form_submit", "QUESTION", "QUESTIONS");
     $registry = Zend_registry::getInstance();
     $config = $registry->get("Config");
     // If in two phases submission: hide the upload
     if ($config->two_phases_submission == "Y") {
         $view->FILE_UPLOAD = "";
     }
     // Put the connected user in the form
     $view->me_last_name = $user->last_name;
     $view->me_first_name = $user->first_name;
     $view->me_affiliation = $user->affiliation;
     $view->me_email = $user->email;
     $view->me_country = $user->country_code;
     $db = Zend_Db_Table::getDefaultAdapter();
     $user = new User();
     // Get the lists of choices
     $countryList = $db->fetchPairs("SELECT * FROM Country");
     // Sort the countries in alphabetical order
     asort($countryList, SORT_STRING);
     $topicList = $db->fetchPairs("SELECT * FROM ResearchTopic");
     // Produce the list of abstracts sections ordered by their position
     $abstract = new AbstractSection();
     $abstract->select()->order('position ASC');
     $abstractRows = $abstract->fetchAll();
     $view->list_abstract_ids = $separator = "";
     foreach ($abstractRows as $abstractRow) {
         $abstractRow->putInView($view, false);
         // Set the default value
         if (isset($this->_abstract[$abstractRow->id])) {
             $view->abstract_content = $this->_abstract[$abstractRow->id]->content;
         } else {
             $view->abstract_content = "";
         }
         if ($abstractRow->mandatory == 'Y') {
             $view->abstract_mandatory = "*";
         } else {
             $view->abstract_mandatory = "";
         }
         $view->list_abstract_ids .= $separator . $abstractRow->id;
         $separator = "; ";
         $view->append("ABSTRACTS", "ABSTRACT");
     }
     $view->topic_list = Zmax_View_Phplib::selectField("topic", $topicList, $this->topic);
     // Produce the list of fields for authors.
     for ($i = 0; $i < $this->nb_authors_in_form; $i++) {
         if ($i % 2 == 0) {
             $view->css_class = 'odd';
         } else {
             $view->css_class = 'even';
         }
         $view->ith = $i;
         $view->iplus = $i + 1;
         $view->checked = "";
         // Take the existing author for default values
         if ($i < $this->nbAuthors()) {
             $author = $this->getAuthor($i);
             if ($this->_contactAuthor == $i) {
                 $view->checked = "checked='1'";
             }
         } else {
             // Create an empty author
             $author = $user->createRow();
         }
         $author->putInView($view);
         // Propose the list of countries
         $view->country_list = Zmax_View_Phplib::selectField("country_code[{$i}]", $countryList, $author->country_code, 1, "author_country_{$i}");
         $view->append("AUTHORS", "AUTHOR");
     }
     // Produce the list of questions
     $paperQuestion = new PaperQuestion();
     $questions = $paperQuestion->fetchAll();
     foreach ($questions as $question) {
         $view->id_question = $question->id;
         $view->question = $question->question_code;
         // Get the list of choices, ordered by the position
         $view->CHOICES = "";
         $choices = $question->findPQChoice($paperQuestion->select()->order('position ASC'));
         $choicesList = array();
         $defaultChoice = "";
         foreach ($choices as $choice) {
             $choicesList[$choice->id_choice] = $choice->choice;
             if (empty($defaultChoice)) {
                 $defaultChoice = $choice->id_choice;
             }
             // Check whether this is the default choice
             if (isset($this->_answers[$question->id])) {
                 if ($this->_answers[$question->id]->id_answer == $choice->id_choice) {
                     $defaultChoice = $choice->id_choice;
                 }
             }
         }
         $view->CHOICES = Zmax_View_Phplib::checkboxField("radio", "answers[{$question->id}]", $choicesList, $defaultChoice, array("length" => 5));
         $view->append("QUESTIONS", "QUESTION");
     }
     // Put the values in the view
     $this->putInView($view, false);
     // Note: make a double assignment, to translate text code which are
     // dynamically generated
     $view->assign("form_result1", "form_submit");
     $view->assign("form_result2", "form_result1");
     return $view->form_result2;
 }
 function assignAction()
 {
     $this->view->setFile("content", "assign.xml");
     $this->view->initial_message = "";
     // Sort either by topic or by status
     if (isset($_REQUEST['sort_topic'])) {
         $sortOption = "topic";
     } else {
         $sortOption = "status";
     }
     // Check whether papers are assigned to sessions
     if (isset($_REQUEST['form_assign_session'])) {
         foreach ($_REQUEST['conf_session'] as $id_paper => $id_session) {
             if (!empty($id_session)) {
                 if (isset($_REQUEST['position_in_session'][$id_paper])) {
                     $pos_in_session = trim($_REQUEST['position_in_session'][$id_paper]);
                 } else {
                     $pos_in_session = "";
                 }
                 if (!empty($pos_in_session)) {
                     $this->zmax_context->db->query("UPDATE Paper SET id_conf_session='{$id_session}', " . "position_in_session='{$pos_in_session}' " . "WHERE id='{$id_paper}'");
                 } else {
                     $this->db->query("UPDATE Paper SET id_conf_session='{$id_session}' " . "WHERE id='{$id_paper}'");
                 }
             }
         }
     }
     /*  First extract the 'blocks' describing a line from the template */
     $this->view->set_block("content", "PAPER_DETAIL", "PAPERS");
     $conf_sessions = $this->zmax_context->db->fetchPairs("SELECT id, name FROM ConfSession");
     $conf_sessions[0] = $this->texts->admin->not_yet_assigned;
     ksort($conf_sessions);
     // Get the list of required files in the proceedings phase
     $listFiles = array();
     $requiredFileTbl = new RequiredFile();
     $requiredFiles = $requiredFileTbl->fetchAll("id_phase = " . Config::PROCEEDINGS_PHASE);
     foreach ($requiredFiles as $requiredFile) {
         $listFiles[$requiredFile->file_code] = $requiredFile->file_extension;
     }
     // Directory of the CR files
     $fileDir = ".." . DIRECTORY_SEPARATOR . $this->zmax_context->config->app->upload_path . DIRECTORY_SEPARATOR . "proceedings" . DIRECTORY_SEPARATOR;
     // OK. Now execute the query, fetch the papers, display
     $query = "SELECT p.id, p.title, p.CR as cr, p.emailContact, t.label AS topic, IFNULL(id_conf_session,0) id_conf_session, " . " IFNULL(position_in_session,999) position_in_session, s.label " . " FROM Paper as p,  PaperStatus s, ResearchTopic t WHERE p.status=s.id " . " AND cameraReadyRequired ='Y' AND t.id=p.topic " . "ORDER BY id_conf_session DESC, position_in_session ASC, {$sortOption}";
     $rPapers = $this->zmax_context->db->query($query);
     $i = 0;
     while ($paper = $rPapers->fetch(Zend_Db::FETCH_OBJ)) {
         $this->view->css_class = Config::CssCLass($i++);
         $this->view->session_list = Zmax_View_Phplib::selectField("conf_session[{$paper->id}]", $conf_sessions, $paper->id_conf_session);
         $this->view->paper_id = $paper->id;
         $this->view->paper_title = $paper->title;
         $this->view->paper_status = $paper->label;
         $this->view->paper_topic = $paper->topic;
         $this->view->paper_position_in_session = $paper->position_in_session;
         $this->view->paper_authors = PaperRow::getPaperAuthors($this->zmax_context->db, $paper);
         $this->view->paper_email_contact = $paper->emailContact;
         $this->view->someUser = Mail::SOME_USER;
         if (!$this->config->isPhaseOpen(Config::PROCEEDINGS_PHASE)) {
             $this->view->cr_paper = $this->texts->admin->camera_ready_not_open;
         } else {
             // Take the name of the camera ready file
             foreach ($listFiles as $code => $ext) {
                 $filePath = $fileDir . $code . "_" . $paper->id . "." . $ext;
                 if (file_exists($filePath)) {
                     $this->view->download_link = $this->texts->camera_ready_uploaded;
                 } else {
                     $this->view->download_link = $this->texts->camera_ready_not_uploaded;
                 }
             }
         }
         $this->view->append("PAPERS", "PAPER_DETAIL");
     }
     echo $this->view->render("layout");
 }
Example #5
0
function SummaryPapersAssignment(&$tpl, $db, &$TEXTS)
{
    $registry = Zend_registry::getInstance();
    $config = $registry->get("Config");
    $config->putInView($tpl);
    $db = Zend_Db_Table::getDefaultAdapter();
    $paperTbl = new Paper();
    $reviewTbl = new Review();
    $ratingTbl = new Rating();
    $userTbl = new User();
    /* Check whether there is a prefered topic for papers */
    if ($config->selectedPaperTopic) {
        $prefPaperTopic = $config->selectedPaperTopic;
    } else {
        $prefPaperTopic = "%";
    }
    /* Check whether there is a prefered topic for reviewers */
    if ($config->selectedReviewerTopic) {
        $prefReviewerTopic = $config->selectedReviewerTopic;
    } else {
        $prefReviewerTopic = "%";
    }
    // Decompose the blocks of the template
    $tpl->set_block("content", "MEMBER_DETAIL", "MEMBERS");
    $tpl->set_block("content", "PAPER_DETAIL", "PAPERS");
    $tpl->set_block("content", "NAVIGATION_TABLE", "NAVIGATION");
    $tpl->set_block("PAPER_DETAIL", "ASSIGNMENT_DETAIL", "ASSIGNMENTS");
    // Get the list of topics
    $topicList = $db->fetchPairs("SELECT id, label FROM ResearchTopic");
    $topicList["0"] = "Any";
    ksort($topicList);
    // Show the selection list
    $tpl->paper_topics = Zmax_View_Phplib::selectField("paperTopic", $topicList, $prefPaperTopic);
    $tpl->reviewer_topics = Zmax_View_Phplib::selectField("reviewerTopic", $topicList, $prefReviewerTopic);
    /* Store the list of reviewers in an array (+easier, +efficient).  */
    $members = array();
    $nb_members = 0;
    $users = $userTbl->fetchAll("roles LIKE '%R%'", "last_name");
    foreach ($users as $user) {
        if ($prefReviewerTopic == '%' or $user->matchTopic($prefReviewerTopic)) {
            $members[++$nb_members] = $user;
        }
    }
    // Same thing for papers
    $papers = array();
    $nb_papers = 0;
    $rPapers = $db->query("SELECT * FROM Paper ORDER BY id");
    while ($paper = $rPapers->fetch(Zend_Db::FETCH_OBJ)) {
        if ($prefPaperTopic == '%' or $paper->topic == $prefPaperTopic) {
            $papers[++$nb_papers] = $paper;
        }
    }
    // Manage the navigation table
    if ($nb_papers > MAX_ITEMS_IN_ASSIGNMENT or $nb_members > MAX_ITEMS_IN_ASSIGNMENT) {
        // Show the navigation table
        $tpl->set_var("nb_paper", $nb_papers);
        $tpl->set_var("nb_reviewers", $nb_members);
        $tpl->set_var("max_items_in_assignment", MAX_ITEMS_IN_ASSIGNMENT);
        if (isset($_REQUEST['i_paper_min'])) {
            // The request comes from the navigation table
            $i_paper_min = $_REQUEST['i_paper_min'];
            $i_paper_max = min($_REQUEST['i_paper_max'], $nb_papers);
            $i_member_min = $_REQUEST['i_member_min'];
            $i_member_max = min($_REQUEST['i_member_max'], $nb_members);
        } else {
            $i_paper_min = 1;
            $i_paper_max = min($nb_papers, MAX_ITEMS_IN_ASSIGNMENT);
            $i_member_min = 1;
            $i_member_max = min($nb_members, MAX_ITEMS_IN_ASSIGNMENT);
        }
        // Show the navigation table
        $tpl->set_var("NAV_TABLE", "");
        $lines = "";
        $script = $tpl->base_url . "/admin/chair/showassignment?1=1";
        for ($i = 1; $i <= $nb_papers; $i += MAX_ITEMS_IN_ASSIGNMENT) {
            $line = "";
            for ($j = 1; $j <= $nb_members; $j += MAX_ITEMS_IN_ASSIGNMENT) {
                $link = $script . "&i_paper_min={$i}" . "&i_paper_max=" . ($i + MAX_ITEMS_IN_ASSIGNMENT - 1) . "&i_member_min={$j}" . "&i_member_max=" . ($j + MAX_ITEMS_IN_ASSIGNMENT - 1);
                if ($i == $i_paper_min and $j == $i_member_min) {
                    $line .= "<td bgcolor=lightblue><a href='{$link}'>" . "<font color=white>{$i}/{$j}</font></a></td>";
                } else {
                    $line .= "<td><a href='{$link}'>{$i}/{$j}</a></td>";
                }
            }
            $lines .= "<tr>{$line}</tr>\n";
        }
        $tpl->set_var("NAV_TABLE", $lines);
        $tpl->append("NAVIGATION", "NAVIGATION_TABLE");
    } else {
        // Hide the navigation table
        $i_paper_min = $i_member_min = 1;
        $i_paper_max = $nb_papers;
        $i_member_max = $nb_members;
        $tpl->set_var("NAVIGATION", "");
    }
    // Put the current values in the template
    $tpl->set_var("I_PAPER_MIN", $i_paper_min);
    $tpl->set_var("I_PAPER_MAX", $i_paper_max);
    $tpl->set_var("I_MEMBER_MIN", $i_member_min);
    $tpl->set_var("I_MEMBER_MAX", $i_member_max);
    //  echo "I paper min=$i_paper_min I paper max = $i_paper_max<br>";
    // OK, now create the table. First the columns' headers
    for ($j = $i_member_min; $j <= $i_member_max; $j++) {
        $members[$j]->putInView($tpl);
        $tpl->member_nb_papers = $members[$j]->countPapers();
        $tpl->append("MEMBERS", "MEMBER_DETAIL");
    }
    // then each line
    $tpl->PAPERS = "";
    for ($i = $i_paper_min; $i <= $i_paper_max; $i++) {
        // Choose the CSS class
        if ($i % 2 == 0) {
            $tpl->set_var("css_class", "even");
        } else {
            $tpl->set_var("css_class", "odd");
        }
        $paper = $papers[$i];
        $entity = "Paper" . "->id";
        $tpl->setVar($entity, $papers[$i]->id);
        $tpl->SESSION_ID = session_id();
        // Get the ratings of each PC member
        $nbReviewers = 0;
        for ($j = $i_member_min; $j <= $i_member_max; $j++) {
            $member = $members[$j];
            $member->putInView($tpl);
            $rating = $ratingTbl->find($paper->id, $member->id)->current();
            if ($rating) {
                $val = $rating->rate;
            } else {
                $val = 2;
            }
            $tpl->bg_color = "white";
            $tpl->set_var("paper_rating", $val);
            $tpl->set_var("CHECKED_YES", "");
            $tpl->set_var("CHECKED_NO", "checked='1'");
            // Check if the paper is assigned
            $review = $reviewTbl->find($paper->id, $member->id)->current();
            if ($review) {
                $nbReviewers = $nbReviewers + 1;
                $tpl->bg_color = "yellow";
                $tpl->set_var("CHECKED_YES", "checked='1'");
                $tpl->set_var("CHECKED_NO", "");
            }
            // Add to the assignment line
            $tpl->append("ASSIGNMENTS", "ASSIGNMENT_DETAIL");
        }
        // Add to the list of papers
        $tpl->setVar("paper_nb_reviewers", $nbReviewers);
        $tpl->append("PAPERS", "PAPER_DETAIL");
        $tpl->set_var("ASSIGNMENTS", "");
    }
}
 /**
  *  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>&nbsp;</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", "");
         }
     }
 }
 /**
  * Register to the conference
  * @author philipperigaux
  *
  */
 function registerAction()
 {
     // No way to change a registrationb once the payment is made
     if ($this->user->payment_received == "Y") {
         $this->view->content = $this->zmax_context->texts->attendee->payment_already_made;
         echo $this->view->render("layout");
         return;
     }
     $this->view->setFile("content", "register.xml");
     $this->view->setFile("form_register", "form_register.xml");
     $this->view->setBlock("form_register", "REGISTRATION_QUESTION");
     $db = Zend_Db_Table::getDefaultAdapter();
     // Put the values in the view (don't use HTML formating)
     $this->user->putInView($this->view, false);
     // If this is a registered user: show the attendee information, else hide them
     $regQuestion = new RegQuestion();
     // Registration? Produce the list of questions
     $this->view->setBlock("REGISTRATION_QUESTION", "QUESTION", "QUESTIONS");
     $questions = $regQuestion->fetchAll();
     foreach ($questions as $question) {
         $this->view->id_question = $question->id;
         $this->view->question = $question->question_code;
         // Get the list of choices, ordered by the position
         $this->view->CHOICES = "";
         $choices = $question->findRegChoice($regQuestion->select()->order('position ASC'));
         $choicesList = array();
         $defaultChoice = "";
         foreach ($choices as $choice) {
             $choicesList[$choice->id_choice] = $choice->choice . "<br/>({$choice->cost} " . $this->config_v1["currency"] . ")";
             if (empty($defaultChoice)) {
                 $defaultChoice = $choice->id_choice;
             }
             // Check whether this is the default choice
             $answers = $this->user->getAnswers();
             if (isset($answers[$question->id])) {
                 if ($answers[$question->id]->id_answer == $choice->id_choice) {
                     $defaultChoice = $choice->id_choice;
                 }
             }
         }
         $this->view->CHOICES = Zmax_View_Phplib::checkboxField("radio", "reg_answers[{$question->id}]", $choicesList, $defaultChoice, array("length" => 5));
         $this->view->append("QUESTIONS", "QUESTION");
     }
     // Instantiate the template
     $this->view->assign("form_result1", "form_register");
     $this->view->assign("form_result2", "form_result1");
     $this->view->form_mode = "insert";
     echo $this->view->render("layout");
 }
 function exporttextsAction()
 {
     $this->view->setFile("content", "export_texts.xml");
     $defaultLang = "fr";
     $langs = $this->zmax_context->db->fetchPairs("SELECT * FROM zmax_lang where lang !='en'");
     $this->view->list_langs = Zmax_View_Phplib::checkboxField("radio", "lang", $langs, $defaultLang, array("length" => 5));
     $namespaces = $this->zmax_context->db->fetchPairs("SELECT namespace, namespace FROM zmax_namespace");
     $namespaces[' all'] = "All";
     ksort($namespaces);
     $this->view->list_namespaces = Zmax_View_Phplib::checkboxField("radio", "namespace", $namespaces, ' all', array("length" => 10));
     echo $this->view->render("layout");
 }
Example #9
0
 public function showReview($view, $html = false, $revName = "review")
 {
     $db = Zend_Db_Table::getDefaultAdapter();
     // Initialize the review content
     $view->review_marks = "";
     $view->review_answers = "";
     // Put the data in the view
     $this->putInView($view, $html);
     // Default selection of the reviewer expertise
     $selectedName = "selected" . $this->reviewerExpertise;
     $view->setVar($selectedName, "selected");
     // Get the reviewer
     $reviewer = $this->findParentUser();
     $reviewer->putInView($view, $html);
     // Get the paper
     $paper = $this->findParentPaper();
     $paper->putInView($view, $html);
     // Show the marks
     $j = 0;
     foreach ($this->_marks as $mark) {
         // Choose the CSS class
         $view->css_class = Config::CssCLass($j++);
         $mark->putInView($view);
         $criteria = $mark->findParentCriteria();
         $criteria->putInView($view, $html);
         // Create the list of marks (for forms)
         $view->list_marks = Zmax_View_Phplib::selectField("marks[{$criteria->id}]", Config::$Scale, $mark->mark);
         $view->append($revName . "_marks", $revName . "_mark");
     }
     // Put the answers to questions
     foreach ($this->_answers as $answer) {
         // Choose the CSS class
         $view->css_class = Config::CssCLass($j++);
         // Instantiate the answer
         $answer->putInView($view, $html);
         // Get and instantiate the question
         $question = $answer->findParentReviewQuestion();
         $question->putInView($view);
         // get and instantiate the choice
         $choiceList = $db->fetchPairs("SELECT * FROM RQChoice WHERE id_question={$answer->id_question}");
         $choice = $answer->findParentRQChoice();
         if (is_object($choice)) {
             $choice->putInView($view);
         }
         $view->list_choices = Zmax_View_Phplib::checkboxField("radio", "answers[{$answer->id_question}]", $choiceList, $answer->id_answer, array());
         $view->append($revName . "_answers", $revName . "_answer");
     }
     // Instantiate twice to resolve translations
     $view->assign("result1", $revName);
     $view->assign("result2", "result1");
     return $view->result2;
 }
Example #10
0
 /**
  * Create a form to access a User
  *
  */
 function form(&$view, $formTemplate = "form_user.xml", $changePassword = true, $register = false)
 {
     $view->setFile("form_user", $formTemplate);
     $view->setBlock("form_user", "TOPICS");
     $view->setBlock("form_user", "PASSWORD");
     $view->setBlock("form_user", "ATTENDEE");
     $view->setBlock("form_user", "NO_ATTENDEE");
     $view->setBlock("form_user", "REGISTRATION_QUESTION");
     if ($register) {
         $this->addRole(User::PARTICIPANT_ROLE);
     }
     $db = Zend_Db_Table::getDefaultAdapter();
     // Put the values in the view (don't use HTML formating)
     $this->putInView($view, false);
     if (!$changePassword) {
         // Do not show the password
         $view->PASSWORD = "";
     }
     $view->change_password = $changePassword;
     $view->register = $register;
     $countryList = $db->fetchPairs("SELECT * FROM Country");
     // Sort the countries in alphabetical order
     asort($countryList, SORT_STRING);
     $view->country_list = Zmax_View_Phplib::selectField("country_code", $countryList, $this->country_code);
     // Do not allow empty roles
     if (empty($this->roles)) {
         $this->addRole(User::REVIEWER_ROLE);
     }
     $existingRoles = array_flip(explode(",", $this->roles));
     $view->roles_list = Zmax_View_Phplib::checkboxField("checkbox", "roles[]", Config::$Roles, $existingRoles, $this->country_code);
     if ($this->isReviewer()) {
         // We show a form that allows the user to choose his/her topics
         $topicList = $db->fetchPairs("SELECT * FROM ResearchTopic");
         $existingTopics = array();
         foreach ($this->_topics as $topic) {
             $existingTopics[$topic->id_topic] = 1;
         }
         $view->topic_list = Zmax_View_Phplib::checkboxField("checkbox", "topics[]", $topicList, $existingTopics, array("length" => 5));
         $view->assign("TOPICS", "TOPICS");
     } else {
         $view->TOPICS = "";
     }
     // If this is a registered user: show the attendee information, else hide them
     if ($this->isParticipant()) {
         $view->NO_ATTENDEE = "";
         $regQuestion = new RegQuestion();
         // Registration? Produce the list of questions
         $view->setBlock("REGISTRATION_QUESTION", "QUESTION", "QUESTIONS");
         $questions = $regQuestion->fetchAll();
         foreach ($questions as $question) {
             $view->id_question = $question->id;
             $view->question = $question->question_code;
             // Get the list of choices, ordered by the position
             $view->CHOICES = "";
             $choices = $question->findRegChoice($regQuestion->select()->order('position ASC'));
             $choicesList = array();
             $defaultChoice = "";
             foreach ($choices as $choice) {
                 $choicesList[$choice->id_choice] = $choice->choice;
                 if (empty($defaultChoice)) {
                     $defaultChoice = $choice->id_choice;
                 }
                 // Check whether this is the default choice
                 if (isset($this->_answers[$question->id])) {
                     if ($this->_answers[$question->id]->id_answer == $choice->id_choice) {
                         $defaultChoice = $choice->id_choice;
                     }
                 }
             }
             $view->CHOICES = Zmax_View_Phplib::checkboxField("radio", "reg_answers[{$question->id}]", $choicesList, $defaultChoice, array("length" => 5));
             $view->append("QUESTIONS", "QUESTION");
         }
     } else {
         $view->ATTENDEE = "";
         $view->REGISTRATION_QUESTION = "";
     }
     // Instantiate the template
     $view->assign("form_result1", "form_user");
     $view->assign("form_result2", "form_result1");
     return $view->form_result2;
 }