Commit 5921b80e authored by Raph El's avatar Raph El
Browse files

Hotfix formObj

parent 2d5aeabf
......@@ -99,12 +99,12 @@ var formObj = {
});
}
},
initFilters : function(){},
pagination : {},
scroll : {},
header : {},
results : {},
search : {},
// initFilters : function(){},
// pagination : {},
// scroll : {},
// header : {},
// results : {},
// search : {},
views : {
forms : function(fObj, forms){
var str = '';
......@@ -122,15 +122,34 @@ var formObj = {
fObj.events.form(fObj);
},
form : function(id, form){
var panelColor = "panel-primary";
var formCostum = false;
var urlCostum = "";
if( typeof form.source != "undefined" &&
typeof form.source.insertOrign != "undefined" &&
form.source.insertOrign == "costum"){
panelColor = "panel-success";
formCostum = true;
urlCostum = baseUrl+'/costum/co/index/id/'+form.source.key
}
var str='<div class="col-sm-6 col-xs-12" id="'+id+'Form">'+
'<div class="panel panel-primary">'+
'<div class="panel '+panelColor+'">'+
'<div class="panel-heading">'+
'<h3 class="panel-title">'+form.name;
if(typeof form.canEditForm != "undefined" && form.canEditForm === true){
str += '<a href="javascript:;" class="pull-right deleteFormBtn" data-id="'+id+'">'+
'<i class="fa fa-trash text-red"></i></a>'+
'<a href="javascript:;" class="pull-right editFormBtn" data-id="'+id+'">'+
'<i class="fa fa-pencil text-dark"></i></a>';
'<i class="fa fa-trash text-red"></i></a>';
if(formCostum == true){
str += '<a href="'+urlCostum+'#form.edit.id.'+id+'" target="_blanc" class="pull-right">'+
'<i class="fa fa-pencil text-dark"></i>'+
'</a>';
} else {
str += '<a href="javascript:;" data-id="'+id+'" class="pull-right config">'+
'<i class="fa fa-pencil text-dark"></i>'+
'</a>';
}
}
str += '</h3>';
......@@ -146,22 +165,21 @@ var formObj = {
'<i class="fa fa-pencil"></i> My answers '+
'</a>';
if(typeof form.active != "undefined" && form.active === true){
str += '<a href="javascript:;" data-id="'+id+'" class=" application btn btn-xs btn-primary col-sm-12 bold">'+
if(formCostum == true){
str += '<a href="'+urlCostum+'#answer.index.id.new.form.'+id+'" target="_blanc" class="btn btn-xs btn-primary col-sm-12 bold">'+
'<i class="fa fa-file-text-o"></i> Application Form '+
'</a>';
} else {
str += '<a href="javascript:;" data-id="'+id+'" class=" application btn btn-xs btn-primary col-sm-12 bold">'+
'<i class="fa fa-file-text-o"></i> Application Form '+
'</a>';
}
if(typeof form.canEditForm != "undefined" && form.canEditForm === true){
str += '<a href="javascript:;" data-id="'+id+'" class="allAnswers btn btn-xs btn-primary col-sm-12 bold">'+
'<i class="fa fa-pencil"></i> All Answers '+
'</a>';
}
} else {
if(typeof form.canEditForm != "undefined" && form.canEditForm === true){
str += '<a href="javascript:;" data-id="'+id+'" class="btn btn-xs btn-primary config col-sm-12 bold">'+
'<i class="fa fa-pencil"></i> Build '+
'</a>';
}
}
str += '</div>'+
'</div>'+
......@@ -186,8 +204,6 @@ var formObj = {
var address = "<i class='fa fa-map-marker'></i> ";
var nameProp= "inconnu";
var descrTravaux= "Aucune";
if(typeof ans.mappingValues != "undefined" && ans.mappingValues != null ){
if(typeof ans.mappingValues.name != "undefined")
lbl=ans.mappingValues.name;
......@@ -268,7 +284,7 @@ var formObj = {
str +='</div>';
$(fObj.container).html(str);
fObj.events.answers(fObj);
},
}
},
events : {
add : function(fObj){
......@@ -305,9 +321,9 @@ var formObj = {
fObj.urls.form(fObj, idForm);
});
$(fObj.container+' .editFormBtn').off().click( function(){
dyFObj.openForm( fObj.dynForm.form(fObj) , null, fObj.forms[$(this).data("id")] )
});
// $(fObj.container+' .editFormBtn').off().click( function(){
// dyFObj.openForm( fObj.dynForm.form(fObj) , null, fObj.forms[$(this).data("id")] )
// });
$(fObj.container+' .deleteFormBtn').off().click( function(){
var idF = $(this).data("id");
......
......@@ -13,6 +13,7 @@
'edit' => 'survey.controllers.form.EditAction',
'get' => 'survey.controllers.form.GetAction',
'delete' => 'survey.controllers.form.DeleteAction',
'admindirectory'=>'survey.controllers.form.admin.DirectoryAction',
);
}
}
<?php
/**
* Display the directory of back office
* @param String $id Not mandatory : if specify, look for the person with this Id.
* Else will get the id of the person logged
* @return type
*/
class DirectoryAction extends CAction
{
public function run($slug=null, $tpl=null, $view=null){
$controller = $this->getController();
$panelAdmin = $_POST;
$limitMin=0;
$stepLim=100;
if(@$_POST["page"]){
$limitMin=$limitMin+(100*($_POST["page"]-1));
}
$search="";
if(!empty($_POST["name"])){
$search = trim(urldecode($_POST['name']));
}
$panelAdmin["context"] = array( "id" => $_POST["id"],
"collection" => $_POST["collection"],
"slug" => $_POST["slug"] );
$searchRegExp = Search::accentToRegex($search);
//$query=array("parentSlug"=>$slug);
$query=array("parent.".$_POST["id"] => array('$exists' => 1 ));
//Rest::json($query); exit;
$querySearch = array();
if(!empty($querySearch))
$query = array('$and' => array( $query , $querySearch ) ) ;
if(!empty($panelAdmin['filters'])){
$query = Search::searchFilters($panelAdmin['filters'], $query);
}
$params["typeDirectory"]=[ Form::COLLECTION ];
$params["results"] = array();
$forms = PHDB::findAndLimitAndIndex ( Form::COLLECTION , $query, $stepLim, $limitMin);
$params["results"]["count"][Form::COLLECTION] = PHDB::count( Form::COLLECTION , $query);
$params["results"][Form::COLLECTION] = $forms ;
$params["panelAdmin"] = $panelAdmin;
$page = "groupAdmin";
if($tpl=="json")
Rest::json( $params );
else if(Yii::app()->request->isAjaxRequest)
echo $controller->renderPartial("costum.views.custom.default.".$page,$params,true);
}
}
......@@ -5,7 +5,7 @@ if($canEditForm === true){
$subFormIds = array_merge( $subFormIds, $form["subForms"] );
?>
<div class="col-xs-12 padding-10 text-center" style="background-color: #eee">
<h4>Admin Form : <?php echo $form["name"] ?></h4>
<h4>Admin Form : <?php echo @$form["name"] ?></h4>
<a href='javascript:;' data-id='<?php echo (String)$form["_id"]; ?>' class="configBtn btn btn-danger bold"><i class='fa fa-cogs'></i> CONFIG </a>
<a href='javascript:;' data-id='<?php echo (String)$form["_id"]; ?>' class='addStepBtn btn btn-danger bold'> <i class='fa fa-plus'></i> Ajouter une étape </a>
</div>
......
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