117 $name = static::generateControlName($field);
118 $value = static::internalizeValue($fieldType,
'Renderer', $value);
119 $offset = ($value instanceof
Value\Date) ? $value->getOffset() : 0;
121 $className = static::generateControlClassName($fieldType, $field);
125 if ($isPublicControl && $allowSelection)
127 $selectorAttributes = sprintf(
128 'data-role="inline-selector-target" data-selector-type="%s" data-property="%s" ',
129 htmlspecialcharsbx($fieldType->
getType()),
130 htmlspecialcharsbx(Main\Web\Json::encode($fieldType->
getProperty()))
133 $renderResult = sprintf(
134 '<input name="%s" type="text" class="%s" value="%s" placeholder="%s" %s/>',
135 htmlspecialcharsbx($name),
136 htmlspecialcharsbx($className),
137 htmlspecialcharsbx($value),
144 $renderResult =
'<div><input type="hidden" value="'
145 .htmlspecialcharsbx($value).
'" data-type="'
146 .htmlspecialcharsbx(static::getType()).
'" name="'.htmlspecialcharsbx($name).
'"/>'
147 .
'<a href="#" onclick="return BX.BizProcMobile.showDatePicker(this, event);">'
148 .($value? htmlspecialcharsbx($value) :
Loc::getMessage(
'BPDT_DATE_MOBILE_SELECT')).
'</a></div>';
152 \CJSCore::Init([
'popup',
'date']);
153 $renderResult = sprintf(
154 '<input type="text" name="%s" value="%s" class="%s"/>'
155 .
'<img src="/bitrix/js/main/core/images/calendar-icon.gif" alt="calendar" class="calendar-icon" '
156 .
'onclick="BX.calendar({node:this, field: this.previousSibling, bTime: %s, bHideTime: %s});" '
157 .
'onmouseover="BX.addClass(this, \'calendar-icon-hover\');" '
158 .
'onmouseout="BX.removeClass(this, \'calendar-icon-hover\');" border="0"/>',
159 htmlspecialcharsbx($name),
160 htmlspecialcharsbx($value),
161 $isPublicControl ? htmlspecialcharsbx($className) :
'',
166 $tzName =
'tz_'.$name;
167 $zones = self::getZones();
174 $tzClassName =
'bizproc-type-control-date-lc';
177 $tzClassName .=
' bizproc-type-control-date-lc-multiple';
179 if (!$isPublicControl)
184 $renderResult .=
'<select name="'.htmlspecialcharsbx($tzName).
'" class="'.$tzClassName.
'">';
185 foreach ($zones as $zone)
187 $selected = ($offset && $offset === $zone[
'offset']) ?
'selected' :
'';
188 $renderResult .=
'<option value="'.htmlspecialcharsbx($zone[
'value']).
'" '.$selected.
'>'
189 .htmlspecialcharsbx($zone[
'text']).
'</option>';
191 $renderResult .=
'</select>';
196 $settings[
'timezones'] = $zones;
201 return $renderResult;
214 $allowSelectionOrig = $allowSelection;
217 $allowSelection =
false;
220 $value = static::toSingleValue($fieldType, $value);
221 $selectorValue =
null;
223 if ($allowSelection && \CBPActivity::isExpression($value))
225 $selectorValue = $value;
229 $renderResult = static::renderControl($fieldType, $field, $value, $allowSelectionOrig, $renderMode);
233 $renderResult .= static::renderControlSelector($field, $selectorValue,
true,
'', $fieldType);
236 return $renderResult;
241 $allowSelectionOrig = $allowSelection;
244 $allowSelection =
false;
247 if (!is_array($value) || is_array($value) && \CBPHelper::isAssociativeArray($value))
249 $value = array($value);
252 $selectorValue =
null;
255 foreach ($value as $k => $v)
257 if (\CBPActivity::isExpression($v))
263 $value = array_values($value);
273 foreach ($value as $k => $v)
275 $singleField = $field;
276 $singleField[
'Index'] = $k;
277 $controls[] = static::renderControl(
288 $renderResult = static::renderPublicMultipleWrapper($fieldType, $field, $controls);
292 $renderResult = static::wrapCloneableControls($controls, static::generateControlName($field));
297 $renderResult .= static::renderControlSelector($field, $selectorValue,
true,
'', $fieldType);
300 return $renderResult;
321 $value = parent::extractValue($fieldType, $field, $request);
323 if ($value !==
null && is_string($value) && $value <>
'')
325 if (\CBPActivity::isExpression($value))
329 if(!\CheckDateTime($value, $format))
332 static::addError(array(
333 'code' =>
'ErrorValue',
335 'parameter' => static::generateControlName($field),
340 $tzOffset = self::extractOffset($field, $request);
345 $value = $value->serialize();
425 if ($value instanceof Value\
Date)
431 $userId = \CBPHelper::ExtractUsers([
'author',
'responsible'], $documentId,
true);
432 $offset = $userId ? \CTimeZone::GetOffset($userId,
true) : 0;
437 return (
string) $value;
445 if ($value && is_string($value))
447 $offset = \CTimeZone::GetOffset();
451 ?
new Value\
Date($value, $offset)
454 if ($obj->getTimestamp() !==
null)
463 else if ($value instanceof
Type\
Date)
466 ? Value\Date::fromSystemObject($value)
467 : Value\DateTime::fromSystemObject($value);
477 return \CBPHelper::makeTimestamp($value) ?:
null;
481 if (is_string($value) && preg_match(
'#(.+)\s\[([0-9\-]+)\]#', $value))
483 $value = static::internalizeValue($fieldType, $context, $value);
486 if ($value instanceof Value\
Date)
493 return date(
'c', strtotime($value));