Example #1
0
      $mail_subject = $translator->getMessage('MAIL_SUBJECT_MATERIAL_NOT_WORLDPUBLIC',$context_item->getTitle());
      $mail_body    = '';
      $mail_body   .= $translator->getEmailMessage('MAIL_BODY_HELLO',$receiver_item->getFullname());
      $mail_body   .= LF.LF;
      $mail_body   .= $translator->getEmailMessage('MAIL_BODY_MATERIAL_NOT_WORLDPUBLIC',$item->getTitle(),$context_item->getTitle());
      $mail_body   .= LF.LF;
      $mail_body   .= $translator->getEmailMessage('MAIL_BODY_CIAO',$current_user->getFullname(),$context_item->getTitle());

      $translator->setSelectedLanguage($save_language);
      unset($save_language);

      $url = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'].'?cid='.$environment->getCurrentContextID().'&mod=material&fct=detail&iid='.$item->getItemID();
      $mail_body .= "\n\n";
      $mail_body .= $url;
      $mail_obj->setSubject($mail_subject);
      $mail_obj->setContent($mail_body);
      $history = $session->getValue('history');
      if ($history[0]['function'] == 'detail') {
         $back_hop = 1;
      } else {
         $back_hop = 0;
      }
      $mail_obj->setBackLink( $environment->getCurrentContextID(),
                              $history[$back_hop]['module'],
                              $history[$back_hop]['function'],
                              '');
   }

   if ( isset($_GET['automail']) ) {
      if ( $_GET['automail'] == 'true' ) {
         $mail_obj->setSendMailAuto(true);