Commit 64c4cb37 authored by Anatole Rakotoson's avatar Anatole Rakotoson
Browse files

coform community

parent 642ab9c4
......@@ -4,30 +4,24 @@ class SendAction extends CAction {
public function run($msg="", $to="") {
$controller=$this->getController();
// $msg=null;
// $infos=array();
// if(isset($_POST["tpl"]))
// $tpl=$_POST["tpl"];
// if(isset($_POST["step"]))
// $step=$_POST["step"];
// // ALL infos
// if(isset($_POST["tplObject"]))
// $infos["tplObject"]=$_POST["tplObject"];
// if(isset($_POST["html"]))
// $infos["html"]=$_POST["html"];
// if(isset($_POST["msg"]))
// $infos["msg"]=$_POST["msg"];
// if(isset($_POST["tplMail"]))
// $infos["emails"]=$_POST["tplMail"];
// if(isset($_POST["listContact"]))
// $infos["community"]=$_POST["listContact"];
if(isset($_POST["to"]))
$to=$_POST["to"];
$msg=null;
$infos=array();
if(isset($_POST["tpl"]))
$msg=$_POST["msg"];
$tpl=$_POST["tpl"];
if(isset($_POST["step"]))
$step=$_POST["step"];
// ALL infos
if(isset($_POST["tplObject"]))
$infos["tplObject"]=$_POST["tplObject"];
if(isset($_POST["html"]))
$infos["html"]=$_POST["html"];
if(isset($_POST["msg"]))
$infos["msg"]=$_POST["msg"];
if(isset($_POST["tplMail"]))
$infos["emails"]=$_POST["tplMail"];
if(isset($_POST["listContact"]))
$infos["community"]=$_POST["listContact"]S
$mailParams=Answer::mailProcessOne($to, $msg);
Rest::json(array("result"=>true, "msg"=>"Ok : webhook handdled"));
}
......
......@@ -367,21 +367,22 @@ class Answer{
public static function mailProcessOne($to, $msg){
$params = array (
"type" => Cron::TYPE_MAIL,
"tpl"=>s$msg,
"tpl"=>"basic",
"subject" => "invitation",
"from"=>Yii::app()->params['adminEmail'],
"to" => $to,
"tplParams" => array( "user"=> "user" ,
"title" => Mail::getAppName() ,
"title" => "title" ,
"answer" => "answer",
"form"=>Yii::app()->params['adminEmail'],
"msg"=>$msg));
"msg"=>"helloword"));
if(isset($infos["msg"]))
$params["tplParams"]["msg"]=$infos["msg"];
if(isset($infos["html"]))
$params["tplParams"]["html"]=$infos["html"];
$params=Mail::getCustomMail($params);
//Rest::json($params);exit();
Mail::schedule($params);
}
......
......@@ -102,16 +102,16 @@
ajaxPost(
null,
baseUrl+"/survey/answer/sendmail/id/<?php echo (string)$answer['_id'] ?>",
{to:$("#liste_row").val(),mailtype:sectionDyf.<?php echo $kunik ?>ParamsData.mail_type},
{to:$("#liste_row").val(),msg:sectionDyf.<?php echo $kunik ?>ParamsData.mail_type},
function(data){
toastr.success("Un mail a été envoyé à toutes les parties prenantes afin de les notifier");
//urlCtrl.loadByHash(location.hash);
//urlCtrl.loadByHash(location.hash);
dataHelper.path2Value( tplCtx, function(params) {
$("#ajax-modal").html("<div class='text-center'><i class='fa fa-spin fa-spinner'></i></div>");//$("#ajax-modal").modal('hide');
//location.reload();
} );
}
);
dataHelper.path2Value( tplCtx, function(params) {
$("#ajax-modal").html("<div class='text-center'><i class='fa fa-spin fa-spinner'></i></div>");//$("#ajax-modal").modal('hide');
location.reload();
} );
}
}
}
......@@ -123,8 +123,13 @@
"description" : "Mail type",
"icon" : "fa-cog",
"properties" : {
mail_type : {
subject : {
inputType : "text",
label : "Sujet",
values : sectionDyf.<?php echo $kunik ?>ParamsData.mail_type
}
mail_type : {
inputType : "textarea",
label : "Mail type",
values : sectionDyf.<?php echo $kunik ?>ParamsData.mail_type
}
......
......@@ -15,11 +15,13 @@ if($mode == "r"){ ?>
<?php
}else{
?>
<link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.6-rc.0/css/select2.min.css" rel="stylesheet" />
<div class="form-group">
<label for="<?php echo $key ?>"><h4 style="color:<?php echo ($titleColor) ? $titleColor : "black"; ?>"><?php echo $label.$editQuestionBtn ?></h4></label>
<br/>
<select class="form-control js-example-tags">
<select id="tags<?php echo $kunik ?>" multiple>
<option selected="selected">orange</option>
<option>white</option>
<option>purple</option>
......@@ -29,11 +31,17 @@ if($mode == "r"){ ?>
<?php } ?>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.6-rc.0/js/select2.min.js"></script>
<script type="text/javascript">
jQuery(document).ready(function() {
$(".js-example-tags").select2({
});
});
let optionSelect2<?php echo $kunik ?> = {
templateResult: formatResult,
closeOnSelect: false,
width: '90%',
placeholder: 'Saisir un territoire'
};
let $select2<?php echo $kunik ?> = $("#tags<?php echo $kunik ?>").select2(optionSelect2<?php echo $kunik ?>);
</script>
<?php } ?>
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment