Ejemplo n.º 1
0
 /**
  * add course - test / survey association
  * adds a course node that contains link to test / survey too
  *
  * @global db $dh
  *
  * @param int $id_test
  *
  * @return boolean
  */
 public function add($id_test)
 {
     $dh = $GLOBALS['dh'];
     $test = $dh->test_getNode($id_test);
     if ($dh->isError($test)) {
         return false;
     }
     //creo nodo di riferimento
     $last_node = explode('_', get_max_idFN($this->courseObj->id));
     $new_id = $last_node[1] + 1;
     $new_node_id = $this->courseObj->id . '_' . $new_id;
     $url = MODULES_TEST_HTTP . '/index.php?id_test=' . $id_test;
     $link = CDOMElement::create('a');
     $link->setAttribute('href', $url);
     $link->addChild(new CText($url));
     $nodo_test['id'] = $new_node_id;
     $nodo_test['id_node_author'] = $test['id_utente'];
     $nodo_test['title'] = $test['titolo'];
     $nodo_test['name'] = $test['titolo'];
     $nodo_test['text'] = $link->getHtml();
     $nodo_test['type'] = ADA_CUSTOM_EXERCISE_TEST;
     $nodo_test['parent_id'] = $this->courseObj->id . '_0';
     $nodo_test['order'] = 999;
     $nodo_test['creation_date'] = today_dateFN();
     $nodo_test['pos_x0'] = 0;
     $nodo_test['pos_y0'] = 0;
     $nodo_test['pos_x1'] = 0;
     $nodo_test['pos_y1'] = 0;
     $id_node = $dh->add_node($nodo_test);
     if (empty($id_node) || $dh->isError($id_node)) {
         return false;
     }
     $res = $dh->test_addCourseTest($this->courseObj->id, $id_test, $id_node);
     if (!$dh->isError($res)) {
         return false;
     } else {
         return true;
     }
 }
 * Get needed objects
 */
$neededObjAr = array(AMA_TYPE_STUDENT => array('layout', 'course_instance'));
require_once ROOT_DIR . '/include/module_init.inc.php';
require_once ROOT_DIR . '/browsing/include/browsing_functions.inc.php';
//require_once ROOT_DIR . '/include/CourseInstance.inc.php';
$self = whoami();
// to select the right template
/*
 * INCLUSIONE SPECIFICA PER PAYPAL
 */
