[Fusionforge-commits] r15907 - branches/Branch_5_2/src/plugins/oslc/include/oslc-zend/application/models

Olivier Berger olberger at fusionforge.org
Fri Jun 29 18:38:02 CEST 2012


Author: olberger
Date: 2012-06-29 18:38:01 +0200 (Fri, 29 Jun 2012)
New Revision: 15907

Modified:
   branches/Branch_5_2/src/plugins/oslc/include/oslc-zend/application/models/fusionforge.inc.php
Log:
Fix dates to return proper xsd:DateTime

Modified: branches/Branch_5_2/src/plugins/oslc/include/oslc-zend/application/models/fusionforge.inc.php
===================================================================
--- branches/Branch_5_2/src/plugins/oslc/include/oslc-zend/application/models/fusionforge.inc.php	2012-06-29 15:29:17 UTC (rev 15906)
+++ branches/Branch_5_2/src/plugins/oslc/include/oslc-zend/application/models/fusionforge.inc.php	2012-06-29 16:38:01 UTC (rev 15907)
@@ -284,16 +284,25 @@
 									$return[$identifier]['helios_bt:assigned_to'] = $at_arr[$i]->data_array['assigned_realname'];
 									break;
 								case 'dcterms:modified':
-									$return[$identifier]['modified'] = $at_arr[$i]->data_array['last_modified_date'];
-									break;
+								  $date = '@'.$at_arr[$i]->data_array['last_modified_date'];
+								  $date = DateTime($date);
+								  $return[$identifier]['modified'] = $date->format(DateTime::W3C);
+								  break;
 								case 'dcterms:created':
-									$return[$identifier]['created'] = $at_arr[$i]->data_array['open_date'];
-									break;
+								  $date = '@'.$at_arr[$i]->data_array['open_date'];
+								  $date = DateTime($date);
+								  $return[$identifier]['created'] = $date->format(DateTime::W3C);
+								  break;
 								default:
 									throw new ConflictException("The attribute specified ".$field." cannot be found!");
 							}
 						}
 					} else {
+					  $modified = '@'.$at_arr[$i]->data_array['last_modified_date'];
+					  $modified = new DateTime($modified);
+					  $created = '@'.$at_arr[$i]->data_array['open_date'];
+					  $created = new DateTime($created);
+
 						//return the by default set of Change request fields.
 						$return[$identifier]=array(
 							'identifier'=>$identifier,
@@ -303,8 +312,8 @@
 							'helios_bt:priority'=>$at_arr[$i]->data_array['priority'],
 							'creator' => $at_arr[$i]->data_array['submitted_realname'],
 							'helios_bt:assigned_to' => $at_arr[$i]->data_array['assigned_realname'],
-							'modified' => $at_arr[$i]->data_array['last_modified_date'],
-							'created' => $at_arr[$i]->data_array['open_date']
+							'modified' => $modified->format(DateTime::W3C),
+                                                        'created' => $created->format(DateTime::W3C)
 						);
 					}
 				}




More information about the Fusionforge-commits mailing list