Commit 5c165e4c authored by Clément Damiens's avatar Clément Damiens
Browse files

Merge remote-tracking branch 'origin/qa' into qa

parents edc10c9d a20284cd
......@@ -60,6 +60,10 @@ class Form {
"tpls.forms.cplx.regle" =>"règle d'attribution",
"tpls.forms.cplx.multiCheckbox" =>"Liste of checkboxes",
"sectionTitle" => "Séparateur de Section avec Titre",
"tpls.forms.cplx.subList" => "sublist : subliste",
"tpls.forms.cplx.list" => "list : liste",
"tpls.forms.cplx.multiList" => "multiList : multiListe"
];
/*
[X] author view pod
......@@ -679,8 +683,6 @@ class Form {
//use the cache
Yii::app()->session["forms"] = $allforms;
} else {
if(isset($_GET["form"]))
$params["formId"] = $_GET["form"];
......@@ -741,25 +743,40 @@ class Form {
//pour permettre le save onBlur , ou s'il y a des cplx forms
//il ne peut y avoir qu'un seul answer en cours simultanement
///TODO purger ANSwers via CRON
if( $generateAnswer ){
$ans = [
"formId" => $params["formId"],
"user" => Yii::app()->session["userId"],
"parentSlug" => $params["el"]["slug"],
"created" => time()
];
if(isset($params["formList"]))
$ans["formList"] = count($params["formList"]);
PHDB::insert(Form::ANSWER_COLLECTION, $ans);
$answer = PHDB::findOne( Form::ANSWER_COLLECTION, [ "_id" => new MongoId($ans["_id"]) ] );
}
$params["answer"] = $answer;
$params["showForm"] = $showForm;
$params["allAnswers"] = PHDB::find( Form::ANSWER_COLLECTION,[
//on pré genere un anwser que quand il n'y en pas
//pour permettre le save onBlur , ou s'il y a des cplx forms
//il ne peut y avoir qu'un seul answer en cours simultanement
///TODO purger ANSwers via CRON
if( $generateAnswer )
{
//var_dump("create new" );
$ans = [
"formId" => $params["formId"],
"user" => Yii::app()->session["userId"],
"parentSlug" => $params["el"]["slug"],
"created" => time()
];
if(isset($params["formList"]))
$ans["formList"] = count($params["formList"]);
PHDB::insert(Form::ANSWER_COLLECTION, $ans);
$answer = PHDB::findOne( Form::ANSWER_COLLECTION, [ "_id" => new MongoId($ans["_id"]) ] );
}
// var_dump($params["el"]["slug"] );
// var_dump($params["formId"] );
// var_dump($answer );
// var_dump(Yii::app()->getRequest()->getQuery('answer'));
// exit;
$params["answer"] = $answer;
$params["showForm"] = $showForm;
$allAnswers = PHDB::find( Form::ANSWER_COLLECTION,[
"formId" => $params["formId"],
"parentSlug" => $params["el"]["slug"] ] );
"parentSlug" => $params["el"]["slug"] ] ) ;
$params["allAnswers"] = (!isset($allAnswers)) ? [] : $allAnswers ;
//var_dump($params["el"]["slug"]);exit;
//var_dump($params["allAnswers"]);exit;
} else {
echo "<h4 class='text-center text-red'><i class='fa fa-warning'></i> Une seul réponse n'est possible.</h4>";
echo "<a class='btn btn-primary' href='/costum/co/index/slug/".$el["slug"]."/answer/".$myAnswers[0]."'>Votre réponse</a>";
......
Supports Markdown
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