buildMimeMessage() public static méthode

Builds the body MIME part of a multipart message.
public static buildMimeMessage ( Horde_View $view, string $template, Horde_Mime_Part $image ) : Horde_Mime_Part
$view Horde_View A view to render the HTML and plain text templates for the messate.
$template string The template base name for the view.
$image Horde_Mime_Part The MIME part of a related image.
Résultat Horde_Mime_Part A multipart/alternative MIME part.
Exemple #1
0
 /**
  * Returns an alarm hash of this task suitable for Horde_Alarm.
  *
  * @param string $user  The user to return alarms for.
  * @param Prefs $prefs  A Prefs instance.
  *
  * @return array  Alarm hash or null.
  */
 public function toAlarm($user = null, $prefs = null)
 {
     if (empty($this->alarm) || $this->completed) {
         return;
     }
     if (empty($user)) {
         $user = $GLOBALS['registry']->getAuth();
     }
     if (empty($prefs)) {
         $prefs = $GLOBALS['prefs'];
     }
     $methods = !empty($this->methods) ? $this->methods : @unserialize($prefs->getValue('task_alarms'));
     if (!$methods) {
         $methods = array();
     }
     if (isset($methods['notify'])) {
         $methods['notify']['show'] = array('__app' => $GLOBALS['registry']->getApp(), 'task' => $this->id, 'tasklist' => $this->tasklist);
         $methods['notify']['ajax'] = 'task:' . $this->tasklist . ':' . $this->id;
         if (!empty($methods['notify']['sound'])) {
             if ($methods['notify']['sound'] == 'on') {
                 // Handle boolean sound preferences;
                 $methods['notify']['sound'] = (string) Horde_Themes::sound('theetone.wav');
             } else {
                 // Else we know we have a sound name that can be
                 // served from Horde.
                 $methods['notify']['sound'] = (string) Horde_Themes::sound($methods['notify']['sound']);
             }
         }
     }
     if (isset($methods['mail'])) {
         $image = Nag::getImagePart('big_alarm.png');
         $view = new Horde_View(array('templatePath' => NAG_TEMPLATES . '/alarm', 'encoding' => 'UTF-8'));
         new Horde_View_Helper_Text($view);
         $view->task = $this;
         $view->imageId = $image->getContentId();
         $view->due = new Horde_Date($this->due);
         $view->dateFormat = $prefs->getValue('date_format');
         $view->timeFormat = $prefs->getValue('twentyFour') ? 'H:i' : 'h:ia';
         if (!$prefs->isLocked('task_alarms')) {
             $view->prefsUrl = Horde::url($GLOBALS['registry']->getServiceLink('prefs', 'nag'), true)->remove(session_name());
         }
         $methods['mail']['mimepart'] = Nag::buildMimeMessage($view, 'mail', $image);
     }
     if (isset($methods['desktop'])) {
         $methods['desktop']['url'] = Horde::url('view.php', true)->add('tasklist', $this->tasklist)->add('task', $this->id)->toString(true, true);
     }
     return array('id' => $this->uid, 'user' => $user, 'start' => new Horde_Date($this->due - $this->alarm * 60), 'methods' => array_keys($methods), 'params' => $methods, 'title' => $this->name, 'text' => $this->desc);
 }