Пример #1
0
function show_task_children($template)
{
    global $TPL;
    global $task;
    if ($task->get_value("taskTypeID") == "Parent") {
        $options["parentTaskID"] = $task->get_id();
        $options["taskView"] = "byProject";
        $task->get_value("projectID") and $options["projectIDs"][] = $task->get_value("projectID");
        $options["showDates"] = true;
        #$options["showCreator"] = true;
        $options["showAssigned"] = true;
        $options["showPercent"] = true;
        $options["showHeader"] = true;
        $options["showTimes"] = true;
        $options["showTaskID"] = true;
        $options["showTotals"] = true;
        $options["showStatus"] = true;
        $options["showEdit"] = true;
        $options["showPriorityFactor"] = true;
        $options["returnURL"] = $TPL["url_alloc_task"] . "taskID=" . $task->get_id();
        $_GET["media"] == "print" and $options["showDescription"] = true;
        $_GET["media"] == "print" and $options["showComments"] = true;
        $TPL["taskListRows"] = task::get_list($options);
        $TPL["taskListOptions"] = $options;
        include_template($template);
    }
}
Пример #2
0
 function get_tasks_for_email()
 {
     $options = array();
     #$options["projectType"] = "mine";
     $options["limit"] = 3;
     $options["current_user"] = $this->get_id();
     $options["personID"] = $this->get_id();
     $options["taskView"] = "prioritised";
     $options["taskStatus"] = "open";
     $tasks = task::get_list($options);
     foreach ($tasks as $task) {
         $s[] = "";
         $s[] = "";
         $s[] = "Project: " . $task["project_name"];
         $s[] = "Task: " . $task["taskName"];
         $s[] = $task["taskStatusLabel"];
         $s[] = $task["taskURL"];
     }
     $summary = implode("\n", $s);
     if ($summary) {
         $topThree = "\n\nTop Three Tasks";
         $topThree .= $summary;
     }
     unset($summary, $s);
     unset($options["limit"]);
     $options["taskDate"] = "due_today";
     $tasks = task::get_list($options);
     foreach ($tasks as $task) {
         $s[] = "";
         $s[] = "";
         $s[] = "Project: " . $task["project_name"];
         $s[] = "Task: " . $task["taskName"];
         $s[] = $task["taskStatusLabel"];
         $s[] = $task["taskURL"];
     }
     $summary = implode("\n", $s);
     if ($summary) {
         $dueToday = "\n\nTasks Due Today";
         $dueToday .= $summary;
     }
     unset($summary, $s);
     unset($options["limit"]);
     $options["taskDate"] = "new";
     $tasks = task::get_list($options);
     foreach ($tasks as $task) {
         $s[] = "";
         $s[] = "";
         $s[] = "Project: " . $task["project_name"];
         $s[] = "Task: " . $task["taskName"];
         $s[] = $task["taskStatusLabel"];
         $s[] = $task["taskURL"];
     }
     $summary = implode("\n", $s);
     if ($summary) {
         $newTasks = "\n\nNew Tasks";
         $newTasks .= $summary;
     }
     return $topThree . $dueToday . $newTasks;
 }
Пример #3
0
 function render()
 {
     global $TPL;
     $defaults = array("showHeader" => true, "showTaskID" => true, "taskView" => "prioritised", "showStatus" => "true", "url_form_action" => $TPL["url_alloc_home"], "form_name" => "taskListHome_filter");
     $current_user =& singleton("current_user");
     if (!$current_user->prefs["taskListHome_filter"]) {
         $defaults["taskStatus"] = "open";
         $defaults["personID"] = $current_user->get_id();
         $defaults["showStatus"] = true;
         $defaults["showProject"] = true;
         $defaults["limit"] = 10;
         $defaults["applyFilter"] = true;
     }
     $_FORM = task::load_form_data($defaults);
     $TPL["taskListRows"] = task::get_list($_FORM);
     $TPL["_FORM"] = $_FORM;
     return true;
 }
Пример #4
0
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
 * License for more details.
 * 
 * You should have received a copy of the GNU Affero General Public License
 * along with allocPSA. If not, see <http://www.gnu.org/licenses/>.
*/
require_once "../alloc.php";
include "lib/task_graph.inc.php";
$current_user =& singleton("current_user");
global $show_weeks;
global $for_home_item;
$options = unserialize(stripslashes($_GET["FORM"]));
$options["return"] = "array";
$options["padding"] = 0;
$options["debug"] = 0;
$tasks = task::get_list($options) or $tasks = array();
foreach ($tasks as $task) {
    $objects[$task["taskID"]] = $task["object"];
}
$task_graph = new task_graph();
$task_graph->set_title($_GET["graphTitle"]);
$task_graph->set_width($_GET["graphWidth"]);
$task_graph->init($objects);
$task_graph->draw_grid();
foreach ($tasks as $task) {
    $task_graph->draw_task($task);
}
$task_graph->draw_milestones();
$task_graph->draw_today();
$task_graph->draw_legend();
$task_graph->output();
Пример #5
0
 * your option) any later version.
 * 
 * allocPSA is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
 * License for more details.
 * 
 * You should have received a copy of the GNU Affero General Public License
 * along with allocPSA. If not, see <http://www.gnu.org/licenses/>.
