mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-25 00:24:35 +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,77 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Library to manage UDF
|
||||
*/
|
||||
class UDFLib
|
||||
{
|
||||
const WIDGET_NAME = 'UDFWidget';
|
||||
const SCHEMA_ARG_NAME = 'schema';
|
||||
const TABLE_ARG_NAME = 'table';
|
||||
const FIELD_ARG_NAME = 'field';
|
||||
const UDFS_ARG_NAME = 'udfs';
|
||||
|
||||
// HTML components
|
||||
const TITLE = 'description';
|
||||
const LABEL = 'title';
|
||||
const PLACEHOLDER = 'placeholder';
|
||||
const DEFAULT_VALUE = 'defaultValue';
|
||||
|
||||
// Validation attributes
|
||||
const REGEX = 'regex';
|
||||
const REQUIRED = 'required';
|
||||
const MAX_VALUE = 'max-value';
|
||||
const MIN_VALUE = 'min-value';
|
||||
const MAX_LENGTH = 'max-length';
|
||||
const MIN_LENGTH = 'min-length';
|
||||
|
||||
private $_ci;
|
||||
|
||||
public function __construct($config = array())
|
||||
{
|
||||
$this->_ci = & get_instance();
|
||||
|
||||
$this->_ci->load->helper('fhc');
|
||||
|
||||
// Loads the widget library
|
||||
$this->_ci->load->library('WidgetLib');
|
||||
|
||||
// Loads widgets to render HTML elements
|
||||
// NOTE: the first one to be loaded must be HTMLWidget
|
||||
loadResource(APPPATH . 'widgets/udf');
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function UDFWidget($args, $htmlArgs = array())
|
||||
{
|
||||
if (!empty($args[UDFLib::SCHEMA_ARG_NAME]) && !empty($args[UDFLib::TABLE_ARG_NAME]))
|
||||
{
|
||||
//
|
||||
if (empty($args[UDFLib::FIELD_ARG_NAME]) && !isset($htmlArgs[HTMLWidget::EXTERNAL_BLOCK]))
|
||||
{
|
||||
$htmlArgs[HTMLWidget::EXTERNAL_BLOCK] = true;
|
||||
}
|
||||
|
||||
return $this->_ci->widgetlib->widget(
|
||||
UDFLib::WIDGET_NAME,
|
||||
$args,
|
||||
$htmlArgs
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (empty($args[UDFLib::SCHEMA_ARG_NAME]))
|
||||
{
|
||||
show_error(UDFLib::SCHEMA_ARG_NAME.' parameter is missing!');
|
||||
}
|
||||
if (empty($args[UDFLib::TABLE_ARG_NAME]))
|
||||
{
|
||||
show_error(UDFLib::TABLE_ARG_NAME.' parameter is missing!');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user