mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-22 09:22:22 +00:00
- New directory application/widgets/html/ for widgets to render HTML
elements - All the widgets classes to render HTML elements moved from WidgetLib to application/widgets/html/ - New directory application/widgets/udf/ for widgets to render UDF - All the UDF widgets classes moved from WidgetLib to application/widgets/udf/ - HTMLWidget is now the main class to render HTML widget - UDFWidget is now the mail class to render UDF - Removed UDFWidgetTpl - Added function loadResource to fhc helper - Changed method widget of WidgetLib (using loadResource) - Moved UDFWidget method from WidgetLib to UDFLib - Slimmed down class Widget present in WidgetLib - Controller system/UDf now uses UDFLib - View application/views/system/udf.php now uses UDFLib - Updated udf and html widgets to adapt them to the new libs
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class DropdownWidgetUDF extends DropdownWidget
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function render($parameters)
|
||||
{
|
||||
$tmpElements = array();
|
||||
|
||||
//
|
||||
foreach($parameters as $parameter)
|
||||
{
|
||||
//
|
||||
if ((is_array($parameter) && count($parameter) == 2)
|
||||
|| (is_string($parameter) || is_numeric($parameter))
|
||||
|| (is_object($parameter) && isset($parameter->{PARENT::ID_FIELD}) && isset($parameter->{PARENT::DESCRIPTION_FIELD})))
|
||||
{
|
||||
$element = new stdClass(); //
|
||||
//
|
||||
if (is_array($parameter) && count($parameter) == 2)
|
||||
{
|
||||
$element->{PARENT::ID_FIELD} = $parameter[0]; //
|
||||
$element->{PARENT::DESCRIPTION_FIELD} = $parameter[1]; //
|
||||
}
|
||||
//
|
||||
else if (is_string($parameter) || is_numeric($parameter))
|
||||
{
|
||||
$element->{PARENT::ID_FIELD} = $parameter; //
|
||||
$element->{PARENT::DESCRIPTION_FIELD} = $parameter; //
|
||||
}
|
||||
//
|
||||
else if (is_object($parameter) && isset($parameter->{PARENT::ID_FIELD}) && isset($parameter->{PARENT::DESCRIPTION_FIELD}))
|
||||
{
|
||||
$element->{PARENT::ID_FIELD} = $parameter->{PARENT::ID_FIELD}; //
|
||||
$element->{PARENT::DESCRIPTION_FIELD} = $parameter->{PARENT::DESCRIPTION_FIELD}; //
|
||||
}
|
||||
|
||||
array_push($tmpElements, $element); //
|
||||
}
|
||||
}
|
||||
|
||||
$this->setElementsArray(
|
||||
success($tmpElements),
|
||||
true,
|
||||
$this->_args[HTMLWidget::HTML_ARG_NAME][HTMLWidget::PLACEHOLDER],
|
||||
'No data found for this UDF'
|
||||
);
|
||||
|
||||
$this->loadDropDownView();
|
||||
|
||||
echo $this->content();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user