ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilMailAttachmentGUI Class Reference
+ Collaboration diagram for ilMailAttachmentGUI:

Public Member Functions

 __construct ()
 executeCommand ()
 saveAttachments ()
 cancelSaveAttachments ()
 deleteAttachments ()
 confirmDeleteAttachments ()
 cancelDeleteAttachments ()
 uploadFile ()
 showAttachments ()

Private Attributes

 $tpl = null
 $ctrl = null
 $lng = null
 $umail = null
 $mfile = null
 $errorDelete = false

Detailed Description

Author
Jens Conze
Version
$Id$

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

Constructor & Destructor Documentation

ilMailAttachmentGUI::__construct ( )

Definition at line 44 of file class.ilMailAttachmentGUI.php.

References $ilCtrl, $lng, and $tpl.

{
global $tpl, $ilCtrl, $lng, $ilUser;
$this->tpl = $tpl;
$this->ctrl = $ilCtrl;
$this->lng = $lng;
$this->ctrl->saveParameter($this, "mobj_id");
$this->umail = new ilFormatMail($ilUser->getId());
$this->mfile = new ilFileDataMail($ilUser->getId());
}

Member Function Documentation

ilMailAttachmentGUI::cancelDeleteAttachments ( )

Definition at line 160 of file class.ilMailAttachmentGUI.php.

References showAttachments().

{
$this->showAttachments();
}

+ Here is the call graph for this function:

ilMailAttachmentGUI::cancelSaveAttachments ( )

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

{
$this->ctrl->setParameter($this, "type", "attach");
$this->ctrl->returnToParent($this);
}
ilMailAttachmentGUI::confirmDeleteAttachments ( )

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

References $_POST, $error, $files, ilUtil\sendInfo(), and showAttachments().

{
if(!is_array($_POST['filename']))
{
ilUtil::sendInfo($this->lng->txt('mail_select_one_mail'));
}
// decode post values
$files = array();
foreach($_POST['filename'] as $value)
{
$files[] = urldecode($value);
}
if(strlen(($error = $this->mfile->unlinkFiles($files))))
{
ilUtil::sendInfo($this->lng->txt('mail_error_delete_file').' '.$error);
}
else
{
$mailData = $this->umail->getSavedData();
if (is_array($mailData['attachments']))
{
$tmp = array();
for ($i = 0; $i < count($mailData['attachments']); $i++)
{
if (!in_array($mailData['attachments'][$i], $files))
{
$tmp[] = $mailData['attachments'][$i];
}
}
$mailData['attachments'] = $tmp;
$this->umail->saveAttachments($tmp);
}
ilUtil::sendInfo($this->lng->txt('mail_files_deleted'));
}
$this->showAttachments();
}

+ Here is the call graph for this function:

ilMailAttachmentGUI::deleteAttachments ( )

Definition at line 104 of file class.ilMailAttachmentGUI.php.

References $_POST, ilUtil\sendInfo(), and showAttachments().

{
if(!is_array($_POST["filename"]))
{
ilUtil::sendInfo($this->lng->txt("mail_select_one_file"));
$this->errorDelete = true;
}
else
{
ilUtil::sendInfo($this->lng->txt("mail_sure_delete_file"));
}
$this->showAttachments();
}

+ Here is the call graph for this function:

ilMailAttachmentGUI::executeCommand ( )

Definition at line 58 of file class.ilMailAttachmentGUI.php.

References $cmd.

{
$forward_class = $this->ctrl->getNextClass($this);
switch($forward_class)
{
default:
if (!($cmd = $this->ctrl->getCmd()))
{
$cmd = "showAttachments";
}
$this->$cmd();
break;
}
return true;
}
ilMailAttachmentGUI::saveAttachments ( )

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

References $_POST, $file, and $files.

{
global $ilUser;
$files = array();
if(is_array($_POST['filename']) && count($_POST['filename']))
{
foreach($_POST['filename'] as $file)
{
// decode post value
if(file_exists($this->mfile->getMailPath().'/'.basename($ilUser->getId().'_'.urldecode($file))))
{
$files[] = urldecode($file);
}
}
}
$this->umail->saveAttachments($files);
$this->ctrl->returnToParent($this);
}
ilMailAttachmentGUI::showAttachments ( )

Definition at line 178 of file class.ilMailAttachmentGUI.php.

References $_POST, $file, and $files.

Referenced by cancelDeleteAttachments(), confirmDeleteAttachments(), deleteAttachments(), and uploadFile().

