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
6b9474f3
Commit
6b9474f3
authored
Jun 25, 2020
by
Raph El
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Hotfix Answer admin + amélioration btn validation
parent
576775f9
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
47 additions
and
19 deletions
+47
-19
controllers/answer/ValidateAction.php
controllers/answer/ValidateAction.php
+29
-1
controllers/answer/admin/DirectoryAction.php
controllers/answer/admin/DirectoryAction.php
+0
-1
models/Answer.php
models/Answer.php
+2
-1
models/Form.php
models/Form.php
+6
-4
views/tpls/forms/cplx/multitextvalidation.php
views/tpls/forms/cplx/multitextvalidation.php
+3
-2
views/tpls/forms/cplx/validationForm.php
views/tpls/forms/cplx/validationForm.php
+7
-10
No files found.
controllers/answer/ValidateAction.php
View file @
6b9474f3
...
...
@@ -8,4 +8,32 @@ class ValidateAction extends CAction
$res
=
Answer
::
validate
(
$_POST
);
Rest
::
json
(
$_POST
);
}
}
\ No newline at end of file
}
"organizations"
:
[
{
"from"
:
"aressForm1.multitextvalidationaressForm110"
,
"to"
:
"name"
},
{
"from"
:
"aressForm1.multitextvalidationaressForm111"
,
"to"
:
"sigle"
},
{
"from"
:
"aressForm1.multitextvalidationaressForm112"
,
"to"
:
"siren"
},
{
"from"
:
"aressForm1.multitextvalidationaressForm19"
,
"to"
:
"email"
},
{
"from"
:
"aressForm1.multitextvalidationaressForm113"
,
"to"
:
"WALDEC_RNA
"
},
{
"from"
:
"aressForm1.multitextvalidationaressForm113"
,
"to"
:
"siren"
}
]
\ No newline at end of file
controllers/answer/admin/DirectoryAction.php
View file @
6b9474f3
...
...
@@ -24,7 +24,6 @@ class DirectoryAction extends CAction
$idFs
[]
=
$keyF
;
}
$res
=
Form
::
getBySourceAndId
(
$controller
->
costum
[
"slug"
]);
//Rest::json($res); exit;
$searchParams
=
$_POST
;
$searchParams
[
"count"
]
=
true
;
$answers
=
Answer
::
globalAutocomplete
(
$res
[
"form"
],
$searchParams
);
...
...
models/Answer.php
View file @
6b9474f3
...
...
@@ -108,6 +108,7 @@ class Answer{
}
public
static
function
globalAutocomplete
(
$form
,
$searchParams
){
//var_dump($form);
$searchParams
[
"indexMin"
]
=
(
isset
(
$searchParams
[
"indexMin"
]))
?
$searchParams
[
"indexMin"
]
:
0
;
$searchParams
[
"indexStep"
]
=
(
isset
(
$searchParams
[
"indexStep"
]))
?
$searchParams
[
"indexStep"
]
:
100
;
$mappingData
=
(
isset
(
$form
[
"mapping"
]))
?
$form
[
"mapping"
]
:
array
(
"name"
=>
"name"
,
"address"
=>
"address"
);
...
...
@@ -149,7 +150,7 @@ class Answer{
$query
=
Search
::
searchFilters
(
$searchParams
[
'filters'
],
$query
);
}
$res
=
array
();
//
var_dump
($query);exit;
//
Rest::json
($query);exit;
$res
[
"results"
]
=
PHDB
::
findAndLimitAndIndex
(
self
::
COLLECTION
,
$query
,
$searchParams
[
"indexStep"
],
$searchParams
[
"indexMin"
]);
if
(
isset
(
$searchParams
[
"count"
]))
$res
[
"count"
][
self
::
COLLECTION
]
=
PHDB
::
count
(
self
::
COLLECTION
,
$query
);
...
...
models/Form.php
View file @
6b9474f3
...
...
@@ -184,10 +184,12 @@ class Form {
}
$res
[
"form"
]
=
PHDB
::
findOne
(
Form
::
COLLECTION
,
$queryForm
);
$res
[
"forms"
]
=
[];
foreach
(
$res
[
"form"
][
"subForms"
]
as
$ix
=>
$formId
)
{
$f
=
PHDB
::
findOne
(
Form
::
COLLECTION
,
[
"id"
=>
$formId
]);
$res
[
"forms"
][
$formId
]
=
$f
;
}
if
(
!
empty
(
$res
[
"form"
][
"subForms"
])){
foreach
(
$res
[
"form"
][
"subForms"
]
as
$ix
=>
$formId
)
{
$f
=
PHDB
::
findOne
(
Form
::
COLLECTION
,
[
"id"
=>
$formId
]);
$res
[
"forms"
][
$formId
]
=
$f
;
}
}
return
$res
;
}
public
static
function
getById
(
$parentForm
,
$fields
=
array
()){
...
...
views/tpls/forms/cplx/multitextvalidation.php
View file @
6b9474f3
...
...
@@ -168,9 +168,10 @@ $paramsData = [
"validation"
=>
[
"text"
=>
"texte"
,
"number"
=>
"Nombre"
,
"email"
=>
"adresse mail"
"email"
=>
"adresse mail"
,
"unique"
=>
[
"siret"
]
]
];
];
if
(
$saveOneByOne
)
...
...
views/tpls/forms/cplx/validationForm.php
View file @
6b9474f3
<?php
var_dump
(
$input
);
if
(
$mode
!=
"pdf"
){
var_dump
(
$input
);
?>
<div
class=
""
>
<label
for=
"
<?php
echo
$k
ey
?>
"
><h4
style=
"color:
<?php
echo
(
$titleColor
)
?
$titleColor
:
"black"
;
?>
"
>
<?php
echo
$label
.
$editQuestionBtn
?>
</h4></label>
<label
for=
"
validation
<?php
echo
$k
unik
?>
"
><h4
style=
"color:
<?php
echo
(
$titleColor
)
?
$titleColor
:
"black"
;
?>
"
>
<?php
echo
$label
.
$editQuestionBtn
?>
</h4></label>
<div
class=
"text-center"
>
<
button
class=
"btn btn-primary"
id=
"validation
<?php
echo
$kunik
?>
"
>
Validation
</
button
>
<
a
href=
"javascript:;"
class=
"btn btn-primary"
id=
"validation
<?php
echo
$kunik
?>
"
>
Validation
</
a
>
</div>
</div>
...
...
@@ -13,8 +14,8 @@ if($mode != "pdf"){
var
paramsInput
=
<?php
echo
json_encode
(
$input
);
?>
;
jQuery
(
document
).
ready
(
function
()
{
mylog
.
log
(
"
render form input
"
,
"
/modules/costum/views/tpls/forms/cplx/validate.php
"
);
$
(
"
#validation
<?php
echo
$kunik
?>
"
).
click
(
function
(){
var
params
=
{
$
(
"
#question
<?php
echo
$key
?>
#validation
<?php
echo
$kunik
?>
"
).
off
().
click
(
function
(){
var
params
Validate
=
{
answerId
:
answerId
,
answer
:
answerObj
.
answers
,
input
:
paramsInput
...
...
@@ -23,7 +24,7 @@ if($mode != "pdf"){
ajaxPost
(
null
,
baseUrl
+
"
/survey/answer/validate
"
,
params
,
params
Validate
,
function
(
data
){
toastr
.
success
(
"
Le formulaire à été soumis
"
);
},
...
...
@@ -34,9 +35,5 @@ if($mode != "pdf"){
});
});
</script>
<?php
}
?>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment