Commit 24b71c27 authored by Anatole Rakotoson's avatar Anatole Rakotoson
Browse files

sommom

parent 98d1f805
......@@ -137,10 +137,9 @@
<?php
foreach ($properties as $i => $inp) {
if($actualNbr1 < 6){
echo "<th>".$inp["placeholder"]."</th>";
}
$actualNbr1++;
}
?>
<th></th>
......@@ -157,7 +156,7 @@
echo "<tr id='".$kunik.$q."' class='".$kunik."Line'>";
foreach ($properties as $i => $inp) {
if($actualNbr2 < 6){
echo "<td>";
if(isset($a[$i])) {
if(is_array($a[$i]))
......@@ -176,8 +175,7 @@
}
}
echo "</td>";
}
$actualNbr2++;
}
?>
<td style="white-space: normal;">
......@@ -201,66 +199,6 @@
?>
<?php if(isset($answers)){ ?>
<tr>
</th>
<?php
$actualNbr3 = 0;
foreach ($properties as $i => $inp) {
if($actualNbr3 > 5){
echo "<th>".$inp["placeholder"]."</th>";
}
$actualNbr3++;
}
?>
<th></th><th></th>
</tr>
<?php
}
$ct = 0;
$actualNbr4 = 0;
if(isset($answers)){
foreach ($answers as $q => $a) {
//var_dump($actualNbr4);
//if($actualNbr4 > 4){
echo "<tr id='".$kunik.$q."' class='".$kunik."Line'>";
foreach ($properties as $i => $inp) {
if($actualNbr4 > 5){
echo "<td>";
if(isset($a[$i])) {
if(is_array($a[$i])){
echo implode(",", $a[$i]);
}
else {
if($a[$i] == "true"){
echo "oui";
}else if($a[$i] == "false"){
echo "non";
}
else {
echo $a[$i];
}
}
}
echo "</td>";
}
$actualNbr4++;
}
?>
<td></td><td></td>
<?php
$ct++;
echo "</tr>";
//}
}
}
?>
</tbody>
</table>
</div>
......
......@@ -174,8 +174,9 @@ $actualNbr1 = 0;
if($actualNbr2 < 6){
echo "<td>";
if(isset($a[$i])) {
if(is_array($a[$i]))
if(is_array($a[$i])){
echo implode(",", $a[$i]);
}
else
if($i == "site")
{
......@@ -247,6 +248,12 @@ $actualNbr1 = 0;
if($actualNbr4 > 5){
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>";
......@@ -255,6 +262,7 @@ $actualNbr1 = 0;
{
echo $a[$i];
}
}
}
echo "</td>";
}
......
......@@ -110,7 +110,7 @@
echo "<td>";
if(isset($a[$i])) {
if(is_array($a[$i]))
echo implode(",", $a["partenaire"]);
echo implode(",", $a[$i]);
else
echo $a[$i];
}
......
......@@ -177,19 +177,7 @@
echo "<td>";
if(isset($a[$i])) {
if(is_array($a[$i])){
$j = 0;
foreach ($a[$i] as $value) {
foreach ($l['list'] as $il => $inp) {
if($value == $il){
echo $inp["nomVernaculaire"];
if($j < count($a[$i]) - 1){
echo ',';
}
}
}
$j++;
}
echo implode(",", $a[$i]);
}
else if($i == "site") {
......
......@@ -50,7 +50,7 @@
"rules" => [ "required" => false ]
],
"pointGps" => [
"coord" => [
"label" => "Point d’observation terrestre",
"placeholder" => "Point d’observation terrestre",
"inputType" => "formLocality",
......@@ -143,12 +143,12 @@
} else {
echo "<td>";
if(isset($a[$i])) {
if($i == "pointGPS"){
if($i == "coord"){
//$nameM = $a["localisation"];
$lat = $a["pointGPS"]["latitude"];
$lon = $a["pointGPS"]["longitude"];
echo $a["pointGPS"]["latitude"]." / ".$a["pointGPS"]["longitude"];
//echo implode(",", $a["pointGPS"]);
$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])){
......@@ -214,9 +214,26 @@
var today = new Date();
tplCtx.value = { date : today.getDate() + '/' + (today.getMonth()+1) + '/' + today.getFullYear() };
$.each( sectionDyf.<?php echo $kunik ?>.jsonSchema.properties , function(k,val) {
tplCtx.value[k] = $("#"+k).val();
if(val.inputType == "properties")
tplCtx.value[k] = getPairsObj('.'+k+val.inputType);
else if(val.inputType == "array")
tplCtx.value[k] = getArray('.'+k+val.inputType);
else if(val.inputType == "formLocality")
tplCtx.value[k] = getArray('.'+k+val.inputType);
else
tplCtx.value[k] = $("#"+k).val();
});
if(typeof formData != "undefined" && typeof formData.geo != "undefined"){
tplCtx.value["coord"] = formData.geo;
tplCtx.value["address"] = formData.address;
tplCtx.value["geo"] = formData.geo;
tplCtx.value["geoPosition"] = formData.geoPosition;
if(typeof formData.addresses != "undefined")
tplCtx.value["addresses"] = formData.addresses;
}
mylog.log("save tplCtx",tplCtx);
if(typeof tplCtx.value == "undefined")
toastr.error('value cannot be empty!');
......
<?php
$defaultColor = "#354C57";
$structField = "structags";
$keyTpl = "wizard";
$paramsData = [ "title" => "",
"color" => "",
"background" => "",
"nbList" => 2,
"defaultcolor" => "#354C57",
"tags" => "structags"
];
if( isset(Yii::app()->session["costum"]["tpls"][$keyTpl]) ) {
foreach ($paramsData as $i => $v) {
if( isset(Yii::app()->session["costum"]["tpls"][$keyTpl][$i]) )
$paramsData[$i] = Yii::app()->session["costum"]["tpls"][$keyTpl][$i];
}
}
?>
<div class="col-xs-12 margin-top-20">
<div id="<?php echo $wizid ?>" class="swMain">
<style type="text/css">
.swMain ul li > a.done .stepNumber {
border-color: <?php echo ( @$color1 ) ? $color1 : $defaultColor ?>;
background-color: <?php echo ( @$color1 ) ? $color1 : $defaultColor ?>;
}
swMain > ul li > a.selected .stepDesc, .swMain li > a.done .stepDesc {
color: <?php echo ( @$color1 ) ? $color1 : $defaultColor ?>;
font-weight: bolder;
}
.swMain > ul li > a.selected::before, .swMain li > a.done::before{
border-color: <?php echo ( @$color1 ) ? $color1 : $defaultColor ?>;
}
</style>
<ul id="wizardLinks">
<?php
// var_dump($listSteps); exit;
$activeStep = 0;
$nextStepValid =true;
foreach ($formList as $k => $v) {
$n = "todo";
$p = null;
$form = PHDB::findOne( Form::COLLECTION,[ "id"=>$v ] );
if( !empty($form) )
$n = $form["name"];
echo "<li>";
$d = '';
$lbl = "?";
// if(isset(Yii::app()->session["costum"]["form"]["hasStepValidations"]) )
// $lbl = "";
if( (!isset($answer["step"]) && !isset(Yii::app()->session["costum"]["form"]["hasStepValidations"])) ||
$k == 0 ||
(isset($answer["step"]) && $answer["step"] == "all" ) ||
(isset(Yii::app()->session["costum"]["form"]["hasStepValidations"]) && isset($answer["step"]) && $k <= array_search($answer["step"], $formList) ) ||
( isset(Yii::app()->session["costum"]["form"]["hasStepValidations"]) && !isset($answer["step"]) && $k <= Yii::app()->session["costum"]["form"]["hasStepValidations"] ) )
{
$d = 'class="done"';
$lbl = $k;
$l = 'showStepForm(\'#'.$v.'\')' ;
$activeStep = $k;
}
echo '<a onclick="'.$l.'" href="javascript:;" '.$d.' >';
echo '<div class="stepNumber">'.$lbl.'</div>';
echo '<span class="stepDesc">'.$n.'</span></a>';
echo "</li>";
}
?>
</ul>
<?php
foreach ($formList as $k => $v) {
$hide = ($k==$activeStep) ? "" : "hide";
?>
<div id='<?php echo $v ?>' class='align-self-center col-sm-10 sectionStep <?php echo $hide ?>' style="padding-bottom:40px">
<?php
$form = PHDB::findOne( Form::COLLECTION,[ "id"=>$v ] );
?>
<script type="text/javascript">
formInputs["<?php echo $v ?>"] = <?php echo json_encode( $form['inputs'] ); ?>;
var formInputsHere = formInputs;
</script>
<?php
if( !empty($form) )
{
echo '<h1 class="text-center" style="color:'.$color1.'" >'.@$form["name"].'</h1>';
echo "<div class='text-center'>";
if(isset(Yii::app()->session["costum"]["cms"][$form["id"]."desc"]))
echo htmlentities(Yii::app()->session["costum"]["cms"][$form["id"]."desc"]);
else
echo "<span style='color:#aaa'>* section description</span>";
if($canEdit)
echo "<a class='btn btn-xs btn-danger editBtn' href='javascript:;' data-key='".@$form["id"]."desc' data-type='textarea' data-markdown='1' data-path='costum.cms.".@$form["id"]."desc' data-label='Expliquez les objectifs de cette étape ? '> <i class='fa fa-pencil'></i></a>";
echo "</div>";
//echo "<div class='markdown'>";
echo "<div class=''>";
echo $this->renderPartial("survey.views.tpls.forms.formSection",
[ "formId" => $v,
"form" => $form,
"wizard" => true,
"answer"=>$answer,
"mode" => "w",
"showForm" => $showForm,
"canEdit" => $canEdit,
"el" => $el ] ,true );
echo "</div>";
}
else
{
echo "";
}
?>
</div>
<?php
}
?>
<script type="text/javascript">
jQuery(document).ready(function() {
mylog.log("render","survey.views.tpls.forms.wizard");
$.each($(".markdown"), function(k,v){
descHtml = dataHelper.markdownToHtml($(v).html());
$(v).html(descHtml);
});
// Todo BUG en nav private
if( localStorage !== null && localStorage.wizardStep !== null)
showStepForm(localStorage.wizardStep);
});
function showStepForm(id){
mylog.log("showStepForm", id);
$(".sectionStep").addClass("hide");
$(id).removeClass("hide");
localStorage.setItem("wizardStep",id);
}
</script>
</div>
</div>
\ 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