- Added Zusatzfelder tab for UDF in FAS, students and employees

- UDF for person and prestudent only
- Added CSS for widgets
- Fixed checkbox
- Improved aesthetics of widgets
This commit is contained in:
Paolo
2017-07-28 17:25:27 +02:00
parent 994c4e1d36
commit 0ff635f5ea
11 changed files with 148 additions and 101 deletions
+3 -27
View File
@@ -1070,23 +1070,8 @@ class CheckboxWidget extends Widget
const VALUE_FIELD = 'value';
// Name of the property that will be used to store the value between the option tags
const DESCRIPTION_FIELD = 'description';
// The name of the element of the data array given to the view
// this element is used to tell what element of the dropdown is selected
const CHECKED_ELEMENT = 'checkedElement';
/**
*
*/
protected function setValue($value)
{
$tmpValue = $value;
if (is_array($value) && count($value) > 0)
{
$tmpValue = array_values($value)[0];
}
$this->_args[CheckboxWidget::VALUE_FIELD] = $tmpValue;
}
// Value of value attribute of the checkbox
const CHECKBOX_VALUE = 'true';
/**
*
@@ -1105,17 +1090,8 @@ class CheckboxWidgetUDF extends CheckboxWidget
/**
*
*/
public function render($parameters)
public function render()
{
if ($parameters != null)
{
$this->setValue($parameters);
}
else
{
$this->setValue('');
}
$this->loadCheckboxView();
echo $this->content();
+69 -34
View File
@@ -45,25 +45,23 @@
<form action="/core/index.ci.php/system/UDF/saveUDF" method="POST">
<table>
<tr>
<td style="font-size: 20px; font-weight: bold;">
Person
</td>
<td width="30px">
<div class="div-table">
<div class="div-row">
<div class="div-cell" style="font-size: 20px; font-weight: bold;">
Zusatzfelder
</div>
</div>
<div class="div-row">
<div class="div-cell">
&nbsp;
</td>
<td style="font-size: 20px; font-weight: bold;">
Prestudent
</td>
</tr>
<tr>
<td colspan="3">
&nbsp;
</td>
</tr>
<tr>
<td class="align-top">
</div>
</div>
<div class="div-row">
<?php
if (isset($personUdfs))
{
?>
<div class="div-cell">
<?php
echo $this->widgetlib->UDFWidget(
array(
@@ -73,11 +71,18 @@
)
);
?>
</td>
<td width="30px">
</div>
<div class="div-cell" style="width: 40px;">
&nbsp;
</td>
<td class="align-top">
</div>
<?php
}
?>
<?php
if (isset($prestudentUdfs))
{
?>
<div class="div-cell">
<?php
echo $this->widgetlib->UDFWidget(
array(
@@ -87,22 +92,52 @@
)
);
?>
</td>
</tr>
<tr>
<td colspan="3">
</div>
<?php
}
?>
</div>
<div class="div-row">
<div class="div-cell">
&nbsp;
</td>
</tr>
<tr>
<td colspan="3" align="center">
<input type="submit" value="Save">
</td>
</tr>
</table>
</div>
</div>
<div class="div-row halign-right">
<?php
if (isset($personUdfs) && isset($prestudentUdfs))
{
?>
<div class="div-cell">
&nbsp;
</div>
<div class="div-cell">
&nbsp;
</div>
<?php
}
?>
<div class="div-cell halign-right">
<input type="submit" value="&nbsp;Speichern&nbsp;">
</div>
</div>
</div>
<?php
if (isset($personUdfs))
{
?>
<input type="hidden" name="person_id" value="<?php echo $personUdfs['person_id']; ?>">
<?php
}
?>
<?php
if (isset($prestudentUdfs))
{
?>
<input type="hidden" name="prestudent_id" value="<?php echo $prestudentUdfs['prestudent_id']; ?>">
<?php
}
?>
</form>
+4 -7
View File
@@ -6,7 +6,7 @@
if (isset(${Widget::HTML_ARG_NAME}[UDFWidgetTpl::LABEL]))
{
?>
<div class="div-cell align-middle">
<div class="div-cell-label valign-middle width-150px">
<label for="<?php echo ${Widget::HTML_ARG_NAME}[Widget::HTML_ID]; ?>">
<?php echo ${Widget::HTML_ARG_NAME}[UDFWidgetTpl::LABEL]; ?>
</label>
@@ -14,7 +14,7 @@
<?php
}
?>
<div class="div-cell">
<div class="div-cell-data width-30px">
<input
type="checkbox"
<?php Widget::printAttribute(${Widget::HTML_ARG_NAME}, Widget::HTML_ID); ?>
@@ -24,18 +24,15 @@
<?php Widget::printAttribute(${Widget::HTML_ARG_NAME}, UDFWidgetTpl::TITLE); ?>
<?php
$checked = '';
if (${CheckboxWidget::VALUE_FIELD} == ${CheckboxWidget::CHECKED_ELEMENT})
if (${CheckboxWidget::VALUE_FIELD} === true)
{
$checked = 'checked';
}
?>
<?php echo $checked; ?>
value="<?php echo ${CheckboxWidget::VALUE_FIELD}; ?>"
value="<?php echo CheckboxWidget::CHECKBOX_VALUE; ?>"
>
</div>
<div class="div-cell align-middle">
<?php echo ${CheckboxWidget::VALUE_FIELD}; ?>
</div>
</div>
</div>
+4 -4
View File
@@ -5,13 +5,13 @@
<?php
if (isset(${Widget::HTML_ARG_NAME}[UDFWidgetTpl::LABEL]))
{
$align = "align-middle";
$align = "valign-middle";
if (isset(${Widget::HTML_ARG_NAME}[DropdownWidget::MULTIPLE]))
{
$align = "align-top";
$align = "valign-top";
}
?>
<div class="div-cell <?php echo $align; ?>">
<div class="div-cell width-150px <?php echo $align; ?>">
<label for="<?php echo ${Widget::HTML_ARG_NAME}[Widget::HTML_ID]; ?>">
<?php echo ${Widget::HTML_ARG_NAME}[UDFWidgetTpl::LABEL]; ?>
</label>
@@ -19,7 +19,7 @@
<?php
}
?>
<div class="div-cell">
<div class="div-cell width-150px">
<select
<?php Widget::printAttribute(${Widget::HTML_ARG_NAME}, Widget::HTML_ID); ?>
<?php Widget::printAttribute(${Widget::HTML_ARG_NAME}, Widget::HTML_NAME); ?>
+2 -2
View File
@@ -6,7 +6,7 @@
if (isset(${Widget::HTML_ARG_NAME}[UDFWidgetTpl::LABEL]))
{
?>
<div class="div-cell align-top">
<div class="div-cell width-150px valign-top">
<label for="<?php echo ${Widget::HTML_ARG_NAME}[Widget::HTML_ID]; ?>">
<?php echo ${Widget::HTML_ARG_NAME}[UDFWidgetTpl::LABEL]; ?>
</label>
@@ -14,7 +14,7 @@
<?php
}
?>
<div class="div-cell">
<div class="div-cell width-150px">
<textarea
<?php Widget::printAttribute(${Widget::HTML_ARG_NAME}, Widget::HTML_ID); ?>
<?php Widget::printAttribute(${Widget::HTML_ARG_NAME}, Widget::HTML_NAME); ?>
+2 -2
View File
@@ -6,7 +6,7 @@
if (isset(${Widget::HTML_ARG_NAME}[UDFWidgetTpl::LABEL]))
{
?>
<div class="div-cell align-middle">
<div class="div-cell width-150px valign-middle">
<label for="<?php echo ${Widget::HTML_ARG_NAME}[Widget::HTML_ID]; ?>">
<?php echo ${Widget::HTML_ARG_NAME}[UDFWidgetTpl::LABEL]; ?>
</label>
@@ -14,7 +14,7 @@
<?php
}
?>
<div class="div-cell">
<div class="div-cell width-150px">
<input
type="text"
<?php Widget::printAttribute(${Widget::HTML_ARG_NAME}, Widget::HTML_ID); ?>
+3 -20
View File
@@ -283,33 +283,16 @@ class UDFWidget extends UDFWidgetTpl
if (isset($this->_args[UDFWidgetTpl::UDFS_ARG_NAME])
&& isset($this->_args[UDFWidgetTpl::UDFS_ARG_NAME][$jsonSchema->{UDFWidget::NAME}]))
{
$this->_args[CheckboxWidget::CHECKED_ELEMENT] = $this->_args[UDFWidgetTpl::UDFS_ARG_NAME][$jsonSchema->{UDFWidget::NAME}];
$this->_args[CheckboxWidget::VALUE_FIELD] = $this->_args[UDFWidgetTpl::UDFS_ARG_NAME][$jsonSchema->{UDFWidget::NAME}];
}
else
{
$this->_args[CheckboxWidget::CHECKED_ELEMENT] = $jsonSchema->{UDFWidgetTpl::DEFAULT_VALUE};
$this->_args[CheckboxWidget::VALUE_FIELD] = Widget::HTML_DEFAULT_VALUE;
}
$checkboxWidgetUDF = new CheckboxWidgetUDF($this->_name, $this->_args);
$parameters = array();
//
if (isset($jsonSchema->{UDFWidget::LIST_VALUES}->enum))
{
$parameters = $jsonSchema->{UDFWidget::LIST_VALUES}->enum;
}
//
else if (isset($jsonSchema->{UDFWidget::LIST_VALUES}->sql))
{
$queryResult = $this->UDFModel->execQuery($jsonSchema->{UDFWidget::LIST_VALUES}->sql);
if (hasData($queryResult))
{
$tmpResult = (array)$queryResult->retval[0];
$parameters = $tmpResult;
}
}
$checkboxWidgetUDF->render($parameters);
$checkboxWidgetUDF->render();
}
/**
@@ -623,6 +623,12 @@ function MitarbeiterAuswahl()
// ***** Termine *****
document.getElementById('mitarbeiter-termine').setAttribute('src','termine.xul.php?mitarbeiter_uid='+uid);
}
// ***** UDF *****
if (document.getElementById('mitarbeiter-tabs').selectedItem == document.getElementById('mitarbeiter-tab-udf'))
{
document.getElementById('mitarbeiter-udf').setAttribute('src', 'udf.xul.php?person_id='+person_id);
}
// **** VERWENDUNG ****
verwendungtree = document.getElementById('mitarbeiter-tree-verwendung');
@@ -1972,3 +1978,23 @@ function MitarbeiterTermineIFrameLoad()
document.getElementById('mitarbeiter-termine').setAttribute('src',url);
}
}
// ****
// * Load UDF IFrame
// ****
function MitarbeiterUDFIFrameLoad()
{
var tree = document.getElementById('mitarbeiter-tree');
if (tree.currentIndex == -1) return;
try
{
//Ausgewaehlte person_id holen
var person_id = getTreeCellText(tree, 'mitarbeiter-treecol-person_id', tree.currentIndex);
url = 'udf.xul.php?person_id='+person_id;
document.getElementById('mitarbeiter-udf').setAttribute('src', url);
}
catch(e) {}
}
@@ -262,6 +262,10 @@ echo '<?xul-overlay href="'.APP_ROOT.'content/mitarbeiter/mitarbeitervertragover
?>
<tab id="mitarbeiter-tab-termine" label="Termine" onclick="MitarbeiterTermineIFrameLoad()" />
<tab id="mitarbeiter-tab-notizen" label="Notizen"/>
<?php
if (!defined('FAS_UDF') || FAS_UDF == true)
echo '<tab id="mitarbeiter-tab-udf" label="Zusatzfelder" onclick="MitarbeiterUDFIFrameLoad()"/>';
?>
</tabs>
<tabpanels id="mitarbeiter-tabpanels-main" flex="1">
<vbox id="mitarbeiter-detail-stammdaten" style="margin-top:10px;" />
@@ -279,6 +283,10 @@ echo '<?xul-overlay href="'.APP_ROOT.'content/mitarbeiter/mitarbeitervertragover
<vbox id="mitarbeiter-box-notiz">
<box class="Notiz" flex="1" id="mitarbeiter-box-notizen"/>
</vbox>
<?php
if (!defined('FAS_UDF') || FAS_UDF == true)
echo '<iframe id="mitarbeiter-udf" src="" style="margin-top:10px;" />';
?>
</tabpanels>
</tabbox>
</vbox>
+3 -3
View File
@@ -486,8 +486,8 @@ else
?>
<?php
if(!defined('FAS_UDF') || FAS_UDF==true)
echo '<tab id="student-tab-udf" label="UDF" onclick="StudentUDFIFrameLoad();"/>';
if (!defined('FAS_UDF') || FAS_UDF == true)
echo '<tab id="student-tab-udf" label="Zusatzfelder" onclick="StudentUDFIFrameLoad();"/>';
?>
</tabs>
@@ -524,7 +524,7 @@ else
if(!defined('FAS_MESSAGES') || FAS_MESSAGES==true)
echo '<iframe id="student-messages" style="margin: 0px;" src="" />';
if(!defined('FAS_UDF') || FAS_UDF==true)
if (!defined('FAS_UDF') || FAS_UDF == true)
echo '<iframe id="student-udf" style="margin: 0px;" src="" />';
?>
+24 -2
View File
@@ -10,11 +10,33 @@
display: table-cell;
}
.align-middle {
.div-cell-label {
display: table-cell;
}
.div-cell-data {
display: table-cell;
}
.halign-right {
text-align: right;
margin-left: auto;
margin-right: 0;
}
.valign-middle {
vertical-align: middle;
}
.align-top {
.valign-top {
vertical-align: top;
padding-top: 1px;
}
.width-150px {
width: 150px;
}
.width-30px {
width: 30px;
}