本文整理汇总了PHP中Tasks::updateTask方法的典型用法代码示例。如果您正苦于以下问题:PHP Tasks::updateTask方法的具体用法?PHP Tasks::updateTask怎么用?PHP Tasks::updateTask使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tasks
的用法示例。
在下文中一共展示了Tasks::updateTask方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct(Site $site, &$session, $post)
{
$tasks = new Tasks($site);
$user = $session[User::SESSION_NAME];
$root = $site->getRoot();
if (isset($post['add'])) {
$day = strip_tags($post['day']);
$title = strip_tags($post['title']);
$notes = strip_tags($post['notes']);
$notes = $notes === null ? '' : $notes;
$priority = strip_tags($post['priority']);
$row = array("id" => 0, "day" => $day, "title" => $title, "notes" => $notes, "priority" => $priority);
$task = new Task($row);
$tasks->addTask($user->getId(), $task);
$this->redirect = "/tasks.php";
return;
}
if (isset($post['edit'])) {
$id = strip_tags($post['id']);
$day = strip_tags($post['day']);
$title = strip_tags($post['title']);
$notes = strip_tags($post['notes']);
$notes = $notes === null ? '' : $notes;
$priority = strip_tags($post['priority']);
$row = array("id" => $id, "day" => $day, "title" => $title, "notes" => $notes, "priority" => $priority);
$task = new Task($row);
$tasks->updateTask($user->getId(), $task);
$this->redirect = "/tasks.php";
return;
}
if (isset($post['delete'])) {
$id = strip_tags($post['id']);
$tasks->deleteTask($user->getId(), $id);
$this->redirect = "/tasks.php";
return;
}
}
示例2: Tasks
if (isset($_REQUEST['id'])) {
include_once "Tasks.php";
$obj_task = new Tasks();
$tid = $_REQUEST['id'];
$tname = $_REQUEST['taskname'];
$tdesc = $_REQUEST['description'];
$start_date = $_REQUEST['sdate'];
$end_date = $_REQUEST['edate'];
$loc = $_REQUEST['location'];
/**
* A method to check is the task is successfully updated
*
*@param string $tid id of the task
*@param varchar $name name of the task
*@param varchar description of task
*@param date $s_date start date of the job
*@param date $e_date end date of the job
*@param string $location location of job
*@return Task successfully updated or update not successful
*/
if (!$obj_task->updateTask('$tid', '$tname', '$tdesc', '$start_date', '$end_date', '$loc')) {
echo "The task was not updated";
} else {
echo "A task was successfully updated";
}
}
?>
</body>
</html>