/** * Executes the test */ function execute() { $standardDateFormat = new StandardDateFormat(); $usaDateFormat = new UsaDateFormat(); $isoDateFormat = new IsoDateFormat(); // Test parsing assert($standardDateFormat->parseDate("13/01/2005") != null); assert($standardDateFormat->parseDatetime("13/01/2005 23:20:30") != null); assert($usaDateFormat->parseDate("12/15/2005") != null); assert($usaDateFormat->parseDatetime("01/05/2005 10:20:30 PM") != null); assert($isoDateFormat->parseDate("2005-11-25") != null); assert($isoDateFormat->parseDatetime("2004-01-25 22:10:33") != null); // Test date object $date = $standardDateFormat->parseDatetime("15/01/2004 10:20:11"); assert($date->getYear() == 2004); assert($date->getMonth() == 01); assert($date->getDay() == 15); assert($date->getHour() == 10); assert($date->getMinute() == 20); assert($date->getSecond() == 11); // Reparse date object echo "toDatetimeString: " . $standardDateFormat->toDatetimeString($date); }
<!-- Objects --> <?php if ($this->folder->canDoAction(null, Action::LIST_OBJECTS_ACTION()) == true) {?> <?php foreach($this->folder->getObjectFolders() as $objectFolder) {?> <?php $object = $objectFolder->getObject(); /* @var $object Object */?> <?php $class = $object->getClass(); ?> <?php if (($rowNumber % 2) == 0) $rowClass = "row0"; else $rowClass="row1"; ?> <tr class="<?php echo $rowClass ?>"> <td> </td> <td><img src="<?php echo $this->templatePath?>/images/leaf.gif"/></td> <td><a href="#" onclick="editObject(<?php echo $object->getId()?>)"><?php echo $object->getTitle()?></a></td> <td><?php if ($this->folder->isFirstObjectFolder($objectFolder) == false) {?><img onclick="moveObjectFolderUp(<?php echo $objectFolder->getId()?>)" src="<?php echo $this->templatePath?>/images/uparrow.png"/><?php }?></td> <td><?php if ($this->folder->isLastObjectFolder($objectFolder) == false) {?><img onclick="moveObjectFolderDown(<?php echo $objectFolder->getId()?>)" src="<?php echo $this->templatePath?>/images/downarrow.png"/><?php }?></td> <td><?php echo $class->getTitle()?></td> <td><?php $user = $object->getUpdatedByUser(); if ($user == null) echo "-"; else echo $user->getName();?></td> <td><?php $date = $isoDateFormat->parseDatetime($object->getUpdated()); if ($date == null) echo "-"; else echo $this->dateFormat->toDatetimeString($date);?></td> </tr> <?php $rowNumber++; ?> <?php }?> <?php }?> </table> </td> </tr> </table> </form> <script type="text/javascript"> var form = document.getElementById("form");
/** * Shows a view that allows the user to update an object * @param $object Object - object to update * @param $setPostInContext boolean - if true, $object won't be used to fill the fields. Instead, data received by post will be used for that purpose. */ function showUpdateView($setPostInContext = false) { $object = $this->object; // Has the required permissions ? if ($object->canDoAction(null, Action::EDIT_OBJECTS_ACTION()) == false) { $controllerMessage = new ControllerMessage($this->text["notenoughpermissions"], ControllerMessage::getErrorType()); array_push($this->controllerMessageArray, $controllerMessage); $this->showView(false); return; } // Title of the page $pageTitle = str_replace("className", $this->class->getTitle(), $this->text["updateobject"]); // Attributes $frontLanguageArray = $this->constructFrontLanguageArray($object); // Folders $allowedFolderArray = $this->getFolderArray($this->class, $object); $this->tpl->assign("objectId", $object->getId()); // Add items to toolbar $this->setUpdateToolbar(); if ($setPostInContext) { $this->setPostInContext($frontLanguageArray); } else { $dateFormat = DateFormatFactory::getDateFormat(); $isoDateFormat = new IsoDateFormat(); $isPublished = $object->getIsPublished(); if ($isPublished) { $this->tpl->assign("publishCheckbox", "-1"); } $publishFromDate = $isoDateFormat->parseDatetime($object->getStartPublishing()); if ($publishFromDate != null) { $this->tpl->assign("publishFromText", $dateFormat->toDateString($publishFromDate)); } $publishToDate = $isoDateFormat->parseDatetime($object->getEndPublishing()); if ($publishToDate != null) { $this->tpl->assign("publishToText", $dateFormat->toDateString($publishToDate)); } $this->tpl->assign("hits", $object->getHits()); $createdOnDate = $isoDateFormat->parseDatetime($object->getCreated()); $user = $object->getCreatedByUser(); $this->tpl->assign("createdOn", $dateFormat->toDatetimeString($createdOnDate)); $this->tpl->assign("createdBy", $user->getName()); $updatedOnDate = $isoDateFormat->parseDatetime($object->getUpdated()); $user = $object->getUpdatedByUser(); $updatedBy = "-"; $updatedOn = "-"; if ($updatedOnDate != null) { $updatedOn = $dateFormat->toDatetimeString($updatedOnDate); } if ($user != null) { $updatedBy = $user->getName(); } $this->tpl->assign("updatedOn", $updatedOn); $this->tpl->assign("updatedBy", $updatedBy); } $this->displayAdd($pageTitle, $frontLanguageArray, $allowedFolderArray); }