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

Edit action form fix & move funtion listAnswers

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