Changeset 413 for trunk/expressoMail1_2/inc/class.db_functions.inc.php
- Timestamp:
- 09/11/08 16:42:44 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/expressoMail1_2/inc/class.db_functions.inc.php
r205 r413 3 3 define('PHPGW_API_INC','../phpgwapi/inc'); 4 4 include_once(PHPGW_API_INC.'/class.db.inc.php'); 5 5 include_once('class.dynamic_contacts.inc.php'); 6 6 7 class db_functions 7 8 { … … 142 143 } 143 144 144 function get_dropdown_contacts(){ 145 function get_dropdown_contacts() 146 { 147 $dynamic_contact = new dynamic_contacts(); 145 148 146 149 $contacts = $this -> get_cc_contacts(); 147 150 $groups = $this -> get_cc_groups(); 151 $dynamic = $dynamic_contact->dynamic_contact_toString(); 148 152 149 153 if(($contacts) && ($groups)) … … 155 159 elseif ((!$contacts) && ($groups)) 156 160 $stringDropDownContacts = $groups; 157 161 if (($dynamic) && (($groups) || ($contacts))) 162 $stringDropDownContacts .= ',' . $dynamic; 163 else 164 if ($dynamic) 165 $stringDropDownContacts = $dynamic; 166 158 167 return $stringDropDownContacts; 159 168 } … … 257 266 return $result; 258 267 } 268 269 function get_dynamic_contacts() 270 { 271 // Pesquisa os emails e ultima inserção nos contatos dinamicos. 272 if(!$this->db->select('phpgw_expressomail_contacts','data', 273 'id_owner ='.$this -> user_id, 274 __LINE__,__FILE__)) 275 { 276 return $this->db->Error; 277 } 278 while($this->db->next_record()) 279 { 280 $result[] = $this->db->row(); 281 } 282 foreach($result as $item) 283 { 284 $contacts = unserialize($item['data']); 285 } 286 if (count($contacts) == 0) 287 { 288 return null; 289 } 290 return $contacts; 291 } 292 293 function update_contacts($contacts=array()) 294 { 295 // Atualiza um email nos contatos dinamicos. 296 if(!$this->db->update('phpgw_expressomail_contacts ','data=\''.serialize($contacts).'\'', 297 'id_owner ='.$this -> user_id, 298 __LINE__,__FILE__)) 299 { 300 return $this->db->Error; 301 } 302 return $contacts; 303 } 304 305 function insert_contact($contact) 306 { 307 $contacts[] = array( 'timestamp' => time(), 308 'email' => $contact ); 309 310 // Insere um email nos contatos dinamicos. 311 $query = 'INSERT INTO phpgw_expressomail_contacts (data, id_owner) ' . 312 'values ( \''.serialize($contacts).'\', '.$this->user_id.')'; 313 314 if(!$this->db->query($query,__LINE__,__FILE__)) 315 return $this->db->Error; 316 return $contacts; 317 } 318 319 function remove_dynamic_contact($user_id,$line,$file) 320 { 321 $where = $user_id.' = id_owner'; 322 $this->db->delete('phpgw_expressomail_contacts',$where,$line,$file); 323 } 259 324 } 260 325 ?>
Note: See TracChangeset
for help on using the changeset viewer.