ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilBlogExerciseGUI Class Reference

@ilCtrl_Calls ilBlogExerciseGUI: More...

+ Collaboration diagram for ilBlogExerciseGUI:

Public Member Functions

 __construct (int $a_node_id, \ILIAS\Blog\Exercise\BlogExercise $blog_exercise, ilLanguage $lng, ilObjUser $user, \ILIAS\Blog\InternalGUIService $gui)
 
 executeCommand ()
 
 getSubmitButton (int $ass_id)
 Get submit link. More...
 
 getDownloadSubmissionButton (int $ass_id)
 
 getActionButtons ()
 

Protected Member Functions

 downloadExcAssFile ()
 
 finalize ()
 

Protected Attributes

SubmissionManager $submission
 
ILIAS Blog Exercise BlogExercise $blog_exercise
 
StandardGUIRequest $blog_request
 
ilCtrl $ctrl
 
ilObjUser $user
 
ilLanguage $lng
 
int $node_id
 
int $ass_id
 
string $file
 
ILIAS DI UIServices $ui
 

Private Attributes

ilGlobalTemplateInterface $main_tpl
 

Detailed Description

@ilCtrl_Calls ilBlogExerciseGUI:

Definition at line 28 of file class.ilBlogExerciseGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilBlogExerciseGUI::__construct ( int  $a_node_id,
\ILIAS\Blog\Exercise\BlogExercise  $blog_exercise,
ilLanguage  $lng,
ilObjUser  $user,
\ILIAS\Blog\InternalGUIService  $gui 
)

Definition at line 42 of file class.ilBlogExerciseGUI.php.

48 {
49 global $DIC;
50
51 $this->main_tpl = $gui->ui()->mainTemplate();
52 $this->ctrl = $gui->ctrl();
53 $this->user = $user;
54 $this->lng = $lng;
55 $this->node_id = $a_node_id;
56 $this->blog_request = $gui->standardRequest();
57
58 $this->ass_id = $this->blog_request->getAssId();
59 $this->file = $this->blog_request->getAssFile();
60 $this->ui = $gui->ui();
61 $this->blog_exercise = $blog_exercise;
62 $this->submission = $DIC->exercise()->internal()->domain()->submission(
63 $this->ass_id
64 );
65 }
ILIAS Blog Exercise BlogExercise $blog_exercise
global $DIC
Definition: shib_login.php:26

References $blog_exercise, $DIC, $lng, $user, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ILIAS\Repository\ui(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

Member Function Documentation

◆ downloadExcAssFile()

ilBlogExerciseGUI::downloadExcAssFile ( )
protected

Definition at line 85 of file class.ilBlogExerciseGUI.php.

85 : void
86 {
87 if ($this->file) {
88 $ass = new ilExAssignment($this->ass_id);
89 $ass_files = $ass->getFiles();
90 if (count($ass_files) > 0) {
91 foreach ($ass_files as $file) {
92 if ($file["name"] == $this->file) {
93 ilFileDelivery::deliverFileLegacy($file["fullpath"], $file["name"]);
94 }
95 }
96 }
97 }
98 }
Exercise assignment.
static deliverFileLegacy(string $a_file, ?string $a_filename=null, ?string $a_mime=null, ?bool $isInline=false, ?bool $removeAfterDelivery=false, ?bool $a_exit_after=true)

References $file, and ilFileDelivery\deliverFileLegacy().

+ Here is the call graph for this function:

◆ executeCommand()

ilBlogExerciseGUI::executeCommand ( )

Definition at line 67 of file class.ilBlogExerciseGUI.php.

67 : void
68 {
69 $ilCtrl = $this->ctrl;
70
71 if (!$this->ass_id) {
72 $this->ctrl->returnToParent($this);
73 }
74
75 $next_class = $ilCtrl->getNextClass($this);
76 $cmd = $ilCtrl->getCmd();
77
78 switch ($next_class) {
79 default:
80 $this->$cmd();
81 break;
82 }
83 }

References $ctrl, and ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ finalize()

ilBlogExerciseGUI::finalize ( )
protected

Definition at line 122 of file class.ilBlogExerciseGUI.php.

122 : void
123 {
124 $ilCtrl = $this->ctrl;
126
127 $exc_gui = ilExSubmissionObjectGUI::initGUIForSubmit($this->ass_id);
128 $exc_gui->submitBlog($this->node_id);
129
130 $this->main_tpl->setOnScreenMessage('success', $lng->txt("blog_finalized"), true);
131 $ilCtrl->returnToParent($this);
132 }
static initGUIForSubmit(int $a_ass_id, ?int $a_user_id=null)
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...

References $ctrl, $lng, ilExSubmissionObjectGUI\initGUIForSubmit(), and ilLanguage\txt().

+ Here is the call graph for this function:

◆ getActionButtons()

ilBlogExerciseGUI::getActionButtons ( )

Definition at line 183 of file class.ilBlogExerciseGUI.php.

183 : array
184 {
186
187 $buttons = [];
188 foreach ($be->getAssignmentsOfBlog() as $exercise) {
189 $ass_id = $exercise["ass_id"];
190 $buttons[$ass_id] = [];
191 $submit_button = $this->getSubmitButton($ass_id);
192 if ($submit_button) {
193 $buttons[$ass_id][] = $submit_button;
194 }
195 $download_button = $this->getDownloadSubmissionButton($ass_id);
196 if ($download_button) {
197 $buttons[$ass_id][] = $download_button;
198 }
199 }
200
201 return $buttons;
202 }
getDownloadSubmissionButton(int $ass_id)
getSubmitButton(int $ass_id)
Get submit link.

References $ass_id, and $exercise.

◆ getDownloadSubmissionButton()

ilBlogExerciseGUI::getDownloadSubmissionButton ( int  $ass_id)
Exceptions
ilCtrlException
ilExcUnknownAssignmentTypeException

Definition at line 160 of file class.ilBlogExerciseGUI.php.

163 $ilCtrl = $this->ctrl;
165 $ui = $this->ui;
166
167 // submitted files
168 $submission = new ilExSubmission(new ilExAssignment($ass_id), $this->user->getId());
169 if ($submission->hasSubmitted()) {
170 // #16888
171 $submitted = $submission->getSelectedObject();
172 if ($submitted?->getTimestamp() !== "") {
173 $ilCtrl->setParameterByClass("ilblogexercisegui", "ass", $ass_id);
174 $dl_link = $ilCtrl->getLinkTargetByClass("ilblogexercisegui", "downloadExcSubFile");
175 $ilCtrl->setParameterByClass("ilblogexercisegui", "ass", "");
176 return $ui->factory()->button()->standard($lng->txt("blog_download_submission"), $dl_link);
177 }
178 }
179 return null;
180 }
SubmissionManager $submission
ILIAS DI UIServices $ui
Exercise submission //TODO: This class has many static methods related to delivered "files".
This describes a standard button.
Definition: Standard.php:27

