mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-22 09:22:22 +00:00
- Removed /core from URL
- If UDf are not set in DB UDF view will not display them - Removed placeholder from multiple dropdown widget - Dropdown widget has null value as placeholder - Added permission system/udf to checksystem
This commit is contained in:
@@ -55,18 +55,24 @@ class UDF extends VileSci_Controller
|
||||
|
||||
if (isset($person_id) && is_numeric($person_id))
|
||||
{
|
||||
$person = $this->PersonModel->load($person_id);
|
||||
$personUdfs = $this->PersonModel->getUDFs();
|
||||
$personUdfs['person_id'] = $person_id;
|
||||
$data['personUdfs'] = $personUdfs;
|
||||
if ($this->PersonModel->hasUDF())
|
||||
{
|
||||
$person = $this->PersonModel->load($person_id);
|
||||
$personUdfs = $this->PersonModel->getUDFs();
|
||||
$personUdfs['person_id'] = $person_id;
|
||||
$data['personUdfs'] = $personUdfs;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($prestudent_id) && is_numeric($prestudent_id))
|
||||
{
|
||||
$prestudent = $this->PrestudentModel->load($prestudent_id);
|
||||
$prestudentUdfs = $this->PrestudentModel->getUDFs();
|
||||
$prestudentUdfs['prestudent_id'] = $prestudent_id;
|
||||
$data['prestudentUdfs'] = $prestudentUdfs;
|
||||
if ($this->PrestudentModel->hasUDF())
|
||||
{
|
||||
$prestudent = $this->PrestudentModel->load($prestudent_id);
|
||||
$prestudentUdfs = $this->PrestudentModel->getUDFs();
|
||||
$prestudentUdfs['prestudent_id'] = $prestudent_id;
|
||||
$data['prestudentUdfs'] = $prestudentUdfs;
|
||||
}
|
||||
}
|
||||
|
||||
$this->load->view('system/udf', $data);
|
||||
|
||||
+100
-63
@@ -25,6 +25,8 @@ class DB_Model extends FHC_Model
|
||||
const UDF_ATTRIBUTE_NAME = 'name';
|
||||
const UDF_TYPE_NAME = 'type';
|
||||
const UDF_CHKBOX_TYPE = 'checkbox';
|
||||
const UDF_DROPDOWN_TYPE = 'dropdown';
|
||||
const UDF_MULTIPLEDROPDOWN_TYPE = 'multipledropdown';
|
||||
const UDF_FIELD_JSON_DESCRIPTION = 'jsons';
|
||||
|
||||
// UDF validation attributes
|
||||
@@ -39,6 +41,7 @@ class DB_Model extends FHC_Model
|
||||
// String values of booleans
|
||||
const STRING_TRUE = 'true';
|
||||
const STRING_FALSE = 'false';
|
||||
const STRING_NULL = 'null';
|
||||
|
||||
protected $dbTable; // Name of the DB-Table for CI-Insert, -Update, ...
|
||||
protected $pk; // Name of the PrimaryKey for DB-Update, Load, ...
|
||||
@@ -866,89 +869,100 @@ class DB_Model extends FHC_Model
|
||||
/**
|
||||
* Validates UDF value
|
||||
*/
|
||||
private function _validateUDFs($decodedUDFValidation, $udfName, $udfValue)
|
||||
private function _validateUDFs($decodedUDFValidation, $udfName, $udfType, $udfValue)
|
||||
{
|
||||
$returnArrayValidation = array(); // returned value
|
||||
|
||||
// If $udfValue is not an array, then store it inside a new array
|
||||
$tmpUdfValues = $udfValue;
|
||||
if (!is_array($udfValue))
|
||||
//
|
||||
if (((isset($decodedUDFValidation->validation->{DB_Model::UDF_REQUIRED})
|
||||
&& $decodedUDFValidation->validation->{DB_Model::UDF_REQUIRED} === false)
|
||||
|| !isset($decodedUDFValidation->validation->{DB_Model::UDF_REQUIRED}))
|
||||
&& ($udfType == DB_Model::UDF_DROPDOWN_TYPE || $udfType == DB_Model::UDF_MULTIPLEDROPDOWN_TYPE))
|
||||
{
|
||||
$tmpUdfValues = array($udfValue);
|
||||
$returnArrayValidation = array();
|
||||
}
|
||||
|
||||
// Loops through all the supplied UDFs values
|
||||
foreach($tmpUdfValues as $udfValIndx => $udfVal)
|
||||
else
|
||||
{
|
||||
// If the single UDF value is not an array or an object
|
||||
if (!is_array($udfVal) && !is_object($udfVal))
|
||||
// If $udfValue is not an array, then store it inside a new array
|
||||
$tmpUdfValues = $udfValue;
|
||||
if (!is_array($udfValue))
|
||||
{
|
||||
// If the UDF value is numeric (integer, float, double...)
|
||||
if (is_numeric($udfVal))
|
||||
$tmpUdfValues = array($udfValue);
|
||||
}
|
||||
|
||||
// Loops through all the supplied UDFs values
|
||||
foreach($tmpUdfValues as $udfValIndx => $udfVal)
|
||||
{
|
||||
// If the single UDF value is not an array or an object
|
||||
if (!is_array($udfVal) && !is_object($udfVal))
|
||||
{
|
||||
// If min value attribute is present in the validation for this UDF,
|
||||
// then checks if the value of this UDF is compliant to this attribute
|
||||
if (isset($decodedUDFValidation->{DB_Model::UDF_MIN_VALUE})
|
||||
&& $udfVal < $decodedUDFValidation->{DB_Model::UDF_MIN_VALUE})
|
||||
// If the UDF value is numeric (integer, float, double...)
|
||||
if (is_numeric($udfVal))
|
||||
{
|
||||
// validation is failed and the error is stored in $returnArrayValidation
|
||||
$returnArrayValidation[] = error($udfName, EXIT_VALIDATION_UDF_MIN_VALUE);
|
||||
// If min value attribute is present in the validation for this UDF,
|
||||
// then checks if the value of this UDF is compliant to this attribute
|
||||
if (isset($decodedUDFValidation->{DB_Model::UDF_MIN_VALUE})
|
||||
&& $udfVal < $decodedUDFValidation->{DB_Model::UDF_MIN_VALUE})
|
||||
{
|
||||
// validation is failed and the error is stored in $returnArrayValidation
|
||||
$returnArrayValidation[] = error($udfName, EXIT_VALIDATION_UDF_MIN_VALUE);
|
||||
}
|
||||
|
||||
// If max value attribute is present in the validation for this UDF,
|
||||
// then checks if the value of this UDF is compliant to this attribute
|
||||
if (isset($decodedUDFValidation->{DB_Model::UDF_MAX_VALUE})
|
||||
&& $udfVal > $decodedUDFValidation->{DB_Model::UDF_MAX_VALUE})
|
||||
{
|
||||
// validation is failed and the error is stored in $returnArrayValidation
|
||||
$returnArrayValidation[] = error($udfName, EXIT_VALIDATION_UDF_MAX_VALUE);
|
||||
}
|
||||
}
|
||||
|
||||
// If max value attribute is present in the validation for this UDF,
|
||||
$strUdfVal = strval($udfVal); // store in $strUdfVal the string conversion of $udfVal
|
||||
// If min length attribute is present in the validation for this UDF,
|
||||
// then checks if the value of this UDF is compliant to this attribute
|
||||
if (isset($decodedUDFValidation->{DB_Model::UDF_MAX_VALUE})
|
||||
&& $udfVal > $decodedUDFValidation->{DB_Model::UDF_MAX_VALUE})
|
||||
if (isset($decodedUDFValidation->{DB_Model::UDF_MIN_LENGTH}) && isset($strUdfVal)
|
||||
&& strlen($strUdfVal) < $decodedUDFValidation->{DB_Model::UDF_MIN_LENGTH})
|
||||
{
|
||||
// validation is failed and the error is stored in $returnArrayValidation
|
||||
$returnArrayValidation[] = error($udfName, EXIT_VALIDATION_UDF_MAX_VALUE);
|
||||
$returnArrayValidation[] = error($udfName, EXIT_VALIDATION_UDF_MIN_LENGTH);
|
||||
}
|
||||
}
|
||||
|
||||
$strUdfVal = strval($udfVal); // store in $strUdfVal the string conversion of $udfVal
|
||||
// If min length attribute is present in the validation for this UDF,
|
||||
// then checks if the value of this UDF is compliant to this attribute
|
||||
if (isset($decodedUDFValidation->{DB_Model::UDF_MIN_LENGTH}) && isset($strUdfVal)
|
||||
&& strlen($strUdfVal) < $decodedUDFValidation->{DB_Model::UDF_MIN_LENGTH})
|
||||
{
|
||||
// validation is failed and the error is stored in $returnArrayValidation
|
||||
$returnArrayValidation[] = error($udfName, EXIT_VALIDATION_UDF_MIN_LENGTH);
|
||||
}
|
||||
|
||||
// If max length attribute is present in the validation for this UDF,
|
||||
// then checks if the value of this UDF is compliant to this attribute
|
||||
if (isset($decodedUDFValidation->{DB_Model::UDF_MAX_LENGTH}) && isset($strUdfVal)
|
||||
&& strlen($strUdfVal) > $decodedUDFValidation->{DB_Model::UDF_MAX_LENGTH})
|
||||
{
|
||||
// validation is failed and the error is stored in $returnArrayValidation
|
||||
$returnArrayValidation[] = error($udfName, EXIT_VALIDATION_UDF_MAX_LENGTH);
|
||||
}
|
||||
|
||||
// If $udfVal is a string
|
||||
if (is_string($udfVal))
|
||||
{
|
||||
// Search for a php regular expression in the validation of this UDF, if one is found
|
||||
|
||||
// If max length attribute is present in the validation for this UDF,
|
||||
// then checks if the value of this UDF is compliant to this attribute
|
||||
if (isset($decodedUDFValidation->{DB_Model::UDF_REGEX})
|
||||
&& is_array($decodedUDFValidation->{DB_Model::UDF_REGEX}))
|
||||
if (isset($decodedUDFValidation->{DB_Model::UDF_MAX_LENGTH}) && isset($strUdfVal)
|
||||
&& strlen($strUdfVal) > $decodedUDFValidation->{DB_Model::UDF_MAX_LENGTH})
|
||||
{
|
||||
foreach($decodedUDFValidation->{DB_Model::UDF_REGEX} as $regexIndx => $regex)
|
||||
// validation is failed and the error is stored in $returnArrayValidation
|
||||
$returnArrayValidation[] = error($udfName, EXIT_VALIDATION_UDF_MAX_LENGTH);
|
||||
}
|
||||
|
||||
// If $udfVal is a string
|
||||
if (is_string($udfVal))
|
||||
{
|
||||
// Search for a php regular expression in the validation of this UDF, if one is found
|
||||
// then checks if the value of this UDF is compliant to this attribute
|
||||
if (isset($decodedUDFValidation->{DB_Model::UDF_REGEX})
|
||||
&& is_array($decodedUDFValidation->{DB_Model::UDF_REGEX}))
|
||||
{
|
||||
if ($regex->language == DB_Model::UDF_REGEX_LANG)
|
||||
foreach($decodedUDFValidation->{DB_Model::UDF_REGEX} as $regexIndx => $regex)
|
||||
{
|
||||
if (preg_match($regex->expression, $udfVal) != 1)
|
||||
if ($regex->language == DB_Model::UDF_REGEX_LANG)
|
||||
{
|
||||
// validation is failed and the error is stored in $returnArrayValidation
|
||||
$returnArrayValidation[] = error($udfName, EXIT_VALIDATION_UDF_REGEX);
|
||||
if (preg_match($regex->expression, $udfVal) != 1)
|
||||
{
|
||||
// validation is failed and the error is stored in $returnArrayValidation
|
||||
$returnArrayValidation[] = error($udfName, EXIT_VALIDATION_UDF_REGEX);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else // otherwise the validation is failed and the error is stored in $returnArrayValidation
|
||||
{
|
||||
$returnArrayValidation[] = error($udfName, EXIT_VALIDATION_UDF_NOT_VALID_VAL);
|
||||
else // otherwise the validation is failed and the error is stored in $returnArrayValidation
|
||||
{
|
||||
$returnArrayValidation[] = error($udfName, EXIT_VALIDATION_UDF_NOT_VALID_VAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1012,13 +1026,13 @@ class DB_Model extends FHC_Model
|
||||
// If this is the definition of this UDF
|
||||
if ($decodedUDFDefinition->{DB_Model::UDF_ATTRIBUTE_NAME} == $key)
|
||||
{
|
||||
// If validation rules are present for this UDF
|
||||
if (isset($decodedUDFDefinition->validation))
|
||||
if (isset($decodedUDFDefinition->validation)) // If validation rules are present for this UDF
|
||||
{
|
||||
// Validation!!!
|
||||
$validate = $this->_validateUDFs(
|
||||
$decodedUDFDefinition->validation, //
|
||||
$decodedUDFDefinition->{DB_Model::UDF_ATTRIBUTE_NAME}, //
|
||||
$decodedUDFDefinition->{DB_Model::UDF_TYPE_NAME},
|
||||
$val //
|
||||
);
|
||||
|
||||
@@ -1031,7 +1045,23 @@ class DB_Model extends FHC_Model
|
||||
&& $decodedUDFDefinition->validation->{DB_Model::UDF_REQUIRED} === true
|
||||
&& isset($requiredUDFsArray[$decodedUDFDefinition->{DB_Model::UDF_ATTRIBUTE_NAME}]))
|
||||
{
|
||||
unset($requiredUDFsArray[$decodedUDFDefinition->{DB_Model::UDF_ATTRIBUTE_NAME}]);
|
||||
//
|
||||
if ($decodedUDFDefinition->{DB_Model::UDF_TYPE_NAME} == DB_Model::UDF_CHKBOX_TYPE
|
||||
&& ($val == DB_Model::STRING_FALSE || $val === false))
|
||||
{
|
||||
// NOP
|
||||
}
|
||||
//
|
||||
else if (($decodedUDFDefinition->{DB_Model::UDF_TYPE_NAME} == DB_Model::UDF_DROPDOWN_TYPE
|
||||
|| $decodedUDFDefinition->{DB_Model::UDF_TYPE_NAME} == DB_Model::UDF_MULTIPLEDROPDOWN_TYPE)
|
||||
&& ($val == DB_Model::STRING_NULL || $val == null))
|
||||
{
|
||||
// NOP
|
||||
}
|
||||
else
|
||||
{
|
||||
unset($requiredUDFsArray[$decodedUDFDefinition->{DB_Model::UDF_ATTRIBUTE_NAME}]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1045,6 +1075,14 @@ class DB_Model extends FHC_Model
|
||||
if ($val == DB_Model::STRING_TRUE) $val = true;
|
||||
else if ($val == DB_Model::STRING_FALSE) $val = false;
|
||||
}
|
||||
else if ($decodedUDFDefinition->{DB_Model::UDF_TYPE_NAME} == DB_Model::UDF_DROPDOWN_TYPE
|
||||
|| $decodedUDFDefinition->{DB_Model::UDF_TYPE_NAME} == DB_Model::UDF_MULTIPLEDROPDOWN_TYPE)
|
||||
{
|
||||
if ($val == DB_Model::STRING_NULL)
|
||||
{
|
||||
$val = null;
|
||||
}
|
||||
}
|
||||
|
||||
$toBeStoredUDFsArray[$key] = $val;
|
||||
}
|
||||
@@ -1082,7 +1120,7 @@ class DB_Model extends FHC_Model
|
||||
{
|
||||
// If this field is not present in the given parameters
|
||||
// then copy it from the DB without changes
|
||||
if (!isset($toBeStoredUDFsArray[$fieldName]))
|
||||
if (!array_key_exists($fieldName, $toBeStoredUDFsArray))
|
||||
{
|
||||
$toBeStoredUDFsArray[$fieldName] = $fieldValue;
|
||||
}
|
||||
@@ -1090,7 +1128,6 @@ class DB_Model extends FHC_Model
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$encodedToBeStoredUDFs = json_encode($toBeStoredUDFsArray); // encode to json
|
||||
if ($encodedToBeStoredUDFs !== false) // if encode was ok
|
||||
{
|
||||
|
||||
@@ -781,6 +781,8 @@ class DropdownWidget extends Widget
|
||||
// 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 SELECTED_ELEMENT = 'selectedElement';
|
||||
//
|
||||
const HTML_DEFAULT_VALUE = 'null';
|
||||
|
||||
const SIZE = 'size'; //
|
||||
const MULTIPLE = 'multiple'; //
|
||||
@@ -795,7 +797,7 @@ class DropdownWidget extends Widget
|
||||
//
|
||||
if (!isset($this->_args[DropdownWidget::SELECTED_ELEMENT]))
|
||||
{
|
||||
$this->_args[DropdownWidget::SELECTED_ELEMENT] = Widget::HTML_DEFAULT_VALUE;
|
||||
$this->_args[DropdownWidget::SELECTED_ELEMENT] = DropdownWidget::HTML_DEFAULT_VALUE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -804,7 +806,23 @@ class DropdownWidget extends Widget
|
||||
*/
|
||||
public function setMultiple()
|
||||
{
|
||||
$this->_args[Widget::HTML_ARG_NAME][DropdownWidget::MULTIPLE] = 'multiple';
|
||||
$this->_args[Widget::HTML_ARG_NAME][DropdownWidget::MULTIPLE] = DropdownWidget::MULTIPLE;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function isMultipleDropdown()
|
||||
{
|
||||
$isMultipleDropdown = false;
|
||||
|
||||
if (isset($this->_args[Widget::HTML_ARG_NAME][DropdownWidget::MULTIPLE])
|
||||
&& $this->_args[Widget::HTML_ARG_NAME][DropdownWidget::MULTIPLE] == DropdownWidget::MULTIPLE)
|
||||
{
|
||||
$isMultipleDropdown = true;
|
||||
}
|
||||
|
||||
return $isMultipleDropdown;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -835,7 +853,7 @@ class DropdownWidget extends Widget
|
||||
* @param string $id value of the attribute value of the empty element
|
||||
*/
|
||||
protected function setElementsArray(
|
||||
$elements, $emptyElement = false, $stdDescription = '' , $noDataDescription = 'No data found' , $id = Widget::HTML_DEFAULT_VALUE
|
||||
$elements, $emptyElement = false, $stdDescription = '' , $noDataDescription = 'No data found' , $id = DropdownWidget::HTML_DEFAULT_VALUE
|
||||
)
|
||||
{
|
||||
$tmpElements = array();
|
||||
@@ -857,7 +875,7 @@ class DropdownWidget extends Widget
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($emptyElement === true)
|
||||
if ($emptyElement === true && $this->isMultipleDropdown() == false)
|
||||
{
|
||||
$tmpElements = $this->addElementAtBeginning(
|
||||
$elements,
|
||||
|
||||
@@ -62,6 +62,7 @@ class UDF_model extends DB_Model
|
||||
$this->load->model('person/Person_model', 'PersonModel');
|
||||
|
||||
$udfs = $this->_fillMissingChkboxUDF($udfs, 'public', 'tbl_person');
|
||||
$udfs = $this->_fillMissingDropdownUDF($udfs, 'public', 'tbl_person');
|
||||
|
||||
$resultPerson = $this->PersonModel->update($person_id, $udfs);
|
||||
}
|
||||
@@ -73,6 +74,7 @@ class UDF_model extends DB_Model
|
||||
$this->load->model('crm/Prestudent_model', 'PrestudentModel');
|
||||
|
||||
$udfs = $this->_fillMissingChkboxUDF($udfs, 'public', 'tbl_prestudent');
|
||||
$udfs = $this->_fillMissingDropdownUDF($udfs, 'public', 'tbl_prestudent');
|
||||
|
||||
$resultPrestudent = $this->PrestudentModel->update($prestudent_id, $udfs);
|
||||
}
|
||||
@@ -119,4 +121,32 @@ class UDF_model extends DB_Model
|
||||
|
||||
return $_fillMissingChkboxUDF;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private function _fillMissingDropdownUDF($udfs, $schema, $table)
|
||||
{
|
||||
$_fillMissingDropdownUDF = $udfs;
|
||||
|
||||
$result = $this->load(array($schema, $table));
|
||||
if (isSuccess($result) && count($result->retval) == 1)
|
||||
{
|
||||
$jsons = json_decode($result->retval[0]->jsons);
|
||||
|
||||
foreach($jsons as $udfDescription)
|
||||
{
|
||||
if ($udfDescription->{DB_Model::UDF_TYPE_NAME} == DB_Model::UDF_DROPDOWN_TYPE
|
||||
|| $udfDescription->{DB_Model::UDF_TYPE_NAME} == DB_Model::UDF_MULTIPLEDROPDOWN_TYPE)
|
||||
{
|
||||
if (!isset($_fillMissingDropdownUDF[$udfDescription->{DB_Model::UDF_ATTRIBUTE_NAME}]))
|
||||
{
|
||||
$_fillMissingDropdownUDF[$udfDescription->{DB_Model::UDF_ATTRIBUTE_NAME}] = DB_Model::STRING_NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $_fillMissingDropdownUDF;
|
||||
}
|
||||
}
|
||||
@@ -25,9 +25,9 @@
|
||||
<div style="color: red;">
|
||||
<?php
|
||||
$errors = $result->retval;
|
||||
foreach($errors as $error)
|
||||
foreach ($errors as $error)
|
||||
{
|
||||
foreach($error as $fieldError)
|
||||
foreach ($error as $fieldError)
|
||||
{
|
||||
echo $fieldError->msg . ' -> ' . $fieldError->retval . '<br>';
|
||||
}
|
||||
@@ -42,8 +42,7 @@
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<form action="/core/index.ci.php/system/UDF/saveUDF" method="POST">
|
||||
<form action="<?php echo APP_ROOT; ?>/index.ci.php/system/UDF/saveUDF" method="POST">
|
||||
|
||||
<div class="div-table">
|
||||
<div class="div-row">
|
||||
|
||||
@@ -12,6 +12,8 @@ class UDFWidget extends UDFWidgetTpl
|
||||
const LIST_VALUES = 'listValues';
|
||||
const REGEX_LANGUAGE = 'js';
|
||||
|
||||
const PHRASES_APP_NAME = 'core';
|
||||
|
||||
public function display($widgetData)
|
||||
{
|
||||
$schema = $widgetData[UDFWidgetTpl::SCHEMA_ARG_NAME];
|
||||
@@ -208,7 +210,6 @@ class UDFWidget extends UDFWidgetTpl
|
||||
*/
|
||||
private function _renderDropdown($jsonSchema, $multiple = false)
|
||||
{
|
||||
|
||||
if (isset($this->_args[UDFWidgetTpl::UDFS_ARG_NAME])
|
||||
&& isset($this->_args[UDFWidgetTpl::UDFS_ARG_NAME][$jsonSchema->{UDFWidget::NAME}]))
|
||||
{
|
||||
@@ -305,11 +306,20 @@ class UDFWidget extends UDFWidgetTpl
|
||||
|| isset($jsonSchema->{UDFWidgetTpl::TITLE})
|
||||
|| isset($jsonSchema->{UDFWidgetTpl::PLACEHOLDER}))
|
||||
{
|
||||
//
|
||||
$this->_ci->load->library('PhrasesLib');
|
||||
|
||||
//
|
||||
if (isset($jsonSchema->{UDFWidgetTpl::LABEL}))
|
||||
{
|
||||
$tmpResult = $this->_ci->phraseslib->getPhrases('core', 'German', $jsonSchema->{UDFWidgetTpl::LABEL}, null, null, 'no');
|
||||
$tmpResult = $this->_ci->phraseslib->getPhrases(
|
||||
UDFWidget::PHRASES_APP_NAME,
|
||||
DEFAULT_LEHREINHEIT_SPRACHE,
|
||||
$jsonSchema->{UDFWidgetTpl::LABEL},
|
||||
null,
|
||||
null,
|
||||
'no'
|
||||
);
|
||||
if (hasData($tmpResult))
|
||||
{
|
||||
$this->_args[Widget::HTML_ARG_NAME][UDFWidgetTpl::LABEL] = $tmpResult->retval[0]->text;
|
||||
@@ -320,9 +330,17 @@ class UDFWidget extends UDFWidgetTpl
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
if (isset($jsonSchema->{UDFWidgetTpl::TITLE}))
|
||||
{
|
||||
$tmpResult = $this->_ci->phraseslib->getPhrases('core', 'German', $jsonSchema->{UDFWidgetTpl::TITLE}, null, null, 'no');
|
||||
$tmpResult = $this->_ci->phraseslib->getPhrases(
|
||||
UDFWidget::PHRASES_APP_NAME,
|
||||
DEFAULT_LEHREINHEIT_SPRACHE,
|
||||
$jsonSchema->{UDFWidgetTpl::TITLE},
|
||||
null,
|
||||
null,
|
||||
'no'
|
||||
);
|
||||
if (hasData($tmpResult))
|
||||
{
|
||||
$this->_args[Widget::HTML_ARG_NAME][UDFWidgetTpl::TITLE] = $tmpResult->retval[0]->text;
|
||||
@@ -333,9 +351,17 @@ class UDFWidget extends UDFWidgetTpl
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
if (isset($jsonSchema->{UDFWidgetTpl::PLACEHOLDER}))
|
||||
{
|
||||
$tmpResult = $this->_ci->phraseslib->getPhrases('core', 'German', $jsonSchema->{UDFWidgetTpl::PLACEHOLDER}, null, null, 'no');
|
||||
$tmpResult = $this->_ci->phraseslib->getPhrases(
|
||||
UDFWidget::PHRASES_APP_NAME,
|
||||
DEFAULT_LEHREINHEIT_SPRACHE,
|
||||
$jsonSchema->{UDFWidgetTpl::PLACEHOLDER},
|
||||
null,
|
||||
null,
|
||||
'no'
|
||||
);
|
||||
if (hasData($tmpResult))
|
||||
{
|
||||
$this->_args[Widget::HTML_ARG_NAME][UDFWidgetTpl::PLACEHOLDER] = $tmpResult->retval[0]->text;
|
||||
@@ -361,7 +387,8 @@ class UDFWidget extends UDFWidgetTpl
|
||||
|
||||
if (isset($jsonSchema->validation))
|
||||
{
|
||||
if (isset($jsonSchema->{UDFWidget::VALIDATION}->{UDFWidgetTpl::REGEX}) && is_array($jsonSchema->{UDFWidget::VALIDATION}->{UDFWidgetTpl::REGEX}))
|
||||
if (isset($jsonSchema->{UDFWidget::VALIDATION}->{UDFWidgetTpl::REGEX})
|
||||
&& is_array($jsonSchema->{UDFWidget::VALIDATION}->{UDFWidgetTpl::REGEX}))
|
||||
{
|
||||
foreach($jsonSchema->{UDFWidget::VALIDATION}->{UDFWidgetTpl::REGEX} as $regex)
|
||||
{
|
||||
|
||||
+1
-1
@@ -32,6 +32,6 @@ function loadUDF(person_id, prestudent_id)
|
||||
|
||||
if (udfIFrame != null && udfIFrame.getAttribute('src') == 'about:blank')
|
||||
{
|
||||
udfIFrame.setAttribute('src', '/core/index.ci.php/system/UDF?person_id='+person_id+'&prestudent_id='+prestudent_id);
|
||||
udfIFrame.setAttribute('src', '<?php echo APP_ROOT ?>/index.ci.php/system/UDF?person_id='+person_id+'&prestudent_id='+prestudent_id);
|
||||
}
|
||||
}
|
||||
@@ -334,6 +334,20 @@ if(!$result = @$db->db_query("SELECT udf_values FROM public.tbl_prestudent LIMIT
|
||||
echo '<br>Added column udf_values to table public.tbl_prestudent';
|
||||
}
|
||||
|
||||
// Add permission for UDF
|
||||
if($result = @$db->db_query("SELECT 1 FROM system.tbl_berechtigung WHERE berechtigung_kurzbz = 'system/udf';"))
|
||||
{
|
||||
if($db->db_num_rows($result) == 0)
|
||||
{
|
||||
$qry = "INSERT INTO system.tbl_berechtigung(berechtigung_kurzbz, beschreibung) VALUES('system/udf', 'UDF');";
|
||||
|
||||
if(!$db->db_query($qry))
|
||||
echo '<strong>system.tbl_berechtigung '.$db->db_last_error().'</strong><br>';
|
||||
else
|
||||
echo ' system.tbl_berechtigung: Added permission for UDF<br>';
|
||||
}
|
||||
}
|
||||
|
||||
// Spalten mailversand,teilnehmer_anonym,termine_anonym in campus.tbl_coodle
|
||||
if(!$result = @$db->db_query("SELECT mailversand FROM campus.tbl_coodle LIMIT 1;"))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user