Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes

ilMailingList Class Reference
[Services/Mail]

Public Member Functions

 __construct (ilObjUser $user, $id=0)
 insert ()
 update ()
 delete ()
 getAssignedEntries ()
 assignAddressbookEntry ($addr_id=0)
 deassignAddressbookEntry ($a_id=0)
 deassignAllEntries ()
 setId ($a_mail_id=0)
 getId ()
 setUserId ($a_user_id=0)
 getUserId ()
 setTitle ($a_title= '')
 getTitle ()
 setDescription ($a_description= '')
 getDescription ()
 setCreatedate ($_createdate= '0000-00-00 00:00:00')
 getCreatedate ()
 setChangedate ($a_changedate= '0000-00-00 00:00:00')
 getChangedate ()

Static Public Member Functions

static _isOwner ($a_ml_id, $a_usr_id)

Private Member Functions

 read ()

Private Attributes

 $mail_id = 0
 $user_id = 0
 $title = ''
 $description = ''
 $createdate = '0000-00-00 00:00:00'
 $changedate = '0000-00-00 00:00:00'
 $user = null
 $db = null

Detailed Description

Author:
Michael Jansen <mjansen@databay.de>
Version:
$Id$

Definition at line 30 of file class.ilMailingList.php.


Constructor & Destructor Documentation

ilMailingList::__construct ( ilObjUser user,
id = 0 
)

Definition at line 42 of file class.ilMailingList.php.

References ilObject::getId(), and read().

        {
                global $ilDB;

                $this->db = $ilDB;
                $this->user = $user;
                
                $this->mail_id = $id;
                $this->user_id = $this->user->getId();
                
        
                $this->read();
        }

Here is the call graph for this function:


Member Function Documentation

static ilMailingList::_isOwner ( a_ml_id,
a_usr_id 
) [static]

Definition at line 256 of file class.ilMailingList.php.

Referenced by ilMailingListsGUI::mailToList(), ilMailingListsGUI::performDelete(), ilMailingListsGUI::performDeleteMembers(), ilMailingListsGUI::saveAssignmentForm(), ilMailingListsGUI::saveForm(), ilMailingListsGUI::showAssignmentForm(), and ilMailingListsGUI::showForm().

        {
                global $ilDB;
                
                $query = "SELECT * FROM addressbook_mailing_lists "
                                ."WHERE 1 "
                                ."AND ml_id = " . $ilDB->quote($a_ml_id) . " "
                                ."AND user_id = " . $ilDB->quote($a_usr_id) . " ";

                $row = $ilDB->getRow($query);
                
                return is_object($row) ? true : false;
        }

Here is the caller graph for this function:

ilMailingList::assignAddressbookEntry ( addr_id = 0  ) 

Definition at line 171 of file class.ilMailingList.php.

        {
                $query = "INSERT INTO addressbook_mailing_lists_assignments "
                                ."(a_id, ml_id, addr_id) "
                                ."VALUES ( "
                                ."'', "
                                .$this->db->quote($this->mail_id).", "
                                .$this->db->quote($addr_id)." "
                                .") ";
                $this->db->query($query);
                
                return true;
        }

ilMailingList::deassignAddressbookEntry ( a_id = 0  ) 

Definition at line 185 of file class.ilMailingList.php.

        {
                $query = "DELETE FROM addressbook_mailing_lists_assignments "
                                ."WHERE 1 "
                                ."AND a_id = " . $this->db->quote($a_id) . " ";
                
                $this->db->query($query);
                
                return true;
        }

ilMailingList::deassignAllEntries (  ) 

Definition at line 196 of file class.ilMailingList.php.

Referenced by delete().

        {
                $query = "DELETE FROM addressbook_mailing_lists_assignments "
                                ."WHERE 1 "
                                ."AND ml_id = " . $this->db->quote($this->mail_id) . " ";
                
                $this->db->query($query);
                
                return true;
        }

Here is the caller graph for this function:

ilMailingList::delete (  ) 

Definition at line 98 of file class.ilMailingList.php.

References deassignAllEntries().

        {
                if ($this->mail_id && $this->user_id)
                {
                        $this->deassignAllEntries();
                        
                        $query = "DELETE FROM addressbook_mailing_lists "
                                        ."WHERE 1 "
                                        ."AND ml_id = " . $this->db->quote($this->mail_id) . " "
                                        ."AND user_id = " . $this->db->quote($this->user_id) . " ";
                        
                        $this->db->query($query);
                        
                        return true;
                }
                else
                {
                        return false;
                }               
        }

Here is the call graph for this function:

ilMailingList::getAssignedEntries (  ) 

Definition at line 144 of file class.ilMailingList.php.

References $res.

        {
                $query = "SELECT * FROM addressbook_mailing_lists_assignments "
                                ."INNER JOIN addressbook ON addressbook.addr_id = addressbook_mailing_lists_assignments.addr_id "
                                ."WHERE 1 "
                                ."AND ml_id = " . $this->db->quote($this->mail_id) . " ";
                $res = $this->db->query($query);

                $entries = array();
                
                $counter = 0;
                while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
                {                       
                        $entries[$counter] = array('a_id' => $row->a_id, 
                                                                           'addr_id' => $row->addr_id,
                                                                           'login' => $row->login,
                                                                           'email' => $row->email,
                                                                           'firstname' => $row->firstname,
                                                                           'lastname' => $row->lastname                                                                    
                                                                           );
                        
                        ++$counter;
                }
                
                return $entries;
        }

