phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] tasks/class.base.php, 1.1.2.2


From: nomail
Subject: [Phpgroupware-cvs] tasks/class.base.php, 1.1.2.2
Date: Thu, 20 May 2004 20:57:19 -0000

Update of /tasks
Modified Files:
        Branch: proposal-branch
          class.base.php

date: 2004/04/17 07:16:17;  author: jengo;  state: Exp;  lines: +63 -2

Log Message:
Added in delete task
=====================================================================
No syntax errors detected in -
=====================================================================
Index: tasks/class.base.php
diff -u tasks/class.base.php:1.1.2.1 tasks/class.base.php:1.1.2.2
--- tasks/class.base.php:1.1.2.1        Sat Apr 17 06:24:31 2004
+++ tasks/class.base.php        Sat Apr 17 07:16:17 2004
@@ -457,6 +457,67 @@
                        return $result;
                }
 
+               function delete()
+               {
+                       $args = new safe_args();
+                       $args->set('task_id',REQUIRED,'number');
+                       $args->set('answer',NOVAR,'any');
+                       $args = $args->get(func_get_args());
+
+                       if (! $GLOBALS['phpgw']->acl->check('tasks.' . 
$args['task_id'],PHPGW_ACL_DELETE))
+                       {
+                               
$GLOBALS['phpgw']->interface->access_denied('this record');
+                               return array();
+                       }
+
+                       if ($args['answer'] == NOVAR)
+                       {
+                               $db = $GLOBALS['phpgw']->db->execute("SELECT * 
from phpgw_tasks WHERE task_id='"
+                                       . $args['task_id'] . "'");
+
+                               if ($db->EOF)
+                               {
+                                       $GLOBALS['msgbox']->add(lang('Record 
not found'),'notice');
+                                       return array();
+                               }
+                               $result['task_data'] = 
$this->__get_record(&$db);
+
+                               $result['dialog'] = array
+                               (
+                                       'question' => lang('Are you sure you 
want to delete this task ?'),
+                                       'yes_op'   => 'tasks.base.delete',
+                                       'no_op'    => 'api.statecache.cancel',
+                                       'current_inputs' => array
+                                       (
+                                               0 => array
+                                               (
+                                                       'name'  => 'task_id',
+                                                       'value' => 
$args['task_id']
+                                               )
+                                       )
+                               );
+
+                               $result['action_type'] = 'task_delete';
+                       }
+                       else if ($args['answer'] == 'Yes')
+                       {
+                               $db = $GLOBALS['phpgw']->db->execute("DELETE 
FROM phpgw_tasks WHERE task_id='"
+                                       . $args['task_id'] . "'");
+
+                               if ($GLOBALS['phpgw']->db->affected_rows())
+                               {
+                                       execMethod('api.history.clear','tasks.' 
. $args['task_id']);
+                                       $GLOBALS['msgbox']->add(lang('Task has 
been deleted successfully'),'notice');
+                               }
+                               else
+                               {
+                                       $GLOBALS['msgbox']->add(lang('There was 
a problem deleting this task'),'warning');
+                               }
+                       }
+
+                       return $result;
+               }
+
                function _datamine_get()
                {
                        $args = new safe_args();




reply via email to

[Prev in Thread] Current Thread [Next in Thread]