if (file_exists(ROOT_DIR . '/browsing/paypal/paypal_conf.inc.php')) {
    require_once ROOT_DIR . '/browsing/paypal/paypal_conf.inc.php';
    $paypal_allowed = TRUE;
}
$today_date = today_dateFN();
$providerId = DataValidator::is_uinteger($_GET['provider']);
$courseId = DataValidator::is_uinteger($_GET['course']);
$instanceId = DataValidator::is_uinteger($_GET['instance']);
$studentId = DataValidator::is_uinteger($_GET['student']);
$testerInfoAr = $common_dh->get_tester_info_from_id($providerId, 'AMA_FETCH_ASSOC');
if (!AMA_Common_DataHandler::isError($testerInfoAr)) {
    $provider_name = $testerInfoAr[1];
    $tester = $testerInfoAr[10];
    $tester_dh = AMA_DataHandler::instance(MultiPort::getDSN($tester));
    $currentTesterId = $newTesterId;
    $GLOBALS['dh'] = $tester_dh;
    $dh = $tester_dh;
    /*
     * GESTIONE LOG
     */
Ejemplo n.º 3
0
    $destinatari = "";
}
if (!isset($course_title)) {
    $course_title = "";
}
//
if (empty($err_msg) or !isset($err_msg)) {
    $err_msg = translateFN('Inserimento appuntamento');
}
if (!isset($ora_evento)) {
    $event_time = today_timeFN();
} else {
    $event_time = $ora_evento;
}
if (!isset($data_evento)) {
    $event_date = today_dateFN();
} else {
    $event_date = $data_evento;
}
/*
$event_time = today_timeFN();
$event_date = today_dateFN();
*/
$ada_address_book = EventsAddressBook::create($userObj);
$tester_TimeZone = MultiPort::getTesterTimeZone($sess_selected_tester);
$time = time() + get_timezone_offset($tester_TimeZone, SERVER_TIMEZONE);
/*
* Last access link
*/
if (isset($_SESSION['sess_id_course_instance'])) {
    $last_access = $userObj->get_last_accessFN($_SESSION['sess_id_course_instance'], "UT", null);
Ejemplo n.º 4
0
 function form_addcourse($file_action, $file_back, $authors_ha, $is_author = 0)
 {
     $root_dir = $GLOBALS['root_dir'];
     // inizializzazione variabili
     $str = "";
     // nome
     $fields["add"][] = "course[nome]";
     $names["add"][] = "Nome";
     $edittypes["add"][] = "text";
     $necessary["add"][] = "true";
     $values["add"][] = "";
     $options["add"][] = "";
     $maxsize["add"][] = 32;
     // titolo
     $fields["add"][] = "course[titolo]";
     $names["add"][] = "Titolo";
     $edittypes["add"][] = "text";
     $necessary["add"][] = "true";
     $values["add"][] = "";
     $options["add"][] = "";
     $maxsize["add"][] = 128;
     // autore
     if ($is_author) {
         $fields["add"][] = "course[id_autore]";
         $names["add"][] = "Autore";
         $edittypes["add"][] = "hidden";
         $necessary["add"][] = "true";
         $values["add"][] = $authors_ha[0][0];
         $options["add"][] = "";
         $maxsize["add"][] = "";
     } else {
         $labels_sel = "";
         $val_sel = "";
         $max = count($authors_ha);
         for ($i = 0; $i < $max; $i++) {
             $labels_sel .= ":" . $authors_ha[$i][1] . " " . $authors_ha[$i][2] . " ";
             if ($i != $max - 1) {
                 $val_sel .= $authors_ha[$i][0] . ":";
             } else {
                 $val_sel .= $authors_ha[$i][0];
             }
         }
         $fields["add"][] = "course[id_autore]";
         $names["add"][] = "Autore {$labels_sel}";
         $edittypes["add"][] = "select";
         $necessary["add"][] = "true";
         $values["add"][] = "";
         $options["add"][] = "{$val_sel}";
         $maxsize["add"][] = "";
     }
     // descrizione
     $fields["add"][] = "course[descr]";
     $names["add"][] = "descrizione";
     $edittypes["add"][] = "textarea";
     $necessary["add"][] = "";
     $values["add"][] = "";
     $options["add"][] = "";
     $maxsize["add"][] = "";
     // data creazione
     if ($is_author) {
         $gma = today_dateFN();
         $fields["add"][] = "course[d_create]";
         $names["add"][] = "data creazione (GG/MM/AAAA)";
         $edittypes["add"][] = "hidden";
         $necessary["add"][] = "";
         $values["add"][] = $gma;
         $options["add"][] = "";
         $maxsize["add"][] = 12;
     } else {
         $fields["add"][] = "course[d_create]";
         $names["add"][] = "data creazione (GG/MM/AAAA)";
         $edittypes["add"][] = "text";
         $necessary["add"][] = "";
         $values["add"][] = "";
         $options["add"][] = "";
         $maxsize["add"][] = 12;
     }
     // data pubblicazione
     if (!$is_author) {
         $fields["add"][] = "course[d_publish]";
         $names["add"][] = "data pubblicazione";
         $edittypes["add"][] = "text";
         $necessary["add"][] = "";
         $values["add"][] = "";
         $options["add"][] = "";
         $maxsize["add"][] = 12;
     }
     // media path
     $fields["add"][] = "course[media_path]";
     $names["add"][] = "media path";
     $edittypes["add"][] = "text";
     $necessary["add"][] = "";
     $values["add"][] = "";
     $options["add"][] = "";
     $maxsize["add"][] = 50;
     $temp_dir_base = $root_dir . "/layout/";
     $layout_OK = dirTree($temp_dir_base);
     $val_sel = "";
     $max = count($layout_OK);
     for ($i = 0; $i < $max; $i++) {
         //if (($layout_OK[$i]!='.') && ($layout_OK[$i]!='..'))
         if ($i != $max - 1) {
             $val_sel .= $layout_OK[$i] . ":";
         } else {
             $val_sel .= $layout_OK[$i];
         }
     }
     // $layout_OK [] = "";
     $fields["add"][] = "course[layout]";
     $names["add"][] = "Layout: {$val_sel}";
     $edittypes["add"][] = "select";
     $necessary["add"][] = "";
     $values["add"][] = $course['layout'];
     $options["add"][] = $val_sel;
     $maxsize["add"][] = 20;
     // id_nodo_toc
     $fields["add"][] = "course[id_nodo_toc]";
     $names["add"][] = "id_nodo_toc";
     $edittypes["add"][] = "text";
     $necessary["add"][] = "";
     $values["add"][] = "";
     $options["add"][] = "";
     $maxsize["add"][] = "";
     // id_nodo_iniziale
     $fields["add"][] = "course[id_nodo_iniziale]";
     $names["add"][] = "id_nodo_iniziale";
     $edittypes["add"][] = "text";
     $necessary["add"][] = "";
     $values["add"][] = "";
     $options["add"][] = "";
     $maxsize["add"][] = "";
     // file XML possibili
     // vito, 15 giugno 2009
     $message = "";
     if ($is_author && (int) $_GET['modello'] == 1) {
         $course_models = read_dir(AUTHOR_COURSE_PATH_DEFAULT, 'xml');
         /*
          * vito, 30 mar 2009
          * Decomment the following lines (those after the comment SEARCH INTO AUTHOR'S UPLOAD DIR)
          * to enable searching for course models into author's
          * upload dir in addition to those stored into AUTHOR_COURSE_PATH_DEFAULT dir.
          *
          * It is necessary to handle this change in admin/author_course_xml_to_db_process.php:
          * now it builds the root dir relative position for the given xml file by prefixing it
          * with AUTHOR_COURSE_PATH_DEFAULT. If we allow searching into the author's upload dir
          * we have to avoid adding this prefix because the filename will be already a root dir
          * relative filename.
          *
          * If an author wants to create a new course based on an existing course model,
          * show him the course models in the course model repository, (common to all authors) and
          * the ones he has uploaded, stored in UPLOAD_PATH/<authorid>.
          * Otherwise, if an admin wants to create a course from an existing model, show him only the
          * course models stored in the course model repository.
          */
         // SEARCH INTO AUTHOR'S UPLOAD DIR
         //        if (!is_array($course_models)) {
         //          $course_models = array();
         //        }
         //        if ($is_author) {
         //	      $authors_uploaded_files = UPLOAD_PATH.$authors_ha[0][0];
         //	      $authors_course_models  = read_dir($authors_uploaded_files, 'xml');
         //	      $course_models = array_merge($course_models, $authors_course_models);
         //        }
         $num_files = 0;
         if (is_array($course_models)) {
             $num_files = sizeof($course_models);
         }
         $val_sel = '';
         $label_sel = '';
         if ($num_files > 0) {
             foreach ($course_models as $value) {
                 //vito, 30 mar 2009
                 // SEARCH INTO AUTHOR'S UPLOAD DIR
                 //$val_sel.=$value['path_to_file'].":";
                 $val_sel .= $value['file'] . ":";
                 $label_sel .= ":" . $value['file'];
             }
             $val_sel = substr($val_sel, 0, -1);
             // vito, 12 giugno 2009
             //}
             //if ($is_author AND ((int)$_GET['modello'])==1) {
             $fields["add"][] = "course[xml]";
             $names["add"][] = "XML" . $label_sel;
             $edittypes["add"][] = "select";
             $necessary["add"][] = "";
             $values["add"][] = "";
             $options["add"][] = $val_sel;
             $maxsize["add"][] = "";
             //}
         } else {
             $message = translateFN("Non sono presenti modelli di corso. E' comunque possibile creare un corso vuoto.");
         }
     }
     // creazione del form
     $str = MakeForm($fields, $names, $edittypes, $necessary, $values, $options, $maxsize, $file_action, "add", false, true);
     // scrittura stringa back
     //  $str .= $this->go_file_back($file_back,"Home");
     return $message . $str;
 }
Ejemplo n.º 5
0
//import_request_variables('GP',ADA_GP_VARIABLES_PREFIX);
extract($_GET, EXTR_OVERWRITE, ADA_GP_VARIABLES_PREFIX);
extract($_POST, EXTR_OVERWRITE, ADA_GP_VARIABLES_PREFIX);
/**
 * Graffio 19/08/2014
 * set the variable $GLOBALS['simpleCleaned'] in order to NOT clean the messagges
 * $GLOBALS['simpleCleaned'] = true means that the clean function is already been executed
 */
$GLOBALS['simpleCleaned'] = true;
/**
 *	Validates $_SESSION data
 */
if (!isset($neededObjAr) || !is_array($neededObjAr)) {
    $neededObjAr = array();
}
if (!isset($allowedUsersAr) || !is_array($allowedUsersAr)) {
    $allowedUsersAr = array();
}
if (!isset($trackPageToNavigationHistory)) {
    $trackPageToNavigationHistory = true;
}
session_controlFN($neededObjAr, $allowedUsersAr, $trackPageToNavigationHistory);
loadServiceTypes();
/**
 * Clears variables specified in $whatAR
 */
if (isset($variableToClearAR) && is_array($variableToClearAR)) {
    clear_dataFN($variableToClearAR);
}
$ymdhms = today_dateFN();
Ejemplo n.º 6
0
 public function course_instance_subscribeable_get_list($field_list_ar, $courseId)
 {
     $today_date = today_dateFN();
     $timestamp = AMA_DataHandler::date_to_ts($today_date);
     //        $timestamp = time();
     //        return $this->course_instance_find_list($field_list_ar, "id_corso=$courseId AND self_registration=1 AND data_inizio=0 AND data_inizio_previsto >= $timestamp and durata > 0  ORDER BY data_inizio_previsto ASC");
     return $this->course_instance_find_list($field_list_ar, "id_corso={$courseId} AND self_registration=1 AND open_subscription=1 ORDER BY data_inizio_previsto ASC");
 }
Ejemplo n.º 7
0
         $risp['id_node_author'] = $_SESSION['sess_id_user'];
         $risp['title'] = "";
         $risp['name'] = $answer['answer'];
         //					if ( isset( $answer['comment'] ) )
         //					{
         //					    $risp['text'] = $answer['comment'];
         //					}
         //					else
         //					{
         //					    $risp['text'] ="";
         //					}
         $risp['text'] = isset($answer['comment']) ? $answer['comment'] : "";
         $risp['type'] = 1;
         $risp['parent_id'] = $node_exercise;
         $risp['correctness'] = $answer['correctness'];
         $risp['creation_date'] = today_dateFN();
         $risp['pos_x0'] = 0;
         $risp['pos_y0'] = 0;
         $risp['pos_x1'] = 0;
         $risp['pos_y1'] = 0;
         // se si tratta di una parola da nascondere in un esercizio di tipo CLOZE
         // memorizzo anche la posizione nella frase
         if ($_SESSION['add_exercise']['exercise_family'] == ADA_CLOZE_EXERCISE_TYPE) {
             $risp['order'] = $answer['hide'];
         }
         $dh->add_node($risp);
         // risposta
     }
 }
 ##### eventuale file
 //if (!empty($_SESSION['add_exercise']['file'])) {
