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';
/*
 * 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();
//$id_course_instance = $_REQUEST['id_instance'];
//$id_studente = $_REQUEST['id_student'];
$providerId = DataValidator::is_uinteger($_GET['provider']);
$courseId = DataValidator::is_uinteger($_GET['course']);
$instanceId = DataValidator::is_uinteger($_GET['instance']);
$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;
    /*
     * Instance Object
     */
    $instanceObj = new course_instance($instanceId);
    //    print_r($instanceObj);
    $price = $instanceObj->getPrice();
    $id_course = $instanceObj->getCourseId();
    $course = $dh->get_course($courseId);
Пример #2
0
 public function __construct($user_dataHa = array())
 {
     /*
      * $user_dataHa is an associative array with the following keys:
      * nome, cognome, tipo, e_mail, telefono, username, layout, indirizzo, citta,
      * provincia, nazione, codice_fiscale, sesso,
      * telefono, stato
      */
     if (isset($user_dataHa['id']) && DataValidator::is_uinteger($user_dataHa['id'])) {
         $this->id_user = $user_dataHa['id'];
     } else {
         $this->id_user = 0;
     }
     $this->nome = isset($user_dataHa['nome']) ? $user_dataHa['nome'] : null;
     $this->cognome = isset($user_dataHa['cognome']) ? $user_dataHa['cognome'] : null;
     $this->tipo = isset($user_dataHa['tipo']) ? $user_dataHa['tipo'] : null;
     $this->email = isset($user_dataHa['email']) ? $user_dataHa['email'] : null;
     $this->username = isset($user_dataHa['username']) ? $user_dataHa['username'] : null;
     $this->template_family = isset($user_dataHa['layout']) ? $user_dataHa['layout'] : null;
     $this->indirizzo = isset($user_dataHa['indirizzo']) ? $user_dataHa['indirizzo'] : null;
     $this->citta = isset($user_dataHa['citta']) ? $user_dataHa['citta'] : null;
     $this->provincia = isset($user_dataHa['provincia']) ? $user_dataHa['provincia'] : null;
     $this->nazione = isset($user_dataHa['nazione']) ? $user_dataHa['nazione'] : null;
     $this->codice_fiscale = isset($user_dataHa['codice_fiscale']) ? $user_dataHa['codice_fiscale'] : null;
     $this->birthdate = isset($user_dataHa['birthdate']) ? $user_dataHa['birthdate'] : null;
     $this->sesso = isset($user_dataHa['sesso']) ? $user_dataHa['sesso'] : null;
     $this->telefono = isset($user_dataHa['telefono']) ? $user_dataHa['telefono'] : null;
     $this->stato = isset($user_dataHa['stato']) ? $user_dataHa['stato'] : null;
     $this->lingua = isset($user_dataHa['lingua']) ? $user_dataHa['lingua'] : null;
     $this->timezone = isset($user_dataHa['timezone']) ? $user_dataHa['timezone'] : null;
     $this->cap = isset($user_dataHa['cap']) ? $user_dataHa['cap'] : null;
     $this->SerialNumber = isset($user_dataHa['matricola']) ? $user_dataHa['matricola'] : null;
     $this->avatar = isset($user_dataHa['avatar']) ? $user_dataHa['avatar'] : null;
     $this->birthcity = isset($user_dataHa['birthcity']) ? $user_dataHa['birthcity'] : null;
     $this->birthprovince = isset($user_dataHa['birthprovince']) ? $user_dataHa['birthprovince'] : null;
 }
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
     */
    $logStr = "";
    $log_file = ROOT_DIR . '/browsing/paypal/' . PAYPAL_IPN_LOG;
    $logFd = fopen($log_file, "a");
    $fpx = fopen($log_file, 'a');
Пример #4
0
 * Users (types) allowed to access this module.
 */
$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 = 'switcher';
// = switcher!
include_once 'include/' . $self . '_functions.inc.php';
/*
 * YOUR CODE HERE
 */
include_once ROOT_DIR . '/include/HtmlLibrary/BaseHtmlLib.inc.php';
$tutor_id = DataValidator::is_uinteger($_GET['id']);
if ($tutor_id == false) {
    header('Location: ' . $userObj->getHomePage());
    exit;
}
$tutor_ha = $dh->get_tutor($tutor_id);
if (AMA_DataHandler::isError($tutor_ha)) {
    $errObj = new ADA_Error($tutor_ha, translateFN('An error occurred while reading tutor data.'));
}
//$tutored_users_number = $dh->get_number_of_tutored_users($id);
$tutored_user_ids = $dh->get_tutored_user_ids($id);
if (AMA_DataHandler::isError($tutored_user_ids)) {
    $errObj = new ADA_Error($tutored_user_ids, translateFN('An error occurred while reading tutored user ids'));
}
$number_of_active_tutored_users = $common_dh->get_number_of_users_with_status($tutored_user_ids, ADA_STATUS_REGISTERED);
if (AMA_Common_DataHandler::isError($number_of_active_tutored_users)) {
Пример #5
0
 * 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
 */
/*
 * 1. dati del tester (con link modifica)
 * 2. elenco servizi erogati dal tester (con link modifica)
 * 3. link a lista utenti presenti sul tester
 */
$id_tester = DataValidator::is_uinteger($_GET['id_tester']);
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);
        }
