예제 #1
0
 $chatroom_ha['welcome_msg'] = $_POST['welcome_msg'];
 $chatroom_ha['max_users'] = $_POST['max_users'];
 $chatroom_ha['start_time'] = $start_data;
 $chatroom_ha['end_time'] = $end_data;
 $chatroom_ha['id_course_instance'] = $_POST['id_course_instance'];
 // add chatroom_ha to the database
 $chatroom = Chatroom::add_chatroomFN($chatroom_ha);
 if (!is_object($chatroom)) {
     // the chatroom id
     $id_chatroom = $chatroom;
     //Initialize a new chatroom object
     $chatroomObj = new ChatRoom($id_chatroom);
     // the link to the chatroom
     $chatroom_link = "../comunica/ada_chat.php?id_chatroom={$id_chatroom}";
     // invites him self into the chatroom
     $add_himself = $chatroomObj->add_user_chatroomFN($sess_id_user, $sess_id_user, $id_chatroom, ACTION_INVITE, STATUS_INVITED);
     // message display
     $err_msg = translateFN("<b>La chatroom e' stata creata con successo!</b>");
     // construct link for edit the chat if needed
     $form_data = array(array('label' => 'Titolo *', 'type' => 'text', 'value' => stripslashes($_POST['chat_title']), 'name' => 'chat_title', 'size' => '85', 'maxlenght' => '120'), array('label' => 'Argomento *', 'type' => 'text', 'name' => 'chat_topic', 'value' => stripslashes($_POST['chat_topic']), 'size' => '85', 'maxlength' => '120'), array('label' => 'Messaggio di benvenuto', 'type' => 'textarea', 'name' => 'welcome_msg', 'value' => stripslashes($_POST['welcome_msg']), 'rows' => '1', 'cols' => '63', 'wrap' => 'physical'), array('label' => 'Proprietario *', 'type' => 'text', 'name' => 'chat_owner', 'value' => $_POST['chat_owner'], 'size' => '20', 'maxlength' => '20'), array('label' => 'Tipo *', 'type' => 'select', 'name' => 'chat_type', 'value' => $options_of_chat_types), array('label' => 'Numero utenti', 'type' => 'text', 'name' => 'max_users', 'value' => $_POST['max_users'], 'size' => '3', 'maxlength' => '3'), array('label' => 'Giorno di apertura<br>(gg/mm/aa)', 'type' => 'text', 'name' => 'start_day', 'value' => $start_day, 'size' => '8', 'maxlength' => '8'), array('label' => 'Ora di avvio<br>(oo:mm:ss)', 'type' => 'text', 'value' => $start_time, 'name' => 'start_time', 'size' => '8', 'maxlength' => '8'), array('label' => 'Giorno di chiusura<br>(gg/mm/aa)', 'type' => 'text', 'value' => $_POST['end_day'], 'name' => 'end_day', 'size' => '8', 'maxlength' => '8'), array('label' => 'Ora di termine<br>(oo:mm:ss)', 'type' => 'text', 'value' => $_POST['end_time'], 'name' => 'end_time', 'size' => '8', 'maxlength' => '8'), array('label' => 'Classe ID', 'type' => 'text', 'value' => $id_course_instance, 'name' => 'id_course_instance', 'value' => $_POST['id_course_instance'], 'size' => '11', 'maxlength' => '11'), array('label' => '', 'type' => 'submit', 'name' => 'invia', 'value' => 'Invia'), array('type' => 'reset', 'name' => 'reset', 'value' => 'Reset'));
     $f->initForm("../comunica/create_chat.php", "POST", "", "create_chat_form");
     $f->setForm($form_data);
     $form = $f->getForm();
 } else {
     $errorObj = $chatroom->message;
     if ($errorObj == "errore: record gi�esistente") {
         $err_msg = translateFN("<b>Errore.Una chatroom con questo titolo, tipo, classe ID e tempo di avvio e' gia' esistente! Inserirne di nuovi.</b>");
         $form_data = array(array('label' => 'Titolo *', 'type' => 'text', 'value' => stripslashes($_POST['chat_title']), 'name' => 'chat_title', 'size' => '85', 'maxlenght' => '120'), array('label' => 'Argomento *', 'type' => 'text', 'name' => 'chat_topic', 'value' => stripslashes($_POST['chat_topic']), 'size' => '85', 'maxlength' => '120'), array('label' => 'Messaggio di benvenuto', 'type' => 'textarea', 'name' => 'welcome_msg', 'value' => stripslashes($_POST['welcome_msg']), 'rows' => '1', 'cols' => '63', 'wrap' => 'physical'), array('label' => 'Proprietario *', 'type' => 'text', 'name' => 'chat_owner', 'value' => $_POST['chat_owner'], 'size' => '20', 'maxlength' => '20'), array('label' => 'Tipo *', 'type' => 'select', 'name' => 'chat_type', 'value' => $options_of_chat_types), array('label' => 'Numero utenti', 'type' => 'text', 'name' => 'max_users', 'value' => $_POST['max_users'], 'size' => '3', 'maxlength' => '3'), array('label' => 'Giorno di apertura<br>(gg/mm/aa)', 'type' => 'text', 'name' => 'start_day', 'value' => $start_day, 'size' => '8', 'maxlength' => '8'), array('label' => 'Ora di avvio<br>(oo:mm:ss)', 'type' => 'text', 'value' => $start_time, 'name' => 'start_time', 'size' => '8', 'maxlength' => '8'), array('label' => 'Giorno di chiusura<br>(gg/mm/aa)', 'type' => 'text', 'value' => $_POST['end_day'], 'name' => 'end_day', 'size' => '8', 'maxlength' => '8'), array('label' => 'Ora di termine<br>(oo:mm:ss)', 'type' => 'text', 'value' => $_POST['end_time'], 'name' => 'end_time', 'size' => '8', 'maxlength' => '8'), array('label' => 'Classe ID', 'type' => 'text', 'value' => $id_course_instance, 'name' => 'id_course_instance', 'value' => $_POST['id_course_instance'], 'size' => '11', 'maxlength' => '11'), array('label' => '', 'type' => 'submit', 'name' => 'invia', 'value' => 'Invia'), array('type' => 'reset', 'name' => 'reset', 'value' => 'Reset'));
         $f->initForm("../comunica/create_chat.php", "POST", "", "create_chat_form");
         $f->setForm($form_data);
         $form = $f->getForm();