Esempio n. 1
0
 /**
  * performs user login using the ADA db
  * 
  * (non-PHPdoc)
  * @see iLogin::doLogin()
  */
 public function doLogin($name, $pass, $remindMe, $language)
 {
     $user = MultiPort::loginUser($name, $pass);
     if (is_object($user) && $user instanceof ADALoggableUser) {
         // WARNING! For this login provider, no set of options is supported
         $this->setSuccessfulOptionsID(0);
     }
     return $user;
 }
Esempio n. 2
0
 /**
  *
  * @param Node $n The node for which calculate the previous and next node link
  * @param array $params
  */
 public function __construct(Node $n, $params = array())
 {
     $this->_currentNode = $n->id;
     $prevId = DataValidator::validate_node_id($params['prevId']);
     if ($prevId !== false) {
         $this->_previousNode = $prevId;
     } else {
         $this->findPreviousNode($n, $params['userLevel']);
     }
     $nextId = DataValidator::validate_node_id($params['nextId']);
     if ($nextId !== false) {
         $this->_nextNode = $nextId;
     } else {
         $this->findNextNode($n, $params['userLevel']);
     }
     /**
      * @author giorgio 08/ott/2013
      * check if this is a node wich has been generated when creating a test.
      * If it is, next node is the first topic of the test.
      * BUT, I'll pass the computed $this->_nextNode to give a callBack point
      * to be used when user is in the last topic of the test.
      */
     if (MODULES_TEST && strpos($n->type, (string) constant('ADA_PERSONAL_EXERCISE_TYPE')) === 0) {
         if (isset($GLOBALS['dh'])) {
             $GLOBALS['dh']->disconnect();
         }
         $test_db = AMATestDataHandler::instance(MultiPort::getDSN($_SESSION['sess_selected_tester']));
         $res = $test_db->test_getNodes(array('id_nodo_riferimento' => $n->id));
         if (!empty($res) && count($res) == 1 && !AMA_DataHandler::isError($res)) {
             $node = array_shift($res);
             $this->_nextTestNode = $node['id_nodo'];
         }
         /**
          * @author giorgio 06/nov/2013
          * must check if computed $this->_previousNode points to a test
          * and get last topic if it does.
          */
         if (!is_null($this->_previousNode)) {
             $res = $test_db->test_getNodes(array('id_nodo_riferimento' => $this->_previousNode));
         } else {
             $res = array();
         }
         if (!empty($res) && count($res) == 1 && !AMA_DataHandler::isError($res)) {
             $node = array_shift($res);
             $test = NodeTest::readTest($node['id_nodo'], $test_db);
             $this->_prevTestTopic = count($test->_children);
             $this->_prevTestNode = $node['id_nodo'];
         }
         $test_db->disconnect();
     }
 }
 /**
  * method that checks if the contidion is satisfied
  * for the passed id_user in the passed id_course_instance
  *
  * @param int $id_course_instance
  * @param int $id_user
  * @return boolean true if condition is satisfied
  * @access public
  */
 private function isSatisfied($id_course_instance = null, $id_student = null)
 {
     $user = MultiPort::findUser($id_student, $id_course_instance);
     if ($user instanceof ADAUser && isset($GLOBALS['dh'])) {
         $level = $user->get_student_level($id_student, $id_course_instance);
         if (!AMA_DB::isError($level) && is_numeric($level)) {
             if (intval($this->_param) === 0) {
                 $course_id = $GLOBALS['dh']->get_course_id_for_course_instance($id_course_instance);
                 if (!AMA_DB::isError($course_id) && is_numeric($course_id)) {
                     $max_level = $GLOBALS['dh']->get_course_max_level($course_id);
                     if (!AMA_DB::isError($max_level) && is_numeric($max_level)) {
                         return intval($level) > intval($max_level);
                     }
                 }
             } else {
                 if (is_numeric($this->_param)) {
                     return intval($level) > intval($this->_param);
                 }
             }
         }
     }
     return false;
 }
