Пример #1
0
             * is made available. Every time there is an update in the course instance
             * duration, this chatroom needs to be updated too.
             */
            $id_instance = $courseInstanceId;
            /*
             *                $start_time = $start_date;
                           $end_time = $dh->add_number_of_days($_POST['durata'],$start_time);
            //               $end_time   = $course_instance_data_before_update['data_fine'];
            */
            $id_chatroom = ChatRoom::get_class_chatroom_for_instance($id_instance, 'C');
            if (!AMA_DataHandler::isError($id_chatroom)) {
                /*
                 * An existing chatroom with id class and type = C (chat classroom)
                 * already exists, so update this chatroom owner (= tutor id).
                 */
                $chatroomObj = new Chatroom($id_chatroom);
                $chatroom_data['id_chat_owner'] = $id_tutor_new;
                $result = $chatroomObj->set_chatroomFN($chatroomObj->id_chatroom, $chatroom_data);
                if (AMA_DataHandler::isError($result)) {
                    // gestire l'errore
                }
            }
        }
    }
    header('Location: list_instances.php?id_course=' . $courseId);
    exit;
} else {
    if ($courseInstanceObj instanceof Course_instance && $courseInstanceObj->isFull()) {
        $result = $dh->course_instance_tutor_get($courseInstanceObj->getId());
        if (AMA_DataHandler::isError($result)) {
            // FIXME: verificare che si venga redirezionati alla home page del'utente
Пример #2
0
     case 'Pubblica':
         $chatroom_ha['chat_type'] = PUBLIC_CHAT;
         break;
     default:
 }
 // switch
 $chatroom_ha['id_chat_owner'] = $id_chat_owner;
 $chatroom_ha['chat_title'] = $_POST['chat_title'];
 $chatroom_ha['chat_topic'] = $_POST['chat_topic'];
 $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);
Пример #3
0
require_once 'include/ChatDataHandler.inc.php';
$help = translateFN("Da qui l'utente puo' vedere la lista di tutte le chatrooms a cui puo' accedere.");
$status = '';
//translateFN('lista delle chatrooms');
$modulo = translateFN('lista delle chatrooms');
// including the banner
$chat_label = translateFN('entra');
$edit_label = translateFN('modifica');
$delete_label = translateFN('cancella');
$add_users_label = translateFN('aggiungi utenti');
switch ($id_profile) {
    // ADMINISTRATOR
    case AMA_TYPE_ADMIN:
    case AMA_TYPE_SWITCHER:
        // gets an array with all the chatrooms
        $all_chatrooms_ar = Chatroom::get_all_chatroomsFN();
        if (!AMA_DB::isError($all_chatrooms_ar)) {
            //initialize an array
            $list_chatrooms = array();
            // sort the chatrooms in reverse order, so we can visualize first the most recent chatrooms
            rsort($all_chatrooms_ar);
            $tbody_data = array();
            foreach ($all_chatrooms_ar as $id_chatroom) {
                //initialize a chatroom Object
                $chatroomObj = new ChatRoom($id_chatroom);
                //get the array with all the current info of the chatoorm
                $chatroom_ha = $chatroomObj->get_info_chatroomFN($id_chatroom);
                $id_course_instance = $chatroom_ha['id_istanza_corso'];
                $id_course = $dh->get_course_id_for_course_instance($chatroom_ha['id_istanza_corso']);
                $courseObj = read_course($id_course);
                if (is_object($courseObj) && !AMA_DB::isError($courseObj)) {
Пример #4
0
 public function cancel($hostUserId, $appointmentId)
 {
     if ($this->haveMissingUser($hostUserId)) {
         throw new Cv\Exceptions\MissingModelException();
     }
     $appointment = Chatroom::findOrDie($appointmentId);
     if (is_null($appointment)) {
         throw new Cv\Exceptions\MissingModelException();
     }
     // I don't know cancel processes
 }
Пример #5
0
        }
    }
    public function sendMessage($from, $to, $message)
    {
        if (array_key_exists($to, $this->users)) {
            //Collegueのメソッドは、Mediator側で呼び出す。
            $this->users[$to]->receiveMessage($from, $message);
        } else {
            printf('<font color="#dd0000">%sさんは入室していないようです</font><hr>', $to);
        }
    }
}
/*
 * Client 
 */
$chatroom = new Chatroom();
$sasaki = new User('佐々木');
$suzuki = new User('鈴木');
$yoshida = new User('吉田');
$kawamura = new User('川村');
$tajima = new User('田島');
$chatroom->login($sasaki);
$chatroom->login($suzuki);
$chatroom->login($yoshida);
$chatroom->login($kawamura);
$chatroom->login($tajima);
$sasaki->sendMessage('鈴木', '来週の予定は?');
$suzuki->sendMessage('川村', '秘密です');
$yoshida->sendMessage('萩原', '元気ですか?');
$tajima->sendMessage('佐々木', 'お邪魔してます');
$kawamura->sendMessage('吉田', '私事で恐縮ですが…');
Пример #6
0
 public function sendMessage($message)
 {
     Chatroom::showMessage($this, $message);
 }