2016-10-06 15:57:01 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/* @var $feuser FrontendUser */
|
|
|
|
/* @var $db DB_ConLite */
|
|
|
|
function frontendusers_valid_to_getTitle ()
|
|
|
|
{
|
|
|
|
return i18n("Valid to");
|
|
|
|
}
|
|
|
|
|
2023-07-04 18:04:48 +00:00
|
|
|
/**
|
|
|
|
* @throws Exception
|
|
|
|
*/
|
2016-10-06 15:57:01 +00:00
|
|
|
function frontendusers_valid_to_display ()
|
|
|
|
{
|
2023-07-04 18:04:48 +00:00
|
|
|
global $feuser;
|
2016-10-06 15:57:01 +00:00
|
|
|
|
|
|
|
$template = '%s';
|
|
|
|
|
|
|
|
$currentValue = $feuser->get("valid_to");
|
2023-07-04 18:04:48 +00:00
|
|
|
|
|
|
|
if($currentValue == "0000-00-00 00:00:00" || $currentValue == "") {
|
|
|
|
$currentValue = '';
|
|
|
|
} else {
|
|
|
|
$datetime = new DateTime($currentValue);
|
|
|
|
$currentValue = $datetime->format('Y-m-d\TH:i');
|
2016-10-06 15:57:01 +00:00
|
|
|
}
|
2023-07-04 18:04:48 +00:00
|
|
|
|
|
|
|
$sValidFrom = '<input
|
|
|
|
id="valid_to"
|
|
|
|
type="datetime-local"
|
|
|
|
name="valid_to"
|
|
|
|
pattern="[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}"
|
|
|
|
value="'.$currentValue.'" />';
|
2016-10-06 15:57:01 +00:00
|
|
|
return sprintf($template,$sValidFrom);
|
|
|
|
}
|
|
|
|
|
|
|
|
function frontendusers_valid_to_wantedVariables ()
|
|
|
|
{
|
|
|
|
return (array("valid_to"));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* check and store valid_to date/datetime
|
|
|
|
*
|
|
|
|
* @global FrontendUser $feuser
|
|
|
|
* @param array $variables
|
|
|
|
*/
|
|
|
|
function frontendusers_valid_to_store ($variables) {
|
|
|
|
global $feuser;
|
2023-07-04 18:04:48 +00:00
|
|
|
|
|
|
|
if(!is_null($variables["valid_to"])) {
|
2016-10-06 15:57:01 +00:00
|
|
|
$feuser->set("valid_to", $variables["valid_to"], false);
|
|
|
|
}
|
2023-07-04 18:04:48 +00:00
|
|
|
}
|