Commit 50cf1c90 authored by Raph El's avatar Raph El
Browse files

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

parents 97bb4ace 94a75299
......@@ -4,13 +4,13 @@
</style>
<div class="col-xs-12 text-center">
<a href="javascript:;" class='btn btn- btn-default' id="showAnswerBtn"><i class="fa fa-bars"></i> Les <?php echo $what ?></a>
<a href="javascript:;" class='btn btn- btn-default' id="showAnswerBtn<?php echo @$viewDom ?>"><i class="fa fa-bars"></i> Les <?php echo $what ?></a>
<a href="#dashboard" class='lbh btn btn-default'><i class="fa fa-area-chart"></i> Observatoire Global</a>
<a href="#community" class='lbh btn btn-default'><i class="fa fa-group"></i> Communauté</a>
<a href="#answer.new" class='btn btn-primary' id="showAnswerBtn"><i class="fa fa-plus"></i> Ajouter <?php echo $what ?></a>
<a href="#answer.new" class='btn btn-primary'><i class="fa fa-plus"></i> Ajouter <?php echo $what ?></a>
</div>
<div id="allAnswersContainer" class="hide col-xs-12 col-lg-offset-2 col-lg-8 margin-top-20">
<div id="allAnswersContainer<?php echo @$viewDom ?>" class="hide col-xs-12 col-lg-offset-2 col-lg-8 margin-top-20">
<ul id="allAnswersList">
<?php
$lbl = $what." ";
......@@ -101,7 +101,12 @@
jQuery(document).ready(function() {
mylog.log("render","/modules/survey/views/tpls/answers/allAnswers.php");
$('#showAnswerBtn<?php echo @$viewDom ?>').on("click",function() {
$("#allAnswersContainer<?php echo @$viewDom ?>").toggleClass("hide");
$('#wizardForm').toggleClass("hide");
//getAjax(".pageContent", baseUrl+"/costum/co/index/slug/<?php echo $el['slug'] ?>/page/answerList",null,"html");
})
<?php if($canEdit) { ?>
......
<?php
//check show btn use cases
// role is financer or operater
if( Form::canFormAccess( ['roles'=>["Financeur","opérateur"] ]))
{
if( isset($form['id']) )
{ ?>
<table class="table table-bordered table-hover directoryTable" >
<tbody class="directoryLines">
<tr>
<td colspan='2' ><h3 style="color:#16A9B1">Intention Opérateur</h3></td>
</tr>
<?php
$str = "";
$selectedOperator = false;
if(isset($answer["links"]["operators"]))
{
$communityLinks = Element::getCommunityByTypeAndId($this->costum["contextType"],$this->costum["contextId"]);
$persons = Link::groupFindByType( Person::COLLECTION,$communityLinks,["name","links"] );
$organizations = Link::groupFindByType( Organization::COLLECTION,$communityLinks,["name","links"] );
$financers = array_merge( $persons, $organizations );
$orgs = [];
if( !empty($or["links"]["memberOf"][$this->costum["contextId"]]["roles"]) ) {
foreach ($financers as $id => $or) {
$roles = $or["links"]["memberOf"][$this->costum["contextId"]]["roles"];
if( isset($this->costum["form"]["params"]["financement"]["limitRoles"]) && !empty($roles))
{
foreach ($roles as $i => $r) {
if( in_array($r, $this->costum["form"]["params"]["financement"]["limitRoles"]) )
$orgs[$id] = $or["name"];
}
}
}
}
// var_dump($orgs);exit;
foreach ($answer["links"]["operators"] as $oid => $state) {
if($state != "0")
{
$selectedOperator = true;
$str = '<tr>'.
'<td>Opérateur</td>'.
'<td>'.$oid.'</td>'.
'<td><span class="label label-success">Validé</span></td>'.
'</tr>';
}
else if( !$selectedOperator )
{
//if role financeurs
$str .= '<tr>'.
'<td>Opérateur Candidat</td>'.
'<td>'.$oid.'</td>'.
'<td><span class="label label-success"><a href="javascript:;" class="validateOperator" data-id="'.$oid.'">à Valider</a></span></td>'.
'</tr>';
}
}
}
echo $str;
//if role operateurs
if(!$selectedOperator){
?>
<tr>
<td colspan='2' class="text-center" >
<a href="javascript:;" data-oid="<?php echo Yii::app()->session["userId"] ?>" class="intentOperator btn btn-primary">Opérateur : Demander de prendre en charge</a>
</td>
</tr>
<?php
}
//if role financeur
if(!$selectedOperator){
?>
<tr>
<td colspan='2' class="text-center" >
<a href="javascript:;" data-oid="<?php echo Yii::app()->session["userId"] ?>" class="validateOperator btn btn-danger">Financeur : Veuillez étudier ce dossier</a>
</td>
</tr>
<?php }?>
</tbody>
</table>
<?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();
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>
<?php } else {?>
<div class="col-xs-12">
Cette étape sera validé par un opérateur et les financeurs.
</div>
<?php } ?>
\ No newline at end of file
......@@ -7,7 +7,6 @@
<a href="javascript:;" class='btn btn- btn-default' id="showAnswerBtn"><i class="fa fa-bars"></i> Les <?php echo $what ?></a>
<a href="#dashboard" class='lbh btn btn-default'><i class="fa fa-area-chart"></i> Observatoire Global</a>
<a href="javascript:;" id="globalCommunityBtn" class=' btn btn-default'><i class="fa fa-group"></i> Communauté</a>
<a href="<?php echo Yii::app()->createUrl("/costum")?>/co/index/slug/<?php echo $el["slug"] ?>/answer/new" class='btn btn-primary' id="showAnswerBtn"><i class="fa fa-plus"></i> Ajouter <?php echo $what ?></a>
</div>
<div id="allAnswersContainer" class="hide col-xs-12 col-lg-offset-2 col-lg-8 margin-top-20">
......@@ -21,9 +20,9 @@
foreach ($allAnswers as $k => $ans) {
$ct++;
$lbl = $what." ".$ct;
if(isset($this->costum["form"]["title"]))
if(isset(Yii::app()->session["costum"]["form"]["title"]))
{
$titlePath = explode( ".", $this->costum["form"]["title"] );
$titlePath = explode( ".", Yii::app()->session["costum"]["form"]["title"] );
if(isset($ans["answers"][$titlePath[0]][$titlePath[1]]))
$lbl = $ans["answers"][$titlePath[0]][$titlePath[1]];
}
......@@ -124,7 +123,7 @@
<li class="answerLi col-xs-12" <?php echo $liBg ?>>
<div class="col-xs-3 text-center">
<a href="<?php echo Yii::app()->createUrl("/costum")?>/co/index/slug/<?php echo $el["slug"] ?>/answer/<?php echo $ans["_id"] ?>"> <?php echo $lbl ?></a>
<a href="#answer.index.id.<?php echo $ans["_id"] ?>" class="lbh"> <?php echo $lbl ?></a>
</div>
<div class="col-xs-8">
......
......@@ -467,11 +467,14 @@ echo "<h4 style='color:".(($titleColor) ? $titleColor : "black")."'>Suivi des d
<form id="form-add-todo" class="form-add-todo">
<!-- <label for="todo">To do:</label> -->
<?php
$uids = [];;
foreach (array_keys($el["links"]["members"]) as $ix => $id) {
$uids[] = new MongoId($id);
$uids = [];
if(isset($el["links"]["members"])){
foreach (array_keys($el["links"]["members"]) as $ix => $id) {
$uids[] = new MongoId($id);
}
}
$members = PHDB::find ( Person::COLLECTION, [ "_id" => [ '$in' => $uids ] ] , ["name","username"] );
?>
<!-- <textarea id="new-todo-item" class="new-todo-item col-xs-5" name="todo" placeholder="Quoi"></textarea> -->
<div class="col-xs-12">
......
......@@ -9,7 +9,7 @@ $paramsData = [ "options" => [ ] ];
if( isset($this->costum["form"]["params"][$key]) )
$paramsData = $this->costum["form"]["params"][$key];
if(!isset($options))
if(!isset($options) && isset($this->costum["form"]["params"][$key]['options']))
$options = $this->costum["form"]["params"][$key]['options'];
if($mode == "r"){ ?>
......
......@@ -202,7 +202,7 @@ jQuery(document).ready(function() {
contextData = {
id : "<?php echo $this->costum["contextId"] ?>",
type : "<?php echo $this->costum["contextType"] ?>",
name : '<?php echo htmlentities($el['name']) ?>',
name : "<?php echo htmlspecialchars($el['name']) ?>",
profilThumbImageUrl : "http://127.0.0.1/ph/themes/CO2/assets/img/LOGOS/CO2/logo-min.png"
};
getAjax("community",
......@@ -213,12 +213,6 @@ jQuery(document).ready(function() {
},
"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");
});
});
......
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