◆ getSubmitButton()

ilBlogExerciseGUI::getSubmitButton ( int  $ass_id)

Get submit link.

Exceptions
ilCtrlException

Definition at line 138 of file class.ilBlogExerciseGUI.php.

141 $ilCtrl = $this->ctrl;
142 $ui = $this->ui;
144
145 $state = ilExcAssMemberState::getInstanceByIds($ass_id, $this->user->getId());
146
147 if ($state->isSubmissionAllowed()) {
148 $ilCtrl->setParameterByClass("ilblogexercisegui", "ass", $ass_id);
149 $submit_link = $ilCtrl->getLinkTargetByClass("ilblogexercisegui", "finalize");
150 $ilCtrl->setParameterByClass("ilblogexercisegui", "ass", "");
151 return $ui->factory()->button()->primary($lng->txt("blog_finalize_blog"), $submit_link);
152 }
153 return null;
154 }
static getInstanceByIds(int $a_ass_id, int $a_user_id=0)
This describes a standard button.
Definition: Primary.php:27

Field Documentation

◆ $ass_id

int ilBlogExerciseGUI::$ass_id
protected

Definition at line 37 of file class.ilBlogExerciseGUI.php.

◆ $blog_exercise

ILIAS Blog Exercise BlogExercise ilBlogExerciseGUI::$blog_exercise
protected

Definition at line 31 of file class.ilBlogExerciseGUI.php.

Referenced by __construct().

◆ $blog_request

StandardGUIRequest ilBlogExerciseGUI::$blog_request
protected

Definition at line 32 of file class.ilBlogExerciseGUI.php.

◆ $ctrl

ilCtrl ilBlogExerciseGUI::$ctrl
protected

Definition at line 33 of file class.ilBlogExerciseGUI.php.

Referenced by executeCommand(), and finalize().

◆ $file

string ilBlogExerciseGUI::$file
protected

Definition at line 38 of file class.ilBlogExerciseGUI.php.

Referenced by downloadExcAssFile().

◆ $lng

ilLanguage ilBlogExerciseGUI::$lng
protected

Definition at line 35 of file class.ilBlogExerciseGUI.php.

Referenced by __construct(), and finalize().

◆ $main_tpl

ilGlobalTemplateInterface ilBlogExerciseGUI::$main_tpl
private

Definition at line 40 of file class.ilBlogExerciseGUI.php.

◆ $node_id

int ilBlogExerciseGUI::$node_id
protected

Definition at line 36 of file class.ilBlogExerciseGUI.php.

◆ $submission

SubmissionManager ilBlogExerciseGUI::$submission
protected

Definition at line 30 of file class.ilBlogExerciseGUI.php.

◆ $ui

ILIAS DI UIServices ilBlogExerciseGUI::$ui
protected

Definition at line 39 of file class.ilBlogExerciseGUI.php.

◆ $user

ilObjUser ilBlogExerciseGUI::$user
protected

Definition at line 34 of file class.ilBlogExerciseGUI.php.

Referenced by __construct().


The documentation for this class was generated from the following file: