/** * 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; }
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; }
/** * 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(); } }
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>"; } }
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; }
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); } }
/** * 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); } }
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; }
public function __construct() { parent::__construct(); //set step order $this->step_order = array('first', 'users_auths', 'config_news_log', 'events', 'multidkp', 'members', 'raids', 'items', 'adjustments', 'dkp_check', 'infopages', 'plugins_portal'); $this->use_steps = true; $this->parse_only = false; }
/** * 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); // }
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; } }
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."); } }
public function post_delete($id) { try { $delete = task::find($id); $delete->delete(); return Redirect::action('page1controller@get_index'); } catch (Exception $e) { return $e; } }
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"; } }
public function init_lang() { if (isset($this->langs[$this->user->data['user_lang']])) { $lang = $this->langs[$this->user->data['user_lang']]; } elseif (isset($this->langs[$this->default_lang])) { $lang = $this->langs[$this->default_lang]; } if (!isset($lang)) { parent::init_lang(); } else { $this->lang = $lang; } }
/** * 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; }
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; }
function show_projects($template_name) { global $TPL; global $default; $_FORM = task::load_form_data($defaults); $arr = task::load_task_filter($_FORM); is_array($arr) and $TPL = array_merge($TPL, $arr); if (is_array($_FORM["projectID"])) { $projectIDs = $_FORM["projectID"]; foreach ($projectIDs as $projectID) { $project = new project(); $project->set_id($projectID); $project->select(); $_FORM["projectID"] = array($projectID); $TPL["graphTitle"] = urlencode($project->get_value("projectName")); $arr = task::load_task_filter($_FORM); is_array($arr) and $TPL = array_merge($TPL, $arr); include_template($template_name); } } }
* 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();
* This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ***************************************************************************/ ####################################################################### ## check login again if (!$loginInst->id) { echo $lang['common_accessDenied'] . "\n"; exit; } $taskInst = new task(); if (tool::securePost('action') == "save") { $taskId = tool::securePost('taskid'); } if ($taskId) { $taskInst->activate($taskId); } else { $taskId = tool::secureGet('taskid'); $taskInst->activate($taskId); } if (!$taskInst->id) { echo "no task found.\n"; exit; } $projectInst = new project($taskInst->projectId); $userInst = new user($taskInst->userId);
* * You should have received a copy of the GNU Affero General Public License * along with allocPSA. If not, see <http://www.gnu.org/licenses/>. */ define("NO_REDIRECT", 1); require_once "../alloc.php"; //usleep(1000); $t = timeSheetItem::parse_time_string($_REQUEST["time_item"]); $timeUnit = new timeUnit(); $units = $timeUnit->get_assoc_array("timeUnitID", "timeUnitLabelA"); $timeSheetItemMultiplier = new meta("timeSheetItemMultiplier"); $tsims = $timeSheetItemMultiplier->get_list(); foreach ($t as $k => $v) { if ($v) { if ($k == "taskID") { $task = new task(); $task->set_id($v); if ($task->select()) { $v = $task->get_id() . " " . $task->get_link(); } else { $v = "Task " . $v . " not found."; } } else { if ($k == "unit") { $v = $units[$v]; } else { if ($k == "multiplier") { $v = $tsims[sprintf("%0.2f", $v)]["timeSheetItemMultiplierName"]; } } }
$db = new db_alloc(); $display = array("", "username", ", ", "emailAddress"); $person = new person(); $people =& get_cached_table("person"); foreach ($people as $p) { $peeps[$p["personID"]] = $p["name"]; } // get the default time sheet manager/admin options $TPL["defaultTimeSheetManagerListText"] = get_person_list(config::get_config_item("defaultTimeSheetManagerList")); $TPL["defaultTimeSheetAdminListText"] = get_person_list(config::get_config_item("defaultTimeSheetAdminList")); $days = array("Sun" => "Sun", "Mon" => "Mon", "Tue" => "Tue", "Wed" => "Wed", "Thu" => "Thu", "Fri" => "Fri", "Sat" => "Sat"); $TPL["calendarFirstDayOptions"] = page::select_options($days, config::get_config_item("calendarFirstDay")); $TPL["timeSheetPrintOptions"] = page::select_options($TPL["timeSheetPrintOptions"], $TPL["timeSheetPrint"]); $commentTemplate = new commentTemplate(); $ops = $commentTemplate->get_assoc_array("commentTemplateID", "commentTemplateName"); $TPL["rssStatusFilterOptions"] = page::select_options(task::get_task_statii_array(true), config::get_config_item("rssStatusFilter")); if (has("timeUnit")) { $timeUnit = new timeUnit(); $rate_type_array = $timeUnit->get_assoc_array("timeUnitID", "timeUnitLabelB"); } $TPL["timesheetRate_options"] = page::select_options($rate_type_array, config::get_config_item("defaultTimeSheetUnit")); $TPL["main_alloc_title"] = "Setup - " . APPLICATION_NAME; include_template("templates/configM.tpl"); function get_person_list($personID_array) { global $peeps; $people = array(); foreach ($personID_array as $personID) { $people[] = $peeps[$personID]; } if (count($people) > 0) {
// } // } $data['chapter_id'] = $mapData['chapter']; $data['page'] = $mapData['page']; $data['chapter_info'] = json_encode($data['chapter_info']); $res = $this->get_data('PlayerFB')->update_player_fb($player_id, $data); var_dump($res); } } } } } if (!empty($_POST)) { $player_id = $_POST['player_id']; $task_id = $_POST['task_id']; $obj = new task(); $obj->run($player_id, $task_id); // $obj->open_func($player_id,$task_id); } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE> Clear Task</TITLE> <META NAME="Generator" CONTENT="EditPlus"> <META NAME="Author" CONTENT=""> <META NAME="Keywords" CONTENT=""> <META NAME="Description" CONTENT=""> <style> span{
/** * Run a task. This will trigger the task to do a small amount of work, then it will report * back with status on the task. * @param string $task_id */ public function run($task_id) { access::verify_csrf(); try { $task = task::run($task_id); } catch (Exception $e) { Kohana::log("error", sprintf("%s in %s at line %s:\n%s", $e->getMessage(), $e->getFile(), $e->getLine(), $e->getTraceAsString())); throw $e; } if ($task->done) { switch ($task->state) { case "success": log::success("tasks", t("Task %task_name completed (task id %task_id)", array("task_name" => $task->name, "task_id" => $task->id)), html::anchor("admin/maintenance", t("maintenance"))); message::success(t("Task completed successfully")); break; case "error": log::error("tasks", t("Task %task_name failed (task id %task_id)", array("task_name" => $task->name, "task_id" => $task->id)), html::anchor("admin/maintenance", t("maintenance"))); message::success(t("Task failed")); break; } print json_encode(array("result" => "success", "task" => array("percent_complete" => $task->percent_complete, "status" => $task->status, "done" => $task->done), "location" => url::site("admin/maintenance"))); } else { print json_encode(array("result" => "in_progress", "task" => array("percent_complete" => $task->percent_complete, "status" => $task->status, "done" => $task->done))); } }
/** * checks whether an existing parent task is set to done * @return true if parent task is done, otherwise false */ function isParentDone() { if (!isset($this->mountId) || $this->mountId == 0) { return true; } $task = new task($this->mountId); if ($task->isDone()) { return true; } return false; }
/** * [Discuz!] (C)2001-2099 Comsenz Inc. * This is NOT a freeware, use is subject to license terms * * $Id: home_task.php 6976 2010-03-27 08:32:32Z zhengqingpeng $ */ if (!defined('IN_DISCUZ')) { exit('Access Denied'); } require_once libfile('function/spacecp'); if (!$_G['setting']['taskon'] && $_G['adminid'] != 1) { showmessage('task_close'); } require_once libfile('class/task'); $tasklib =& task::instance(); $id = intval($_G['gp_id']); $do = empty($_GET['do']) ? '' : $_GET['do']; if (empty($_G['uid'])) { showmessage('to_login', 'member.php?mod=logging&action=login', array(), array('showmsg' => true, 'login' => 1)); } if (empty($do)) { $_G['gp_item'] = empty($_G['gp_item']) ? 'new' : $_G['gp_item']; $actives = array($_G['gp_item'] => ' class="a"'); $tasklist = $tasklib->tasklist($_G['gp_item']); $listdata = $tasklib->listdata; } elseif ($do == 'view' && $id) { $allowapply = $tasklib->view($id); $task =& $tasklib->task; $taskvars =& $tasklib->taskvars; } elseif ($do == 'apply' && $id) {
<?php session_start(); require_once "config.php"; $obj = new task(); $obj->checkUser(); $done = 0; $cat = new task(); if (isset($_POST["submit"])) { if ($cat->EditCategory()) { $done = 1; } } if (isset($_GET["id"])) { $catid = $_GET["id"]; $cat->connect(); $query = "select * from categories where catid='{$catid}'"; $data = mysqli_query($cat->con, $query); $row = mysqli_fetch_array($data); extract($row); } require_once "headincludes.php"; ?> <body> <!-- topbar starts --> <?php require_once "topbar.php"; ?> <!-- topbar ends --> <div class="container-fluid"> <div class="row-fluid">
$server = 'mysql:host=localhost;dbname=to_do'; $username = '******'; $password = '******'; $DB = new PDO($server, $username, $password); $app->register(new Silex\Provider\TwigServiceProvider(), array('twig.path' => __DIR__ . '/../views')); $app->get("/", function () use($app) { return $app['twig']->render('index.html.twig'); }); $app->get("/tasks", function () use($app) { return $app['twig']->render('tasks.html.twig', array('tasks' => Task::getAll())); }); $app->get("/categories", function () use($app) { return $app['twig']->render('categories.html.twig', array('categories' => Category::getAll())); }); $app->post("/tasks", function () use($app) { $task = new task($_POST['description']); $task->save(); return $app['twig']->render('tasks.html.twig', array('tasks' => Task::getAll())); }); $app->post("/delete_tasks", function () use($app) { Task::deleteAll(); return $app['twig']->render('index.html.twig'); }); $app->post("/categories", function () use($app) { $category = new Category($_POST['name']); $category->save(); return $app['twig']->render('categories.html.twig', array('categories' => Category::getAll())); }); $app->post("/delete_categories", function () use($app) { Category::deleteAll(); return $app['twig']->render('index.html.twig');
function runTask($task_id) { access::verify_csrf(); $task = task::run($task_id); if (!$task->loaded || $task->owner_id != user::active()->id) { access::forbidden(); } print json_encode(array("result" => $task->done ? $task->state : "in_progress", "task" => array("id" => $task->id, "percent_complete" => $task->percent_complete, "type" => $task->get("type"), "post_process" => $task->get("post_process"), "status" => $task->status, "state" => $task->state, "done" => $task->done))); }
<?php require_once 'config.php'; session_start(); $obj = new task(); $obj->checkUser(); $admin_id = $_GET["admin_id"]; $query = "select * from admins where admin_id='{$admin_id}'"; $obj->query($query); $obj->nextRecord(); require_once "headincludes.php"; ?> <body> <!-- topbar starts --> <?php require_once "topbar.php"; ?> <!-- topbar ends --> <div class="container-fluid"> <div class="row-fluid"> <!-- left menu starts --> <div class="span2 main-menu-span"> <div class="well nav-collapse sidebar-nav"> <?php require_once "sidemenu.php"; ?> </div><!--/.well --> </div><!--/span--> <!-- left menu ends -->