本文整理汇总了PHP中task::set_value方法的典型用法代码示例。如果您正苦于以下问题:PHP task::set_value方法的具体用法?PHP task::set_value怎么用?PHP task::set_value使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类task
的用法示例。
在下文中一共展示了task::set_value方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
function get_list_summary($_FORM = array())
{
//$_FORM["fromDate"] = "2010-08-20";
//$_FORM["projectID"] = "22";
$_FORM["maxCommentLength"] or $_FORM["maxCommentLength"] = 500;
list($filter1, $filter2, $filter3) = comment::get_list_summary_filter($_FORM);
is_array($filter1) && count($filter1) and $filter1 = " AND " . implode(" AND ", $filter1);
is_array($filter2) && count($filter2) and $filter2 = " AND " . implode(" AND ", $filter2);
is_array($filter3) && count($filter3) and $filter3 = " AND " . implode(" AND ", $filter3);
if ($_FORM["clients"]) {
$client_join = " LEFT JOIN clientContact on comment.commentCreatedUserClientContactID = clientContact.clientContactID";
$client_fields = " , clientContact.clientContactName";
}
$q = prepare("SELECT commentID as id\n , commentCreatedUser as personID\n , UNIX_TIMESTAMP(commentCreatedTime) as sortDate\n , date(commentCreatedTime) as date\n , commentCreatedTime as displayDate\n , commentMasterID as taskID\n , task.taskName\n , SUBSTRING(comment.comment,1,%d) AS comment_text\n , commentCreatedUserText\n " . $client_fields . "\n FROM comment\n LEFT JOIN task on comment.commentMasterID = task.taskID\n " . $client_join . "\n WHERE commentMaster = 'task'\n " . $filter1 . "\n ORDER BY commentCreatedTime, commentCreatedUser", $_FORM["maxCommentLength"]);
$q .= " ";
$people =& get_cached_table("person");
$db = new db_alloc();
$db->query($q);
while ($row = $db->row()) {
$row["icon"] = 'icon-comments-alt';
$row["id"] = "comment_" . $row["id"];
$row["personID"] and $row["person"] = $people[$row["personID"]]["name"];
$row["clientContactName"] and $row["person"] = $row["clientContactName"];
$row["person"] or list($e, $row["person"]) = parse_email_address($row["commentCreatedUserText"]);
$row["displayDate"] = format_date("Y-m-d g:ia", $row["displayDate"]);
if (!$tasks[$row["taskID"]]) {
$t = new task();
$t->set_id($row["taskID"]);
$t->set_value("taskName", $row["taskName"]);
$tasks[$row["taskID"]] = $t->get_task_link(array("prefixTaskID" => true));
}
$rows[$row["taskID"]][$row["sortDate"]][] = $row;
}
// Note that timeSheetItemID is selected twice so that the perms checking can work
// timeSheetID is also used by the perms checking.
$q2 = prepare("SELECT timeSheetItemID as id\n ,timeSheetItemID\n ,timeSheetID\n ,timeSheetItem.personID\n ,dateTimeSheetItem as date\n ,UNIX_TIMESTAMP(CONCAT(dateTimeSheetItem, ' 23:59:58')) as sortDate\n ,dateTimeSheetItem as displayDate\n ,timeSheetItem.taskID\n ,task.taskName\n ,timeSheetItemDuration as duration\n ,SUBSTRING(timeSheetItem.comment,1,%d) AS comment_text\n FROM timeSheetItem\n LEFT JOIN task on timeSheetItem.taskID = task.taskID\n WHERE 1\n " . $filter2 . "\n ORDER BY dateTimeSheetItem", $_FORM["maxCommentLength"]);
$db->query($q2);
while ($row = $db->row()) {
$timeSheetItem = new timeSheetItem();
if (!$timeSheetItem->read_row_record($row)) {
continue;
}
$row["icon"] = 'icon-time';
$row["id"] = "timeitem_" . $row["id"];
$row["person"] = $people[$row["personID"]]["name"];
if (!$tasks[$row["taskID"]]) {
$t = new task();
$t->set_id($row["taskID"]);
$t->set_value("taskName", $row["taskName"]);
$tasks[$row["taskID"]] = $t->get_task_link(array("prefixTaskID" => true));
}
$totals[$row["taskID"]] += $row["duration"];
$rows[$row["taskID"]][$row["sortDate"]][] = $row;
}
// get manager's guestimates about time worked from tsiHint table
$q3 = prepare("SELECT tsiHintID as id\n ,tsiHintID\n ,tsiHint.personID\n ,tsiHint.date\n ,UNIX_TIMESTAMP(CONCAT(tsiHint.date,' 23:59:59')) as sortDate\n ,tsiHint.date as displayDate\n ,tsiHint.taskID\n ,tsiHint.duration\n ,tsiHint.tsiHintCreatedUser\n ,SUBSTRING(tsiHint.comment,1,%d) AS comment_text\n ,task.taskName\n FROM tsiHint\n LEFT JOIN task on tsiHint.taskID = task.taskID\n WHERE 1\n " . $filter3 . "\n ORDER BY tsiHint.date", $_FORM["maxCommentLength"]);
$db->query($q3);
while ($row = $db->row()) {
//$tsiHint = new tsiHint();
//if (!$tsiHint->read_row_record($row))
// continue;
$row["icon"] = 'icon-bookmark-empty';
$row["id"] = "tsihint_" . $row["id"];
$row["person"] = $people[$row["personID"]]["name"];
$row["comment_text"] .= ' [by ' . $people[$row["tsiHintCreatedUser"]]["name"] . ']';
if (!$tasks[$row["taskID"]]) {
$t = new task();
$t->set_id($row["taskID"]);
$t->set_value("taskName", $row["taskName"]);
$tasks[$row["taskID"]] = $t->get_task_link(array("prefixTaskID" => true));
}
$totals_tsiHint[$row["taskID"]] += $row["duration"];
$rows[$row["taskID"]][$row["sortDate"]][] = $row;
}
// If there is a time sheet entry for 2010-10-10 but there is no comment entry
// for that date, then the time sheet entry will appear out of sequence i.e. at
// the very end of the whole list. So we need to manually sort them.
foreach ((array) $rows as $tid => $arr) {
ksort($arr, SORT_NUMERIC);
$rows[$tid] = $arr;
}
foreach ((array) $rows as $taskID => $dates) {
$rtn .= comment::get_list_summary_header($tasks[$taskID], $totals[$taskID], $totals_tsiHint[$taskID], $_FORM);
foreach ($dates as $date => $more_rows) {
foreach ($more_rows as $row) {
$rtn .= comment::get_list_summary_body($row);
}
}
$rtn .= comment::get_list_summary_footer($rows, $tasks);
}
return $rtn;
}
示例2: count
$task->read_globals();
$taskID = $task->get_id();
if (has("project") && $task->get_value("projectID")) {
$project = $task->get_foreign_object("project");
}
}
// if someone uploads an attachment
if ($_POST["save_attachment"]) {
move_attachment("task", $taskID);
alloc_redirect($TPL["url_alloc_task"] . "taskID=" . $taskID . "&sbs_link=attachments");
}
// If saving a record
if ($_POST["save"] || $_POST["save_and_back"] || $_POST["save_and_new"] || $_POST["save_and_summary"] || $_POST["timeSheet_save"] || $_POST["close_task"]) {
$task->read_globals();
if ($_POST["close_task"]) {
$task->set_value("taskStatus", "closed_complete");
}
// If we're auto-nuking the pending tasks, we need to do that before the call to task->save()
if ($task->get_id() && !$_POST["pendingTasksIDs"]) {
$task->add_pending_tasks($_POST["pendingTasksIDs"]);
}
// Moved all validation over into task.inc.php save()
$success = $task->save();
count($msg) and $msg = "&message_good=" . urlencode(implode("<br>", $msg));
if ($success) {
interestedParty::make_interested_parties("task", $task->get_id(), $_POST["interestedParty"]);
// A task can only have a pending task or pending reopen date - pending task is fixed up in JS, but check here too
if ($task->get_value("taskStatus") != "pending_tasks") {
$_POST['pendingTaskIDs'] = '';
}
$task->add_pending_tasks($_POST["pendingTasksIDs"]);
示例3: array
// 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
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();
}
示例4: prepare
function update_children($field, $value = "")
{
$q = prepare("SELECT * FROM task WHERE parentTaskID = %d", $this->get_id());
$db = new db_alloc();
$db->query($q);
while ($db->row()) {
$t = new task();
$t->read_db_record($db);
$t->set_value($field, $value);
$t->save();
if ($t->get_value("taskTypeID") == "Parent") {
$t->update_children($field, $value);
}
}
}
示例5: 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
//.........这里部分代码省略.........
示例6: 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(">", $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;
}
示例7: unset
function edit_task($commands, $email_receive)
{
$task_fields = $this->get_fields("task");
// Task commands
if ($commands["task"]) {
unset($changes);
$taskPriorities = config::get_config_item("taskPriorities") or $taskPriorities = array();
foreach ($taskPriorities as $k => $v) {
$priorities[strtolower($v["label"])] = $k;
}
$people_by_username = person::get_people_by_username();
// Else edit/create the task ...
$task = new task();
if ($commands["task"] && strtolower($commands["task"]) != "new") {
$task->set_id($commands["task"]);
if (!$task->select()) {
alloc_error("Unable to select task with ID: " . $commands["task"]);
}
}
foreach ($commands as $k => $v) {
// transform from username to personID
if ($k == "assign") {
$changes[$k] = "personID";
$v = $people_by_username[$v]["personID"];
$v or alloc_error("Unrecognized username.");
}
if ($k == "manage") {
$changes[$k] = "managerID";
$v = $people_by_username[$v]["personID"];
$v or alloc_error("Unrecognized username.");
}
if ($k == "estimator") {
$changes[$k] = "estimatorID";
$v = $people_by_username[$v]["personID"];
$v or alloc_error("Unrecognized username.");
}
// transform from priority label to priority ID
if ($k == "priority" && !in_array($v, array(1, 2, 3, 4, 5))) {
$v = $priorities[strtolower($v)];
}
// so that --type parent becomes --type Parent
// mysql's referential integrity is case-insensitive :(
if ($k == "type") {
$v = ucwords($v);
}
// Plug the value in
if ($task_fields[$k][0]) {
$changes[$k] = $task_fields[$k][0];
$task->set_value($task_fields[$k][0], sprintf("%s", $v));
}
}
if (isset($commands["pend"])) {
$changes["pend"] = implode(",", (array) $task->get_pending_tasks());
}
if (isset($commands["reopen"])) {
$reopen_rows = $task->get_reopen_reminders();
unset($rr_bits);
foreach ($reopen_rows as $rr) {
$rr_bits[] = $rr["reminderTime"];
}
$changes["reopen"] = implode(",", (array) $rr_bits);
}
if (isset($commands["tags"])) {
$changes["tags"] = implode(",", $task->get_tags());
}
if (strtolower($commands["task"]) == "new") {
if (!$commands["desc"] && is_object($email_receive)) {
$task->set_value("taskDescription", $email_receive->get_converted_encoding());
}
}
$after_label = "After: ";
if (strtolower($commands["task"]) != "new") {
$str = $this->condense_changes($changes, $task->row());
$str and $status[] = "msg";
$str and $message[] = "Before: " . $str;
} else {
$after_label = "Fields: ";
}
// Save task
$err = $task->validate();
if (!$err && $task->save()) {
$task->select();
if (isset($commands["pend"])) {
$task->add_pending_tasks($commands["pend"]);
$changes["pend"] = implode(",", (array) $task->get_pending_tasks());
}
if (isset($commands["reopen"])) {
$task->add_reopen_reminder($commands["reopen"]);
$reopen_rows = $task->get_reopen_reminders();
unset($rr_bits);
foreach ($reopen_rows as $rr) {
$rr_bits[] = $rr["reminderTime"];
}
$changes["reopen"] = implode(",", (array) $rr_bits);
}
if (isset($commands["tags"])) {
$task->add_tags(array($commands["tags"]));
$changes["tags"] = implode(",", $task->get_tags());
}
$str = $this->condense_changes($changes, $task->row());
//.........这里部分代码省略.........
示例8: singleton
function convert_email_to_new_task($email_receive, $change_user = false)
{
global $TPL;
$current_user =& singleton("current_user");
$orig_current_user =& $current_user;
if ($change_user) {
inbox::change_current_user($email_receive->mail_headers["from"]);
$current_user =& singleton("current_user");
if (is_object($current_user) && method_exists($current_user, "get_id") && $current_user->get_id()) {
$personID = $current_user->get_id();
}
}
$email_receive->save_email();
// Subject line is name, email body is body
$task = new task();
$task->set_value("taskName", $email_receive->mail_headers["subject"]);
$task->set_value("taskDescription", $email_receive->mail_text);
$task->set_value("priority", "3");
$task->set_value("taskTypeID", "Task");
$task->save();
if (!$TPL["message"] && $task->get_id()) {
$dir = ATTACHMENTS_DIR . DIRECTORY_SEPARATOR . "task" . DIRECTORY_SEPARATOR . $task->get_id();
if (!is_dir($dir)) {
mkdir($dir);
foreach ((array) $email_receive->mimebits as $file) {
$fh = fopen($dir . DIRECTORY_SEPARATOR . $file["name"], "wb");
fputs($fh, $file["blob"]);
fclose($fh);
}
}
rmdir_if_empty(ATTACHMENTS_DIR . DIRECTORY_SEPARATOR . "task" . DIRECTORY_SEPARATOR . $task->get_id());
$msg = "Created task " . $task->get_task_link(array("prefixTaskID" => true)) . " and moved the email to the task's mail folder.";
$mailbox = "INBOX/task" . $task->get_id();
$email_receive->create_mailbox($mailbox) and $msg .= "\nCreated mailbox: " . $mailbox;
$email_receive->archive($mailbox) and $msg .= "\nMoved email to " . $mailbox;
$msg and $TPL["message_good_no_esc"][] = $msg;
list($from_address, $from_name) = parse_email_address($email_receive->mail_headers["from"]);
$ip["emailAddress"] = $from_address;
$ip["name"] = $from_name;
$ip["personID"] = $personID;
$ip["entity"] = "task";
$ip["entityID"] = $task->get_id();
interestedParty::add_interested_party($ip);
}
// Put current_user back to normal
$current_user =& $orig_current_user;
singleton("current_user", $current_user);
}