Ejemplo n.º 8
0
 /**
  * Adds a test / survey node
  *
  * @global db $dh
  *
  * @return array an array with 'html' and 'path' keys
  */
 public function add()
 {
     $dh = $GLOBALS['dh'];
     $nodo = new Node($_GET['id_node']);
     if (!AMATestDataHandler::isError($nodo)) {
         $path = $nodo->findPathFN();
     }
     if ($_POST) {
         $data = $_POST;
     } else {
         $data = null;
     }
     require_once MODULES_TEST_PATH . '/include/forms/rootFormTest.inc.php';
     if (get_class($this) == 'TestManagementTest') {
         require_once MODULES_TEST_PATH . '/include/forms/testFormTest.inc.php';
         $form = new TestFormTest($data);
     } else {
         if (get_class($this) == 'SurveyManagementTest') {
             require_once MODULES_TEST_PATH . '/include/forms/surveyFormTest.inc.php';
             $form = new SurveyFormTest($data);
         }
     }
     if ($_POST) {
         $_POST['consegna'] = Node::prepareInternalLinkMediaForDatabase($_POST['consegna']);
         $_POST['testo'] = Node::prepareInternalLinkMediaForDatabase($_POST['testo']);
         if ($form->isValid()) {
             //crea nuovo test con i dati del form
             $this->setTipo();
             $id_corso = explode('_', $nodo->id);
             $id_corso = $id_corso[0];
             $data = array('id_corso' => $id_corso, 'id_utente' => $_SESSION['sess_id_user'], 'id_istanza' => $nodo->instance, 'nome' => $_POST['nome'], 'titolo' => $_POST['titolo'], 'consegna' => $_POST['consegna'], 'testo' => $_POST['testo'], 'tipo' => $this->getTipo(), 'livello' => $_POST['livello'], 'durata' => $_POST['min_level'], 'correttezza' => $_POST['correttezza']);
             $id_test = $dh->test_addNode($data);
             unset($data);
             if (!AMATestDataHandler::isError($id_test)) {
                 //crea nuovo nodo contenente link al test
                 $last_node = explode('_', get_max_idFN($id_corso));
                 $new_id = $last_node[1] + 1;
                 $new_node_id = $id_corso . '_' . $new_id;
                 $order = $dh->get_ordine_max_val($nodo->id);
                 $url = MODULES_TEST_HTTP . '/index.php?id_test=' . $id_test;
                 $link = CDOMElement::create('a');
                 $link->setAttribute('href', $url);
                 $link->addChild(new CText($url));
                 $link = $link->getHtml();
                 $text = $_POST['testo'] . '<br />' . $link;
                 $nodo_test['id'] = $new_node_id;
                 $nodo_test['id_node_author'] = $_SESSION['sess_id_user'];
                 $nodo_test['title'] = $_POST['titolo'];
                 $nodo_test['name'] = $_POST['nome'];
                 $nodo_test['text'] = $text;
                 $nodo_test['type'] = ADA_CUSTOM_EXERCISE_TEST;
                 $nodo_test['parent_id'] = $nodo->id;
                 $nodo_test['order'] = $order + 1;
                 $nodo_test['creation_date'] = today_dateFN();
                 $nodo_test['pos_x0'] = 0;
                 $nodo_test['pos_y0'] = 0;
                 $nodo_test['pos_x1'] = 0;
                 $nodo_test['pos_y1'] = 0;
                 $id_nodo_riferimento = $dh->add_node($nodo_test);
                 if (!AMATestDataHandler::isError($id_nodo_riferimento)) {
                     $data = array('id_nodo_riferimento' => $id_nodo_riferimento);
                     $res = true;
                     if ($this->mode == ADA_TYPE_SURVEY) {
                         //aggiungo record nella tabella dei sondaggi-corsi per lo switcher
                         $res = $dh->test_addCourseTest($id_corso, $id_test, $id_nodo_riferimento);
                     }
                     if ($res && $dh->test_updateNode($id_test, $data)) {
                         redirect(MODULES_TEST_HTTP . '/index.php?id_test=' . $id_test);
                     } else {
                         $html = sprintf(translateFN('Errore durante la creazione del %s'), $this->what);
                     }
                 } else {
                     $html = sprintf(translateFN('Errore durante la creazione del %s'), $this->what);
                 }
             } else {
                 $html = sprintf(translateFN('Errore durante la creazione del %s'), $this->what);
             }
         } else {
             $html = $form->getHtml();
         }
     } else {
         $html = $form->getHtml();
     }
     return array('html' => $html, 'path' => $path);
 }
