24 require_once 
"Services/Mail/classes/class.ilFormatMail.php";
 
   25 require_once 
"classes/class.ilFileDataMail.php";
 
   52                 $this->ctrl->saveParameter($this, 
"mobj_id");
 
   60                 $forward_class = $this->ctrl->getNextClass($this);
 
   61                 switch($forward_class)
 
   64                                 if (!(
$cmd = $this->ctrl->getCmd()))
 
   66                                         $cmd = 
"showAttachments";
 
   81                 if(is_array(
$_POST[
'filename']) && count(
$_POST[
'filename']))
 
   86                                 if(file_exists($this->mfile->getMailPath().
'/'.basename($ilUser->getId().
'_'.urldecode($file))))
 
   88                                         $files[] = urldecode($file);
 
   93                 $this->umail->saveAttachments(
$files);
 
   95                 $this->ctrl->returnToParent($this);
 
  100                 $this->ctrl->setParameter($this, 
"type", 
"attach");
 
  101                 $this->ctrl->returnToParent($this);
 
  106                 if(!is_array(
$_POST[
"filename"]))
 
  109                         $this->errorDelete = 
true;
 
  121                 if(!is_array(
$_POST[
'filename']))
 
  128                 foreach(
$_POST[
'filename'] as $value)
 
  130                         $files[] = urldecode($value);
 
  133                 if(strlen(($error = $this->mfile->unlinkFiles(
$files))))
 
  139                         $mailData = $this->umail->getSavedData();
 
  140                         if (is_array($mailData[
'attachments']))
 
  143                                 for ($i = 0; $i < count($mailData[
'attachments']); $i++)
 
  145                                         if (!in_array($mailData[
'attachments'][$i], 
$files))
 
  147                                                 $tmp[] = $mailData[
'attachments'][$i];
 
  150                                 $mailData[
'attachments'] = $tmp;
 
  151                                 $this->umail->saveAttachments($tmp);
 
  167                 if (trim($_FILES[
"userfile"][
"name"]) != 
"")
 
  169                         if($this->mfile->storeUploadedFile($_FILES[
"userfile"]) == 1)
 
  171                                 ilUtil::sendInfo($this->lng->txt(
"mail_maxsize_attachment_error").
" ".$this->mfile->getUploadLimit().
" K".$this->lng->txt(
"mail_byte"));
 
  182                 $this->tpl->addBlockFile(
"ADM_CONTENT", 
"adm_content", 
"tpl.mail_attachment.html", 
"Services/Mail");
 
  183                 $this->tpl->setVariable(
"HEADER", $this->lng->txt(
"mail"));
 
  184                 $this->tpl->setVariable(
"TXT_ATTACHMENT",$this->lng->txt(
"attachment"));
 
  186                 $mailData = $this->umail->getSavedData();
 
  188                 $this->tpl->setVariable(
"ACTION", $this->ctrl->getFormAction($this, 
'saveAttachments'));
 
  189                 $this->tpl->setVariable(
"UPLOAD", $this->ctrl->getFormAction($this, 
'uploadFile'));
 
  190                 $this->ctrl->clearParameters($this);
 
  193                 if (isset(
$_POST[
"cmd"][
"deleteAttachments"]) &&
 
  194                         !$this->errorDelete &&
 
  195                         !isset(
$_POST[
"cmd"][
"confirm"]))
 
  197                         $this->tpl->setCurrentBlock(
"confirm_delete");
 
  198                         $this->tpl->setVariable(
"BUTTON_CONFIRM",$this->lng->txt(
"confirm"));
 
  199                         $this->tpl->setVariable(
"BUTTON_CANCEL",$this->lng->txt(
"cancel"));
 
  200                         $this->tpl->parseCurrentBlock();
 
  204                 $this->tpl->setVariable(
"TXT_ATTACHMENT",$this->lng->txt(
"attachment"));
 
  205                 $this->tpl->setVariable(
"TXT_FILENAME",$this->lng->txt(
"mail_file_name"));
 
  206                 $this->tpl->setVariable(
"TXT_FILESIZE",$this->lng->txt(
"mail_file_size"));
 
  207                 $this->tpl->setVariable(
"TXT_CREATE_TIME",$this->lng->txt(
"create_date"));
 
  208                 $this->tpl->setVariable(
"TXT_NEW_FILE",$this->lng->txt(
"mail_new_file"));
 
  211                 $this->tpl->setVariable(
"BUTTON_ATTACHMENT_ADOPT",$this->lng->txt(
"adopt"));
 
  212                 $this->tpl->setVariable(
"BUTTON_ATTACHMENT_CANCEL",$this->lng->txt(
"cancel"));
 
  213                 $this->tpl->setVariable(
"BUTTON_ATTACHMENT_DELETE",$this->lng->txt(
"delete"));
 
  216                 $this->tpl->setVariable(
"BUTTON_SUBMIT",$this->lng->txt(
"submit"));
 
  217                 $this->tpl->setVariable(
"BUTTON_UPLOAD",$this->lng->txt(
"upload"));
 
  220                 if(
$files = $this->mfile->getUserFilesData())
 
  225                                 $this->tpl->setCurrentBlock(
'files');
 
  226                                 if((!isset(
$_POST[
"cmd"][
"deleteAttachments"]) && is_array($mailData[
"attachments"]) && in_array($file[
"name"],$mailData[
"attachments"])) ||
 
  227                                    (isset(
$_POST[
"cmd"][
"deleteAttachments"]) && is_array(
$_POST[
"filename"]) && in_array(urlencode($file[
"name"]), 
$_POST[
"filename"])))
 
  229                                         $this->tpl->setVariable(
"CHECKED",
'checked');
 
  231                                 $this->tpl->setVariable(
'CSSROW',++$counter%2 ? 
'tblrow1' : 
'tblrow2');
 
  232                                 $this->tpl->setVariable(
'FILE_NAME',urlencode($file[
"name"]));
 
  233                                 $this->tpl->setVariable(
"NAME",$file[
"name"]);
 
  234                                 $this->tpl->setVariable(
"SIZE",$file[
"size"]);
 
  235                                 $this->tpl->setVariable(
"CTIME",$file[
"ctime"]);
 
  236                                 $this->tpl->parseCurrentBlock();
 
  241                         $this->tpl->setCurrentBlock(
"no_content");
 
  242                         $this->tpl->setVariable(
"TXT_ATTACHMENT_NO",$this->lng->txt(
"mail_no_attachments_found"));
 
  243                         $this->tpl->parseCurrentBlock();
 
  246                 $this->tpl->setVariable(
"TXT_MARKED_ENTRIES",$this->lng->txt(
"marked_entries"));