当前位置: 首页>>代码示例>>PHP>>正文


PHP task::get_value方法代码示例

本文整理汇总了PHP中task::get_value方法的典型用法代码示例。如果您正苦于以下问题:PHP task::get_value方法的具体用法?PHP task::get_value怎么用?PHP task::get_value使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在task的用法示例。


在下文中一共展示了task::get_value方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: singleton

 function add_tsiHint($stuff)
 {
     $current_user =& singleton("current_user");
     $errstr = "Failed to record new time sheet item hint. ";
     $username = $stuff["username"];
     $people = person::get_people_by_username();
     $personID = $people[$username]["personID"];
     $personID or alloc_error("Person " . $username . " not found.");
     $taskID = $stuff["taskID"];
     $projectID = $stuff["projectID"];
     $duration = $stuff["duration"];
     $comment = $stuff["comment"];
     $date = $stuff["date"];
     if ($taskID) {
         $task = new task();
         $task->set_id($taskID);
         $task->select();
         $projectID = $task->get_value("projectID");
         $extra = " for task " . $taskID;
     }
     $projectID or alloc_error(sprintf($errstr . "No project found%s.", $extra));
     $row_projectPerson = projectPerson::get_projectPerson_row($projectID, $current_user->get_id());
     $row_projectPerson or alloc_error($errstr . "The person(" . $current_user->get_id() . ") has not been added to the project(" . $projectID . ").");
     if ($row_projectPerson && $projectID) {
         // Add new time sheet item
         $tsiHint = new tsiHint();
         $d = $date or $d = date("Y-m-d");
         $tsiHint->set_value("date", $d);
         $tsiHint->set_value("duration", $duration);
         if (is_object($task)) {
             $tsiHint->set_value("taskID", sprintf("%d", $taskID));
         }
         $tsiHint->set_value("personID", $personID);
         $tsiHint->set_value("comment", $comment);
         $tsiHint->save();
         $ID = $tsiHint->get_id();
     }
     if ($ID) {
         return array("status" => "yay", "message" => $ID);
     } else {
         alloc_error($errstr . "Time hint not added.");
     }
 }
开发者ID:cjbayliss,项目名称:alloc,代码行数:43,代码来源:tsiHint.inc.php

示例2: task

 function get_project_id()
 {
     $this->select();
     if ($this->get_value("commentType") == "task" && $this->get_value("commentLinkID")) {
         $t = new task();
         $t->set_id($this->get_value("commentLinkID"));
         $t->select();
         $projectID = $t->get_value("projectID");
     } else {
         if ($this->get_value("commentType") == "project" && $this->get_value("commentLinkID")) {
             $projectID = $this->get_value("commentLinkID");
         } else {
             if ($this->get_value("commentType") == "timeSheet" && $this->get_value("commentLinkID")) {
                 $t = new timeSheet();
                 $t->set_id($this->get_value("commentLinkID"));
                 $t->select();
                 $projectID = $t->get_value("projectID");
             }
         }
     }
     return $projectID;
 }
开发者ID:cjbayliss,项目名称:alloc,代码行数:22,代码来源:comment.inc.php

示例3: array

// 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
                if ($_POST["parentTaskID"] != $task->get_id()) {
                    $task->set_value("parentTaskID", $_POST["parentTaskID"]);
                }
                // If task is a parent, change the project of that tasks children
                if ($_POST["projectID"] != $task->get_value("projectID") && $task->get_value("taskTypeID") == "Parent") {
                    $task->update_children("projectID", $_POST["projectID"]);
                }
                $task->set_value("projectID", $_POST["projectID"]);
                $task->updateSearchIndexLater = true;
                $task->save();
                // All other cases are generic and can be handled by a single clause
            } else {
                if ($_POST["update_action"] && in_array($_POST["update_action"], $allowed_auto_fields)) {
                    $task->set_value($_POST["update_action"], $_POST[$_POST["update_action"]]);
                    $task->updateSearchIndexLater = true;
                    $task->save();
                }
            }
        }
        $TPL["message_good"][] = "Tasks updated.";
开发者ID:cjbayliss,项目名称:alloc,代码行数:31,代码来源:taskList.php

