Example #1
0
function indexCourse()
{
    global $db, $smarty, $nav;
    $query = "select c.course_name course, p.code code,\n                   p.paper_title title\n            from paper p, course c\n            where p.paper_course = c.code\n            order by c.course_name, p.paper_title";
    $result =& $db->queryAll($query);
    /* Iteration to get all info about the paper */
    foreach ($result as $row) {
        /* Iteration to get all paper's author(s) */
        $query = "select a.person_name name, a.person_lastname lastname,  \n                     a.person_webpage webpage \n              from person a, authoring at \n              where at.code_author = a.code and at.code_paper = " . $db->quote($row['code']) . "order by at.author_order";
        $temporal =& $db->queryAll($query);
        foreach ($temporal as $tmp_row) {
            $author[] = array('name' => $tmp_row['name'], 'lastname' => $tmp_row['lastname'], 'webpage' => $tmp_row['webpage']);
        }
        /* Here we put together all the information */
        $paper[] = array('code' => $row['code'], 'title' => $row['title'], 'course' => $row['course'], 'author' => $author, 'tutor' => $tutor);
        unset($author);
    }
    $arr = generateIndex($paper, 'course', 1);
    $nav['Cursos'] = navigationIndex($arr);
    $smarty->assign('leftnav', $nav);
    $smarty->assign('index', $arr);
    $smarty->assign('body', $smarty->fetch('courseindex.tpl'));
}
Example #2
0
function indexCourse()
{
    global $db, $smarty, $nav;
    $result = $db->prepare('select c.course_name course, p.code code,
                                 p.paper_title title
                          from paper p, course c
                          where p.paper_course = c.code
                          order by c.course_name, p.paper_title');
    $result =& $db->execute($query);
    if (PEAR::isError($db)) {
        die($db->getMessage());
    }
    /* Iteration to get all info about the paper */
    while ($result->fetchInto($row)) {
        /* Iteration to get all paper's author(s) */
        $query = $db->prepare("select a.person_name name, a.person_lastname lastname,  \n                                a.person_webpage webpage \n                           from person a, authoring at \n                           where at.code_author = a.code and at.code_paper = ?\n                           order by at.author_order");
        $temporal =& $db->execute($query, $row['code']);
        if (PEAR::isError($db)) {
            die($db->getMessage());
        }
        while ($temporal->fetchInto($tmp_row)) {
            $author[] = array('name' => $tmp_row['name'], 'lastname' => $tmp_row['lastname'], 'webpage' => $tmp_row['webpage']);
        }
        /* Here we put together all the information */
        $paper[] = array('code' => $row['code'], 'title' => $row['title'], 'course' => $row['course'], 'author' => $author, 'tutor' => $tutor);
        unset($author);
    }
    $arr = generateIndex($paper, 'course', 1);
    $nav['Cursos'] = navigationIndex($arr);
    $smarty->assign('leftnav', $nav);
    $smarty->assign('index', $arr);
    $smarty->assign('body', $smarty->fetch('courseindex.tpl'));
}