public function indexAction() { $calculationInProgress = Status::isCalculationInProgress(); $elements = array(); $user = Session::get('user'); // Check for currently ongoing calculation if ($calculationInProgress) { $alert = Bootstrap::alert('<img src="' . Url::link('img/alert.png') . '" /> Data calculation is in progress! Reports might be slower then usual! Status: ' . Status::getCalculationStatus())->color('warning')->dismissable(); $elements[] = $alert; } $title = Bootstrap::h(1, 'Welcome ' . ($this->getUser('first_name') === null ? $this->getUser('username') : $this->getUser('first_name')))->secondaryText('Your timezone is <a href="' . Url::href('profile') . '">' . $user['timezone'] . '</a>, ' . Timezone::date($user['timezone'], 'M dS, H:i:s')); $elements[] = Bootstrap::row()->add(12, $title); // last reports row $row = Bootstrap::row(); $minutes = 15; $panel = Bootstrap::panel("Reports per minute in last {$minutes} minutes", new Chart\RequestsPerSecond($minutes))->color('blue'); $row->add(4, $panel); $panel = Bootstrap::panel("Problematic apps in last {$minutes} minutes", new Chart\ProblematicApps($minutes))->color('blue'); $row->add(4, $panel); $panel = Bootstrap::panel("Problematic brands in last {$minutes} minutes", new Chart\ProblematicBrands($minutes))->color('blue'); $row->add(4, $panel); $elements[] = $row; // quick reports $row = Bootstrap::row(); // quick links $listGroup = Bootstrap::listGroup(); foreach (Menu::getReportLinks() as $url => $text) { $listGroup->addLink($url, $text); } $row->add(4, Bootstrap::panel('Quick links', $listGroup)); // countries $panel = Bootstrap::panel("Reports from countries in last {$minutes} minutes", new Chart\ProblematicCountries($minutes))->color('blue'); $row->add(4, $panel); // OS versions $panel = Bootstrap::panel("OS and version in last {$minutes} minutes", new Chart\ProblematicOsVersions($minutes))->color('blue'); $row->add(4, $panel); $elements[] = $row; $dashboardDaysCacheKey = "DashboardDays-last-10-days-offset-0min"; if (!$calculationInProgress || Cache::has($dashboardDaysCacheKey)) { // dahsboard last 10 days $row = Bootstrap::row(); $row->add(12, Bootstrap::panel('Number of crash reports in last 10 days', new Chart\DashboardDays(10))->color('blue')); $elements[] = $row; } return View::create('base')->with('title', 'Dashboard')->with('content', $elements); }
/** * Show the page with user edit form */ public function editUserAction() { $id = (int) Url::getVar(2); $user = User::fetchOne($id); if ($user === false) { Application::throwError(404, "Can not find user"); } $title = "Edit user {$user->username}"; $elements = array(\Bootstrap::h(1, $title), \Bootstrap::panel("User #{$id}", $this->getUserForm($user->getData()))->color('blue')); if ($user->last_login !== null) { $info = \Bootstrap::alert('User logged in last time at ' . Misc::userDate('Y-m-d H:i:s', $user->last_login) . " from {$user->last_login_ip}")->color('info'); $elements[] = $info; } $content[] = Bootstrap::row()->add(8, $elements, 2); return View::create('base')->with('title', $title)->with('content', $content); }
$currentQueue = Sustainer::get_queue(); $i = 0; echo "<h3>Current queue:</h3>"; if (!is_null($currentQueue)) { if (array_key_exists('id', $currentQueue)) { $currentQueueTemp = array(0 => $currentQueue); $currentQueue = $currentQueueTemp; } echo "<table class=\"table table-striped table-bordered\">\r\n\t\t<thead>\r\n\t\t<tr>\r\n\t\t<th></th>\r\n\t\t<th>Title</th>\r\n\t\t<th>Artist</th>\r\n\t\t<th>Album</th>\r\n\t\t</tr>\r\n\t\t</thead>\r\n\t\t<tbody>"; foreach ($currentQueue as $row) { $i++; echo "<tr>\r\n\t\t\t<td>" . $i . "</td>\r\n\t\t<td>" . $row['title'] . "</td>\r\n\t\t<td>" . $row['artist'] . "</td>\r\n\t\t<td>" . $row['album'] . "</td>\r\n\t\t</tr>"; } echo "</tbody>\r\n\t\t</table>"; } else { Bootstrap::alert("warning", "<b>Warning: </b>The current queue is empty", "", false); } echo "<h3>Schedule audio:</h3>"; echo "<p>You can use this tool to schedule the next audio track to be played on Sue by using its audio id.</p>"; echo "<form action=\"\" method=\"post\">"; echo "Track ID: <input type=\"text\" name=\"trackid\" /><input type=\"submit\" name=\"submit\" value=\"Schedule\" />"; echo "</form>"; $currentLog = Sustainer::get_log(); $i = 0; echo "<h3>Scheduler log:</h3>"; echo "<table class=\"table table-striped table-bordered\">\r\n\t<thead>\r\n\t<tr>\r\n\t<th>Date</th>\r\n\t<th>Title</th>\r\n\t<th>Artist</th>\r\n\t<th>Scheduled By</th>\r\n\t</tr>\r\n\t</thead>\r\n\t<tbody>"; foreach ($currentLog as $row) { $i++; echo "<tr>\r\n\t\t<td>" . date('d/m/y H:i', $row['timestamp']) . "</td>\r\n\t<td>" . $row['title'] . "</td>\r\n\t<td>" . $row['artist'] . "</td>\r\n\t<td>" . $row['username'] . "</td>\r\n\t</tr>"; } echo "</tbody>\r\n\t</table>";
$track->save(); echo Bootstrap::alert("success", "The track " . $track->get_title() . " by " . $track->get_artists_str() . " has been censored.", "Track censored!"); } else { trigger_error("The track you are trying to censor doesn't exist!"); } } } if (isset($_REQUEST["uncensor"]) && is_numeric($_REQUEST["uncensor"])) { if (!Session::is_group_user("Censor")) { trigger_error("You are trying to uncensor a track, but you do not have the required privileges!"); } else { $track = Tracks::get_by_id($_REQUEST["uncensor"]); if ($track) { $track->set_censored(false); $track->save(); echo Bootstrap::alert("success", "The track " . $track->get_title() . " by " . $track->get_artists_str() . " has been uncensored.", "Track uncensored!"); } else { trigger_error("The track you are trying to uncensor doesn't exist!"); } } } if (isset($_REQUEST["unflag"]) && is_numeric($_REQUEST["unflag"])) { if (!Session::is_group_user("Censor")) { echo Bootstrap::alert_message_basic("error", "You are trying to unflag a track, but you do not have the required privileges!", "Error!"); } else { $track = Tracks::get_by_id($_REQUEST["unflag"]); if ($track) { $track->set_flagged(false); $track->save(); echo Bootstrap::alert_message_basic("success", "The track " . $track->get_title() . " by " . $track->get_artists_str() . " has been unflagged.", "Track unflagged!"); } else {