예제 #1
0
function get_student_indexattFN($id_course_instance, $id_course, $id_student)
{
    // wrapper for Class Student_class (in courses_class.inc.php)
    $student_classObj = new Student_class($id_course_instance);
    $student_dataHa = $student_classObj->find_student_index_att($id_course, $id_course_instance, $id_student);
    if (is_array($student_dataHa)) {
        $dati_stude[0]['name_index_att'] = translateFN("Indice attività");
        $dati_stude[0]['index_att'] = $student_dataHa['index_att'];
        $tObj = new Table();
        // $tObj->initTable('0','center','0','1','100%','black','white','black','white');
        $tObj->initTable('0', 'center', '0', '1', '', '', '', '', '', '1');
        // Syntax: $border,$align,$cellspacing,$cellpadding,$width,$col1, $bcol1,$col2, $bcol2
        $caption = translateFN("Indice attività al") . " {$ymdhms}";
        $summary = translateFN("Dati relativi al corso monitorato");
        $tObj->setTable($dati_stude, $caption, $summary);
        $tabled_report = $tObj->getTable();
    } else {
        $tabled_report = "";
    }
    return $tabled_report;
}
예제 #2
0
 function get_class_tagsFN($sess_id_node, $sess_id_course_instance, $ordering = 's')
 {
     //   ritorna una lista di tag per questo nodo, da tutta la classe
     $dh = $GLOBALS['dh'];
     $error = $GLOBALS['error'];
     $sess_id_course_instance = $GLOBALS['sess_id_course_instance'];
     $sess_id_user = $GLOBALS['sess_id_user'];
     $debug = $GLOBALS['debug'];
     $out_fields_ar = array('id_nodo', 'data', 'descrizione', 'id_utente_studente');
     $dataHa = $dh->find_bookmarks_list($out_fields_ar, '', $sess_id_course_instance, $sess_id_node);
     if (AMA_DataHandler::isError($dataHa)) {
         $msg = $dataHa->getMessage();
         return $msg;
         // header("Location: $error?err_msg=$msg");
     }
     //print_r($dataHa);
     switch ($ordering) {
         case 'd':
             // date or id
         // date or id
         case 'i':
         default:
             $ordered_tagsHa = $dataHa;
             break;
         case 'a':
             // ordering on absolute activity index
             //???
             break;
         case 's':
             // somiglianza tra activity index degli autori con quello dell'utente
             $student_classObj = new Student_class($sess_id_course_instance);
             // conviene farsi dare la lista e ordinarla una volta per tutte ?
             $student_listAr = $student_classObj->student_list;
             foreach ($student_listAr as $student) {
                 $id_student = $student['id_utente_studente'];
                 $student_dataHa = $student_classObj->find_student_index_att($id_course, $sess_id_course_instance, $id_student);
                 $user_activity_index = $student_dataHa['index_att'];
                 $class_student_activityAr[$id_student] = $user_activity_index;
                 //echo "$id_student : $user_activity_index <br>";
             }
             $user_activity_index = $class_student_activityAr[$sess_id_user];
             //print_r($class_student_activityAr);
             //	asort ($class_student_activityAr,SORT_NUMERIC); // ordinamento su indice attività
             //print ($user_activity_index."<br>");
             $ord_tag_ind = array();
             $tagsdataHa = array();
             foreach ($dataHa as $bk_Ar) {
                 //print_r($bk_Ar);
                 $id_bk = $bk_Ar[0];
                 //BK id
                 //$node = $bk_Ar[1];
                 //$date = $bk_Ar[2]; //date
                 //$description = $bk_Ar[3]; //description
                 $author_id = $bk_Ar[4];
                 $author_activity_index = $class_student_activityAr[$author_id];
                 $distance = abs($author_activity_index - $user_activity_index);
                 $ord_tag_ind[$id_bk] = $distance;
                 $tagsdataHa[$id_bk] = $bk_Ar;
                 //echo ("$id_bk : $author_activity_index ; $distance<br>");
             }
             //print_r($ord_tag_ind);
             asort($ord_tag_ind, SORT_NUMERIC);
             // ordinamento su distanza ia da user
             //print_r($ord_tag_ind);
             $ordered_tagsHa = array();
             foreach ($ord_tag_ind as $id_bk => $distance) {
                 //echo ("$id_bk => $distance ;");
                 $ordered_tagsHa[] = $tagsdataHa[$id_bk];
             }
             //print_r($ordered_tagsHa);
             break;
             //...
     }
     return $ordered_tagsHa;
 }