Example #1
0
                if ($k == "multiplier") {
                    $v = $tsims[sprintf("%0.2f", $v)]["timeSheetItemMultiplierName"];
                }
            }
        }
        $rtn[$k] = $v;
    }
}
//2010-10-01  1 Days x Double Time
//Task: 102 This is the task
//Comment: This is the comment
$str[] = "<tr><td>" . $rtn["date"] . " </td><td class='nobr bold'> " . $rtn["duration"] . " " . $rtn["unit"] . "</td><td class='nobr'>&times; " . $rtn["multiplier"] . "</td></tr>";
$rtn["taskID"] and $str[] = "<tr><td colspan='3'>" . $rtn["taskID"] . "</td></tr>";
$rtn["comment"] and $str[] = "<tr><td colspan='3'>" . $rtn["comment"] . "</td></tr>";
if (isset($_REQUEST["save"]) && isset($_REQUEST["time_item"])) {
    $t = timeSheetItem::parse_time_string($_REQUEST["time_item"]);
    if (!is_numeric($t["duration"])) {
        $status = "bad";
        $extra = "Time not added. Duration not found.";
    } else {
        if (!is_numeric($t["taskID"])) {
            $status = "bad";
            $extra = "Time not added. Task not found.";
        }
    }
    if ($status != "bad") {
        $timeSheet = new timeSheet();
        $tsi_row = $timeSheet->add_timeSheetItem($t);
        if ($TPL["message"]) {
            $status = "bad";
            $extra = "Time not added.<br>" . implode("<br>", $TPL["message"]);
Example #2
0
 function add_time($commands, $email_receive)
 {
     $current_user =& singleton("current_user");
     if ($commands["time"]) {
         // CLI passes time along as a string, email passes time along as an array
         if (!is_array($commands["time"])) {
             $t = $commands["time"];
             unset($commands["time"]);
             $commands["time"][] = $t;
         }
         foreach ((array) $commands["time"] as $time) {
             $t = timeSheetItem::parse_time_string($time);
             if (is_numeric($t["duration"]) && $current_user->get_id()) {
                 $timeSheet = new timeSheet();
                 is_object($email_receive) and $t["msg_uid"] = $email_receive->msg_uid;
                 $tsi_row = $timeSheet->add_timeSheetItem($t);
                 $status[] = $tsi_row["status"];
                 $message[] = $tsi_row["message"];
             }
         }
     }
     return array($status, $message);
 }