示例#1
0
 function get_form()
 {
     global $mailtpl_form_tpl, $msg, $charset;
     $tpl = $mailtpl_form_tpl;
     if ($this->id) {
         $tpl = str_replace('!!msg_title!!', $msg['admin_mailtpl_form_edit'], $tpl);
         $tpl = str_replace('!!delete!!', "<input type='button' class='bouton' value='" . $msg['admin_mailtpl_delete'] . "'  onclick=\"document.getElementById('action').value='delete';this.form.submit();\"  />", $tpl);
         $name = $this->info['name'];
         $tpl_objet = $this->info['objet'];
         $tpl_contens = $this->info['tpl'];
     } else {
         $tpl = str_replace('!!msg_title!!', $msg['admin_mailtpl_form_add'], $tpl);
         $tpl_objet = "";
         $tpl = str_replace('!!delete!!', "", $tpl);
         $name = "";
         $tpl_contens = "";
     }
     $id_check_list = "";
     foreach ($this->all_users as $a_user) {
         $id_check = "auto_" . $a_user[0];
         if ($a_user[0] == 1) {
             $checked = " checked readonly ";
         } else {
             if (in_array($a_user[0], $this->users)) {
                 $checked = " checked ";
             } else {
                 $checked = "";
             }
             if ($id_check_list) {
                 $id_check_list .= '|';
             }
             $id_check_list .= $id_check;
         }
         $autorisations_users .= "<span class='usercheckbox'><input type='checkbox' {$checked} name='userautorisation[]' id='{$id_check}' value='" . $a_user[0] . "' class='checkbox'><label for='{$id_check}' class='normlabel'>&nbsp;" . $a_user[1] . "</label></span>&nbsp;&nbsp;";
     }
     $tpl = str_replace('!!name!!', htmlentities($name, ENT_QUOTES, $charset), $tpl);
     $tpl = str_replace('!!selvars!!', mailtpl::get_selvars(), $tpl);
     $sel_img_tpl = "";
     $sel_img = mailtpl::get_sel_img();
     if ($sel_img) {
         $sel_img_tpl = "\n\t\t<div class='row'>\n\t\t\t<label class='etiquette'>" . $msg["admin_mailtpl_form_sel_img"] . "</label>\n\t\t\t<div class='row'>\n\t\t\t\t{$sel_img}\n\t\t\t</div>\n\t\t</div>";
     }
     $tpl = str_replace('!!sel_img!!', $sel_img_tpl, $tpl);
     $tpl = str_replace('!!autorisations_users!!', $autorisations_users, $tpl);
     $tpl = str_replace('!!id_check_list!!', $id_check_list, $tpl);
     $tpl = str_replace('!!tpl!!', htmlentities($tpl_contens, ENT_QUOTES, $charset), $tpl);
     $tpl = str_replace('!!objet!!', htmlentities($tpl_objet, ENT_QUOTES, $charset), $tpl);
     $tpl = str_replace('!!id_mailtpl!!', $this->id, $tpl);
     return $tpl;
 }
