From c6850cc05bd603f2bbc5f5f458b3e52d6aafe555 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Wed, 19 Feb 2014 15:37:36 +0100 Subject: [PATCH] Adding delete room see BT#7391 --- .../openmeetings/lib/openmeetings.class.php | 97 ++++++++++++++----- .../openmeetings/lib/openmeetings_gateway.php | 18 ++-- plugin/openmeetings/lib/room.class.php | 33 ++++++- plugin/openmeetings/listing.php | 12 ++- plugin/openmeetings/listing.tpl | 3 +- plugin/openmeetings/start.php | 20 ++-- 6 files changed, 129 insertions(+), 54 deletions(-) diff --git a/plugin/openmeetings/lib/openmeetings.class.php b/plugin/openmeetings/lib/openmeetings.class.php index bf448c4169..7a9d28a15e 100644 --- a/plugin/openmeetings/lib/openmeetings.class.php +++ b/plugin/openmeetings/lib/openmeetings.class.php @@ -54,7 +54,6 @@ class OpenMeetings $this->externalType = substr(api_get_path(WEB_PATH), strpos(api_get_path(WEB_PATH), '://')+3, -1); } $this->externalType = 'chamilolms.'.$this->externalType; - $this->table = \Database::get_main_table('plugin_openmeetings'); if ($om_plugin) { @@ -136,10 +135,24 @@ class OpenMeetings public function createMeeting($params) { global $_configuration; - //$id = \Database::insert($this->table, $params); - // First, try to see if there is an active room for this course and session + // First, try to see if there is an active room for this course and session. $roomId = null; - $meetingData = \Database::select('*', $this->table, array('where' => array('c_id = ?' => $this->chamiloCourseId, ' AND session_id = ? ' => $this->chamiloSessionId)), 'first'); + + $meetingData = \Database::select( + '*', + $this->table, + array( + 'where' => + array( + 'c_id = ?' => $this->chamiloCourseId, + ' AND session_id = ? ' => $this->chamiloSessionId, + ' AND status <> ? ' => 2, + + ) + ), + 'first' + ); + if ($meetingData != false && count($meetingData) > 0) { //error_log(print_r($meetingData,1)); //error_log('Found previous room reference - reusing'); @@ -165,7 +178,7 @@ class OpenMeetings //$room->roomtypes_id = $room->roomtypes_id; $room->comment = urlencode(get_lang('Course').': ' . $params['meeting_name'] . ' - '.$_configuration['software_name']); //$room->numberOfPartizipants = $room->numberOfPartizipants; - $room->ispublic = $room->getString('isPublic','false'); + $room->ispublic = $room->getString('isPublic', 'false'); //$room->appointment = $room->getString('appointment'); //$room->isDemoRoom = $room->getString('isDemoRoom'); //$room->demoTime = $room->demoTime; @@ -210,21 +223,20 @@ class OpenMeetings if (empty($meetingId)) { return false; } - $meetingData = \Database::select('*', $this->table, array('where' => array('id = ? AND status = 1 ' => $meetingId)), 'first'); + $meetingData = \Database::select( + '*', + $this->table, + array('where' => array('id = ? AND status = 1 ' => $meetingId)), + 'first' + ); if (empty($meetingData)) { if ($this->debug) error_log("meeting does not exist: $meetingId "); return false; } - $params = array( 'room_id' => $meetingData['room_id'] ); - - $returnVal = $this->setUserObjectAndGenerateRoomHashByURLAndRecFlag( $params ); - //$urlWithoutProtocol = str_replace("http://", CONFIG_OPENMEETINGS_SERVER_URL); - //$imgWithoutProtocol = str_replace("http://", $_SESSION['_user']['avatar'] ); - - $iframe = $this->url . "/?" . - "secureHash=" . $returnVal; - + $params = array('room_id' => $meetingData['room_id']); + $returnVal = $this->setUserObjectAndGenerateRoomHashByURLAndRecFlag($params); + $iframe = $this->url . "/?" ."secureHash=" . $returnVal; printf("