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.3


From: nomail
Subject: [Phpgroupware-cvs] tasks/class.base.php, 1.1.2.3
Date: Thu, 20 May 2004 18:15:07 -0000

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

date: 2004/04/23 05:42:04;  author: jengo;  state: Exp;  lines: +110 -18

Log Message:
Started working on the assigned to portion of the code
=====================================================================
No syntax errors detected in -
=====================================================================
Index: tasks/class.base.php
diff -u tasks/class.base.php:1.1.2.2 tasks/class.base.php:1.1.2.3
--- tasks/class.base.php:1.1.2.2        Sat Apr 17 07:16:17 2004
+++ tasks/class.base.php        Fri Apr 23 05:42:04 2004
@@ -295,9 +295,16 @@
                                                        now(),
                                                        now())");
 
-                                       $dbresult = 
$GLOBALS['phpgw']->db->execute("SELECT * FROM phpgw_tasks "
-                                               . "WHERE task_subject='" . 
$args['subject'] . "' and task_description='" . $args['description']
-                                               . "' ORDER BY task_created 
desc");
+                                       $dbresult = 
$GLOBALS['phpgw']->db->execute("
+                                               SELECT
+                                                       *
+                                               FROM
+                                                       phpgw_tasks
+                                               WHERE
+                                                       task_subject='" . 
$args['subject'] . "'
+                                               AND
+                                                       task_description='" . 
$args['description'] . "'
+                                               ORDER BY task_created desc");
                                        $task_id  = 
$dbresult->fields['task_id'];
 
                                        if ($task_id)
@@ -382,6 +389,16 @@
                        //$GLOBALS['phpgw']->form_lock();
                        $result['current_tab_index'] = $args['select_tab'];
                        $result['action_type'] = 'task_create';
+
+                       $users = $GLOBALS['phpgw']->accounts->list_repository();
+                       foreach ($users as $user)
+                       {
+                               $result['responsible_user_list'][] = array
+                               (
+                                       'id'       => $user['account_id'],
+                                       'name'     => 
$GLOBALS['phpgw']->prefs->_display_account_fullname($user['account_lid'],$user['account_firstname'],$user['account_lastname'])
+                               );
+                       }
 
                        return $result;
                }
@@ -393,15 +410,13 @@
                        $args->set('select_tab',1,'number');
                        $args = $args->get(func_get_args());
 
-                       $dbresult = $GLOBALS['phpgw']->db->execute("SELECT * 
from phpgw_tasks WHERE task_owner="
-                               . $GLOBALS['phpgw_data']['user']['id'] . " AND 
task_id=" . $args['task_id']);
-
+                       $task = $this->_read($args['task_id'],'N');
                        if (! $GLOBALS['phpgw']->acl->check('tasks.' . 
$args['task_id'],PHPGW_ACL_READ))
                        {
                                
$GLOBALS['phpgw']->interface->access_denied('this record');
                                return array();
                        }
-                       else if ($db->EOF)
+                       else if (! is_array($task))
                        {
                                $GLOBALS['msgbox']->add(lang('Record not 
found'),'notice');
                                return array();
@@ -411,7 +426,7 @@
                        $GLOBALS['phpgw']->add_appmenu('Task manager 
menu','Delete task','tasks.base.delete&task_id=' . $args['task_id']);
 
                        $result['action_type']      = 'task_view';
-                       $result['task_data']        = 
$this->__get_record(&$dbresult);
+                       $result['task_data']        = $task;
                        $this->history              = 
createObject('api_history');
                        $this->__set_history_fields();
 
@@ -420,7 +435,6 @@
                        $this->history->field_execMethod['task_priority'] = 
'tasks.base._convert_priority';
                        //$this->history->field_execMethod['task_owner']    = 
'api.accounts.id2name';
 
-                       //echo "TASK: " . $args['task_id'];
                        $result['history_data'] = $this->history->get('tasks.' 
. $args['task_id']);
 
                        if (! $args['select_tab'])
@@ -472,15 +486,13 @@
 
                        if ($args['answer'] == NOVAR)
                        {
-                               $db = $GLOBALS['phpgw']->db->execute("SELECT * 
from phpgw_tasks WHERE task_id='"
-                                       . $args['task_id'] . "'");
-
-                               if ($db->EOF)
+                               $task = $this->_read($args['task_id']);
+                               if (! is_array($task))
                                {
                                        $GLOBALS['msgbox']->add(lang('Record 
not found'),'notice');
                                        return array();
                                }
-                               $result['task_data'] = 
$this->__get_record(&$db);
+                               $result['task_data'] = $task;
 
                                $result['dialog'] = array
                                (
@@ -518,17 +530,97 @@
                        return $result;
                }
 
+               function __update_history($note_id,$_old_values,$_new_values)
+               {
+
+               }
+
+               function _read()
+               {
+                       $args = new safe_args();
+                       $args->set('id',REQUIRED,'number');
+                       $args->set('dm_type','N','string');
+                       $args = $args->get(func_get_args());
+
+                       $dbresult = $GLOBALS['phpgw']->db->execute("
+                               SELECT
+                                       *
+                               FROM
+                                       phpgw_tasks
+                               WHERE
+                                       task_owner=" . 
$GLOBALS['phpgw_data']['user']['id'] . "
+                               AND
+                                       task_id=" . $args['id']);
+
+                       if (! $dbresult->EOF)
+                       {
+                               return false;
+                       }
+                       else
+                       {
+                               return $this->__get_item(&$dbresult);
+                       }
+               }
+
+               function _update()
+               {
+                       $args = new safe_args();
+                       $args->set('id',REQUIRED,'number');
+                       $args->set('dm_type','N','string');
+                       $args->set('subject',NOTSET,'any');
+                       $args->set('category',NOTSET,'any');
+                       $args->set('description',NOTSET,'any');
+                       $args->set('priority',0,'any');
+                       $args->set('start_date',NOTSET,'any');
+                       $args->set('start_time',NOTSET,'any');
+                       $args->set('end_date',NOTSET,'any');
+                       $args->set('end_time',NOTSET,'any');
+                       $args->set('status',NOTSET,'any');
+                       $args->set('access',array('private','public'),'enum');
+                       $args = $args->get(func_get_args());
+
+                       $update_result = $GLOBALS['phpgw']->db->execute("
+                               UPDATE
+                                       phpgw_tasks
+                               SET
+                                       task_subject='" . $args['subject'] . "',
+                                       task_category'" . $args['category'] . 
"',
+                                       task_description'" . 
$args['description'] . "',
+                                       task_priority'" . $args['priority'] . 
"',
+                                       task_start'" . $args['start'] . "',
+                                       task_end'" . $args['end'] . "',
+                                       task_status'" . $args['status'] . "',
+                                       task_access'" . $args['access'] . "',
+                                       task_dm_type'" . $args['dm_type'] . "',
+                                       task_modified=now()
+                               WHERE
+                                       task_id='" . $args['id'] . "'");
+
+                       $this->__update_history($args['id'],$old_values,$args);
+
+                       return ($update_result ? True : False);
+               }
+
                function _datamine_get()
                {
                        $args = new safe_args();
-                       $args->set('task_id',REQUIRED,'number');
+                       $args->set('id',REQUIRED,'number');
                        $args = $args->get(func_get_args());
 
                        $GLOBALS['phpgw']->add_xsl('tasks.widgets');
 
                        // FIXME: This needs ACL check and it needs to check 
for task_dm_type of D
-                       $dbresult = $GLOBALS['phpgw']->db->execute("SELECT * 
from phpgw_tasks WHERE task_owner="
-                               . $GLOBALS['phpgw_data']['user']['id']);
+                       $dbresult = $GLOBALS['phpgw']->db->execute("
+                               SELECT
+                                       *
+                               FROM
+                                       phpgw_tasks
+                               WHERE
+                                       task_owner=" . 
$GLOBALS['phpgw_data']['user']['id'] . "
+                               AND
+                                       task_id=" . $args['id'] . "
+                               AND
+                                       task_dm_type='D'");
 
                        return $this->__get_record(&$dbresult);
                }




reply via email to

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