Exemplo n.º 1
0
 public static function getAddExerciseForm($form_dataAr = array(), $errorsAr = array())
 {
     $form = CDOMElement::create('form', 'id:add_exercise, name:add_exercise, class:fec, method:post');
     $form->setAttribute('action', 'add_exercise.php?verify=1');
     //$form->setAttribute('onsubmit',"return checkNec();");
     $form->setAttribute('enctype', 'multipart/form-data');
     $parent_node = FormElementCreator::addTextInput('parent_node', 'Nodo parent', $form_dataAr, $errorsAr, '', true);
     $form->addChild($parent_node);
     $exercise_title = FormElementCreator::addTextInput('exercise_title', 'Titolo esercizio', $form_dataAr, $errorsAr, '', true);
     $form->addChild($exercise_title);
     $exercise_familyAr = array(ADA_STANDARD_EXERCISE_TYPE => translateFN('Multiple Choice'), ADA_OPEN_MANUAL_EXERCISE_TYPE => translateFN('Open with Manual Correction'), ADA_OPEN_AUTOMATIC_EXERCISE_TYPE => translateFN('Open with Automatic Correction'), ADA_OPEN_UPLOAD_EXERCISE_TYPE => translateFN('Open Manual + Upload'), ADA_CLOZE_EXERCISE_TYPE => translateFN('CLOZE'));
     $exercise_family = FormElementCreator::addSelect('exercise_family', 'Tipo di esercizio', $exercise_familyAr, $form_dataAr, $errorsAr, '', true);
     $form->addChild($exercise_family);
     $exercise_interactionAr = array(ADA_BLIND_EXERCISE_INTERACTION => translateFN('No Feedback'), ADA_FEEDBACK_EXERCISE_INTERACTION => translateFN('With Feedback'), ADA_RATING_EXERCISE_INTERACTION => translateFN('With Feedback and Rating'));
     $exercise_interaction = FormElementCreator::addSelect('exercise_interaction', 'Tipo di interazione', $exercise_interactionAr, $form_dataAr, $errorsAr, '', true);
     $form->addChild($exercise_interaction);
     $test_modeAr = array(ADA_SINGLE_EXERCISE_MODE => translateFN('Only One Exercise'), ADA_SEQUENCE_EXERCISE_MODE => translateFN('Next Exercise will be Shown'), ADA_RANDOM_EXERCISE_MODE => translateFN('A Random Picked Exercise will be Shown'));
     $test_mode = FormElementCreator::addSelect('test_mode', 'Modalità di esecuzione', $test_modeAr, $form_dataAr, $errorsAr, '', true);
     $form->addChild($test_mode);
     $test_simplificationAr = array(ADA_NORMAL_EXERCISE_SIMPLICITY => translateFN('Normal Exercise'), ADA_MEDIUM_EXERCISE_SIMPLICITY => translateFN('Medium Exercise'), ADA_SIMPLIFY_EXERCISE_SIMPLICITY => translateFN('Simplified Exercise'));
     $test_simplification = FormElementCreator::addSelect('test_simplification', "Semplicità dell'esercizio", $test_simplificationAr, $form_dataAr, $errorsAr, '', true);
     $form->addChild($test_simplification);
     $test_barrierAr = array(ADA_NO_EXERCISE_BARRIER => translateFN('No barrier'), ADA_YES_EXERCISE_BARRIER => translateFN('With barrier'));
     $test_barrier = FormElementCreator::addSelect('test_barrier', 'Con sbarramento', $test_barrierAr, $form_dataAr, $errorsAr, '', true);
     $form->addChild($test_barrier);
     $buttons = FormElementCreator::addSubmitAndResetButtons();
     $form->addChild($buttons);
     return $form;
 }
 public static function registrationForm($form_dataAr = array(), $errorsAr = array())
 {
     $firstname = $form_dataAr['firstname'];
     $lastname = $form_dataAr['lastname'];
     $username = $form_dataAr['username'];
     $password = $form_dataAr['password'];
     $email = $form_dataAr['email'];
     $error_message = $form_dataAr['error_message'];
     $id_course = $form_dataAr['id_course'];
     $form = CDOMElement::create('form', 'id:services_request, name:services_request, class:fec, method:post, action:registration.php');
     $form->setAttribute('onsubmit', "return checkNec();");
     $form->setAttribute('enctype', 'multipart/form-data');
     $id_course_hidden = CDOMElement::create('hidden', 'id:id_course, name:id_course');
     $id_course_hidden->setAttribute('value', $id_course);
     $form->addChild($id_course_hidden);
     $name = FormElementCreator::addTextInput('name', 'nome', $form_dataAr, $errorsAr, '', true);
     $form->addChild($name);
     $surname = FormElementCreator::addTextInput('surname', 'cognome', $form_dataAr, $errorsAr, '', true);
     $form->addChild($surname);
     $birthdate = FormElementCreator::addTextInput('birthdate', 'Data di Nascita', $form_dataAr, $errorsAr);
     $form->addChild($birthdate);
     $birthcity = FormElementCreator::addTextInput('birthcity', 'Comune o stato estero di nascita', $form_dataAr, $errorsAr);
     $form->addChild($birthcity);
     $birthprovince = FormElementCreator::addTextInput('birthprovince', 'Provincia di nascita', $form_dataAr, $errorsAr);
     $form->addChild($birthprovince);
     $genderAr = array('0' => translateFN('Scegli un genere'), 'M' => translateFN('maschio'), 'F' => translateFN('femmina'));
     $gender = FormElementCreator::addSelect('gender', 'sesso', $genderAr, $form_dataAr, $errorsAr);
     $form->addChild($gender);
     $email = FormElementCreator::addTextInput('email', 'email', $form_dataAr, $errorsAr, '', true);
     $form->addChild($email);
     $telephone = FormElementCreator::addTextInput('telephone', 'telefono', $form_dataAr, $errorsAr, '', true);
     $form->addChild($telephone);
     $countryAr = array('0' => translateFN("Scegli il tuo paese"), '1' => translateFN('Bulgaria'), '2' => translateFN('Espana'), '3' => translateFN('Islanda'), '4' => translateFN('Italia'), '5' => translateFN('Romania'));
     $country = FormElementCreator::addSelect('country', 'nazione', $countryAr, $form_dataAr, $errorsAr, 'onchange:CreateProvince()', true);
     $form->addChild($country);
     $provinceAr = array(translateFN('Scegli una provincia'));
     $Province = FormElementCreator::addSelect('Province', 'provincia', $provinceAr, $form_dataAr, $errorsAr, '', true);
     $form->addChild($Province);
     $city = FormElementCreator::addTextInput('city', 'città', $form_dataAr, $errorsAr, '', true);
     $form->addChild($city);
     $address = FormElementCreator::addTextInput('address', 'indirizzo', $form_dataAr, $errorsAr, '', true);
     $form->addChild($address);
     $locationAr = array('0' => translateFN("Scegli un luogo"), '1' => translateFN('from home'), '2' => translateFN('eg-kiosk'), '3' => translateFN('eg-station'));
     $location = FormElementCreator::addSelect('location', 'preferenze di accesso', $locationAr, $form_dataAr, $errorsAr);
     $form->addChild($location);
     $fiscal_code = FormElementCreator::addTextInput('fiscal_code', 'codice fiscale', $form_dataAr, $errorsAr);
     $form->addChild($fiscal_code);
     /*
        $buttons = CDOMElement::create('div');
         $submit_button_text = translateFN('Invia');
         $buttons->addChild(CDOMElement::create('submit',"id:submit,name:submit, value:$submit_button_text"));
         $buttons->addChild(CDOMElement::create('reset'));
         $form->addChild($buttons);
     */
     $buttons = FormElementCreator::addSubmitAndResetButtons();
     $form->addChild($buttons);
     $div = CDOMElement::create('div');
     $div->addChild(new Ctext(translateFN("If not yet registered, please insert yout personal data and click on 'Submit'")));
     $div->addChild($form);
     $div->addChild(new Ctext(translateFN("By clicking Submit, you confirm that you have read the following User Agreements, that you\nunderstand them and that you agree to be bound by them.")));
     $privacy_linkObj = CDOMElement::create('a', 'href:' . HTTP_ROOT_DIR . '/privacy.php?lan=' . $_SESSION['sess_user_language']);
     $privacy_linkObj->setAttribute('target', '_blank');
     $privacy_linkObj->addChild(new CText(translateFN("Read the User Agreements")));
     $privacy_link = $privacy_linkObj->getHtml();
     $div->addChild($privacy_linkObj);
     return $div;
 }
