| [ Index ] |
|
Code source de eGroupWare 1.2.106-2 |
1 <?php 2 /**************************************************************************\ 3 * eGroupWare SiteMgr - Web Content Management * 4 * http://www.egroupware.org * 5 * -------------------------------------------- * 6 * This program is free software; you can redistribute it and/or modify it * 7 * under the terms of the GNU General Public License as published by the * 8 * Free Software Foundation; either version 2 of the License, or (at your * 9 * option) any later version. * 10 \**************************************************************************/ 11 12 /* $Id: class.notification_so.inc.php 20295 2006-02-15 12:31:25Z $ */ 13 14 class notification_so 15 { 16 var $db; 17 18 function notification_so() 19 { 20 $this->db = clone($GLOBALS['egw']->db); 21 $this->db->set_app('sitemgr'); 22 $this->notifications_table = 'egw_sitemgr_notifications'; 23 $this->messages_table = 'egw_sitemgr_notify_messages'; 24 } 25 26 function create_notification($email,$all_langs) 27 { 28 $values=array( 29 'site_id' => $GLOBALS['sitemgr_info']['site_id'], 30 'email' => $email 31 ); 32 if (!$all_langs) { 33 $values['site_language'] = $GLOBALS['sitemgr_info']['userlang']; 34 } 35 $this->db->insert($this->notifications_table,$values,False,__LINE__,__FILE__); 36 37 return $this->db->get_last_insert_id($this->notifications_table,'notification_id'); 38 } 39 40 function delete_notifications($email) 41 { 42 $this->db->delete($this->notifications_table,array('email'=>$email),__LINE__,__FILE__); 43 } 44 45 function get_notifications($site_id,$lang) 46 { 47 $this->db->select($this->notifications_table,array('email'), 48 'site_id='.$site_id." AND site_language='".$lang."'", 49 __LINE__,__FILE__); 50 51 while($this->db->next_record()) 52 { 53 $result[] = $this->db->f('email'); 54 } 55 56 $this->db->select($this->notifications_table,array('email'), 57 'site_id='.$site_id." AND site_language ='all'", 58 __LINE__,__FILE__); 59 60 while($this->db->next_record()) 61 { 62 $result[] = $this->db->f('email'); 63 } 64 65 return $result; 66 } 67 68 function get_message($site_id,$lang,$def_lang) 69 { 70 $this->db->select($this->messages_table,array('message','subject'), 71 'site_id='.$site_id." AND language='".$lang."'", 72 __LINE__,__FILE__); 73 74 if($this->db->next_record()) 75 { 76 return $this->db->Query_ID->fields; 77 } 78 79 //language not found, try default language 80 $this->db->select($this->messages_table,array('message','subject'), 81 'site_id='.$site_id." AND language='".$def_lang."'", 82 __LINE__,__FILE__); 83 84 if($this->db->next_record()) 85 { 86 return $this->db->Query_ID->fields; 87 } 88 89 //even default language not found, state the default text 90 return False; 91 } 92 93 function get_permissions($cat_id) 94 { 95 $account=$GLOBALS['egw']->accounts->name2id( 96 $GLOBALS['Common_BO']->sites->current_site['anonymous_user']); 97 98 if ($account == $GLOBALS['egw_info']['user']['account_id']) 99 { 100 $acl =& $GLOBALS['egw']->acl; 101 } 102 else 103 { 104 $acl =& CreateObject('phpgwapi.acl',$account); 105 $acl->read_repository(); 106 } 107 return $acl->get_rights('L'.$cat_id,'sitemgr'); 108 } 109 } 110
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
| Généré le : Sun Feb 25 17:20:01 2007 | par Balluche grâce à PHPXref 0.7 |