{
global $rbacsystem;
$this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.mail_attachment.html", "Services/Mail");
$this->tpl->setVariable("HEADER", $this->lng->txt("mail"));
$this->tpl->setVariable("TXT_ATTACHMENT",$this->lng->txt("attachment"));
$mailData = $this->umail->getSavedData();
$this->tpl->setVariable("ACTION", $this->ctrl->getFormAction($this, 'saveAttachments'));
$this->tpl->setVariable("UPLOAD", $this->ctrl->getFormAction($this, 'uploadFile'));
$this->ctrl->clearParameters($this);
// BEGIN CONFIRM_DELETE
if (isset($_POST["cmd"]["deleteAttachments"]) &&
!$this->errorDelete &&
!isset($_POST["cmd"]["confirm"]))
{
$this->tpl->setCurrentBlock("confirm_delete");
$this->tpl->setVariable("BUTTON_CONFIRM",$this->lng->txt("confirm"));
$this->tpl->setVariable("BUTTON_CANCEL",$this->lng->txt("cancel"));
$this->tpl->parseCurrentBlock();
}
// SET STATIC VARIABLES ;-)
$this->tpl->setVariable("TXT_ATTACHMENT",$this->lng->txt("attachment"));
$this->tpl->setVariable("TXT_FILENAME",$this->lng->txt("mail_file_name"));
$this->tpl->setVariable("TXT_FILESIZE",$this->lng->txt("mail_file_size"));
$this->tpl->setVariable("TXT_CREATE_TIME",$this->lng->txt("create_date"));
$this->tpl->setVariable("TXT_NEW_FILE",$this->lng->txt("mail_new_file"));
// ACTIONS
$this->tpl->setVariable("BUTTON_ATTACHMENT_ADOPT",$this->lng->txt("adopt"));
$this->tpl->setVariable("BUTTON_ATTACHMENT_CANCEL",$this->lng->txt("cancel"));
$this->tpl->setVariable("BUTTON_ATTACHMENT_DELETE",$this->lng->txt("delete"));
// BUTTONS
$this->tpl->setVariable("BUTTON_SUBMIT",$this->lng->txt("submit"));
$this->tpl->setVariable("BUTTON_UPLOAD",$this->lng->txt("upload"));
// BEGIN FILES
if($files = $this->mfile->getUserFilesData())
{
$counter = 0;
foreach($files as $file)
{
$this->tpl->setCurrentBlock('files');
if((!isset($_POST["cmd"]["deleteAttachments"]) && is_array($mailData["attachments"]) && in_array($file["name"],$mailData["attachments"])) ||
(isset($_POST["cmd"]["deleteAttachments"]) && is_array($_POST["filename"]) && in_array(urlencode($file["name"]), $_POST["filename"])))
{
$this->tpl->setVariable("CHECKED",'checked');
}
$this->tpl->setVariable('CSSROW',++$counter%2 ? 'tblrow1' : 'tblrow2');
$this->tpl->setVariable('FILE_NAME',urlencode($file["name"]));
$this->tpl->setVariable("NAME",$file["name"]);
$this->tpl->setVariable("SIZE",$file["size"]);
$this->tpl->setVariable("CTIME",$file["ctime"]);
$this->tpl->parseCurrentBlock();
}
}
else
{
$this->tpl->setCurrentBlock("no_content");
$this->tpl->setVariable("TXT_ATTACHMENT_NO",$this->lng->txt("mail_no_attachments_found"));
$this->tpl->parseCurrentBlock();
}
$this->tpl->setVariable("TXT_MARKED_ENTRIES",$this->lng->txt("marked_entries"));
$this->tpl->show();
}

+ Here is the caller graph for this function:

ilMailAttachmentGUI::uploadFile ( )

Definition at line 165 of file class.ilMailAttachmentGUI.php.

References ilUtil\sendInfo(), and showAttachments().

{
if (trim($_FILES["userfile"]["name"]) != "")
{
if($this->mfile->storeUploadedFile($_FILES["userfile"]) == 1)
{
ilUtil::sendInfo($this->lng->txt("mail_maxsize_attachment_error")." ".$this->mfile->getUploadLimit()." K".$this->lng->txt("mail_byte"));
}
}
$this->showAttachments();
}

+ Here is the call graph for this function:

Field Documentation

ilMailAttachmentGUI::$ctrl = null
private

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

ilMailAttachmentGUI::$errorDelete = false
private

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

ilMailAttachmentGUI::$lng = null
private

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

Referenced by __construct().

ilMailAttachmentGUI::$mfile = null
private

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

ilMailAttachmentGUI::$tpl = null
private

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

Referenced by __construct().

ilMailAttachmentGUI::$umail = null
private

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


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