* 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 IPN\n");
    fwrite($fpx, "Prima di init \n");
}
$today_date = today_dateFN();
$providerId = DataValidator::is_uinteger($_REQUEST['provider']);
$courseId = DataValidator::is_uinteger($_REQUEST['course']);
$instanceId = DataValidator::is_uinteger($_REQUEST['instance']);
$studentId = DataValidator::is_uinteger($_REQUEST['student']);
$testerInfoAr = $common_dh->get_tester_info_from_id($providerId, 'AMA_FETCH_ASSOC');
$buyerObj = read_user($studentId);
if (is_object($buyerObj) && !AMA_dataHandler::isError($buyerObj)) {
    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;
        // id dello studente
        if (!isset($instanceId)) {
            $instanceId = $sess_id_user;
            // ??????
        }
Пример #7
0
 */
$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
 */
$id_tester = DataValidator::is_uinteger($_GET['id_tester']);
if (!isset($_GET['page']) || DataValidator::is_uinteger($_GET['page']) === FALSE) {
    $page = 1;
} else {
    $page = $_GET['page'];
}
$userTypeToFilter = isset($_GET['user_type']) ? DataValidator::is_uinteger($_GET['user_type']) : false;
$users_per_page = 20;
if ($id_tester !== FALSE) {
    $tester_info = $common_dh->get_tester_info_from_id($id_tester);
    $tester_dsn = MultiPort::getDSN($tester_info[10]);
    if ($tester_dsn != NULL) {
        $tester_dh = AMA_DataHandler::instance($tester_dsn);
        if ($userTypeToFilter !== FALSE) {
            $user_typesAr = array($userTypeToFilter);
        } else {
            $user_typesAr = array(AMA_TYPE_STUDENT, AMA_TYPE_AUTHOR, AMA_TYPE_TUTOR, AMA_TYPE_SWITCHER, AMA_TYPE_ADMIN);
        }
        $users_count = $tester_dh->count_users_by_type($user_typesAr);
        if (AMA_DataHandler::isError($users_count)) {
            $errObj = new ADA_Error($users_count);
        } else {
Пример #8
0
    } else {
        unset($_POST['submit']);
        $service_dataAr = $_POST;
        $result = $common_dh->set_service($_POST['service_id'], $service_dataAr);
        if (AMA_Common_DataHandler::isError($result)) {
            $errObj = new ADA_Error($result);
        } else {
            header('Location: ' . $userObj->getHomePage());
            exit;
        }
    }
} else {
    /*
     * Display the add user form
     */
    $id_service = DataValidator::is_uinteger($_GET['id_service']);
    if ($id_service !== FALSE) {
        $service_infoAr = $common_dh->get_service_info($id_service);
        if (AMA_Common_DataHandler::isError($service_infoAr)) {
            $errObj = new ADA_Error($service_infoAr);
        } else {
            $testersAr = array();
            $service_dataAr = array('service_id' => $service_infoAr[0], 'service_name' => $service_infoAr[1], 'service_description' => $service_infoAr[2], 'service_level' => $service_infoAr[3], 'service_duration' => $service_infoAr[4], 'service_min_meetings' => $service_infoAr[5], 'service_max_meetings' => $service_infoAr[6], 'service_meeting_duration' => $service_infoAr[7]);
            $form = AdminModuleHtmlLib::getEditServiceForm($testersAr, $service_dataAr);
        }
    } else {
        $form = new CText('');
    }
}
$label = translateFN("Modifica servizio");
$help = translateFN("Da qui l'amministratore puo' apportare modifiche ad un servizio esistente");
Пример #9
0
/**
 * @param  int $id_course_instance - a valid ADA
 * @return a Course_instance object on success, on failure raises a ADA_Error
 */
function read_course_instance_from_DB($id_course_instance)
{
    if (DataValidator::is_uinteger($id_course_instance) !== FALSE) {
        $read_id_course_instance = $id_course_instance;
    } else {
        $read_id_course_instance = $_SESSION['sess_id_course_instance'];
    }
    if (isset($read_id_course_instance)) {
        $courseInstanceObj = new Course_instance($read_id_course_instance);
        if ($courseInstanceObj->full == 0) {
            /*
             * Return a ADA_Error object with delayedErrorHandling set to TRUE.
             */
            return new ADA_Error(NULL, translateFN('Errore in lettura oggetto istanza corso'), 'read_course_instance_from_DB', NULL, NULL, NULL, TRUE);
        }
        return $courseInstanceObj;
    } else {
        /*
         * Return a ADA_Error object with delayedErrorHandling set to TRUE.
         */
        return new ADA_Error(NULL, translateFN('Errore in lettura oggetto istanza corso'), 'read_course_instance_from_DB', NULL, NULL, NULL, TRUE);
    }
}
Пример #10
0
        $userToEditObj->setBirthCity($_POST['user_birthcity']);
        $userToEditObj->setBirthProvince($_POST['user_birthprovince']);
        if ($userToEditObj instanceof ADAPractitioner) {
            $userToEditObj->setProfile($_POST['user_profile']);
        }
        MultiPort::setUser($userToEditObj, array(), true);
        $navigationHistoryObj = $_SESSION['sess_navigation_history'];
        $location = $navigationHistoryObj->lastModule();
        header('Location: ' . $location);
        exit;
    }
} else {
    /*
     * Display the add user form
     */
    if (DataValidator::is_uinteger($_GET['id_user']) === FALSE) {
        $form = new CText('');
    } else {
        $userToEditObj = MultiPort::findUser($_GET['id_user']);
        $user_dataAr = $userToEditObj->toArray();
        $testers_for_userAr = $common_dh->get_testers_for_user($_GET['id_user']);
        /*
         * FIXME: selects just one tester. if the user is of type ADAUser
         * we have to display all the associated testers.
         */
        if (!AMA_Common_DataHandler::isError($testers_for_userAr) && count($testers_for_userAr) > 0) {
            $tester = $testers_for_userAr[0];
        } else {
            $tester = NULL;
        }
        $dataAr = array('user_id' => $user_dataAr['id_utente'], 'user_firstname' => $user_dataAr['nome'], 'user_lastname' => $user_dataAr['cognome'], 'user_type' => $user_dataAr['tipo'], 'user_email' => $user_dataAr['e_mail'], 'user_username' => $user_dataAr['username'], 'user_layout' => $user_dataAr['layout'], 'user_address' => $user_dataAr['indirizzo'], 'user_city' => $user_dataAr['citta'], 'user_province' => $user_dataAr['provincia'], 'user_country' => $user_dataAr['nazione'], 'user_fiscal_code' => $user_dataAr['codice_fiscale'], 'user_birthdate' => $user_dataAr['birthdate'], 'user_sex' => $user_dataAr['sesso'], 'user_phone' => $user_dataAr['telefono'], 'user_tester' => $tester, 'user_profile' => isset($user_dataAr['profilo']) ? $user_dataAr['profilo'] : null, 'user_birthcity' => $user_dataAr['birthcity'], 'user_birthprovince' => $user_dataAr['birthprovince']);
Пример #11
0
 if (DataValidator::validate_not_empty_string($_POST['service_description']) === FALSE) {
     $errorsAr['service_description'] = true;
 }
 if (DataValidator::is_uinteger($_POST['service_level']) === FALSE) {
     $errorsAr['service_level'] = true;
 }
 if (DataValidator::is_uinteger($_POST['service_duration']) === FALSE) {
     $errorsAr['service_duration'] = true;
 }
 if (DataValidator::is_uinteger($_POST['service_min_meetings']) === FALSE) {
     $errorsAr['service_min_meetings'] = true;
 }
 if (DataValidator::is_uinteger($_POST['service_max_meetings']) === FALSE) {
     $errorsAr['service_max_meetings'] = true;
 }
 if (DataValidator::is_uinteger($_POST['service_meeting_duration']) === FALSE) {
     $errorsAr['service_meeting_duration'] = true;
 }
 if (count($errorsAr) > 0) {
     $service_dataAr = $_POST;
     $form = AdminModuleHtmlLib::getAddServiceForm($testersAr, $service_dataAr, $errorsAr);
 } else {
     unset($_POST['submit']);
     $service_dataAr = $_POST;
     if ($common_dh->add_service($service_dataAr)) {
         header('Location: ' . $userObj->getHomePage());
         exit;
     } else {
         $errObj = new ADA_Error();
     }
 }
Пример #12
0
     //  $title = translateFN('Registration confirmed');
     $dati = sprintf(translateFN('Hai confermato la tua registrazione a %s. %s Puoi accedere a %s inserendo il tuo username (%s) e la tua password nella pagina di login di %s.'), PORTAL_NAME, '<br />', PORTAL_NAME, $userObj->getUserName(), PORTAL_NAME);
     //  $dati  = sprintf(translateFN('You have successfully confirmed your registration to ICON. %s You can access ICON by entering your username (%s) and your password in the ADA login page.'),'<br />', $userObj->getUserName());
     $login_page_link = CDOMElement::create('a', 'href:' . HTTP_ROOT_DIR);
     $login_page_link->addChild(new CText(translateFN('Pagina di login')));
     $dati .= '<br />' . $login_page_link->getHtml();
     break;
 case 'set_new_password':
     /*
      * first time here: we show only the password and passwordcheck fields
      */
     /*
      * Data validation
      */
     $token = DataValidator::validate_action_token($_GET['tok']);
     $userid = DataValidator::is_uinteger($_GET['uid']);
     if ($token == false || $userid == false) {
         /*
          * Token or userid not valid, do not proceed.
          */
         header('Location: ' . HTTP_ROOT_DIR);
         exit;
     }
     $tokenObj = TokenFinder::findTokenForUserRegistration($userid, $token);
     if ($tokenObj == false) {
         /*
          * There isn't a token corresponding to input data, do not proceed.
          */
         $message = translateFN('Did not find a token that matches your request');
         header('Location: ' . HTTP_ROOT_DIR . '/index.php?message=' . urlencode($message));
         exit;
Пример #13
0
 * Users (types) allowed to access this module.
 */
$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 = 'switcher';
// = switcher!
include_once 'include/' . $self . '_functions.inc.php';
/*
 * YOUR CODE HERE
 */
include_once ROOT_DIR . '/include/HtmlLibrary/BaseHtmlLib.inc.php';
if (DataValidator::is_uinteger($id) !== FALSE) {
    /*
     * Aggiungere un controllo per verificare che l'utente di cui si vuole vedere
     * il profilo sia un utente seguito da questo switcher?
     */
    $tutoredUserObj = MultiPort::findUser($id);
    $user_dataAr = array(translateFN('Id utente') => $tutoredUserObj->getId(), translateFN('Nome') => $tutoredUserObj->getFirstName(), translateFN('Cognome') => $tutoredUserObj->getLastName(), translateFN('E-mail') => $tutoredUserObj->getEmail(), translateFN('Username') => $tutoredUserObj->getUserName(), translateFN('Indirizzo') => $tutoredUserObj->getAddress(), translateFN('Città') => $tutoredUserObj->getCity(), translateFN('Provincia') => $tutoredUserObj->getProvince(), translateFN('Nazione') => $tutoredUserObj->getCountry(), translateFN('Codice fiscale') => $tutoredUserObj->getFiscalCode(), translateFN('Data di Nascita') => $tutoredUserObj->getBirthDate(), translateFN('Comune o stato estero di nascita') => $tutoredUserObj->getBirthCity(), translateFN('Provincia di nascita') => $tutoredUserObj->getBirthProvince(), translateFN('Sesso') => $tutoredUserObj->getGender(), translateFN('Telefono') => $tutoredUserObj->getPhoneNumber(), translateFN('Status') => $tutoredUserObj->getStatus());
    $data = BaseHtmlLib::plainListElement('', $user_dataAr);
} else {
    $data = new CText(translateFN("Id dell'utente non valido"));
}
$banner = (include ROOT_DIR . '/include/banner.inc.php');
$status = translateFN("Caratteristiche dell'utente");
// preparazione output HTML e print dell' output
$title = translateFN('ADA - dati epractitioner');
$content_dataAr = array('menu' => $menu, 'banner' => $banner, 'dati' => $data->getHtml(), 'help' => $help, 'status' => $status, 'user_name' => $user_name, 'user_type' => $user_type, 'messages' => $user_messages->getHtml(), 'agenda' => $user_agenda->getHtml());
Пример #14
0
 * If id course instance is not set or is not valid,
 * return to user's home page
 */
$id_course_instance = DataValidator::is_uinteger($_GET['id_course_instance']);
if ($id_course_instance === FALSE) {
    $errObj = new ADA_Error(NULL, translateFN('Impossibile accedere al modulo'), NULL, NULL, NULL, $userObj->getHomePage());
}
/*
 * If id user is not set or is not valid,
 * return to user's home page
 */
$id_user = DataValidator::is_uinteger($_GET['id_user']);
if ($id_user === FALSE) {
    $errObj = new ADA_Error(NULL, translateFN('Impossibile accedere al modulo'), NULL, NULL, NULL, $userObj->getHomePage());
}
$page = DataValidator::is_uinteger($_GET['page']);
if ($page === FALSE) {
    $page = 1;
}
$tutoredUserObj = MultiPort::findUser($id_user);
/*
 * Obtain service information and eguidance data for the given id_course_instance
 */
$id_course = $dh->get_course_id_for_course_instance($id_course_instance);
if (AMA_DataHandler::isError($id_course)) {
    $errObj = new ADA_Error(NULL, translateFN("Errore nell'ottenimento dell'id del servzio"), NULL, NULL, NULL, $userObj->getHomePage());
}
$service_infoAr = $common_dh->get_service_info_from_course($id_course);
if (AMA_Common_DataHandler::isError($service_infoAr)) {
    $errObj = new ADA_Error(NULL, translateFN("Errore nell'ottenimento delle informazioni sul servizio"), NULL, NULL, NULL, $userObj->getHomePage());
}
Пример #15
0
if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'POST') {
    /*
     * Handle data from $_POST:
     * 1. validate user submitted data
     * 2. if there are errors, display the add user form updated with error messages
     * 3. if there aren't errors, add this user to the common database and to
     *    the tester databases associated with this user.
     */
    /*
     * Validazione dati
     */
    $errorsAr = array();
    if ($_POST['user_tester'] == 'none') {
        $errorsAr['user_tester'] = true;
    }
    if (DataValidator::is_uinteger($_POST['user_type']) === FALSE) {
        $errorsAr['user_type'] = true;
    }
    if (DataValidator::validate_firstname($_POST['user_firstname']) === FALSE) {
        $errorsAr['user_firstname'] = true;
    }
    if (DataValidator::validate_lastname($_POST['user_lastname']) === FALSE) {
        $errorsAr['user_lastname'] = true;
    }
    if (DataValidator::validate_email($_POST['user_email']) === FALSE) {
        $errorsAr['user_email'] = true;
    }
    if (DataValidator::validate_username($_POST['user_username']) === FALSE) {
        $errorsAr['user_username'] = true;
    }
    if (DataValidator::validate_password($_POST['user_password'], $_POST['user_passwordcheck']) === FALSE) {
Пример #16
0
    $eguidance_session_dataAr = $dh->get_eguidance_session_with_event_token($event_token);
    if (AMA_DataHandler::isError($eguidance_session_dataAr)) {
        $errObj = new ADA_Error($eguidance_session_dataAr);
    } else {
        $tutoredUserObj = MultiPort::findUser($eguidance_session_dataAr['id_utente']);
        $eguidance_session_dataAr['user_fullname'] = $tutoredUserObj->getFullName();
        $eguidance_session_dataAr['user_country'] = $tutoredUserObj->getCountry();
        $eguidance_session_dataAr['service_duration'] = '';
        createCSVFileToDownload($eguidance_session_dataAr);
        /*
         * exits here.
         */
    }
} else {
    $id_user = DataValidator::is_uinteger($_GET['id_user']);
    $id_course_instance = DataValidator::is_uinteger($_GET['id_course_instance']);
    if ($id_user === FALSE || $id_course_instance === FALSE) {
        $errObj = new ADA_Error(NULL, translateFN("Dati in input per il modulo user_servide_detail non corretti"), NULL, NULL, NULL, $userObj->getHomePage());
    }
    /*
     * User data to display
     */
    $tutoredUserObj = MultiPort::findUser($id_user);
    $user_data = TutorModuleHtmlLib::getEguidanceSessionUserDataTable($tutoredUserObj);
    /*
     * Service data to display
     */
    $id_course = $dh->get_course_id_for_course_instance($id_course_instance);
    if (!AMA_DataHandler::isError($id_course)) {
        $service_infoAr = $common_dh->get_service_info_from_course($id_course);
        if (!AMA_Common_DataHandler::isError($service_infoAr)) {
Пример #17
0
 public static function getEguidanceTutorForm(ADALoggableUser $tutoredUserObj, $service_infoAr = array(), $form_dataAr = array(), $fill_textareas = FALSE)
 {
     $form = CDOMElement::create('form', 'id:eguidance_tutor_form, name: eguidance_tutor_form, action:eguidance_tutor_form.php, method:post');
     $area_personal_conditions = CDOMElement::create('div');
     $area_personal_conditions->addChild(new CText(EguidanceSession::textLabelForField('area_pc')));
     $form->addChild($area_personal_conditions);
     /*
      * Fiscal code
      */
     $user_fiscal_code = $tutoredUserObj->getFiscalCode();
     if (!is_null($user_fiscal_code)) {
         $hidden_fc = CDOMElement::create('hidden', 'id:user_fc, name:user_fc');
         $hidden_fc->setAttribute('value', $user_fiscal_code);
         $form->addChild($hidden_fc);
         $ufc = $user_fiscal_code;
     } else {
         $ufc = translateFN("L'utente non ha fornito il codice fiscale");
     }
     if (isset($form_dataAr['is_popup'])) {
         $hidden_popup = CDOMElement::create('hidden', 'id:is_popup, name:is_popup');
         $hidden_popup->setAttribute('value', '1');
         $form->addChild($hidden_popup);
     }
     /*
      * Hidden user data
      */
     $user_fullname = $tutoredUserObj->nome . ' ' . $tutoredUserObj->cognome;
     $user_country = $tutoredUserObj->getCountry();
     $user_birthdate = $tutoredUserObj->getBirthDate();
     $user_birthcity = $tutoredUserObj->getBirthCity();
     $user_birthprovince = $tutoredUserObj->getBirthProvince();
     $user_gender = $tutoredUserObj->getGender();
     $user_foreign_culture = 'FOREIGN CULTURE';
     if (($id = DataValidator::is_uinteger($form_dataAr['id'])) !== FALSE) {
         $hidden_id_eguidance_session = CDOMElement::create('hidden', 'id:id_eguidance_session, name:id_eguidance_session');
         $hidden_id_eguidance_session->setAttribute('value', $id);
         $form->addChild($hidden_id_eguidance_session);
     }
     $hidden_id_utente = CDOMElement::create('hidden', 'id:id_utente, name:id_utente');
     $hidden_id_utente->setAttribute('value', $tutoredUserObj->getId());
     $hidden_id_istanza_corso = CDOMElement::create('hidden', 'id:id_istanza_corso, name:id_istanza_corso');
     $hidden_id_istanza_corso->setAttribute('value', $service_infoAr['id_istanza_corso']);
     $hidden_event_token = CDOMElement::create('hidden', 'id:event_token, name:event_token');
     $hidden_event_token->setAttribute('value', $service_infoAr['event_token']);
     $hidden_user_fullname = CDOMElement::create('hidden', 'id:user_fullname, name: user_fullname');
     $hidden_user_fullname->setAttribute('value', $user_fullname);
     $hidden_user_country = CDOMElement::create('hidden', 'id:user_country, name:user_country');
     $hidden_user_country->setAttribute('value', $user_country);
     $hidden_service_duration = CDOMElement::create('hidden', 'id:service_duration, name:service_duration');
     $hidden_service_duration->setAttribute('value', 10);
     $hidden_user_birthdate = CDOMElement::create('hidden', 'id:ud_1, name:ud_1');
     $hidden_user_birthdate->setAttribute('value', $user_birthdate);
     $hidden_user_gender = CDOMElement::create('hidden', 'id:ud_2, name:ud_2');
     $hidden_user_gender->setAttribute('value', $user_gender);
     $hidden_user_foreign_culture = CDOMElement::create('hidden', 'id:ud_3, name:ud_3');
     $hidden_user_foreign_culture->setAttribute('value', $user_foreign_culture);
     $hidden_user_birthcity = CDOMElement::create('hidden', 'id:ud_4, name:ud_4');
     $hidden_user_birthcity->setAttribute('value', $user_birthcity);
     $hidden_user_birthprovince = CDOMElement::create('hidden', 'id:ud_5, name:ud_5');
     $hidden_user_birthprovince->setAttribute('value', $user_birthprovince);
     $form->addChild($hidden_id_utente);
     $form->addChild($hidden_id_istanza_corso);
     $form->addChild($hidden_event_token);
     $form->addChild($hidden_user_fullname);
     $form->addChild($hidden_user_country);
     $form->addChild($hidden_service_duration);
     $form->addChild($hidden_user_birthdate);
     $form->addChild($hidden_user_birthcity);
     $form->addChild($hidden_user_birthprovince);
     $form->addChild($hidden_user_gender);
     $form->addChild($hidden_user_foreign_culture);
     //    $ufc_thead = array(translateFN("Dati utente"),'');
     //    $ufc_tbody = array(
     //      array(translateFN("Codice fiscale dell'utente"), $user_fiscal_code),
     //      array(translateFN("Nome e cognome dell'utente"), $user_ns),
     //      array(translateFN("Nazionalità dell'utente"), $user_country)
     //    );
     //    $ufc_table = BaseHtmlLib::tableElement('', $ufc_thead, $ufc_tbody);
     $ufc_table = self::getEguidanceSessionUserDataTable($tutoredUserObj);
     $form->addChild($ufc_table);
     /*
      * Type of e-guidance action
      */
     if (is_array($service_infoAr) && isset($service_infoAr[3])) {
         $service_level = $service_infoAr[3];
     }
     if ($service_level == 2) {
         $typeAr = array(1 => EguidanceSession::textLabelForField('sl_1'), 2 => EguidanceSession::textLabelForField('sl_2'));
     } else {
         if ($service_level == 3) {
             $typeAr = array(3 => EguidanceSession::textLabelForField('sl_3'), 4 => EguidanceSession::textLabelForField('sl_4'));
         } else {
             if ($service_level == 4) {
                 $typeAr = array(5 => EguidanceSession::textLabelForField('sl_5'), 6 => EguidanceSession::textLabelForField('sl_6'), 7 => EguidanceSession::textLabelForField('sl_7'));
             } else {
                 $typeAr = array();
             }
         }
     }
     //FIXME: qui passo $form_dataAr['tipo_eguidance'], ma dovrei passare $form_dataAr['type_of_guidance']
     $toe_thead = array(EguidanceSession::textLabelForField('toe_title'));
     $toe_tbody = array(array(BaseHtmlLib::selectElement2('id:type_of_guidance, name:type_of_guidance', $typeAr, $form_dataAr['tipo_eguidance'])));
     $toe_table = BaseHtmlLib::tableElement('', $toe_thead, $toe_tbody);
     $form->addChild($toe_table);
     $scoresAr = EguidanceSession::scoresArray();
     //$textarea_default_text = translateFN('Inserire i vostri commenti');
     /*
      * User's features
      */
     // Critical socio anagraphic data
     $ud_1_select = BaseHtmlLib::selectElement2('id:ud_1, name:ud_1', $scoresAr, $form_dataAr['ud_1']);
     $ud_2_select = BaseHtmlLib::selectElement2('id:ud_2, name:ud_2', $scoresAr, $form_dataAr['ud_2']);
     $ud_3_select = BaseHtmlLib::selectElement2('id:ud_3, name:ud_3', $scoresAr, $form_dataAr['ud_3']);
     $ud_4_select = BaseHtmlLib::selectElement2('id:ud_4, name:ud_4', $scoresAr, $form_dataAr['ud_4']);
     $ud_5_select = BaseHtmlLib::selectElement2('id:ud_5, name:ud_5', $scoresAr, $form_dataAr['ud_5']);
     $csa_thead = array(EguidanceSession::textLabelForField('ud_title'), '');
     $csa_tbody = array(array(EguidanceSession::textLabelForField('ud_1'), $ud_1_select), array(EguidanceSession::textLabelForField('ud_4'), $ud_4_select), array(EguidanceSession::textLabelForField('ud_5'), $ud_5_select), array(EguidanceSession::textLabelForField('ud_2'), $ud_2_select), array(EguidanceSession::textLabelForField('ud_3'), $ud_3_select));
     $csa_table = BaseHtmlLib::tableElement('', $csa_thead, $csa_tbody);
     $form->addChild($csa_table);
     $label = EguidanceSession::textLabelForField('ud_comments');
     $form->addChild(self::displayTextAreaForTutorComments('ud_comments', $label, $form_dataAr, $fill_textareas));
     // Personal critical items
     $pcitems_1_select = BaseHtmlLib::selectElement2('id:pc_1, name:pc_1', $scoresAr, $form_dataAr['pc_1']);
     $pcitems_2_select = BaseHtmlLib::selectElement2('id:pc_2, name:pc_2', $scoresAr, $form_dataAr['pc_2']);
     $pcitems_3_select = BaseHtmlLib::selectElement2('id:pc_3, name:pc_3', $scoresAr, $form_dataAr['pc_3']);
     $pcitems_4_select = BaseHtmlLib::selectElement2('id:pc_4, name:pc_4', $scoresAr, $form_dataAr['pc_4']);
     $pcitems_5_select = BaseHtmlLib::selectElement2('id:pc_5, name:pc_5', $scoresAr, $form_dataAr['pc_5']);
     $pcitems_6_select = BaseHtmlLib::selectElement2('id:pc_6, name:pc_6', $scoresAr, $form_dataAr['pc_6']);
     $pcitems_thead = array(EguidanceSession::textLabelForField('pc_title'), translateFN('Select a score'));
     $pcitems_tbody = array(array(EguidanceSession::textLabelForField('pc_1'), $pcitems_1_select), array(EguidanceSession::textLabelForField('pc_2'), $pcitems_2_select), array(EguidanceSession::textLabelForField('pc_3'), $pcitems_3_select), array(EguidanceSession::textLabelForField('pc_4'), $pcitems_4_select), array(EguidanceSession::textLabelForField('pc_5'), $pcitems_5_select), array(EguidanceSession::textLabelForField('pc_6'), $pcitems_6_select));
     $pcitems_table = BaseHtmlLib::tableElement('', $pcitems_thead, $pcitems_tbody);
     $form->addChild($pcitems_table);
     $label = EguidanceSession::textLabelForField('pc_comments');
     $form->addChild(self::displayTextAreaForTutorComments('pc_comments', $label, $form_dataAr, $fill_textareas));
     $area_of_the_job = CDOMElement::create('div');
     $area_of_the_job->addChild(new CText(EguidanceSession::textLabelForField('area_pp')));
     $form->addChild($area_of_the_job);
     /*
      * Bonds/availability
      */
     $ba_1_select = BaseHtmlLib::selectElement2('id:ba_1, name:ba_1', $scoresAr, $form_dataAr['ba_1']);
     $ba_2_select = BaseHtmlLib::selectElement2('id:ba_2, name:ba_2', $scoresAr, $form_dataAr['ba_2']);
     $ba_3_select = BaseHtmlLib::selectElement2('id:ba_3, name:ba_3', $scoresAr, $form_dataAr['ba_3']);
     $ba_4_select = BaseHtmlLib::selectElement2('id:ba_4, name:ba_4', $scoresAr, $form_dataAr['ba_4']);
     $ba_thead = array(EguidanceSession::textLabelForField('ba_title'), translateFN('Select a score'));
     $ba_tbody = array(array(EguidanceSession::textLabelForField('ba_1'), $ba_1_select), array(EguidanceSession::textLabelForField('ba_2'), $ba_2_select), array(EguidanceSession::textLabelForField('ba_3'), $ba_3_select), array(EguidanceSession::textLabelForField('ba_4'), $ba_4_select));
     $ba_table = BaseHtmlLib::tableElement('', $ba_thead, $ba_tbody);
     $form->addChild($ba_table);
     $label = EguidanceSession::textLabelForField('ba_comments');
     $form->addChild(self::displayTextAreaForTutorComments('ba_comments', $label, $form_dataAr, $fill_textareas));
     /*
      * Training
      */
     $t_1_select = BaseHtmlLib::selectElement2('id:t_1, name:t_1', $scoresAr, $form_dataAr['t_1']);
     $t_2_select = BaseHtmlLib::selectElement2('id:t_2, name:t_2', $scoresAr, $form_dataAr['t_2']);
     $t_3_select = BaseHtmlLib::selectElement2('id:t_3, name:t_3', $scoresAr, $form_dataAr['t_3']);
     $t_4_select = BaseHtmlLib::selectElement2('id:t_4, name:t_4', $scoresAr, $form_dataAr['t_4']);
     $t_thead = array(EguidanceSession::textLabelForField('t_title'), translateFN('Select a score'));
     $t_tbody = array(array(EguidanceSession::textLabelForField('t_1'), $t_1_select), array(EguidanceSession::textLabelForField('t_2'), $t_2_select), array(EguidanceSession::textLabelForField('t_3'), $t_3_select), array(EguidanceSession::textLabelForField('t_4'), $t_4_select));
     $t_table = BaseHtmlLib::tableElement('', $t_thead, $t_tbody);
     $form->addChild($t_table);
     $label = EguidanceSession::textLabelForField('t_comments');
     $form->addChild(self::displayTextAreaForTutorComments('t_comments', $label, $form_dataAr, $fill_textareas));
     /*
      * Professional experiences
      */
     $pe_1_select = BaseHtmlLib::selectElement2('id:pe_1, name:pe_1', $scoresAr, $form_dataAr['pe_1']);
     $pe_2_select = BaseHtmlLib::selectElement2('id:pe_2, name:pe_2', $scoresAr, $form_dataAr['pe_2']);
     $pe_3_select = BaseHtmlLib::selectElement2('id:pe_3, name:pe_3', $scoresAr, $form_dataAr['pe_3']);
     $pe_thead = array(EguidanceSession::textLabelForField('pe_title'), translateFN('Select a score'));
     $pe_tbody = array(array(EguidanceSession::textLabelForField('pe_1'), $pe_1_select), array(EguidanceSession::textLabelForField('pe_2'), $pe_2_select), array(EguidanceSession::textLabelForField('pe_3'), $pe_3_select));
     $pe_table = BaseHtmlLib::tableElement('', $pe_thead, $pe_tbody);
     $form->addChild($pe_table);
     $label = EguidanceSession::textLabelForField('pe_comments');
     $form->addChild(self::displayTextAreaForTutorComments('pe_comments', $label, $form_dataAr, $fill_textareas));
     /*
      * Critical issues ...
      */
     $ci_1_select = BaseHtmlLib::selectElement2('id:ci_1, name:ci_1', $scoresAr, $form_dataAr['ci_1']);
     $ci_2_select = BaseHtmlLib::selectElement2('id:ci_2, name:ci_2', $scoresAr, $form_dataAr['ci_2']);
     $ci_3_select = BaseHtmlLib::selectElement2('id:ci_3, name:ci_3', $scoresAr, $form_dataAr['ci_3']);
     $ci_4_select = BaseHtmlLib::selectElement2('id:ci_4, name:ci_4', $scoresAr, $form_dataAr['ci_4']);
     $ci_thead = array(EguidanceSession::textLabelForField('ci_title'), translateFN('Select a score'));
     $ci_tbody = array(array(EguidanceSession::textLabelForField('ci_1'), $ci_1_select), array(EguidanceSession::textLabelForField('ci_2'), $ci_2_select), array(EguidanceSession::textLabelForField('ci_3'), $ci_3_select), array(EguidanceSession::textLabelForField('ci_4'), $ci_4_select));
     $ci_table = BaseHtmlLib::tableElement('', $ci_thead, $ci_tbody);
     $form->addChild($ci_table);
     $label = EguidanceSession::textLabelForField('ci_comments');
     $form->addChild(self::displayTextAreaForTutorComments('ci_comments', $label, $form_dataAr, $fill_textareas));
     /*
      * Motivazione + Other particular comments
      */
     $m_1_select = BaseHtmlLib::selectElement2('id:m_1, name:m_1', $scoresAr, $form_dataAr['m_1']);
     $m_2_select = BaseHtmlLib::selectElement2('id:m_2, name:m_2', $scoresAr, $form_dataAr['m_2']);
     $m_thead = array(EguidanceSession::textLabelForField('m_title'), translateFN('Select a score'));
     $m_tbody = array(array(EguidanceSession::textLabelForField('m_1'), $m_1_select), array(EguidanceSession::textLabelForField('m_2'), $m_2_select));
     $m_table = BaseHtmlLib::tableElement('', $m_thead, $m_tbody);
     $form->addChild($m_table);
     $label = EguidanceSession::textLabelForField('m_comments');
     $form->addChild(self::displayTextAreaForTutorComments('m_comments', $label, $form_dataAr, $fill_textareas));
     $label = EguidanceSession::textLabelForField('other_comments');
     $form->addChild(self::displayTextAreaForTutorComments('other_comments', $label, $form_dataAr, $fill_textareas));
     /*
      * Form buttons
      */
     $buttons = CDOMElement::create('div', 'id:buttons, name:buttons');
     $submit = CDOMElement::create('submit', 'id:submit, name:submit');
     $submit->setAttribute('value', translateFN('Save'));
     //    $reset   = CDOMElement::create('reset');
     $buttons->addChild($submit);
     //    $buttons->addChild($reset);
     $form->addChild($buttons);
     return $form;
 }
Пример #18
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);
Пример #19
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;
 }
Пример #20
0
require_once ROOT_DIR . '/include/Forms/UserProfileForm.inc.php';
$self = whoami();
$languages = Translator::getLanguagesIdAndName();
/**
 * Set the $editUserObj depending on logged user type
 */
$editUserObj = null;
$self_instruction = isset($self_instruction) ? $self_instruction : null;
switch ($userObj->getType()) {
    case AMA_TYPE_STUDENT:
    case AMA_TYPE_AUTHOR:
    case AMA_TYPE_TUTOR:
        $editUserObj = clone $userObj;
        break;
    case AMA_TYPE_SWITCHER:
        $userId = DataValidator::is_uinteger($_GET['id_user']);
        if ($userId !== false) {
            $editUserObj = MultiPort::findUser($userId);
        } else {
            $data = new CText(translateFN('Utente non trovato'));
        }
        break;
}
if (!is_null($editUserObj) && 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_user.php?message={$message}");
Пример #21
0
/**
 * checks if the passed object type and id are coming from the public tester.
 * If true sets the needed GLOBALS['dh'] session variables accordingly.
 * 
 * @param string $objType either 'course' or 'node'
 * @param string $objID object id to be checked and loaded if need be
 * 
 * return true if invalid has to be set to true on the caller
 */
function checkAndSetPublicTester($objType, $objID)
{
    $common_dh = $GLOBALS['common_dh'];
    if ($objType !== 'course' || is_null($objID)) {
        $tmp_id_course = isset($_REQUEST['id_course']) ? DataValidator::is_uinteger($_REQUEST['id_course']) : false;
        if ($tmp_id_course === false) {
            $tmp_id_course = isset($_REQUEST['id_node']) ? substr($_REQUEST['id_node'], 0, strpos($_REQUEST['id_node'], '_')) : false;
        }
        if ($tmp_id_course === false) {
            $tmp_id_course = isset($_SESSION['sess_id_course']) ? DataValidator::is_uinteger($_SESSION['sess_id_course']) : false;
        }
        if ($tmp_id_course === false) {
            $tmp_id_course = isset($_SESSION['sess_id_node']) ? substr($_SESSION['sess_id_node'], 0, strpos($_SESSION['sess_id_node'], '_')) : false;
        }
    } else {
        $tmp_id_course = $objID;
    }
    if ($tmp_id_course !== false) {
        // get the tester for the passed id_course
        $tester_infoAr = $common_dh->get_tester_info_from_id_course($tmp_id_course);
        // get the service info for the passed id_course
        $service_inforAr = $common_dh->get_service_type_info_from_course($tmp_id_course);
        // check that the tester is valid and is the public one and
        // check that the service is valid and is a public one
        if (!AMA_DB::isError($tester_infoAr) && is_array($tester_infoAr) && isset($tester_infoAr['puntatore']) && $tester_infoAr['puntatore'] == ADA_PUBLIC_TESTER && !AMA_DB::isError($service_inforAr) && is_array($service_inforAr) && isset($service_inforAr['isPublic']) && intval($service_inforAr['isPublic']) !== 0) {
            // save the dh, if a restrore is needed afterwards
            $olddh = $GLOBALS['dh'];
            // load the dh
            $dh = AMA_DataHandler::instance(MultiPort::getDSN($tester_infoAr['puntatore']));
            if (!AMA_DB::isError($dh)) {
                // check the object
                if ($objType == 'node') {
                    $dataHa = $dh->get_node_info($objID);
                    if (AMA_DB::isError($dataHa) || !is_array($dataHa)) {
                        $retval = true;
                        // restore the saved datahandler
                        $GLOBALS['dh'] = $olddh;
                    } else {
                        $retval = false;
                        // set the datahandler
                        $GLOBALS['dh'] = $dh;
                        $_SESSION['sess_id_node'] = $objID;
                        $_SESSION['sess_id_course'] = $tmp_id_course;
                    }
                } else {
                    if ($objType == 'course') {
                        // set the datahandler
                        $GLOBALS['dh'] = $dh;
                        $sess_courseObj = read_course($objID);
                        if (AMA_DB::isError($sess_courseObj) || !$sess_courseObj instanceof Course) {
                            $retval = true;
                            // restore the saved datahandler
                            $GLOBALS['dh'] = $olddh;
                        } else {
                            $retval = false;
                            $_SESSION['sess_courseObj'] = $sess_courseObj;
                            $_SESSION['sess_id_course'] = $objID;
                        }
                    }
                }
            }
        }
    }
    return isset($retval) ? $retval : true;
}
Пример #22
0
     */
    $extraTableClass = trim($_POST['extraTableName']);
    $extraTableFormClass = "User" . ucfirst($extraTableClass) . "Form";
    if (is_file(ROOT_DIR . '/include/Forms/' . $extraTableFormClass . '.inc.php')) {
        require_once ROOT_DIR . '/include/Forms/' . $extraTableFormClass . '.inc.php';
    } else {
        die("Form class not found, don't know how to save");
    }
}
switch ($userObj->getType()) {
    case AMA_TYPE_STUDENT:
    case AMA_TYPE_AUTHOR:
        $editUserObj =& $userObj;
        break;
    case AMA_TYPE_SWITCHER:
        $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);
Пример #23
0
            $classId = $chatRoomHa['id_istanza_corso'];
            $chatTitle = $chatRoomHa['titolo_chat'];
            $chat_deleted = ChatRoom::remove_chatroomFN($chatId);
            if ($chat_deleted) {
                $data = new CText(translateFN('Chat cancellata'));
            } else {
                $data = new CText(translateFN('Errore nella cancellazione della Chat'));
            }
        } else {
            $data = new CText(translateFN('Chatroom non trovata'));
        }
    } else {
        $data = new CText(translateFN('Id chat non valido'));
    }
} else {
    $chatId = DataValidator::is_uinteger($_GET['id_room']);
    if ($chatId === false) {
        $data = new CText(translateFN('Id chat non valido') . '(1)');
    } else {
        //         $chatroomObj = new ChatRoom($chatId);
        $chatRoomHa = ChatRoom::get_info_chatroomFN($chatId);
        if (!AMA_DataHandler::isError($chatRoomHa)) {
            $classId = $chatRoomHa['id_istanza_corso'];
            $chatTitle = $chatRoomHa['titolo_chat'];
            $formData = array('id_room' => $chatId);
            $data = new chatRemovalForm();
            $data->fillWithArrayData($formData);
        } else {
            $data = new CText(translateFN('Chatroom non trovata') . '(1)');
        }
    }
Пример #24
0
*/
require_once ROOT_DIR . '/include/Forms/UserProfileForm.inc.php';
$languages = Translator::getLanguagesIdAndName();
$retArray = array();
$title = translateFN('Salvataggio');
/**
 * Set the $editUserObj depending on logged user type
 */
$editUserObj = null;
switch ($userObj->getType()) {
    case AMA_TYPE_STUDENT:
    case AMA_TYPE_AUTHOR:
        $editUserObj =& $userObj;
        break;
    case AMA_TYPE_SWITCHER:
        $userId = DataValidator::is_uinteger($_POST['id_utente']);
        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);
        }
Пример #25
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, AMA_TYPE_VISITOR, AMA_TYPE_AUTHOR, AMA_TYPE_TUTOR, AMA_TYPE_SWITCHER, AMA_TYPE_ADMIN);
/**
 * Performs basic controls before entering this module
 */
