Commit 37c31310 authored by Raph El's avatar Raph El
Browse files

Merge branch 'development' of https://gitlab.adullact.net/pixelhumain/survey into development

parents 7cbb6fa0 dd83cad2
......@@ -21,8 +21,8 @@ class AnswerAction extends CAction
if ( ! Person::logguedAndValid() )
$ctrl->render("co2.views.default.unTpl",array("msg"=>Yii::t("common","Please Login First"),"icon"=>"fa-sign-in"));
else if( Form::canSeeAnswer(Yii::app()->session["userId"], $answer, $form, $parent) ) {
$canAdmin=Form::canEditAnswer(Yii::app()->session["userId"], $answer, $form, $parent);
else if( Answer::canAccess($answer, $form, Yii::app()->session["userId"], $parent) ) {
$canAdmin=Answer::canEdit($answer, $form, Yii::app()->session["userId"], $parent);
if(!@$form["session"][ $answer["session"] ]){
$ctrl->render("co2.views.default.unTpl",array("msg"=>"Session introuvable sur ".$answer["formId"]."<br/><br/> Généré l'AAP pour afficher la candidature","icon"=>"fa-search"));
} else {
......
......@@ -25,7 +25,30 @@ class NewAction extends CAction
"email"=>Yii::app()->session["userEmail"],
"session" => $session
);
$res = Form::newAnswer( $new );
try{
$answer = array(
"formId"=>$new["id"],
"user"=>$new["user"],
"session"=>$new["session"],
"name"=>$new["name"],
"email"=>$new["email"],
"step" => "dossier",
"created"=>time()
);
$costum = CacheHelper::getCostum();
if( isset($costum) &&
isset($costum["slug"]) ){
$answer["source"] = array( "key" => $costum["slug"],
"keys" => array($costum["slug"]),
"insertOrign" => "costum") ;
}
PHDB::insert( self::ANSWER_COLLECTION, $answer);
$res = array( "result" => true,
"answer" => $answer );
} catch (CTKException $e){
return $e->getMessage();
}
if( $form["surveyType"] == "surveyList" ){
$firstId = (@$form["scenario"]) ? array_keys($form["scenario"])[0] : $form["id"];
$ctrl->redirect(Yii::app()->createUrl("/survey/co/index/id/".$firstId."/session/".$session."/answer/".(string)$res["answer"]['_id']));
......
......@@ -50,7 +50,7 @@ class IndexAction extends CAction
$mode = "w";
}
if( $mode == "w" || $mode == "fa" ){
$canEditAnswer = Form::canEditAnswer(Yii::app()->session['userId'], $params["answer"], $form, @$parentForm);
$canEditAnswer = Answer::canEdit($params["answer"], $form, Yii::app()->session['userId'], @$parentForm);
if(empty($canEditAnswer))
$mode = "r";
else
......@@ -58,7 +58,7 @@ class IndexAction extends CAction
}
if(empty($canEditAnswer) && empty($canSeeAnswer)){
$canSeeAnswer = Form::canSeeAnswer(Yii::app()->session['userId'], $params["answer"], $form, @$parentForm);
$canSeeAnswer = Answer::canAccess($params["answer"], $form, Yii::app()->session['userId'], @$parentForm);
if($canSeeAnswer === true && !empty($mode) && ($mode == "w" || $mode == "fa") )
$mode = "r";
}
......
......@@ -51,6 +51,51 @@ class Answer{
return $answer;
}
public static function canEdit($ans, $form=null, $userId=null, $parent=null){
if(ctype_xdigit($ans)){
$ans=self::getById($ans);
$form = Form::getByIdMongo($ans["form"]);
$parent = Slug::getElementBySlug($form["id"]);
$userId=Yii::app()->session["userId"];
}
if($ans["user"] == $userId)
return true;
else if(Form::canAdmin((string)$form["_id"], $form))
return true;
else if(Costum::isSameFunction("canEditAnswer", array("answer"=>$ans)))
return Costum::sameFunction("canEditAnswer", array("answer"=>$ans));
return false;
}
public static function canAccess($answer, $form=null, $userId=null, $parentForm=null){
if(ctype_xdigit($answer)){
$answer=self::getById($answer);
$form = Form::getByIdMongo($answer["form"]);
$parent = Slug::getElementBySlug($form["id"]);
}
if(self::canEdit( $answer, $form, $userId, $parentForm))
return true;
else if(Costum::isSameFunction("canAccessAnswer", array("answer"=>$answer)))
return Costum::sameFunction("canAccessAnswer", array("answer"=>$answer));
return false;
}
public static function getListBy($form=null, $costum=null, $userId=null, $cond=null){
$where = array();
$lists = array();
if(!empty($form))
$where["form"]=$form;
if(!empty($costum))
$where["source.keys"]=array('$in' => array($costum) );
if(!empty($userId))
$where["user"]=$userId;
if(!empty($cond)){
$where=array('$and'=> array($where, $cond));
}
if(!empty($where))
$lists=PHDB::find( Answer::COLLECTION, $where);
return $lists;
}
public static function globalAutocomplete($form, $searchParams){
$searchParams["indexMin"] = (isset($searchParams["indexMin"])) ? $searchParams["indexMin"] : 0;
$searchParams["indexStep"] = (isset($searchParams["indexStep"])) ? $searchParams["indexStep"] : 100;
......
......@@ -100,33 +100,6 @@ class Form {
[ ] array
[ ] properties
*/
public static function newAnswer($data)
{
try{
$answer = array(
"formId"=>$data["id"],
"user"=>$data["user"],
"session"=>$data["session"],
"name"=>$data["name"],
"email"=>$data["email"],
"step" => "dossier",
"created"=>time()
);
$costum = CacheHelper::getCostum();
if( isset($costum) &&
isset($costum["slug"]) ){
$answer["source"] = array( "key" => $costum["slug"],
"keys" => array($costum["slug"]),
"insertOrign" => "costum") ;
}
PHDB::insert( self::ANSWER_COLLECTION, $answer);
return array( "result" => true,
"answer" => $answer );
} catch (CTKException $e){
return $e->getMessage();
}
}
public static function save($id,$data)
{
......@@ -182,12 +155,7 @@ class Form {
return PHDB::findOneById(self::COLLECTION,$id, $fields);
}
public static function canEditAnswerById($id){
$ans=self::getAnswerById($id);
$form = PHDB::findOne( Form::COLLECTION , array("id"=>$ans["formId"]));
$parent = Slug::getElementBySlug($form["id"]);
return self::canEditAnswer(Yii::app()->session["userId"], $ans, $form, $parent);
}
public static function getAnswerById($id,$fields=array()){
return PHDB::findOneById(self::ANSWER_COLLECTION,$id, $fields);
}
......@@ -236,8 +204,8 @@ class Form {
}
return $res;
}
public static function listForAdminNews($form, $answers = array() ){
// TODO OCEATOON : DEPRACTED !?
/* public static function listForAdminNews($form, $answers = array() ){
$results = array();
$uniq = array();
$uniqO = array();
......@@ -390,7 +358,7 @@ class Form {
// exit;
// Rest::json($results);exit ;
return $results ;
}
}*/
//rebuild answerList
// by adding organizing organization (id,type) and project (id,type)
......@@ -429,30 +397,6 @@ class Form {
}
public static function canSeeAnswer($userId, $answer, $form, $parentForm){
if(self::canEditAnswer($userId, $answer, $form, $parentForm))
return true;
else if(Costum::isSameFunction("canSeeAnswer", array("answer"=>$answer)))
return Costum::sameFunction("canSeeAnswer", array("answer"=>$answer));
return false;
}
public static function canEditAnswer($userId, $answer, $form, $parentForm = null){
if(self::canAdmin((string)$form["_id"], $form))
return true;
else if($answer["user"] == $userId)
return true;
else if ( self::canAdmin((string)$form["_id"], $form) )
return true;
// else if(Authorisation::canEditItem(Yii::app()->session["userId"], $parentForm["type"], $answer["_id"] ))
// return true;
// else if(Costum::sameFunction("canEditAnswer", array("answer"=>$answer)))
// return true;
else if(Costum::isSameFunction("canEditAnswer", array("answer"=>$answer)))
return Costum::sameFunction("canEditAnswer", array("answer"=>$answer));
return false;
}
public static function canAdmin($id, $form = array()){
if(empty($form) && @$id)
......@@ -670,33 +614,7 @@ class Form {
}
return false;
}
// public static function getListAnswersBy($formId, $parent, $userId=null, $cond=null){
// $where=array("formId"=> $formId, "parentSlug" => $parent);
// if(!empty($userId)){
// $where["user"]=$userId;
// }
// if(!empty($cond))
// $where=array('$and'=> array($where, $cond));
// $lists=PHDB::find( Form::ANSWER_COLLECTION, $where);
// return $lists;
// }
public static function getListAnswersBy($form=null, $costum=null, $userId=null, $cond=null){
$where = array();
$lists = array();
if(!empty($form))
$where["form"]=$form;
if(!empty($costum))
$where["source.keys"]=array('$in' => array($costum) );
if(!empty($userId))
$where["user"]=$userId;
if(!empty($cond)){
$where=array('$and'=> array($where, $cond));
}
if(!empty($where))
$lists=PHDB::find( Answer::COLLECTION, $where);
return $lists;
}
public static function getDataForAnswer($params){
if(isset($_GET["form"]) || !empty($params["form"])){
......
......@@ -52,7 +52,6 @@ if( $this->layout != "//layouts/empty"){
$this->renderPartial($layoutPath.'header',array("page"=>"ressource","layoutPath"=>$layoutPath));
}
//$canAdmin = Form::canEditAnswer( Form::canAdmin((string)$form["_id"]) || Authorisation::isElementAdmin( $parent["id"] , $parent["type"], Yii::app()->session["userId"] ) );
$canSuperAdmin = Form::canSuperAdmin($form["id"],$session, $form, $adminForm);
$showStyle = ( $canAdmin ) ? "display:none; " : "";
......
......@@ -5,7 +5,7 @@ if($canEditForm === true){
$subFormIds = array_merge( $subFormIds, $form["subForms"] );
?>
<div class="col-xs-12 padding-10 text-center" style="background-color: #eee">
<h4>Admin Form</h4>
<h4>Admin Form : <?php echo $form["name"] ?></h4>
<a href='javascript:;' data-id='<?php echo (String)$form["_id"]; ?>' class="configBtn btn btn-danger bold"><i class='fa fa-cogs'></i> CONFIG </a>
<a href='javascript:;' data-id='<?php echo (String)$form["_id"]; ?>' class='addStepBtn btn btn-danger bold'> <i class='fa fa-plus'></i> Ajouter une étape </a>
</div>
......@@ -129,6 +129,7 @@ var addStepParams = {
properties : {
name : {
label : "Nommé cette étape de votre questionnaire",
value : ""
}
},
save : function (formData) {
......
......@@ -111,6 +111,67 @@ if( $mode != "pdf" ){
<?php }
} ?>
<script type="text/javascript">
$(document).ready(function() {
mylog.log("render","modules/survey/views/tpls/forms/costum/deal/stepOperateur.php");
var today = new Date();
today = today.getDate() + '/' + (today.getMonth()+1) + '/' + today.getFullYear();
$('.validateOperator').off().on("click", function() {
var oid = $(this).data("id");
ctxTpl = {
id : "<?php echo $answer['_id'] ?>",
collection : "answers",
path : "links.operators."+oid,
value : {
date : today,
user : userId
}
};
$(this).fadeOut();
mylog.log("save step save",ctxTpl);
dataHelper.path2Value( ctxTpl, function(params) {
ctxTpl = {
id : "<?php echo $answer['_id'] ?>",
collection : "answers",
path : "step",
value : "deal3" //pourrait etre un parametre element.costum.form.stepOperateur : deal3
};
mylog.log("save step save",ctxTpl);
dataHelper.path2Value( ctxTpl, function(params) {
urlCtrl.loadByHash(location.hash);
} );
} );
});
$('.validateForSubmit').off().on("click", function() {
ctxTpl = {
id : "<?php echo $answer['_id'] ?>",
collection : "answers",
path : "step",
value : "deal1"
};
dataHelper.path2Value( ctxTpl, function(params) {
urlCtrl.loadByHash(location.hash);
});
} );
$('.intentOperator').off().on("click", function() {
var oid = $(this).data("oid");
ctxTpl = {
id : "<?php echo $answer['_id'] ?>",
collection : "answers",
path : "links.operators."+oid,
value : "0"
};
dataHelper.path2Value( ctxTpl, function(params) {
urlCtrl.loadByHash(location.hash);
} );
});
});
</script>
......@@ -2,7 +2,7 @@
$debug = false;
$editBtnL = (Yii::app()->session["userId"] == $answer["user"]) ? " <a href='javascript:;' data-id='".$answer["_id"]."' data-collection='".Form::ANSWER_COLLECTION."' data-path='".$answerPath."' class='add".$kunik." btn btn-default'><i class='fa fa-plus'></i> Ajouter une ligne </a>" : "";
$editParamsBtn = ($canEditForm) ? " <a href='javascript:;' data-id='".$el["_id"]."' data-collection='".$this->costum["contextType"]."' data-path='costum.form.params.".$kunik."' class='previewTpl edit".$kunik."Params btn btn-xs btn-danger'><i class='fa fa-cog'></i> </a>" : "";
$editParamsBtn = ($canEditForm) ? " <a href='javascript:;' data-id='".$parentForm["_id"]."' data-collection='".Form::COLLECTION."' data-path='params.".$kunik."' class='previewTpl edit".$kunik."Params btn btn-xs btn-danger'><i class='fa fa-cog'></i> </a>" : "";
$paramsData = [
"group" => [
......
......@@ -34,7 +34,7 @@
$editBtnL = (Yii::app()->session["userId"] == $answer["user"]) ? " <a href='javascript:;' data-id='".$answer["_id"]."' data-collection='".Form::ANSWER_COLLECTION."' data-path='".$answerPath."' class='add".$kunik." btn btn-default'><i class='fa fa-plus'></i> Ajouter une ligne </a>" : "";
$editParamsBtn = ($canEditForm) ? " <a href='javascript:;' data-id='".$el["_id"]."' data-collection='".$this->costum["contextType"]."' data-path='costum.form.params.".$kunik."' class='previewTpl edit".$kunik."Params btn btn-xs btn-danger'><i class='fa fa-cog'></i> </a>" : "";
$editParamsBtn = ($canEditForm) ? " <a href='javascript:;' data-id='".$parentForm["_id"]."' data-collection='".Form::COLLECTION."' data-path='params.".$kunik."' class='previewTpl edit".$kunik."Params btn btn-xs btn-danger'><i class='fa fa-cog'></i> </a>" : "";
?>
<thead>
<tr>
......
......@@ -28,7 +28,7 @@
$editBtnL = "";
$editParamsBtn = ($canEdit) ? " <a href='javascript:;' data-id='".$el["_id"]."' data-collection='".$this->costum["contextType"]."' data-path='costum.form.params.".$kunik."' class='previewTpl edit".$kunik."Params btn btn-xs btn-danger'><i class='fa fa-cog'></i> </a>" : "";
$editParamsBtn = ($canEdit) ? " <a href='javascript:;' data-id='".$parentForm["_id"]."' data-collection='".Form::COLLECTION."' data-path='params.".$kunik."' class='previewTpl edit".$kunik."Params btn btn-xs btn-danger'><i class='fa fa-cog'></i> </a>" : "";
$paramsData = [
......@@ -295,12 +295,12 @@ if( isset($parentForm["params"]["financement"]["tpl"])){
?>
<script type="text/javascript">
if(typeof costum != "undefined" && costum != null && typeof costum.lists == "undefined")
costum.lists = {};
if(typeof costum != "undefined" && costum != null && typeof costum.lists == "undefined")
costum.lists.budgetInputList = <?php echo json_encode( Yii::app()->session["budgetInputList"] ); ?>;
//costum.lists.financerTypeList = <?php //echo json_encode(Ctenat::$financerTypeList); ?>;
costum.lists.workerList = <?php echo json_encode($orgs); ?>;
if(typeof dyFObj.elementObjParams == "undefined")
dyFObj.elementObjParams = {};
dyFObj.elementObjParams.budgetInputList = <?php echo json_encode( Yii::app()->session["budgetInputList"] ); ?>;
//dyFObj.elementObjParams.financerTypeList = <?php //echo json_encode(Ctenat::$financerTypeList); ?>;
dyFObj.elementObjParams.workerList = <?php echo json_encode($orgs); ?>;
var <?php echo $kunik ?>Data = <?php echo json_encode( (isset($answer["answers"][$copy])) ? $answer["answers"][$copy] : null ); ?>;
......@@ -349,7 +349,7 @@ $(document).ready(function() {
budgetCopy : {
label : "Input Bugdet",
inputType : "select",
options : costum.lists.budgetInputList
options : dyFObj.elementObjParams.budgetInputList
}
},
save : function () {
......
......@@ -8,7 +8,7 @@
<?php
$editBtnL = (Yii::app()->session["userId"] == $answer["user"]) ? " <a href='javascript:;' data-id='".$answer["_id"]."' data-collection='".Form::ANSWER_COLLECTION."' data-path='answers.".$kunik.".' class='add".$keyTpl." btn btn-default'><i class='fa fa-plus'></i> Ajouter une ligne </a>" : "";
$editParamsBtn = ($canEdit) ? " <a href='javascript:;' data-id='".$el["_id"]."' data-collection='".$this->costum["contextType"]."' data-path='costum.form.params.".$keyTpl."' class='previewTpl edit".$keyTpl."Params btn btn-xs btn-danger'><i class='fa fa-cog'></i> </a>" : "";
$editParamsBtn = ($canEdit) ? " <a href='javascript:;' data-id='".$parentForm["_id"]."' data-collection='".Form::COLLECTION."' data-path='params.".$keyTpl."' class='previewTpl edit".$keyTpl."Params btn btn-xs btn-danger'><i class='fa fa-cog'></i> </a>" : "";
$paramsData = [ "nature" => [
"investissement" => "Investissement",
......
......@@ -57,7 +57,7 @@
? " <a href='javascript:;' data-id='".$answer["_id"]."' data-collection='".Form::ANSWER_COLLECTION."' data-path='answers.".$kunik.".' class='add".$keyTpl." btn btn-default'><i class='fa fa-plus'></i> Ajouter un élément </a>"
: "";
$editParamsBtn = ($canEdit) ? " <a href='javascript:;' data-id='".$el["_id"]."' data-collection='".$this->costum["contextType"]."' data-path='costum.form.params.".$kunik."' class='previewTpl edit".$keyTpl."Params btn btn-xs btn-danger'><i class='fa fa-cog'></i> </a>" : "";
$editParamsBtn = ($canEdit) ? " <a href='javascript:;' data-id='".$parentForm["_id"]."' data-collection='".Form::COLLECTION."' data-path='params.".$kunik."' class='previewTpl edit".$keyTpl."Params btn btn-xs btn-danger'><i class='fa fa-cog'></i> </a>" : "";
?>
<thead>
<tr>
......
......@@ -7,7 +7,7 @@
$editBtnL = (Yii::app()->session["userId"] == $answer["user"] && isset($parentForm["params"][$keyTpl.$key]) ) ? " <a href='javascript:;' data-id='".$answer["_id"]."' data-collection='".Form::ANSWER_COLLECTION."' data-path='answers.".$keyTpl.$key.".' class='add".$keyTpl." btn btn-default'><i class='fa fa-plus'></i> Ajouter un élément </a>" : "";
$editParamsBtn = ($canEdit) ? " <a href='javascript:;' data-id='".$el["_id"]."' data-collection='".$this->costum["contextType"]."' data-path='costum.form.params.".$keyTpl.$key."' class='previewTpl edit".$keyTpl."Params btn btn-xs btn-danger'><i class='fa fa-cog'></i> </a>" : "";
$editParamsBtn = ($canEdit) ? " <a href='javascript:;' data-id='".$parentForm["_id"]."' data-collection='".Form::COLLECTION."' data-path='params.".$keyTpl.$key."' class='previewTpl edit".$keyTpl."Params btn btn-xs btn-danger'><i class='fa fa-cog'></i> </a>" : "";
$paramsData = [ "type" => [
Organization::COLLECTION => "Organization",
......
......@@ -6,7 +6,7 @@
<?php
$editBtnL = (Yii::app()->session["userId"] == $answer["user"]) ? " <a href='javascript:;' data-id='".$answer["_id"]."' data-collection='".Form::ANSWER_COLLECTION."' data-path='".$answerPath."' class='add".$kunik." btn btn-default'><i class='fa fa-plus'></i> Ajouter une ligne </a>" : "";
$editParamsBtn = ($canEdit) ? " <a href='javascript:;' data-id='".$el["_id"]."' data-collection='".$this->costum["contextType"]."' data-path='costum.form.params.".$kunik."' class='previewTpl edit".$kunik."Params btn btn-xs btn-danger'><i class='fa fa-cog'></i> </a>" : "";
$editParamsBtn = ($canEdit) ? " <a href='javascript:;' data-id='".$parentForm["_id"]."' data-collection='".Form::COLLECTION."' data-path='params.".$kunik."' class='previewTpl edit".$kunik."Params btn btn-xs btn-danger'><i class='fa fa-cog'></i> </a>" : "";
$communityLinks = array();
if(!empty($form["parent"])){
......@@ -215,10 +215,10 @@ if( isset($parentForm["params"]["financement"]["tpl"])){
?>
<script type="text/javascript">
if(typeof costum.lists == "undefined")
costum.lists = {};
costum.lists.financerTypeList = <?php echo json_encode(Ctenat::$financerTypeList); ?>;
costum.lists.financersList = <?php echo json_encode($orgs); ?>;
if(typeof dyFObj.elementObjParams == "undefined")
dyFObj.elementObjParams = {};
dyFObj.elementObjParams.financerTypeList = <?php echo json_encode(Ctenat::$financerTypeList); ?>;
dyFObj.elementObjParams.financersList = <?php echo json_encode($orgs); ?>;
var <?php echo $kunik ?>Data = <?php echo json_encode( (isset($answer["answers"][$kunik])) ? $answer["answers"][$kunik] : null ); ?>;
sectionDyf.<?php echo $kunik ?>ParamsData = <?php echo json_encode( $paramsData ); ?>;
......
......@@ -27,7 +27,7 @@ if($wizard){
$editBtnL = "";
$editParamsBtn = ($canEditForm) ? " <a href='javascript:;' data-id='".$el["_id"]."' data-collection='".$this->costum["contextType"]."' data-path='costum.form.params.".$kunik."' class='previewTpl edit".$kunik."Params btn btn-xs btn-danger'><i class='fa fa-cog'></i> </a>" : "";
$editParamsBtn = ($canEditForm) ? " <a href='javascript:;' data-id='".$parentForm["_id"]."' data-collection='".Form::COLLECTION."' data-path='params.".$kunik."' class='previewTpl edit".$kunik."Params btn btn-xs btn-danger'><i class='fa fa-cog'></i> </a>" : "";
......@@ -201,12 +201,13 @@ if( isset($parentForm["params"]["financement"]["tpl"])){
?>
<?php if($mode != "pdf"){ ?>
<script type="text/javascript">
if(typeof costum.lists == "undefined")
costum.lists = {};
if(typeof costum.lists == "undefined")
costum.lists.budgetInputList = <?php echo json_encode( Yii::app()->session["budgetInputList"] ); ?>;
costum.lists.financerTypeList = <?php echo json_encode(Ctenat::$financerTypeList); ?>;
costum.lists.financersList = <?php echo json_encode($orgs); ?>;
if(typeof dyFObj.elementObjParams.lists == "undefined")
dyFObj.elementObjParams = {};
dyFObj.elementObjParams.budgetInputList = <?php echo json_encode( Yii::app()->session["budgetInputList"] ); ?>;
dyFObj.elementObjParams.financerTypeList = <?php echo json_encode(Ctenat::$financerTypeList); ?>;
dyFObj.elementObjParams.financersList = <?php echo json_encode($orgs); ?>;
var <?php echo $kunik ?>Data = <?php echo json_encode( (isset($answer["answers"][$budgetKey])) ? $answer["answers"][$budgetKey] : null ); ?>;
......@@ -260,7 +261,7 @@ $(document).ready(function() {
budgetCopy : {
label : "Input Bugdet",
inputType : "select",
options : costum.lists.budgetInputList
options : dyFObj.elementObjParams.budgetInputList
},
openFinancing : {
inputType : "checkboxSimple",
......
......@@ -8,7 +8,7 @@
<?php
$editBtnL = (Yii::app()->session["userId"] == $answer["user"]) ? " <a href='javascript:;' data-id='".$answer["_id"]."' data-collection='".Form::ANSWER_COLLECTION."' data-path='answers.".$kunik.".' class='add".$keyTpl." btn btn-default'><i class='fa fa-plus'></i> Ajouter une ligne </a>" : "";
$editParamsBtn = ($canEdit) ? " <a href='javascript:;' data-id='".$el["_id"]."' data-collection='".$this->costum["contextType"]."' data-path='costum.form.params.".$keyTpl."' class='previewTpl edit".$keyTpl."Params btn btn-xs btn-danger'><i class='fa fa-cog'></i> </a>" : "";
$editParamsBtn = ($canEdit) ? " <a href='javascript:;' data-id='".$parentForm["_id"]."' data-collection='".Form::COLLECTION."' data-path='params.".$keyTpl."' class='previewTpl edit".$keyTpl."Params btn btn-xs btn-danger'><i class='fa fa-cog'></i> </a>" : "";
$paramsData = [ "titles" => [ "Indicateur",
"Objectif / Réalisé",
......@@ -119,9 +119,10 @@ $properties = [
</div>
<script type="text/javascript">
if(typeof costum.lists == "undefined")
costum.lists = {};
costum.lists.indicateurs = <?php echo json_encode($indicateurs); ?>;
if(typeof dyFObj.elementObjParams == "undefined")
dyFObj.elementObjParams = {};
cdyFObj.elementObjParams.indicateurs = <?php echo json_encode($indicateurs); ?>;
var <?php echo $keyTpl ?>Data = <?php echo json_encode( (isset($answer["answers"][$kunik])) ? $answer["answers"][$kunik] : null ); ?>;
sectionDyf.<?php echo $keyTpl ?>ParamsData = <?php echo json_encode( $paramsData ); ?>;
......
......@@ -3,7 +3,7 @@
if($saveOneByOne)
$inpClass = " saveOneByOne";
$editParamsBtn = ($canEdit) ? " <a href='javascript:;' data-id='".$el["_id"]."' data-collection='".$this->costum["contextType"]."' data-path='costum.form.params.".$kunik."' class='previewTpl edit".$kunik."Params btn btn-xs btn-danger'><i class='fa fa-cog'></i> </a>" : "";
$editParamsBtn = ($canEdit) ? " <a href='javascript:;' data-id='".$parentForm["_id"]."' data-collection='".Form::COLLECTION."' data-path='params.".$kunik."' class='previewTpl edit".$kunik."Params btn btn-xs btn-danger'><i class='fa fa-cog'></i> </a>" : "";
$paramsData = [ "list" => [ ] ];
......
......@@ -6,7 +6,7 @@
$editBtnL = (Yii::app()->session["userId"] == $answer["user"]) ? " <a href='javascript:;' data-id='".$answer["_id"]."' data-collection='".Form::ANSWER_COLLECTION."' data-path='".$answerPath."' class='add".$kunik." btn btn-default'><i class='fa fa-plus'></i> Ajouter une ligne </a>" : "";
$editParamsBtn = ($canEdit) ? " <a href='javascript:;' data-id='".$el["_id"]."' data-collection='".$this->costum["contextType"]."' data-path='costum.form.params.".$kunik."' class='previewTpl edit".$kunik."Params btn btn-xs btn-danger'><i class='fa fa-cog'></i> </a>" : "";
$editParamsBtn = ($canEdit) ? " <a href='javascript:;' data-id='".$parentForm["_id"]."' data-collection='".Form::COLLECTION."' data-path='params.".$kunik."' class='previewTpl edit".$kunik."Params btn btn-xs btn-danger'><i class='fa fa-cog'></i> </a>" : "";
$paramsData = [ "listQuestion" => [ "acquis" => "Acquis",
"discussion" => "En discussion",
......
......@@ -9,7 +9,7 @@ $paramsData = [ "options" => [ ] ];
if( isset($parentForm["params"][$key]) )
$paramsData = $parentForm["params"][$key];
$editParamsBtn = ($canEditForm) ? " <a href='javascript:;' data-id='".$el["_id"]."' data-collection='".$this->costum["contextType"]."' data-path='costum.form.params.".$key."' class='previewTpl edit".$key."Params btn btn-xs btn-danger'><i class='fa fa-cog'></i> </a>" : "";
$editParamsBtn = ($canEditForm) ? " <a href='javascript:;' data-id='".$parentForm["_id"]."' data-collection='".Form::COLLECTION."' data-path='params.".$key."' class='previewTpl edit".$key."Params btn btn-xs btn-danger'><i class='fa fa-cog'></i> </a>" : "";
?>
<div class="form-group">
......
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