public function printHints() { if (!($activities = $this->getGithubActivity())) { return insertNotify("error", "No Github activity could be loaded"); } if (count($activities) > 0) { $html = "<ul>"; foreach ($activities as $activity) { # There are other activity types other than commit, but for now we'll pretend they don't exist. if (isset($activity->repository->owner)) { $friendly_name = "{$activity->repository->owner}/{$activity->repository->name}"; $url_base = "{$activity->repository->url}/commit/"; if (isset($activity->payload->shas)) { foreach ($activity->payload->shas as $commit) { $html .= '<li><a href="' . $url_base . $commit[0] . '" target="_blank">'; $html .= "{$friendly_name}</a> - {$commit[2]}</li>"; } } } } $html .= "</ul>"; return $html; } else { return insertNotify("error", "No Github activity could be found and/or loaded"); } }
public function printHints() { if (!($activities = $this->getGithubActivity())) { return insertNotify("error", "No Github activity could be loaded"); } if (count($activities) > 0) { $html = "<ul>"; foreach ($activities as $activity) { # There are other activity types other than commit, but for now we'll pretend they don't exist. # This block handles direct requests to github.com/username.json if (isset($activity->repository->owner)) { $friendly_name = "{$activity->repository->owner}/{$activity->repository->name}"; $url_base = "{$activity->repository->url}/commit/"; if (isset($activity->payload->shas)) { foreach ($activity->payload->shas as $commit) { $html .= '<li><a href="' . $url_base . $commit[0] . '" target="_blank">'; $html .= "{$friendly_name}</a> - {$commit[2]}</li>"; } } } # This block handles requests via api URL if (isset($activity->org->login)) { $friendly_name = $activity->repo->name; $url_base = "{$this->github_url}/{$activity->repo->name}/commit/"; if (isset($activity->payload->commits)) { foreach ($activity->payload->commits as $commit) { $html .= "<li><a href=\"{$url_base}{$commit->sha}\">"; $html .= "{$friendly_name}</a> - {$commit->message}</li>"; } } } } $html .= "</ul>"; return $html; } else { return insertNotify("error", "No Github activity could be found and/or loaded"); } }
?> /generate_report.php/generate_report.php", { type: 'week', date: '<?php echo $time_requested; ?> ' }).done(function(data) { $('#oncall-stats').html(data); }); </script> <?php } ?> <h2>Weekly Updates</h2> <?php if (!($updates = getGenericWeeklyReportsForWeek($start_ts, $end_ts))) { echo insertNotify("error", "No Weekly Updates have been entered yet this week"); } else { foreach ($updates as $update) { echo formatWeeklyReportForPrint($update); } } ?> <h2>Fin</h2> <p>You have reached the end of the meeting report! </p> <button class="btn btn-primary" onClick="$('#weekly-notes').submit()">Save Meeting Notes</button> <a class="btn btn-success" href="<?php echo $ROOT_URL; ?> /index.php"><i class="icon-white icon-home"></i> Home</a> <br />
data: time_data, domain : "month", start: new Date(<?php echo date("U", strtotime("-1 year")); ?> *1000), subDomain : "day", range : 13, itemName: ["notification", "notifications"], domainGutter: 2 }); </script> <br /> <?php } } else { echo insertNotify("error", "Nothing was found for that search. If you believe this is in error, you may be right. Complain to the developer. "); } } ?> </div> </div> <?php include_once 'phplib/footer.php'; ?> </body> </html>
static function connect() { global $mysql_host, $mysql_user, $mysql_pass; $mysql_db = getTeamConfig('database'); if (function_exists("mysqli_connect")) { $mysqli = new mysqli($mysql_host, $mysql_user, $mysql_pass, $mysql_db); if ($mysqli->connect_error) { echo insertNotify("critical", $mysqli->connect_error); return false; } self::$dbh = $mysqli; } else { if (function_exists("mysql_connect")) { if (!($mysql = mysql_connect($mysql_host, $mysql_user, $mysql_pass))) { echo insertNotify("critical", mysql_error()); return false; } if (!mysql_select_db($mysql_db, $mysql)) { echo insertNotify("critical", mysql_error()); return false; } } else { echo "MySQL support is required"; return false; } } return true; }
<div class="container"> <h1>Edit profile <small>for user <?php echo $my_username; ?> </small></h1> <?php if (!($profile = checkForUserProfile($my_username))) { echo insertNotify("info", "Welcome to your profile page! Fill in the data below"); $profile = null; } else { $sleeptracking_settings = json_decode($profile['sleeptracking_settings'], 1); } if (isset($_GET['succ'])) { echo insertNotify("success", "Thanks! Your profile details have been saved. "); } ?> <div class="row"> <div class="span12"> <form method='POST' action='<?php echo $ROOT_URL; ?> /save_profile.php'> <fieldset> <legend>User details</legend> <label>Full Name</label><input type="text" placeholder="Bob Robertson" name="full_name" value="<?php echo $profile['full_name']; ?>
} else { $week_action_pct = 0; $week_noaction_pct = 0; } $tag_pct_graph_data[] = array(date("j M y", $week['range_start']), $week_action_pct, $week_noaction_pct); $user_tag_graph_data[] = array(date("j M y", $week['range_start']) . " {$n['contact']}", $week_tag_summary["action"], $week_tag_summary["noaction"]); } // Collect up the per day totals into the graph array ksort($per_day_total); foreach ($per_day_total as $d => $c) { // This seems a bit bizarre but there's no way to convert a DoW number to name? I could hardcode but // what if people want it in their own locale? // For yearly this is also average per day so it's divided by the number of weeks. $per_day_graph_data[] = array(date('l', strtotime("Sunday +{$d} days")), $c / $num_weeks); } // Create the array for the alert types per user bar graph $user_graph_data[] = array("Person", "Action Taken", "No Action Taken"); foreach ($year_user_tag_agg as $alert_user => $alert_tags) { $user_graph_data[] = array($alert_user, $alert_tags["action"] / $num_weeks, $alert_tags["noaction"] / $num_weeks); } $week_avg = round($year_total_notifications / $num_weeks, 2); // Data ahoy, time to render. require_once 'year_report.php'; } else { // If there wasn't more than 2 weeks, we're down here: if ($num_weeks > 2) echo insertNotify("error", "There is not enough data to generate this report yet! You must have at least two weeks of data."); } } else { // Just in case the report type is something weird. insertNotify("error", "You want WHAT type of report?! I have no idea what {$report_type} is."); }
', function() { $('#on-call-question').fadeOut('fast') });">I was on call</button> </div> <div class="notifications" id="notifications"></div> <p></p><br /> <?php } ?> <h2>Regular update</h2> <div class="row"> <div class="span7"> <?php if (isset($_GET['weekly_succ'])) { echo insertNotify("success", "Your weekly update has been saved successfully"); } elseif (isset($_GET['weekly_succ_email'])) { echo insertNotify("success", "Your weekly update has been saved and emailed successfully"); } if ($results = checkForPreviousWeeklyUpdate(generateWeeklyReportID($my_username, $start_ts, $end_ts))) { # Previous report was found $previous_report = $results['report']; } else { $previous_report = null; } ?> <form action="add_generic_weekly.php" method="POST"> <textarea class="textarea span7" name="weeklyupdate" placeholder="Enter Update" style="height: 500px"><?php echo $previous_report; ?> </textarea> <script> $('.textarea').wysihtml5({"image": false, "color": false});
<?php include_once "phplib/base.php"; $my_username = getUsername(); $page_title = getTeamName() . " Weekly Updates - Your profile"; include_once 'phplib/header.php'; include_once 'phplib/nav.php'; ?> <div class="container"> <?php if (!($profile = checkForUserProfile($my_username))) { echo insertNotify("info", "Welcome to your profile page! Please <a href='{$ROOT_URL}/edit_profile.php'>edit your profile</a>"); $profile = null; } else { $sleeptracking_settings = json_decode($profile['sleeptracking_settings'], 1); } // Welcome the user either with their full name, or their username. if ($profile['full_name'] != "") { list($name, $rest) = explode(" ", $profile['full_name'], 2); } else { $name = $my_username; } echo "<h1>Hello {$name} <small>viewing your profile</small></h1>"; // Count the number of weekly updates for the summary if (!($updates = getGenericWeeklyReportsForUser($my_username))) { $num_weekly = "no"; } else { $num_weekly = count($updates); }
function printWeeklyHints($username, $from, $to) { $wanted_hints = getTeamConfig('weekly_hints'); if (is_array($wanted_hints)) { foreach ($wanted_hints as $provider) { // Load each requested provider and run the printHints() to print the hints $provider_info = getWeeklyHintProvider($provider); if ($provider_info && (require_once $provider_info['lib'])) { $provider_class = new $provider_info['class']($username, $provider_info['options'], $from, $to); echo "<h4>{$provider_info['display_name']}</h4>"; echo $provider_class->printHints(); } else { echo insertNotify("info", "Couldn't load weekly hint provider '{$provider}'! Please check your config."); } } } }
$page_title = getTeamName() . " Weekly Updates - Updates for {$user_requested}"; include_once 'phplib/header.php'; include_once 'phplib/nav.php'; ?> <div class="container"> <h1>All Weekly Updates <small>for user <?php echo $user_requested; ?> </small></h1> <div class="row"> <div class="span9"> <?php $updates = getGenericWeeklyReportsForUser($user_requested); if (!$updates) { echo insertNotify("error", "This user doesn't appear to have any weekly updates!"); } else { foreach ($updates as $update) { $pretty_time = getPrettyTime($update['timestamp']); $ending_date = date("l jS F Y", $update['range_end']); echo "<h3>Week ending {$ending_date} <small>written {$pretty_time}</small></h3>"; echo "<div class='well well-small'><p>{$update['report']}</p></div>"; } } ?> </div> <div class="span3"> <h4>Choose person</h3> <form id="setperson" action="<?php echo $ROOT_URL;
public function printJIRAForPeriod() { // JIRA wants milliseconds instead of seconds since epoch $range_start = $this->events_from * 1000; $range_end = $this->events_to * 1000; $tickets = $this->getJIRAForPeriod($range_start, $range_end); if ($tickets->total > 0) { $html = "<ul>"; foreach ($tickets->issues as $issue) { $html .= '<li><a href="' . $this->jira_url . '/browse/' . $issue->key . '" target="_blank">'; $html .= "{$issue->key}</a> - {$issue->fields->summary} ({$issue->fields->status->name})</li>"; } $html .= "</ul>"; return $html; } else { # No tickets found return insertNotify("error", "No JIRA activity for this period was found"); } }