[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] [20910] New feature : preferences for notifications
From: |
Pascal Vilarem |
Subject: |
[Phpgroupware-cvs] [20910] New feature : preferences for notifications |
Date: |
Tue, 05 Jan 2010 17:36:55 +0000 |
Revision: 20910
http://svn.sv.gnu.org/viewvc/?view=rev&root=phpgroupware&revision=20910
Author: maat
Date: 2010-01-05 17:36:55 +0000 (Tue, 05 Jan 2010)
Log Message:
-----------
New feature : preferences for notifications
Modified Paths:
--------------
modules/ged/trunk/inc/class.ged_dm.inc.php
Modified: modules/ged/trunk/inc/class.ged_dm.inc.php
===================================================================
--- modules/ged/trunk/inc/class.ged_dm.inc.php 2010-01-05 17:24:12 UTC (rev
20909)
+++ modules/ged/trunk/inc/class.ged_dm.inc.php 2010-01-05 17:36:55 UTC (rev
20910)
@@ -3683,9 +3683,130 @@
return ($out);
}
-
+
function get_project_status($project_root)
{
}
+
+ /**
+ * Get GED Preference
+ *
+ * @return array of preference
+ */
+ function get_ged_preference ()
+ {
+
+
+ //TODO : limiter en fonction des droits
+ $sql="select preference_value from phpgw_preferences where
preference_app = 'ged' and preference_owner =
".$GLOBALS['phpgw_info']['user']['account_id'];
+ $this->db->query($sql, __LINE__, __FILE__);
+
+ $this->db->next_record();
+ $array = unserialize($this->db->f('preference_value'));
+
+ $this->db->unlock();
+
+ return $array;
+ }
+
+ function add_reject($project,$action)
+ {
+ $new_reject=array('project' => $project,'action' => $action);
+ $sql="select * from phpgw_preferences where preference_app =
'flow_mail_ged' and preference_owner =
".$GLOBALS['phpgw_info']['user']['account_id'];
+ $this->db->query($sql, __LINE__, __FILE__);
+
+
+ if($this->db->next_record())
+ {
+ $value = unserialize($this->db->f('preference_value'));
+ $value[count($value)]=$new_reject;
+
+ $sql2="UPDATE phpgw_preferences SET
preference_value='".serialize($value)."' where preference_app = 'flow_mail_ged'
and preference_owner = ".$GLOBALS['phpgw_info']['user']['account_id'];
+ }
+ else
+ {
+ $value=array(0 => $new_reject);
+ $sql2="INSERT INTO phpgw_preferences
(preference_value,preference_app,preference_owner) values
('".serialize($value)."','flow_mail_ged',".$GLOBALS['phpgw_info']['user']['account_id'].")";
+ }
+
+ $this->db->query($sql2);
+
+ $this->db->unlock();
+
+ }
+
+ function list_ged_reject ($user='')
+ {
+
+ if($user =='')
+ $user=$GLOBALS['phpgw_info']['user']['account_id'];
+ //TODO : limiter en fonction des droits
+ $sql="select preference_value from phpgw_preferences where
preference_app = 'flow_mail_ged' and preference_owner = ".$user;
+ $this->db->query($sql, __LINE__, __FILE__);
+
+ $this->db->next_record();
+ $array = unserialize($this->db->f('preference_value'));
+
+ $this->db->unlock();
+
+ return $array;
+ }
+
+ function remove_reject($i)
+ {
+
+ $sql="select * from phpgw_preferences where preference_app =
'flow_mail_ged' and preference_owner =
".$GLOBALS['phpgw_info']['user']['account_id'];
+ $this->db->query($sql, __LINE__, __FILE__);
+ $new_tab=array();
+ $cpt=0;
+ if($this->db->next_record())
+ {
+ $values = unserialize($this->db->f('preference_value'));
+ foreach($values as $key => $value)
+ {
+
+ if($key != $i)
+ $new_tab[$cpt++]=$value;
+ }
+
+
+ $sql2="UPDATE phpgw_preferences SET
preference_value='".serialize($new_tab)."' where preference_app =
'flow_mail_ged' and preference_owner =
".$GLOBALS['phpgw_info']['user']['account_id'];
+ }
+ else
+ {
+ return false;
+ }
+
+ $this->db->query($sql2);
+
+ $this->db->unlock();
+
+ }
+
+ function notification_filter($user,$project,$action)
+ {
+
+ $user_pref = createObject('phpgwapi.preferences');
+ $user_pref->preferences($user);
+
+ $data = $user_pref->read();
+ if(!isset($data['email']['address']))
+ return false;
+ $list_project = $data['ged']['show_projects'];
+ $list_reject = $data['flow_mail_ged'];
+ if(!isset($list_project[$project]))
+ return false;
+ foreach($list_reject as $reject)
+ {
+ if($reject['project'] == 0 && $reject['action'] ==
$action)
+ return false;
+ if($reject['project'] == $project && $reject['action']
== $action)
+ return false;
+ }
+
+ return $data['email']['address'];
+
+ }
+
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] [20910] New feature : preferences for notifications,
Pascal Vilarem <=