Commit ff42b8b1 authored by Raph El's avatar Raph El
Browse files

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

parents aff1d082 f0e5dedf
...@@ -6,13 +6,14 @@ class EditAction extends CAction ...@@ -6,13 +6,14 @@ class EditAction extends CAction
$this->getController()->layout = "//layouts/empty"; $this->getController()->layout = "//layouts/empty";
$params = array("canEdit" => true, "showAnswerActions"=>false); $params = array("canEdit" => true, "showAnswerActions"=>false);
$params = Form::getDataForAnswer($params); $params = Form::getDataForAnswer($params);
$tpl=(!empty($tpl)) ? $tpl : "survey.views.tpls.forms.formWizard"; $tpl=(!empty($tpl)) ? $tpl : "survey.views.tpls.views.index";
$params["mode"]="w";
echo $this->getController()->renderPartial($tpl,$params ); echo $this->getController()->renderPartial($tpl,$params );
} }
} }
// Propriétaire // Propriétaire
[] Rempli un dossier Etape 1 /* [] Rempli un dossier Etape 1
( ) Soit logué / Pas Loggué ( ) Soit logué / Pas Loggué
[ ] Nom prénom (propriétaire) [ ] Nom prénom (propriétaire)
[ ] Email (propriétaire) [ ] Email (propriétaire)
...@@ -23,6 +24,7 @@ class EditAction extends CAction ...@@ -23,6 +24,7 @@ class EditAction extends CAction
[ ] Description [ ] Description
[ ] Opérateur lien [ ] Opérateur lien
[ ] validate [ ] validate
[ ] Déposé proriétaitre
Valide => answer (Pas dopérateur) Valide => answer (Pas dopérateur)
// Place au marché // Place au marché
...@@ -30,4 +32,4 @@ Je mengage => ...@@ -30,4 +32,4 @@ Je mengage =>
tel opérateur (orga / -> admin) tel opérateur (orga / -> admin)
// Une fois crée étape 2 // Une fois crée étape 2
[ ] Rempli step 2 avec le gadjo [ ] Rempli step 2 avec le gadjo */
\ No newline at end of file \ No newline at end of file
...@@ -687,7 +687,16 @@ class Form { ...@@ -687,7 +687,16 @@ class Form {
return $params; return $params;
} }
public static function getListAnswersBy($formId, $parent, $userId=null, $cond=null){
$where=array("formId"=> $formId, "parentSlug" => $parent);
if(!empty($userId)){
$where["user"]=$userId;
}
if(!empty($cond))
$where=array('$and'=> array($where, $cond));
$lists=PHDB::find( Form::ANSWER_COLLECTION, $where);
return $lists;
}
public static function getDataForAnswer($params){ public static function getDataForAnswer($params){
//var_dump(Yii::app()->session['costum']);exit; //var_dump(Yii::app()->session['costum']);exit;
//WARNING //WARNING
...@@ -733,10 +742,8 @@ class Form { ...@@ -733,10 +742,8 @@ class Form {
$params["el"]=Slug::getElementBySlug($answer["parentSlug"])["el"]; $params["el"]=Slug::getElementBySlug($answer["parentSlug"])["el"];
$showForm = true; $showForm = true;
$myAnswers = PHDB::find( Form::ANSWER_COLLECTION,[
"formId" => $params["formId"], $myAnswers = self::getListAnswersBy($params["formId"], $params["el"]["slug"], Yii::app()->session["userId"]);
"parentSlug" => $params["el"]["slug"],
"user" => Yii::app()->session["userId"] ] );
...@@ -813,9 +820,7 @@ class Form { ...@@ -813,9 +820,7 @@ class Form {
$params["answer"] = $answer; $params["answer"] = $answer;
$params["showForm"] = $showForm; $params["showForm"] = $showForm;
$params["showAnswerActions"]=(isset($params["showAnswerActions"])) ? $params["showAnswerActions"] : true; $params["showAnswerActions"]=(isset($params["showAnswerActions"])) ? $params["showAnswerActions"] : true;
$allAnswers = PHDB::find( Form::ANSWER_COLLECTION,[ $allAnswers = self::getListAnswersBy($params["formId"], $params["el"]["slug"] ) ;
"formId" => $params["formId"],
"parentSlug" => $params["el"]["slug"] ] ) ;
$params["allAnswers"] = (!isset($allAnswers)) ? [] : $allAnswers ; $params["allAnswers"] = (!isset($allAnswers)) ? [] : $allAnswers ;
//var_dump($params["el"]["slug"]);exit; //var_dump($params["el"]["slug"]);exit;
//var_dump($params["allAnswers"]);exit; //var_dump($params["allAnswers"]);exit;
......
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