Ejemplo n.º 9
0
 function get_class_reportFN($id_course, $order = "", $index_att = "", $type = 'HTML')
 {
     $dh = $GLOBALS['dh'];
     $http_root_dir = $GLOBALS['http_root_dir'];
     $debug = isset($GLOBALS['debug']) ? $GLOBALS['debug'] : null;
     $npar = isset($GLOBALS['npar']) ? $GLOBALS['npar'] : null;
     $hpar = isset($GLOBALS['hpar']) ? $GLOBALS['hpar'] : null;
     $mpar = isset($GLOBALS['mpar']) ? $GLOBALS['mpar'] : null;
     $epar = isset($GLOBALS['epar']) ? $GLOBALS['epar'] : null;
     $bpar = isset($GLOBALS['mpar']) ? $GLOBALS['mpar'] : null;
     $cpar = isset($GLOBALS['epar']) ? $GLOBALS['epar'] : null;
     // default parameters for activity index are in configuration file
     if (empty($npar)) {
         $npar = NOTE_PAR;
     }
     // notes
     if (!isset($hpar)) {
         $hpar = HIST_PAR;
     }
     // history
     if (!isset($mpar)) {
         $mpar = MSG_PAR;
     }
     //messages
     if (!isset($epar)) {
         $epar = EXE_PAR;
     }
     // exercises
     if (!isset($bpar)) {
         $bpar = defined('BKM_PAR') ? BKM_PAR : null;
     }
     //bookmarks
     if (!isset($cpar)) {
         $cpar = defined('CHA_PAR') ? CHA_PAR : null;
     }
     // chat
     $student_list_ar = $this->student_list;
     $id_instance = $this->id;
     if ($student_list_ar != 0) {
         $info_course = $dh->get_course($id_course);
         // Get title course
         if (AMA_DataHandler::isError($info_course)) {
             $msg = $info_course->getMessage();
             return $msg;
         }
         $course_title = $info_course['titolo'];
         $instance_course_ha = $dh->course_instance_get($id_instance);
         // Get the instance courses data
         if (AMA_DataHandler::isError($instance_course_ha)) {
             $msg = $instance_course_ha->getMessage();
             return $msg;
         }
         $start_date = AMA_DataHandler::ts_to_date($instance_course_ha['data_inizio'], ADA_DATE_FORMAT);
         $num_student = -1;
         $tot_history_count = 0;
         $tot_exercises_score = 0;
         $tot_exercises_number = 0;
         $tot_added_notes = 0;
         $tot_read_notes = 0;
         $tot_message_count = 0;
         $tot_message_count_in = 0;
         $tot_message_count_out = 0;
         $tot_bookmarks_count = 0;
         $tot_chatlines_count_out = 0;
         $tot_index = 0;
         $tot_level = 0;
         /**
          * @author giorgio 27/ott/2014
          * 
          * change to:
          * $report_generation_TS = time();
          * 
          * to have full date & time generation of report
          * but be warned that table log_classi may grow A LOT!
          */
         $report_generation_TS = dt2tsFN(today_dateFN());
         if (MODULES_TEST) {
             $tot_exercises_score_test = 0;
             $tot_exercises_number_test = 0;
             $tot_exercises_score_survey = 0;
             $tot_exercises_number_survey = 0;
             $test_db = AMATestDataHandler::instance(MultiPort::getDSN($_SESSION['sess_selected_tester']));
             $test_score = $test_db->getStudentsScores($id_course, $id_instance);
         }
         foreach ($student_list_ar as $one_student) {
             $num_student++;
             //starts with 0
             $id_student = $one_student['id_utente_studente'];
             $student_level = $one_student['livello'];
             $status_student = $one_student['status'];
             $dati['id'] = $id_student;
             $dati['level'] = $student_level;
             $ymdhms = today_dateFN();
             $utime = dt2tsFN($ymdhms);
             $dati['date'] = $report_generation_TS;
             if (!empty($id_student) and ($status_student == ADA_STATUS_SUBSCRIBED or $status_student == ADA_SERVICE_SUBSCRIPTION_STATUS_COMPLETED)) {
                 $studentObj = MultiPort::findUser($id_student);
                 //new Student($id_student,$id_instance);
                 if ($studentObj->full != 0) {
                     //==0) {
                     $err_msg = $studentObj->error_msg;
                 } else {
                     if ($studentObj instanceof ADAPractitioner) {
                         /**
                          * @author giorgio 14/apr/2015
                          * 
                          * If student is actually a tutor, build a new student
                          * object for history and evaluation purposes
                          */
                         $studentObj = $studentObj->toStudent();
                     }
                     $student_name = $studentObj->getFullname();
                     //$studentObj->nome." ".$studentObj->cognome;
                     // vito
                     $studentObj->set_course_instance_for_history($id_instance);
                     //$studentObj->history->setCourseInstance($id_instance);
                     $studentObj->history->setCourse($id_course);
                     $studentObj->get_exercise_dataFN($id_instance, $id_student);
                     $st_exercise_dataAr = $studentObj->user_ex_historyAr;
                     $st_score = 0;
                     $st_exer_number = 0;
                     if (is_array($st_exercise_dataAr)) {
                         foreach ($st_exercise_dataAr as $exercise) {
                             $st_score += $exercise[7];
                             $st_exer_number++;
                         }
                     }
                     $dati['exercises'] = $st_exer_number;
                     $dati['score'] = $st_score;
                     if (MODULES_TEST) {
                         $st_score_test = isset($test_score[$id_student]['score_test']) ? $test_score[$id_student]['score_test'] : 0;
                         $st_exer_number_test = isset($test_score[$id_student]['max_score_test']) ? $test_score[$id_student]['max_score_test'] : 0;
                         $dati['exercises_test'] = $st_exer_number_test;
                         $dati['score_test'] = $st_score_test;
                         $st_score_survey = isset($test_score[$id_student]['score_survey']) ? $test_score[$id_student]['score_survey'] : 0;
                         $st_exer_number_survey = isset($test_score[$id_student]['max_score_survey']) ? $test_score[$id_student]['max_score_survey'] : 0;
                         $dati['exercises_survey'] = $st_exer_number_survey;
                         $dati['score_survey'] = $st_score_survey;
                     }
                     $sub_courses = $dh->get_subscription($id_student, $id_instance);
                     if ($sub_courses['tipo'] == ADA_STATUS_SUBSCRIBED) {
                         $out_fields_ar = array('nome', 'titolo', 'id_istanza', 'data_creazione');
                         $clause = "tipo = '" . ADA_NOTE_TYPE . "' AND id_utente = '{$id_student}'";
                         $nodes = $dh->find_course_nodes_list($out_fields_ar, $clause, $id_course);
                         $added_nodes_count = count($nodes);
                         $added_nodes_count_norm = str_pad($added_nodes_count, 5, "0", STR_PAD_LEFT);
                         $added_notes = "<!-- {$added_nodes_count_norm} --><a href={$http_root_dir}/tutor/tutor.php?op=student_notes&id_instance={$id_instance}&id_student={$id_student}>" . $added_nodes_count . "</a>";
                         //$added_notes = $added_nodes_count;
                     } else {
                         $added_notes = "<!-- 0 -->-";
                     }
                     $read_notes_count = $studentObj->total_visited_notesFN($id_student, $id_course);
                     if ($read_notes_count > 0) {
                         $read_nodes_count_norm = str_pad($read_notes_count, 5, "0", STR_PAD_LEFT);
                         $read_notes = "<!-- {$read_nodes_count_norm} -->{$read_notes_count}";
                     } else {
                         $read_notes = "<!-- 0 -->-";
                     }
                     $st_history_count = "0";
                     $debug = 0;
                     $st_history_count = $studentObj->total_visited_nodesFN($id_student, ADA_LEAF_TYPE);
                     // vito, 11 mar 2009. Ottiene solo il numero di visite a nodi di tipo foglia.
                     // vogliamo anche il numero di visite a nodi di tipo gruppo.
                     $st_history_count += $studentObj->total_visited_nodesFN($id_student, ADA_GROUP_TYPE);
                     $dati['visits'] = $st_history_count;
                     $st_name = "<!-- {$student_name} --><a href=" . $http_root_dir . "/tutor/tutor.php?op=zoom_student&id_student=" . $id_student;
                     $st_name .= "&id_course=" . $id_course . "&id_instance=" . $id_instance . ">";
                     $st_name .= $student_name . "</a>";
                     $st_history_count_norm = str_pad($st_history_count, 5, "0", STR_PAD_LEFT);
                     $st_history = "<!-- {$st_history_count_norm} --><a href=" . $http_root_dir . "/tutor/tutor_history.php?id_student=" . $id_student;
                     $st_history .= "&id_course=" . $id_course . "&id_course_instance=" . $id_instance . ">";
                     $st_history .= $st_history_count . "</a>";
                     $st_history_last_access = $studentObj->get_last_accessFN($id_instance, "T");
                     //$dati['date'] = $st_history_last_access;
                     $st_score_norm = str_pad($st_score, 5, "0", STR_PAD_LEFT);
                     $st_exercises = "<!-- {$st_score_norm} --><a href=" . $http_root_dir . "/tutor/tutor_exercise.php?id_student=" . $id_student;
                     $st_exercises .= "&id_course_instance=" . $id_instance . " class='dontwrap'>";
                     $st_exercises .= $st_score . " " . translateFN("su") . " " . $st_exer_number * ADA_MAX_SCORE . "</a>";
                     if (MODULES_TEST) {
                         $st_score_norm_test = str_pad($st_score_test, 5, "0", STR_PAD_LEFT);
                         $st_exercises_test = '<!-- ' . $st_score_norm_test . ' --><a href="' . MODULES_TEST_HTTP . '/tutor.php?op=test&id_course_instance=' . $id_instance . '&id_course=' . $id_course . '&id_student=' . $id_student . '" class="dontwrap">' . $st_score_test . ' ' . translateFN('su') . ' ' . $st_exer_number_test . '</a>';
                         $st_score_norm_survey = str_pad($st_score_survey, 5, "0", STR_PAD_LEFT);
                         $st_exercises_survey = '<!-- ' . $st_score_norm_survey . ' --><a href="' . MODULES_TEST_HTTP . '/tutor.php?op=survey&id_course_instance=' . $id_instance . '&id_course=' . $id_course . '&id_student=' . $id_student . '" class="dontwrap">' . $st_score_survey . ' ' . translateFN('su') . ' ' . $st_exer_number_survey . '</a>';
                     }
                     // user data
                     $dati_stude[$num_student]['id'] = $id_student;
                     $dati_stude[$num_student]['student'] = $st_name;
                     // history
                     $dati_stude[$num_student]['history'] = $st_history;
                     $tot_history_count += $st_history_count;
                     if ($st_history_last_access != "-") {
                         $dati_stude[$num_student]['last_access'] = "<a href=\"{$http_root_dir}/tutor/tutor_history_details.php?period=1&id_student={$id_student}&id_course_instance={$id_instance}&id_course={$id_course}\">" . $st_history_last_access . "</a>";
                         $dati['last_access'] = $studentObj->get_last_accessFN($id_instance, 'UT');
                     } else {
                         $dati_stude[$num_student]['last_access'] = $st_history_last_access;
                         $dati['last_access'] = null;
                     }
                     // exercises
                     $tot_exercises_score += $st_score;
                     $tot_exercises_number += $st_exer_number;
                     $dati_stude[$num_student]['exercises'] = $st_exercises;
                     $dati['exercises'] = $st_exer_number;
                     if (MODULES_TEST) {
                         $tot_exercises_score_test += $st_score_test;
                         $tot_exercises_number_test += $st_exer_number_test;
                         $dati_stude[$num_student]['exercises_test'] = $st_exercises_test;
                         $dati['exercises_test'] = $st_exer_number_test;
                         $tot_exercises_score_survey += $st_score_survey;
                         $tot_exercises_number_survey += $st_exer_number_survey;
                         $dati_stude[$num_student]['exercises_survey'] = $st_exercises_survey;
                         $dati['exercises_survey'] = $st_exer_number_survey;
                     }
                     // forum notes written
                     $dati_stude[$num_student]['added_notes'] = $added_notes;
                     $tot_added_notes += $added_nodes_count;
                     $dati['added_notes'] = $added_nodes_count;
                     // forum notes read
                     $dati_stude[$num_student]['read_notes'] = $read_notes;
                     $tot_read_notes += $read_notes_count;
                     $dati['read_notes'] = $read_notes_count;
                     // messages
                     //$mh = new MessageHandler("%d/%m/%Y - %H:%M:%S");
                     $mh = MessageHandler::instance(MultiPort::getDSN($_SESSION['sess_selected_tester']));
                     $sort_field = "data_ora desc";
                     // messages received
                     $msgs_ha = $mh->get_messages($id_student, ADA_MSG_SIMPLE, array("id_mittente", "data_ora"), $sort_field);
                     if (AMA_DataHandler::isError($msgs_ha)) {
                         $err_code = $msgs_ha->code;
                         $dati_stude[$num_student]['message_count_in'] = "-";
                     } else {
                         $user_message_count = count($msgs_ha);
                         $dati_stude[$num_student]['message_count_in'] = $user_message_count;
                         $tot_message_count += $user_message_count;
                     }
                     $tot_message_count_in += $user_message_count;
                     $dati['msg_in'] = $user_message_count;
                     // messages sent
                     $msgs_ha = $mh->get_sent_messages($id_student, ADA_MSG_SIMPLE, array("id_mittente", "data_ora"), $sort_field);
                     if (AMA_DataHandler::isError($msgs_ha)) {
                         $err_code = $msgs_ha->code;
                         $dati_stude[$num_student]['message_count_out'] = "-";
                     } else {
                         $user_message_count = count($msgs_ha);
                         $dati_stude[$num_student]['message_count_out'] = $user_message_count;
                         $tot_message_count += $user_message_count;
                     }
                     $tot_message_count_out += $user_message_count;
                     $dati['msg_out'] = $user_message_count;
                     //chat..
                     $msgs_ha = $mh->get_sent_messages($id_student, ADA_MSG_CHAT, array("id_mittente", "data_ora"), $sort_field);
                     if (AMA_DataHandler::isError($msgs_ha)) {
                         $err_code = $msgs_ha->code;
                         $dati_stude[$num_student]['chat'] = "-";
                     } else {
                         $chatlines_count_out = count($msgs_ha);
                         $dati_stude[$num_student]['chat'] = $chatlines_count_out;
                         $tot_chatlines_count_out += $chatlines_count_out;
                     }
                     $tot_chatlines_count_out += $chatlines_count_out;
                     $dati['chat'] = $chatlines_count_out;
                     //bookmarks..
                     include_once 'bookmark_class.inc.php';
                     $bookmarks_count = count(Bookmark::get_bookmarks($id_student));
                     $dati_stude[$num_student]['bookmarks'] = $bookmarks_count;
                     $tot_bookmarks_count += $bookmarks_count;
                     $dati['bookmarks'] = $bookmarks_count;
                     // activity index
                     if (empty($index_att)) {
                         // parametro passato alla funzione
                         if (empty($GLOBALS['index_activity_expression'])) {
                             //
                             if (!isset($bcount)) {
                                 $bcount = 1;
                             }
                             $index = $added_nodes_count * $npar + $st_history_count * $hpar + $user_message_count * $mpar + $st_exer_number * $epar + $bookmarks_count * $bcount + $chatlines_count_out * $cpar;
                         } else {
                             $index = eval($GLOBALS['index_activity_expression']);
                         }
                     } else {
                         $index = eval($index_att);
                     }
                     $dati_stude[$num_student]['index'] = $index;
                     //echo $index;
                     $tot_index += $index;
                     $dati['index'] = $index;
                     // level
                     $tot_level += $student_level;
                     $dati_stude[$num_student]['level'] = '<span id="studentLevel_' . $id_student . '">' . $student_level . '</span>';
                     $forceUpdate = false;
                     $linksHtml = $this->generateLevelButtons($id_student, $forceUpdate);
                     $dati_stude[$num_student]['level_plus'] = !is_null($linksHtml) ? $linksHtml : '-';
                     // inserting a row in table log_classi
                     $this->log_class_data($id_course, $id_instance, $dati);
                 }
             }
         }
         // average data
         $tot_students = $num_student + 1;
         $av_history = $tot_history_count / $tot_students;
         $av_exercises = $tot_exercises_score / $tot_students . " " . translateFN("su") . " " . floor($tot_exercises_number * ADA_MAX_SCORE / $tot_students);
         if (MODULES_TEST) {
             $av_exercises_test = round($tot_exercises_score_test / $tot_students, 2) . ' ' . translateFN('su') . ' ' . floor($tot_exercises_number_test / $tot_students);
             $av_exercises_survey = round($tot_exercises_score_survey / $tot_students, 2) . ' ' . translateFN('su') . ' ' . floor($tot_exercises_number_survey / $tot_students);
         }
         $av_added_notes = $tot_added_notes / $tot_students;
         $av_read_notes = $tot_read_notes / $tot_students;
         $av_message_count_in = $tot_message_count_in / $tot_students;
         $av_message_count_out = $tot_message_count_out / $tot_students;
         $av_chat_count_out = $tot_chatlines_count_out / $tot_students;
         $av_bookmarks_count = $tot_bookmarks_count / $tot_students;
         $av_index = $tot_index / $tot_students;
         $av_level = $tot_level / $tot_students;
         $av_student = $tot_students;
         $dati_stude[$av_student]['id'] = "-";
         $dati_stude[$av_student]['student'] = translateFN("Media");
         $dati_stude[$av_student]['history'] = round($av_history, 2);
         $dati_stude[$av_student]['last_access'] = "-";
         $dati_stude[$av_student]['exercises'] = '<span class="dontwrap">' . $av_exercises . '</span>';
         if (MODULES_TEST) {
             $dati_stude[$av_student]['exercises_test'] = '<span class="dontwrap">' . $av_exercises_test . '</span>';
             $dati_stude[$av_student]['exercises_survey'] = '<span class="dontwrap">' . $av_exercises_survey . '</span>';
         }
         $dati_stude[$av_student]['added_notes'] = round($av_added_notes, 2);
         $dati_stude[$av_student]['read_notes'] = round($av_read_notes, 2);
         $dati_stude[$av_student]['message_count_in'] = round($av_message_count_in, 2);
         $dati_stude[$av_student]['message_count_out'] = round($av_message_count_out, 2);
         $dati_stude[$av_student]['chat'] = round($av_chat_count_out, 2);
         $dati_stude[$av_student]['bookmarks'] = round($av_bookmarks_count, 2);
         $dati_stude[$av_student]['index'] = round($av_index, 2);
         $dati_stude[$av_student]['level'] = '<span id="averageLevel">' . round($av_level, 2) . '</span>';
         $dati_stude[$av_student]['level_plus'] = "-";
         // @author giorgio 16/mag/2013
         // was $dati_stude[$av_student]['level_minus'] = "-";
         // $dati_stude[$av_student]['level_less'] = "-";
         if (!empty($order)) {
             //var_dump($dati_stude);
             $dati_stude = masort($dati_stude, $order, 1, SORT_NUMERIC);
         }
         // TABLE LABELS
         $table_labels[0] = $this->generate_class_report_header();
         /**
          * @author giorgio 16/mag/2013
          * 
          * unset the unwanted columns data and labels. unwanted cols are defined in config/config_class_report.inc.php
          */
         $arrayToUse = 'report' . $type . 'ColArray';
         $this->clean_class_reportFN($arrayToUse, $table_labels, $dati_stude);
         return array('report_generation_date' => $report_generation_TS) + array_merge($table_labels, $dati_stude);
     } else {
         return null;
     }
 }
