Example #1
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;
 }
 /**
  * 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
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", "");
    }
}
 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");
 }
 /**
  * Take the identity of another user.
  */
 function impersonateAction()
 {
     $userTbl = new User();
     $this->view->setFile("content", "impersonate.xml");
     // Create the infos for the filter list
     if (isset($_POST['filter_roles'])) {
         $filterRoles = array_flip($_POST['filter_roles']);
     } else {
         // Show only reviewers
         $filterRoles = array_flip(array("R"));
     }
     // Take account of the roles
     $this->view->filter_roles_list = Zmax_View_Phplib::checkboxField("checkbox", "filter_roles[]", Config::$Roles, $filterRoles, array());
     $filterRolesList = "";
     $connector = "";
     foreach (array_flip($filterRoles) as $role) {
         $filterRolesList .= " {$connector} roles LIKE '%{$role}%' ";
         $connector = " OR ";
     }
     // Get the list of users
     $users = $userTbl->fetchAll("({$filterRolesList})", 'last_name');
     $listUsers = array();
     foreach ($users as $user) {
         $listUsers[$user->id] = "{$user->first_name} {$user->last_name}";
     }
     $this->view->list_users = Zmax_View_Phplib::selectField("user_id", $listUsers, "");
     // Default initial message
     $this->view->initial_message = "You are currently connected as {$this->user->first_name} {$this->user->last_name}.";
     // Check whether impersonating is required
     if (isset($_REQUEST['form_impersonate']) and !isset($_REQUEST['refresh'])) {
         // Change the current user
         $newUserId = $_REQUEST['user_id'];
         $this->user = $userTbl->fetchAll("id = '{$newUserId}'")->current();
         // Modify the session
         $this->session->id_user = $newUserId;
         $this->session->roles = $this->user->roles;
         $this->session->save();
         $this->view->initial_message = "You are now connected as {$this->user->first_name} {$this->user->last_name}.";
     }
     echo $this->view->render("layout");
 }
Example #6
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 #7
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;
 }