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

ilPDMailBlockGUI Class Reference

BlockGUI class for Personal Desktop Mail block. More...

Inheritance diagram for ilPDMailBlockGUI:
Collaboration diagram for ilPDMailBlockGUI:

Public Member Functions

 ilPDMailBlockGUI ()
 Constructor.
executeCommand ()
 execute command
 getHTML ()
 Get HTML.
 getMails ()
 Get Mails.
 fillDataSection ()
 Fill data section.
 fillRow ($mail)
 get flat bookmark list for personal desktop
 getOverview ()
 Get overview.
 showMail ()
 show mail
 deleteMail ()
 delete mail

Static Public Member Functions

static getBlockType ()
 Get block type.
static isRepositoryObject ()
 Get block type.
static getScreenMode ()
 Get Screen Mode for current command.

Static Public Attributes

static $block_type = "pdmail"

Detailed Description

BlockGUI class for Personal Desktop Mail block.

Author:
Alex Killing <alex.killing@gmx.de>
Version:
$Id$

ilPDMailBlockGUI: ilColumnGUI

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


Member Function Documentation

ilPDMailBlockGUI::deleteMail (  ) 

delete mail

Definition at line 308 of file class.ilPDMailBlockGUI.php.

References $_GET, $_SESSION, $ilCtrl, $lng, and ilUtil::sendInfo().

        {
                global $lng, $ilCtrl;
                
                $lng->loadLanguageModule('mail');
                
                $umail = new ilMail($_SESSION['AccountId']);
                $mbox = new ilMailBox($_SESSION['AccountId']);

                // IF THERE IS NO OBJ_ID GIVEN GET THE ID OF MAIL ROOT NODE
                if(!$_GET['mobj_id'])
                {
                        $_GET['mobj_id'] = $mbox->getInboxFolder();
                }

                if ($umail->moveMailsToFolder(array($_GET['mail_id']),
                        $mbox->getTrashFolder()))
                {
                        ilUtil::sendInfo($lng->txt('mail_moved_to_trash'), true);
                }
                else
                {
                        ilUtil::sendInfo($lng->txt('mail_move_error'), true);
                }
                $ilCtrl->redirectByClass('ilpersonaldesktopgui', 'show');
        }

Here is the call graph for this function:

& ilPDMailBlockGUI::executeCommand (  ) 

execute command

Definition at line 99 of file class.ilPDMailBlockGUI.php.

References $cmd, and $ilCtrl.

        {
                global $ilCtrl;

                $next_class = $ilCtrl->getNextClass();
                $cmd = $ilCtrl->getCmd("getHTML");

                return $this->$cmd();
        }

ilPDMailBlockGUI::fillDataSection (  ) 

Fill data section.

Reimplemented from ilBlockGUI.

Definition at line 162 of file class.ilPDMailBlockGUI.php.

References ilBlockGUI::getCurrentDetailLevel(), getMails(), getOverview(), ilBlockGUI::setColSpan(), ilBlockGUI::setData(), ilBlockGUI::setDataSection(), ilBlockGUI::setEnableDetailRow(), ilBlockGUI::setEnableNumInfo(), and ilBlockGUI::setRowTemplate().

        {
                $this->getMails();
                $this->setData($this->mails);

                if ($this->getCurrentDetailLevel() > 1 && count($this->mails) > 0)
                {
                        $this->setRowTemplate("tpl.pd_mail_row.html", "Services/Mail");
                        if ($this->getCurrentDetailLevel() > 2)
                        {
                                $this->setColSpan(2);
                        }
                        parent::fillDataSection();
                }
                else
                {
                        $this->setEnableNumInfo(false);
                        if (count($this->mails) == 0)
                        {
                                $this->setEnableDetailRow(false);
                        }
                        $this->setDataSection($this->getOverview());
                }
        }

Here is the call graph for this function:

ilPDMailBlockGUI::fillRow ( mail  ) 

get flat bookmark list for personal desktop

Reimplemented from ilBlockGUI.

Definition at line 190 of file class.ilPDMailBlockGUI.php.