Ejemplo n.º 10
0
 public static function render($layout_dataAr = array(), $content_dataAr = array(), $renderer = NULL, $options = array(), $menuoptions = array())
 {
     /**
      * @author giorgio 03/apr/2014
      * 
      * If query string wants a pdf, let's obey by setting the $renderer
      */
     if (isset($_GET['pdfExport']) && intval($_GET['pdfExport']) === 1) {
         $renderer = ARE_PDF_RENDER;
     }
     if (!isset($id_profile)) {
         $id_profile = null;
     }
     switch ($renderer) {
         case ARE_PRINT_RENDER:
             $layoutObj = read_layout_from_DB($id_profile, isset($layout_dataAr['family']) ? $layout_dataAr['family'] : '', isset($layout_dataAr['node_type']) ? $layout_dataAr['node_type'] : '', isset($layout_dataAr['node_author_id']) ? $layout_dataAr['node_author_id'] : '', isset($layout_dataAr['node_course_id']) ? $layout_dataAr['node_course_id'] : '', isset($layout_dataAr['module_dir']) ? $layout_dataAr['module_dir'] : '');
             // TODO: controlli su layoutObj
             $layout_template = $layoutObj->template;
             $layout_CSS = $layoutObj->CSS_filename;
             if (!empty($layout_dataAr['CSS_filename']) && is_array($layout_dataAr['CSS_filename'])) {
                 $tmp = explode(';', $layoutObj->CSS_filename);
                 $tmp = array_merge($tmp, $layout_dataAr['CSS_filename']);
                 //$tmp = array_merge($layout_dataAr['JS_filename'],$tmp);
                 $layoutObj->CSS_filename = implode(';', $tmp);
                 $layout_CSS = implode(';', $tmp);
             }
             /*
              * optional arguments for HTML constructor
              */
             $user_name = isset($options['user_name']) ? $options['user_name'] : '';
             $course_title = isset($options['course_title']) ? $options['course_title'] : '';
             $node_title = isset($options['node_title']) ? $options['user_name'] : '';
             $meta_keywords = isset($options['meta_keywords']) ? $options['meta_keywords'] : '';
             $author = isset($options['author']) ? $options['author'] : '';
             $meta_refresh_time = isset($options['meta_refresh_time']) ? $options['meta_refresh_time'] : '';
             $meta_refresh_url = isset($options['meta_refresh_url']) ? $options['meta_refresh_url'] : '';
             $onload_func = isset($options['onload_func']) ? $options['onload_func'] : '';
             $static_dir = isset($options['static_dir']) ? $options['static_dir'] : ROOT_DIR . 'services/media/cache/';
             $html_renderer = new HTML($layout_template, $layout_CSS, $user_name, $course_title, $node_title, $meta_keywords, $author, null, null, $onload_func, $layoutObj);
             $html_renderer->fillin_templateFN($content_dataAr);
             $imgpath = dirname($layout_template);
             $html_renderer->resetImgSrcFN($imgpath, isset($layoutObj->family) ? $layoutObj->family : ADA_TEMPLATE_FAMILY);
             $html_renderer->apply_styleFN();
             $html_renderer->outputFN('page');
             break;
         case ARE_XML_RENDER:
             $today = today_dateFN();
             $title = $options['course_title'];
             $portal = $options['portal'];
             $xml_renderer = new Generic_XML($portal, $today, $title);
             $xml_renderer->idNode = $options['id'];
             $xml_renderer->URL = $options['URL'];
             $xml_renderer->fillinFN($content_dataAr);
             $xml_renderer->outputFN('page');
             break;
         case ARE_FILE_RENDER:
             $layoutObj = read_layout_from_DB($id_profile, isset($layout_dataAr['family']) ? $layout_dataAr['family'] : null, isset($layout_dataAr['node_type']) ? $layout_dataAr['node_type'] : null, isset($layout_dataAr['node_author_id']) ? $layout_dataAr['node_author_id'] : null, isset($layout_dataAr['node_course_id']) ? $layout_dataAr['node_course_id'] : null, isset($layout_dataAr['module_dir']) ? $layout_dataAr['module_dir'] : null);
             // TODO: controlli su layoutObj
             $layout_template = $layoutObj->template;
             $layout_CSS = $layoutObj->CSS_filename;
             /*
              * optional arguments for HTML constructor
              */
             $user_name = isset($options['user_name']) ? $options['user_name'] : '';
             $course_title = isset($options['course_title']) ? $options['course_title'] : '';
             $node_title = isset($options['node_title']) ? $options['user_name'] : '';
             $meta_keywords = isset($options['meta_keywords']) ? $options['meta_keywords'] : '';
             $author = isset($options['author']) ? $options['author'] : '';
             $meta_refresh_time = isset($options['meta_refresh_time']) ? $options['meta_refresh_time'] : '';
             $meta_refresh_url = isset($options['meta_refresh_url']) ? $options['meta_refresh_url'] : '';
             $onload_func = isset($options['onload_func']) ? $options['onload_func'] : '';
             $static_dir = isset($options['static_dir']) ? $options['static_dir'] : ROOT_DIR . 'services/media/cache/';
             if (!file_exists($static_dir)) {
                 mkdir($static_dir);
             }
             $static_filename = md5($_SERVER['REQUEST_URI'] . $_SERVER['QUERY_STRING']);
             $cached_file = $static_dir . $static_filename;
             $html_renderer = new HTML($layout_template, $layout_CSS, $user_name, $course_title, $node_title, $meta_keywords, $author, $meta_refresh_time, $meta_refresh_url, $onload_func, $layoutObj);
             $html_renderer->full_static_filename = $cached_file;
             $html_renderer->static_filename = $static_filename;
             $html_renderer->fillin_templateFN($content_dataAr);
             $imgpath = dirname($layout_template);
             $html_renderer->resetImgSrcFN($imgpath, isset($layoutObj->family) ? $layoutObj->family : ADA_TEMPLATE_FAMILY);
             $html_renderer->apply_styleFN();
             $html_renderer->outputFN('file');
             break;
         case ARE_HTML_RENDER:
         case ARE_PDF_RENDER:
         default:
             $layoutObj = read_layout_from_DB($id_profile, isset($layout_dataAr['family']) ? $layout_dataAr['family'] : null, isset($layout_dataAr['node_type']) ? $layout_dataAr['node_type'] : null, isset($layout_dataAr['node_author_id']) ? $layout_dataAr['node_author_id'] : null, isset($layout_dataAr['node_course_id']) ? $layout_dataAr['node_course_id'] : null, isset($layout_dataAr['module_dir']) ? $layout_dataAr['module_dir'] : null);
             // TODO: controlli su layoutObj
             $layout_template = $layoutObj->template;
             $layout_CSS = $layoutObj->CSS_filename;
             /**
              * @author giorgio 19/ago/2014
              * 
              * fix javascript inclusion as follows:
              * - if the PhP has not included JQUERY, include it as first element
              * - if the PhP has not included SEMANTICUI_JS, include it just after JQUERY
              * - if the PhP has not included JQUERY_NO_CONFLICT include it as last element
              * 
              * This way, any PhP can include what it needs and in the right order of inclusion
              */
             /**
              * @author giorgio 10/nov/2014
              * 
              * If the browser is InternetExplorer 8 or less, use smartmenus instead of semantic-ui
              * 
              * NOTE: $_SESSION['IE-version'] is set by module_init_functions.inc.php
              */
             $JSToUse = isset($_SESSION['IE-version']) && $_SESSION['IE-version'] !== false && $_SESSION['IE-version'] <= 8 ? SMARTMENUS_JS : SEMANTICUI_JS;
             $CSSToUse = isset($_SESSION['IE-version']) && $_SESSION['IE-version'] !== false && $_SESSION['IE-version'] <= 8 ? SMARTMENUS_CSS : SEMANTICUI_CSS;
             if (!empty($layout_dataAr['JS_filename']) && is_array($layout_dataAr['JS_filename'])) {
                 // if jquery is not included in the script itself, add it at first position
                 if (!in_array(JQUERY, $layout_dataAr['JS_filename'])) {
                     $layout_dataAr['JS_filename'] = array_merge(array(JQUERY), $layout_dataAr['JS_filename']);
                 }
                 // if $JSToUse is not included in the script itself, add it just after JQUERY
                 if (!in_array($JSToUse, $layout_dataAr['JS_filename'])) {
                     // find the key for JQUERY
                     $key = array_search(JQUERY, $layout_dataAr['JS_filename']);
                     // add $JSToUse after JQUERY slicing the original array
                     $layout_dataAr['JS_filename'] = array_merge(array_slice($layout_dataAr['JS_filename'], 0, $key + 1), array($JSToUse), array_slice($layout_dataAr['JS_filename'], $key + 1));
                 }
                 // if jquery noconflict is not included in the script itself, add it at last position
                 if (!in_array(JQUERY_NO_CONFLICT, $layout_dataAr['JS_filename'])) {
                     array_push($layout_dataAr['JS_filename'], JQUERY_NO_CONFLICT);
                 }
                 $tmp = explode(';', $layoutObj->JS_filename);
                 $tmp = array_merge($tmp, $layout_dataAr['JS_filename']);
                 //$tmp = array_merge($layout_dataAr['JS_filename'],$tmp);
                 $layoutObj->JS_filename = implode(';', $tmp);
             } else {
                 // add jquery, semantic and jquery noconflict
                 $layoutObj->JS_filename .= ';' . JQUERY . ';' . $JSToUse . ';' . JQUERY_NO_CONFLICT;
             }
             $tmp = explode(';', $layoutObj->CSS_filename);
             if (!empty($layout_dataAr['CSS_filename']) && is_array($layout_dataAr['CSS_filename'])) {
                 $tmp = array_merge($tmp, $layout_dataAr['CSS_filename']);
             }
             /**
              * @author giorgio 06/ago/2014
              * add $CSSToUse last
              */
             $tmp[] = $CSSToUse;
             //$tmp = array_merge($layout_dataAr['JS_filename'],$tmp);
             $layoutObj->CSS_filename = implode(';', $tmp);
             $layout_CSS = implode(';', $tmp);
             /*
              * optional arguments for HTML constructor
              */
             $user_name = isset($options['user_name']) ? $options['user_name'] : '';
             $course_title = isset($options['course_title']) ? $options['course_title'] : '';
             $node_title = isset($options['node_title']) ? $options['user_name'] : '';
             $meta_keywords = isset($options['meta_keywords']) ? $options['meta_keywords'] : '';
             $author = isset($options['author']) ? $options['author'] : '';
             $meta_refresh_time = isset($options['meta_refresh_time']) ? $options['meta_refresh_time'] : '';
             $meta_refresh_url = isset($options['meta_refresh_url']) ? $options['meta_refresh_url'] : '';
             $onload_func = isset($options['onload_func']) ? $options['onload_func'] : '';
             /**
              * @author giorgio 19/ago/2014
              *
              * make menu here
              */
             require_once ROOT_DIR . '/include/menu_class.inc.php';
             // menu property created 'on-the-fly'
             $layoutObj->menu = new Menu($layoutObj->module_dir, basename($_SERVER['SCRIPT_FILENAME']), $_SESSION['sess_userObj']->getType(), $menuoptions);
             if ($renderer == ARE_PDF_RENDER) {
                 $orientation = isset($options['orientation']) ? $options['orientation'] : '';
                 $outputfile = isset($options['outputfile']) ? $options['outputfile'] : '';
                 // must be called $html_renderer for below code, but it's not :)
                 $html_renderer = new PDF($layout_template, $layout_CSS, $user_name, $course_title, $node_title, $meta_keywords, $author, $meta_refresh_time, $meta_refresh_url, $onload_func, $layoutObj, $outputfile, $orientation);
             } else {
                 $html_renderer = new HTML($layout_template, $layout_CSS, $user_name, $course_title, $node_title, $meta_keywords, $author, $meta_refresh_time, $meta_refresh_url, $onload_func, $layoutObj);
             }
             /**
              * @author giorgio 25/set/2013
              * merge the content_dataAr with the one generated by the widgets if it's needed
              */
             if (!is_null($layoutObj->WIDGET_filename)) {
                 if (!isset($layout_dataAr['widgets'])) {
                     $layout_dataAr['widgets'] = '';
                 }
                 $widgets_dataAr = $html_renderer->fillin_widgetsFN($layoutObj->WIDGET_filename, $layout_dataAr['widgets']);
                 if (!ADA_Error::isError($widgets_dataAr)) {
                     $content_dataAr = array_merge($content_dataAr, $widgets_dataAr);
                 }
             }
             /**
              * adamenu must be the first key of $content_dataAr
              * for the template_field substitution to work inside the menu
              */
             $content_dataAr = array('adamenu' => $layoutObj->menu->getHtml()) + $content_dataAr;
             $content_dataAr['isVertical'] = $layoutObj->menu->isVertical() ? ' vertical' : '';
             $html_renderer->fillin_templateFN($content_dataAr);
             $imgpath = dirname($layout_template);
             // $html_renderer->resetImgSrcFN($imgpath,$template_family);
             $html_renderer->resetImgSrcFN($imgpath, $layoutObj->family);
             $html_renderer->apply_styleFN();
             $html_renderer->outputFN($renderer == ARE_PDF_RENDER ? 'pdf' : 'page');
             break;
     }
 }
