function _EDIT_EMAIL_TEMPLATE()
 {
     global $templateid;
     JToolBarHelper::title(_JOOMLMS_COMP_NAME . ':' . ($templateid ? _JLMS_NOTS_EDIT_EML_TPL : _JLMS_NOTS_NEW_EML_TPL), 'config.png');
     $id = intval(mosGetParam($_REQUEST, 'id', 0));
     $native = NotificationsManager::getNativeEmailTemplate($id);
     if (!$native) {
         JToolBarHelper::save('save_email_template');
         JToolBarHelper::spacer();
         JToolBarHelper::apply('apply_email_template', _JLMS_APPLY);
         JToolBarHelper::spacer();
     }
     JToolBarHelper::cancel('email_templates');
     JToolBarHelper::spacer();
 }
 function getEmailTemplate($id)
 {
     static $templates;
     if (!isset($templates[$id])) {
         $db = JFactory::getDBO();
         $nativeEmailTemplate = NotificationsManager::getNativeEmailTemplate($id);
         if ($nativeEmailTemplate) {
             $row = new stdClass();
             $row->id = $nativeEmailTemplate->id;
             $row->name = isset($nativeEmailTemplate->name) ? $nativeEmailTemplate->name : '';
             $row->subject = isset($nativeEmailTemplate->subject) ? $nativeEmailTemplate->subject : '';
             $row->template_html = $nativeEmailTemplate->template_html;
             $row->template_alt_text = isset($nativeEmailTemplate->template_alt_text) ? $nativeEmailTemplate->template_alt_text : '';
             $row->disabled = false;
             $row->native = true;
             $row->notification_type = $nativeEmailTemplate->notification_type;
         } else {
             $sql = "SELECT id, name, body_html AS template_html, body_text AS template_alt_text, notification_type, subject, disabled, '0' AS native FROM #__lms_email_templates WHERE id = '" . $id . "'";
             $db->setQuery($sql);
             $row = $db->loadObject();
         }
         $templates[$id] = $row;
     }
     return php4_clone($templates[$id]);
 }