-
Notifications
You must be signed in to change notification settings - Fork 5
Cert #255
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
Cert #255
Changes from all commits
f2f29b9
ebb34a1
9543b45
8bce43e
8eb7c32
641e12d
c99bf62
29b1ace
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| #courseware-settings { | ||
| label { | ||
| font-weight: 700; | ||
| dfn { | ||
| display: block; | ||
| max-width: 48em; | ||
| font-weight: 400; | ||
| } | ||
| &.cw-settings-label-vips-tries { | ||
| input { | ||
| display: inline-block; | ||
| margin-right: 1em; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,6 +48,22 @@ public function initialize() | |
| $this->defineField('sections_as_chapters', \Mooc\SCOPE_BLOCK, false); | ||
|
|
||
| $this->defineField('scrollytelling', \Mooc\SCOPE_BLOCK, false); | ||
|
|
||
| $this->defineField('certificate', \Mooc\SCOPE_BLOCK, false); | ||
| $this->defineField('certificate_limit', \Mooc\SCOPE_BLOCK, 100); | ||
| $this->defineField('certificate_image_id', \Mooc\SCOPE_BLOCK, ''); | ||
|
|
||
| $this->defineField('reminder', \Mooc\SCOPE_BLOCK, false); | ||
| $this->defineField('reminder_message', \Mooc\SCOPE_BLOCK, ''); | ||
| $this->defineField('reminder_interval', \Mooc\SCOPE_BLOCK, 0); | ||
| $this->defineField('reminder_start_date', \Mooc\SCOPE_BLOCK, 0); | ||
| $this->defineField('reminder_end_date', \Mooc\SCOPE_BLOCK, ''); | ||
|
|
||
| $this->defineField('resetter', \Mooc\SCOPE_BLOCK, false); | ||
| $this->defineField('resetter_message', \Mooc\SCOPE_BLOCK, ''); | ||
| $this->defineField('resetter_interval', \Mooc\SCOPE_BLOCK, 0); | ||
| $this->defineField('resetter_start_date', \Mooc\SCOPE_BLOCK, ''); | ||
| $this->defineField('resetter_end_date', \Mooc\SCOPE_BLOCK, ''); | ||
| } | ||
|
|
||
| public function student_view($context = array()) | ||
|
|
@@ -130,6 +146,7 @@ public function student_view($context = array()) | |
| 'show_section_nav' => $this->show_section_nav, | ||
| 'sections_as_chapters' => $this->sections_as_chapters, | ||
| 'scrollytelling' => $this->scrollytelling, | ||
| 'certificate' => $this->certificate, | ||
| 'isSequential' => $this->progression == 'seq', | ||
| 'active_section' => $active_section, | ||
| 'cw_title' => $courseware->title, | ||
|
|
@@ -437,6 +454,136 @@ public function getScrollytelling() | |
| return $this->scrollytelling; | ||
| } | ||
|
|
||
| public function setCertificate($state) | ||
| { | ||
| $this->certificate = $state; | ||
| } | ||
|
|
||
| public function getCertificate() | ||
| { | ||
| return $this->certificate; | ||
| } | ||
|
|
||
| public function setCertificateLimit($state) | ||
| { | ||
| $this->certificate_limit = $state; | ||
| } | ||
|
|
||
| public function getCertificateLimit() | ||
| { | ||
| return $this->certificate_limit; | ||
| } | ||
|
|
||
| public function setCertificateImageId($state) | ||
| { | ||
| $this->certificate_image_id = $state; | ||
| } | ||
|
|
||
| public function getCertificateImageId() | ||
| { | ||
| return $this->certificate_image_id; | ||
| } | ||
|
|
||
| public function setReminder($state) | ||
| { | ||
| $this->reminder = $state; | ||
| } | ||
|
|
||
| public function getReminder() | ||
| { | ||
| return $this->reminder; | ||
| } | ||
|
|
||
| public function setReminderInterval($state) | ||
| { | ||
| $this->reminder_interval = $state; | ||
| } | ||
|
|
||
| public function getReminderInterval() | ||
| { | ||
| return $this->reminder_interval; | ||
| } | ||
|
|
||
| public function setReminderMessage($state) | ||
| { | ||
| $this->reminder_message = $state; | ||
| } | ||
|
|
||
| public function getReminderMessage() | ||
| { | ||
| return $this->reminder_message; | ||
| } | ||
|
|
||
| public function setReminderStartDate($state) | ||
| { | ||
| $this->reminder_start_date = $state; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hier wäre gut, wenn die Eingabe geprüft würde. Erlaubte Werte sind analog dann ein String im Format |
||
| } | ||
|
|
||
| public function getReminderStartDate() | ||
| { | ||
| return $this->reminder_start_date == '' ? '': date('d.m.Y', (int) $this->reminder_start_date); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hier muss das Format von |
||
| } | ||
|
|
||
| public function setReminderEndDate($state) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hier dasselbe wie für reminder start |
||
| { | ||
| $this->reminder_end_date = $state; | ||
| } | ||
|
|
||
| public function getReminderEndDate() | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Und hier auch. |
||
| { | ||
| return $this->reminder_end_date == '' ? '': date('d.m.Y', (int) $this->reminder_end_date); | ||
| } | ||
|
|
||
| public function setResetter($state) | ||
| { | ||
| $this->resetter = $state; | ||
| } | ||
|
|
||
| public function getResetter() | ||
| { | ||
| return $this->resetter; | ||
| } | ||
|
|
||
| public function setResetterInterval($state) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Konstanten verwenden und prüfen |
||
| { | ||
| $this->resetter_interval = $state; | ||
| } | ||
|
|
||
| public function getResetterInterval() | ||
| { | ||
| return $this->resetter_interval; | ||
| } | ||
|
|
||
| public function setResetterStartDate($state) | ||
| { | ||
| return $this->resetter_start_date = $state; | ||
| } | ||
|
|
||
| public function getResetterStartDate() | ||
| { | ||
| return $this->resetter_start_date == '' ? '': date('d.m.Y', (int) $this->resetter_start_date); | ||
| } | ||
|
|
||
| public function setResetterEndDate($state) | ||
| { | ||
| return $this->resetter_end_date = $state; | ||
| } | ||
|
|
||
| public function getResetterEndDate() | ||
| { | ||
| return $this->resetter_end_date == '' ? '': date('d.m.Y', (int) $this->resetter_end_date); | ||
| } | ||
|
|
||
| public function setResetterMessage($state) | ||
| { | ||
| $this->resetter_message = $state; | ||
| } | ||
|
|
||
| public function getResetterMessage() | ||
| { | ||
| return $this->resetter_message; | ||
| } | ||
|
|
||
| /////////////////////// | ||
| // PRIVATE FUNCTIONS // | ||
| /////////////////////// | ||
|
|
@@ -784,4 +931,4 @@ private function getFilesForSubChapter(\Mooc\DB\Block $subChapter) | |
|
|
||
| return $files; | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -56,6 +56,16 @@ public function settings_action() | |
|
|
||
| return $this->redirect('courseware/settings'); | ||
| } | ||
| $folders = \Folder::findBySQL('range_id = ? AND folder_type = ?', array($this->container['cid'], 'HiddenFolder')); | ||
| $this->files = array(); | ||
| foreach ($folders as $folder) { | ||
| $file_refs = \FileRef::findBySQL('folder_id = ?', array($folder->id)); | ||
| foreach($file_refs as $ref){ | ||
| if (($ref->isImage()) && (!$ref->isLink())) { | ||
| $this->files[] = $ref; | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| public function news_action() | ||
|
|
@@ -306,6 +316,68 @@ private function storeSettings() | |
| $this->storeMaxCountIAV($courseware_settings['max-tries-iav']); | ||
| } | ||
|
|
||
| //////////////////////// | ||
| // Certificate // | ||
| //////////////////////// | ||
| if ($courseware_settings['certificate'] === '1') { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. '1' bedeutet |
||
| $this->storeCertificate(true); | ||
| $this->storeCertificateLimit($courseware_settings['certificate_limit']); | ||
| $this->storeCertificateImageId($courseware_settings['certificate_image_id']); | ||
| } else { | ||
| $this->storeCertificate(false); | ||
| } | ||
|
|
||
| //////////////////// | ||
| // Reminder // | ||
| //////////////////// | ||
| if ($courseware_settings['reminder'] === '1') { | ||
| $this->storeReminder(true); | ||
| if(isset($courseware_settings['reminder_interval'])){ | ||
| $this->storeReminderInterval($courseware_settings['reminder_interval']); | ||
| } else { | ||
| $this->storeReminderInterval(\Mooc\YEARLY); // default jährlich | ||
| } | ||
| if(isset($courseware_settings['reminder_start_date'])){ | ||
| $this->storeReminderStartDate($courseware_settings['reminder_start_date']); | ||
| } else { | ||
| $this->storeReminderStartDate(date("d.m.Y")); | ||
| } | ||
| if(isset($courseware_settings['reminder_end_date'])){ | ||
| $this->storeReminderEndDate($courseware_settings['reminder_end_date']); | ||
| } | ||
| if(isset($courseware_settings['reminder_message'])){ | ||
| $this->storeReminderMessage($courseware_settings['reminder_message']); | ||
| } | ||
| } else { | ||
| $this->storeReminder(false); | ||
| } | ||
|
|
||
|
|
||
| /////////////////// | ||
| // Resetter // | ||
| /////////////////// | ||
| if ($courseware_settings['resetter'] === '1') { | ||
| $this->storeResetter(true); | ||
| if(isset($courseware_settings['resetter_interval'])){ | ||
| $this->storeResetterInterval($courseware_settings['resetter_interval']); | ||
| } else { | ||
| $this->storeResetterInterval(\Mooc\YEARLY); // default jährlich | ||
| } | ||
| if(isset($courseware_settings['resetter_start_date'])){ | ||
| $this->storeResetterStartDate($courseware_settings['resetter_start_date']); | ||
| } else { | ||
| $this->storeResetterStartDate(date("d.m.Y")); | ||
| } | ||
| if(isset($courseware_settings['resetter_end_date'])){ | ||
| $this->storeResetterEndDate($courseware_settings['resetter_end_date']); | ||
| } | ||
| if(isset($courseware_settings['resetter_message'])){ | ||
| $this->storeResetterMessage($courseware_settings['resetter_message']); | ||
| } | ||
| } else { | ||
| $this->storeResetter(false); | ||
| } | ||
|
|
||
| $this->courseware_block->save(); | ||
| } | ||
|
|
||
|
|
@@ -362,6 +434,75 @@ private function storeScrollytelling($active) | |
| } | ||
| } | ||
|
|
||
| private function storeCertificate($active) | ||
| { | ||
| if (!$this->courseware_block->setCertificate($active)) { | ||
| } | ||
| } | ||
|
|
||
| private function storeCertificateLimit($value) | ||
| { | ||
| if (!$this->courseware_block->setCertificateLimit($value)) { | ||
| } | ||
| } | ||
|
|
||
| private function storeCertificateImageId($value) | ||
| { | ||
| if (!$this->courseware_block->setCertificateImageId($value)) { | ||
| } | ||
| } | ||
|
|
||
| private function storeReminder($active) | ||
| { | ||
| if (!$this->courseware_block->setReminder($active)) { | ||
| } | ||
| } | ||
|
|
||
| private function storeReminderInterval($interval) | ||
| { | ||
| $this->courseware_block->setReminderInterval($interval); | ||
| } | ||
|
|
||
| private function storeReminderStartDate($date) | ||
| { | ||
| $this->courseware_block->setReminderStartDate(strtotime($date)); | ||
| } | ||
|
|
||
| private function storeReminderEndDate($date) | ||
| { | ||
| $this->courseware_block->setReminderEndDate(strtotime($date)); | ||
| } | ||
|
|
||
| private function storeReminderMessage($text) | ||
| { | ||
| $this->courseware_block->setReminderMessage(Studip\Markup::purifyHtml(trim($text))); | ||
| } | ||
|
|
||
| private function storeResetter($active) | ||
| { | ||
| $this->courseware_block->setResetter($active); | ||
| } | ||
|
|
||
| private function storeResetterInterval($interval) | ||
| { | ||
| $this->courseware_block->setResetterInterval($interval); | ||
| } | ||
|
|
||
| private function storeResetterStartDate($date) | ||
| { | ||
| $this->courseware_block->setResetterStartDate(strtotime($date)); | ||
| } | ||
|
|
||
| private function storeResetterEndDate($date) | ||
| { | ||
| $this->courseware_block->setResetterEndDate(strtotime($date)); | ||
| } | ||
|
|
||
| private function storeResetterMessage($text) | ||
| { | ||
| $this->courseware_block->setResetterMessage(Studip\Markup::purifyHtml(trim($text))); | ||
| } | ||
|
|
||
| private function storeEditingPermission($tutor_may_edit) | ||
| { | ||
| $perm = $tutor_may_edit | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eingabe prüfen, ob sie zu den Konstanten gehört.