- Renamed view system/messages/messageSent.php to system/messages/htmlSuccess.php

- Added new view system/messages/htmlError.php
- Renamed view system/messages/messageWrite.php to system/messages/htmlWriteTemplate.php
- Added new widget views: widgets/Dropdown_widget.php and widgets/MultipleDropdown_widget.php
- Added new CSS public/css/Widgets.css
- Controller system/FASMessages:
	- Renamed method write to writeTemplate and method writeReply to writeReplyTemplate
	- Removed all the private methods and moved all the logic to model CL/Messages_model
	- Methods writeTemplate and writeReplyTemplate do not need anymore the sender id as parameter
- Controller system/Messages:
	- Renamed method write to writeTemplate
	- Renamed method send to sendImplicitTemplate
	- Renamed method sendJson to sendExplicitTemplateJson
	- Moved all the logic to model CL/Messages_model
- Adapted php and JS code to use these new methods names and interfaces
- Removed public method getIsAdmin from MessageLib
- Method _sendMessage of MessageLib now returns the saved message ids
- Added new package olifolkerd/tabulator to composer
- Added new parameter widgets to view templates/FHC-Header.php
- Added new HTML widget widgets/Dropdown_widget and widgets/MultipleDropdown_widget
- Added constants REPLY_SUBJECT_PREFIX and REPLY_BODY_PREFIX to model CL/Messages_model
- Added new public methods prepareHtmlWriteTemplatePersons, prepareHtmlWriteTemplatePrestudents, sendImplicitTemplate, sendExplicitTemplate, getVorlage, parseMessageText and getMessageFromIds to model CL/Messages_model
- Added new private methods _getAuthUser, _lowerReplaceSpaceArrayKeys, _addOeToPrestudents, _personLog and _prepareHtmlWriteTemplate to model CL/Messages_model
This commit is contained in:
Paolo
2019-06-18 18:25:26 +02:00
parent 5bda5eb966
commit f6e0f58b3d
23 changed files with 802 additions and 613 deletions
+19
View File
@@ -0,0 +1,19 @@
<?php
class Dropdown_widget extends DropdownWidget
{
public function display($widgetData)
{
$elements = $widgetData['elements'];
$emptyElement = $widgetData['emptyElement'];
$this->setElementsArray(
$elements,
true,
$emptyElement,
'No data present'
);
$this->loadDropDownView($widgetData);
}
}
@@ -0,0 +1,20 @@
<?php
class MultipleDropdown_widget extends DropdownWidget
{
public function display($widgetData)
{
$elements = $widgetData['elements'];
$this->setElementsArray(
$elements,
false,
'',
'No data present'
);
$this->setMultiple();
$this->loadDropDownView($widgetData);
}
}
+21 -21
View File
@@ -17,32 +17,32 @@ class DropdownWidget extends HTMLWidget
const SELECTED_ELEMENT = 'selectedElement';
// Default HTML value
const HTML_DEFAULT_VALUE = 'null';
const SIZE = 'size'; // size of the dropdown
const MULTIPLE = 'multiple'; // multiple attribute
// Alias of $this->_args[HTMLWidget::HTML_ARG_NAME] for a better code readability
protected $htmlParameters;
/**
*
*
*/
public function __construct($name, $args = array(), $htmlArgs = array())
{
parent::__construct($name, $args, $htmlArgs);
// If the selectd element is not set then set it to HTML_DEFAULT_VALUE
if (!isset($this->_args[DropdownWidget::SELECTED_ELEMENT]))
{
$this->_args[DropdownWidget::SELECTED_ELEMENT] = DropdownWidget::HTML_DEFAULT_VALUE;
}
$this->htmlParameters =& $this->_args[HTMLWidget::HTML_ARG_NAME]; // Reference for a better code readability
// By default is not a multiple dropdown
unset($this->htmlParameters[DropdownWidget::MULTIPLE]);
}
/**
* Set this dropdown as multiple:
* - Setting the multiple attribute
@@ -53,23 +53,23 @@ class DropdownWidget extends HTMLWidget
$this->htmlParameters[DropdownWidget::MULTIPLE] = DropdownWidget::MULTIPLE;
$this->htmlParameters[HTMLWidget::HTML_NAME] .= '[]';
}
/**
* Checks if this object is a multiple dropdown
*/
public function isMultipleDropdown()
{
$isMultipleDropdown = false;
if (isset($this->htmlParameters[DropdownWidget::MULTIPLE])
&& $this->htmlParameters[DropdownWidget::MULTIPLE] == DropdownWidget::MULTIPLE)
{
$isMultipleDropdown = true;
}
return $isMultipleDropdown;
}
/**
* Add the correct select to the model used to load a list of elemets for this dropdown
* @param model $model the model used to load elements
@@ -88,7 +88,7 @@ class DropdownWidget extends HTMLWidget
)
);
}
/**
* Set the array used to populate the dropdown
* @param array $elements list used to populate this dropdown
@@ -102,7 +102,7 @@ class DropdownWidget extends HTMLWidget
)
{
$tmpElements = array();
if (isError($elements))
{
if (is_object($elements) && isset($elements->retval))
@@ -133,11 +133,11 @@ class DropdownWidget extends HTMLWidget
{
$tmpElements = $elements->retval;
}
$this->_args[DropdownWidget::WIDGET_DATA_ELEMENTS_ARRAY_NAME] = $tmpElements;
}
}
/**
* Adds an element to the beginning of the array
*/
@@ -146,17 +146,17 @@ class DropdownWidget extends HTMLWidget
$element = new stdClass();
$element->{DropdownWidget::ID_FIELD} = $id;
$element->{DropdownWidget::DESCRIPTION_FIELD} = $stdDescription;
if (!hasData($elements))
{
$element->{DropdownWidget::DESCRIPTION_FIELD} = $noDataDescription;
}
array_unshift($elements->retval, $element);
return $elements->retval;
}
/**
* Loads the dropdown view with all the elements to be displayed
*/
@@ -164,4 +164,4 @@ class DropdownWidget extends HTMLWidget
{
$this->view('widgets/dropdown', $this->_args);
}
}
}