Exemple #1
0
 function createHandler($p)
 {
     $o = new ChatRoom();
     $o->name = trim($p['name']);
     $o->id = $o->store();
     js_redirect('a/chatroom/list');
 }
 public function createChatRoom()
 {
     $valid = Validator::make(Input::all(), array('name' => 'required|max:50|unique:chat_rooms'));
     if ($valid->fails()) {
         return Redirect::route('home')->withErrors($valid)->withInput();
     }
     $chatroom_name = Input::get('name');
     $chat_room_id = ChatRoom::insertGetId(array('name' => $chatroom_name, 'file' => str_random(40)));
     Session::put('message', 'New chatroom has been added successfully');
     return $this->registerChatroom($chat_room_id);
 }
Exemple #3
0
 $message_text = sprintf(translateFN('Provider: "%s".%sService: "%s".%s'), $tester_name, $newline, $service_name, $newline);
 $message_text .= ' ' . sprintf(translateFN("L'appuntamento, di tipo %s,  si terrà il giorno %s alle ore %s."), $new_subject, $date, $time);
 /**
  * In case the user is confirming a videochat or a chat appointment,
  * we will also add a link to enter the chat or videochat directly from the
  * appointment message.
  */
 if (ADA_CHAT_EVENT & $practitioner_proposal['flags'] || ADA_VIDEOCHAT_EVENT & $practitioner_proposal['flags']) {
     if (ADA_CHAT_EVENT & $practitioner_proposal['flags']) {
         $event_flag = ADA_CHAT_EVENT;
         $end_time = $data_ora + $service_infoAr[7];
         //durata_max_incontro
         $chatroom_ha = array('id_course_instance' => $course_instance, 'id_chat_owner' => $practitioner_proposal['id_mittente'], 'chat_title' => ADAEventProposal::addEventToken($event_token, $new_subject), 'chat_topic' => '', 'start_time' => $data_ora, 'end_time' => $end_time);
         require_once 'include/ChatDataHandler.inc.php';
         require_once 'include/ChatRoom.inc.php';
         $id_chatroom = ChatRoom::add_chatroomFN($chatroom_ha, $tester_dsn);
         if (AMA_DataHandler::isError($id_chatroom)) {
             $errObj = new ADA_Error($id_chatroom, translateFN("Si è verificato un errore nella creazione della chatroom. L'appuntamento non è stato creato."), NULL, NULL, NULL, $userObj->getHomePage());
         }
     } else {
         $event_flag = ADA_VIDEOCHAT_EVENT;
     }
     $message_text .= ADAEvent::generateEventMessageAction($event_flag, $id_course, $course_instance);
 }
 $message_ha = array('tipo' => ADA_MSG_AGENDA, 'flags' => ADA_EVENT_CONFIRMED | $event_flag, 'mittente' => $user_uname, 'destinatari' => array($user_uname, $practitioner_proposal['mittente']), 'data_ora' => $data_ora, 'titolo' => ADAEventProposal::addEventToken($event_token, $new_subject), 'testo' => $message_text);
 /*
  * Here we send an email message as an appointment reminder.
  * We send it seprately to the user and to the practitioner, since we do not
  * want the user to know the practitioner's email address.
  */
 $appointment_type = $new_subject;
Exemple #4
0
 * License: http://www.bluethrust.com/license.php
 *
 */
