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


From: nomail
Subject: [Phpgroupware-cvs] tasks/class.base.php, 1.1.2.14
Date: Sun, 11 Jul 2004 06:51:26 +0200

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

date: 2004/07/11 04:51:26;  author: jengo;  state: Exp;  lines: +56 -9

Log Message:
Added nextmatchs
=====================================================================
Index: tasks/class.base.php
diff -u tasks/class.base.php:1.1.2.13 tasks/class.base.php:1.1.2.14
--- tasks/class.base.php:1.1.2.13       Fri Jul  9 06:43:21 2004
+++ tasks/class.base.php        Sun Jul 11 04:51:26 2004
@@ -202,12 +202,49 @@
                }
 
                function start()
-               {
+               {
+                       $args = new safe_args();
+                       $args->set('start',0,'number');
+                       $args->set('search',NOTSET,'sqlsafe');
+                       $args->set('sort',array('desc','asc'),'enum');
+                       $args->set('order','task_subject','string');
+                       $args = $args->get(func_get_args());
+
                        $result['task_data']   = array();
                        $result['action_type'] = 'task_start';
 
                        $dbresult = $GLOBALS['phpgw']->db->execute("
                                SELECT
+                                       count(DISTINCT task_id)
+                               FROM
+                                       phpgw_tasks AS t,
+                                       phpgw_acl   AS a
+                               WHERE
+                               (
+                                               t.acl_id != -1
+                                       AND
+                                               t.acl_id=a.acl_id
+                                       AND
+                                               (1 & acl_rights)=1
+                                       AND
+                                               acl_account=" . 
$GLOBALS['phpgw_data']['user']['id'] . "
+                               )
+                               OR
+                               (
+                                       t.task_owner=" . 
$GLOBALS['phpgw_data']['user']['id'] . "
+                               )
+                               OR
+                               (
+                                       t.task_responsible=" . 
$GLOBALS['phpgw_data']['user']['id'] . "
+                               )
+                               AND
+                                       t.task_dm_type in ('N','S')
+                       ");
+                       $total = $dbresult->fields[0];
+                       
$GLOBALS['phpgw']->interface->handle_nextmatchs($args['start'],$total);
+
+                       $dbresult = $GLOBALS['phpgw']->db->selectlimit("
+                               SELECT
                                        DISTINCT task_id,
                                        task_subject,
                                        task_owner,
@@ -241,17 +278,20 @@
                                        t.task_responsible=" . 
$GLOBALS['phpgw_data']['user']['id'] . "
                                )
                                AND
-                                       t.task_dm_type='N'
-                       ");
+                                       t.task_dm_type in ('N','S')
+                       
",$GLOBALS['phpgw_data']['prefs']['api.maxmatchs'],$args['start']);
 
-                       while (! $dbresult->EOF)
+                       if (is_object($dbresult))
                        {
-                               $result['tasks_data'][] = 
$this->__get_record(&$dbresult);
-                               $dbresult->movenext();
+                               while (! $dbresult->EOF)
+                               {
+                                       $result['tasks_data'][] = 
$this->__get_record(&$dbresult);
+                                       $dbresult->movenext();
+                               }
                        }
 
                        return $result;
-               }
+               }
 
                function set_cache_value($key,$value)
                {
@@ -261,11 +301,18 @@
                        }
                }
 
+               // Temp alias
+               function __cache_value($key,$args)
+               {
+                       $this->__restore_cache_value($key,$args);
+               }
+
                function __restore_cache_value($key,$args)
                {
                        if (strlen($args[$key]))
                        {
-                               $this->set_cache_value($key,$args[$key]);
+                               
$GLOBALS['phpgw_session']['phpgw_data']['statecache']['tasks.base.create'][$key]
 = $value[$key];
+
                                return $args[$key];
                        }
                        else




reply via email to

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