- Added new includes to FHC-Header.php

- Now FilterWidget is not rendering an entire page but only a div
- Added view infocenterData to show the filter itself
- FilterWidget now is using the new FHC-Header
This commit is contained in:
Paolo
2017-12-19 10:53:02 +01:00
parent fa3daa7a57
commit 6aeb96818f
7 changed files with 90 additions and 88 deletions
@@ -36,60 +36,4 @@ class InfoCenter extends VileSci_Controller
)
);
}
/**
*
*/
public function filter($filterId = null)
{
$filterWidgetArray = array(
'query' => '
SELECT p.person_id AS "PersonId",
p.nachname AS "Nachname",
p.vorname AS "Vorname",
k.kontakt AS "Email",
p.aktiv AS "Aktiv",
k.updateamum AS "UpdateDate"
FROM public.tbl_person p INNER JOIN public.tbl_kontakt k USING(person_id)
WHERE p.aktiv = TRUE
AND p.person_id = k.person_id
AND k.kontakttyp = \'email\'
AND p.person_id < 1000
',
'hideHeader' => false,
'hideSave' => false,
'checkboxes' => array('PersonId'),
'additionalColumns' => array('Delete', 'Edit'),
'formatRaw' => function($fieldName, $fieldValue, $datasetRaw) {
if ($fieldName == 'PersonId')
{
$datasetRaw->{$fieldName} = '<a href="view/'.$datasetRaw->PersonId.'">'.$fieldValue.'</a>';
}
elseif ($fieldName == 'Delete')
{
$datasetRaw->{$fieldName} = '<a href="delete/'.$datasetRaw->PersonId.'">Delete</a>';
}
elseif ($fieldName == 'Edit')
{
$datasetRaw->{$fieldName} = '<a href="edit/'.$datasetRaw->PersonId.'">Edit</a>';
}
return $datasetRaw;
}
);
if ($filterId == null)
{
$filterWidgetArray['app'] = 'core';
$filterWidgetArray['datasetName'] = 'kontakts';
$filterWidgetArray['filterKurzbz'] = 'This filter filters';
}
else
{
$filterWidgetArray['filterId'] = $filterId;
}
echo $this->widgetlib->widget('FilterWidget', $filterWidgetArray);
}
}
@@ -1,14 +1,6 @@
<?php $this->load->view('templates/FHC-Header', array('title' => 'Info Center', 'jquery3' => true)); ?>
<?php $iFrameSrc = base_url('index.ci.php/system/infocenter/InfoCenter/filter'); ?>
<script language="Javascript" type="text/javascript">
$(document).ready(function() {
// $("#iFrameFilter").attr('width', $(window).width());
});
</script>
<?php
$this->load->view('templates/FHC-Header', array('title' => 'Info Center', 'jquery3' => true, 'tablesorter' => true));
?>
<body>
@@ -25,9 +17,9 @@
</span>
<span>
<iframe id="iFrameFilter" name="iFrameFilter" src="<?php echo $iFrameSrc; ?>" width="800" height="700" frameborder="0">
Your browser does not support iframes, please update it
</iframe>
<?php
$this->load->view('system/infocenter/infocenterData.php');
?>
</span>
</body>
@@ -0,0 +1,50 @@
<?php
$filterWidgetArray = array(
'query' => '
SELECT p.person_id AS "PersonId",
p.nachname AS "Nachname",
p.vorname AS "Vorname",
k.kontakt AS "Email",
p.aktiv AS "Aktiv",
k.updateamum AS "UpdateDate"
FROM public.tbl_person p INNER JOIN public.tbl_kontakt k USING(person_id)
WHERE p.aktiv = TRUE
AND p.person_id = k.person_id
AND k.kontakttyp = \'email\'
AND p.person_id < 1000
',
'hideHeader' => true,
'hideSave' => true,
'additionalColumns' => array('Details'),
'formatRaw' => function($fieldName, $fieldValue, $datasetRaw) {
$link = '<a href="%s%s" target="_blank">Details</a>';
if ($fieldName == 'Details')
{
$datasetRaw->{$fieldName} = sprintf(
$link,
base_url('index.ci.php/system/infocenter/infocenterDetails/showDetails/'),
$datasetRaw->PersonId
);
}
return $datasetRaw;
}
);
$filterId = isset($_GET['filterId']) ? $_GET['filterId'] : null;
if (isset($filterId) && is_numeric($filterId))
{
$filterWidgetArray['filterId'] = $filterId;
}
else
{
$filterWidgetArray['app'] = 'core';
$filterWidgetArray['datasetName'] = 'kontakts';
$filterWidgetArray['filterKurzbz'] = 'This filter filters';
}
echo $this->widgetlib->widget('FilterWidget', $filterWidgetArray);
?>
@@ -3,9 +3,9 @@
{
foreach ($listFilters as $name => $filterId)
{
$toPrint = '<div><a href="%s/%s" target="iFrameFilter">%s</a></div>';
$toPrint = '<div><a href="%s=%s">%s</a></div>';
echo sprintf($toPrint, base_url('index.ci.php/system/infocenter/InfoCenter/filter'), $filterId, $name).PHP_EOL;
echo sprintf($toPrint, base_url('index.ci.php/system/infocenter/InfoCenter?filterId'), $filterId, $name).PHP_EOL;
}
}
@@ -9,6 +9,7 @@ $customJSs = isset($customJSs) ? $customJSs : null;
// By default set the parameters to false
$jquery3 = isset($jquery3) ? $jquery3 : false;
$tablesorter = isset($tablesorter) ? $tablesorter : false;
/**
* Print the given title of the page
@@ -89,11 +90,16 @@ function _generateJSsInclude($JSs)
// Eventually required CSS
_generateCSSsInclude($customCSSs); // Eventually required CSS
// Table sorter CSS
if ($tablesorter === true) _generateCSSsInclude('skin/tablesort.css');
// --------------------------------------------------------------------------------------------------------
// Javascripts
// JQuery V3
if ($jquery3 === true) _generateJSsInclude('vendor/components/jquery/jquery.min.js');
// Table sorter JS
if ($tablesorter === true) _generateJSsInclude('vendor/christianbach/tablesorter/jquery.tablesorter.min.js');
// Eventually required JS
_generateJSsInclude($customJSs);
+12 -11
View File
@@ -1,12 +1,16 @@
<?php
$this->load->view(
'templates/header',
array('title' => 'Filters', 'tablesort' => true, 'tableid' => 'tableDataset', 'widgets' => 'zebra')
);
?>
<script language="Javascript" type="text/javascript">
$(document).ready(function() {
// Checks if the table contains data (rows)
if ($('#tableDataset').find('tbody:empty').length == 0
&& $('#tableDataset').find('tr:empty').length == 0)
{
$("#tableDataset").tablesorter(
{
widgets: ["zebra"]
});
}
$("#addField").change(function() {
$("#filterForm").submit();
});
@@ -47,7 +51,7 @@
});
</script>
<body>
<div>
<form id="filterForm" method="POST" action="<?php echo current_url(); ?>">
<div>
<?php FilterWidget::loadViewSelectFields($listFields); ?>
@@ -71,7 +75,4 @@
<?php FilterWidget::loadViewTableDataset($dataset); ?>
</div>
</form>
</body>
<?php
$this->load->view('templates/footer');
?>
</div>
+14 -5
View File
@@ -593,7 +593,7 @@ class FilterWidget extends Widget
$this->FiltersModel->resetQuery();
//
$this->FiltersModel->addJoin('public.tbl_benutzer', 'person_id');
$this->FiltersModel->addJoin('public.tbl_benutzer', 'person_id', 'LEFT');
//
$this->FiltersModel->addSelect('system.tbl_filters.*');
@@ -619,9 +619,7 @@ class FilterWidget extends Widget
else
{
$whereParameters = array(
'filter_id' => $this->filter_id,
'uid' => getAuthUID(),
'default_filter' => true
'filter_id' => $this->filterId
);
}
@@ -635,7 +633,6 @@ class FilterWidget extends Widget
if (isset($filter->retval[0]->filter) && trim($filter->retval[0]->filter) != '')
{
$jsonEncodedFilter = json_decode($filter->retval[0]->filter);
}
}
@@ -687,6 +684,18 @@ class FilterWidget extends Widget
self::ACTIVE_FILTERS_OPTION => $activeFiltersOption
);
$this->session->set_userdata(self::SESSION_NAME, $filterSessionArray);
}
else
{
$filterSessionArray = array(
self::SELECTED_FIELDS => array(),
self::SELECTED_FILTERS => array(),
self::ACTIVE_FILTERS => array(),
self::ACTIVE_FILTERS_OPERATION => array(),
self::ACTIVE_FILTERS_OPTION => array()
);
$this->session->set_userdata(self::SESSION_NAME, $filterSessionArray);
}
}