Ejemplo n.º 11
0
 */
if (!isset($op)) {
    $op = 'default';
}
$title = translateFN('ADA - Lista eventi');
// Who's online
// $online_users_listing_mode = 0 (default) : only total numer of users online
// $online_users_listing_mode = 1  : username of users
// $online_users_listing_mode = 2  : username and email of users
$online_users_listing_mode = 2;
$online_users = ADALoggableUser::get_online_usersFN($sess_id_course_instance, $online_users_listing_mode);
// CHAT, BANNER etc
$banner = (include ROOT_DIR . '/include/banner.inc.php');
// default status:
if (empty($status) or !isset($status)) {
    $status = translateFN('Lista appuntamenti del') . ' ' . today_dateFN() . ' - ' . today_timeFN();
} else {
    $status = urldecode($status);
}
// Has the form been posted?
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    // build array of messages ids to be set as read
    if (isset($form) and in_array('read', array_keys($form)) and count($form['read'])) {
        $to_set_as_read_ar = $form['read'];
    } else {
        $to_set_as_read_ar = array();
    }
    // set all read events
    //$res = $mh->set_messages($sess_id_user, $to_set_as_read_ar, 'R');
    $res = MultiPort::markUserAppointmentsAsRead($userObj, $to_set_as_read_ar);
    if (AMA_DataHandler::isError($res)) {
Ejemplo n.º 12
0
 public static function hasThisUserAVideochatAppointment(ADALoggableUser $userObj)
 {
     $id_course_instance = DataValidator::is_uinteger($_SESSION['sess_id_course_instance']);
     if ($id_course_instance === FALSE) {
         return FALSE;
     }
     $fields_list_Ar = array('id_mittente', 'data_ora', 'titolo', 'priorita', 'read_timestamp');
     $clause = '(flags & ' . ADA_VIDEOCHAT_EVENT . ') AND (flags & ' . ADA_EVENT_CONFIRMED . ')';
     $sort_field = 'data_ora desc';
     $mh = MessageHandler::instance(self::getDSN($_SESSION['sess_selected_tester']));
     $msgs_ha = $mh->find_messages($userObj->getId(), ADA_MSG_AGENDA, $fields_list_Ar, $clause, $sort_field);
     if (!AMA_DataHandler::isError($msgs_ha)) {
         $today_time = today_timeFN();
         $today_date = today_dateFN();
         $today_time_date = date(ADA_DATE_FORMAT);
         foreach ($msgs_ha as $one_date) {
             $time_2_add = 30 * 60;
             // 30 minuti di arrotondamento.
             $unix_date_app_rounded = $one_date[1] + $time_2_add;
             $udate_now = time();
             if ($udate_now >= $one_date[1] and $udate_now <= $unix_date_app_rounded) {
                 $event_token = ADAEventProposal::extractEventToken($one_date[2]);
                 return $event_token;
             }
         }
     }
     return FALSE;
 }
Ejemplo n.º 13
0
    // Date in the past
    header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
    // always modified
    header("Cache-Control: no-store, no-cache, must-revalidate");
    // HTTP/1.1
    header("Cache-Control: post-check=0, pre-check=0", false);
    header("Pragma: no-cache");
    // HTTP/1.0
    //header("Content-Type: text/plain");
    header("Content-Type: text/html");
    //header("Content-Length: ".filesize($name));
    header("Content-Disposition: attachment; filename={$name_tmp}");
    echo $log_text;
    exit;
} else {
    $date = today_dateFN() . " " . today_timeFN() . "\n";
    $log_form = new Form();
    $log_data = array(array('label' => "", 'type' => 'textarea', 'name' => 'log_today', 'rows' => '10', 'cols' => '80', 'wrap' => 'virtual', 'value' => $date), array('label' => "", 'type' => 'hidden', 'name' => 'log_text', 'value' => $log_text), array('label' => '', 'type' => 'submit', 'name' => 'Submit', 'value' => 'Salva'));
    $log_form->initForm("{$http_root_dir}/browsing/mylog.php", "POST", "multipart/form-data");
    $log_form->setForm($log_data);
    $log_data = $log_form->getForm();
    $log_data .= $log_text;
}
$export_log_link = "<a href={$http_root_dir}/browsing/mylog.php?op=export>" . translateFN("Esporta") . "</a><br/>";
// Who's online
// $online_users_listing_mode = 0 (default) : only total numer of users online
// $online_users_listing_mode = 1  : username of users
// $online_users_listing_mode = 2  : username and email of users
$online_users_listing_mode = 2;
$online_users = ADALoggableUser::get_online_usersFN($sess_id_course_instance, $online_users_listing_mode);
/*