Example #1
0
function AdmForum($email, &$tpl, $db, &$TEXTS, $i_min, $i_max)
{
    $config = GetConfig($db);
    $tpl->set_var("SUBMISSION_URL", $config['submissionURL']);
    $tpl->set_var("SESSION_ID", session_id());
    $class = 'even';
    /* Select all the papers which are NOT in conflict with the
       reviewer and list them.
       First extract the 'bloc' describing a line from the template */
    $query = "SELECT p.* FROM Paper p, Rating ra " . " WHERE ra.email='{$email}' AND ra.idPaper=p.id AND ra.rate > 0 ";
    $result = $db->execRequete($query);
    $nbPapers = 0;
    $i = 0;
    while ($paper = $db->objetSuivant($result)) {
        $nbPapers++;
        $i++;
        if ($i >= $i_min and $i <= $i_max) {
            if ($class == 'even') {
                $class = 'odd';
            } else {
                $class = 'even';
            }
            $tpl->set_var("CSS_CLASS", $class);
            // Instanciate vars of the paper
            InstanciatePaperVars($paper, $tpl, $db);
            // Show all other reviews, do not propose to see only my review
            $tpl->set_var("REVIEW", "");
            // Show the messages
            $tpl->set_var("MESSAGES", DisplayMessages($paper->id, 0, $db, TRUE, "Forum.php"));
            $tpl->parse("FORUM", "Forum");
            $tpl->parse("PAPERS", "PAPER_DETAIL", true);
        }
    }
    // Create the groups
    $nb_groups = $nbPapers / SIZE_FORUM + 1;
    for ($i = 1; $i <= $nb_groups; $i++) {
        $iMin = ($i - 1) * SIZE_FORUM + 1;
        if ($iMin >= $i_min and $iMin <= $i_max) {
            $link = "<font color=red>{$i}</font>";
        } else {
            $link = $i;
        }
        $tpl->set_var("LINK", $link);
        $tpl->set_var("IMIN_VALUE", $iMin);
        $tpl->set_var("IMAX_VALUE", $iMin + SIZE_FORUM - 1);
        $tpl->parse("LINKS", "GROUPS_LINKS", true);
    }
    if ($nbPapers == 0) {
        $tpl->set_var("PAPERS", "No papers");
    }
    $tpl->parse("BODY", "TxtPapersInForum");
}
Example #2
0
function ReportAssignment(&$tpl, &$members, &$papers, &$choice, $db)
{
    // get the config from the registry
    $registry = Zend_registry::getInstance();
    $config = $registry->get("Config");
    $config->putInView($tpl);
    $tpl->set_var("MAXIMAL_WEIGHT", $config['nbReviewersPerItem'] * 4);
    $tpl->set_var("SESSION_ID", session_id());
    // This function might potentially reach the memory
    // limit of PHP. Check that this does not happen
    if (function_exists("memory_get_usage")) {
        // The following instruction can raise the memory limit
        ini_set("memory_limit", "100M");
        ini_set("max_execution_time", "300");
        // 5 mns
    }
    // Header of the array
    reset($members);
    $userTbl = new User();
    foreach ($members as $id) {
        $user = $userTbl->find($id)->current();
        $user->putInView($tpl);
        $tpl->append("MEMBERS", "MEMBER_DETAIL");
    }
    // Display the array
    reset($papers);
    while (list($iPaper, $idPaper) = each($papers)) {
        $weightPaper = 0;
        reset($members);
        while (list($iRef, $email) = each($members)) {
            $paper = GetPaper($idPaper, $db, "object");
            InstanciatePaperVars($paper, $tpl, $db);
            if ($choice[$iRef][$iPaper] != 0) {
                $tpl->set_var("BG_COLOR", "lightblue");
                $tpl->set_var("PAPER_RATING", $choice[$iRef][$iPaper]);
                $weightPaper += $choice[$iRef][$iPaper];
            } else {
                $tpl->set_var("BG_COLOR", "white");
                $tpl->set_var("PAPER_RATING", GetRatingValue($papers[$iPaper], $members[$iRef], $db));
            }
            $tpl->set_var("WEIGHT", "{$weightPaper}");
            $tpl->append("ASSIGNMENTS", "ASSIGNMENT_DETAIL");
        }
        // Add to the list of papers
        $tpl->append("PAPERS", "PAPER_DETAIL");
        $tpl->set_var("ASSIGNMENTS", "");
    }
}
Example #3
0
function parsePapers($tpl, $templateFileName, $db, &$messages)
{
    $logs = "";
    $config = GetConfig($db);
    $tpl->set_file(array("papers" => TPLDIR . $templateFileName));
    $tpl->set_block("papers", "ARTICLE", "ARTICLES");
    $tpl->set_block("ARTICLE", "INDEX", "INDEXES");
    $tpl->set_var("INDEXES", "");
    $tpl->set_var("ARTICLES", "");
    // Take the paper following their order in the slots/sessions
    $query = "SELECT p.* FROM Paper p, ConfSession c, Slot s " . "WHERE p.id_conf_session = c.id AND c.id_slot=s.id " . " ORDER BY s.slot_date, s.begin, c.id, p.position_in_session ";
    $res = $db->execRequete($query);
    while ($paper = $db->objetSuivant($res)) {
        InstanciatePaperVars($paper, $tpl, $db, "", false);
        // We have to check that the file actually exists,
        // so as to avoid problems with \includepdf
        $cr_name = CRNamePaper($config['uploadDir'], $paper->status, $paper->id, $paper->format);
        if (file_exists($cr_name)) {
            $tpl->set_var("INDEXES", "");
            $queryIndex = "SELECT last_name, first_name FROM Author " . " WHERE id_paper='{$paper->id}'";
            // For each paper, we need to get the list of all the authors
            $authors = $db->execRequete($queryIndex);
            while ($author = $db->objetSuivant($authors)) {
                $tpl->set_var("AUTEUR", $author->last_name . ", " . $author->first_name);
                $tpl->parse("INDEXES", "INDEX", true);
            }
            $tpl->parse("ARTICLES", "ARTICLE", true);
        } else {
            $messages .= "<br><font color=red>ERROR: Unable to find the file {$cr_name}" . " of the paper <i>{$paper->title}</i></font><br>";
        }
    }
    $tpl->parse("BODY", "papers");
    $contents = $tpl->get_var("BODY");
    replaceBadChars($contents);
    return $contents;
}