*/
require_once "../alloc.php";
$TPL["main_alloc_title"] = "Task List - " . APPLICATION_NAME;
$defaults = array("showHeader" => true, "showTaskID" => true, "showEdit" => true, "taskView" => "byProject", "showStatus" => "true", "showTotals" => "true", "padding" => 1, "url_form_action" => $TPL["url_alloc_taskList"], "form_name" => "taskList_filter");
// Load task list
$_FORM = task::load_form_data($defaults);
$TPL["taskListRows"] = task::get_list($_FORM);
$TPL["_FORM"] = $_FORM;
// Load filter
$arr = task::load_task_filter($_FORM);
is_array($arr) and $TPL = array_merge($TPL, $arr);
// Check for updates
if ($_POST["mass_update"]) {
    if ($_POST["select"]) {
        $allowed_auto_fields = array("dateTargetStart", "dateTargetCompletion", "dateActualStart", "dateActualCompletion", "managerID", "timeLimit", "timeBest", "timeWorst", "timeExpected", "priority", "taskTypeID", "taskStatus", "personID");
        foreach ($_POST["select"] as $taskID => $selected) {
            $task = new task();
            $task->set_id($taskID);
            $task->select();
            // Special case: projectID and parentTaskID have to be done together
            if ($_POST["update_action"] == "projectIDAndParentTaskID") {
                // Can't set self to be parent
Пример #6
0
 function get_task_list_dropdown($status, $timeSheetID, $taskID = "")
 {
     if (is_object($this)) {
         $personID = $this->get_value('personID');
         $projectID = $this->get_value('projectID');
     } else {
         if ($timeSheetID) {
             $t = new timeSheet();
             $t->set_id($timeSheetID);
             $t->select();
             $personID = $t->get_value('personID');
             $projectID = $t->get_value('projectID');
         }
     }
     $options["projectID"] = $projectID;
     $options["personID"] = $personID;
     $options["taskView"] = "byProject";
     $options["return"] = "array";
     $options["taskTimeSheetStatus"] = $status;
     $taskrows = task::get_list($options);
     foreach ((array) $taskrows as $tid => $row) {
         $tasks[$tid] = str_repeat("&nbsp;&nbsp;&nbsp;&nbsp;", $row["padding"]) . $tid . " " . $row["taskName"];
     }
     if ($taskID) {
         $t = new task();
         $t->set_id($taskID);
         $t->select();
         $tasks[$taskID] = $t->get_id() . " " . $t->get_name();
     }
     $dropdown_options = page::select_options((array) $tasks, $taskID, 100);
     return "<select name=\"timeSheetItem_taskID\" style=\"width:400px\"><option value=\"\">" . $dropdown_options . "</select>";
 }
Пример #7
0
function show_tasks()
{
    global $TPL;
    global $project;
    $options["showHeader"] = true;
    $options["taskView"] = "byProject";
    $options["projectIDs"] = array($project->get_id());
    $options["taskStatus"] = array("open", "pending");
    $options["showTaskID"] = true;
    $options["showAssigned"] = true;
    $options["showStatus"] = true;
    $options["showManager"] = true;
    $options["showDates"] = true;
    #$options["showTimes"] = true; // performance hit
    $options["return"] = "html";
    // $TPL["taskListRows"] is used for the budget estimatation outside of this function
    $options = ace_augment("project_page_task_list_options", $options);
    $TPL["taskListRows"] = task::get_list($options);
    $TPL["_FORM"] = $options;
    include_template("templates/projectTaskS.tpl");
}
Пример #8
0
function export_csv($projectID)
{
    $project = new project();
    $project->set_id($projectID);
    $project->select();
    $retstr = '"Task Name","Estimated Time","Assignee"';
    // Export all tasks in the project
    $taskOptions["projectIDs"] = array($project->get_id());
    $taskOptions["return"] = "array";
    $taskOptions["taskView"] = "byProject";
    $tasks = task::get_list($taskOptions);
    // Sort by taskID--we assume taskIDs were assigned linearly on import/creation--so as to produce an identical file
    foreach ($tasks as $task) {
        $taskIDs[] = $task['taskID'];
    }
    array_multisort($taskIDs, $tasks);
    foreach ($tasks as $task) {
        $assignee = new person();
        $assignee->set_id($task['personID']);
        $assignee->select();
        $estimatedHours = $task['timeExpected'];
        is_numeric($estimatedHours) or $estimatedHours = 0;
        $retstr .= "\n" . export_escape_csv($task['taskName']) . ',' . export_escape_csv($estimatedHours) . ',' . export_escape_csv($assignee->get_name(array("format" => "nick")));
    }
    return $retstr;
}
Пример #9
0
$_FORM["showAssigned"] and $fields["assignee_name"] = "Assigned To";
$_FORM["showDate1"] and $fields["dateTargetStart"] = "Targ Start";
$_FORM["showDate2"] and $fields["dateTargetCompletion"] = "Targ Compl";
$_FORM["showDate3"] and $fields["dateActualStart"] = "Start";
$_FORM["showDate4"] and $fields["dateActualCompletion"] = "Compl";
$_FORM["showDate5"] and $fields["dateCreated"] = "Created";
$_FORM["showTimes"] and $fields["timeBestLabel"] = "Best";
$_FORM["showTimes"] and $fields["timeExpectedLabel"] = "Likely";
$_FORM["showTimes"] and $fields["timeWorstLabel"] = "Worst";
$_FORM["showTimes"] and $fields["timeActualLabel"] = "Actual";
$_FORM["showTimes"] and $fields["timeLimitLabel"] = "Limit";
$_FORM["showPercent"] and $fields["percentComplete"] = "%";
$_FORM["showStatus"] and $fields["taskStatusLabel"] = "Status";
$taskPriorities = config::get_config_item("taskPriorities");
$projectPriorities = config::get_config_item("projectPriorities");
$rows = task::get_list($_FORM);
$taskListRows = array();
foreach ((array) $rows as $row) {
    $row["taskPriority"] = $taskPriorities[$row["priority"]]["label"];
    $row["projectPriority"] = $projectPriorities[$row["projectPriority"]]["label"];
    $row["taskDateStatus"] = strip_tags($row["taskDateStatus"]);
    $row["percentComplete"] = strip_tags($row["percentComplete"]);
    $taskListRows[] = $row;
}
if ($taskListRows) {
    header('Content-Type: text/csv');
    header('Content-Disposition: attachment;filename=tasklist' . time() . '.csv');
    $fp = fopen('php://output', 'w');
    // header row
    fputcsv($fp, array_keys(current($taskListRows)));
    foreach ($taskListRows as $row) {
Пример #10
0
 function get_printable_file($_FORM = array())
 {
     global $TPL;
     $db = new db_alloc();
     $TPL["companyName"] = config::get_config_item("companyName");
     $TPL["companyNos1"] = config::get_config_item("companyACN");
     $TPL["companyNos2"] = config::get_config_item("companyABN");
     $TPL["img"] = config::get_config_item("companyImage");
     $TPL["companyContactAddress"] = config::get_config_item("companyContactAddress");
     $TPL["companyContactAddress2"] = config::get_config_item("companyContactAddress2");
     $TPL["companyContactAddress3"] = config::get_config_item("companyContactAddress3");
     $email = config::get_config_item("companyContactEmail");
     $email and $TPL["companyContactEmail"] = "Email: " . $email;
     $web = config::get_config_item("companyContactHomePage");
     $web and $TPL["companyContactHomePage"] = "Web: " . $web;
     $phone = config::get_config_item("companyContactPhone");
     $fax = config::get_config_item("companyContactFax");
     $phone and $TPL["phone"] = "Ph: " . $phone;
     $fax and $TPL["fax"] = "Fax: " . $fax;
     $taskPriorities = config::get_config_item("taskPriorities");
     $projectPriorities = config::get_config_item("projectPriorities");
     // Add requested fields to pdf
     $_FORM["showEdit"] = false;
     $fields["taskID"] = "ID";
     $fields["taskName"] = "Task";
     $_FORM["showProject"] and $fields["projectName"] = "Project";
     $_FORM["showPriority"] || $_FORM["showPriorityFactor"] and $fields["priorityFactor"] = "Pri";
     $_FORM["showPriority"] and $fields["taskPriority"] = "Task Pri";
     $_FORM["showPriority"] and $fields["projectPriority"] = "Proj Pri";
     $_FORM["showCreator"] and $fields["creator_name"] = "Creator";
     $_FORM["showManager"] and $fields["manager_name"] = "Manager";
     $_FORM["showAssigned"] and $fields["assignee_name"] = "Assigned To";
     $_FORM["showDate1"] and $fields["dateTargetStart"] = "Targ Start";
     $_FORM["showDate2"] and $fields["dateTargetCompletion"] = "Targ Compl";
     $_FORM["showDate3"] and $fields["dateActualStart"] = "Start";
     $_FORM["showDate4"] and $fields["dateActualCompletion"] = "Compl";
     $_FORM["showDate5"] and $fields["dateCreated"] = "Created";
     $_FORM["showTimes"] and $fields["timeBestLabel"] = "Best";
     $_FORM["showTimes"] and $fields["timeExpectedLabel"] = "Likely";
     $_FORM["showTimes"] and $fields["timeWorstLabel"] = "Worst";
     $_FORM["showTimes"] and $fields["timeActualLabel"] = "Actual";
     $_FORM["showTimes"] and $fields["timeLimitLabel"] = "Limit";
     $_FORM["showPercent"] and $fields["percentComplete"] = "%";
     $_FORM["showStatus"] and $fields["taskStatusLabel"] = "Status";
     $rows = task::get_list($_FORM);
     $taskListRows = array();
     foreach ((array) $rows as $row) {
         $row["taskPriority"] = $taskPriorities[$row["priority"]]["label"];
         $row["projectPriority"] = $projectPriorities[$row["projectPriority"]]["label"];
         $row["taskDateStatus"] = strip_tags($row["taskDateStatus"]);
         $row["percentComplete"] = strip_tags($row["percentComplete"]);
         $taskListRows[] = $row;
     }
     if ($_FORM["format"] != "html" && $_FORM["format"] != "html_plus") {
         // Build PDF document
         $font1 = ALLOC_MOD_DIR . "util/fonts/Helvetica.afm";
         $font2 = ALLOC_MOD_DIR . "util/fonts/Helvetica-Oblique.afm";
         $pdf_table_options = array("showLines" => 0, "shaded" => 0, "showHeadings" => 0, "xPos" => "left", "xOrientation" => "right", "fontSize" => 10, "rowGap" => 0, "fontSize" => 10);
         $pdf_table_options3 = array("showLines" => 2, "shaded" => 0, "width" => 750, "xPos" => "center", "fontSize" => 10, "lineCol" => array(0.8, 0.8, 0.8), "splitRows" => 1, "protectRows" => 0);
         $pdf = new Cezpdf(null, 'landscape');
         $pdf->ezSetMargins(40, 40, 40, 40);
         $pdf->selectFont($font1);
         $pdf->ezStartPageNumbers(436, 30, 10, 'center', 'Page {PAGENUM} of {TOTALPAGENUM}');
         $pdf->ezSetY(560);
         $TPL["companyContactAddress"] and $contact_info[] = array($TPL["companyContactAddress"]);
         $TPL["companyContactAddress2"] and $contact_info[] = array($TPL["companyContactAddress2"]);
         $TPL["companyContactAddress3"] and $contact_info[] = array($TPL["companyContactAddress3"]);
         $TPL["companyContactEmail"] and $contact_info[] = array($TPL["companyContactEmail"]);
         $TPL["companyContactHomePage"] and $contact_info[] = array($TPL["companyContactHomePage"]);
         $TPL["phone"] and $contact_info[] = array($TPL["phone"]);
         $TPL["fax"] and $contact_info[] = array($TPL["fax"]);
         $pdf->selectFont($font2);
         $y = $pdf->ezTable($contact_info, false, "", $pdf_table_options);
         $pdf->selectFont($font1);
         $line_y = $y - 10;
         $pdf->setLineStyle(1, "round");
         $pdf->line(40, $line_y, 801, $line_y);
         $pdf->ezSetY(570);
         $image_jpg = ALLOC_LOGO;
         if (file_exists($image_jpg)) {
             $pdf->ezImage($image_jpg, 0, sprintf("%d", config::get_config_item("logoScaleX")), 'none');
             $y = 700;
         } else {
             $y = $pdf->ezText($TPL["companyName"], 27, array("justification" => "right"));
         }
         $nos_y = $line_y + 22;
         $TPL["companyNos2"] and $nos_y = $line_y + 34;
         $pdf->ezSetY($nos_y);
         $TPL["companyNos1"] and $y = $pdf->ezText($TPL["companyNos1"], 10, array("justification" => "right"));
         $TPL["companyNos2"] and $y = $pdf->ezText($TPL["companyNos2"], 10, array("justification" => "right"));
         $pdf->ezSetY($line_y - 10);
         $y = $pdf->ezText("Task List", 20, array("justification" => "center"));
         $pdf->ezSetY($y - 20);
         $y = $pdf->ezTable($taskListRows, $fields, "", $pdf_table_options3);
         $pdf->ezSetY($y - 20);
         $pdf->ezStream();
         // Else HTML format
     } else {
         echo task::get_list_html($taskListRows, $_FORM);
     }
 }