$calendar = Calendar::factory($month, $year); $calendar->standard('today') ->standard('prev-next') ->standard('holidays'); $events = array(); $appts = get_appts(); while ($appt = $appts->fetch_array()) { //convert the datetime to a timestamp, because the calendar does not understand datetimes $datetime = new DateTime($appt['datetime']); $timestamp = $datetime->getTimestamp(); //Build the rest of the information $title = ucfirst(appt_type_to_string($appt['type'])); $resolved = ''; if ($appt['resolved']==TRUE) $resolved = ' inactive'; $output = '<li class="qmse '.appt_type_to_classname($appt['type']).$resolved.'" id="appt-'.$appt['quest_id'].'" onclick="openEdit('.$appt['quest_id'].')">'.$appt['tt'].': '.str_replace('_',' ',ucfirst($appt['building'])).' '.$appt['room'].'</li>'; $class = appt_type_to_classname($appt['type']); $event = $calendar->event() ->condition('timestamp',$timestamp) ->title($title) ->output($output) ->add_class($class); $calendar->attach($event); } is_appointment();
function draw_appt_edit_form($apptinfo) { global $appt_types,$buildings; $date=date('Y-m-d', strtotime($apptinfo['datetime'])); $time=date('H:00:00', strtotime($apptinfo['datetime'])); ?> <form action='' method='post' role="form"> <div class="form-group col-xs-6"> <label for="date">Date</label> <div class="input-group date"> <input type="text" class="form-control" name="date" value=<?php echo '"'.$date.'"'; ?>><span class="input-group-addon"><i class="glyphicon glyphicon-calendar"></i></span> </div> </div> <div class="form-group col-xs-6"> <label for="time">Time</label> <select class="form-control" name="time"> <?php for ($i=10;$i<=18;$i++) { if ($i>12) { $j = $i-12; $ampm = 'pm'; } else { $j = $i; $ampm = 'am'; } echo '<option value="'.$i.'">'.$j.':00 '.$ampm.'</option>'; } ?> </select> </div> <div class="form-group col-xs-6"> <label for="type">Type</label> <select class="form-control" name="type"> <?php for ($i=0;$i<count($appt_types);$i++) { echo '<option value='.$i; if ($apptinfo['type']==$i) echo ' selected="true"'; echo '>'.ucfirst(appt_type_to_string($i)).'</option>'; } ?> </select> </div> <div class="form-group col-xs-6"> <label for="tt">Trouble Ticket</label> <input type="text" class="form-control" name="tt" value=<?php echo $apptinfo['tt']; ?>> </div> <div class="form-group col-xs-6"> <label for="building">Building</label> <select class="form-control" name="building"> <?php foreach ($buildings as $building) { echo '<option value="'.strtolower(str_replace(' ', '_', $building)).'"'; if (strtolower(str_replace(' ','_',$building))==$apptinfo['building']) echo ' selected="true"'; echo '>'.$building.'</option>'; } ?> </select> </div> <div class="form-group col-xs-6"> <label for="room">Room</label> <input type="text" class="form-control" name="room" value="<?php echo $apptinfo['room']; ?>"> </div> <div class="form-group col-xs-6"> <label for="tech_id">Technician</label> <select class="form-control" name="tech_id"> <?php $users = get_users(); while ($user = $users->fetch_array()) { echo '<option value='.$user['user_id']; if ($user['user_id']==$apptinfo['tech_id']) echo ' selected="true"'; echo '>'.$user['fname'].' '.$user['lname'].'</option>'; } ?> </select> </div> <div class="col-xs-6"> <input type="hidden" name="updateAppt-submit" value="true"> <button type="submit" class="btn btn-default pull-right">Update</button> </div> </form> <?php }