示例4: implode

        $st2 = "</strike>";
    } else {
        $wasopen = true;
    }
    $pendingTaskLinks[] = $st1 . $realtask->get_task_link(array("prefixTaskID" => 1, "return" => "html")) . $st2;
}
$is = "was";
$wasopen and $is = "is";
$pendingTaskLinks and $TPL["message_help_no_esc"][] = "This task " . $is . " pending the completion of:<br>" . implode("<br>", $pendingTaskLinks);
$rows = $task->get_pending_tasks(true);
foreach ((array) $rows as $tID) {
    $realtask = new task();
    $realtask->set_id($tID);
    $realtask->select();
    unset($st1, $st2);
    if (substr($realtask->get_value("taskStatus"), 0, 6) == "closed") {
        $st1 = "<strike>";
        $st2 = "</strike>";
    } else {
        $wasopen = true;
    }
    $blockTaskLinks[] = $st1 . $realtask->get_task_link(array("prefixTaskID" => 1, "return" => "html")) . $st2;
}
$is = "was";
$wasopen and $is = "is";
$blockTaskLinks and $TPL["message_help_no_esc"][] = "This task " . $is . " blocking the start of:<br>" . implode("<br>", $blockTaskLinks);
if (in_str("pending_", $task->get_value("taskStatus"))) {
    $rows = $task->get_reopen_reminders();
    foreach ($rows as $r) {
        $TPL["message_help_no_esc"][] = 'This task is set to
                                    <a href="' . $TPL["url_alloc_reminder"] . 'step=3&reminderID=' . $r["rID"] . '&returnToParent=task">
开发者ID:cjbayliss,项目名称:alloc,代码行数:31,代码来源:task.php

示例5: project

                 $project = new project();
                 $project->read_db_record($db);
                 $parent_names[$project->get_id()] = $project->get_value('projectName');
             }
         } else {
             if ($parentType == "task") {
                 if ($current_user->have_role("admin")) {
                     $query = "SELECT * FROM task";
                 } else {
                     $query = prepare("SELECT * FROM task WHERE personID=%d ORDER BY taskName", $personID);
                 }
                 $db->query($query);
                 while ($db->next_record()) {
                     $task = new task();
                     $task->read_db_record($db);
                     if (substr($task->get_value("taskStatus"), 0, 6) != "closed") {
                         $parent_names[$task->get_id()] = $task->get_value('taskName');
                     }
                 }
             }
         }
     }
     $TPL["parentType"] = $parentType;
     $TPL["parentNameOptions"] = page::select_options($parent_names);
     include_template("templates/reminderSelectParentM.tpl");
     break;
 case 3:
     // reminder entry form
     $reminder = new reminder();
     if (isset($reminderID)) {
         $reminder->set_id($reminderID);
开发者ID:cjbayliss,项目名称:alloc,代码行数:31,代码来源:reminder.php

示例6: get_list

 public static function get_list($_FORM)
 {
     $current_user =& singleton("current_user");
     /*
      * This is the definitive method of getting a list of tasks that need a sophisticated level of filtering
      *
      */
     list($filter, $having) = task::get_list_filter($_FORM);
     $debug = $_FORM["debug"];
     $debug and print "\n<pre>_FORM: " . print_r($_FORM, 1) . "</pre>";
     $debug and print "\n<pre>filter: " . print_r($filter, 1) . "</pre>";
     $_FORM["taskView"] or $_FORM["taskView"] = 'prioritised';
     // Zero is a valid limit
     if ($_FORM["limit"] || $_FORM["limit"] === 0 || $_FORM["limit"] === "0") {
         $limit = prepare("limit %d", $_FORM["limit"]);
     }
     $_FORM["return"] or $_FORM["return"] = "html";
     $_FORM["people_cache"] =& get_cached_table("person");
     $_FORM["timeUnit_cache"] =& get_cached_table("timeUnit");
     $_FORM["taskType_cache"] =& get_cached_table("taskType");
     if ($_FORM["taskView"] == "prioritised") {
         unset($filter["parentTaskID"]);
         $order_limit = " " . $limit;
     } else {
         $order_limit = " ORDER BY projectName,taskName " . $limit;
     }
     // Get a hierarchical list of tasks
     if (is_array($filter) && count($filter)) {
         $f = " WHERE " . implode(" AND ", $filter);
     }
     $uid = sprintf("%d", $current_user->get_id());
     $spread = sprintf("%d", config::get_config_item("taskPrioritySpread"));
     $scale = sprintf("%d", config::get_config_item("taskPriorityScale"));
     $scale_halved = sprintf("%d", config::get_config_item("taskPriorityScale") / 2);
     $q = "SELECT task.*\n                ,projectName\n                ,projectShortName\n                ,clientID\n                ,projectPriority\n                ,project.currencyTypeID as currency\n                ,rate\n                ,rateUnitID\n                ,GROUP_CONCAT(pendingTask.pendingTaskID) as pendingTaskIDs\n                ,GROUP_CONCAT(DISTINCT alltag.name SEPARATOR ', ') as tags\n            FROM task\n       LEFT JOIN project ON project.projectID = task.projectID\n       LEFT JOIN projectPerson ON project.projectID = projectPerson.projectID AND projectPerson.personID = '" . $uid . "'\n       LEFT JOIN pendingTask ON pendingTask.taskID = task.taskID\n       LEFT JOIN tag alltag ON alltag.taskID = task.taskID\n       LEFT JOIN tag seltag ON seltag.taskID = task.taskID\n                 " . $f . "\n        GROUP BY task.taskID\n                 " . $having . "\n                 " . $order_limit;
     $debug and print "\n<br>QUERY: " . $q;
     $_FORM["debug"] and print "\n<br>QUERY: " . $q;
     $db = new db_alloc();
     $db->query($q);
     while ($row = $db->next_record()) {
         $task = new task();
         $task->read_db_record($db);
         $row["taskURL"] = $task->get_url();
         $row["taskName"] = $task->get_name($_FORM);
         $row["taskLink"] = $task->get_task_link($_FORM);
         $row["project_name"] = $row["projectShortName"] or $row["project_name"] = $row["projectName"];
         $row["projectPriority"] = $db->f("projectPriority");
         has("project") and $row["projectPriorityLabel"] = project::get_priority_label($db->f("projectPriority"));
         has("project") and list($row["priorityFactor"], $row["daysUntilDue"]) = $task->get_overall_priority($row["projectPriority"], $row["priority"], $row["dateTargetCompletion"]);
         $row["taskTypeImage"] = $task->get_task_image();
         $row["taskTypeSeq"] = $_FORM["taskType_cache"][$row["taskTypeID"]]["taskTypeSeq"];
         $row["taskStatusLabel"] = $task->get_task_status("label");
         $row["taskStatusColour"] = $task->get_task_status("colour");
         $row["creator_name"] = $_FORM["people_cache"][$row["creatorID"]]["name"];
         $row["manager_name"] = $_FORM["people_cache"][$row["managerID"]]["name"];
         $row["assignee_name"] = $_FORM["people_cache"][$row["personID"]]["name"];
         $row["closer_name"] = $_FORM["people_cache"][$row["closerID"]]["name"];
         $row["estimator_name"] = $_FORM["people_cache"][$row["estimatorID"]]["name"];
         $row["creator_username"] = $_FORM["people_cache"][$row["creatorID"]]["username"];
         $row["manager_username"] = $_FORM["people_cache"][$row["managerID"]]["username"];
         $row["assignee_username"] = $_FORM["people_cache"][$row["personID"]]["username"];
         $row["closer_username"] = $_FORM["people_cache"][$row["closerID"]]["username"];
         $row["estimator_username"] = $_FORM["people_cache"][$row["estimatorID"]]["username"];
         $row["newSubTask"] = $task->get_new_subtask_link();
         $_FORM["showPercent"] and $row["percentComplete"] = $task->get_percentComplete();
         $_FORM["showTimes"] and $row["timeActual"] = $task->get_time_billed() / 60 / 60;
         $row["rate"] = page::money($row["currency"], $row["rate"], "%mo");
         $row["rateUnit"] = $_FORM["timeUnit_cache"][$row["rateUnitID"]]["timeUnitName"];
         $row["priorityLabel"] = $task->get_priority_label();
         if (!$_FORM["skipObject"]) {
             $_FORM["return"] == "array" and $row["object"] = $task;
         }
         $row["padding"] = $_FORM["padding"];
         $row["taskID"] = $task->get_id();
         $row["parentTaskID"] = $task->get_value("parentTaskID");
         $row["parentTaskID_link"] = "<a href='" . $task->get_url(false, $task->get_value("parentTaskID")) . "'>" . $task->get_value("parentTaskID") . "</a>";
         $row["timeLimitLabel"] = $row["timeBestLabel"] = $row["timeWorstLabel"] = $row["timeExpectedLabel"] = $row["timeActualLabel"] = "";
         $row["timeLimit"] !== NULL and $row["timeLimitLabel"] = seconds_to_display_format($row["timeLimit"] * 60 * 60);
         $row["timeBest"] !== NULL and $row["timeBestLabel"] = seconds_to_display_format($row["timeBest"] * 60 * 60);
         $row["timeWorst"] !== NULL and $row["timeWorstLabel"] = seconds_to_display_format($row["timeWorst"] * 60 * 60);
         $row["timeExpected"] !== NULL and $row["timeExpectedLabel"] = seconds_to_display_format($row["timeExpected"] * 60 * 60);
         $row["timeActual"] !== NULL and $row["timeActualLabel"] = seconds_to_display_format($row["timeActual"] * 60 * 60);
         if ($_FORM["showComments"] && ($comments = comment::util_get_comments("task", $row["taskID"]))) {
             $row["comments"] = $comments;
         }
         if ($_FORM["taskView"] == "byProject") {
             $rows[$task->get_id()] = array("parentTaskID" => $row["parentTaskID"], "row" => $row);
         } else {
             if ($_FORM["taskView"] == "prioritised") {
                 $rows[$row["taskID"]] = $row;
                 if (is_array($rows) && count($rows)) {
                     uasort($rows, array("task", "priority_compare"));
                 }
             }
         }
     }
     if ($_FORM["taskView"] == "byProject") {
         $parentTaskID = $_FORM["parentTaskID"] or $parentTaskID = 0;
         $t = task::get_recursive_child_tasks($parentTaskID, (array) $rows);
         list($tasks, $done) = task::build_recursive_task_list($t, $_FORM);
//.........这里部分代码省略.........
开发者ID:cjbayliss,项目名称:alloc,代码行数:101,代码来源:task.inc.php

示例7: show_timeSheet_list

function show_timeSheet_list($template)
{
    global $TPL;
    global $timeSheet;
    global $db;
    global $tskDesc;
    global $timeSheetItem;
    global $timeSheetID;
    $db_task = new db_alloc();
    if (is_object($timeSheet) && ($timeSheet->get_value("status") == "edit" || $timeSheet->get_value("status") == "rejected")) {
        $TPL["timeSheetItem_buttons"] = '
        <button type="submit" name="timeSheetItem_delete" value="1" class="delete_button">Delete<i class="icon-trash"></i></button>
        <button type="submit" name="timeSheetItem_edit" value="1">Edit<i class="icon-edit"></i></button>';
    }
    $TPL["currency"] = page::money($timeSheet->get_value("currencyTypeID"), '', "%S");
    $timeUnit = new timeUnit();
    $unit_array = $timeUnit->get_assoc_array("timeUnitID", "timeUnitLabelA");
    $item_query = prepare("SELECT * from timeSheetItem WHERE timeSheetID=%d", $timeSheetID);
    // If editing a timeSheetItem then don't display it in the list
    $timeSheetItemID = $_POST["timeSheetItemID"] or $timeSheetItemID = $_GET["timeSheetItemID"];
    $timeSheetItemID and $item_query .= prepare(" AND timeSheetItemID != %d", $timeSheetItemID);
    $item_query .= prepare(" GROUP BY timeSheetItemID ORDER BY dateTimeSheetItem, timeSheetItemID");
    $db->query($item_query);
    if (is_object($timeSheet)) {
        $project = $timeSheet->get_foreign_object("project");
        $row_projectPerson = projectPerson::get_projectPerson_row($project->get_id(), $timeSheet->get_value("personID"));
        $default_rate = array();
        if ($row_projectPerson && $row_projectPerson['rate'] > 0) {
            $default_rate['rate'] = $row_projectPerson['rate'];
            $default_rate['unit'] = $row_projectPerson['rateUnitID'];
        }
    }
    while ($db->next_record()) {
        $timeSheetItem = new timeSheetItem();
        $timeSheetItem->currency = $timeSheet->get_value("currencyTypeID");
        $timeSheetItem->read_db_record($db);
        $timeSheetItem->set_tpl_values("timeSheetItem_");
        $TPL["timeSheet_totalHours"] += $timeSheetItem->get_value("timeSheetItemDuration");
        $TPL["unit"] = $unit_array[$timeSheetItem->get_value("timeSheetItemDurationUnitID")];
        $br = "";
        $commentPrivateText = "";
        $text = $timeSheetItem->get_value('description', DST_HTML_DISPLAY);
        if ($timeSheetItem->get_value("commentPrivate")) {
            $commentPrivateText = "<b>[Private Comment]</b> ";
        }
        $text and $TPL["timeSheetItem_description"] = "<a href=\"" . $TPL["url_alloc_task"] . "taskID=" . $timeSheetItem->get_value('taskID') . "\">" . $text . "</a>";
        $text && $timeSheetItem->get_value("comment") and $br = "<br>";
        $timeSheetItem->get_value("comment") and $TPL["timeSheetItem_comment"] = $br . $commentPrivateText . page::to_html($timeSheetItem->get_value("comment"));
        $TPL["timeSheetItem_unit_times_rate"] = $timeSheetItem->calculate_item_charge($timeSheet->get_value("currencyTypeID"), $timeSheetItem->get_value("rate"));
        $m = new meta("timeSheetItemMultiplier");
        $tsMultipliers = $m->get_list();
        $timeSheetItem->get_value('multiplier') and $TPL["timeSheetItem_multiplier"] = $tsMultipliers[$timeSheetItem->get_value('multiplier')]['timeSheetItemMultiplierName'];
        // Check to see if this tsi is part of an overrun
        $TPL["timeSheetItem_class"] = "panel";
        $TPL["timeSheetItem_status"] = "";
        $row_messages = array();
        if ($timeSheetItem->get_value('taskID')) {
            $task = new task();
            $task->set_id($timeSheetItem->get_value('taskID'));
            $task->select();
            if ($task->get_value('timeLimit') > 0) {
                $total_billed_time = $task->get_time_billed(false) / 3600;
                // get_time_billed returns seconds, limit hours is in hours
                if ($total_billed_time > $task->get_value('timeLimit')) {
                    $row_messages[] = "<em class='faint warn nobr'>[ Exceeds Limit ]</em>";
                }
            }
        }
        // Highlight the rate if the project person has a non-zero rate and it doesn't match the item's rate
        if ($default_rate) {
            if ($timeSheetItem->get_value('rate') != $default_rate['rate'] || $timeSheetItem->get_value('timeSheetItemDurationUnitID') != $default_rate['unit']) {
                $row_messages[] = "<em class='faint warn nobr'>[ Modified rate ]</em>";
            }
        }
        if ($row_messages) {
            $TPL["timeSheetItem_status"] = implode("<br />", $row_messages);
            $TPL["timeSheetItem_class"] = "panel loud";
        }
        include_template($template);
    }
    $TPL["summary_totals"] = $timeSheet->pay_info["summary_unit_totals"];
}
开发者ID:cjbayliss,项目名称:alloc,代码行数:82,代码来源:timeSheet.php

示例8: singleton

 function move_forwards()
 {
     $current_user =& singleton("current_user");
     global $TPL;
     $status = $this->get_value("status");
     $db = new db_alloc();
     if ($this->get_value("clientID")) {
         $c = $this->get_foreign_object("client");
         $extra = " for " . $c->get_value("clientName");
         $taskDesc[] = "";
     }
     $taskname1 = "Sale " . $this->get_id() . ": raise an invoice" . $extra;
     $taskname2 = "Sale " . $this->get_id() . ": place an order to the supplier";
     $taskname3 = "Sale " . $this->get_id() . ": pay the supplier";
     $taskname4 = "Sale " . $this->get_id() . ": deliver the goods / action the work";
     $cyberadmin = 59;
     $taskDesc[] = "Sale items:";
     $taskDesc[] = "";
     foreach ((array) $this->get_productSaleItems() as $psiID => $psi_row) {
         $p = new product();
         $p->set_id($psi_row["productID"]);
         $taskDesc[] = "  " . page::money($psi_row["sellPriceCurrencyTypeID"], $psi_row["sellPrice"], "%S%mo") . " for " . $psi_row["quantity"] . " x " . $p->get_name();
         $hasItems = true;
     }
     if (!$hasItems) {
         return alloc_error("No sale items have been added.");
     }
     $amounts = $this->get_amounts();
     $taskDesc[] = "";
     $taskDesc[] = "Total: " . $amounts["total_sellPrice"];
     $taskDesc[] = "Total inc " . config::get_config_item("taxName") . ": " . $amounts["total_sellPrice_plus_gst"];
     $taskDesc[] = "";
     $taskDesc[] = "Refer to the sale in alloc for up-to-date information:";
     $taskDesc[] = config::get_config_item("allocURL") . "sale/productSale.php?productSaleID=" . $this->get_id();
     $taskDesc = implode("\n", $taskDesc);
     if ($status == "edit") {
         $this->set_value("status", "allocate");
         $items = $this->get_productSaleItems();
         foreach ($items as $r) {
             $psi = new productSaleItem();
             $psi->set_id($r["productSaleItemID"]);
             $psi->select();
             if (!$db->qr("SELECT transactionID FROM transaction WHERE productSaleItemID = %d", $psi->get_id())) {
                 $psi->create_transactions();
             }
         }
     } else {
         if ($status == "allocate") {
             $this->set_value("status", "admin");
             // 1. from salesperson to admin
             $q = prepare("SELECT * FROM task WHERE projectID = %d AND taskName = '%s'", $cyberadmin, $taskname1);
             if (config::for_cyber() && !$db->qr($q)) {
                 $task = new task();
                 $task->set_value("projectID", $cyberadmin);
                 // Cyber Admin Project
                 $task->set_value("taskName", $taskname1);
                 $task->set_value("managerID", $this->get_value("personID"));
                 // salesperson
                 $task->set_value("personID", 67);
                 // Cyber Support people (jane)
                 $task->set_value("priority", 3);
                 $task->set_value("taskTypeID", "Task");
                 $task->set_value("taskDescription", $taskDesc);
                 $task->set_value("dateTargetStart", date("Y-m-d"));
                 $task->set_value("dateTargetCompletion", date("Y-m-d", date("U") + 60 * 60 * 24 * 7));
                 $task->save();
                 $TPL["message_good"][] = "Task created: " . $task->get_id() . " " . $task->get_value("taskName");
                 $p1 = new person();
                 $p1->set_id($this->get_value("personID"));
                 $p1->select();
                 $p2 = new person();
                 $p2->set_id(67);
                 $p2->select();
                 $recipients[$p1->get_value("emailAddress")] = array("name" => $p1->get_name(), "addIP" => true, "internal" => true);
                 $recipients[$p2->get_value("emailAddress")] = array("name" => $p2->get_name(), "addIP" => true, "internal" => true);
                 $comment = $p2->get_name() . ",\n\n" . $taskname1 . "\n\n" . $taskDesc;
                 $commentID = comment::add_comment("task", $task->get_id(), $comment, "task", $task->get_id());
                 $emailRecipients = comment::add_interested_parties($commentID, null, $recipients);
                 // Re-email the comment out, including any attachments
                 if (!comment::send_comment($commentID, $emailRecipients)) {
                     alloc_error("Email failed to send.");
                 } else {
                     $TPL["message_good"][] = "Emailed task comment to " . $p1->get_value("emailAddress") . ", " . $p2->get_value("emailAddress") . ".";
                 }
             }
         } else {
             if ($status == "admin" && $this->have_perm(PERM_APPROVE_PRODUCT_TRANSACTIONS)) {
                 $this->set_value("status", "finished");
                 if ($_REQUEST["changeTransactionStatus"]) {
                     $rows = $this->get_productSaleItems();
                     foreach ($rows as $row) {
                         $ids[] = $row["productSaleItemID"];
                     }
                     if ($ids) {
                         $q = prepare("UPDATE transaction SET status = '%s' WHERE productSaleItemID in (%s)", $_REQUEST["changeTransactionStatus"], $ids);
                         $db = new db_alloc();
                         $db->query($q);
                     }
                 }
                 // 2. from admin to salesperson
//.........这里部分代码省略.........
开发者ID:cjbayliss,项目名称:alloc,代码行数:101,代码来源:productSale.inc.php

示例9: singleton

 function add_timeSheetItem($stuff)
 {
     $current_user =& singleton("current_user");
     $errstr = "Failed to record new time sheet item. ";
     $taskID = $stuff["taskID"];
     $projectID = $stuff["projectID"];
     $duration = $stuff["duration"];
     $comment = $stuff["comment"];
     $emailUID = $stuff["msg_uid"];
     $emailMessageID = $stuff["msg_id"];
     $date = $stuff["date"];
     $unit = $stuff["unit"];
     $multiplier = $stuff["multiplier"];
     if ($taskID) {
         $task = new task();
         $task->set_id($taskID);
         $task->select();
         $projectID = $task->get_value("projectID");
         $extra = " for task " . $taskID;
     }
     $projectID or alloc_error(sprintf($errstr . "No project found%s.", $extra));
     $row_projectPerson = projectPerson::get_projectPerson_row($projectID, $current_user->get_id());
     $row_projectPerson or alloc_error($errstr . "The person(" . $current_user->get_id() . ") has not been added to the project(" . $projectID . ").");
     if ($row_projectPerson && $projectID) {
         if ($stuff["timeSheetID"]) {
             $q = prepare("SELECT *\n                        FROM timeSheet\n                       WHERE status = 'edit'\n                         AND personID = %d\n                         AND timeSheetID = %d\n                    ORDER BY dateFrom\n                       LIMIT 1\n                  ", $current_user->get_id(), $stuff["timeSheetID"]);
             $db = new db_alloc();
             $db->query($q);
             $row = $db->row();
             $row or alloc_error("Couldn't find an editable time sheet with that ID.");
         } else {
             $q = prepare("SELECT *\n                        FROM timeSheet\n                       WHERE status = 'edit'\n                         AND projectID = %d\n                         AND personID = %d\n                    ORDER BY dateFrom\n                       LIMIT 1\n                  ", $projectID, $current_user->get_id());
             $db = new db_alloc();
             $db->query($q);
             $row = $db->row();
         }
         // If no timeSheets add a new one
         if (!$row) {
             $project = new project();
             $project->set_id($projectID);
             $project->select();
             $timeSheet = new timeSheet();
             $timeSheet->set_value("projectID", $projectID);
             $timeSheet->set_value("status", "edit");
             $timeSheet->set_value("personID", $current_user->get_id());
             $timeSheet->set_value("recipient_tfID", $current_user->get_value("preferred_tfID"));
             $timeSheet->set_value("customerBilledDollars", page::money($project->get_value("currencyTypeID"), $project->get_value("customerBilledDollars"), "%mo"));
             $timeSheet->set_value("currencyTypeID", $project->get_value("currencyTypeID"));
             $timeSheet->save();
             $timeSheetID = $timeSheet->get_id();
             // Else use the first timesheet we found
         } else {
             $timeSheetID = $row["timeSheetID"];
         }
         $timeSheetID or alloc_error($errstr . "Couldn't locate an existing, or create a new Time Sheet.");
         // Add new time sheet item
         if ($timeSheetID) {
             $timeSheet = new timeSheet();
             $timeSheet->set_id($timeSheetID);
             $timeSheet->select();
             $tsi = new timeSheetItem();
             $tsi->currency = $timeSheet->get_value("currencyTypeID");
             $tsi->set_value("timeSheetID", $timeSheetID);
             $d = $date or $d = date("Y-m-d");
             $tsi->set_value("dateTimeSheetItem", $d);
             $tsi->set_value("timeSheetItemDuration", $duration);
             $tsi->set_value("timeSheetItemDurationUnitID", $unit);
             if (is_object($task)) {
                 $tsi->set_value("description", $task->get_name());
                 $tsi->set_value("taskID", sprintf("%d", $taskID));
                 $_POST["timeSheetItem_taskID"] = sprintf("%d", $taskID);
                 // this gets used in timeSheetItem->save();
             }
             $tsi->set_value("personID", $current_user->get_id());
             $tsi->set_value("rate", page::money($timeSheet->get_value("currencyTypeID"), $row_projectPerson["rate"], "%mo"));
             $tsi->set_value("multiplier", $multiplier);
             $tsi->set_value("comment", $comment);
             $tsi->set_value("emailUID", $emailUID);
             $tsi->set_value("emailMessageID", $emailMessageID);
             $tsi->save();
             $id = $tsi->get_id();
             $tsi = new timeSheetItem();
             $tsi->set_id($id);
             $tsi->select();
             $ID = $tsi->get_value("timeSheetID");
         }
     }
     if ($ID) {
         return array("status" => "yay", "message" => $ID);
     } else {
         alloc_error($errstr . "Time not added.");
     }
 }
开发者ID:cjbayliss,项目名称:alloc,代码行数:93,代码来源:timeSheet.inc.php

示例10: singleton

 function populate_string($str, $entity, $entityID = false)
 {
     // Actually do the text substitution
     $current_user =& singleton("current_user");
     is_object($current_user) and $swap["cu"] = person::get_fullname($current_user->get_id());
     if ($entity == "timeSheet" && $entityID) {
         $timeSheet = new timeSheet();
         $timeSheet->set_id($entityID);
         $timeSheet->select();
         $timeSheet->load_pay_info();
         foreach ($timeSheet->pay_info as $k => $v) {
             $swap[$k] = $v;
         }
         if ($timeSheet->get_value("approvedByManagerPersonID")) {
             $swap["tm"] = person::get_fullname($timeSheet->get_value("approvedByManagerPersonID"));
         } else {
             $project = $timeSheet->get_foreign_object("project");
             $projectManagers = $project->get_timeSheetRecipients();
             if (is_array($projectManagers) && count($projectManagers)) {
                 $people =& get_cached_table("person");
                 foreach ($projectManagers as $pID) {
                     $swap["tm"] .= $commar . $people[$pID]["name"];
                     $commar = ", ";
                 }
             }
         }
         if ($timeSheet->get_value("approvedByAdminPersonID")) {
             $swap["tc"] = person::get_fullname($timeSheet->get_value("approvedByAdminPersonID"));
         } else {
             $people =& get_cached_table("person");
             $timeSheetAdministrators = config::get_config_item('defaultTimeSheetAdminList');
             if (count($timeSheetAdministrators)) {
                 $swap["tc"] = "";
                 $comma = "";
                 foreach ($timeSheetAdministrators as $adminID) {
                     $swap["tc"] .= $comma . $people[$adminID]["name"];
                     $comma = ", ";
                 }
             } else {
                 $swap["tc"] = 'no-one';
             }
         }
         $swap["ti"] = $timeSheet->get_id();
         $swap["to"] = person::get_fullname($timeSheet->get_value("personID"));
         $swap["ta"] = person::get_fullname($timeSheet->get_value("personID"));
         $swap["tf"] = $timeSheet->get_value("dateFrom");
         $swap["tt"] = $timeSheet->get_value("dateTo");
         $swap["ts"] = $timeSheet->get_timeSheet_status();
         $swap["tu"] = config::get_config_item("allocURL") . "time/timeSheet.php?timeSheetID=" . $timeSheet->get_id();
         $projectID = $timeSheet->get_value("projectID");
     }
     if ($entity == "task" && $entityID) {
         $task = new task();
         $task->set_id($entityID);
         $task->select();
         $swap["ti"] = $task->get_id();
         $swap["to"] = person::get_fullname($task->get_value("creatorID"));
         $swap["ta"] = person::get_fullname($task->get_value("personID"));
         $swap["tm"] = person::get_fullname($task->get_value("managerID"));
         $swap["tc"] = person::get_fullname($task->get_value("closerID"));
         $swap["tn"] = $task->get_value("taskName");
         $swap["td"] = $task->get_value("taskDescription");
         $swap["tu"] = config::get_config_item("allocURL") . "task/task.php?taskID=" . $task->get_id();
         $swap["tp"] = $task->get_priority_label();
         $swap["ts"] = $task->get_task_status("label");
         $swap["teb"] = $task->get_value("timeBest");
         $swap["tem"] = $task->get_value("timeExpected");
         $swap["tew"] = $task->get_value("timeWorst");
         $swap["tep"] = person::get_fullname($task->get_value("estimatorID"));
         //time estimate person, when it's implemented
         $projectID = $task->get_value("projectID");
     }
     if ($entity == "project" && $entityID || $projectID) {
         $project = new project();
         if ($projectID) {
             $project->set_id($projectID);
         } else {
             $project->set_id($entityID);
         }
         $project->select();
         $swap["pn"] = $project->get_value("projectName");
         $swap["pi"] = $project->get_id();
         $clientID = $project->get_value("clientID");
     }
     if ($entity == "client" && $entityID || $clientID) {
         $client = new client();
         if ($clientID) {
             $client->set_id($clientID);
         } else {
             $client->set_id($entityID);
         }
         $client->select();
         $swap["li"] = $client->get_id();
         $swap["cc"] = $client->get_value("clientName");
     }
     $swap["cd"] = config::get_config_item("companyContactAddress");
     $swap["cd"] .= " " . config::get_config_item("companyContactAddress2");
     $swap["cd"] .= " " . config::get_config_item("companyContactAddress3");
     $swap["cd"] .= "\nP: " . config::get_config_item("companyContactPhone");
     $swap["cd"] .= "\nF: " . config::get_config_item("companyContactFax");
//.........这里部分代码省略.........
开发者ID:cjbayliss,项目名称:alloc,代码行数:101,代码来源:commentTemplate.inc.php

示例11: import_planner_tasks

function import_planner_tasks($parentNode, $parentTaskId, $depth, $task_allocation, $resource_people, $project_manager_ID)
{
    //Recursively imports tasks from GNOME Planner, given the parentNode.
    global $projectID;
    $current_user =& singleton("current_user");
    $result = array();
    // our dodgy DOM_NodeList doesn't support foreach....
    for ($i = 0; $i < $parentNode->childNodes->length; $i++) {
        $taskXML = $parentNode->childNodes->item($i);
        if ($taskXML->nodeType == XML_ELEMENT_NODE && $taskXML->tagName == "task") {
            $task = new task();
            $task->set_value('taskName', trim($taskXML->getAttribute("name")));
            $task->set_value('projectID', $projectID);
            // We can find the task assignee's id in the $task_allocation array, and that person's Person record in the $resource_people array
            $planner_taskid = $taskXML->getAttribute("id");
            // Dates we guess at (i.e., set to now)
            $task->set_value('dateCreated', date("Y-m-d H:i:s"));
            $task->set_value('dateAssigned', date("Y-m-d H:i:s"));
            if ($taskXML->hasAttribute("work-start")) {
                $task->set_value('dateTargetStart', import_planner_date($taskXML->getAttribute("work-start")));
            } else {
                $task->set_value('dateTargetStart', import_planner_date($taskXML->getAttribute("start")));
                $result[] = "Resorting to work value for " . $task->get_value('taskName');
            }
            $task->set_value('dateTargetCompletion', import_planner_date($taskXML->getAttribute("end")));
            if ($taskXML->hasAttribute("note")) {
                $task->set_value('taskDescription', $taskXML->getAttribute("note"));
            }
            $task->set_value('creatorID', $current_user->get_id());
            $task->set_value('managerID', $project_manager_ID);
            if ($taskXML->hasAttribute("type") and $taskXML->getAttribute("type") == "milestone") {
                $task->set_value('taskTypeID', 'Milestone');
            } else {
                $task->set_value('taskTypeID', 'Task');
            }
            $task->set_value('taskStatus', 'open_notstarted');
            $task->set_value('priority', '3');
            $task->set_value('parentTaskID', $parentTaskId == 0 ? "" : $parentTaskId);
            // The following fields we leave at their default values: duplicateTaskID, dateActualCompletion, dateActualStart, closerID, timeExpected, dateClosed, parentTaskID, taskModifiedUser
            // Handle task assignment
            if (isset($task_allocation[$planner_taskid])) {
                if (is_array($task_allocation[$planner_taskid])) {
                    // This task was assigned to more than one person. Assign it to the project manager and make a comment about it.
                    $task->set_value('personID', $project_manager_ID);
                    // Save the task so we have a task ID
                    $task->save();
                    // Make a comment about this task
                    $comment = new comment();
                    $comment->set_value("commentType", "task");
                    $comment->set_value("commentLinkID", $task->get_id());
                    $comment->set_value("commentCreatedTime", date("Y-m-d H:i:s"));
                    // The user doing the import is (implicitly) the user creating the comment
                    $comment->set_value("commentCreatedUser", $current_user->get_id());
                    // Get the relevant usernames
                    $names = array();
                    foreach ($task_allocation[$planner_taskid] as $assignee) {
                        $names[] = person::get_fullname($assignee);
                    }
                    $comment->set_value("comment", "Import notice: This task was originally assigned to " . implode($names, ', ') . ".");
                    $comment->save();
                    $result[] = sprintf("<li>Note: multiple people were assigned to the task %d %s</li>", $task->get_id(), $task->get_value("taskName"));
                } else {
                    $task->set_value('personID', $resource_people[$task_allocation[$taskXML->getAttribute("id")]]->get_id());
                }
            } else {
                // Task not assigned to anyone, assign the task to the nominated manager
                $task->set_value('personID', $project_manager_ID);
            }
            $task->save();
            $result[] = sprintf('<li>%sCreated task <a href="%s">%d %s</a>.</li>', str_repeat("&gt;", $depth), $task->get_url(), $task->get_id(), $task->get_value('taskName'));
            // Do child nodes
            if ($taskXML->hasChildNodes()) {
                $result = array_merge($result, import_planner_tasks($taskXML, $task->get_id(), $depth + 1, $task_allocation, $resource_people, $project_manager_ID));
            }
        }
    }
    return $result;
}
开发者ID:cjbayliss,项目名称:alloc,代码行数:78,代码来源:import_export.inc.php

示例12: list

 function get_timeSheetItem_list_items($timeSheetID)
 {
     global $TPL;
     list($db, $customerBilledDollars, $timeSheet, $unit_array, $currency) = $this->get_timeSheetItem_vars($timeSheetID);
     $m = new meta("timeSheetItemMultiplier");
     $multipliers = $m->get_list();
     while ($db->next_record()) {
         $timeSheetItem = new timeSheetItem();
         $timeSheetItem->read_db_record($db);
         $row_num++;
         $taskID = sprintf("%d", $timeSheetItem->get_value("taskID"));
         $num = sprintf("%0.2f", $timeSheetItem->get_value("timeSheetItemDuration"));
         $info["total"] += $num;
         $rows[$row_num]["date"] = $timeSheetItem->get_value("dateTimeSheetItem");
         $rows[$row_num]["units"] = $num . " " . $unit_array[$timeSheetItem->get_value("timeSheetItemDurationUnitID")];
         $rows[$row_num]["multiplier_string"] = $multipliers[$timeSheetItem->get_value("multiplier")]["timeSheetItemMultiplierName"];
         unset($str);
         $d = $timeSheetItem->get_value('taskID', DST_HTML_DISPLAY) . ": " . $timeSheetItem->get_value('description', DST_HTML_DISPLAY);
         $d && !$rows[$row_num]["desc"] and $str[] = "<b>" . $d . "</b>";
         // Get task description
         if ($taskID && $TPL["printDesc"]) {
             $t = new task();
             $t->set_id($taskID);
             $t->select();
             $d2 = str_replace("\r\n", "\n", $t->get_value("taskDescription", DST_HTML_DISPLAY));
             $d2 .= "\n";
             $d2 && !$d2s[$taskID] and $str[] = $d2;
             $d2 and $d2s[$taskID] = true;
         }
         $c = str_replace("\r\n", "\n", $timeSheetItem->get_value("comment"));
         !$timeSheetItem->get_value("commentPrivate") && $c and $str[] = page::htmlentities($c);
         is_array($str) and $rows[$row_num]["desc"] .= trim(implode(DEFAULT_SEP, $str));
     }
     $timeSheet->load_pay_info();
     $info["total"] = $timeSheet->pay_info["summary_unit_totals"];
     $rows or $rows = array();
     $info or $info = array();
     return array($rows, $info);
 }
开发者ID:cjbayliss,项目名称:alloc,代码行数:39,代码来源:timeSheetPrint.inc.php

示例13: timeSheetItem

 function edit_timeSheetItem($commands)
 {
     $item_fields = $this->get_fields("item");
     // Time Sheet Item commands
     if ($commands["item"]) {
         $timeSheetItem = new timeSheetItem();
         if ($commands["item"] && strtolower($commands["item"] != "new")) {
             $timeSheetItem->set_id($commands["item"]);
             if (!$timeSheetItem->select()) {
                 alloc_error("Unable to select time sheet item with ID: " . $commands["item"]);
             }
         }
         $timeSheet = $timeSheetItem->get_foreign_object("timeSheet");
         $timeSheetItem->currency = $timeSheet->get_value("currencyTypeID");
         $timeSheetItem->set_value("rate", $timeSheetItem->get_value("rate", DST_HTML_DISPLAY));
         foreach ($commands as $k => $v) {
             // Validate/coerce the fields
             if ($k == "unit") {
                 $changes[$k] = "timeSheetItemDurationUnitID";
                 in_array($v, array(1, 2, 3, 4, 5)) or $err[] = "Invalid unit. Try a number from 1-5.";
             } else {
                 if ($k == "task") {
                     $changes[$k] = "taskID";
                     $t = new task();
                     $t->set_id($v);
                     $t->select();
                     is_object($timeSheet) && $timeSheet->get_id() && $t->get_value("projectID") != $timeSheet->get_value("projectID") and $err[] = "Invalid task. Task belongs to different project.";
                 }
             }
             // Plug the value in
             if ($item_fields[$k][0]) {
                 $changes[$k] = $item_fields[$k][0];
                 $timeSheetItem->set_value($item_fields[$k][0], sprintf("%s", $v));
             }
         }
         $after_label2 = "After:  ";
         if (strtolower($commands["item"]) != "new") {
             $str = $this->condense_changes($changes, $timeSheetItem->row());
             $str and $status[] = "msg";
             $str and $message[] = "Before: " . $str;
         } else {
             $after_label2 = "Fields: ";
         }
         if ($commands["delete"]) {
             $id = $timeSheetItem->get_id();
             $timeSheetItem->delete();
             $status[] = "yay";
             $message[] = "Time sheet item " . $id . " deleted.";
             // Save timeSheetItem
         } else {
             if (!$err && $commands["item"] && $timeSheetItem->save()) {
                 $timeSheetItem->select();
                 $str = $this->condense_changes($changes, $timeSheetItem->row());
                 $str and $status[] = "msg";
                 $str and $message[] = $after_label2 . $str;
                 $status[] = "yay";
                 if (strtolower($commands["item"]) == "new") {
                     $message[] = "Time sheet item " . $timeSheetItem->get_id() . " created.";
                 } else {
                     $message[] = "Time sheet item " . $timeSheetItem->get_id() . " updated.";
                 }
                 // Problems
             } else {
                 if ($err && $commands["item"]) {
                     alloc_error("Problem updating time sheet item: " . implode("\n", (array) $err));
                 }
             }
         }
     }
     return array($status, $message);
 }
开发者ID:cjbayliss,项目名称:alloc,代码行数:71,代码来源:command.inc.php

示例14: task

 function get_effective_person_id($recipient)
 {
     if ($recipient->get_value('personID') == null) {
         //nulls don't come through correctly?
         // OK, slightly more complicated, we need to get the relevant link entity
         $metaperson = -$recipient->get_value('metaPersonID');
         $type = $this->get_value("reminderType");
         if ($type == "task") {
             $task = new task();
             $task->set_id($this->get_value('reminderLinkID'));
             $task->select();
             switch ($metaperson) {
                 case REMINDER_METAPERSON_TASK_ASSIGNEE:
                     return $task->get_value('personID');
                     break;
                 case REMINDER_METAPERSON_TASK_MANAGER:
                     return $task->get_value('managerID');
                     break;
             }
         } else {
             // we should never actually get here...
             alloc_error("Unknown metaperson.");
         }
     } else {
         return $recipient->get_value('personID');
     }
 }
开发者ID:cjbayliss,项目名称:alloc,代码行数:27,代码来源:reminder.inc.php


注:本文中的task::get_value方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。