Skip to content

Lesson Attendance Write Mark #32

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,7 @@ $attendance = new \Wonde\Writeback\LessonAttendanceRecord();
$attendance->setStudentId('STUDENT_ID_GOES_HERE');
$attendance->setLessonId('LESSON_ID_GOES_HERE');
$attendance->setAttendanceCodeId('ATTENDANCE_CODE_ID_GOES_HERE');
$attendance->setComment('Comment here.');

// Add attendance mark to register
$register->add($attendance);
Expand Down
33 changes: 32 additions & 1 deletion src/Writeback/LessonAttendanceRecord.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ class LessonAttendanceRecord
*/
private $attendance_code_id;

/**
* @var string
*/
private $comment;

/**
* Set student id
*
Expand Down Expand Up @@ -114,7 +119,33 @@ public function toArray()
'attendance_code_id' => $this->getAttendanceCodeId()
];

$comment = $this->getComment();

if ( ! empty($comment)) {
$required['comment'] = $comment;
}

return $required;
}

}
/**
* Get the comment value
*
* @return string
*/
public function getComment()
{
return $this->comment;
}

/**
* Set the comment value
*
* @param string $comment
*/
public function setComment($comment)
{
$this->comment = $comment;
}

}