Commit 743dc207 authored by Tibor Katelbach's avatar Tibor Katelbach
Browse files

added oforms view

parent 39b54308
......@@ -24,6 +24,7 @@ class CoController extends CommunecterController {
'form' => 'survey.controllers.actions.FormAction',
'forms' => 'survey.controllers.actions.FormsAction',
'oforms' => 'survey.controllers.actions.OformsAction',
'edit' => 'survey.controllers.actions.EditAction',
'new' => 'survey.controllers.actions.NewAction',
'save' => 'survey.controllers.actions.SaveAction',
......
<?php
class OformsAction extends CTKAction
{
public function run($slug)
{
$this->getController()->layout = "//layouts/empty";
$el = Slug::getElementBySlug($slug);
$params = [];
if(isset( $el["el"]["costum"]["form"]))
{
$params["forms"] = [ $el["el"]["costum"]["form"] ];
$params["forms"][0]["name"] = "todo COForms name";
//$params["forms"][0]["name"] = "todo COForms name";
//var_dump($el["el"]["costum"]["form"]); exit;
foreach ( $params["forms"] as $fix => $f )
{
$formId = "";
foreach ($f['ids'] as $ix => $fid)
{
if($formId != "")
$formId .= "|";
$formId .= $fid;
$params["forms"][$fix][$fid] = PHDB::findOne( Form::COLLECTION, [ "id"=>$fid ] );
}
$params["forms"][$fix]["answers"] = PHDB::count( Form::ANSWER_COLLECTION, ["formId"=>$formId] );
}
}
//$forms = PHDB::find(Form::COLLECTION,["costum.form"=>[]])
echo $this->getController()->renderPartial('survey.views.tpls.forms.oforms', $params, true);
}
}
\ No newline at end of file
<div class="col-md-12 col-sm-12 col-xs-12 labelTitleDir margin-bottom-15">
<i class="fa fa-file-text-o fa-2x margin-right-10"></i> <i class="fa fa-angle-down"></i> <?php echo count($forms) ?> <b>Open Forms</b> créé par <span class="Montserrat" id="name-lbl-title">SOMMOM</span>
<button class="btn btn-sm btn-link bg-green-k pull-right btn-open-form" data-form-type="classifieds" data-dismiss="modal"><i class="fa fa-plus"></i> Nouveau Formulaire</button>
<div class="col-xs-12 text-right no-padding margin-top-5">
<button class="btn switchDirectoryView margin-right-5" data-value="list"><i class="fa fa-bars"></i></button>
<button class="btn switchDirectoryView active " data-value="block"><i class="fa fa-th-large"></i></button>
</div>
</div>
<?php foreach ($forms as $fix => $f) {
?>
<div class="col-md-4 col-sm-3 col-xs-12 " style="padding:10px;border:1px solid grey">
steps : <br/>
<?php foreach ( $f["ids"] as $ix => $i ) {
echo '<i class="fa fa-file-text-o"></i> '.$f[$i]['name']."<br/>";
}?>
<a href='' style="width:40%;border:1px solid grey">
<i class='fa fa-comments'></i>(<?php echo $f["answers"]; ?>) réponses
</a>
<a href='' style="width:40%;border:1px solid grey">
<i class='fa fa-file-text-o'></i> Questionnaire
</a>
</div>
<?php } ?>
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