include_once "../../classes/chatroom.php";
if (!isset($member) || !isset($eventObj) || substr($_SERVER['PHP_SELF'], -strlen("manage.php")) != "manage.php") {
    exit;
} else {
    // This is a little repeatative, but for security.
    $memberInfo = $member->get_info();
    $consoleObj->select($cID);
    if (!$member->hasAccess($consoleObj) || !$eventObj->select($eID)) {
        exit;
    }
    $eventInfo = $eventObj->get_info_filtered();
}
if ($eventInfo['member_id'] != $memberInfo['member_id'] && !in_array($memberInfo['member_id'], $eventObj->getInvitedMembers(true))) {
    echo "\n\t\t<script type='text/javascript'>\n\t\t\twindow.location = '" . $MAIN_ROOT . "members';\n\t\t</script>\n\t";
    exit;
}
$eventChatObj = new ChatRoom($mysqli);
$eventChatID = $eventObj->chatRoomStarted();
if ($eventChatID === false && $memberInfo['member_id'] != $eventInfo['member_id']) {
    echo "\n\t\t<div style='display: none' id='successBox'>\n\t\t\t<p align='center'>\n\t\t\t\tAn event chat room has not been created.  The event creator must start one!\n\t\t\t</p>\n\t\t</div>\n\t\t\n\t\t<script type='text/javascript'>\n\t\t\tpopupDialog('Event Chatroom', '" . $MAIN_ROOT . "members/console.php?cID=" . $cID . "&select=" . $eventInfo['event_id'] . "', 'successBox');\n\t\t</script>\n\t";
    exit;
} elseif ($eventChatID === false && $memberInfo['member_id'] == $eventInfo['member_id']) {
    $eventChatObj->addNew(array("event_id", "datestarted"), array($eventInfo['event_id'], time()));
    $eventObj->notifyEventInvites("A chatroom has been started for the event, <a href='" . $MAIN_ROOT . "members/events/manage.php?eID=" . $eventInfo['event_id'] . "&pID=Chat'>" . $eventInfo['title'] . "</a>!");
} elseif ($eventChatObj->select($eventChatID)) {
    $eventChatInfo = $eventChatObj->get_info_filtered();
}
echo "\n\n<script type='text/javascript'>\n\$(document).ready(function() {\n\$('#breadCrumbTitle').html(\"Chat\");\n\$('#breadCrumb').html(\"<a href='" . $MAIN_ROOT . "'>Home</a> > <a href='" . $MAIN_ROOT . "members'>My Account</a> > <a href='" . $MAIN_ROOT . "members/console.php?cID=" . $cID . "&select=" . $eventInfo['event_id'] . "'>" . $consoleTitle . "</a> > <b>" . $eventInfo['title'] . ":</b> Chat\");\n});\n</script>\n\n\n\n<div class='eventChatContainer'>\n\n\t\n\t<div style='position: relative; margin-left: 5px; margin-bottom: 5px'>\n\t\t<div class='main' style='display: table-cell; vertical-align: middle'>Auto-scroll:</div>\n\t\t<div style='display: table-cell; vertical-align: middle'><input type='checkbox'></div>\n\t</div>\n\t\n\t<div style='clear: both'></div>\n\t<div class='eventChatRoom'></div>\n\t\n\t<div class='eventChatList'></div>\n\t<div style='clear: both'></div>\n\t<div class='chatTextBoxContainer'>\n\t\t<div style='float: left; width: 85%'><textarea class='textBox'></textarea></div><div style='float: right; width: 10%'><input type='button' class='submitButton' value='Chat'></div>\n\t\n\t</div>\n\t\n</div>\n\n\n\n<div id='jsDump' style='display: none'></div>\n\n<script type='text/javascript'>\n\n\tfunction updateChat() {\n\t\n\t\t\$(document).ready(function() {\n\t\t\n\t\t\t\$.post('" . $MAIN_ROOT . "members/events/include/updatechat.php', { ecID: '" . $eventChatInfo['eventchat_id'] . "' }, function(data) {\n\t\t\t\n\t\t\t\t\$('#jsDump').html(data);\n\t\t\t\n\t\t\t});\n\t\t\n\t\t});\n\t\n\t}\n\n</script>\n";
Exemple #5
0
     $cr = ChatRoom::get($this->child);
     if ($cr->locked_by) {
         die('hey3');
     }
     $m = new ChatMessage();
     $m->room = $this->child;
     $m->from = $session->id;
     $m->msg = $_GET['m'];
     $m->microtime = microtime(true);
     $m->store();
     $page->setMimeType('text/plain');
     echo 'OK';
     break;
 case 'show':
     // child = room id
     $cr = ChatRoom::get($this->child);
     echo '<h2>Chat in ' . $cr->name . '</h2>';
     if ($cr->locked_by) {
         echo 'The chatroom is locked!';
         return;
     }
     $div_name = 'chatroom_txt';
     $form_id = 'chatfrm';
     ChatRoomUpdater::init($this->child, $div_name, $form_id);
     $css = 'width:500px;' . 'height:300px;' . 'background-color:#eee;' . 'overflow:auto;';
     echo '<div id="' . $div_name . '" style="' . $css . '"></div>';
     $form = new XhtmlForm();
     $form->setId($form_id);
     $form->addInput('msg', $session->username . ':', '', 445);
     $form->setFocus('msg');
     $form->disableAutocomplete();