References $ilCtrl, $lng, $user, ilMail::_getAnonymousName(), ilObjUser::_lookupPref(), ilFormat::formatDate(), and ilBlockGUI::getCurrentDetailLevel().

        {
                global $ilUser, $ilCtrl, $lng;

                // GET SENDER NAME
                $user = new ilObjUser($mail["sender_id"]);              
                if ($this->getCurrentDetailLevel() > 2)
                {
                        $this->tpl->setCurrentBlock("image");
                        $this->tpl->setVariable("IMG_SENDER", $user->getPersonalPicturePath("xxsmall"));
                        $this->tpl->setVariable("ALT_SENDER", $user->getLogin());
                        $this->tpl->parseCurrentBlock();
                        $this->tpl->setCurrentBlock("long");
                        if($mail['sender_id'] != ANONYMOUS_USER_ID)
                        {
                                if(ilObjUser::_lookupPref($mail['sender_id'], 'public_profile') == 'y')
                                {
                                        if(!($fullname = $user->getFullname()))
                                        {
                                                $fullname = $lng->txt("unknown");
                                        }
                                        $this->tpl->setVariable("NEW_MAIL_FROM", $fullname);
                                }
                                $this->tpl->setVariable("NEW_MAIL_FROM_LOGIN", $user->getLogin());
                        }
                        else
                        {
                                $this->tpl->setVariable('NEW_MAIL_FROM_LOGIN', ilMail::_getAnonymousName());                            
                        }
                        $this->tpl->setVariable('NEW_MAIL_DATE', ilFormat::formatDate($mail['send_time'], 'date', true));
                        $this->tpl->setVariable("TXT_FROM", $lng->txt("from"));
                        $this->tpl->parseCurrentBlock();
                }
                else
                {
                        if($mail['sender_id'] != ANONYMOUS_USER_ID)
                        {
                                $this->tpl->setCurrentBlock('short');
                                $this->tpl->setVariable('NEW_MAIL_FROM_LOGIN', $user->getLogin());
                                $this->tpl->parseCurrentBlock();
                        }
                        else
                        {
                                $this->tpl->setCurrentBlock('short');
                                $this->tpl->setVariable('NEW_MAIL_FROM_LOGIN', ilMail::_getAnonymousName());
                                $this->tpl->parseCurrentBlock();
                        }
                }
                
                $this->tpl->setVariable("NEW_MAIL_SUBJ", htmlentities($mail["m_subject"],ENT_NOQUOTES,'UTF-8'));
                $ilCtrl->setParameter($this, "mobj_id", $inbox);
                $ilCtrl->setParameter($this, "mail_id", $mail["mail_id"]);
                $ilCtrl->setParameter($this, "mail_mode", $this->mail_mode);
                $this->tpl->setVariable("NEW_MAIL_LINK_READ",
                        $ilCtrl->getLinkTarget($this, "showMail"));
                $ilCtrl->clearParameters($this);
        }

Here is the call graph for this function:

static ilPDMailBlockGUI::getBlockType (  )  [static]

Get block type.

Returns:
string Block type.

Reimplemented from ilBlockGUI.

Reimplemented in ilPDSysMessageBlockGUI.

Definition at line 64 of file class.ilPDMailBlockGUI.php.

        {
                return self::$block_type;
        }

ilPDMailBlockGUI::getHTML (  ) 

Get HTML.

Reimplemented from ilBlockGUI.

Reimplemented in ilPDSysMessageBlockGUI.

Definition at line 109 of file class.ilPDMailBlockGUI.php.

References ilBlockGUI::getCurrentDetailLevel().

        {
                global $ilUser, $rbacsystem;
                
                $umail = new ilMail($ilUser->getId());          
                if(!$rbacsystem->checkAccess('mail_visible', $umail->getMailObjectReferenceId()))
                {
                        return '';
                }
                
                if ($this->getCurrentDetailLevel() == 0)
                {
                        return '';
                }
                else
                {
                        $html = parent::getHTML();
                        return $html;
                }
        }

Here is the call graph for this function:

ilPDMailBlockGUI::getMails (  ) 

Get Mails.

Reimplemented in ilPDSysMessageBlockGUI.

Definition at line 133 of file class.ilPDMailBlockGUI.php.

References $_SESSION.

Referenced by fillDataSection().

        {
                global $ilUser;
                
                // BEGIN MAILS
                $umail = new ilMail($_SESSION["AccountId"]);
                $mbox = new ilMailBox($_SESSION["AccountId"]);
                $inbox = $mbox->getInboxFolder();
                
                //SHOW MAILS FOR EVERY USER
                $mail_data = $umail->getMailsOfFolder($inbox);
                $mail_counter = $umail->getMailCounterData();
                $unreadmails = 0;
        
                $this->mails = array();
                foreach ($mail_data as $mail)
                {
                        //ONLY NEW MAILS WOULD BE ON THE PERSONAL DESKTOP
                        if($mail["m_status"] == 'unread' &&
                                in_array('normal',$mail['m_type']))
                        {
                                $this->mails[] = $mail;
                        }
                }
        }

Here is the caller graph for this function:

ilPDMailBlockGUI::getOverview (  ) 

Get overview.

Reimplemented in ilPDSysMessageBlockGUI.

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

References $ilCtrl, and $lng.