Esempio n. 4
0
        if ($userId !== false) {
            $editUserObj = MultiPort::findUser($userId);
        }
        break;
}
if (!is_null($editUserObj) && isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'POST') {
    $form = new UserProfileForm($languages);
    $form->fillWithPostData();
    if ($form->isValid()) {
        $user_layout = $_POST['layout'];
        $editUserObj->fillWithArrayData($_POST);
        // save extra datas if it has been forced
        if (isset($_POST['forceSaveExtra']) && $editUserObj->hasExtra()) {
            $editUserObj->setExtras($_POST);
        }
        MultiPort::setUser($editUserObj, array(), true, ADAUser::getExtraTableName());
        /**
         * Set the session user to the saved one if it's not
         * a switcher, that is not saving its own profile
         */
        if ($userObj->getType() != AMA_TYPE_SWITCHER) {
            $_SESSION['sess_userObj'] = $editUserObj;
        }
        // if registration form is saved ok and userObj is not a switcher,
        //  force a page reload to reflect the changes immediately
        $retArray = array("status" => "OK", "title" => $title, "msg" => translateFN('Scheda Anagrafica Salvata'), "reload" => true);
    } else {
        $retArray = array("status" => "ERROR", "title" => $title, "msg" => translateFN("I dati non sono validi"));
    }
} else {
    if (is_null($editUserObj)) {
Esempio n. 5
0
 $users_infoAr = $dh->course_instance_students_presubscribe_get_list($id_course_instance);
 if (AMA_DataHandler::isError($users_infoAr)) {
     $errObj = new ADA_Error($users_infoAr, translateFN("Errore nell'ottenimento dei dati dello studente"), NULL, NULL, NULL, $userObj->getHomePage());
 }
 /*
  * Get tutored user info
  */
 /*
  * In ADA only a student can be subscribed to a specific course instance
  * if the service has level < 4.
  * TODO: handle form generation for service with level = 4 and multiple users
  * subscribed.
  */
 $user_infoAr = $users_infoAr[0];
 $id_user = $user_infoAr['id_utente_studente'];
 $tutoredUserObj = MultiPort::findUser($id_user);
 $service_infoAr['id_istanza_corso'] = $id_course_instance;
 $service_infoAr['event_token'] = $event_token;
 /*
  * Check if an eguidance session with this event_token exists. In this case,
  * use this data to fill the form.
  */
 $eguidance_session_dataAr = $dh->get_eguidance_session_with_event_token($event_token);
 if (!AMA_DataHandler::isError($eguidance_session_dataAr)) {
     if ($is_popup) {
         $eguidance_session_dataAr['is_popup'] = true;
     }
     $form = TutorModuleHtmlLib::getEditEguidanceDataForm($tutoredUserObj, $service_infoAr, $eguidance_session_dataAr);
 } else {
     $last_eguidance_session_dataAr = $dh->get_last_eguidance_session($id_course_instance);
     if (AMA_DataHandler::isError($last_eguidance_session_dataAr)) {
Esempio n. 6
0
 protected static function fillAddressBook(ADALoggableUser $userObj, $user_types_Ar = array())
 {
     $user_type = $userObj->getType();
     $common_dh = $GLOBALS['common_dh'];
     $dh = $GLOBALS['dh'];
     // this tells get_users_by_type method to get nome, cognome....
     $retrieve_extended_data = true;
     if (!is_array($user_types_Ar[$user_type]) || empty($user_types_Ar[$user_type])) {
         return FALSE;
     }
     switch ($user_type) {
         case AMA_TYPE_ADMIN:
             /*
              * Ottieni tutti i practitioner, gli autori e gli switcher da tutti i
              * tester
              */
             // FIXME: differisce dagli altri casi !!!
             $users[] = $common_dh->get_users_by_type($user_types_Ar[AMA_TYPE_ADMIN], $retrieve_extended_data);
             if (AMA_Common_DataHandler::isError($users)) {
                 // Gestione errore
             }
             break;
         case AMA_TYPE_SWITCHER:
             /*
              * Ottieni tutti i practitioner e gli utenti dal suo tester
              */
             $tester = $userObj->getDefaultTester();
             $tester_dh = AMA_DataHandler::instance(MultiPort::getDSN($tester));
             $tester_info_Ar = $common_dh->get_tester_info_from_pointer($tester);
             $tester_name = $tester_info_Ar[1];
             $users[$tester_name] = $tester_dh->get_users_by_type($user_types_Ar[AMA_TYPE_SWITCHER], $retrieve_extended_data);
             if (AMA_Common_DataHandler::isError($users)) {
                 $users[$tester_name] = array();
             }
             /*
              * Ottiene tutti i practitioner presenti sul tester
              */
             //         $practitioners_Ar = $tester_dh->get_users_by_type(array(AMA_TYPE_TUTOR), $retrieve_extended_data);
             //         if(AMA_DataHandler::isError($practitioners_Ar) || !is_array($practitioners_Ar)) {
             //           $practitioners_Ar = array();
             //         }
             /*
              * Ottiene tutti gli utenti che hanno richiesto un servizio sul tester
              * e che sono in attesa di assegnamento ad un practitioner
              */
             // $users_Ar = $tester_dh->get_registered_students_without_tutor();
             //         if(AMA_DataHandler::isError($users_Ar) || !is_array($users_Ar)) {
             //           $users_Ar = array();
             //         }
             //         $users[$tester_name] = array_merge($practitioners_Ar, $users_Ar);
             break;
         case AMA_TYPE_TUTOR:
             /*
              * Ottieni lo switcher del suo tester, gli utenti con i quali è in relazione,
              * eventualmente gli altri practitioner sul suo tester
              */
             $tester = $userObj->getDefaultTester();
             $tester_dh = AMA_DataHandler::instance(MultiPort::getDSN($tester));
             $tester_info_Ar = $common_dh->get_tester_info_from_pointer($tester);
             $tester_name = $tester_info_Ar[1];
             if (in_array(AMA_TYPE_STUDENT, $user_types_Ar[$user_type])) {
                 /*
                  * STUDENTS
                  */
                 //        $users[$tester_name] = $tester_dh->get_list_of_tutored_users($userObj->id_user);
                 if (!$userObj->isSuper()) {
                     $students_Ar = $tester_dh->get_list_of_tutored_unique_users($userObj->id_user);
                 } else {
                     $students_Ar = $tester_dh->get_users_by_type(array(AMA_TYPE_STUDENT), $retrieve_extended_data);
                 }
                 //        $users[$tester_name] = $tester_dh->get_users_by_type($user_types_Ar[AMA_TYPE_TUTOR], $retrieve_extended_data);
                 if (AMA_DataHandler::isError($students_Ar) || !is_array($students_Ar)) {
                     $students_Ar = array();
                 }
             } else {
                 $students_Ar = array();
             }
             if (in_array(AMA_TYPE_TUTOR, $user_types_Ar[$user_type])) {
                 /*
                  * TUTORS
                  */
                 $tutors_Ar = $tester_dh->get_users_by_type(array(AMA_TYPE_TUTOR), $retrieve_extended_data);
                 if (AMA_DataHandler::isError($tutors_Ar) || !is_array($tutors_Ar)) {
                     $tutors_Ar = array();
                 }
             } else {
                 $tutors_Ar = array();
             }
             if (in_array(AMA_TYPE_SWITCHER, $user_types_Ar[$user_type])) {
                 /*
                  * SWITCHERS
                  */
                 $switchers_Ar = $tester_dh->get_users_by_type(array(AMA_TYPE_SWITCHER), $retrieve_extended_data);
                 if (AMA_DataHandler::isError($switchers_Ar) || !is_array($switchers_Ar)) {
                     $switchers_Ar = array();
                 }
             } else {
                 $switchers_Ar = array();
             }
             $users[$tester_name] = array_merge($tutors_Ar, $students_Ar, $switchers_Ar);
             break;
         case AMA_TYPE_STUDENT:
             /*
              * Se sono all'interno di un tester, vedo solo i practitioner di questo
              * tester con i quali sono in relazione
              * Se sono nella home dell'utente, vedo tutti i practitioner di tutti i
              * tester con i quali sono in relazione
              *
              * Come faccio a capirlo qui? posso Verificare che sess_selected_tester == ADA_DEFAULT_TESTER
              */
             if (MultiPort::isUserBrowsingThePublicTester()) {
                 // home di user o navigazione nei contenuti pubblici
                 $testers = $userObj->getTesters();
                 foreach ($userObj->getTesters() as $tester) {
                     if ($tester != ADA_PUBLIC_TESTER or count($testers) == 1) {
                         $tester_dh = AMA_DataHandler::instance(MultiPort::getDSN($tester));
                         $tester_info_Ar = $common_dh->get_tester_info_from_pointer($tester);
                         $tester_name = $tester_info_Ar[1];
                         $tutors_Ar = $tester_dh->get_tutors_for_student($userObj->getId());
                         if (AMA_DataHandler::isError($tutors_Ar) || !is_array($tutors_Ar)) {
                             $tutors_Ar = array();
                         }
                         $tutors_Ar = array_unique($tutors_Ar, SORT_REGULAR);
                         $switcher_Ar = $tester_dh->get_users_by_type(array(AMA_TYPE_SWITCHER), $retrieve_extended_data);
                         if (AMA_DataHandler::isError($switcher_Ar) || !is_array($switcher_Ar)) {
                             $switcher_Ar = array();
                         }
                         /*
                          * OTHER STUDENTS RELATED TO USER
                          */
                         $subscribed_instances = $tester_dh->get_id_course_instances_for_this_student($userObj->getId());
                         $students_Ar = $tester_dh->get_unique_students_for_course_instances($subscribed_instances);
                         if (AMA_DataHandler::isError($students_Ar) || !is_array($students_Ar)) {
                             $students_Ar = array();
                         }
                         /*
                                      foreach ($subscribed_instances as $subscribed_instance) {
                                          $subscribed_instance_id = $subscribed_instance['id_istanza_corso'];
                                          $students_Ar = array_merge($tester_dh->get_students_for_course_instance($subscribed_instance_id));
                                      }
                         *
                         */
                         $users[$tester_name] = array_merge($tutors_Ar, $switcher_Ar, $students_Ar);
                     }
                 }
             } else {
                 $tester = $_SESSION['sess_selected_tester'];
                 $tester_info_Ar = $common_dh->get_tester_info_from_pointer($tester);
                 $tester_name = $tester_info_Ar[1];
                 $tester_dh = AMA_DataHandler::instance(MultiPort::getDSN($tester));
                 /*
                  * GET TUTORS OF TESTER
                  */
                 $tutors_Ar = $tester_dh->get_tutors_for_student($userObj->getId());
                 if (AMA_DataHandler::isError($tutors_Ar) || !is_array($tutors_Ar)) {
                     $tutors_Ar = array();
                 }
                 $tutors_Ar = array_unique($tutors_Ar, SORT_REGULAR);
                 /*
                  * GET SWITCHER OF TESTER
                  */
                 $switcher_Ar = $tester_dh->get_users_by_type(array(AMA_TYPE_SWITCHER), $retrieve_extended_data);
                 if (AMA_DataHandler::isError($switcher_Ar) || !is_array($switcher_Ar)) {
                     $switcher_Ar = array();
                 }
                 /*
                  * OTHER STUDENTS RELATED TO USER
                  */
                 $subscribed_instances = $tester_dh->get_id_course_instances_for_this_student($userObj->getId());
                 $students_Ar = $tester_dh->get_unique_students_for_course_instances($subscribed_instances);
                 if (AMA_DataHandler::isError($students_Ar) || !is_array($students_Ar)) {
                     $students_Ar = array();
                 }
                 $users[$tester_name] = array_merge($tutors_Ar, $switcher_Ar, $students_Ar);
             }
             break;
         case AMA_TYPE_AUTHOR:
         default:
             return FALSE;
     }
     return $users;
 }
Esempio n. 7
0
/**
 * Performs basic controls before entering this module
 */
$neededObjAr = array(AMA_TYPE_AUTHOR => array('layout', 'node', 'course', 'course_instance'));
require_once ROOT_DIR . '/include/module_init.inc.php';
//$self =  whoami();
$self = 'form';
require_once ROOT_DIR . '/services/include/author_functions.inc.php';
$layout_dataAr['node_type'] = $self;
$online_users_listing_mode = 2;
$online_users = ADAGenericUser::get_online_usersFN($id_course_instance, $online_users_listing_mode);
require_once MODULES_TEST_PATH . '/config/config.inc.php';
require_once MODULES_TEST_PATH . '/include/management/managementTest.inc.php';
require_once MODULES_TEST_PATH . '/include/management/rootManagementTest.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']));
/*
 * Generazione dei form per l'inserimento dell'esercizio.
 * 
*/
require_once MODULES_TEST_PATH . '/include/management/questionManagementTest.inc.php';
$management = new QuestionManagementTest($_GET['action'], $_GET['id_question'], $_GET['id_test']);
$form_return = $management->run();
// per la visualizzazione del contenuto della pagina
$banner = (include $root_dir . '/include/banner.inc.php');
$content_dataAr = array('head' => $head_form, 'banner' => $banner, 'path' => $form_return['path'], 'form' => $form_return['html'], 'status' => $form_return['status'], 'user_name' => $user_name, 'user_type' => $user_type, 'messages' => $user_messages->getHtml(), 'agenda' => $user_agenda->getHtml(), 'title' => $node_title, 'course_title' => $course_title, 'back' => $back);
$content_dataAr['notes'] = $other_node_data['notes'];
$content_dataAr['personal'] = $other_node_data['private_notes'];
if ($reg_enabled) {
    $content_dataAr['add_bookmark'] = $add_bookmark;
} else {
Esempio n. 8
0
 //display a direct link to forum if there are new messages
 if ($msg_forum_count > 0) {
     $link = CDOMElement::create('a', 'href:main_index.php?op=forum&id_course=' . $courseId . '&id_course_instance=' . $courseInstanceId);
     $link->addChild(new CText($msg_forum_count));
     $msg_forum_count = $link->getHtml();
     unset($link);
 }
 // @author giorgio 24/apr/2013 private messages
 $msg_simple_count = 0;
 $msg_simpleAr = MultiPort::getUserMessages($userObj);
 foreach ($msg_simpleAr as $msg_simple_provider) {
     $msg_simple_count += count($msg_simple_provider);
 }
 // @author giorgio 24/apr/2013 agenda messages
 $msg_agenda_count = 0;
 $msg_agendaAr = MultiPort::getUserAgenda($userObj);
 foreach ($msg_agendaAr as $msg_agenda_provider) {
     $msg_agenda_count += count($msg_agenda_provider);
 }
 // @author giorgio 24/apr/2013 gocontinue link
 $last_visited_node_id = $userObj->get_last_accessFN($courseInstanceId, "N");
 if (!empty($last_visited_node_id) and !is_object($last_visited_node_id) && $isStarted && !$isEnded) {
     $last_node_visitedObj = BaseHtmlLib::link("view.php?id_course={$courseId}&id_node={$last_visited_node_id}&id_course_instance={$courseInstanceId}", translateFN("Continua"));
     // echo "<!--"; var_dump($last_node_visitedObj);echo "-->";
     $last_node_visited_link = $last_node_visitedObj->getHtml();
 } else {
     //$last_node_visitedObj = BaseHtmlLib::link("view.php?id_node=$nodeId&id_course=$courseId&id_course_instance=$courseInstanceId",translateFN('Continua'));
     $last_node_visitedObj = BaseHtmlLib::link("#", translateFN(''));
     $last_node_visited_link = $last_node_visitedObj->getHtml();
 }
 // @author giorgio 24/apr/2013 gostart, goindex, goforum and gocontinue link
Esempio n. 9
0
$allowedUsersAr = array(AMA_TYPE_SWITCHER);
/**
 * Performs basic controls before entering this module
 */
$neededObjAr = array(AMA_TYPE_SWITCHER => array('layout'));
require_once ROOT_DIR . '/include/module_init.inc.php';
$self = whoami();
include_once 'include/switcher_functions.inc.php';
include_once ROOT_DIR . '/admin/include/AdminUtils.inc.php';
/*
 * YOUR CODE HERE
 */
require_once ROOT_DIR . '/include/Forms/UserProfileForm.inc.php';
$userId = DataValidator::is_uinteger($_GET['id_user']);
if ($userId === false) {
    $data = new CText('Utente non trovato');
} else {
    $user_info = $dh->_get_user_info($userId);
    if (AMA_DataHandler::isError($userId)) {
        $data = new CText('Utente non trovato');
    } else {
        $viewedUserObj = MultiPort::findUser($userId);
        $viewedUserObj->toArray();
        $user_dataAr = array('id' => $viewedUserObj->getId(), 'tipo' => $viewedUserObj->getTypeAsString(), 'nome e cognome' => $viewedUserObj->getFullName(), 'data di nascita' => $viewedUserObj->getBirthDate(), 'Comune o stato estero di nascita' => $viewedUserObj->getBirthCity(), 'Provincia di nascita' => $viewedUserObj->getBirthProvince(), 'genere' => $viewedUserObj->getGender(), 'email' => $viewedUserObj->getEmail(), 'telefono' => $viewedUserObj->getPhoneNumber(), 'indirizzo' => $viewedUserObj->getAddress(), 'citta' => $viewedUserObj->getCity(), 'provincia' => $viewedUserObj->getProvince(), 'nazione' => $viewedUserObj->getCountry(), 'confermato' => $viewedUserObj->getStatus() == ADA_STATUS_REGISTERED ? translateFN("Si") : translateFN("No"));
        $data = BaseHtmlLib::labeledListElement('class:view_info', $user_dataAr);
    }
}
$label = translateFN('Profilo utente');
$help = translateFN('Da qui il provider admin può visualizzare il profilo di un utente esistente');
$content_dataAr = array('user_name' => $user_name, 'user_type' => $user_type, 'status' => $status, 'label' => $label, 'help' => $help, 'data' => $data->getHtml(), 'edit_profile' => $userObj->getEditProfilePage(), 'module' => isset($module) ? $module : '', 'messages' => $user_messages->getHtml());
ARE::render($layout_dataAr, $content_dataAr);
Esempio n. 10
0
    }
}
if ($id_profile == AMA_TYPE_STUDENT && $log_enabled) {
    $user_level = (string) $userObj->get_student_level($sess_id_user, $sess_id_course_instance);
    $user_score = (string) $userObj->get_student_score($sess_id_user, $sess_id_course_instance);
    $user_history = $userObj->history;
}
/**
 * service completeness
 */