Exemple #6
0
 // 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);
     $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>");
Exemple #7
0
     if (is_array($class_chatrooms)) {
         $class_chatrooms_ar[] = $class_chatrooms;
     }
     // get only the ids of the chatrooms
     foreach ($class_chatrooms_ar as $value) {
         foreach ($value as $id) {
             $chatrooms_class_ids_ar[] = $id;
         }
     }
     //initialize the array of the chatrooms to be displayed on the screen
     $list_chatrooms = "";
     // start the construction of the table contaning all the chatrooms
     foreach ($chatrooms_class_ids_ar as $id_chatroom) {
         // vito, 16 mar 2009
         if (!is_object($id_chatroom)) {
             $chatroomObj = new ChatRoom($id_chatroom);
             //get the array with all the current info of the chatoorm
             $chatroom_ha = $chatroomObj->get_info_chatroomFN($id_chatroom);
         }
         $list_chatrooms .= "<a href=\"report_chat.php?id_chatroom={$id_chatroom}\">{$chatroom_ha['titolo_chat']}</a><br />";
     }
     $tabled_chat_dataHa = $list_chatrooms;
     break;
 case 'export':
     //file as TXT :
     header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
     // Date in the past
     header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
     // always modified
     header("Cache-Control: no-store, no-cache, must-revalidate");
     // HTTP/1.1
Exemple #8
0
         $id_course = $dh->get_course_id_for_course_instance($id_instance);
         if (AMA_DataHandler::isError($id_course)) {
             // gestire l'errore
         }
         $course_data = $dh->get_course($id_course);
         if (AMA_DataHandler::isError($course_data)) {
             // gestire l'errore
         }
         $id_tutor = $dh->course_instance_tutor_get($id_instance);
         if (!AMA_DataHandler::isError($id_tutor)) {
             $chatroom_ha['id_chat_owner'] = $id_tutor;
         } else {
             $chatroom_ha['id_chat_owner'] = $sess_id_user;
         }
         $chatroom_ha = array('chat_title' => $course_data['titolo'], 'chat_topic' => translateFN('Discussione sui contenuti del corso'), 'start_time' => $start_time, 'end_time' => $end_time, 'max_utenti' => '999', 'id_course_instance' => $id_instance);
         $result = ChatRoom::add_chatroomFN($chatroom_ha);
         if (AMA_DataHandler::isError($result)) {
             // gestire l'errore
         }
     } else {
         // e' un errore, gestire
     }
 } else {
     /*
      * An existing chatroom with duration == class duration
      * already exists, so update this chatroom start and end time.
      */
     $chatroomObj = new Chatroom($id_chatroom, MultiPort::getDSN($_SESSION['sess_selected_tester']));
     $id_tutor = $dh->course_instance_tutor_get($id_instance);
     if (!AMA_DataHandler::isError($id_tutor)) {
         $chatroom_data['id_chat_owner'] = $id_tutor;
        $close_page_message = addslashes(translateFN("You don't have a videochat appointment at this time."));
        $options_Ar = array('onload_func' => "close_page('{$close_page_message}');");
    }
}
if (in_array('chatroom', $thisUserNeededObjAr)) {
    require_once 'ChatRoom.inc.php';
    require_once 'ChatDataHandler.inc.php';
    /*
     * Check if the user has an appointment
     */
    $exit_reason = NO_EXIT_REASON;
    $event_token = '';
    //  if (($id_chatroom = MultiPort::hasThisUserAChatAppointment($userObj)) !== FALSE) {
    //  $chatroomHA = ChatRoom::get_info_chatroomFN($id_chatroom);
    if (!isset($id_chatroom) && isset($_SESSION['sess_id_course_instance'])) {
        $id_chatroom = ChatRoom::get_class_chatroomFN($_SESSION['sess_id_course_instance']);
        if (AMA_DataHandler::isError($id_chatroom)) {
            $id_chatroom = 0;
        }
    } else {
    }
    $chatroomObj = new ChatRoom($id_chatroom, $_SESSION['sess_selected_tester_dsn']);
    if ($chatroomObj->error == 1) {
        $exit_reason = EXIT_REASON_WRONG_ROOM;
    }
    //    $event_token = ADAEventProposal::extractEventToken($chatroomObj->chat_title);
    //  }
    //  else {
    //    $exit_reason = EXIT_REASON_WRONG_ROOM;
    //  }
}
Exemple #10
0
            } 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)');
        }
    }
}
$label = translateFN('Cancellazione chatroom') . ' ' . $chatTitle . ', id: ' . $chatId;
$label .= ' - ' . translateFN('Classe') . ': ' . $classId;
$help = translateFN('Da qui il provider admin può cancellare una chat esistente');
/*
Exemple #11
0
 *
 * Author: Bluethrust Web Development
 * E-mail: support@bluethrust.com
 * Website: http://www.bluethrust.com
 *
 * License: http://www.bluethrust.com/license.php
 *
 */
