4 include_once
"Services/Form/classes/class.ilFormPropertyGUI.php";
32 $this->lng = $DIC->language();
33 $this->tpl = $DIC[
"tpl"];
34 parent::__construct($a_title, $a_postvar);
44 $this->value = $a_value;
64 $this->validationFailureMessage = $a_msg;
69 return $this->validationFailureMessage;
94 foreach (
$data as $slot => $days) {
96 $this->
setAlert(
$lng->txt(
"msg_input_does_not_match_regexp"));
99 $parts = explode(
"-", $slot);
100 $from = str_replace(
":",
"", $parts[0]);
101 $to = str_replace(
":",
"", $parts[1]);
103 $this->
setAlert(
$lng->txt(
"msg_input_does_not_match_regexp"));
107 foreach (
$data as $rslot => $rdays) {
108 if ($slot != $rslot && $rdays && array_intersect($days, $rdays)) {
109 $rparts = explode(
"-", $rslot);
110 $rfrom = str_replace(
":",
"", $rparts[0]);
111 $rto = str_replace(
":",
"", $rparts[1]);
113 if (($rfrom >
$from && $rfrom < $to) ||
114 ($rto >
$from && $rto < $to) ||
115 ($rfrom < $from && $rto > $to)) {
116 $this->
setAlert(
$lng->txt(
"msg_input_does_not_match_regexp"));
134 public static function getPostData($a_post_var, $a_remove_invalid =
true)
137 for ($loop = 0; $loop < 240; $loop++) {
138 $days =
$_POST[$a_post_var .
"_days~" . $loop];
139 $from = self::parseTime(
140 $_POST[$a_post_var .
"_from_hh~" . $loop],
141 $_POST[$a_post_var .
"_from_mm~" . $loop]
143 $to = self::parseTime(
144 $_POST[$a_post_var .
"_to_hh~" . $loop],
145 $_POST[$a_post_var .
"_to_mm~" . $loop]
149 if ($days ||
$from !=
"00:00" || $to !=
"00:00") {
150 $slot =
$from .
"-" . $to;
152 if (isset(
$res[$slot])) {
153 $res[$slot] = array_unique(array_merge(
$res[$slot], $days));
158 $res[$slot] = array();
161 if ($a_remove_invalid && !($days &&
$from && $to &&
$from != $to)) {
177 $tpl =
new ilTemplate(
"tpl.schedule_input.html",
true,
true,
"Modules/BookingManager");
179 $lng->loadLanguageModule(
"dateplaner");
183 $def = array(null => null);
186 $days = array(
"Mo",
"Tu",
"We",
"Th",
"Fr",
"Sa",
"Su");
188 foreach (
$def as $slot => $days_select) {
189 $tpl->setCurrentBlock(
"days");
190 foreach ($days as $day) {
191 $day_value = strtolower($day);
196 $tpl->setVariable(
"DAY", $day_value);
197 $tpl->setVariable(
"TXT_DAY",
$lng->txt($day .
"_short"));
199 if ($days_select && in_array($day_value, $days_select)) {
200 $tpl->setVariable(
"DAY_STATUS",
" checked=\"checked\"");
203 $tpl->parseCurrentBlock();
206 $tpl->setCurrentBlock(
"row");
210 $tpl->setVariable(
"TXT_FROM",
$lng->txt(
"cal_from"));
211 $tpl->setVariable(
"TXT_TO",
$lng->txt(
"cal_until"));
212 include_once(
"./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php");
215 $tpl->setVariable(
"TXT_MULTI_ADD",
$lng->txt(
"add"));
216 $tpl->setVariable(
"TXT_MULTI_REMOVE",
$lng->txt(
"remove"));
219 $parts = explode(
"-", $slot);
220 $from = explode(
":", $parts[0]);
221 $to = explode(
":", $parts[1]);
223 $tpl->setVariable(
"FROM_HH_VALUE",
$from[0]);
224 $tpl->setVariable(
"FROM_MM_VALUE",
$from[1]);
225 $tpl->setVariable(
"TO_HH_VALUE", $to[0]);
226 $tpl->setVariable(
"TO_MM_VALUE", $to[1]);
232 $tpl->setVariable(
"ADD_STYLE",
" style=\"display:none\"");
236 $tpl->setVariable(
"RMV_STYLE",
" style=\"display:none\"");
240 $tpl->parseCurrentBlock();
257 $tpl->addJavascript(
"Modules/BookingManager/js/ScheduleInput.js");
261 $a_tpl->setCurrentBlock(
"prop_generic");
262 $a_tpl->setVariable(
"PROP_GENERIC",
$html);
263 $a_tpl->parseCurrentBlock();
271 protected static function parseTime($a_hours, $a_minutes)
273 $hours = (int) $a_hours;
274 $min = (int) $a_minutes;
275 if ($hours > 23 || $min > 59) {
278 return str_pad($hours, 2,
"0", STR_PAD_LEFT) .
":" .
279 str_pad($min, 2,
"0", STR_PAD_LEFT);
static get($a_glyph, $a_text="")
Get glyph html.
foreach($_POST as $key=> $value) $res
special template class to simplify handling of ITX/PEAR