Merge branch 'master' into bug-56209/is_valid_date_vs_isValidDate

This commit is contained in:
Paolo
2026-02-23 13:03:06 +01:00
809 changed files with 84109 additions and 11459 deletions
+87
View File
@@ -408,6 +408,23 @@ function findResource($path, $resource, $subdir = false, $extraDir = null)
return null;
}
// ------------------------------------------------------------------------
// PHP functions that don't exist in older versions
// ------------------------------------------------------------------------
/**
* Returns true if the given array is sequential
*/
if (!function_exists('array_is_list')) {
function array_is_list(array $arr)
{
if ($arr === []) {
return true;
}
return array_keys($arr) === range(0, count($arr) - 1);
}
}
// ------------------------------------------------------------------------
// Collection of utility functions for form validation purposes
// ------------------------------------------------------------------------
@@ -483,3 +500,73 @@ function has_permissions_for_stg($studiengang_kz, $permissions = '')
return false;
}
/**
* check if an entry exists in the database
*/
function is_in_db($key, $model = '')
{
if (!$model)
return false;
$field = strstr($model, ":");
if ($field) {
$model = strstr($model, ":", true);
$field = substr($field, 1);
}
$CI =& get_instance();
$CI->load->model($model, $model);
if ($field) {
$result = $CI->$model->loadWhere([
$field => $key
]);
} else {
$result = $CI->$model->load($key);
}
return (isSuccess($result) && hasData($result));
}
/**
* is building an array for Dropdown Entry in Print Dropdown
* @param $id id for the Document to add to the Document Array
* @param $name title of the dropdownEntry
* @param $parameterUrl url of parameters xml, xsl, format etc as needed
* WITHOUT BASEURL eg. "xml=abschlusspruefung.rdf.php&xsl_stg_kz=$studiengang_kz&xsl=Bescheid&output=pdf"
* @param $uid default parameter, if null only parameterurl will be added
* additional needed parameter: put in the parameterUrl
* @param $alternativeBaseUrl: if baseUrl not pdfExport.php, put here alternative without ? char, eg. "zutrittskarte.php"
*
* @return Array
*/
function buildDropdownEntryPrintArray($id, $name, $parameterurl, $uid=null, $order=null, $alternativeBaseUrl=null)
{
//DEFAULT BASEURL
$baseurl = "pdfExport.php?";
$uidString = $uid ? "&uid=" . $uid : "";
if($alternativeBaseUrl)
{
return [
"id" => $id,
"type" => "documenturl",
"name" => $name,
"url" => $alternativeBaseUrl . "?" . $parameterurl . $uidString,
"order" => $order
];
}
else
return [
"id" => $id,
"type" => "documenturl",
"name" => $name,
"url" => $baseurl . $parameterurl . "&uid=" . $uid,
"order" => $order
];
}
+43 -1
View File
@@ -88,6 +88,7 @@ function generateCSSsInclude($CSSs)
function generateJSDataStorageObject($indexPage, $calledPath, $calledMethod)
{
$ci =& get_instance();
$ci->load->config('theme');
$ci->load->model('system/Sprache_model','SpracheModel');
$server_language = getData($ci->SpracheModel->loadWhere(['content' => true]));
$server_language = array_map(function($language){
@@ -95,6 +96,9 @@ function generateJSDataStorageObject($indexPage, $calledPath, $calledMethod)
}, $server_language);
$user_language = getUserLanguage();
$ci->load->config('javascript');
$systemerror_mailto = $ci->config->item('systemerror_mailto');
$FHC_JS_DATA_STORAGE_OBJECT = array(
'app_root' => APP_ROOT,
'ci_router' => $indexPage,
@@ -103,6 +107,11 @@ function generateJSDataStorageObject($indexPage, $calledPath, $calledMethod)
'server_languages' => $server_language,
'user_language' => $user_language,
'timezone' => date_default_timezone_get(),
'systemerror_mailto' => $systemerror_mailto,
'theme' => [
'name'=>$ci->config->item('theme_name'),
'modes'=>$ci->config->item('theme_modes'),
]
);
$toPrint = "\n";
@@ -176,7 +185,15 @@ function generateJSModulesInclude($JSModules)
for ($tmpJSsCounter = 0; $tmpJSsCounter < count($tmpJSs); $tmpJSsCounter++)
{
$toPrint = sprintf($jsInclude, base_url($tmpJSs[$tmpJSsCounter].$cachetoken)).PHP_EOL;
if($ci->config->item('use_fhcomplete_build_version_in_path'))
{
$relurl = preg_replace('#public/#', 'public/' . $ci->config->item('fhcomplete_build_version') . '/', $tmpJSs[$tmpJSsCounter]);
$toPrint = sprintf($jsInclude, base_url($relurl)).PHP_EOL;
}
else
{
$toPrint = sprintf($jsInclude, base_url($tmpJSs[$tmpJSsCounter].$cachetoken)).PHP_EOL;
}
if ($tmpJSsCounter > 0) $toPrint = "\t\t".$toPrint;
@@ -227,3 +244,28 @@ function generateBackwardCompatibleJSMsIe($js)
echo "<![endif]-->\n";
}
/**
* Constructs an accessibility skipLink https://www.w3schools.com/accessibility/accessibility_skip_links.php
*/
function generateSkipLink($skipID)
{
$toPrint = '<a id="skiplink" href="';
$toPrint.=$skipID;
$toPrint.='" class="fhcSkipLink" aria-label="Skip to main content"></a>';
echo $toPrint;
}
function absoluteJsImportUrl($relurl)
{
$ci =& get_instance();
$ci->load->config('javascript');
if($ci->config->item('use_fhcomplete_build_version_in_path'))
{
$url = base_url(preg_replace('#^public/#', 'public/' . $ci->config->item('fhcomplete_build_version') . '/', $relurl));
}
else
{
$url = base_url($relurl) . '?'. $ci->config->item('fhcomplete_build_version');
}
return $url;
}