if ($id_profile == AMA_TYPE_STUDENT && defined('MODULES_SERVICECOMPLETE') && MODULES_SERVICECOMPLETE) {
    if (isset($courseInstanceObj) && isset($courseObj) && isset($userObj) && is_object($courseInstanceObj) && is_object($courseObj) && is_object($userObj)) {
        if ($user_status != ADA_SERVICE_SUBSCRIPTION_STATUS_COMPLETED) {
            // need the service-complete module data handler
            require_once MODULES_SERVICECOMPLETE_PATH . '/include/init.inc.php';
            $mydh = AMACompleteDataHandler::instance(MultiPort::getDSN($_SESSION['sess_selected_tester']));
            // load the conditionset for this course
            $conditionSet = $mydh->get_linked_conditionset_for_course($courseObj->getId());
            $mydh->disconnect();
            if ($conditionSet instanceof CompleteConditionSet) {
                // evaluate the conditionset for this instance ID and course ID
                $is_course_instance_complete = $conditionSet->evaluateSet(array($courseInstanceObj->getId(), $userObj->getId()));
            } else {
                $is_course_instance_complete = false;
            }
            // if course is complete, save this information to the db
            if ($is_course_instance_complete) {
                require_once ROOT_DIR . '/switcher/include/Subscription.inc.php';
                $s = new Subscription($userObj->getId(), $courseInstanceObj->getId());
                $s->setSubscriptionStatus(ADA_SERVICE_SUBSCRIPTION_STATUS_COMPLETED);
                if (isset($userObj->livello) && intval($userObj->livello) > 0) {
Esempio n. 11
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;
     }
 }
Esempio n. 12
0
         $nodes = $dh->find_course_nodes_list($out_fields_ar, $clause, $sess_id_course);
         $added_nodes_count = count($nodes);
         $added_notes = $added_nodes_count;
     } else {
         $added_notes = '-';
     }
     $st_history_count = '0';
     $st_history_count = $userObj->total_visited_nodesFN($sess_id_user);
     $st_exercises = $st_score . " " . translateFN("su") . " " . $st_exer_number * 100;
     // summary of activities
     $history .= '<p align="center">';
     $history .= translateFN('Punteggio esercizi:') . '&nbsp;<strong>' . $st_exercises . '</strong>&nbsp;';
     // forum
     $history .= translateFN('Note inviate:') . '&nbsp;<strong>' . $added_notes . '</strong>&nbsp;';
     // messages
     $msgs_ha = MultiPort::getUserSentMessages($userObj);
     if (AMA_DataHandler::isError($msgs_ha)) {
         $user_message_count = '-';
     } else {
         $user_message_count = count($msgs_ha);
     }
     $history .= translateFN('Messaggi inviati:') . '&nbsp;<strong>' . $user_message_count . '</strong>&nbsp;';
     // activity index
     $index = $added_notes * $npar + $st_history_count * $hpar + $user_message_count * $mpar + $st_exer_number * $epar;
     $history .= translateFN('Indice attivit&agrave;') . '&nbsp;<strong>' . $index . '</strong>&nbsp;';
     $history .= '<p align="center">';
     // Ultime 10 visite
     $history .= '<p>';
     $history .= $user_historyObj->history_last_nodes_FN('10');
     $history .= '</p>';
 }
Esempio n. 13
0
require_once 'include/Subscription.inc.php';
require_once ROOT_DIR . '/include/Forms/UserFindForm.inc.php';
/*
 * YOUR CODE HERE
 */
if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'POST') {
    $canSubscribeUser = false;
    if ($courseInstanceObj instanceof Course_instance && $courseInstanceObj->isFull()) {
        $startStudentLevel = $courseInstanceObj->start_level_student;
    }
    if (isset($_POST['findByUsername'])) {
        $form = new UserFindForm();
        $form->fillWithPostData();
        if ($form->isValid()) {
            $courseInstanceId = $_POST['id_course_instance'];
            $subscriberObj = MultiPort::findUserByUsername($_POST['username']);
            $canSubscribeUser = false;
            if ($subscriberObj instanceof ADAUser) {
                $result = $dh->student_can_subscribe_to_course_instance($subscriberObj->getId(), $courseInstanceId);
                if (!AMA_DataHandler::isError($result) && $result !== false) {
                    $canSubscribeUser = $courseInstanceObj instanceof Course_instance && $courseInstanceObj->isFull() && $courseInstanceObj->getServiceLevel() != ADA_SERVICE_TUTORCOMMUNITY;
                }
            } else {
                if ($subscriberObj instanceof ADAPractitioner) {
                    /**
                     * @author giorgio 14/apr/2015
                     * 
                     * If the switcher is trying to subscribe a tutor, do it only
                     * if the course instance belongs to a service of type 
                     * ADA_SERVICE_TUTORCOMMUNITY
                     */
Esempio n. 14
0
        }
        $eguidance_data = BaseHtmlLib::tableElement('', $thead_data, $tbody_data);
    }
    /*
     * Future appointments with this user
     *
     *
     * Potremmo avere una classe
     * $agenda = new ADAAgenda($userObj);
     * $appointments = $agenda->futureAppointmentsWithUser($tutoredUserObj->getId());
     *
     */
    $fields_list_Ar = array('data_ora', 'titolo');
    $clause = ' data_ora > ' . time() . ' AND id_mittente=' . $tutoredUserObj->getId() . ' AND (flags & ' . ADA_EVENT_CONFIRMED . ')';
    $sort_field = ' data_ora desc';
    $mh = MessageHandler::instance(MultiPort::getDSN($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) || count($msgs_ha) == 0) {
        $appointments_data = new CText('');
    } else {
        $thead_data = array(translateFN('Date'), translateFN('Appointment type'));
        $tbody_data = array();
        foreach ($msgs_ha as $appointment) {
            $tbody_data[] = array(ts2dFN($appointment[0]), ADAEventProposal::removeEventToken($appointment[1]));
        }
        $appointments_data = BaseHtmlLib::tableElement('', $thead_data, $tbody_data);
    }
    $data = $appointments_data->getHtml() . $user_data->getHtml() . $service_data->getHtml() . $eguidance_data->getHtml();
}
$label = translateFN('user service details');
$help = translateFN("Details");
Esempio n. 15
0
        if ($userId !== false) {
            $editUserObj = MultiPort::findUser($userId);
        }
        break;
}
if (!is_null($editUserObj) && isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'POST') {
    if (!isset($_POST['extraTableName'])) {
        $retArray = array("status" => "ERROR", "title" => $title, "msg" => translateFN("Non so cosa cancellare"));
    } else {
        /**
         * include and instantiate form class based on extraTableName POST
         * variable that MUST be set, else dont' know what and how to save.
         */
        $extraTableClass = trim($_POST['extraTableName']);
        $extraTableId = isset($_POST['id']) ? intval($_POST['id']) : null;
        $result = MultiPort::removeUserExtraData($editUserObj, $extraTableId, $extraTableClass);
        if (!AMA_DB::isError($result)) {
            $editUserObj->removeExtras($extraTableId, $extraTableClass);
            /**
             * Set the session user to the saved one if it's not
             * a switcher, that is not saving its own profile
             */
            if ($userObj->getType() != AMA_TYPE_SWITCHER) {
                $_SESSION['sess_userObj'] = $editUserObj;
            }
            $retArray = array("status" => "OK", "title" => $title, "msg" => translateFN("Scheda cancellata"));
        } else {
            $retArray = array("status" => "ERROR", "title" => $title, "msg" => translateFN("Errore di cancellazione"));
        }
    }
} else {
Esempio n. 16
0
    /*
     * We are inside a tester
     */
    $tester = $sess_selected_tester;
}
/*
 * Find the appointment
 */
$msg_ha = MultiPort::getUserAppointment($userObj, $msg_id);
if (AMA_DataHandler::isError($msg_ha)) {
    $errObj = new ADA_Error($msg_ha, translateFN('Errore durante la lettura di un evento'), NULL, NULL, NULL, 'comunica/list_events.php?status=' . urlencode(translateFN('Errore durante la lettura')));
}
/**
 * Conversione Time Zone
 */
$tester_TimeZone = MultiPort::getTesterTimeZone($tester);
$offset = get_timezone_offset($tester_TimeZone, SERVER_TIMEZONE);
$date_time = $msg_ha['data_ora'];
$date_time_zone = $date_time + $offset;
$zone = translateFN("Time zone:") . " " . $tester_TimeZone;
$Data_messaggio = AMA_DataHandler::ts_to_date($date_time_zone, "%d/%m/%Y - %H:%M:%S") . " " . $zone;
//$Data_messaggio = AMA_DataHandler::ts_to_date($msg_ha['data_ora'], "%d/%m/%Y - %H:%M:%S");
/*
 * Check if the subject has an internal identifier and remove it
 */
$oggetto = ADAEventProposal::removeEventToken($msg_ha['titolo']);
$mittente = $msg_ha['mittente'];
$destinatario = str_replace(",", ", ", $msg_ha['destinatari']);
// $destinatario = $msg_ha['destinatari'];
$dest_encode = urlencode($mittente);
if (isset($message_text) && strlen($message_text) > 0) {
Esempio n. 17
0
function _get_course_info($id_course)
{
    $common_dh = $GLOBALS['common_dh'];
    $serviceAr = $common_dh->get_service_info_from_course($id_course);
    if (!AMA_DataHandler::isError($serviceAr)) {
        $service_name = $serviceAr[1];
        $service_level = $serviceAr[3];
        $service_duration = $serviceAr[4];
        $service_max_meeting = $serviceAr[5];
        $service_max_meeting_time = $serviceAr[7] / 60;
    }
    $providerAr = $common_dh->get_tester_info_from_id_course($id_course);
    if (!AMA_DataHandler::isError($providerAr)) {
        $provider = $providerAr['puntatore'];
        $provider_dsn = MultiPort::getDSN($provider);
        $provider_name = $providerAr['nome'];
        $service_country = $providerAr['nazione'] . "/" . $providerAr['provincia'];
    }
    $provider_dh = AMA_DataHandler::instance($provider_dsn);
    $dataHa = $provider_dh->get_course($id_course);
    if (AMA_DataHandler::isError($dataHa) || !is_array($dataHa)) {
        $infomsg = $dataHa->getMessage();
        if ($dataHa->code == AMA_ERR_NOT_FOUND) {
            $service_description = translateFN("Il provider non fornisce attualmente questo servizio");
        }
        // header("Location: $error?err_msg=$msg");
        //return $infomsg;
    } else {
        if (!empty($dataHa['nome'])) {
            $course_infoHa = array();
            // 1.info from table modello_corso
            $service_title = $dataHa['titolo'];
            // $service_name = $dataHa['nome'];
            // 2. description of instance from table modello_corso
            $service_instance_description = $dataHa['descr'];
            // 3. full description from node id_nodo_iniziale
            $id_desc = $id_course . "_" . $dataHa['id_nodo_iniziale'];
            $user_level = "999";
            $nodeHa = $provider_dh->get_node_info($id_desc);
            if (AMA_DataHandler::isError($nodeHa)) {
                //	$errorObj = new ADA_error($nodeHa); //FIXME: mancano gli altri dati
                $service_description = translateFN("Il provider non fornisce attualmente questo servizio");
            } else {
                $service_description = $nodeHa['text'];
            }
        } else {
            $service_description = translateFN("Il provider non fornisce attualmente questo servizio");
        }
    }
    // check on level?
    /*
    if ($service_level > 1){
    	$require_link = "<a href=" . HTTP_ROOT_DIR .  "/browsing/registration.php?id_course=$id_course>" .translateFN('Richiedi'). "</a>";
    } else {
    	$require_link = "<a href=" . HTTP_ROOT_DIR .  "/browsing/view.php?id_course=$id_course&id_node=$id_desc>" .translateFN('Entra'). "</a>";
    }
    */
    if ($service_instance_description == NULL) {
        $service_instance_description = level2descriptionFN($service_level);
    }
    $service_div = CDOMElement::create('div', 'id:service_info');
    $thead_data = array(translateFN('Fornitore'), translateFN('Nome'), translateFN('Paese'), translateFN('Livello'), translateFN('Durata (gg)'), translateFN('Numero incontri'), translateFN('Durata incontro (minuti)'), translateFN('Descrizione servizio'), translateFN('Descrizione dettagliata'));
    $tbody_dataAr = array();
    $tbody_dataAr[] = array($provider_name, $service_name, $service_country, level2stringFN($service_level), $service_duration, $service_max_meeting, $service_max_meeting_time, $service_description, $service_instance_description);
    $element_attributes = "";
    $serviceTable = BaseHtmlLib::tableElement($element_attributes, $thead_data, $tbody_dataAr);
    $service_div->addChild($serviceTable);
    $service_data = $service_div->getHtml();
    return $service_data;
}
Esempio n. 18
0
        while (!feof($fid)) {
            $infomsg .= fread($fid, 4096);
        }
        fclose($fid);
    } else {
        $infomsg = translateFN("File info non trovato");
    }
}
/**
 * Perform login
 */
