/** * A method to return the datetime of meeting associated with the note * @return string the datetime */ function getMeetingDatetime() { # If this note has a meeting associated with it if ($this->MeetingId != 0) { require_once 'Meeting.php'; # Get the meeting object $meeting = new Meeting($this->MeetingId); # Get datetime and return it in user friendly format $meetingDatetime = $meeting->getDatetime(); return DatetimeConverter::getUserFriendlyDateTimeFormat($meetingDatetime); # Otherwise return an empty string } else { return ""; } }
?> <?php echo $text; ?> <?php } ?> </strong> has been <?php echo $notification::getActionText($notification->getAction()); ?> by <?php echo $notification->getUsername(); ?> <br><span class="label info round"><?php echo DatetimeConverter::getUserFriendlyDateTimeFormat($notification->getDatetimeCreated()); ?> </span> <!-- If the note is deleted, display a warning --> <?php if ($notification->getObject()->getIsDeleted()) { ?> <span class="label alert round">deleted</span> <?php } ?> </div> <a href="<?php echo SITE_URL; ?>
/** * A method to return datetime created in more user friendly way * @return string the datetime of creation */ public function getDatetimeCreatedUserFriendly() { return DatetimeConverter::getUserFriendlyDateTimeFormat($this->DatetimeCreated); }
/** * A method to process POST request for editing an existing AP * @param null $post the $_POST array */ public function editPost($post) { # Retrieve action point from database based on provided id $actionPoint = $this->model('ActionPoint', $post['id']); # Check access rights for user $this->checkAuth($actionPoint); # Check if action point has been marked as done and it was approved (if so, no access) $this->checkAuthDone($actionPoint); # Save the existing actionPoint to the temporary table # in order to retrieve it if not approved by supervisor $actionPoint->SaveTemporary(); # Get original text and deadline of the action point $originalText = $actionPoint->getText(); $originalDeadline = DatetimeConverter::getUserFriendlyDateTimeFormat($actionPoint->getDeadline()); # Get details from post request $deadline = $post['deadline']; $deadline_time_hours = $post['deadline_time_hours']; $deadline_time_minutes = $post['deadline_time_minutes']; $text = $post['text']; $meetingId = $post['meetingId']; $isDone = 0; # If the action point is done if (isset($post['isDone'])) { $isDone = 1; } # If it's the supervisor who edits, he/she can provide a grade $grade = 0; if (isset($post['grade'])) { $grade = $post['grade']; } # Default is 0 because default is student and every time student # edits action point, isApproved must be set to 0 $isApproved = 0; # If it's a supervisor who edits the AP, isApproved is automatically true with any edit if (HTTPSession::getInstance()->USER_TYPE == User::USER_TYPE_SUPERVISOR) { $isApproved = 1; } # Set correct format of provided date $date = DateTime::createFromFormat('d-m-Y H:i', $deadline . " " . $deadline_time_hours . ":" . $deadline_time_minutes); $date = $date->format('Y-m-d H:i:s'); # Set provided information $actionPoint->setDeadline($date); $actionPoint->setText($text); $actionPoint->setMeetingId($meetingId); $actionPoint->setProjectId(HTTPSession::getInstance()->PROJECT_ID); $actionPoint->setIsDone($isDone); if ($grade) { $actionPoint->setGrade($grade); } $actionPoint->setIsApproved($isApproved); # If the action point is approved, we must delete the temporary one from temp table # However we want to retrieve it for the notification, so I'll just keep it here for future reference #if($isApproved) # $actionPoint->RemoveTemporary(); # Save the action point $actionPoint->Save(); # Create a notification new NotificationAP($actionPoint->getID(), NotificationAP::AMENDED); # Redirect back to action points header('Location: ' . SITE_URL . 'actionpoints/' . $post['id']); die; }
<input name="text" placeholder="e.g. Draft of chapter 6" type="text" required> </label> <small class="error">Name of the action point is required</small> </div> <div class="large-12 columns"> <label>This action point has been agreed on a meeting: <small>required</small> <select name="meetingId" required> <option value>Choose a meeting</option> <?php foreach ($data["meetings"] as $meeting) { ?> <option value="<?php echo $meeting->getID(); ?> "><?php echo DatetimeConverter::getUserFriendlyDateTimeFormat($meeting->getDatetime()); ?> </option> <?php } ?> </select> </label> <small class="error">Every action point has to be agreed on a certain meeting</small> </div> <div class="large-12 columns top-10"> <input class="button" type="submit" name="addActionPoint" value="Add"> </div> </form> </div><!-- row -->
<?php echo $data['note']->getTitle(); ?> <?php } ?> <!-- Is the note private? Display a label --> <?php if ($data['note']->getIsPrivate()) { ?> <span class="label info round">Private</span> <?php } ?> </h4> <div><?php echo $data['note']->getText(); ?> </div> <hr> <span class="created">Created by <?php echo $data['note']->getUsername(); ?> on <?php echo DatetimeConverter::getUserFriendlyDateTimeFormat($data['note']->getDatetimeCreated()); ?> </span> </div><!-- note --> </div>
public function getRepeatUntilUserFriendly() { return DatetimeConverter::getUserFriendlyDateTimeFormat($this->getRepeatUntil()); }