/** * * @param Template $template * @param array $to Array containing elements "email", "firstname", and "lastname" * @param array $from Array containing elements "email", "firstname", and "lastname" * @param string $language * @param array $bind_array Array of template variables to be bound to the template * @throws RuntimeException * @return boolean */ public function send(Template $template, array $to, array $from, $language, array $bind_array = array()) { $result = $template->getResult($bind_array, array("lang" => $language)); $mail = $this->_mail_handler; $mail->clearFrom(); $mail->setFrom($from["email"], implode(" ", array($from["firstname"], $from["lastname"]))); $mail->clearSubject(); $mail->setSubject($result->subject); $mail->setBodyText(clean_input($result->body, "emailcontent")); $mail->clearRecipients(); $mail->addTo($to["email"], implode(" ", array($to["firstname"], $to["lastname"]))); if ($mail->send()) { return true; } throw new RuntimeException("Failed to send email"); }
function display_international_activities(InternationalActivities $int_acts, $type, $hide_controls = false) { global $ENTRADA_TEMPLATE; $content_file = $ENTRADA_TEMPLATE->absolute() . "/modules/common/mspr/international_activity.xml"; $content_template = new Template($content_file); $contents = ""; if ($int_acts && $int_acts->count() > 0) { foreach ($int_acts as $entity) { $start = $entity->getStartDate(); $end = $entity->getEndDate(); $start = $start['y'] . "-" . $start['m'] . "-" . $start['d']; $end = $end['y'] . "-" . $end['m'] . "-" . $end['d']; $content_bind = array("title" => clean_input($entity->getTitle(), array("notags", "specialchars")), "site" => clean_input($entity->getSite(), array("notags", "specialchars")), "location" => clean_input($entity->getLocation(), array("notags", "specialchars")), "start" => $start, "end" => $end, "details" => clean_input($entity->getDetails(), array("notags", "specialchars", "nl2br")), "period" => clean_input($entity->getPeriod(), array("notags", "specialchars"))); $content = $content_template->getResult($content_bind, array("lang" => DEFAULT_LANGUAGE)); $contents .= item_wrap_content($type, $entity, $content, $hide_controls); } } else { $contents = "<li>None</li>"; } return list_wrap_content($contents); }