include "../../../_setup.php";
include_once "../../../classes/member.php";
include_once "../../../classes/rank.php";
include_once "../../../classes/consoleoption.php";
include_once "../../../classes/event.php";
include_once "../../../classes/chatroom.php";
$member = new Member($mysqli);
$member->select($_SESSION['btUsername']);
$objMember = new Member($mysqli);
$eventObj = new Event($mysqli);
$eventChatObj = new ChatRoom($mysqli);
$consoleObj = new ConsoleOption($mysqli);
$cID = $consoleObj->findConsoleIDByName("Manage My Events");
$consoleObj->select($cID);
if ($member->authorizeLogin($_SESSION['btPassword']) && $eventChatObj->select($_POST['ecID'])) {
    $memberInfo = $member->get_info_filtered();
    $eventChatInfo = $eventChatObj->get_info_filtered();
    $eventObj->select($eventChatInfo['event_id']);
    if (in_array($memberInfo['member_id'], $eventObj->getInvitedMembers(true)) || $memberInfo['member_id'] == $eventInfo['member_id']) {
        $eventInfo = $eventObj->get_info_filtered();
        $eventID = $eventInfo['event_id'];
    }
}
Exemple #12
0
        } else {
            // removes user form database
            $user_exits = $chatroomObj->quit_chatroomFN($id_user, $id_user, $id_chatroom);
        }
        // message to display while logging out
        $display_message1 = translateFN("La chatroom cui stai provando ad accedere e' stata terminata!");
        $display_message2 = translateFN("Arrivederci da ADA Chat.");
        break;
    case EXIT_REASON_WRONG_ROOM:
        // message to display while logging out
        $display_message1 = translateFN("La chatroom cui stai provando ad accedere non appartiene alla tua classe oppure non sei invitato!");
        $display_message2 = translateFN("Arrivederci da ADA Chat.");
        break;
    case EXIT_REASON_FULL_ROOM:
        // initialize a new ChatDataHandler object
        $chatroomObj = new ChatRoom($id_chatroom, $_SESSION['sess_selected_tester_dsn']);
        //get the type of the chatroom
        $chatroomHa = $chatroomObj->get_info_chatroomFN($id_chatroom);
        $chat_type = $chatroomHa['tipo_chat'];
        if ($chat_type == INVITATION_CHAT) {
            $user_exits = $chatroomObj->set_user_statusFN($id_user, $id_user, $id_chatroom, ACTION_EXIT);
        } else {
            // removes user form database
            $user_exits = $chatroomObj->quit_chatroomFN($id_user, $id_user, $id_chatroom);
        }
        // message to display while logging out
        $display_message1 = translateFN("La chatroom cui stai provando ad accedere ha raggiunto il massimo numero di utenti che pu� ospitare! Riprova pi� tardi!");
        $display_message2 = translateFN("Arrivederci da ADA Chat.");
        break;
    default:
}
Exemple #13
0
 /** @return null 
  * @param string $name */
 public function rename($name)
 {
     $this->chat->renameRoom($this, $name);
     $this->name = $name;
 }
 /** @param String $roomName 
  * @return boolean */
 public function entersRoom($roomName)
 {
     //COPY:ALL
     return $this->chat->userEntersRoom($this->user->getName(), $roomName);
     //COPY:ALL
 }
