R::trash($collapsed); $jsonResponse->message = 'Expanded lane ' . $lane->name; } else { $collapsed = R::dispense('collapsed'); $collapsed->userId = $user->id; $collapsed->laneId = $laneId; R::store($collapsed); $jsonResponse->message = 'Collapsed lane ' . $lane->name; } $jsonResponse->addBeans(getBoards()); } $app->response->setBody($jsonResponse->asJson()); })->conditions(['laneId' => '\\d+']); // Numbers only. $app->post('/boards/:boardId/toggleActive', function ($boardId) use($app, $jsonResponse) { if (validateToken()) { $user = getUser(); if ($user->isAdmin) { $board = R::load('board', $boardId); $before = $board->export(); $board->active = !$board->active; R::store($board); $state = $board->active ? 'active' : 'inactive'; $jsonResponse->message = 'Set board ' . $board->name . ' ' . $state; $jsonResponse->addBeans(getBoards()); logAction($user->username . ' changed active status of board ' . $board->name, $before, $board->export()); } } $app->response->setBody($jsonResponse->asJson()); })->conditions(['boardId' => '\\d+']); // Numbers only.
case 'getOnlineUsers': //--- Check RayChatMessages table and drop autoincrement if it is possible. ---// $rResult = getResult("SELECT `ID` FROM `" . MODULE_DB_PREFIX . "CurrentUsers`"); if (mysql_num_rows($rResult) == 0) { getResult("TRUNCATE TABLE `" . MODULE_DB_PREFIX . "CurrentUsers`"); } //--- Update user's info and return info about all online users. ---// $sContents = refreshUsersInfo($sId); break; case 'update': $sContents = ""; //--- update user's info ---// $sContents .= refreshUsersInfo($sId, 'update'); //--- check for new rooms ---// $sContents .= makeGroup(getBoards('update', $sId), "boards"); $sContents .= makeGroup(getBoards('updateUsers', $sId), "boardsUsers"); break; /** * Transmit new Scene file from specified Board. * param - boardId * param - width * param - height * param - data */ /** * Transmit new Scene file from specified Board. * param - boardId * param - width * param - height * param - data */
get_header(); ?> <div class="row scrumBoardContainer" > <div class="col-lg-2 manageCol"> <div class="btn btn-success col-lg-12 text-left doAddNewBoard"> <span class="glyphicon glyphicon-plus"></span> Create New Board</div> <?php $boards = getBoards(); foreach ($boards as $v) { //print_r($v); ?> <div class="panel-group boardManagers" boardId="<?php echo $v->term_id; ?> " > <div class="panel panel-default" id="panel1"> <div class="panel-heading"> <h4 class="panel-title"><?php echo $v->name; ?> </h4> </div>
R::store($user); addUserToBoard($data->defaultBoard, $user); foreach ($data->boardAccess as $board) { addUserToBoard($board, $user); } logAction($actor->username . ' updated user ' . $user->username, $before, $user->export()); $jsonResponse->addAlert('success', 'User updated.'); } $jsonResponse->addBeans(getUsers()); $jsonResponse->boards = R::exportAll(getBoards()); } $app->response->setBody($jsonResponse->asJson()); }); // Remove a user. $app->post('/users/remove', function () use($app, $jsonResponse) { $data = json_decode($app->environment['slim.input']); if (validateToken(true)) { $user = R::load('user', $data->userId); $actor = getUser(); if ($user->id == $data->userId && $actor->isAdmin) { $before = $user->export(); R::trash($user); R::exec('DELETE from board_user WHERE user_id = ?', [$data->userId]); logAction($actor->username . ' removed user ' . $before['username'], $before, null); $jsonResponse->addAlert('success', 'Removed user ' . $user->username . '.'); } $jsonResponse->addBeans(getUsers()); $jsonResponse->boards = R::exportAll(getBoards()); } $app->response->setBody($jsonResponse->asJson()); });