Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Pixel Humain
survey
Commits
2d7b3be2
Commit
2d7b3be2
authored
Jun 02, 2020
by
Raph El
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'development' into addressJS
parents
c3390de3
296b9805
Changes
50
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
50 changed files
with
3735 additions
and
598 deletions
+3735
-598
controllers/actions/DeleteAction.php
controllers/actions/DeleteAction.php
+11
-5
views/tpls/acceptAndAdmin.php
views/tpls/acceptAndAdmin.php
+15
-0
views/tpls/forms/cplx/address.php
views/tpls/forms/cplx/address.php
+1
-1
views/tpls/forms/cplx/answers.php
views/tpls/forms/cplx/answers.php
+34
-25
views/tpls/forms/cplx/budget.php
views/tpls/forms/cplx/budget.php
+7
-2
views/tpls/forms/cplx/editDeleteLineBtn.php
views/tpls/forms/cplx/editDeleteLineBtn.php
+1
-1
views/tpls/forms/cplx/financementFromBudget.php
views/tpls/forms/cplx/financementFromBudget.php
+2
-9
views/tpls/forms/cplx/list.php
views/tpls/forms/cplx/list.php
+196
-0
views/tpls/forms/cplx/multiCheckboxPlus.php
views/tpls/forms/cplx/multiCheckboxPlus.php
+558
-0
views/tpls/forms/cplx/multiList.php
views/tpls/forms/cplx/multiList.php
+286
-0
views/tpls/forms/cplx/multiRadio.php
views/tpls/forms/cplx/multiRadio.php
+522
-0
views/tpls/forms/cplx/multitextvalidation.php
views/tpls/forms/cplx/multitextvalidation.php
+330
-0
views/tpls/forms/cplx/offres.php
views/tpls/forms/cplx/offres.php
+4
-2
views/tpls/forms/cplx/select2.php
views/tpls/forms/cplx/select2.php
+39
-0
views/tpls/forms/cplx/subList.php
views/tpls/forms/cplx/subList.php
+224
-0
views/tpls/forms/cplx/suiviFromBudget.php
views/tpls/forms/cplx/suiviFromBudget.php
+5
-11
views/tpls/forms/cplx/suiviFromBudgetTable.php
views/tpls/forms/cplx/suiviFromBudgetTable.php
+7
-4
views/tpls/forms/cplx/validationFromOffres.php
views/tpls/forms/cplx/validationFromOffres.php
+499
-0
views/tpls/forms/formbuilder.php
views/tpls/forms/formbuilder.php
+2
-1
views/tpls/forms/select.php
views/tpls/forms/select.php
+1
-0
views/tpls/forms/sommom/acteurEncadrement.php
views/tpls/forms/sommom/acteurEncadrement.php
+1
-1
views/tpls/forms/sommom/airemarineprotege.php
views/tpls/forms/sommom/airemarineprotege.php
+51
-18
views/tpls/forms/sommom/collaboration.php
views/tpls/forms/sommom/collaboration.php
+16
-8
views/tpls/forms/sommom/contribution.php
views/tpls/forms/sommom/contribution.php
+3
-4
views/tpls/forms/sommom/encadrementrec.php
views/tpls/forms/sommom/encadrementrec.php
+8
-73
views/tpls/forms/sommom/equipeDedie.php
views/tpls/forms/sommom/equipeDedie.php
+2
-3
views/tpls/forms/sommom/especeObs.php
views/tpls/forms/sommom/especeObs.php
+76
-84
views/tpls/forms/sommom/evntdedie.php
views/tpls/forms/sommom/evntdedie.php
+3
-1
views/tpls/forms/sommom/formdedie.php
views/tpls/forms/sommom/formdedie.php
+2
-3
views/tpls/forms/sommom/geographie.php
views/tpls/forms/sommom/geographie.php
+13
-13
views/tpls/forms/sommom/label.php
views/tpls/forms/sommom/label.php
+17
-74
views/tpls/forms/sommom/mapterritoire.php
views/tpls/forms/sommom/mapterritoire.php
+17
-10
views/tpls/forms/sommom/organisme.php
views/tpls/forms/sommom/organisme.php
+77
-23
views/tpls/forms/sommom/outilsPed.php
views/tpls/forms/sommom/outilsPed.php
+8
-3
views/tpls/forms/sommom/pgmrech.php
views/tpls/forms/sommom/pgmrech.php
+2
-3
views/tpls/forms/sommom/pgmsci.php
views/tpls/forms/sommom/pgmsci.php
+2
-4
views/tpls/forms/sommom/planConsevation.php
views/tpls/forms/sommom/planConsevation.php
+5
-12
views/tpls/forms/sommom/publact.php
views/tpls/forms/sommom/publact.php
+4
-6
views/tpls/forms/sommom/recommendation.php
views/tpls/forms/sommom/recommendation.php
+0
-1
views/tpls/forms/sommom/reglementation.php
views/tpls/forms/sommom/reglementation.php
+30
-107
views/tpls/forms/sommom/reglementationesp.php
views/tpls/forms/sommom/reglementationesp.php
+351
-0
views/tpls/forms/sommom/sitededie.php
views/tpls/forms/sommom/sitededie.php
+7
-17
views/tpls/forms/sommom/structureaer.php
views/tpls/forms/sommom/structureaer.php
+5
-6
views/tpls/forms/sommom/structureop.php
views/tpls/forms/sommom/structureop.php
+25
-20
views/tpls/forms/sommom/structuresite.php
views/tpls/forms/sommom/structuresite.php
+60
-23
views/tpls/forms/sommom/surveillanceControle.php
views/tpls/forms/sommom/surveillanceControle.php
+16
-13
views/tpls/forms/sommom/territoire.php
views/tpls/forms/sommom/territoire.php
+3
-2
views/tpls/forms/sommom/wizard.php
views/tpls/forms/sommom/wizard.php
+163
-0
views/tpls/forms/sommom/zone_obs_act.php
views/tpls/forms/sommom/zone_obs_act.php
+4
-4
views/tpls/forms/uploader.php
views/tpls/forms/uploader.php
+20
-1
No files found.
controllers/actions/DeleteAction.php
View file @
2d7b3be2
...
...
@@ -10,7 +10,9 @@ class DeleteAction extends CAction
//check form et session exist
if
(
$answer
=
PHDB
::
findOne
(
Form
::
ANSWER_COLLECTION
,
array
(
"_id"
=>
new
MongoId
((
$id
))))
)
{
if
(
$answer
[
"user"
]
==
Yii
::
app
()
->
session
[
"userId"
]
||
Authorisation
::
isElementAdmin
(
$id
,
Form
::
ANSWER_COLLECTION
,
Yii
::
app
()
->
session
[
"userId"
],
false
)){
if
(
$answer
[
"user"
]
==
Yii
::
app
()
->
session
[
"userId"
]
||
Authorisation
::
isElementAdmin
(
$id
,
Form
::
ANSWER_COLLECTION
,
Yii
::
app
()
->
session
[
"userId"
],
false
)
||
(
isset
(
$answer
[
"parentSlug"
])
&&
$el
=
Slug
::
getElementBySlug
(
$answer
[
"parentSlug"
]
)
&&
Authorisation
::
isElementAdmin
(
$el
[
"id"
],
$el
[
"type"
],
Yii
::
app
()
->
session
[
"userId"
],
false
)
)
){
//var_dump($answer["answers"][$answer["formId"]]); exit;
if
(
!
empty
(
$ctrl
->
costum
)
&&
...
...
@@ -33,13 +35,17 @@ class DeleteAction extends CAction
$where
=
array
(
"_id"
=>
new
MongoId
(
$project
[
"id"
]));
$action
=
array
(
'$unset'
=>
array
(
'category'
=>
""
));
PHDB
::
update
(
Project
::
COLLECTION
,
$where
,
$action
);
PHDB
::
update
(
Project
::
COLLECTION
,
$where
,
$action
);
}
//******************************************
$res
=
Form
::
delAnswer
(
$id
);
if
(
!
Yii
::
app
()
->
request
->
isAjaxRequest
)
$ctrl
->
redirect
(
Yii
::
app
()
->
request
->
urlReferrer
);
else
Rest
::
json
(
$res
);
Form
::
delAnswer
(
$id
);
$ctrl
->
redirect
(
Yii
::
app
()
->
request
->
urlReferrer
);
//Yii::app()->createUrl("/survey/co/index/id/".$answer["formId"]));
}
else
$ctrl
->
render
(
"co2.views.default.unTpl"
,
array
(
"msg"
=>
"Réponse introuvable ou "
,
"icon"
=>
"fa-search"
));
}
else
...
...
views/tpls/acceptAndAdmin.php
View file @
2d7b3be2
<script
type=
"text/javascript"
>
//contains all dynform definitions for complexe inputs
//it also carries sub dynforms, when an input needs extra parameters to
var
sectionDyf
=
{};
var
tplCtx
=
{};
var
DFdata
=
{
'
tpl
'
:
'
<?php
echo
$tpl
?>
'
,
"
id
"
:
"
<?php
echo
Yii
::
app
()
->
session
[
"costum"
][
"contextId"
]
?>
"
};
costum
.
col
=
"
<?php
echo
Yii
::
app
()
->
session
[
"costum"
][
"contextType"
]
?>
"
;
costum
.
ctrl
=
"
<?php
echo
Element
::
getControlerByCollection
(
Yii
::
app
()
->
session
[
"costum"
][
"contextType"
])
?>
"
;
var
configDynForm
=
<?php
echo
json_encode
(
Yii
::
app
()
->
session
[
'costum'
][
'dynForm'
]);
?>
;
var
tplsList
=
<?php
echo
json_encode
((
isset
(
Yii
::
app
()
->
session
[
'costum'
][
'tpls'
]))
?
Yii
::
app
()
->
session
[
'costum'
][
'tpls'
]
:
null
);
?>
;
//contains all dynform definitions for complexe inputs
//it also carries sub dynforms, when an input needs extra parameters to
...
...
@@ -14,6 +28,7 @@
var
configDynForm
=
<?php
echo
json_encode
(
$this
->
costum
[
'dynForm'
]);
?>
;
var
tplsList
=
<?php
echo
json_encode
((
isset
(
$this
->
costum
[
'tpls'
]))
?
$this
->
costum
[
'tpls'
]
:
null
);
?>
;
</script>
<?php
...
...
views/tpls/forms/cplx/address.php
View file @
2d7b3be2
...
...
@@ -11,7 +11,7 @@ if($mode == "r" || $mode == "pdf"){ ?>
<?php
if
(
!
empty
(
$value
)){
foreach
(
$value
as
$keyAdd
=>
$valAdd
)
{
echo
$valAdd
[
"name"
]
.
"<br>"
;
echo
@
$valAdd
[
"name"
]
.
"<br>"
;
}
}
...
...
views/tpls/forms/cplx/answers.php
View file @
2d7b3be2
...
...
@@ -4,21 +4,39 @@
</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"><i class="fa fa-bars"></i> Les
<?php
//if(isset($btnn1)){ echo $btnn1; } else {
echo $what
; }
?></a>
<
a
href
=
"#dashboard"
class
=
'lbh btn btn-default'
><
i
class
=
"fa fa-area-chart"
></
i
>
Observatoire
Global
</
a
>
<<<<<<<
HEAD
<
a
href
=
"javascript:;"
id
=
"globalCommunityBtn"
class
=
' btn btn-default'
><
i
class
=
"fa fa-group"
></
i
>
Communauté
</
a
>
</
div
>
<?
php
$showClass
=
(
$this
->
module
->
id
==
"survey"
&&
Yii
::
app
()
->
controller
->
id
==
"answer"
&&
Yii
::
app
()
->
controller
->
action
->
id
==
"all"
)
?
""
:
"hide"
;
?>
<div id="allAnswersContainer" class="
<?php
$showClass
?>
col-xs-12 col-lg-offset-2 col-lg-8 margin-top-20">
=======
<a href="javascript:;" id="globalCommunityBtn" class=' btn btn-default'><i class="fa fa-group"></i> Communauté</a> -->
<?php
if
(
Yii
::
app
()
->
request
->
getQuery
(
"answer"
)
!=
""
){
?>
<a
href=
'javascript:;'
data-id=
'
<?php
echo
Yii
::
app
()
->
request
->
getQuery
(
"answer"
);
?>
'
data-collection=
'answers'
data-path=
'answers.sommomForm1.sommomForm122.'
class=
'addorganismesommomForm122 btn btn-default'
><i
class=
'fa fa-plus'
></i>
Ajouter un organisme
</a>
<?php
}
?>
</div>
<div
class=
"col-xs-12 text-center"
>
<?php
// echo $mode ?>
</
div
>
<
div
id
=
"allAnswersContainer"
class
=
"hide col-xs-12 col-lg-offset-2 col-lg-8 margin-top-20"
>
>>>>>>>
qa
<
ul
id
=
"allAnswersList"
>
<?
php
$lbl
=
$what
.
" "
;
$ct
=
0
;
$globalLinks
=
[];
$gUids
=
[];
if
(
!
empty
(
$allAnswers
)){
if
(
!
empty
(
$allAnswers
)){
foreach
(
$allAnswers
as
$k
=>
$ans
)
{
$ct
++
;
$lbl
=
$what
.
" "
.
$ct
;
...
...
@@ -53,7 +71,7 @@ $showClass = ($this->module->id == "survey" && Yii::app()->controller->id == "an
if
(
isset
(
$ans
[
"answers"
][
$fid
]
)
){
$answeredInputs
+=
count
(
$ans
[
"answers"
][
$fid
]
);
$step
=
$f
[
'name'
];
//echo "|".$f['id']."-ai=".count( $ans["answers"][$f['id']] )."<br/>";
}
//todo lists are on depense for the moment
...
...
@@ -124,7 +142,7 @@ $showClass = ($this->module->id == "survey" && Yii::app()->controller->id == "an
$liBg
=
(
$todo
>
0
)
?
"style='background-color:lightGreen'"
:
""
;
?>
<li
class=
"answerLi col-xs-12"
<?php
echo
$liBg
?>
>
<li
class=
"answerLi col-xs-12
"
id=
"ansline
<?php
echo
$ans
[
"_id"
]
?>
"
<?php
echo
$liBg
?>
>
<div
class=
"col-xs-3 text-center"
>
<a
href=
"#answer.index.id.
<?php
echo
$ans
[
"_id"
]
?>
"
class=
"lbh"
>
<?php
echo
$lbl
?>
</a>
</div>
...
...
@@ -154,14 +172,22 @@ $showClass = ($this->module->id == "survey" && Yii::app()->controller->id == "an
</div>
<div
class=
"col-xs-1"
>
<?php
if
(
$canEdit
)
{
?>
<?php
if
(
Yii
::
app
()
->
session
[
"userId"
]
==
$ans
[
"user"
])
{
?>
<a
class=
'#'
data-id=
"
<?php
echo
$ans
[
"_id"
]
?>
"
href=
"
<?php
echo
Yii
::
app
()
->
createUrl
(
"/costum"
)
?>
/co/index/slug/
<?php
echo
$el
[
"slug"
]
?>
/answer/
<?php
echo
$ans
[
"_id"
]
?>
"
>
<i
class=
"fa fa-pensil"
></i>
</a>
<?php
}
?>
<a
class=
'text-red pull-right deleteAnswer'
data-id=
"
<?php
echo
$ans
[
"_id"
]
?>
"
href=
"javascript:;"
>
<i
class=
"fa fa-trash"
></i>
</a>
<?php
}
?>
</div>
<div
id=
"community
<?php
echo
$ans
[
"_id"
]
?>
"
class=
"communityList col-xs-12 col-lg-offset-2 col-lg-8 hide"
>
<?php
if
(
count
(
$uids
)
){
$people
=
PHDB
::
find
(
Person
::
COLLECTION
,[
"_id"
=>
array
(
'$in'
=>
$uids
)],
[
"name"
,
"username"
]);
echo
"<h5>Created by : "
.
$people
[
$ans
[
'user'
]][
"name"
]
.
"</h5><hr>"
;
if
(
isset
(
$people
[
$ans
[
'user'
]][
"name"
])){
echo
"<h5>Created by : "
.
$people
[
$ans
[
'user'
]][
"name"
]
.
"</h5><hr>"
;
}
foreach
(
$localLinks
as
$type
=>
$ls
)
{
echo
"<h5>"
.
$type
.
"</h5><ul>"
;
foreach
(
$ls
as
$ix
=>
$uid
)
{
...
...
@@ -225,8 +251,9 @@ jQuery(document).ready(function() {
label
:
"
Ok
"
,
className
:
"
btn btn-primary pull-left
"
,
callback
:
function
()
{
getAjax
(
""
,
baseUrl
+
"
/survey/co/delete/id/
"
+
id
,
function
(){
getAjax
(
""
,
baseUrl
+
"
/survey/co/delete/id/
"
+
id
,
function
(){
//urlCtrl.loadByHash(location.hash);
$
(
"
#ansline
"
+
id
).
remove
();
},
"
html
"
);
}
...
...
@@ -242,25 +269,7 @@ jQuery(document).ready(function() {
<?php
}
?>
$
(
'
#showAnswerBtn
'
).
off
().
on
(
"
click
"
,
function
()
{
$
(
"
#allAnswersContainer
"
).
toggleClass
(
"
hide
"
);
$
(
'
#
<?php
echo
@
$wizid
?>
'
).
toggleClass
(
"
hide
"
);
$
(
'
#globalCommunity
'
).
addClass
(
"
hide
"
);
});
$
(
'
#globalCommunityBtn
'
).
off
().
on
(
"
click
"
,
function
()
{
$
(
"
#allAnswersContainer
"
).
addClass
(
"
hide
"
);
$
(
'
#
<?php
echo
@
$wizid
?>
'
).
addClass
(
"
hide
"
);
$
(
'
#globalCommunity
'
).
removeClass
(
"
hide
"
);
});
$
(
'
.answerCommunityBtn
'
).
off
().
on
(
"
click
"
,
function
()
{
$
(
"
#community
"
+
$
(
this
).
data
(
"
id
"
)
).
toggleClass
(
"
hide
"
);
});
$
(
'
.answerTasksBtn
'
).
off
().
on
(
"
click
"
,
function
()
{
$
(
"
#tasks
"
+
$
(
this
).
data
(
"
id
"
)
).
toggleClass
(
"
hide
"
);
});
});
...
...
views/tpls/forms/cplx/budget.php
View file @
2d7b3be2
...
...
@@ -23,6 +23,11 @@ $paramsData = [
"estimate"
=>
false
];
function
is_true
(
$val
,
$return_null
=
false
){
$boolval
=
(
is_string
(
$val
)
?
filter_var
(
$val
,
FILTER_VALIDATE_BOOLEAN
,
FILTER_NULL_ON_FAILURE
)
:
(
bool
)
$val
);
return
(
$boolval
===
null
&&
!
$return_null
?
false
:
$boolval
);
}
if
(
isset
(
$parentForm
[
"params"
][
$kunik
][
"group"
])
)
$paramsData
[
"group"
]
=
$parentForm
[
"params"
][
$kunik
][
"group"
];
if
(
isset
(
$parentForm
[
"params"
][
$kunik
][
"nature"
])
)
...
...
@@ -30,7 +35,7 @@ if( isset($parentForm["params"][$kunik]["nature"]) )
if
(
isset
(
$parentForm
[
"params"
][
$kunik
][
"amounts"
])
)
$paramsData
[
"amounts"
]
=
$parentForm
[
"params"
][
$kunik
][
"amounts"
];
if
(
isset
(
$parentForm
[
"params"
][
$kunik
][
"estimate"
])
)
$paramsData
[
"estimate"
]
=
$parentForm
[
"params"
][
$kunik
][
"estimate"
];
$paramsData
[
"estimate"
]
=
is_true
(
$parentForm
[
"params"
][
$kunik
][
"estimate"
]
)
;
// if(isset($answers)){
// foreach ($answers as $q => $a) {
...
...
@@ -69,7 +74,7 @@ $properties = [
];
}
if
(
$debug
)
var_dump
(
$answers
);
if
(
$debug
)
var_dump
(
$paramsData
);
var_dump
(
$paramsData
);
?>
<?php
...
...
views/tpls/forms/cplx/editDeleteLineBtn.php
View file @
2d7b3be2
...
...
@@ -4,6 +4,6 @@ if ($canEdit){
?>
<a
href=
'javascript:;'
data-id=
'
<?php
echo
$id
?>
'
data-collection=
'
<?php
echo
$collection
?>
'
data-key=
'
<?php
echo
$q
?>
'
data-path=
'
<?php
echo
$path
?>
'
class=
'edit
<?php
echo
$keyTpl
?>
previewTpl btn btn-xs btn-default'
><i
class=
'fa fa-pencil'
></i></a>
<a
href=
'javascript:;'
data-id=
'
<?php
echo
$id
?>
'
data-collection=
'
<?php
echo
$collection
?>
'
data-key=
'
<?php
echo
$keyTpl
.
$q
?>
'
data-path=
'
<?php
echo
$path
?>
'
class=
'deleteLine
x
previewTpl btn btn-xs btn-danger'
><i
class=
'fa fa-times'
></i></a>
<a
href=
'javascript:;'
data-id=
'
<?php
echo
$id
?>
'
data-collection=
'
<?php
echo
$collection
?>
'
data-key=
'
<?php
echo
$keyTpl
.
$q
?>
'
data-path=
'
<?php
echo
$path
?>
'
class=
'deleteLine previewTpl btn btn-xs btn-danger'
><i
class=
'fa fa-times'
></i></a>
<?php
}
?>
\ No newline at end of file
views/tpls/forms/cplx/financementFromBudget.php
View file @
2d7b3be2
...
...
@@ -48,19 +48,11 @@ if( isset($parentForm["params"][$kunik]) ) {
if
(
isset
(
$parentForm
[
"params"
][
$kunik
][
"openFinancing"
])
)
$paramsData
[
"openFinancing"
]
=
$parentForm
[
"params"
][
$kunik
][
"openFinancing"
];
}
$communityLinks
=
array
();
if
(
!
empty
(
$form
[
"parent"
])){
foreach
(
$form
[
"parent"
]
as
$key
=>
$value
)
{
$cl
=
Element
::
getCommunityByTypeAndId
(
$key
,
$value
[
"type"
]);
if
(
!
empty
(
$cl
))
$communityLinks
=
array_merge
(
$communityLinks
,
$cl
);
}
}
$communityLinks
=
Element
::
getCommunityByParentTypeAndId
(
$parentForm
[
"parent"
]
);
$organizations
=
Link
::
groupFindByType
(
Organization
::
COLLECTION
,
$communityLinks
,[
"name"
,
"links"
]
);
$orgs
=
[];
foreach
(
$organizations
as
$id
=>
$or
)
{
$roles
=
null
;
if
(
isset
(
$communityLinks
[
$id
][
"roles"
]
)
)
...
...
@@ -74,6 +66,7 @@ foreach ($organizations as $id => $or) {
}
}
}
//var_dump($orgs); exit;
$listLabels
=
array_merge
(
Ctenat
::
$financerTypeList
,
$orgs
);
...
...
views/tpls/forms/cplx/list.php
0 → 100644
View file @
2d7b3be2
<?php
if
(
$answer
){
?>
<div
class=
"form-group"
>
<?php
$i
=
0
;
$show
=
true
;
if
(
isset
(
$answers
))
{
foreach
(
$answers
as
$q
=>
$a
)
{
if
(
isset
(
$answers
))
{
$i
++
;
}
}
}
if
(
isset
(
Yii
::
app
()
->
session
[
"costum"
][
"form"
][
"params"
][
$kunik
][
'num_row'
])
and
Yii
::
app
()
->
session
[
"costum"
][
"form"
][
"params"
][
$kunik
][
'num_row'
]
==
"0"
and
isset
(
Yii
::
app
()
->
session
[
"costum"
][
"form"
][
"params"
][
$kunik
][
"nbmax"
])
and
((
int
)
Yii
::
app
()
->
session
[
"costum"
][
"form"
][
"params"
][
$kunik
][
"nbmax"
])
<=
$i
){
$show
=
false
;
}
$editBtnL
=
""
;
if
(
$show
){
$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='"
.
Yii
::
app
()
->
session
[
"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>"
:
""
;
$paramsData
=
[
"nbmax"
=>
"2"
,
"num_row"
=>
[
"limité"
,
"illimité"
]
];
if
(
isset
(
Yii
::
app
()
->
session
[
"costum"
][
"form"
][
"params"
][
$kunik
][
"nbmax"
])
)
$paramsData
[
"nbmax"
]
=
Yii
::
app
()
->
session
[
"costum"
][
"form"
][
"params"
][
$kunik
][
"nbmax"
];
if
(
isset
(
Yii
::
app
()
->
session
[
"costum"
][
"form"
][
"params"
][
$kunik
][
"limited"
])
)
$paramsData
[
"num_row"
]
=
Yii
::
app
()
->
session
[
"costum"
][
"form"
][
"params"
][
$kunik
][
"num_row"
];
$properties
=
[
"liste_row"
=>
[
"label"
=>
"mot ou phrase"
,
"placeholder"
=>
"mot ou phrase"
,
"inputType"
=>
"text"
,
"rules"
=>
[
"required"
=>
true
]
]
];
?>
<h4
style=
"color:
<?php
echo
(
$titleColor
)
?
$titleColor
:
"black"
;
?>
"
>
<?php
echo
$label
.
$editQuestionBtn
.
$editParamsBtn
.
$editBtnL
?>
</h4>
<?php
echo
$info
?>
<style>
.s19
{
list-style
:
none
;}
.s19
li
:before
{
content
:
'\f0a9'
;
margin-right
:
15px
;
font-family
:
FontAwesome
;
color
:
#d9534f
;
}
</style>
<ol
class=
"s19"
style=
"
white-space: normal;
"
>
<?php
$ct
=
0
;
if
(
isset
(
$answers
)){
foreach
(
$answers
as
$q
=>
$a
)
{
?>
<li>
<?php
echo
$a
[
'liste_row'
];
?>
<div
class=
"pull-right"
>
<?php
$this
->
renderPartial
(
"survey.views.tpls.forms.cplx.editDeleteLineBtn"
,
[
"canEdit"
=>
(
$canEdit
||
Yii
::
app
()
->
session
[
"userId"
]
==
$answer
[
"user"
]),
"id"
=>
$answer
[
"_id"
],
"collection"
=>
Form
::
ANSWER_COLLECTION
,
"q"
=>
$q
,
"path"
=>
"answers."
.
$kunik
.
"."
.
$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></div>
</li>
<?php
}
}
?>
</ol>
</div>
<script
type=
"text/javascript"
>
var
<?php
echo
$kunik
?>
Data
=
<?php
echo
json_encode
(
(
isset
(
$answers
))
?
$answers
:
null
);
?>
;
sectionDyf
.
<?php
echo
$kunik
?>
ParamsData
=
<?php
echo
json_encode
(
$paramsData
);
?>
;
$
(
document
).
ready
(
function
()
{
sectionDyf
.
<?php
echo
$kunik
?>
=
{
"
jsonSchema
"
:
{
"
title
"
:
"
Budget prévisionnel
"
,
"
icon
"
:
"
fa-money
"
,
"
text
"
:
"
Décrire ici les principaux postes de dépenses : à quoi correspondent les coûts ? <br/>Préciser ce qui relève des dépenses de fonctionnement et des dépenses d’investissement.<br/>Les coûts doivent être en <b>hors taxe</b>.
"
,
"
properties
"
:
<?php
echo
json_encode
(
$properties
);
?>
,
save
:
function
()
{
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
();
});
mylog
.
log
(
"
save tplCtx
"
,
tplCtx
);
if
(
typeof
tplCtx
.
value
==
"
undefined
"
)
toastr
.
error
(
'
value cannot be empty!
'
);
else
{
dataHelper
.
path2Value
(
tplCtx
,
function
(
params
)
{
$
(
"
#ajax-modal
"
).
html
(
"
<div class='text-center'><i class='fa fa-spin fa-spinner'></i></div>
"
);
//$("#ajax-modal").modal('hide');
location
.
reload
();
}
);
}
}
}
};
sectionDyf
.
<?php
echo
$kunik
?>
Params
=
{
"
jsonSchema
"
:
{
"
title
"
:
"
<?php
echo
$kunik
?>
config
"
,
"
description
"
:
"
Liste de question possible
"
,
"
icon
"
:
"
fa-cog
"
,
"
properties
"
:
{
num_row
:
{
inputType
:
"
select
"
,
label
:
"
Limitation
"
,
options
:
sectionDyf
.
<?php
echo
$kunik
?>
ParamsData
.
num_row
,
value
:
"
<?php
echo
(
isset
(
Yii
::
app
()
->
session
[
"costum"
][
"form"
][
"params"
][
$kunik
][
'num_row'
]))
?
Yii
::
app
()
->
session
[
"costum"
][
"form"
][
"params"
][
$kunik
][
'num_row'
]
:
''
;
?>
"
},
nbmax
:
{
inputType
:
"
text
"
,
label
:
"
Nombre d'element maximal
"
,
values
:
sectionDyf
.
<?php
echo
$kunik
?>
ParamsData
.
nbmax
}
},
save
:
function
()
{
tplCtx
.
value
=
{};
$
.
each
(
sectionDyf
.
<?php
echo
$kunik
?>
Params
.
jsonSchema
.
properties
,
function
(
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
tplCtx
.
value
[
k
]
=
$
(
"
#
"
+
k
).
val
();
mylog
.
log
(
"
value
"
,
'
.
'
+
k
+
val
.
inputType
,
tplCtx
.
value
[
k
]);
});
mylog
.
log
(
"
save tplCtx
"
,
tplCtx
);
if
(
typeof
tplCtx
.
value
==
"
undefined
"
)
toastr
.
error
(
'
value cannot be empty!
'
);
else
{
dataHelper
.
path2Value
(
tplCtx
,
function
(
params
)
{
$
(
"
#ajax-modal
"
).
html
(
"
<div class='text-center'><i class='fa fa-spin fa-spinner'></i></div>
"
);
location
.
reload
();
}
);
}
}
}
};
mylog
.
log
(
"
render
"
,
"
/modules/costum/views/tpls/forms/
<?php
echo
$kunik
?>
.php
"
);
//adds a line into answer
$
(
"
.add
<?php
echo
$kunik
?>
"
).
off
().
on
(
"
click
"
,
function
()
{
tplCtx
.
id
=
$
(
this
).
data
(
"
id
"
);
tplCtx
.
collection
=
$
(
this
).
data
(
"
collection
"
);
tplCtx
.
path
=
$
(
this
).
data
(
"
path
"
)
+
((
notNull
(
<?php
echo
$kunik
?>
Data
)
?
<?php
echo
$kunik
?>
Data
.
length
:
"
0
"
));
dyFObj
.
openForm
(
sectionDyf
.
<?php
echo
$kunik
?>
);
});
$
(
"
.edit
<?php
echo
$kunik
?>
"
).
off
().
on
(
"
click
"
,
function
()
{
tplCtx
.
id
=
$
(
this
).
data
(
"
id
"
);
tplCtx
.
collection
=
$
(
this
).
data
(
"
collection
"
);
tplCtx
.
path
=
$
(
this
).
data
(
"
path
"
);
dyFObj
.
openForm
(
sectionDyf
.
<?php
echo
$kunik
?>
,
null
,
<?php
echo
$kunik
?>
Data
[
$
(
this
).
data
(
"
key
"
)]);
});
$
(
"
.edit
<?php
echo
$kunik
?>
Params
"
).
off
().
on
(
"
click
"
,
function
()
{
tplCtx
.
id
=
$
(
this
).
data
(
"
id
"
);
tplCtx
.
collection
=
$
(
this
).
data
(
"
collection
"
);
tplCtx
.
path
=
$
(
this
).
data
(
"
path
"
);
//if no params config on the element.costum.form.params.
<?php
echo
$kunik
?>
//then we load default values available in forms.inputs.
<?php
echo
$kunik
?>
xxx
.
params
//mylog.log(".editParams",sectionDyf.
<?php
echo
$kunik
?>
Params
,
calData
);
dyFObj
.
openForm
(
sectionDyf
.
<?php
echo
$kunik
?>
Params
,
null
,
sectionDyf
.
<?php
echo
$kunik
?>
ParamsData
);
});
});
</script>
<?php
}
else
{
//echo "<h4 class='text-red'>CALENDAR works with existing answers</h4>";
}
?>
\ No newline at end of file
views/tpls/forms/cplx/multiCheckboxPlus.php
0 → 100644
View file @
2d7b3be2
<style
type=
"text/css"
>
.ckd-grp
{
/*position: absolute;
top: calc(50% - 10px);*/
}
.ckd-grp
label
{
cursor
:
pointer
;
-webkit-tap-highlight-color
:
transparent
;
padding
:
6px
8px
;
border-radius
:
20px
;
float
:
left
;
transition
:
all
0.2s
ease
;
}
.ckd-grp
label
:hover
{
background
:
rgba
(
125
,
100
,
247
,
0.06
);
}
.ckd-grp
label
:not
(
:last-child
)
{
margin-right
:
16px
;
}
.ckd-grp
label
span
{
vertical-align
:
middle
;
}
.ckd-grp
label
span
:first-child
{
position
:
relative
;
display
:
inline-block
;
vertical-align
:
middle
;
width
:
27px
;
height
:
27px
;
background
:
#e8eaed
;
border-radius
:
10px
;
transition
:
all
0.2s
ease
;
margin-right
:
8px
;
padding
:
3px
;
}
.ckd-grp
label
span
:first-child:after
{
content
:
''
;
position
:
absolute
;
width
:
16px
;
height
:
16px
;
margin
:
2px
;
background
:
#fff
;
border-radius
:
6px
;
transition
:
all
0.2s
ease
;
}
.ckd-grp
label
:hover
span
:first-child
{
/*background*/
:
#7d64f7;
}
.ckb-grp
label
:hover
span
:first-child:after
{
/*background: #7d64f7;*/
/*background: #7d64f7;*/
padding
:
0px
;
background
:
white
;
}
.ckd-grp
input
{
display
:
none
;
}
.ckd-grp
input
:checked
+
label
span
:first-child
{
/*background: #7d64f7;*/
background
:
#e8eaed
;
}
.ckd-grp
input
:checked
+
label
span
:first-child:after
{
/*transform: scale(0.5);*/
background
:
#7d64f7
;
}
.effect-2
{
border
:
0
;
padding
:
7px
0
;
border-bottom
:
1px
solid
#ccc
;}
.effect-2
~
.focus-border
{
position
:
absolute
;
bottom
:
0
;
left
:
0
;
width
:
0
;
height
:
2px
;
background-color
:
#3399FF
;
transition
:
0.4s
;}
.effect-2
:focus
~
.focus-border
{
width
:
100%
;
transition
:
0.4s
;}
.paramsonebtn
,
.paramsonebtnP
{
font-size
:
17px
;
display
:
none
;
padding
:
5px
;
}
.paramsonebtn
:hover
{
color
:
red
;
}
.paramsonebtnP
:hover
{
color
:
blue
;
}
.thckd
:hover
.paramsonebtn
,
.thckd
:hover
.paramsonebtnP
{
display
:
inline-block
;
}
.effect-2
:focus
{
outline
:
none
!important
;
}
</style>
<?php
$value
=
(
!
empty
(
$answers
))
?
" value='"
.
$answers
.
"' "
:
""
;
$inpClass
=
" saveOneByOne"
;
$editParamsBtn
=
(
$canEdit
)
?
" <a href='javascript:;' data-id='"
.
$el
[
"_id"
]
.
"' data-collection='"
.
Yii
::
app
()
->
session
[
"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>"
:
""
;
$paramsData
=
[
"list"
=>
[
],
"tofill"
=>
[
],
"placeholdersckb"
=>
[
],
"type"
=>