예제 #1
0
/**
 * Wrapper function for read_course_from_DB.
 * @see read_course_from_DB
 */
function read_course($id_course = NULL)
{
    /*
     * Return the course object in sess_courseObj
     */
    if (is_null($id_course)) {
        $sess_courseObj = isset($_SESSION['sess_courseObj']) ? $_SESSION['sess_courseObj'] : null;
        if ($sess_courseObj instanceof Course) {
            return $sess_courseObj;
        }
        return new ADA_Error(NULL, translateFN('Errore in lettura oggetto corso in sessione'), 'read_course', NULL, NULL, NULL, TRUE);
    }
    $sess_id_course = isset($_SESSION['sess_id_course']) ? $_SESSION['sess_id_course'] : null;
    if (DataValidator::is_uinteger($id_course) !== FALSE) {
        $read_id_course = $id_course;
    } else {
        $read_id_course = $sess_id_course;
    }
    if ($read_id_course == $sess_id_course) {
        $sess_courseObj = isset($_SESSION['sess_courseObj']) ? $_SESSION['sess_courseObj'] : null;
        if ($sess_courseObj instanceof Course && $sess_courseObj->getId() == $read_id_course) {
            return $_SESSION['sess_courseObj'];
        }
    }
    /*
     * get course object from database
     */
    return read_course_from_DB($read_id_course);
}
예제 #2
0
 * Get needed objects
 */
$neededObjAr = array(AMA_TYPE_TUTOR => array('layout', 'course', 'course_instance'));
require_once ROOT_DIR . '/include/module_init.inc.php';
$self = 'default';
include_once 'include/tutor_functions.inc.php';
include_once 'include/tutor.inc.php';
/*
 * YOUR CODE HERE
 */
$id_course = $courseInstanceObj->id_corso;
$start_date = AMA_DataHandler::ts_to_date($courseInstanceObj->data_inizio, "%d/%m/%Y");
$history = '';
if ($id_course) {
    // get object course
    $courseObj = read_course_from_DB($id_course);
    if (is_object($courseObj) && !AMA_dataHandler::isError($courseObj)) {
        $course_title = $courseObj->titolo;
        //title
        $id_toc = $courseObj->id_nodo_toc;
        //id_toc_node
    } else {
        $errObj = new ADA_error(translateFN("Corso non trovato"), translateFN("Impossibile proseguire."));
    }
}
$studentObj = read_user_from_DB($id_student);
if (is_object($studentObj) && !AMA_dataHandler::isError($studentObj)) {
    if ($studentObj instanceof ADAPractitioner) {
        /**
         * @author giorgio 14/apr/2015
         *
예제 #3
0
$whatAR = array();
array_push($whatAR, 'node');
array_push($whatAR, 'layout');
array_push($whatAR, 'user');
array_push($whatAR, 'course');
clear_data($whatAR);
$sess_id_course = $_SESSION['sess_id_course'];
$sess_id_course_instance = $_SESSION['sess_id_course_instance'];
$sess_id_user = $_SESSION['sess_id_user'];
//import_request_variables("gP","");
extract($_GET, EXTR_OVERWRITE, ADA_GP_VARIABLES_PREFIX);
extract($_POST, EXTR_OVERWRITE, ADA_GP_VARIABLES_PREFIX);
// ******************************************************
if ($sess_id_course) {
    // get object course
    $courseObj = read_course_from_DB($sess_id_course);
    if ($dh->isError($courseObj)) {
        $errObj = $courseObj;
        $msg = $errObj->errorMessage();
        header("Location:{$error_page}?err_msg={$msg}");
        exit;
    } else {
        $course_title = $courseObj->titolo;
        //title
        $id_toc = $courseObj->id_nodo_toc;
        //id_toc_node
        $course_family = $courseObj->template_family;
    }
} else {
    $errObj = new ADA_error(translateFN("Corso non trovato"), translateFN("Impossibile proseguire."));
}
예제 #4
0
/**
 * Get needed objects
 */
$neededObjAr = array(AMA_TYPE_SWITCHER => array('layout', 'course'));
/**
 * Performs basic controls before entering this module
 */
require_once ROOT_DIR . '/include/module_init.inc.php';
require_once ROOT_DIR . '/switcher/include/switcher_functions.inc.php';
require_once MODULES_TEST_PATH . '/config/config.inc.php';
require_once MODULES_TEST_PATH . '/include/init.inc.php';
//needed to promote AMADataHandler to AMATestDataHandler. $sess_selected_tester is already present in session
$GLOBALS['dh'] = AMATestDataHandler::instance(MultiPort::getDSN($_SESSION['sess_selected_tester']));
$self = whoami();
if (!is_a($courseObj, 'Course')) {
    $courseObj = read_course_from_DB($_GET['id_course']);
}
require_once MODULES_TEST_PATH . '/include/management/switcherManagementTest.inc.php';
$management = new SwitcherManagementTest($courseObj);
$return = $management->render();
$text = $return['html'];
$title = $return['title'];
$path = $return['path'];
/*
 * Go back link
 */
$navigation_history = $_SESSION['sess_navigation_history'];
$last_visited_node = $navigation_history->lastModule();
$go_back_link = CDOMElement::create('a', 'href:' . $last_visited_node);
$go_back_link->addChild(new CText(translateFN('Indietro')));
$content_dataAr = array('path' => $path, 'user_name' => $user_name, 'user_type' => $user_type, 'status' => $status, 'label' => $title, 'title' => $title, 'help' => isset($help) ? $help : '', 'text' => $text, 'go_back' => $go_back_link->getHtml(), 'module' => isset($module) ? $module : '', 'ajax_chat_link' => '<a href="' . HTTP_ROOT_DIR . '/comunica/list_chatrooms.php">' . translateFN('Lista chatrooms'), 'messages' => $user_messages->getHtml(), 'course_title' => '<a href="' . HTTP_ROOT_DIR . '/switcher/switcher.php">' . translateFN('Modulo Switcher') . '</a> > ', 'back_link' => $go_back_link->getHtml());
예제 #5
0
}
if (!isset($mpar)) {
    $mpar = MSG_PAR;
    //messages
}
if (!isset($epar)) {
    $epar = EXE_PAR;
    // exercises
}
/*
 * retrieving student data
 *
 * we shall divide visits from exercises and notes...
 *
*/
$courseObj = read_course_from_DB($courseInstanceObj->id_corso);
if (AMA_DataHandler::isError($courseObj)) {
} else {
    $course_title = $courseObj->titolo;
    $start_date = AMA_DataHandler::ts_to_date($courseInstanceObj->data_inizio);
}
$studentObj = MultiPort::findUser($id_student);
if (AMA_DataHandler::isError($studentObj)) {
    header('Location: tutor.php');
    exit;
} else {
    if ($studentObj instanceof ADAPractitioner) {
        /**
         * @author giorgio 14/apr/2015
         *
         * If student is actually a tutor, build a new student