本文整理汇总了PHP中Task::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Task::delete方法的具体用法?PHP Task::delete怎么用?PHP Task::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Task
的用法示例。
在下文中一共展示了Task::delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testDelete
function testDelete()
{
//Arrange
$name = "Work stuff";
$id = 1;
$test_category = new Category($name, $id);
$test_category->save();
$description = "File reports";
$id2 = 2;
$test_task = new Task($description, $id2);
$test_task->save();
//Act
$test_task->addCategory($test_category);
$test_task->delete();
//Assert
$this->assertEquals([], $test_category->getTasks());
}
示例2: Task
<?php
require_once 'inc/init.php';
$task_id = $_GET['task-id'];
$task = new Task();
$task->load('id = ?', [$task_id]);
if ($task->delete()) {
Response::write('message', 'Task deleted');
} else {
Response::write('status', false);
Response::write('message', 'Task failed to delete.');
}
Response::output();
示例3: edit
//.........这里部分代码省略.........
} else {
$query = "insert into healingcrystals_assignments_action_request (user_id, is_action_request, is_fyi, selected_by_user_id, comment_id, date_added) values ('" . $id . "', '0', '1', '" . $this->logged_user->getId() . "', '" . $this->active_comment->getId() . "', now())";
mysql_query($query);
}
}
}*/
$existing_ar_users = array();
$new_ar_users = array();
if (!empty($action_request_user_id)) {
foreach ($action_request_user_id as $id) {
$query = "select * from healingcrystals_assignments_action_request where comment_id='" . $this->active_comment->getId() . "' and user_id='" . $id . "'";
$result = mysql_query($query);
if (mysql_num_rows($result)) {
$info = mysql_fetch_assoc($result);
if ($info['is_action_request'] == '1') {
$existing_ar_users[] = $id;
} else {
$query = "update healingcrystals_assignments_action_request set is_action_request='1' where comment_id='" . $this->active_comment->getId() . "' and user_id='" . $id . "'";
mysql_query($query);
$new_ar_users[] = $id;
}
} else {
$query = "insert into healingcrystals_assignments_action_request (user_id, is_action_request, is_fyi, selected_by_user_id, comment_id, date_added) values ('" . $id . "', '1', '0', '" . $this->logged_user->getId() . "', '" . $this->active_comment->getId() . "', now())";
mysql_query($query);
$new_ar_users[] = $id;
}
}
$query = "update healingcrystals_assignments_action_request set is_action_request='0' where comment_id='" . $this->active_comment->getId() . "' and user_id not in (" . implode(', ', $action_request_user_id) . ")";
mysql_query($query);
} else {
$query = "update healingcrystals_assignments_action_request set is_action_request='0' where comment_id='" . $this->active_comment->getId() . "'";
mysql_query($query);
}
mysql_query("delete from healingcrystals_assignments_action_request where comment_id='" . $this->active_comment->getId() . "' and is_action_request='0' and is_fyi='0' and marked_for_email='0'");
//EOF:task_1260
foreach ($action_request_users as $id) {
if (!in_array($id, $existing_ar_users)) {
//unassign
$query = "select object_id from actionrequests_to_tasklist where comment_id='" . $this->active_comment->getId() . "' and user_id='" . $id . "' and type='Task'";
$result = mysql_query($query);
if (mysql_num_rows($result)) {
$info = mysql_fetch_assoc($result);
$task = new Task($info['object_id']);
$task->delete();
mysql_query("delete from actionrequests_to_tasklist where comment_id='" . $this->active_comment->getId() . "' and user_id='" . $id . "' and type='Task'");
}
}
}
foreach ($new_ar_users as $id) {
//assign
//BOF:mod 20130429
/*
//EOF:mod 20130429
$priority = '0';
$query = "select * from healingcrystals_assignments_action_request where comment_id='" . $this->active_comment->getId() . "' and user_id='" . $id . "'";
$result = mysql_query($query, $link);
if (mysql_num_rows($result)){
$query1 = "update healingcrystals_assignments_action_request set is_action_request='1', priority_actionrequest='" . $priority . "' where comment_id='" . $this->active_comment->getId() . "' and user_id='" . $id . "'";
mysql_query($query1, $link);
} else {
$query1 = "insert into healingcrystals_assignments_action_request (user_id, is_action_request, is_fyi, selected_by_user_id, comment_id, date_added, priority_actionrequest) values ('" . $id . "', '1', '0', '" . $this->logged_user->getId() . "', '" . $this->active_comment->getId() . "', now(), '" . $priority . "')";
mysql_query($query1, $link);
}
//BOF:mod 20130429
*/
//EOF:mod 20130429
示例4: TaskList
}*/
$tasklist = new TaskList();
$tasklist->setUserId(Authentication::getUserObject()->getId());
$tasklist->setName($_POST['name']);
$tasklist->setIcon($_POST['icon']);
$tasklist->save();
echo json_encode(array('status' => 'success', 'tasklist-id' => $tasklist->getId()));
} else {
echo json_encode(array('status' => 'error', 'reason' => 'List name not supplied.'));
}
} else {
if ($_POST['action'] == "delete_list") {
if (isset($_POST['id'])) {
$list = TaskList::get($where = array('id' => $_POST['id']))[0];
foreach (Task::get($where = array('list_id' => $list->getId())) as $task) {
$task->delete();
}
$list->delete();
echo json_encode(array('status' => 'success'));
}
} else {
if ($_POST['action'] == "delete_task") {
if (isset($_POST['id'])) {
$task = Task::get($where = array('id' => $_POST['id']));
if (!empty($task)) {
$task[0]->delete();
echo json_encode(array('status' => 'success'));
die;
} else {
echo json_encode(array('status' => 'error', 'reason' => 'That task does not exist!'));
die;
示例5: delete
public function delete()
{
$this->output->set_content_type('application/json');
$url = $this->uri->ruri_to_assoc(3);
$task_id = isset($url['task_id']) ? intval($url['task_id']) : 0;
if ($task_id !== 0) {
$this->_transaction_isolation();
$this->db->trans_begin();
$task = new Task();
$task->get_by_id($task_id);
$task->delete();
$this->lang->delete_overlays('tasks', intval($task_id));
if ($this->db->trans_status()) {
$this->db->trans_commit();
$this->output->set_output(json_encode(TRUE));
$this->_action_success();
} else {
$this->db->trans_rollback();
$this->output->set_output(json_encode(FALSE));
}
} else {
$this->output->set_output(json_encode(FALSE));
}
}
示例6: testDeleteTask
function testDeleteTask()
{
// Arrange
$name = "Home stuff";
$id = 1;
$test_category = new Category($name, $id);
$test_category->save();
$description = "Wash the dog";
$id2 = 2;
$due_date = "2016-02-29";
$test_task = new Task($description, $id2, $due_date);
$test_task->save();
// Act
$test_task->addCategory($test_category);
$test_task->delete();
// Assert
$this->assertEquals([], $test_category->getTasks());
}
示例7: Task
}
}
if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == "yes" && $user->rights->projet->supprimer)
{
$task = new Task($db);
if ($task->fetch($_GET["id"]) >= 0 )
{
$projet = new Project($db);
$result=$projet->fetch($task->fk_projet);
if (! empty($projet->socid))
{
$projet->societe->fetch($projet->socid);
}
if ($task->delete($user) > 0)
{
Header("Location: index.php");
exit;
}
else
{
$langs->load("errors");
$mesg='<div class="error">'.$langs->trans($task->error).'</div>';
$_POST["action"]='';
}
}
}
/*
示例8: strip_tags
<?php
$id = strip_tags($_POST['id']);
if (!empty($id)) {
require '../Models/Task.php';
Task::delete($id);
}
示例9:
{
$action='edit';
}
}
if ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->projet->supprimer)
{
if ($object->fetch($id) >= 0 )
{
$result=$projectstatic->fetch($object->fk_projet);
if (! empty($projectstatic->socid))
{
$projectstatic->societe->fetch($projectstatic->socid);
}
if ($object->delete($user) > 0)
{
Header("Location: index.php");
exit;
}
else
{
$langs->load("errors");
$mesg='<div class="error">'.$langs->trans($object->error).'</div>';
$action='';
}
}
}
// Retreive First Task ID of Project if withprojet is on to allow project prev next to work
if (! empty($project_ref) && ! empty($withproject))
示例10: testDelete
function testDelete()
{
$name = "Work stuff";
$id = 1;
$test_category = new Category($name, $id);
$test_category->save();
$description = "File reports";
$id2 = 2;
$due_date = "2000-01-01";
$test_task = new Task($description, $id2, $due_date);
$test_task->save();
$test_task->addCategory($test_category);
$test_task->delete();
$this->assertEquals([], $test_category->getTasks());
}
示例11: destroy
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/
public function destroy(Project $project, Task $task)
{
$task->delete();
return Redirect::route('projects.show', $project->slug)->with('message', 'Task deleted.');
}
示例12: Category
function test_delete()
{
//Arrange
$name = "Work stuff";
$test_category = new Category($name);
$test_category->save();
$description = "File reports";
$due_date = "2014-09-08";
$test_task = new Task($description, $due_date);
$test_task->save();
//Act
$test_task->addCategory($test_category);
$test_task->delete();
//Assert
$this->assertEquals([], $test_category->getTasks());
}
示例13: trim
// Archive task
if (isset($_GET['archive'])) {
$task_id = trim($_GET['archive']);
$archive = Task::update_fields($task_id, array('archived' => 1));
if ($archive) {
$session->message('<p class="success">You have successfully archived that task.</p>');
redirect_to($_SERVER['HTTP_REFERER']);
} else {
$session->message('<p class="error">There was an error archiving that task.</p>');
redirect_to($_SERVER['HTTP_REFERER']);
}
}
// Delete task
if (isset($_GET['delete'])) {
$task_id = trim($_GET['delete']);
$delete = Task::delete($_SESSION['user_id'] . '_Tasks', $task_id);
$delete2 = Context::delete_by_task($task_id);
if ($delete) {
$session->message('<p class="success">You have successfully deleted that task.</p>');
redirect_to($_SERVER['HTTP_REFERER']);
} else {
$session->message('<p class="error">There was an error deleting that task.</p>');
redirect_to($_SERVER['HTTP_REFERER']);
}
}
// Send password link
if (isset($_POST['reset_password'])) {
include APP_DIR . DS . 'run' . DS . 'reset-password.php';
}
// Reset password
if (isset($_POST['new_password'])) {
示例14: testDeleteTask
function testDeleteTask()
{
//Arrange
$name = "Work stuff";
$id = 1;
$test_category = new Category($name, $id);
$test_category->save();
$description2 = "Water the lawn";
$id2 = 2;
$due_date2 = "3094-09-21";
$test_task2 = new Task($description2, $id2, $due_date2);
$test_task2->save();
//Act
$test_task2->addCategory($test_category);
$test_task2->delete();
//Assert
$this->assertEquals([], $test_category->getTasks());
}
示例15: delete
function delete(&$PDOdb)
{
global $db, $user, $conf;
$sql = 'DELETE FROM ' . MAIN_DB_PREFIX . 'element_element WHERE fk_source = ' . (int) $this->rowid . ' AND sourcetype = "tassetworkstationof" AND (targettype = "user" OR targettype = "task")';
$PDOdb->Execute($sql);
if ($this->fk_project_task > 0) {
require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT . '/projet/class/task.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/modules/project/task/' . $conf->global->PROJECT_TASK_ADDON . '.php';
if (!$user->id) {
$user->id = GETPOST('user_id');
}
$projectTask = new Task($db);
$projectTask->fetch($this->fk_project_task);
$projectTask->delete($user);
}
parent::delete($PDOdb);
}