function phoromatic_webui_right_panel_logged_in($add = null) { $right = null; if ($_SESSION['AdminLevel'] == -40) { $right .= '<h3>Phoromatic Server</h3><hr /><p><strong>' . date('H:i T - j F Y') . '</p>'; } else { if ($_SESSION['AdminLevel'] > 0) { $right .= '<a href="#" onclick="javascript:phoromatic_generate_comparison(\'?result/\');"><div id="phoromatic_result_compare_info_box"></div></a> <a href="#" onclick="javascript:phoromatic_delete_results(\'?results/delete/\'); return false;"><div id="phoromatic_result_delete_box">Delete Selected Results</div></a>'; if (($bad_systems = phoromatic_server::systems_appearing_down()) != false) { $right .= '<ul><li><span class="alert">Systems Needing Attention</span></li>'; foreach ($bad_systems as $system) { $right .= '<li><a href="?systems/' . $system . '">' . phoromatic_server::system_id_to_name($system) . '</a></li>'; } $right .= '</ul><hr />'; } $right .= $add; if ($add == null) { $recently_active_systems = phoromatic_server::recently_active_systems($_SESSION['AccountID']); if (!empty($recently_active_systems)) { $right .= '<ul><li>Recently Active Systems</li>'; foreach ($recently_active_systems as &$row) { $right .= '<li><a href="?systems/' . $row['SystemID'] . '">' . $row['Title'] . '</a></li>'; } $right .= '</ul><hr />'; } $right .= ' <ul> <li>Today\'s Scheduled Events</li>'; $stmt = phoromatic_server::$db->prepare('SELECT Title, ScheduleID, RunAt FROM phoromatic_schedules WHERE AccountID = :account_id AND State >= 1 AND ActiveOn LIKE :active_on ORDER BY RunAt,Title ASC'); $stmt->bindValue(':account_id', $_SESSION['AccountID']); $stmt->bindValue(':active_on', '%' . (date('N') - 1) . '%'); $result = $stmt->execute(); $row = $result->fetchArray(); if ($row == false) { $right .= '</ul><p style="text-align: left; margin: 6px 10px;">No Events Found</p>'; } else { do { $right .= '<li>' . $row['RunAt'] . ' <a href="?schedules/' . $row['ScheduleID'] . '">' . $row['Title'] . '</a></li>'; } while ($row = $result->fetchArray()); $right .= '</ul>'; } } $system_count = phoromatic_account_system_count(); $schedule_count = phoromatic_account_schedule_count(); $stmt = phoromatic_server::$db->prepare('SELECT COUNT(UploadID) AS ResultCount FROM phoromatic_results WHERE AccountID = :account_id'); $stmt->bindValue(':account_id', $_SESSION['AccountID']); $result = $stmt->execute(); $row = $result->fetchArray(); $result_count = $row['ResultCount']; $stmt = phoromatic_server::$db->prepare('SELECT COUNT(ActivityTime) AS ActivityCount FROM phoromatic_activity_stream WHERE AccountID = :account_id AND ActivityTime LIKE :today_date'); $stmt->bindValue(':account_id', $_SESSION['AccountID']); $stmt->bindValue(':today_date', date('Y-m-d') . '%'); $result = $stmt->execute(); $row = $result->fetchArray(); $activity_count = $row['ActivityCount']; $group_name = phoromatic_account_id_to_group_name($_SESSION['AccountID']); if ($group_name != null) { $group_name = '<strong>' . $group_name . '</strong><br />'; } $right .= '<hr /><p><strong>' . date('H:i T - j F Y') . '</strong><br />' . $group_name . '<a href="?systems">' . $system_count . ' System' . ($system_count == 1 ? '' : 's') . '</a><br /><a href="?schedules">' . $schedule_count . ' Schedule' . ($schedule_count == 1 ? '' : 's') . '</a><br /><a href="?results">' . $result_count . ' Result' . ($result_count == 1 ? '' : 's') . '</a>'; $right .= ' <a href="/rss.php?user='******'UserID'] . '&v=' . sha1($_SESSION['CreatedOn']) . '"><img src="images/rss.png" /></a>'; $right .= '<br /><a href="?account_activity">' . $activity_count . ' Activity Events Today</a></p>'; } } return $right; }