Exemplo n.º 3
0
 private static function getEditUserForm($action, $user_dataAr = array(), $errorsAr = array())
 {
     $form = CDOMElement::create('form', 'id:user_form, name:user_form, class:fec, method:post');
     $form->setAttribute('action', $action);
     if (is_array($errorsAr) && isset($errorsAr['registration_error'])) {
         switch ($errorsAr['registration_error']) {
             case ADA_ADD_USER_ERROR:
             case ADA_ADD_USER_ERROR_TESTER:
                 $error_message = translateFN("Si è verificato un errore nell'aggiunta dell'utente");
                 break;
             case ADA_ADD_USER_ERROR_USER_EXISTS:
             case ADA_ADD_USER_ERROR_USER_EXISTS_TESTER:
                 $error_message = translateFN("Esiste già un utente con la stessa email dell'utente che si sta cercando di aggiungere");
                 break;
             case ADA_ADD_USER_ERROR_TESTER_ASSOCIATION:
                 $error_message = translateFN("Si è verificato un errore durante l'associazione dell'utente al tester selezionato");
                 break;
         }
         $error_div = CDOMElement::create('div', 'class:error');
         $error_div->addChild(new CText($error_message));
         $form->addChild($error_div);
     }
     if (is_array($user_dataAr) && isset($user_dataAr['user_id'])) {
         $user_id = CDOMElement::create('hidden', 'id:user_id, name:user_id');
         $user_id->setAttribute('value', $user_dataAr['user_id']);
         $form->addChild($user_id);
     }
     $user_type = CDOMElement::create('hidden', 'id:user_type, name:user_type');
     $user_type->setAttribute('value', $user_dataAr['user_type']);
     $form->addChild($user_type);
     $user_firstname = FormElementCreator::addTextInput('user_firstname', 'Nome', $user_dataAr, $errorsAr, '', true);
     $form->addChild($user_firstname);
     $user_lastname = FormElementCreator::addTextInput('user_lastname', 'Cognome', $user_dataAr, $errorsAr, '', true);
     $form->addChild($user_lastname);
     $user_email = FormElementCreator::addTextInput('user_email', 'E-mail', $user_dataAr, $errorsAr, '', true);
     $form->addChild($user_email);
     //    $user_username = FormElementCreator::addTextInput('user_username','Username (min. 8 caratteri)',$user_dataAr, $errorsAr);
     //    $form->addChild($user_username);
     $user_password = FormElementCreator::addPasswordInput('user_password', 'Password (min. 8 caratteri)', $errorsAr);
     $form->addChild($user_password);
     $user_passwordcheck = FormElementCreator::addPasswordInput('user_passwordcheck', 'Ripeti password', $errorsAr);
     $form->addChild($user_passwordcheck);
     if ($user_dataAr['user_type'] == AMA_TYPE_TUTOR || $user_dataAr['user_type'] == AMA_TYPE_SWITCHER) {
         $user_profile = FormElementCreator::addTextArea('user_profile', 'Profilo', $user_dataAr, $errorsAr);
         $form->addChild($user_profile);
     }
     //    $layoutsAr = Layout::getLayouts();
     //    $user_layout = FormElementCreator::addSelect('user_layout', 'Layout', $layoutsAr, $user_dataAr);
     //    $form->addChild($user_layout);
     $user_address = FormElementCreator::addTextInput('user_address', 'Indirizzo', $user_dataAr, $errorsAr);
     $form->addChild($user_address);
     $user_city = FormElementCreator::addTextInput('user_city', 'Città', $user_dataAr, $errorsAr);
     $form->addChild($user_city);
     $user_province = FormElementCreator::addTextInput('user_province', 'Provincia', $user_dataAr, $errorsAr);
     $form->addChild($user_province);
     $user_country = FormElementCreator::addTextInput('user_country', 'Nazione', $user_dataAr, $errorsAr);
     $form->addChild($user_country);
     $user_fiscal_code = FormElementCreator::addTextInput('user_fiscal_code', 'Codice Fiscale', $user_dataAr, $errorsAr);
     $form->addChild($user_fiscal_code);
     $user_age = FormElementCreator::addTextInput('user_age', 'Età', $user_dataAr, $errorsAr);
     $form->addChild($user_age);
     $sexAr = array('M' => 'M', 'F' => 'F');
     $user_sex = FormElementCreator::addSelect('user_sex', 'Sesso', $sexAr, $user_dataAr);
     $form->addChild($user_sex);
     $user_phone = FormElementCreator::addTextInput('user_phone', 'Telefono', $user_dataAr, $errorsAr);
     $form->addChild($user_phone);
     $buttons = FormElementCreator::addSubmitAndResetButtons();
     $form->addChild($buttons);
     return $form;
 }
Exemplo n.º 4
0
 public static function getFormForNews($form_action, $newsmsg, $file, $type)
 {
     $form = CDOMElement::create('form', 'id:edit_news, name:edit_news, method:post');
     $form->setAttribute('action', $form_action);
     $newsEditText = FormElementCreator::addTextArea($type, $type, $newsmsg);
     $form->addChild($newsEditText);
     $file_edit = CDOMElement::create('hidden', 'id:file_edit, name:file_edit');
     $file_edit->setAttribute('value', $file);
     $form->addChild($file_edit);
     $reqTypeForm = CDOMElement::create('hidden', 'id:reqType, name:type');
     $reqTypeForm->setAttribute('value', $type);
     $form->addChild($reqTypeForm);
     $buttons = FormElementCreator::addSubmitAndResetButtons();
     $form->addChild($buttons);
     return $form;
 }