本文整理汇总了PHP中task类的典型用法代码示例。如果您正苦于以下问题:PHP task类的具体用法?PHP task怎么用?PHP task使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了task类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildCal
/**
* Populates the array of calendar information
*
* @return array
*/
private function buildCal()
{
$counter = 0;
$ms = new milestone();
$tsk = new task();
for ($j = 0; $j < $this->weeksInMonth; $j++) {
for ($i = 0; $i < 7; $i++) {
$counter++;
$theday = $counter - $this->firstDay;
if ($theday < 1) {
$this->calendar[$j][$i]["val"] = $this->daysLastMonth + $theday;
$this->calendar[$j][$i]["currmonth"] = 0;
} elseif ($theday > $this->daysInMonth) {
$this->calendar[$j][$i]["val"] = $theday - $this->daysInMonth;
$this->calendar[$j][$i]["currmonth"] = 0;
} else {
$miles = $ms->getTodayMilestones($this->month, $this->year, $theday, $this->project);
$milesnum = count($miles);
$tasks = $tsk->getTodayTasks($this->month, $this->year, $theday, $this->project);
$tasksnum = count($tasks);
$this->calendar[$j][$i] = array("val" => $theday, "milestones" => $miles, "milesnum" => $milesnum, "tasks" => $tasks, "tasksnum" => $tasksnum, "currmonth" => 1);
}
}
}
return $this;
}
示例2: get_list
public static function get_list($_FORM)
{
/*
*
* Get a list of task history items with sophisticated filtering and somewhat sophisticated output
*
* (n.b., the output from this generally needs to be post-processed to handle the semantic meaning of changes in various fields)
*
*/
$filter = audit::get_list_filter($_FORM);
if (is_array($filter) && count($filter)) {
$where_clause = " WHERE " . implode(" AND ", $filter);
}
if ($_FORM["projectID"]) {
$entity = new project();
$entity->set_id($_FORM["projectID"]);
$entity->select();
} else {
if ($_FORM["taskID"]) {
$entity = new task();
$entity->set_id($_FORM["taskID"]);
$entity->select();
}
}
$q = "SELECT *\n FROM audit\n {$where_clause}\n ORDER BY dateChanged";
$db = new db_alloc();
$db->query($q);
$items = array();
while ($row = $db->next_record()) {
$audit = new audit();
$audit->read_db_record($db);
$rows[] = $row;
}
return $rows;
}
示例3: get_task_comments
/**
* Get all the commments on a task
* @param string $taskID
* @return array an array of comments
*/
public function get_task_comments($taskID)
{
if ($taskID) {
$task = new task();
$task->set_id($taskID);
$task->select();
return $task->get_task_comments_array();
}
}
示例4: show_tasks
function show_tasks()
{
$current_user =& singleton("current_user");
global $tasks_date;
list($ts_open, $ts_pending, $ts_closed) = task::get_task_status_in_set_sql();
$q = prepare("SELECT * \n FROM task \n WHERE (task.taskStatus NOT IN (" . $ts_closed . ") AND task.taskTypeID = 'Message') \n AND (personID = %d) \n ORDER BY priority\n ", $current_user->get_id());
$db = new db_alloc();
$db->query($q);
while ($db->next_record()) {
$task = new task();
$task->read_db_record($db);
echo $br . $task->get_task_image() . $task->get_task_link(array("return" => "html"));
$br = "<br>";
}
}
示例5: start
static function start($task_callback, $context = array())
{
$tasks = task::get_definitions();
$task = task::create($tasks[$task_callback], array());
$task->log(t("Task %task_name started (task id %task_id)", array("task_name" => $task->name, "task_id" => $task->id)));
return $task;
}
示例6: show_task_children
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);
}
}
示例7: gallery_shutdown
/**
* At this point, the output has been sent to the browser, so we can take some time
* to run a schedule task.
*/
static function gallery_shutdown()
{
try {
$schedule = ORM::factory("schedule")->where("next_run_datetime", "<=", time())->where("busy", "!=", 1)->order_by("next_run_datetime")->find_all(1);
if ($schedule->count()) {
$schedule = $schedule->current();
$schedule->busy = true;
$schedule->save();
try {
if (empty($schedule->task_id)) {
$task = task::start($schedule->task_callback);
$schedule->task_id = $task->id;
}
$task = task::run($schedule->task_id);
if ($task->done) {
$schedule->next_run_datetime += $schedule->interval;
$schedule->task_id = null;
}
$schedule->busy = false;
$schedule->save();
} catch (Exception $e) {
$schedule->busy = false;
$schedule->save();
throw $e;
}
}
} catch (Exception $e) {
Kohana_Log::add("error", (string) $e);
}
}
示例8: listTasksByUser
function listTasksByUser($inuserid)
{
$tasks = array();
$dbhandle = db_connect();
$query = "SELECT TaskID FROM Tasks WHERE Lister={$inuserid}";
$result = $dbhandle->query($query);
while ($row = $result->fetch_array()) {
$newtask = new task();
$newtask->getFromDB($row['TaskID']);
if ($newtask->active == 0) {
continue;
}
array_push($tasks, $newtask);
}
$dbhandle->close();
return $tasks;
}
示例9: show
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
$tasks = task::find($id);
if (!$tasks) {
return Response::json(['error' => ['message' => 'Task does not exist', 'code' => 195]], 404);
}
return Response::json(['data' => $this->transform($tasks->toArray())], 200);
//
}
示例10: GET
public function GET($id)
{
if (!task::IFDELETED($id)) {
$getQuery = "SELECT \r\n\t\t\t\t\tid,\r\n\t\t\t\t\tname,\r\n\t\t\t\t\tconvert(varchar(max), description) as description, \r\n\t\t\t\t\tinsert_datetime, \r\n\t\t\t\t\tdeadlineDate, \r\n\t\t\t\t\tfinishedDate, \r\n\t\t\t\t\tgiver_userID, \r\n\t\t\t\t\tdoer_userID, \r\n\t\t\t\t\tpriorityID, \r\n\t\t\t\t\tstatusID, \r\n\t\t\t\t\tsiteID\r\n\t\t\t\tFROM \r\n\t\t\t\t\t[dbo].[task] \r\n\t\t\t\tWHERE \r\n\t\t\t\t\tid={$id};";
$row = mssql_fetch_array(mssql_query($getQuery));
$result = new task($row["id"], $row["name"], $row["description"], $row["insert_datetime"], $row["deadlineDate"], $row["finishedDate"], $row["giver_userID"], $row["doer_userID"], $row["priorityID"], $row["statusID"], $row["siteID"]);
return $result;
}
}
示例11: add_tsiHint
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.");
}
}
示例12: post_delete
public function post_delete($id)
{
try {
$delete = task::find($id);
$delete->delete();
return Redirect::action('page1controller@get_index');
} catch (Exception $e) {
return $e;
}
}
示例13: newEntry
public function newEntry()
{
if (user::accessLevel($_COOKIE['id']) == 1) {
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
task::INSERT($_POST['name'], $_POST['description'], $_POST['deadlineDate'], $_POST['giver_userID'], $_POST['doer_userID'], $_POST['priorityID'], $_POST['statusID'], $_POST['siteID']);
//header("Location: /task");
} else {
taskController::loadView('new', $args = array());
}
} else {
echo "You have no access";
}
}
示例14: index
/**
* Show a list of all available, running and finished tasks.
*/
public function index()
{
$query = db::build()->update("tasks")->set("state", "stalled")->where("done", "=", 0)->where("state", "<>", "stalled")->where(new Database_Expression("UNIX_TIMESTAMP(NOW()) - `updated` > 15"))->execute();
$stalled_count = $query->count();
if ($stalled_count) {
log::warning("tasks", t2("One task is stalled", "%count tasks are stalled", $stalled_count), t('<a href="%url">view</a>', array("url" => html::mark_clean(url::site("admin/maintenance")))));
}
$view = new Admin_View("admin.html");
$view->page_title = t("Maintenance tasks");
$view->content = new View("admin_schedule.html");
$view->content->task_definitions = task::get_definitions();
$view->content->running_tasks = ORM::factory("task")->where("done", "=", 0)->order_by("updated", "DESC")->find_all();
$view->content->finished_tasks = ORM::factory("task")->where("done", "=", 1)->order_by("updated", "DESC")->find_all();
$view->content->schedule_definitions = scheduler::get_definitions();
print $view;
}
示例15: render
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;
}