示例#2
0
// $Id: build.inc.php,v 1.1 2012-07-05 14:33:36 ngantier Exp $
if (stristr($_SERVER['REQUEST_URI'], ".inc.php")) {
    die("no access");
}
require_once $class_path . "/mailtpl.class.php";
switch ($action) {
    case 'form':
        $mailtpl = new mailtpl($id_mailtpl);
        print $mailtpl->get_form();
        break;
    case 'save':
        $mailtpl = new mailtpl($id_mailtpl);
        $data['name'] = $name;
        $data['objet'] = $f_objet_mail;
        $data['tpl'] = $f_message;
        $data['users'] = $userautorisation;
        print $mailtpl->save($data);
        $mailtpls = new mailtpls();
        print $mailtpls->get_list();
        break;
    case 'delete':
        $mailtpl = new mailtpl($id_mailtpl);
        print $mailtpl->delete();
        $mailtpls = new mailtpls();
        print $mailtpls->get_list();
        break;
    default:
        $mailtpls = new mailtpls();
        print $mailtpls->get_list();
        break;
}
示例#3
0
require_once $class_path . "/mailtpl.class.php";
require_once $class_path . "/mailing_empr.class.php";
// les requis par mailing.php ou ses sous modules
include_once "{$include_path}/mail.inc.php";
include_once "{$include_path}/mailing.inc.php";
$mailtpl = new mailtpls();
if ($mailtpl->get_count_tpl()) {
    $mailtpl_script = "\n\t<script type='text/javascript'>\n\t\tfunction insert_template(theselector,objet_mail,dest){\t\n\t\t\tvar id_mailtpl=0;\n\t\t\tfor (var i=0 ; i< theselector.options.length ; i++){\n\t\t\t\tif (theselector.options[i].selected){\n\t\t\t\t\tid_mailtpl=theselector.options[i].value ;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(!id_mailtpl) return ;\n\t\t\tvar url= '{$base_path}/ajax.php?module=ajax&categ=mailtpl&quoifaire=get_mailtpl&id_mailtpl='+id_mailtpl;\t\n\t\t\tvar action = new http_request();\n\t\t\taction.request(url,0,'',1,response_tpl,0,0);\t\t\t\t\n\t\t}\n\t\t\n\t\tfunction response_tpl(info){\n\t\t\ttry{ \n\t\t\t\tvar info=eval('(' + info + ')');\n\t\t\t} catch(e){\n\t\t\t\tif(typeof console != 'undefined') {\n\t\t\t\t\tconsole.log(e);\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\t// objet du mail\n\t\t\tdocument.getElementById('f_objet_mail').value=info.objet;\t\t\t\n\t\t\t// contenu\n\t\t\tdocument.getElementById('f_message').innerHTML=info.tpl;\t\n\t\t\tif(typeof(tinyMCE)!= 'undefined')tinyMCE.updateContent('f_message');\n\t\t}\n\t</script>\n\t<div class='row'>\n\t\t<label class='etiquette' >" . $msg["admin_mailtpl_sel"] . "</label>\n\t\t<div class='row'>\n\t\t\t" . $mailtpl->get_sel('mailtpl_id', 0) . "\t\t\t\t\t\t\t\n\t\t\t<input type='button' class='bouton' value=\" " . $msg["admin_mailtpl_insert"] . " \" \n\t\t\tonClick=\"insert_template(document.getElementById('mailtpl_id'), document.getElementById('f_objet_mail'), document.getElementById('f_message')); return false; \" />\t\t\t\t\t\t\t\n\t\t</div>\n\t</div>\n\t";
} else {
    $mailtpl_script = "";
}
$mailtpl_vars = "\n\t<div class='row'>\n\t\t<label class='etiquette'>" . $msg["admin_mailtpl_form_selvars"] . "</label>\n\t\t<div class='row'>\n\t\t\t" . mailtpl::get_selvars() . "\t\n\t\t</div>\n\t</div>\n";
$get_sel_img = "";
$sel_img = mailtpl::get_sel_img();
if ($sel_img) {
    $get_sel_img = "\n\t<div class='row'>\n\t\t<label class='etiquette'>" . $msg["admin_mailtpl_form_sel_img"] . "</label>\n\t\t<div class='row'>\n\t\t\t" . mailtpl::get_sel_img() . "\n\t\t</div>\n\t</div>\n";
}
$urlbase = "./circ/caddie/";
if (!$idemprcaddie) {
    die;
}
if ($pmb_javascript_office_editor) {
    print $pmb_javascript_office_editor;
}
if (!$f_message && !$pmb_javascript_office_editor) {
    $f_message = "\n<html>\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset={$charset}\">\n</head>\n<body>\n</body>\n</html>";
} else {
    $f_message = stripslashes($f_message);
}
$f_objet_mail = stripslashes($f_objet_mail);
print "<div id='contenu-frame'>";
示例#4
0
<?php

// +-------------------------------------------------+
// © 2002-2004 PMB Services / www.sigb.net pmb@sigb.net et contributeurs (voir www.sigb.net)
// +-------------------------------------------------+
// $Id: mailtpl.inc.php,v 1.1 2012-07-05 14:33:36 ngantier Exp $
if (stristr($_SERVER['REQUEST_URI'], ".inc.php")) {
    die("no access");
}
require_once $class_path . "/mailtpl.class.php";
$mailtpl = new mailtpl($id_mailtpl);
switch ($quoifaire) {
    case 'get_mailtpl':
        ajax_http_send_response($mailtpl->get_mailtpl());
        break;
}