ilMailingList::getChangedate (  ) 

Definition at line 251 of file class.ilMailingList.php.

        {
                return $this->changedate;
        }

ilMailingList::getCreatedate (  ) 

Definition at line 243 of file class.ilMailingList.php.

        {
                return $this->createdate;
        }

ilMailingList::getDescription (  ) 

Definition at line 235 of file class.ilMailingList.php.

        {
                return $this->description;
        }

ilMailingList::getId (  ) 

Definition at line 211 of file class.ilMailingList.php.

        {
                return $this->mail_id;
        }

ilMailingList::getTitle (  ) 

Definition at line 227 of file class.ilMailingList.php.

        {
                return $this->title;
        }

ilMailingList::getUserId (  ) 

Definition at line 219 of file class.ilMailingList.php.

        {
                return $this->user_id;
        }

ilMailingList::insert (  ) 

Definition at line 56 of file class.ilMailingList.php.

        {
                $query = "INSERT INTO addressbook_mailing_lists "
                                ."(ml_id, user_id, title, description, createdate, changedate) "
                                ."VALUES ( "
                                ."'', "
                                .$this->db->quote($this->user_id).", "
                                .$this->db->quote($this->title).", "
                                .$this->db->quote($this->description).", "
                                .$this->db->quote($this->createdate).", "
                                ."'' "
                                .") ";
                $this->db->query($query);       
                
                $this->mail_id = $this->db->getLastInsertId();
                
                return true;
        }

ilMailingList::read (  )  [private]

Definition at line 119 of file class.ilMailingList.php.

Referenced by __construct().

        {               
                if ($this->mail_id && $this->user_id)
                {
                        $query = "SELECT * FROM addressbook_mailing_lists "
                                        ."WHERE 1 "
                                        ."AND ml_id = " . $this->db->quote($this->mail_id) . " "
                                        ."AND user_id = " . $this->db->quote($this->user_id) . " ";
        
                        $row = $this->db->getRow($query);
        
                        if (is_object($row))
                        {
                                $this->mail_id = $row->ml_id;
                                $this->user_id = $row->user_id;
                                $this->title = $row->title;
                                $this->description = $row->description;
                                $this->createdate = $row->createdate;
                                $this->changedate = $row->changedae;            
                        }
                }
                
                return true;
        }

Here is the caller graph for this function:

ilMailingList::setChangedate ( a_changedate = '0000-00-00 00:00:00'  ) 

Definition at line 247 of file class.ilMailingList.php.

                                                                    :00:00')
        {
                $this->changedate = $a_changedate;
        }

ilMailingList::setCreatedate ( _createdate = '0000-00-00 00:00:00'  ) 

Definition at line 239 of file class.ilMailingList.php.

                                                                   :00:00')
        {
                $this->createdate = $_createdate;
        }

ilMailingList::setDescription ( a_description = ''  ) 

Definition at line 231 of file class.ilMailingList.php.

        {
                $this->description = $a_description;
        }

ilMailingList::setId ( a_mail_id = 0  ) 

Definition at line 207 of file class.ilMailingList.php.

        {
                $this->mail_id = $a_mail_id;
        }

ilMailingList::setTitle ( a_title = ''  ) 

Definition at line 223 of file class.ilMailingList.php.

        {
                $this->title = $a_title;
        }

ilMailingList::setUserId ( a_user_id = 0  ) 

Definition at line 215 of file class.ilMailingList.php.

        {
                $this->user_id = $a_user_id;
        }

ilMailingList::update (  ) 

Definition at line 75 of file class.ilMailingList.php.

        {
                if ($this->mail_id && $this->user_id)
                {
                        $query = "UPDATE addressbook_mailing_lists "
                                        ."SET "                         
                                        ."title = " . $this->db->quote($this->title) . ", "
                                        ."description = " . $this->db->quote($this->description) . ", "
                                        ."changedate = " . $this->db->quote($this->changedate) . " "
                                        ."WHERE 1 "
                                        ."AND ml_id = " . $this->db->quote($this->mail_id) . " "
                                        ."AND user_id = " . $this->db->quote($this->user_id). " ";
                                        
                        $this->db->query($query);
                        
                        return true;
                }
                else
                {
                        return false;
                }
        }


Field Documentation

ilMailingList::$changedate = '0000-00-00 00:00:00' [private]

Definition at line 37 of file class.ilMailingList.php.

ilMailingList::$createdate = '0000-00-00 00:00:00' [private]

Definition at line 36 of file class.ilMailingList.php.

ilMailingList::$db = null [private]

Definition at line 40 of file class.ilMailingList.php.

ilMailingList::$description = '' [private]

Definition at line 35 of file class.ilMailingList.php.

ilMailingList::$mail_id = 0 [private]

Definition at line 32 of file class.ilMailingList.php.

ilMailingList::$title = '' [private]

Definition at line 34 of file class.ilMailingList.php.

ilMailingList::$user = null [private]

Definition at line 39 of file class.ilMailingList.php.

ilMailingList::$user_id = 0 [private]

Definition at line 33 of file class.ilMailingList.php.


The documentation for this class was generated from the following file: