Commit e41f6c08 authored by Raph El's avatar Raph El
Browse files

Modif form for CO

parent 834b8bd7
......@@ -61,6 +61,14 @@ var formObj = {
events : {
},
// urls : {
// forms : function(){
// return
// },
// form : function(){
// return ""
// }
// }
manage:{},
actions : {},
dynForm : {
......@@ -219,7 +227,6 @@ formObj.events.form = function(fObj){
ajaxPost(fObj.container, baseUrl+'/survey/answer/index/id/new/form/'+$(this).data("id"),
null,
function(){
},"html");
});
......
......@@ -71,6 +71,7 @@ class IndexAction extends CAction
$params["canSee"] = $canSeeAnswer;
$params["mode"] = (!empty($mode) ? $mode : "r");
$tpl=(!empty($form["tpl"])) ? $form["tpl"] : "survey.views.tpls.forms.formWizard";
//Rest::json($tpl); exit;
echo $this->getController()->renderPartial($tpl,$params );
} else {
if(Yii::app()->request->isAjaxRequest)
......
......@@ -36,6 +36,7 @@ class EditAction extends CAction
$params["showForm"] = true;
$params["mode"] = "fa";
$tpl=(!empty($form["tpl"])) ? $form["tpl"] : "survey.views.tpls.forms.formWizard";
//Rest::json($params); exit;
echo $this->getController()->renderPartial($tpl,$params );
} else {
if(Yii::app()->request->isAjaxRequest)
......
......@@ -173,7 +173,6 @@ class Form {
$res["forms"][$formId] = $f;
}
return $res;
}
public static function getById($parentForm, $fields=array()){
return PHDB::findOne( self::COLLECTION, array("id"=>$parentForm), $fields);
......@@ -770,7 +769,6 @@ class Form {
return $parent;
}
}
return $parent;
}
}
......
......@@ -16,7 +16,7 @@ if(isset($this->costum["contextType"]) && isset($this->costum["contextId"])){
array( "parent.".$this->costum["contextId"] => array('$exists'=>1),
"parent.".$this->costum["contextId"].".type"=>$this->costum["contextType"],
"type"=>"cms") );
}
}
?>
<style type="text/css">
......@@ -100,221 +100,101 @@ if(isset($this->costum["contextType"]) && isset($this->costum["contextId"])){
}
</style>
<script type="text/javascript">
var sectionDyf = {};
</script>
<?php
$params = [ "tpl" => $this->costum["slug"],
"slug"=>$el["slug"],
"canEdit"=>$canEdit,
"el"=>$el ];
echo $this->renderPartial("survey.views.tpls.acceptAndAdmin", $params, true );
// $params = [ "tpl" => $this->costum["slug"],
// "slug"=>$el["slug"],
// "canEdit"=>$canEdit,
// "el"=>$el ];
// echo $this->renderPartial("survey.views.tpls.acceptAndAdmin", $params, true );
?>
<div class="col-xs-12 no-padding" id="customHeader" style="background-color: white">
<?php
$color1 = "#E63458";
if(isset($this->costum["cms"]["color1"]))
$color1 = $this->costum["cms"]["color1"];
if($canEdit)
echo "<a class='btn btn-xs btn-danger editBtn' href='javascript:;' data-key='color1' data-type='color' data-path='costum.cms.color1' data-label='Couleur Principale '><i class='fa fa-pencil'></i></a>";
$color1 = $this->costum["cms"]["color1"];
// if($canEdit)
// echo "<a class='btn btn-xs btn-danger editBtn' href='javascript:;' data-key='color1' data-type='color' data-path='costum.cms.color1' data-label='Couleur Principale '><i class='fa fa-pencil'></i></a>";
?>
<div class="col-sm-12 col-md-12 col-xs-12 no-padding" style="background-color:<?php echo $this->costum["colors"]["grey"]; ?>; max-width:100%;">
<div class="col-xs-12 no-padding" style="">
<?php if( !isset(Yii::app()->session["userId"])){ ?>
<div class="col-xs-12 no-padding">
<div class="col-md-12 col-sm-12 col-xs-12 padding-20" style="padding-left:100px;background-color: <?php echo $this->costum["colors"]["grey"]; ?>; ">
<div class="col-xs-12 col-sm-10 col-sm-offset-1 pull-left padding-20 shadow2" style="font-family: montserrat; margin-top:-200px;background-color: #fff;font-size: 14px;z-index: 5;">
<div class="col-xs-12 ourvalues" style="text-align:center;">
<h2 class="mst col-xs-12 text-center">
<br>
<?php
if(isset($this->costum["cms"]["title1"])){
echo htmlentities($this->costum["cms"]["title1"]);
} else { ?> Open Form Wizard (With steps)<?php }
if($canEdit)
echo "<a class='btn btn-xs btn-danger editBtn' href='javascript:;' data-key='title1' data-path='costum.cms.title1'><i class='fa fa-pencil'></i></a>";
?>
</h2>
<p class="mst" style="color:<?php echo $this->costum["colors"]["dark"]; ?>">
<?php
if(isset($this->costum["cms"]["subtitle1"])){
echo htmlentities($this->costum["cms"]["subtitle1"]);
} else { ?>
Votre questionnaire contient des sections ou des étapes
<br/>Vous etes au bon endroit.<br/>
<?php }
if($canEdit)
echo "<a class='btn btn-xs btn-danger editBtn' href='javascript:;' data-key='subtitle1' data-path='costum.cms.subtitle1'><i class='fa fa-pencil'></i></a>";
?>
<br/>
</p>
<h2 class="mst" style="color:<?php echo $this->costum["colors"]["pink"]; ?>" >JE PARTICIPE</h2>
<br/>
<div class="col-xs-12" style="margin-bottom:40px;">
<div class="col-xs-12 col-sm-4">
<?php if( Person::logguedAndValid() ){ ?>
<span class="col-xs-12 text-center btn-main-menu btn-main-menuW ">Je suis Connecté !! <br>et je veux l'utopie</span>
<?php } else { ?>
<button data-toggle="modal" data-target="#modalLogin" class="col-xs-12 btn-main-menu text-center" styl >JE PARTICIPE</button>
<?php } ?>
</div>
<div class="col-xs-12 col-sm-4">
<a href="alert('open share it panel')" class="col-xs-12 btn-main-menu btn-main-menuW text-red" style="font-size: 1.5em; padding-top: 20px;" >En partageant <br>ce sondage</a>
</div>
<div class="col-xs-12 col-sm-4">
<a href="#results" class="col-xs-12 btn-main-menu">Voir les résultats</a>
</div>
</div>
</div>
</div>
<div class="col-xs-12 text-center " style="font-size: 1.5em; padding-top: 20px;" >
<?php
if(isset($this->costum["cms"]["textIntro"])){
echo htmlentities($this->costum["cms"]["textIntro"]);
} else { ?> <b>Lorem ipsum dolor sit amet</b>, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
<br/><br/>
<b>Lorem ipsum dolor sit amet</b>, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
<br/><br/>
<b>Lorem ipsum dolor sit amet</b>, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
<br/><br/>
<b>Lorem ipsum dolor sit amet</b>, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
<?php }
if($canEdit)
echo "<a class='btn btn-xs btn-danger editBtn' href='javascript:;' data-key='textIntro' data-type='textarea' data-markdown='1' data-path='costum.cms.textIntro' data-label='Expliquez les objectifs de ce formulaire ? '><i class='fa fa-pencil'></i></a>";
?>
</div>
</div><br/>
</div>
<?php } else { ?>
<style type="text/css">
.monTitle{
border-top: 1px dashed <?php echo $this->costum["colors"]["pink"]; ?>;
border-bottom: 1px dashed <?php echo $this->costum["colors"]["pink"]; ?>;
margin-top: -20px;
}
</style>
<?php $formSmallSize = 12; ?>
<div class="col-md-12 col-lg-<?php echo $formSmallSize?> no-padding "><br/>
<div class="col-md-12 col-sm-12 col-xs-12 " style="background-color: white; ">
<h1 class="margin-top-20 monTitle padding-20 text-center cbyg" style="color:<?php echo $color1 ?>">
<?php
if(isset($this->costum["cms"]["sec1Title"])){
echo htmlentities($this->costum["cms"]["sec1Title"]);
} else { ?> Sondage <?php }
if($canEdit)
echo "<a class='btn btn-xs btn-danger editBtn' href='javascript:;' data-key='sec1Title' data-type='text' data-path='costum.cms.sec1Title' data-label='Titre '><i class='fa fa-pencil'></i></a>";
<div class="col-xs-12 no-padding" >
<!-- style="background-color:<?php //echo $this->costum["colors"]["grey"]; ?>; max-width:100%;"> -->
<div class="col-xs-12 no-padding" style="">
<style type="text/css">
.monTitle{
border-top: 1px dashed <?php echo $this->costum["colors"]["pink"]; ?>;
border-bottom: 1px dashed <?php echo $this->costum["colors"]["pink"]; ?>;
margin-top: -20px;
}
</style>
<?php $formSmallSize = 12; ?>
<div class="col-md-12 col-lg-<?php echo $formSmallSize?> no-padding "><br/>
<div class="col-xs-12 no-padding" style="background-color: white; ">
<div class="col-xs-12 no-padding">
<script type="text/javascript">
var formInputs = {};
var answerObj = <?php echo (!empty($answer)) ? json_encode( $answer ) : "null"; ?>;
</script>
<div class="col-xs-12 margin-top-20">
<?php
$wizardUid = (String) $form["_id"];
if($mode != "fa"){
$params = [
"parentForm"=>$parentForm,
"el" => $el,
"color1" => $color1,
"canEdit" => $canEdit,
"answer"=>$answer,
"forms"=>$forms,
"allAnswers"=>@$allAnswers,
"what" => "dossiers",
"wizid"=> $wizardUid
];
echo $this->renderPartial($this->costum["form"]["answersTpl"],$params);
}
if( $mode == "fa" && $canEditForm === true ){
$params = [
"canEditForm"=>$canEditForm,
"mode" => $mode,
"form" => $form,
"el" => $el
];
echo $this->renderPartial("survey.views.tpls.forms.config",$params);
}
if( isset($answer) && !empty($showForm) && $showForm === true ) {
$params = [
"parentForm"=>$parentForm,
"form" => $form,
"forms"=>$forms,
"el" => $el,
"active" => "all",
"color1" => $this->costum["colors"]["dark"],
"color2" => $this->costum["colors"]["pink"],
"canEdit" => $canEdit,
"canEditForm" => $canEditForm,
"answer"=>$answer,
"showForm" => $showForm,
"mode" => $mode,
"wizid"=> $wizardUid
];
echo $this->renderPartial("survey.views.tpls.forms.wizard",$params);
}
?>
</h1>
<div class="text-center">
<?php if(isset($parentForm["startDate"])){ ?>
Démarrage : <?php echo $parentForm["startDate"]; ?>
<?php }
if(isset($parentForm["endDate"])){ ?>
et se termine : <?php echo $parentForm["endDate"]; ?>
<?php } ?>
</div>
</div>
<div class="row margin-top-20 padding-20" style="background-color: white; ">
<div class="col-xs-12">
<div class="padding-20 btnParticiper margin-top-20 Montserrat text-center" style="font-size:1.2em ">
<?php
if(isset($this->costum["cms"]["textIntro"])){
echo htmlentities($this->costum["cms"]["textIntro"]);
} else { ?> Quelle est votre objectif avec ce formulaire <?php }
if($canEdit)
echo "<a class='btn btn-xs btn-danger editBtn' href='javascript:;' data-key='textIntro' data-type='textarea' data-markdown='1' data-path='costum.cms.textIntro' data-label='Expliquez les objectifs de ce formulaire ? '><i class='fa fa-pencil'></i></a>";
?>
</div>
<script type="text/javascript">
var formInputs = {};
var answerObj = <?php echo (!empty($answer)) ? json_encode( $answer ) : "null"; ?>;
</script>
<div class="col-xs-12 margin-top-20">
<?php
$wizardUid = "wizardForm";
if(!empty($showAnswerActions)){
$params = [
"el" => $el,
"color1" => $color1,
"canEdit" => $canEdit,
"allAnswers"=>@$allAnswers,
"what" => "dossiers"
];
echo $this->renderPartial("survey.views.tpls.answers.allAnswers",$params);
}
if(!empty($showForm)) {
$params = [
"parentForm"=>$parentForm,
"form"=>$form,
"el" => $el,
"active" => "all",
"color1" => $color1,
"canEdit" => $canEdit,
"answer"=>$answer,
"showForm" => $showForm,
"wizid"=> $wizardUid
];
echo $this->renderPartial("survey.views.tpls.forms.wizard",$params);
} else {
echo "<h4 class='text-center' style='color:".$color1."'><i class='fa fa-warning'></i> Une seul réponse n'est possible.</h4>";
echo "<a class='btn btn-primary' href='/costum/co/index/slug/".$el["slug"]."/answer/".$myAnswers[0]."'>Votre réponse</a>";
}
?>
</div>
</div>
</div>
</div>
</div>
<?php } ?>
</div>
</div>
</div>
......@@ -323,32 +203,19 @@ var answerObj = <?php echo (!empty($answer)) ? json_encode( $answer ) : "null";
<script type="text/javascript">
//to edit costum page pieces
var configDynForm = <?php echo json_encode($this->costum['dynForm']); ?>;
var configDynForm = <?php echo json_encode($this->costum['dynForm']); ?>;
var answerId = <?php echo json_encode((String)$answer['_id']); ?>;
var mode = <?php echo json_encode($mode); ?>;
var elTest = <?php echo json_encode($el); ?>;
//information and structure of the form in this page
var tplCtx = {};
if(location.hash.indexOf("#answer.index.id.new")>=0){
history.replaceState("#answer.index.id.new", "", "#answer.index.id."+answerId+".mode."+mode);
}
jQuery(document).ready(function() {
mylog.log("render","/modules/costum/views/custom/co/formWizard.php");
contextData = {
id : "<?php echo $this->costum["contextId"] ?>",
type : "<?php echo $this->costum["contextType"] ?>",
name : '<?php echo htmlentities($el['name']) ?>',
profilThumbImageUrl : "http://127.0.0.1/ph/themes/CO2/assets/img/LOGOS/CO2/logo-min.png"
};
getAjax("community", baseUrl+"/"+moduleId+"/element/getdatadetail/type/"+costum.contextType+"/id/"+costum.contextId+"/dataName/members",
function(data){
//displayInTheContainer(data,"members","group",null,true);
mylog.log("#community",data);
},
"html");
$('#showAnswerBtn').on("click",function() {
$("#allAnswersContainer").toggleClass("hide");
$('#<?php echo "wizardForm" ?>').toggleClass("hide");
//getAjax(".pageContent", baseUrl+"/costum/co/index/slug/<?php echo $el['slug'] ?>/page/answerList",null,"html");
})
mylog.log("render","/modules/costum/views/custom/deal/form.php");
});
......
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