Referenced by fillDataSection().

        {
                global $ilUser, $lng, $ilCtrl;
                                
                return '<div class="small">'.((int) count($this->mails))." ".$lng->txt("mails_pl")."</div>";
        }

Here is the caller graph for this function:

static ilPDMailBlockGUI::getScreenMode (  )  [static]

Get Screen Mode for current command.

Reimplemented from ilBlockGUI.

Definition at line 82 of file class.ilPDMailBlockGUI.php.

References $_GET.

        {
                switch($_GET["cmd"])
                {
                        case "showMail":
                                return IL_SCREEN_CENTER;
                                break;
                                
                        default:
                                return IL_SCREEN_SIDE;
                                break;
                }
        }

ilPDMailBlockGUI::ilPDMailBlockGUI (  ) 

Constructor.

Definition at line 41 of file class.ilPDMailBlockGUI.php.

References $ilCtrl, $lng, ilUtil::getImagePath(), ilBlockGUI::ilBlockGUI(), ilBlockGUI::setAvailableDetailLevels(), ilBlockGUI::setImage(), ilBlockGUI::setLimit(), and ilBlockGUI::setTitle().

Referenced by ilPDSysMessageBlockGUI::ilPDSysMessageBlockGUI().

        {
                global $ilCtrl, $lng, $ilUser;
                
                #include_once "./include/inc.mail.php";
                include_once './Services/User/classes/class.ilObjUser.php';
                include_once "Services/Mail/classes/class.ilMailbox.php";
                include_once "Services/Mail/classes/class.ilMail.php";

                
                parent::ilBlockGUI();
                
                $this->setLimit(5);
                $this->setImage(ilUtil::getImagePath("icon_mail_s.gif"));
                $this->setTitle($lng->txt("mail"));
                $this->setAvailableDetailLevels(3);
        }

Here is the call graph for this function:

Here is the caller graph for this function:

static ilPDMailBlockGUI::isRepositoryObject (  )  [static]

Get block type.

Returns:
string Block type.

Reimplemented from ilBlockGUI.

Reimplemented in ilPDSysMessageBlockGUI.

Definition at line 74 of file class.ilPDMailBlockGUI.php.

        {
                return false;
        }

ilPDMailBlockGUI::showMail (  ) 

show mail

Definition at line 261 of file class.ilPDMailBlockGUI.php.

References $_GET, $ilCtrl, $lng, and ilUtil::getImagePath().

        {
                global $lng, $ilCtrl;
                
                include_once("./Services/Mail/classes/class.ilPDMailGUI.php");
                $mail_gui = new ilPDMailGUI();

                include_once("./Services/PersonalDesktop/classes/class.ilPDContentBlockGUI.php");
                $content_block = new ilPDContentBlockGUI();
                $content_block->setContent($mail_gui->getPDMailHTML($_GET["mail_id"],
                        $_GET["mobj_id"]));
                $content_block->setTitle($lng->txt("message"));
                $content_block->setColSpan(2);
                $content_block->setImage(ilUtil::getImagePath("icon_mail.gif"));
                $content_block->addHeaderCommand($ilCtrl->getLinkTargetByClass("ilpersonaldesktopgui", "show"),
                        $lng->txt("selected_items_back"));
                        
                if ($_GET["mail_mode"] != "system")
                {
                        $content_block->addBlockCommand("ilias.php?baseClass=ilMailGUI&mail_id=".
                                $_GET["mail_id"]."&mobj_id".$_GET["mobj_id"]."&type=reply",
                                $lng->txt("reply"));
                        $content_block->addBlockCommand("ilias.php?baseClass=ilMailGUI&mail_id=".
                                $_GET["mail_id"]."&mobj_id".$_GET["mobj_id"]."&type=read",
                                $lng->txt("inbox"));
                        
                        $ilCtrl->setParameter($this, 'mail_id', (int) $_GET['mail_id']);                
                        $content_block->addBlockCommand($ilCtrl->getLinkTarget($this, 'deleteMail'), $lng->txt('delete'));
                                
                                
                }
                else
                {
                        $ilCtrl->setParameter($this, "mail_id", $_GET["mail_id"]);
                        $ilCtrl->setParameter($this, "mobj_id", $_GET["mobj_id"]);
                        $content_block->addBlockCommand(
                                $ilCtrl->getLinkTarget($this, "deleteMail"),
                                $lng->txt("delete"));
                        $ilCtrl->clearParameters($this);
                }
                
                return $content_block->getHTML();
        }

Here is the call graph for this function:


Field Documentation

ilPDMailBlockGUI::$block_type = "pdmail" [static]

Reimplemented in ilPDSysMessageBlockGUI.

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


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