示例#1
0
 function setByOffset($customer, $serviceId, $dayOffset, $startTime, $helpStatus)
 {
     $this->service = new Service($serviceId);
     $this->customer = $customer;
     $this->helpStatus = $helpStatus;
     parent::setByOffset($dayOffset, $startTime, $this->service->duration);
 }
示例#2
0
 /**
  * Internal function to return a TimeBlock object from a row.
  * @param $row array
  * @return TimeBlock
  */
 function &_returnTimeBlockFromRow(&$row)
 {
     $timeBlock = new TimeBlock();
     $timeBlock->setId($row['time_block_id']);
     $timeBlock->setSchedConfId($row['sched_conf_id']);
     $timeBlock->setStartTime($this->datetimeFromDB($row['start_time']));
     $timeBlock->setEndTime($this->datetimeFromDB($row['end_time']));
     $timeBlock->setAssignedColour($row['assigned_colour']);
     $timeBlock->setUnassignedColour($row['unassigned_colour']);
     $this->getDataObjectSettings('time_block_settings', 'time_block_id', $row['time_block_id'], $timeBlock);
     return $timeBlock;
 }
示例#3
0
 /**
  * Save time block. 
  */
 function execute()
 {
     $timeBlockDao =& DAORegistry::getDAO('TimeBlockDAO');
     $schedConf =& Request::getSchedConf();
     if (isset($this->timeBlockId)) {
         $timeBlock =& $timeBlockDao->getTimeBlock($this->timeBlockId);
     }
     if (!isset($timeBlock)) {
         $timeBlock = new TimeBlock();
     }
     $timeBlock->setSchedConfId($schedConf->getId());
     $timeBlock->setStartTime($this->getData('startTime'));
     $timeBlock->setEndTime($this->getData('endTime'));
     // Update or insert time block
     if ($timeBlock->getId() != null) {
         $timeBlockDao->updateTimeBlock($timeBlock);
     } else {
         $timeBlockDao->insertTimeBlock($timeBlock);
     }
 }
示例#4
0
<?php

require_once './modules/constants.php';
require_once './modules/autoload.php';
if (isset($_GET['dayOffset'])) {
    $dayOffset = trim($_GET['dayOffset']);
    // create response object
    $json = array();
    $timeBlock = new TimeBlock();
    $timeBlock->setByOffset($dayOffset, "0:00", 30);
    $json['html'] = "<h3> Available Resources on " . $timeBlock->getStartTime('F d, Y') . ":</h3>";
    $json['html'] .= "<table border='1' class='result_table'><tr><th>Time Frame</th><th>Available Resources</th></tr>";
    foreach ($shopHours as $i => $hour) {
        $timeBlock = new TimeBlock();
        $timeBlock->setByOffset($dayOffset, $hour, 30);
        $json['html'] .= "<tr><td><strong>" . $timeBlock->getStartTime('g:i a') . "</strong> to <strong>" . $timeBlock->getEndTime('g:i a') . "</strong></td><td>";
        $availableResources = $timeBlock->getAvailableResources("S");
        // if workspaces are available, display them
        if ($availableResources != null) {
            foreach ($availableResources as $resource) {
                $json['html'] .= "<strong>" . $resource->name . ":</strong> " . ($resource->total - $resource->used) . "<br />";
            }
        } else {
            $json['html'] .= "<strong>There are no resources<br /> available during this time block.</strong>";
        }
        $json['html'] .= "</td></tr>";
    }
    $json['html'] .= "</table>";
    // encode array $json to JSON string
    $encoded = json_encode($json);
    // send response back to index.html
 public function __construct()
 {
     parent::__construct();
 }