Exemple #15
0
$dh = $GLOBALS['dh'];
// display message that explains the functionality of the current script
$help = translateFN("Da qui l'utente puo' creare una nuova chatroom inserendo i valori negli appositi campi.\n\t <br><br>Attenzione!<br>Per il corretto funzionamento della chat e' importante inserire i valori corretti.");
$star = translateFN("I campi contrassegnati con * sono obbligatori, non possono essere lasciati vuoti!");
$status = translateFN("Modifica di una chatroom");
// different chat type options are available for admins and for tutors
if ($id_profile == AMA_TYPE_SWITCHER) {
    $options_of_chat_types = array('Classe' => 'Classe', 'Pubblica' => 'Pubblica');
}
if ($id_profile == AMA_TYPE_TUTOR) {
    $options_of_chat_types = array('Classe' => 'Classe', 'Pubblica' => 'Pubblica');
    //  $options_of_chat_types = array('Privata' => 'Privata');
}
//***********************************
// initialize a new ChatDataHandler object
$chatroomObj = new ChatRoom($id_room);
// chek to see if the chatromm is started, in that case we disable some fields
$chatroom_started = $chatroomObj->is_chatroom_startedFN($id_room);
$id_owner = $chatroomObj->id_chat_owner;
if ($chatroom_started) {
    $readonly = 'readonly';
} else {
    $readonly = 0;
}
// check user type
// owner can edit the chatroom
if ($id_owner == $sess_id_user) {
    $msg = translateFN("Utente abilitato per questa operazione.");
} elseif ($id_profile == AMA_TYPE_SWITCHER) {
    $msg = translateFN("Utente abilitato per questa operazione.");
} elseif ($chatroom_started) {
Exemple #16
0
 }
 // get all the private chatrooms of the user
 $private_chatrooms_ar = ChatRoom::get_all_private_chatroomsFN($sess_id_user);
 if (is_array($private_chatrooms_ar)) {
     $all_chatrooms_ar = array_merge($class_chatrooms_ar, $private_chatrooms_ar);
 } else {
     $all_chatrooms_ar = $class_chatrooms_ar;
 }
 // sort the chatrooms in reverse order, so we can visualize first the most recent chatrooms
 rsort($all_chatrooms_ar);
 //initialize the array of the chatrooms to be displayed on the screen
 $list_chatrooms = array();
 // start the construction of the table contaning all the chatrooms
 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);
     // vito, 16 mar 2009
     $id_course = $dh->get_course_id_for_course_instance($chatroom_ha['id_istanza_corso']);
     // get the owner of the room
     $chat_title = $chatroom_ha['titolo_chat'];
     // get the type of the chatroom
     $c_type = $chatroom_ha['tipo_chat'];
     switch ($c_type) {
         case PUBLIC_CHAT:
             $chat_type = translateFN('pubblica');
             break;
         case CLASS_CHAT:
             $chat_type = translateFN('classe');
             break;
Exemple #17
0
     $result = $dh->course_instance_tutor_subscribe($courseInstanceId, $id_tutor_new);
     if (AMA_DataHandler::isError($result)) {
         $errObj = new ADA_Error($result, translateFN('Errore durante assegnazione del practitioner al client'));
     } else {
         /*
          * For each course instance, a class chatroom with the same duration
          * 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);
Exemple #18
0
 /**
  * get tutor visit for course instance (to count read notes)
  * the method name refers to student, but works ok for a tutor as well
  */
 $visits = $GLOBALS['dh']->get_student_visits_for_course_instance($id_tutor, $course['id_corso'], $course['id_istanza_corso']);
 if (!AMA_DB::isError($visits) && is_array($visits) && count($visits) > 0) {
     foreach ($visits as $visit) {
         if ($visit['tipo'] == ADA_NOTE_TYPE && $visit['id_utente'] != $id_tutor && intval($visit['numero_visite']) > 0) {
             $read_notes_count++;
         }
     }
 }
 /**
  * count class chat messages written by the tutor
  */
 $class_chatrooms = ChatRoom::get_all_class_chatroomsFN($course['id_istanza_corso']);
 if (!AMA_DB::isError($class_chatrooms) && is_array($class_chatrooms) && count($class_chatrooms) > 0) {
     foreach ($class_chatrooms as $aChatRoom) {
         $mh = MessageHandler::instance($_SESSION['sess_selected_tester_dsn']);
         $chat_data = $mh->find_chat_messages($id_tutor, ADA_MSG_CHAT, $aChatRoom[0], '', 'id_mittente=' . $id_tutor);
         if (!AMA_DB::isError($chat_data) && is_array($chat_data) && count($chat_data) > 0) {
             $chatlines_count = count($chat_data);
         }
     }
 }
 /**
  * count files uploaded, for each course
  */
 $courseObj = new Course($course['id_corso']);
 $uploadedFiles = 0;
 if ($courseObj->isFull()) {