if (isset($p_login)) {
    $username = DataValidator::validate_username($p_username);
    $password = DataValidator::validate_password($p_password, $p_password);
    if ($username !== FALSE && $password !== FALSE) {
        $userObj = MultiPort::loginUser($username, $password);
        //User has correctly logged in
        if ($userObj instanceof ADALoggableUser) {
            $_SESSION['sess_user_language'] = $p_selected_language;
            $_SESSION['sess_id_user'] = $userObj->getId();
            $GLOBALS['sess_id_user'] = $userObj->getId();
            $_SESSION['sess_id_user_type'] = $userObj->getType();
            $GLOBALS['sess_id_user_type'] = $userObj->getType();
            $_SESSION['sess_userObj'] = $userObj;
            $user_default_tester = $userObj->getDefaultTester();
            if ($user_default_tester !== NULL) {
                $_SESSION['sess_selected_tester'] = $user_default_tester;
            }
            header('Location:' . $userObj->getHomePage());
            exit;
        } else {
Esempio n. 19
0
/**
 * get User object
 */
$userObj = read_user($sess_id_user);
if (ADA_Error::isError($userObj)) {
    $userObj->handleError();
}
// FIXME: messages and agenda will be handled by class MultiPort
//        $user_messages = $userObj->get_messagesFN($sess_id_user);
//        $user_agenda =  $userObj->get_agendaFN($sess_id_user);
$testers_dataAr = MultiPort::getTestersPointersAndIds();
$user_messagesAr = MultiPort::getUserMessages($userObj);
$user_messages = CommunicationModuleHtmlLib::getMessagesAsTable($user_messagesAr, $testers_dataAr);
$user_agendaAr = MultiPort::getUserAgenda($userObj);
$user_agenda = CommunicationModuleHtmlLib::getAgendaAsTable($user_agendaAr, $testers_dataAr);
$user_eventsAr = MultiPort::getUserEventsNotRead($userObj);
$user_events = CommunicationModuleHtmlLib::getEventsAsTable($userObj, $user_eventsAr, $testers_dataAr);
/*$user_eventsAr = MultiPort::getUserEvents($userObj);
$user_events    = CommunicationModuleHtmlLib::getEventsAsTable($userObj, $user_eventsAr, $testers_dataAr);
 * 
 */
$user_level = ADA_MAX_USER_LEVEL;
$user_score = "";
//  $user_status = ADA_STATUS_VISITOR;
$user_uname = $userObj->username;
$user_name = $userObj->nome;
$user_surname = $userObj->cognome;
$user_family = $userObj->template_family;
$id_profile = $userObj->getType();
$user_type = $userObj->getTypeAsString();
$user_mail = $userObj->email;
Esempio n. 20
0
     }
 } else {
     $switcher_uname = "";
     // probably was a public service or an error
 }
 // 3. send a message to the user (a mail, an SMS, ...)
 $titolo = 'ADA: ' . translateFN('richiesta di servizio');
 $testo = translateFN("Un utente con dati: ");
 $testo .= $name . " " . $surname;
 $testo .= translateFN(" ha richiesto  il servizio: ");
 $testo .= $service_name . ".";
 $testo .= translateFN(" Riceverai un messaggio contenente le proposte di appuntamento. ");
 // $mh = MessageHandler::instance(MultiPort::getDSN($tester));
 // using the previous  MH if exists
 //if (!isset($mh))
 $mh = MessageHandler::instance(MultiPort::getDSN($tester));
 // prepare message to send
 $destinatari = array($username);
 $message3_ha = array();
 $message3_ha['titolo'] = $titolo;
 $message3_ha['testo'] = $testo;
 $message3_ha['destinatari'] = $destinatari;
 $message3_ha['data_ora'] = "now";
 $message3_ha['tipo'] = ADA_MSG_MAIL;
 $message3_ha['mittente'] = $adm_uname;
 // delegate sending to the message handler
 $res3 = $mh->send_message($message3_ha);
 if (AMA_DataHandler::isError($res3)) {
     // $errObj = new ADA_Error($res,translateFN('Impossibile spedire il messaggio'),
     //NULL,NULL,NULL,$error_page.'?err_msg='.urlencode(translateFN('Impossibile spedire il messaggio')));
 }
Esempio n. 21
0
        $userId = DataValidator::is_uinteger($_POST[$extraTableClass::getForeignKeyProperty()]);
        if ($userId !== false) {
            $editUserObj = MultiPort::findUser($userId);
        }
        break;
}
if (!is_null($editUserObj) && isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'POST') {
    $form = new $extraTableFormClass($languages);
    $form->fillWithPostData();
    if ($form->isValid()) {
        $arr = array();
        $arr[$extraTableClass][0] = $extraTableClass::buildArrayFromPOST($_POST);
        // setExtras returns the index of the updated element, be it inserted or updated
        $updatedElementKey = $editUserObj->setExtras($arr);
        // setUser returns last insert id, or empty on update
        $result = MultiPort::setUser($editUserObj, array(), true, $extraTableClass);
        if (!AMA_DB::isError($result)) {
            /**
             * need to set the added extra arr
             * state to saved and to give it the returned id
             */
            $extraTableProperty = 'tbl_' . $extraTableClass;
            // $lastInsertKey = count($editUserObj->$extraTableProperty)-1;
            /**
             * WEIRD STUFF:  NEED TO ACCESS OBJECT THIS WAY OTHERWISE WON'T WORK
             */
            $extraTableKeyProperty = $extraTableClass::getKeyProperty();
            $temp1 = $editUserObj->{$extraTableProperty};
            // 			$temp =  $temp1[$lastInsertKey];
            $temp = $temp1[$updatedElementKey];
            $temp->{$extraTableKeyProperty} = $result;
Esempio n. 22
0
 /*
  * Check if the user has already an appointment in one of the proposed dates
  * or if an appointment proposal is in the past.
  */
 $datetimesAr = ADAEventProposal::extractDateTimesFromEventProposalText($data['testo']);
 if ($datetimesAr === FALSE) {
     $errObj = new ADA_Error(NULL, translateFN("Errore nell'ottenimento delle date per l'appuntamento"));
 }
 /*
  * Obtain a messagehandler instance for the correct tester
  */
 if (MultiPort::isUserBrowsingThePublicTester()) {
     /*
      * In base a event_msg_id, ottenere connessione al tester appropriato
      */
     $data_Ar = MultiPort::geTesterAndMessageId($msg_id);
     $tester = $data_Ar['tester'];
 } else {
     /*
      * We are inside a tester
      */
     $tester = $sess_selected_tester;
 }
 if (($value = ADAEventProposal::canProposeThisDateTime($userObj, $datetimesAr[0]['date'], $datetimesAr[0]['time'], $tester)) !== TRUE) {
     $errors['date1'] = $value;
 }
 if (($value = ADAEventProposal::canProposeThisDateTime($userObj, $datetimesAr[1]['date'], $datetimesAr[1]['time'], $tester)) !== TRUE) {
     $errors['date2'] = $value;
 }
 if (($value = ADAEventProposal::canProposeThisDateTime($userObj, $datetimesAr[2]['date'], $datetimesAr[2]['time'], $tester)) !== TRUE) {
     $errors['date3'] = $value;
Esempio n. 23
0
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);
    $last_access = AMA_DataHandler::ts_to_date($last_access);
} else {
    $last_access = $userObj->get_last_accessFN(null, "UT", null);
    $last_access = AMA_DataHandler::ts_to_date($last_access);
}
if ($last_access == '' || is_null($last_access)) {
    $last_access = '-';
}
$content_dataAr = array('user_name' => $user_name, 'user_type' => $user_type, 'user_level' => $user_level, 'titolo' => $titolo, 'testo' => isset($testo) ? trim($testo) : '', 'destinatari' => isset($destinatari) ? trim($destinatari) : '', 'course_title' => '<a href="../browsing/main_index.php">' . $course_title . '</a>', 'status' => $err_msg, 'timezone' => $tester_TimeZone, 'event_time' => $event_time, 'event_date' => $event_date, 'last_visit' => $last_access, 'rubrica' => $ada_address_book->getHtml(), 'status' => $err_msg);
Esempio n. 24
0
 /**
  * Checks if an event can be proposed in the given date and time
  *
  * @param string $date
  * @param string $time
  * @return TRUE on success, a ADA error code on failure
  */
 public static function canProposeThisDateTime(ADALoggableUser $userObj, $date, $time, $tester = NULL)
 {
     $date = DataValidator::validate_date_format($date);
     if ($date === FALSE) {
         return ADA_EVENT_PROPOSAL_ERROR_DATE_FORMAT;
     } else {
         $current_timestamp = time();
         /**
          * @var timezone management
          */
         $offset = 0;
         if ($tester === NULL) {
             $tester_TimeZone = SERVER_TIMEZONE;
         } else {
             $tester_TimeZone = MultiPort::getTesterTimeZone($tester);
             $offset = get_timezone_offset($tester_TimeZone, SERVER_TIMEZONE);
         }
         $timestamp_time_zone = sumDateTimeFN(array($date, "{$time}:00"));
         $timestamp = $timestamp_time_zone - $offset;
         if ($current_timestamp >= $timestamp) {
             return ADA_EVENT_PROPOSAL_ERROR_DATE_IN_THE_PAST;
         }
         if (MultiPort::hasThisUserAnAppointmentInThisDate($userObj, $timestamp)) {
             return ADA_EVENT_PROPOSAL_ERROR_DATE_IN_USE;
         }
     }
     return TRUE;
 }
 * 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
     */
    $logStr = "";
    $log_file = ROOT_DIR . '/browsing/paypal/' . PAYPAL_IPN_LOG;
    $logFd = fopen($log_file, "a");
    $fpx = fopen($log_file, 'a');
    $debug = 1;
    if ($debug == 1) {
        fwrite($fpx, "INIZIO processo Confirm \n");
        fwrite($fpx, "Student: {$studentId} \n");
    }
Esempio n. 26
0
 * Clear node and layout variable in $_SESSION
 */
$variableToClearAR = array('node', 'layout', 'course', 'course_instance');
/**
 * Users (types) allowed to access this module.
 */
$allowedUsersAr = array(AMA_TYPE_STUDENT);
/**
 * Performs basic controls before entering this module
 */
$neededObjAr = array(AMA_TYPE_STUDENT => array('layout'));
require_once ROOT_DIR . '/include/module_init.inc.php';
include_once ROOT_DIR . '/browsing/include/browsing_functions.inc.php';
$self = whoami();
if (isset($_GET['id']) && DataValidator::is_uinteger($_GET['id'])) {
    $tutorObj = MultiPort::findUser($_GET['id']);
    if ($tutorObj instanceof ADAPractitioner) {
        $dati = CDOMElement::create('div');
        $fullname = CDOMElement::create('div');
        $fullname->addChild(new CText(translateFN('User: '******' ' . $tutorObj->getFullName()));
        $username = CDOMElement::create('div');
        $username->addChild(new CText(translateFN('Username: '******' ' . $tutorObj->getUserName()));
        $tutorProfile = $tutorObj->getProfile();
        if ($tutorProfile == 'NULL') {
            $tutorProfile = '';
        }
        $profile = CDOMElement::create('div');
        $profile->addChild(new CText(translateFN('Profile: ') . ' ' . $tutorProfile));
        $dati->addChild($fullname);
        $dati->addChild($username);
        $dati->addChild($profile);
Esempio n. 27
0
 */
require_once ROOT_DIR . '/include/Forms/UserProfileForm.inc.php';
$languages = Translator::getLanguagesIdAndName();
if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'POST') {
    $form = new UserProfileForm($languages);
    $form->fillWithPostData();
    $password = trim($_POST['password']);
    $passwordcheck = trim($_POST['passwordcheck']);
    if (DataValidator::validate_password_modified($password, $passwordcheck) === FALSE) {
        $message = translateFN('Le password digitate non corrispondono o contengono caratteri non validi.');
        header("Location: edit_author.php?message={$message}");
        exit;
    }
    if ($form->isValid()) {
        $userObj->fillWithArrayData($_POST);
        MultiPort::setUser($userObj, array(), true);
        /* unset $_SESSION['service_level'] to reload it with the correct user language translation */
        unset($_SESSION['service_level']);
        $help = translateFN('Dati salvati');
        /*$navigationHistoryObj = $_SESSION['sess_navigation_history'];
          $location = $navigationHistoryObj->lastModule();
          header('Location: ' . $location);
          exit();*/
    }
} else {
    $form = new UserProfileForm($languages);
    $user_dataAr = $userObj->toArray();
    unset($user_dataAr['password']);
    $user_dataAr['email'] = $user_dataAr['e_mail'];
    unset($user_dataAr['e_mail']);
    $form->fillWithArrayData($user_dataAr);
Esempio n. 28
0
if ($id_tester !== FALSE) {
    $tester_infoAr = $common_dh->get_tester_info_from_id($id_tester);
    if (AMA_Common_DataHandler::isError($tester_infoAr)) {
        $errObj = new ADA_Error($tester_infoAr);
    } else {
        $testersAr = array();
        $tester_dataAr = array(array(translateFN('id'), $tester_infoAr[0]), array(translateFN('Nome'), $tester_infoAr[1]), array(translateFN('Ragione Sociale'), $tester_infoAr[2]), array(translateFN('Indirizzo'), $tester_infoAr[3]), array(translateFN('Citt&agrave'), $tester_infoAr[4]), array(translateFN('Provincia'), $tester_infoAr[5]), array(translateFN('Nazione'), $tester_infoAr[6]), array(translateFN('Telefono'), $tester_infoAr[7]), array(translateFN('E-mail'), $tester_infoAr[8]), array(translateFN('Descrizione'), $tester_infoAr[11]), array(translateFN('Responsabile'), $tester_infoAr[9]), array(translateFN('Puntatore al database'), $tester_infoAr[10]));
        //$tester_data = BaseHtmlLib::tableElement('',array(),$tester_dataAr);
        $tester_data = AdminModuleHtmlLib::displayTesterInfo($id_tester, $tester_dataAr);
        $services_dataAr = $common_dh->get_info_for_tester_services($id_tester);
        if (AMA_Common_DataHandler::isError($services_dataAr)) {
            $errObj = new ADA_Error($services_dataAr);
        } else {
            $tester_services = AdminModuleHtmlLib::displayServicesOnThisTester($id_tester, $services_dataAr);
        }
        $tester_dsn = MultiPort::getDSN($tester_infoAr[10]);
        if ($tester_dsn != NULL) {
            $tester_dh = AMA_DataHandler::instance($tester_dsn);
            $users_on_this_tester = $tester_dh->count_users_by_type(array(AMA_TYPE_STUDENT, AMA_TYPE_AUTHOR, AMA_TYPE_TUTOR, AMA_TYPE_SWITCHER, AMA_TYPE_ADMIN));
            if (AMA_DataHandler::isError($users_on_this_tester)) {
                $errObj = new ADA_Error($users_on_this_tester);
            } else {
                $users_list_link = CDOMElement::create('div', 'id:tester_users');
                $users_list_link->addChild(new CText(translateFN('Numero di utenti presenti sul tester: ') . $users_on_this_tester));
                $link = CDOMElement::create('a', 'href:list_users.php?id_tester=' . $id_tester);
                $link->addChild(new CText(translateFN('Lista utenti')));
                $users_list_link->addChild($link);
            }
        }
    }
} else {
Esempio n. 29
0
/**
 * Users (types) allowed to access this module.
 */
$allowedUsersAr = array(AMA_TYPE_ADMIN);
/**
 * Performs basic controls before entering this module
 */
$neededObjAr = array(AMA_TYPE_ADMIN => array('layout'));
require_once ROOT_DIR . '/include/module_init.inc.php';
$self = whoami();
// = admin!
include_once 'include/admin_functions.inc.php';
/*
 * YOUR CODE HERE
 */
$testers_dataAr = MultiPort::getDataForTesterActivityReport();
$table = AdminModuleHtmlLib::getTestersActivityReport($testers_dataAr);
$label = translateFN("Home dell'amministratore");
$help = translateFN("Report sintetico dell'attivit&agrave; dei tester");
$menu_dataAr = array(array('href' => 'add_tester.php', 'text' => translateFN('Aggiungi provider')), array('href' => 'add_service.php', 'text' => translateFN('Aggiungi servizio')), array('href' => 'add_user.php', 'text' => translateFN('Aggiungi utente')), array('href' => 'import_language.php', 'text' => translateFN('Import Language')));
/**
 * giorgio 12/ago/2013
 * 
 * add content editing to menu only if it's a multiprovider environment
 */
// grab available content types for editing and build menu items
// $availableTypes = ;
// if (MULTIPROVIDER)
// {
foreach (dirTree(ROOT_DIR . '/docs') as $aType) {
    /**
Esempio n. 30
0
 /**
  * calls and sets the parent instance method, and if !MULTIPROVIDER
  * checks if module_login_providers table is in the provider db.
  * 
  * If found, use the provider DB else use the common
  * 
  * @param string $dsn
  */
 static function instance($dsn = null)
 {
     if (!MULTIPROVIDER && is_null($dsn)) {
         $dsn = MultiPort::getDSN($GLOBALS['user_provider']);
     }
     $theInstance = parent::instance($dsn);
     if (is_null(self::$dbToUse)) {
         self::$dbToUse = AMA_Common_DataHandler::instance();
         if (!MULTIPROVIDER && !is_null($dsn)) {
             // must check if passed $dsn has the module login tables
             // execute this dummy query, if result is not an error table is there
             $sql = 'SELECT NULL FROM `' . self::$PREFIX . 'providers`';
             // must use AMA_DataHandler because we are not able to
             // query AMALoginDataHandelr in this method!
             $ok = AMA_DataHandler::instance($dsn)->getOnePrepared($sql);
             if (!AMA_DB::isError($ok)) {
                 self::$dbToUse = $theInstance;
             }
         }
     }
     return $theInstance;
 }