Beispiel #1
0
 public function create_Room($title, $Description, $AllowedUsers)
 {
     // TODO for sagar
     // sagar this function should return false on error and return true on successfull creation of a Room
     // And You Should do a Validation for $title to make sure it does not contain invalid characters
     // the only Characters allowd in a room title should be A-Za-z0-9 and a space
     // TODO for sagar
     // we need a similar class method to update the existing room's title, description and members
     $MU = new ManageUsers();
     $MU->userId = $_SESSION['empl_id'];
     // check if user can create New Rooms
     if (!($MU->isAdminUser() || $MU->has_Privilege('Can Create New Rooms'))) {
         return false;
     }
     // Create the room
     $success = execute_sqlInsert('tblRooms', array('roomName' => $title, 'roomDesc' => $Description, 'roomCreatedBy' => $_SESSION['empl_id']));
     $newRoomId = mysql_insert_id();
     // add given users to the created room
     foreach ($AllowedUsers as $this_user) {
         $MU->userId = $this_user;
         $MU->Allow_AccessToRoom($newRoomId);
     }
     return true;
 }