Example #1
0
 public static function createTextBasedBurndownChart($bible, $year, $month)
 {
     // Number of days in the month for on the X-axis.
     $time = mktime(0, 0, 0, $month, 15, $year);
     $days_in_month = date("t", $time);
     // Assemble history of this sprint.
     $database_sprint = Database_Sprint::getInstance();
     $history = $database_sprint->getHistory($bible, $year, $month);
     $data = array();
     for ($day = 1; $day <= $days_in_month; $day++) {
         if (Filter_Datetime::isBusinessDay($year, $month, $day)) {
             $data[$day] = "";
             foreach ($history as $item) {
                 if ($day == $item['day']) {
                     $tasks = $item['tasks'];
                     $complete = $item['complete'];
                     $tasks = $tasks * (100 - $complete) / 100;
                     $tasks = intval($tasks);
                     $data[$day] = $tasks;
                 }
             }
         }
     }
     unset($item);
     $lines = array();
     $lines[] = '<table style="text-align:center;">';
     $lines[] = '<tr style="vertical-align: bottom;">';
     foreach ($data as $day => $tasks) {
         $text = str_repeat("▓<br>", intval($tasks));
         $lines[] = "<td>{$text}</td>";
     }
     $lines[] = "</tr>";
     // Write number of days along the x-axis.
     $lines[] = '<tr>';
     foreach ($data as $day => $tasks) {
         $lines[] = "<td style=\"width:1em\">{$day}</td>";
     }
     $lines[] = "</tr>";
     // Write "days" below the x-axis.
     $lines[] = '<tr>';
     $columncount = count($data);
     $text = Locale_Translate::_("days");
     $lines[] = "<td colspan=\"{$columncount}\">{$text}</td>";
     $lines[] = "</tr>";
     $lines[] = "</table>";
     $chart = implode("\n", $lines);
     return $chart;
 }
Example #2
0
 private function assembleContents($identifier, $contents)
 {
     $new_contents = "";
     if (is_numeric($identifier)) {
         $new_contents = $this->getContents($identifier);
     }
     $datetime = new DateTime();
     Filter_Datetime::user_zone($datetime);
     $datetime = $datetime->format(DATE_RSS);
     $session_logic = Session_Logic::getInstance();
     $user = $session_logic->currentUser();
     $new_contents .= "<p>{$user} ({$datetime}):</p>\n";
     if ($contents == "<br>") {
         $contents = "";
     }
     $lines = explode("\n", $contents);
     foreach ($lines as $line) {
         $line = trim($line);
         $new_contents .= "<p>{$line}</p>\n";
     }
     return $new_contents;
 }
Example #3
0
 public function testIsBusinessDay()
 {
     $this->assertFalse(Filter_Datetime::isBusinessDay(2013, 9, 1));
     $this->assertTrue(Filter_Datetime::isBusinessDay(2013, 9, 2));
     $this->assertTrue(Filter_Datetime::isBusinessDay(2013, 9, 3));
     $this->assertTrue(Filter_Datetime::isBusinessDay(2013, 9, 4));
     $this->assertTrue(Filter_Datetime::isBusinessDay(2013, 9, 5));
     $this->assertTrue(Filter_Datetime::isBusinessDay(2013, 9, 6));
     $this->assertFalse(Filter_Datetime::isBusinessDay(2013, 9, 7));
     $this->assertFalse(Filter_Datetime::isBusinessDay(2013, 9, 8));
     $this->assertTrue(Filter_Datetime::isBusinessDay(2013, 9, 30));
 }
Example #4
0
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
// This script is called on a client device and makes settings for Bibledit-Web.
// It can be called from localhost only for security reasons.
if ($_SERVER['SERVER_ADDR'] != $_SERVER['REMOTE_ADDR']) {
    die;
}
require_once "../bootstrap/bootstrap.php";
if (Filter_Cli::not_yet_ready()) {
    die;
}
$database_config_general = Database_Config_General::getInstance();
// Set the system's time zone.
// Bibledit for Android calls this function.
@($timezone = $_GET['1']);
if (isset($timezone)) {
    $timezones = Filter_Datetime::timezones();
    if (in_array($timezone, $timezones)) {
        $database_config_general->setTimezone($timezone);
    }
}
// Set the system's time zone from Windows.
// The UTC offset is given in minutes positive or negative.
@($utc_offset_minutes = $_GET['utcoffset']);
if (isset($utc_offset_minutes)) {
    $timezone = timezone_name_from_abbr("", $utc_offset_minutes * 60, 0);
    if ($timezone) {
        $database_config_general->setTimezone($timezone);
    }
}
Example #5
0
// 0 (for Sunday) through 6 (for Saturday).
$hour = date("G");
// 0 through 23
$sprintstart = false;
$sprintfinish = false;
// Every Friday at 2 PM (14:00h) it sends email about the sprint progress.
if ($weekday == 5 && $hour == 14) {
    $email = true;
}
// On the first business day of the month, at 10 AM, send email about the start of the sprint.
if (Filter_Datetime::isFirstWorkingDayOfMonth($monthday, $weekday) && $hour == 10) {
    $email = true;
    $sprintstart = true;
}
// On the last business day of the month, at 2 PM (14:00h), send email about the end of the sprint.
if ($monthday == Filter_Datetime::getLastBusinessDayOfMonth($year, $month) && $hour == 14) {
    $email = true;
    $sprintfinish = true;
}
// Determine what to do, or to quit.
if (!$email && !$sprintstart && !$sprintfinish) {
    if ($hour != 1) {
        die;
    }
}
$database_logs = Database_Logs::getInstance();
$database_config_general = Database_Config_General::getInstance();
$database_config_bible = Database_Config_Bible::getInstance();
$database_config_user = Database_Config_User::getInstance();
$database_users = Database_Users::getInstance();
$database_mail = Database_Mail::getInstance();