$neededObjAr = array(AMA_TYPE_STUDENT => array('layout'), AMA_TYPE_VISITOR => array('layout'), AMA_TYPE_AUTHOR => array('layout'), AMA_TYPE_TUTOR => array('layout'), AMA_TYPE_ADMIN => array('layout'), AMA_TYPE_SWITCHER => array('layout'));
require_once ROOT_DIR . '/include/module_init.inc.php';
include_once 'include/browsing_functions.inc.php';
$self = whoami();
require_once ROOT_DIR . '/include/HtmlLibrary/UserModuleHtmlLib.inc.php';
$external_link_id = isset($_GET['id']) ? DataValidator::is_uinteger($_GET['id']) : false;
$filename = isset($_GET['file']) ? DataValidator::validate_local_filename($_GET['file']) : false;
//$url = DataValidator::validate_url($_GET['url']);
$url = isset($_GET['url']) ? $_GET['url'] : null;
if ($external_link_id != false) {
    $external_resourceAr = $dh->get_risorsa_esterna_info($external_link_id);
    if (AMA_DataHandler::isError($external_resourceAr)) {
        $data = '';
    } elseif ($external_resourceAr['tipo'] != _LINK) {
        $data = '';
    } else {
        $address = $external_resourceAr['nome_file'];
        $data = UserModuleHtmlLib::getExternalLinkNavigationFrame($address)->getHtml();
    }
} elseif ($filename != false) {
    if (basename($filename) == $filename) {