Commit 942711ea authored by Anatole Rakotoson's avatar Anatole Rakotoson

sommom nomterritoire

parent 47a41982
<?php if($answer){
?>
<div class="form-group">
<table class="table table-bordered table-hover directoryTable" id="<?php echo $kunik?>">
<?php
$editBtnL = ($canAnswer) ? " <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='".$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>" : "";
<?php
$editBtnL = ($canEdit and $mode != "r" and $mode != "pdf") ? " <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 and $mode != "r" || $mode != "pdf") ? " <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>" : "";
$a = [];
......@@ -97,9 +96,12 @@
?>
<?php if( $mode != "pdf" ){ ?>
<table class="table table-bordered table-hover directoryTable" id="<?php echo $kunik?>">
<thead>
<tr>
<td colspan='<?php echo count( $properties)+2?>' ><h4 style="color:<?php echo ($titleColor) ? $titleColor : "black"; ?>"><?php echo $label.$editQuestionBtn.$editParamsBtn.$editBtnL?></h4>
<td colspan="<?php if( $mode != "r"){ echo count( $properties)+2 ; } else { echo count( $properties) ;} ?>" ><h4 style="color:<?php echo ($titleColor) ? $titleColor : "black"; ?>"><?php echo $label.$editQuestionBtn.$editParamsBtn.$editBtnL?></h4>
<?php echo $info ?>
</td>
</tr>
......@@ -115,7 +117,9 @@
echo "<th>".$inp["placeholder"]."</th>";
}
} ?>
<th></th>
<?php if( $mode != "r" ){ ?>
<th></th>
<?php } ?>
</tr>
<tr></tr>
<?php } ?>
......@@ -152,19 +156,21 @@
}
}
?>
<td style="white-space: normal;">
<?php
$this->renderPartial( "survey.views.tpls.forms.cplx.editDeleteLineBtn" , [
"canEdit"=>($canEdit || $canAnswer),
"id" => $answer["_id"],
"collection" => Form::ANSWER_COLLECTION,
"q" => $q,
"path" => $answerPath.$q,
"keyTpl"=>$kunik
] ); ?>
<a href="javascript:;" class="btn btn-xs btn-primary openAnswersComment" onclick="commentObj.openPreview('answers','<?php echo $answer["_id"]?>','<?php echo $answer["_id"].$key.$q ?>', '<?php echo @$a['step'] ?>')"><?php echo PHDB::count(Comment::COLLECTION, array("contextId"=>$answer["_id"],"contextType"=>"answers", "path"=>$answer["_id"].$key.$q))?> <i class='fa fa-commenting'></i></a>
</td>
<?php if( $mode != "r"){?>
<td style="white-space: normal;">
<?php
$this->renderPartial( "survey.views.tpls.forms.cplx.editDeleteLineBtn" , [
"canEdit"=>($canEdit),
"id" => $answer["_id"],
"collection" => Form::ANSWER_COLLECTION,
"q" => $q,
"path" => $answerPath.$q,
"keyTpl"=>$kunik
] ); ?>
<a href="javascript:;" class="btn btn-xs btn-primary openAnswersComment" onclick="commentObj.openPreview('answers','<?php echo $answer["_id"]?>','<?php echo $answer["_id"].$key.$q ?>', '<?php echo @$a['step'] ?>')"><?php echo PHDB::count(Comment::COLLECTION, array("contextId"=>$answer["_id"],"contextType"=>"answers", "path"=>$answer["_id"].$key.$q))?> <i class='fa fa-commenting'></i></a>
</td>
<?php } ?>
<?php
$ct++;
echo "</tr>";
......@@ -174,7 +180,77 @@
?>
</tbody>
</table>
<?php
} else {
?>
<div>
<label>
<h4 style="color:<?php echo ($titleColor) ? $titleColor : "black"; ?>"><?php echo $label.$editQuestionBtn.$editParamsBtn.$editBtnL?></h4>
<?php echo $info ?>
</label>
</div>
<table class="table table-bordered table-hover directoryTable" id="<?php echo $kunik?>">
<thead>
<tr>
<?php
if( count($answers)>0 ){
foreach ($properties as $i => $inp) {
if (isset($inp["placeholder"])){
echo "<th>".$inp["placeholder"]."</th>";
}
} ?>
<?php } ?>
</tr>
</thead>
<tbody class="directoryLines">
<?php
if(isset($answers)){
foreach ($answers as $q => $a) {
echo "<tr id='".$kunik.$q."' class='".$kunik."Line'>";
foreach ($properties as $i => $inp) {
if($i == "location"){
} else {
echo "<td>";
if(isset($a[$i])) {
if($i == "pointGPS"){
//$nameM = $a["localisation"];
$lat = $a["pointGPS"]["latitude"];
$lon = $a["pointGPS"]["longitude"];
echo $a["pointGPS"]["latitude"]." / ".$a["pointGPS"]["longitude"];
//echo implode(",", $a["pointGPS"]);
echo '<span class="pull-right" style= "margin-right : 5px;"><a id="showActeurLocation" href="javascript:;" onclick=""><i class="fa fa-map-o" aria-hidden="true"></i></a></span>';
}
else if(is_array($a[$i])){
echo implode(",", $a["port"]);
}
else{
echo $a[$i];
}
}
echo "</td>";
}
}
echo "</tr>";
}
}
?>
</tbody>
</table>
<?php } ?>
</div>
<?php if( $mode != "pdf"){?>
<script type="text/javascript">
var <?php echo $kunik ?>Data = <?php echo json_encode( (isset($answers)) ? $answers : null ); ?>;
......@@ -317,6 +393,4 @@
});
</script>
<?php } else {
//echo "<h4 class='text-red'>CALENDAR works with existing answers</h4>";
} ?>
\ No newline at end of file
<?php } } ?>
\ No newline at end of file
<?php if($answer){
?>
<div class="form-group">
<table class="table table-bordered table-hover directoryTable" id="<?php echo $kunik?>">
<?php
$editBtnL = ($canAnswer) ? " <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> <a href='javascript:;' data-id='".$answer["_id"]."' data-collection='answers' data-path='answers.sommomForm1.sommomForm122.' class='addorganismesommomForm122 btn btn-default'><i class='fa fa-plus'></i> Ajouter un organisme </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>" : "";
$editBtnL = ($canEdit and $mode != "r" and $mode != "pdf") ? " <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 and $mode != "r" || $mode != "pdf") ? " <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 = [
"statut" => [
......@@ -114,10 +113,12 @@
}
?>
<?php if( $mode != "pdf" ){ ?>
<table class="table table-bordered table-hover directoryTable" id="<?php echo $kunik?>">
<thead>
<tr>
<td colspan='<?php echo count( $properties)+2?>' ><h4 style="color:<?php echo ($titleColor) ? $titleColor : "black"; ?>"><?php echo $label.$editQuestionBtn.$editParamsBtn.$editBtnL?></h4>
<td colspan="<?php if( $mode != "r"){ echo count( $properties)+2 ; } else { echo count( $properties) ;} ?>" ><h4 style="color:<?php echo ($titleColor) ? $titleColor : "black"; ?>"><?php echo $label.$editQuestionBtn.$editParamsBtn.$editBtnL?></h4>
<?php echo $info ?>
</td>
</tr>
......@@ -135,7 +136,9 @@
}
}
} ?>
<th></th>
<?php if( $mode != "r" ){ ?>
<th></th>
<?php } ?>
</tr>
<tr></tr>
<?php } ?>
......@@ -175,19 +178,21 @@
}
?>
<td style="white-space: normal;">
<?php
$this->renderPartial( "survey.views.tpls.forms.cplx.editDeleteLineBtn" , [
"canEdit"=>($canEdit || $canAnswer),
"id" => $answer["_id"],
"collection" => Form::ANSWER_COLLECTION,
"q" => $q,
"path" => $answerPath.$q,
"keyTpl"=>$kunik
] ); ?>
<a href="javascript:;" class="btn btn-xs btn-primary openAnswersComment" onclick="commentObj.openPreview('answers','<?php echo $answer["_id"]?>','<?php echo $answer["_id"].$key.$q ?>', '<?php echo @$a['step'] ?>')"><?php echo PHDB::count(Comment::COLLECTION, array("contextId"=>$answer["_id"],"contextType"=>"answers", "path"=>$answer["_id"].$key.$q))?> <i class='fa fa-commenting'></i></a>
</td>
<?php if( $mode != "r"){?>
<td style="white-space: normal;">
<?php
$this->renderPartial( "survey.views.tpls.forms.cplx.editDeleteLineBtn" , [
"canEdit"=>($canEdit),
"id" => $answer["_id"],
"collection" => Form::ANSWER_COLLECTION,
"q" => $q,
"path" => $answerPath.$q,
"keyTpl"=>$kunik
] ); ?>
<a href="javascript:;" class="btn btn-xs btn-primary openAnswersComment" onclick="commentObj.openPreview('answers','<?php echo $answer["_id"]?>','<?php echo $answer["_id"].$key.$q ?>', '<?php echo @$a['step'] ?>')"><?php echo PHDB::count(Comment::COLLECTION, array("contextId"=>$answer["_id"],"contextType"=>"answers", "path"=>$answer["_id"].$key.$q))?> <i class='fa fa-commenting'></i></a>
</td>
<?php } ?>
<?php
$ct++;
echo "</tr>";
......@@ -197,7 +202,87 @@
?>
</tbody>
</table>
<?php
} else {
?>
<div>
<label>
<h4 style="color:<?php echo ($titleColor) ? $titleColor : "black"; ?>"><?php echo $label.$editQuestionBtn.$editParamsBtn.$editBtnL?></h4>
<?php echo $info ?>
</label>
</div>
<table class="table table-bordered table-hover directoryTable" id="<?php echo $kunik?>">
<thead>
<?php
if( count($answers)>0 ){ ?>
<tr>
<?php
foreach ($properties as $i => $inp) {
if(isset($inp["label"])){
if(isset($inp["label"])){
echo "<th>".$inp["label"]."</th>";
}
}
} ?>
</tr>
<?php } ?>
</thead>
<tbody class="directoryLines">
<?php
$ct = 0;
if(isset($answers)){
foreach ($answers as $q => $a) {
echo "<tr id='".$kunik.$q."' class='".$kunik."Line'>";
foreach ($properties as $i => $inp) {
if($i == "location"){
} else {
echo "<td>";
if(isset($a[$i])) {
if($i == "coord"){
$lat = $a["coord"]["latitude"];
$lon = $a["coord"]["longitude"];
echo $a["coord"]["latitude"]." / ".$a["coord"]["longitude"];
//echo implode(",", $a["coord"]);
echo '<span class="pull-right" style= "margin-right : 5px;"><a id="showActeurLocation" href="javascript:;" onclick=""><i class="fa fa-map-o" aria-hidden="true"></i></a></span>';
}
else if(is_array($a[$i])){
echo implode(",", $a[$i]);
}
else if($i == "site") {
echo "<a href='".$a[$i]."'>".$a[$i]."</a>";
}
else{
echo $a[$i];
}
}
echo "</td>";
}
}
echo "</tr>";
}
}
?>
</tbody>
</table>
<?php } ?>
</div>
<?php if( $mode != "pdf"){?>
<script type="text/javascript">
var <?php echo $kunik ?>Data = <?php echo json_encode( (isset($answers)) ? $answers : null ); ?>;
......@@ -333,6 +418,4 @@
});
</script>
<?php } else {
//echo "<h4 class='text-red'>CALENDAR works with existing answers</h4>";
} ?>
\ No newline at end of file
<?php } } ?>
\ No newline at end of file
{
"_id" : ObjectId("5e4fbf0041e01ff668c90f2f"),
"id" : "sommomForm1",
"type" : "openForm",
"name" : "TERRITOIRE – DESCRIPTION GENERALE",
"inputs" : {
"sommomForm120" : {
"label" : "Nom du territoire",
"placeholder" : "",
"info" : "Quel est le territoire décrit ? (territoire français d'outre-mer ou métropolitain)",
"type" : "tpls.forms.text",
"position" : "1"
},
"sommomForm121" : {
"label" : "Nombre d'îles",
"placeholder" : "",
"info" : "Combien d'îles composent le territoire décrit ?",
"type" : "tpls.forms.text",
"position" : "2"
},
"sommomForm128" : {
"label" : "Geeolocalisation du territoire",
"placeholder" : "",
"info" : "",
"type" : "tpls.forms.sommom.mapterritoire",
"position" : "3"
},
"sommomForm19" : {
"label" : "Photo",
"placeholder" : "",
"info" : "",
"type" : "tpls.forms.uploader",
"uploader" : {
"docType" : "file",
"paste" : true,
"itemLimit" : 1
},
"position" : "4"
},
"sommomForm122" : {
"label" : "Organisme de ce territoire",
"placeholder" : "",
"info" : "Organisme de ce territoire",
"type" : "tpls.forms.sommom.organisme",
"position" : "5"
},
"sommomForm11" : {
"label" : "Espace géographique du territoire",
"placeholder" : "",
"info" : "Généralités",
"type" : "tpls.forms.sommom.geographie",
"position" : "6"
},
"sommomForm12" : {
"label" : "Zones d’observation / d’activité",
"placeholder" : "",
"info" : "Zones d’observation / d’activité",
"type" : "tpls.forms.sommom.zone_obs_act",
"position" : "7"
},
"sommomForm13" : {
"label" : "Espèces ciblées par l'activité d'observation",
"placeholder" : "",
"info" : "Ces champs permettent de renseigner les espèces présentes sur le territoire et leurs spécificités locales.",
"type" : "tpls.forms.sommom.especeObs",
"position" : "8"
},
"sommomForm14" : {
"label" : "Plans de conservation",
"placeholder" : "",
"info" : "",
"type" : "tpls.forms.sommom.planConsevation",
"position" : "9"
},
"sommomForm15" : {
"label" : "Les collaborations régionales et intergouvernementales",
"placeholder" : "",
"info" : "Ces champs permettent de renseigner des collaborations existantes entre le territoire et d’autres acteurs, pays, etc. de la région interagissant sur les mêmes populations de cétacés.",
"type" : "tpls.forms.sommom.collaboration",
"position" : "10"
},
"sommomForm165" : {
"label" : "Aire marine Protégée",
"placeholder" : "",
"info" : "",
"type" : "tpls.forms.sommom.airemarineprotege",
"position" : "11"
},
"sommomForm1654" : {
"label" : "Réglementation",
"placeholder" : "",
"info" : "",
"type" : "tpls.forms.sommom.reglementationesp",
"position" : "12"
}
},
"updated" : NumberLong(1587121650)
}
\ No newline at end of file
<?php if($answer){
?>
<div class="form-group">
<table class="table table-bordered table-hover directoryTable" id="<?php echo $kunik?>">
<?php
$editBtnL = ($canAnswer) ? " <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> <a href='javascript:;' data-id='".$answer["_id"]."' data-collection='answers' data-path='answers.sommomForm1.sommomForm122.' class='addorganismesommomForm122 btn btn-default'><i class='fa fa-plus'></i> Ajouter un organisme </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>" : "";
$editBtnL = ($canEdit and $mode != "r" and $mode != "pdf") ? " <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 and $mode != "r" || $mode != "pdf") ? " <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 = [
"nature" => [
......@@ -112,9 +111,12 @@
?>
<?php if( $mode != "pdf" ){ ?>
<table class="table table-bordered table-hover directoryTable" id="<?php echo $kunik?>">
<thead>
<tr>
<td colspan='<?php echo count( $properties)+2?>' ><h4 style="color:<?php echo ($titleColor) ? $titleColor : "black"; ?>"><?php echo $label.$editQuestionBtn.$editParamsBtn.$editBtnL?></h4>
<td colspan="<?php if( $mode != "r"){ echo count( $properties)+2 ; } else { echo count( $properties) ;} ?>" ><h4 style="color:<?php echo ($titleColor) ? $titleColor : "black"; ?>"><?php echo $label.$editQuestionBtn.$editParamsBtn.$editBtnL?></h4>
<?php echo $info ?>
</td>
</tr>
......@@ -128,7 +130,9 @@
foreach ($properties as $i => $inp) {
echo "<th>".$inp["placeholder"]."</th>";
} ?>
<th></th>
<?php if( $mode != "r" ){ ?>
<th></th>
<?php } ?>
</tr>
<tr></tr>
<?php } ?>
......@@ -166,19 +170,21 @@
echo "</td>";
}
?>
<td style="white-space: normal;">
<?php
$this->renderPartial( "survey.views.tpls.forms.cplx.editDeleteLineBtn" , [
"canEdit"=>($canEdit || $canAnswer),
"id" => $answer["_id"],
"collection" => Form::ANSWER_COLLECTION,
"q" => $q,
"path" => $answerPath.$q,
"keyTpl"=>$kunik
] ); ?>
<a href="javascript:;" class="btn btn-xs btn-primary openAnswersComment" onclick="commentObj.openPreview('answers','<?php echo $answer["_id"]?>','<?php echo $answer["_id"].$key.$q ?>', '<?php echo @$a['step'] ?>')"><?php echo PHDB::count(Comment::COLLECTION, array("contextId"=>$answer["_id"],"contextType"=>"answers", "path"=>$answer["_id"].$key.$q))?> <i class='fa fa-commenting'></i></a>
</td>
<?php if( $mode != "r"){?>
<td style="white-space: normal;">
<?php
$this->renderPartial( "survey.views.tpls.forms.cplx.editDeleteLineBtn" , [
"canEdit"=>($canEdit),
"id" => $answer["_id"],
"collection" => Form::ANSWER_COLLECTION,
"q" => $q,
"path" => $answerPath.$q,
"keyTpl"=>$kunik
] ); ?>
<a href="javascript:;" class="btn btn-xs btn-primary openAnswersComment" onclick="commentObj.openPreview('answers','<?php echo $answer["_id"]?>','<?php echo $answer["_id"].$key.$q ?>', '<?php echo @$a['step'] ?>')"><?php echo PHDB::count(Comment::COLLECTION, array("contextId"=>$answer["_id"],"contextType"=>"answers", "path"=>$answer["_id"].$key.$q))?> <i class='fa fa-commenting'></i></a>
</td>
<?php } ?>
<?php
$ct++;
echo "</tr>";
......@@ -188,7 +194,81 @@
?>
</tbody>
</table>
<?php
} else {
?>
<div>
<label>
<h4 style="color:<?php echo ($titleColor) ? $titleColor : "black"; ?>"><?php echo $label.$editQuestionBtn.$editParamsBtn.$editBtnL?></h4>
<?php echo $info ?>
</label>
</div>
<table class="table table-bordered table-hover directoryTable" id="<?php echo $kunik?>">
<thead>
<?php
if( count($answers)>0 ){ ?>
<tr>
<?php
foreach ($properties as $i => $inp) {
echo "<th>".$inp["placeholder"]."</th>";
} ?>
</tr>
<?php } ?>
</thead>
<tbody class="directoryLines">
<?php
$ct = 0;
if(isset($answers)){
foreach ($answers as $q => $a) {
echo "<tr id='".$kunik.$q."' class='".$kunik."Line'>";
foreach ($properties as $i => $inp) {
echo "<td>";
if(isset($a[$i])) {
if(is_array($a[$i])){
echo implode(",", $a[$i]);
} else {
if($i == "site") {
echo "<a href='".$a[$i]."'>".$a[$i]."</a>";
}
else if($i == "type" && isset($paramsData[$i][$a[$i]])){
echo $paramsData[$i][$a[$i]];
}
else if($i == "nature" && isset($paramsData[$i][$a[$i]])){
echo $paramsData[$i][$a[$i]];
}
else {
echo $a[$i];
}
}
}
echo "</td>";
}
echo "</tr>";
}
}
?>
</tbody>
</table>
<?php } ?>
</div>
<?php if( $mode != "pdf"){?>
<script type="text/javascript">
var <?php echo $kunik ?>Data = <?php echo json_encode( (isset($answers)) ? $answers : null ); ?>;
......@@ -316,6 +396,4 @@
});
</script>
<?php } else {
//echo "<h4 class='text-red'>CALENDAR works with existing answers</h4>";
} ?>
\ No newline at end of file
<?php } } ?>
\ No newline at end of file