$chatroom_ha['welcome_msg'] = translateFN('Benvenut* nella chat della tua classe'); $chatroom_ha['max_users'] = 99; $chatroom_ha['start_time'] = $data_inizio_previsto; $chatroom_ha['end_time'] = $data_fine; $chatroom_ha['id_course_instance'] = $id_istanza_corso; // add chatroom_ha to the database $chatroom = Chatroom::add_chatroomFN($chatroom_ha); header('Location: list_instances.php?id_course=' . $_POST['id_course']); exit; } } else { $form = new CText(translateFN('I dati inseriti nel form non sono validi')); } } else { if ($courseObj instanceof Course && $courseObj->isFull()) { $formData = array('id_course' => $courseObj->getId(), 'duration_hours' => $courseObj->getDurationHours(), 'service_level' => $courseObj->getServiceLevel()); $course_title = $courseObj->getTitle(); $form = new CourseInstanceForm(); $form->fillWithArrayData($formData); } else { $form = new CText(translateFN('Corso non trovato')); } } $label = translateFN('Aggiunta di una classe (istanza) del corso:') . ' ' . $course_title; $help = translateFN('Da qui il provider admin può creare una istanza di un corso'); $error_div = CDOMElement::create('DIV', 'id:error_form'); $error_div->setAttribute('class', 'hide_error'); $error_div->addChild(new CText(translateFN("ATTENZIONE: Ci sono degli errori nel modulo!"))); $help .= $error_div->getHtml(); $content_dataAr = array('user_name' => $user_name, 'user_type' => $user_type, 'status' => $status, 'label' => $label, 'help' => $help, 'data' => $form->getHtml(), 'module' => isset($module) ? $module : '', 'messages' => $user_messages->getHtml()); ARE::render($layout_dataAr, $content_dataAr);
exit; } } else { $data = new CText(translateFN('I dati inseriti nel form non sono validi')); } } } } else { if (!$courseObj instanceof Course || !$courseObj->isFull()) { $data = new CText(translateFN('Corso non trovato')); } else { if (!$courseInstanceObj instanceof Course_instance || !$courseInstanceObj->isFull()) { $data = new CText(translateFN('Classe non trovata')); } else { if (is_null($courseInstanceObj->getServiceLevel())) { $courseInstanceObj->service_level = $courseObj->getServiceLevel(); } $formData = array('id_course' => $courseObj->getId(), 'id_course_instance' => $courseInstanceObj->getId(), 'data_inizio_previsto' => $courseInstanceObj->getScheduledStartDate(), 'durata' => $courseInstanceObj->getDuration(), 'started' => $courseInstanceObj->isStarted() ? 1 : 0, 'price' => $courseInstanceObj->getPrice(), 'self_instruction' => $courseInstanceObj->getSelfInstruction() ? 1 : 0, 'self_registration' => $courseInstanceObj->getSelfRegistration() ? 1 : 0, 'title' => $courseInstanceObj->getTitle(), 'duration_subscription' => $courseInstanceObj->getDurationSubscription(), 'start_level_student' => $courseInstanceObj->getStartLevelStudent(), 'open_subscription' => $courseInstanceObj->getOpenSubscription() ? 1 : 0, 'duration_hours' => $courseInstanceObj->getDurationHours(), 'service_level' => $courseInstanceObj->getServiceLevel()); $data = new CourseInstanceForm(); $data->fillWithArrayData($formData); } } } $help = translateFN('Da qui il provider admin può modificare una istanza corso esistente'); $error_div = CDOMElement::create('DIV', 'id:error_form'); $error_div->setAttribute('class', 'hide_error'); $error_div->addChild(new CText(translateFN("ATTENZIONE: Ci sono degli errori nel modulo!"))); $help .= $error_div->getHtml(); $label = translateFN('Modifica istanza corso'); $content_dataAr = array('user_name' => $user_name, 'user_type' => $user_type, 'status' => $status, 'label' => $label, 'help' => $help, 'data' => $data->getHtml(), 'module' => isset($module) ? $module : '', 'messages' => $user_messages->getHtml()); ARE::render($layout_dataAr, $content_dataAr);