/**
  * Adds this AllocationView to the DOMDocument/XMLElement specified.
  * See toXml() for details.
  * $domtree : DOM document root
  * $parentElement : DOM element where this object will be added
  */
 function addSelfToDocument($domtree, $parentElement)
 {
     // create the root element for this allocation row
     $xmlRoot = $parentElement->appendChild($domtree->createElement('allocationview'));
     // search criteria
     $filterRoot = $xmlRoot->appendChild($domtree->createElement('filter'));
     $filterRoot->appendChild($domtree->createElement('allocationmindate', $this->showMinDate->format('Y-m-d')));
     $filterRoot->appendChild($domtree->createElement('allocationmaxdate', $this->showMaxDate->format('Y-m-d')));
     if ($this->bookingResource != null) {
         $this->bookingResource->addSelfToDocument($domtree, $xmlRoot);
     }
     AllocationView::addDateHeadersToDocument($domtree, $xmlRoot, $this->showMinDate, $this->showMaxDate);
 }
 /**
  * Write contents of Allocations View.
  */
 function content_of_allocations_page()
 {
     // if allocation date is defined, we are on the allocations view
     if (isset($_POST['allocationmindate']) && trim($_POST['allocationmindate']) != '') {
         $av = new AllocationView(DateTime::createFromFormat('!Y-m-d', $_POST['allocationmindate'], new DateTimeZone('UTC')), DateTime::createFromFormat('!Y-m-d', $_POST['allocationmaxdate'], new DateTimeZone('UTC')));
     } else {
         if (isset($_SESSION['ALLOCATION_VIEW'])) {
             $av = new AllocationView($_SESSION['ALLOCATION_VIEW']->showMinDate, $_SESSION['ALLOCATION_VIEW']->showMaxDate);
         } else {
             $av = new AllocationView();
         }
     }
     $av->doSearch();
     $_SESSION['ALLOCATION_VIEW'] = $av;
     error_log($av->toXml());
     echo $av->toHtml();
 }