18 require_once SQ_ATTRIBUTES_PATH.
'/datetime/datetime.inc';
47 $this->Asset_Attribute_Datetime($attributeid, $value);
48 if (is_null($value)) {
49 $this->value =
'---------- --:--:--';
64 function paint($prefix, $read_only=
false)
66 $prefix = str_replace(
':',
'_',$prefix);
67 if (empty($this->value)) {
68 $value = Array(
'---------- --:--:--');
70 $value = explode(
"\r\n", $this->value);
72 $dta =
new Asset_Attribute_Datetime();
73 $dta->_params = $this->_params;
74 $dta->_edit_params = $this->_edit_params;
75 $dta->_edit_params[
'null'] = Array(
'y',
'm',
'd',
'h',
'i',
's');
76 $dta->value =
'---------- --:--:--';
78 $dta->paint($prefix, $read_only);
79 $dta_template = ob_get_contents();
81 $dta_template = preg_replace(
'/value\[([^"]+)\]/',
'_value[\\1][]', $dta_template);
84 <div
id=
"date-list-<?php echo $prefix; ?>">
86 foreach ($value as $v) {
90 $dta->paint($prefix, $read_only);
91 $dta_output = ob_get_contents();
93 echo preg_replace(
'/value\[([^"]+)\]/',
'_value[\\1][]', $dta_output);
95 ?><button type=
"button" tabindex=
"99999" class=
"delete-button"> </button><br />
98 for ($i =0; $i < 2; $i++) {
99 echo
'<span>'.$dta_template.
'</span>';
100 ?><button type=
"button" tabindex=
"99999" class=
"delete-button"> </button><br />
105 <script type=
"text/javascript" src=
"<?php echo sq_web_path('lib'); ?>/js/edit.js"></script>
106 <script type=
"text/javascript">
108 attachDateListEventHandlers(document.getElementById(
'date-list-<?php echo $prefix; ?>'));
113 foreach ($value as $v) {
114 echo
'<li>'.date($this->_edit_params[
'print_format'], iso8601_ts($v)).
'</li>';
132 $prefix = str_replace(
':',
'_',$prefix);
133 if (!isset($_POST[$prefix.
'show']))
return;
134 $post = $_REQUEST[$prefix.
'_value'];
135 $keys = array_keys(reset($post));
136 foreach ($keys as $key) {
137 $elt = sprintf(
'%04d-%02d-%02d %02d:%02d:%02d', $post[
'y'][$key], $post[
'm'][$key], $post[
'd'][$key], $post[
'h'][$key], $post[
'i'][$key], $post[
's'][$key]);
138 if ($elt !=
'0000-00-00 00:00:00') {
142 $this->processed = $this->setValue(implode(
"\r\n", $value));
157 foreach (explode(
"\r\n", $value) as $v) {
158 if (!parent::validateValue($v))
return false;