Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Pixel Humain
survey
Commits
c935217d
Commit
c935217d
authored
Jun 19, 2020
by
Raph El
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CressReunion : btn generate
parent
49c05b2f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
13 deletions
+48
-13
controllers/answer/ValidateAction.php
controllers/answer/ValidateAction.php
+1
-1
data/aress.json
data/aress.json
+6
-5
models/Answer.php
models/Answer.php
+37
-5
views/tpls/forms/cplx/validationForm.php
views/tpls/forms/cplx/validationForm.php
+4
-2
No files found.
controllers/answer/ValidateAction.php
View file @
c935217d
...
@@ -6,6 +6,6 @@ class ValidateAction extends CAction
...
@@ -6,6 +6,6 @@ class ValidateAction extends CAction
$res
=
Answer
::
validate
(
$_POST
);
$res
=
Answer
::
validate
(
$_POST
);
//
Rest::json($_POST);
Rest
::
json
(
$_POST
);
}
}
}
}
\ No newline at end of file
data/aress.json
View file @
c935217d
...
@@ -523,11 +523,12 @@
...
@@ -523,11 +523,12 @@
"position"
:
"4"
,
"position"
:
"4"
,
"generateElement"
:
{
"generateElement"
:
{
"organizations"
:
{
"organizations"
:
{
"aressForm1.multitextvalidationaressForm110"
:
"name"
,
"from"
:
"aressForm1.multitextvalidationaressForm110"
,
"aressForm1.multitextvalidationaressForm111"
:
"sigle"
,
"to"
:
"name"
,
"aressForm1.multitextvalidationaressForm112"
:
"siren"
,
"from"
:
"aressForm1.multitextvalidationaressForm111"
,
"aressForm1.multitextvalidationaressForm110"
:
"name"
,
"to"
:
"sigle"
,
"aressForm1.multitextvalidationaressForm110"
:
"name"
,
"from"
:
"aressForm1.multitextvalidationaressForm112"
,
"to"
:
"siren"
}
}
}
}
}
}
...
...
models/Answer.php
View file @
c935217d
...
@@ -367,15 +367,47 @@ class Answer{
...
@@ -367,15 +367,47 @@ class Answer{
public
static
function
validate
(
$params
){
public
static
function
validate
(
$params
){
$costum
=
CacheHelper
::
getCostum
();
$costum
=
CacheHelper
::
getCostum
();
$set
=
array
();
$set
=
array
();
if
(
!
empty
(
$params
[
"validated"
])
&&
$params
[
"validated"
]
===
true
)
$set
[
"validated"
]
=
true
;
if
(
!
empty
(
$params
[
"input"
][
"generateElement"
])){
$mapping
=
array
();
$import
=
array
(
'file'
=>
array
(
json_encode
(
array
(
$params
[
"answer"
]))),
'nameFile'
=>
"test"
,
'typeFile'
=>
'json'
,
"warnings"
=>
"false"
);
foreach
(
$params
[
"input"
][
"generateElement"
]
as
$type
=>
$map
)
{
$mapping
=
array
();
foreach
(
$map
as
$k
=>
$v
)
{
$mapping
[]
=
array
(
'idHeadCSV'
=>
$v
[
"from"
],
'valueAttributeElt'
=>
$v
[
"to"
]
);
}
$import
[
'infoCreateData'
]
=
$mapping
;
$import
[
'typeElement'
]
=
$type
;
$resImport
=
Import
::
previewData
(
$import
,
true
,
true
,
true
);
Rest
::
json
(
$resImport
);
exit
;
}
}
if
(
Costum
::
isSameFunction
(
"answerValidate"
)){
if
(
Costum
::
isSameFunction
(
"answerValidate"
)){
$paramBeforeValidate
=
Costum
::
sameFunction
(
"answerValidate"
,
$params
);
$paramBeforeValidate
=
Costum
::
sameFunction
(
"answerValidate"
,
$params
);
}
}
$set
[
"validated"
]
=
true
;
PHDB
::
update
(
Answer
::
COLLECTION
,
array
(
"_id"
=>
new
MongoId
((
string
)
$params
[
"answerId"
])),
array
(
'$set'
=>
$set
)
);
$res
=
array
(
'result'
=>
true
,
"msg"
=>
"Valider"
);
if
(
!
empty
(
$set
)){
PHDB
::
update
(
Answer
::
COLLECTION
,
array
(
"_id"
=>
new
MongoId
((
string
)
$params
[
"answerId"
])),
array
(
'$set'
=>
$set
)
);
$res
=
array
(
'result'
=>
true
,
"msg"
=>
"Valider"
);
}
return
$res
;
return
$res
;
}
}
...
...
views/tpls/forms/cplx/validationForm.php
View file @
c935217d
<?php
<?php
var_dump
(
$input
);
if
(
$mode
!=
"pdf"
){
if
(
$mode
!=
"pdf"
){
?>
?>
<div
class=
""
>
<div
class=
""
>
...
@@ -10,12 +10,14 @@ if($mode != "pdf"){
...
@@ -10,12 +10,14 @@ if($mode != "pdf"){
</div>
</div>
<script
type=
"text/javascript"
>
<script
type=
"text/javascript"
>
var
paramsInput
=
<?php
echo
json_encode
(
$input
);
?>
;
jQuery
(
document
).
ready
(
function
()
{
jQuery
(
document
).
ready
(
function
()
{
mylog
.
log
(
"
render form input
"
,
"
/modules/costum/views/tpls/forms/cplx/validate.php
"
);
mylog
.
log
(
"
render form input
"
,
"
/modules/costum/views/tpls/forms/cplx/validate.php
"
);
$
(
"
#validation
<?php
echo
$kunik
?>
"
).
click
(
function
(){
$
(
"
#validation
<?php
echo
$kunik
?>
"
).
click
(
function
(){
var
params
=
{
var
params
=
{
answerId
:
answerId
,
answerId
:
answerId
,
answer
:
answerObj
.
answers
answer
:
answerObj
.
answers
,
input
:
paramsInput
};
};
ajaxPost
(
ajaxPost
(
...
...
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