ILIAS  trunk Revision v11.0_alpha-1749-g1a06bdef097
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilExAssignmentInfo Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Collaboration diagram for ilExAssignmentInfo:

Public Member Functions

 __construct (int $ass_id, int $user_id)
 
 getInstructionInfo ()
 
 getInstructionFileInfo (int $readable_ref_id=0)
 
 getScheduleInfo ()
 
 getSubmissionInfo ()
 

Protected Attributes

ilExcAssMemberState $state
 
ilExAssignment $ass
 
int $user_id
 
ilLanguage $lng
 
ilCtrl $ctrl
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 22 of file class.ilExAssignmentInfo.php.

Constructor & Destructor Documentation

◆ __construct()

ilExAssignmentInfo::__construct ( int  $ass_id,
int  $user_id 
)
Exceptions
ilExcUnknownAssignmentTypeException

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

References $DIC, $user_id, ILIAS\Repository\ctrl(), ilExcAssMemberState\getInstanceByIds(), and ILIAS\Repository\lng().

34  {
35  global $DIC;
36 
38  $this->lng = $DIC->language();
39  $this->ass = new ilExAssignment($ass_id);
40  $this->ctrl = $DIC->ctrl();
41  $this->user_id = $user_id;
42  }
Exercise assignment.
global $DIC
Definition: shib_login.php:22
static getInstanceByIds(int $a_ass_id, int $a_user_id=0)
+ Here is the call graph for this function:

Member Function Documentation

◆ getInstructionFileInfo()

ilExAssignmentInfo::getInstructionFileInfo ( int  $readable_ref_id = 0)

Definition at line 60 of file class.ilExAssignmentInfo.php.

References $ctrl, ilCtrl\clearParametersByClass(), ilCtrl\getLinkTargetByClass(), and ilCtrl\setParameterByClass().

60  : array
61  {
63  $ass_files = $this->ass->getFiles();
64  $items = [];
65  if (count($ass_files) > 0) {
66  foreach ($ass_files as $file) {
67  $dl_link = "";
68  if ($readable_ref_id > 0) {
69  $ctrl->setParameterByClass("ilExSubmissionGUI", "ref_id", $readable_ref_id);
70  $ctrl->setParameterByClass("ilExSubmissionGUI", "ass_id", $this->ass->getId());
71  $ctrl->setParameterByClass("ilExSubmissionGUI", "file", urlencode($file["name"]));
72  $dl_link = $ctrl->getLinkTargetByClass([
73  "ilExerciseHandlerGUI",
74  "ilObjExerciseGUI",
75  \ilAssignmentPresentationGUI::class,
76  "ilExSubmissionGUI"
77  ], "downloadFile");
78  $ctrl->clearParametersByClass("ilExSubmissionGUI");
79  }
80  $items[] = [
81  "txt" => $file["name"],
82  "value" => $dl_link
83  ];
84  }
85  }
86  return $items;
87  }
setParameterByClass(string $a_class, string $a_parameter, $a_value)
clearParametersByClass(string $a_class)
getLinkTargetByClass( $a_class, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
+ Here is the call graph for this function:

◆ getInstructionInfo()

ilExAssignmentInfo::getInstructionInfo ( )

Definition at line 44 of file class.ilExAssignmentInfo.php.

References ILIAS\Repository\lng().

44  : array
45  {
46  if ($this->state->areInstructionsVisible()) {
47  $inst = $this->ass->getInstructionPresentation();
48  if (trim($inst)) {
49  return [
50  "instruction" => [
51  "txt" => $this->lng->txt("exc_instruction"),
52  "value" => $inst
53  ]
54  ];
55  }
56  }
57  return [];
58  }
+ Here is the call graph for this function:

◆ getScheduleInfo()

ilExAssignmentInfo::getScheduleInfo ( )
Exceptions
ilDateTimeException

Definition at line 92 of file class.ilExAssignmentInfo.php.

References $lng, $state, $txt, ilExcAssMemberState\exceededOfficialDeadline(), ilExcAssMemberState\getCommonDeadline(), ilExcAssMemberState\getCommonDeadlinePresentation(), ilExcAssMemberState\getGeneralStart(), ilExcAssMemberState\getGeneralStartPresentation(), ilExcAssMemberState\getOfficialDeadline(), ilExcAssMemberState\getOfficialDeadlinePresentation(), ilExcAssMemberState\getRelativeDeadline(), ilExcAssMemberState\getRelativeDeadlinePresentation(), ilExcAssMemberState\getRemainingTimePresentation(), ilExcAssMemberState\hasSubmissionStarted(), ilExcAssMemberState\inLateSubmissionPhase(), and ilLanguage\txt().

Referenced by ILIAS\Exercise\Assignment\PropertyAndActionBuilderUI\buildSchedule().

92  : array
93  {
94  $lng = $this->lng;
95  $ret = [];
97 
98  if ($state->getGeneralStart() > 0) {
99  if ($state->getRelativeDeadline()) {
100  $txt = $lng->txt("exc_earliest_start_time");
101  } else {
102  $txt = $lng->txt("exc_start_time");
103  }
104  $ret["start_time"] = [
105  "txt" => $txt,
106  "value" => $state->getGeneralStartPresentation()
107  ];
108  }
109 
110  // extended deadline info/warning
111  $late_dl = "";
112  if ($state->inLateSubmissionPhase()) {
113  // extended deadline date should not be presented anywhere
115  $late_dl = "<br />" . sprintf($lng->txt("exc_late_submission_warning"), $late_dl);
116  $late_dl = '<span class="warning">' . $late_dl . '</span>';
117  }
118 
119  if ($state->getCommonDeadline()) { // if we have a common deadline (target timestamp)
121 
122  // add late info if no idl
123  if ($late_dl &&
125  $until .= $late_dl;
126  }
127 
128  $prop = $lng->txt("exc_edit_until");
130  $prop = $lng->txt("exc_ended_on");
131  }
132 
133  $ret["until"] = ["txt" => $prop, "value" => $until];
134  } elseif ($state->getRelativeDeadline()) { // if we only have a relative deadline (not started yet)
135  $ret["time_after_start"] = ["txt" => $lng->txt("exc_rem_time_after_start"), "value" => $state->getRelativeDeadlinePresentation()];
136  }
137 
140 
141  // add late info?
142  if ($late_dl) {
143  $until .= $late_dl;
144  }
145 
146  $ret["individual_deadline"] = ["txt" => $lng->txt("exc_individual_deadline"), "value" => $until];
147  }
148 
149  if ($state->hasSubmissionStarted()) {
150  $ret["time_to_send"] = ["txt" => $lng->txt("exc_time_to_send"), "value" => "<strong>" . $state->getRemainingTimePresentation() . "</strong>"];
151  }
152  return $ret;
153  }
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...
hasSubmissionStarted()
Check if the submission phase has started for the current user (if the assignment is generally starte...
ilExcAssMemberState $state
$txt
Definition: error.php:31
getRemainingTimePresentation()
Remaining time presentation (based on official deadline)
getOfficialDeadline()
Get official deadline (individual deadline, fixed deadline or calculated deadline (using relative dea...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSubmissionInfo()

ilExAssignmentInfo::getSubmissionInfo ( )
Exceptions
ilDateTimeException

Definition at line 158 of file class.ilExAssignmentInfo.php.

References ilDatePresentation\formatDate(), IL_CAL_DATETIME, and ILIAS\Repository\lng().

158  : array
159  {
160  // submitted files
161  $submission = new ilExSubmission($this->ass, $this->user_id);
162  $ret = [];
163  if ($submission->hasSubmitted()) {
164  // #16888
165  $submitted = $submission->getSelectedObject();
166  if ($submitted?->getTimestamp() !== "") {
167  $ret["submitted"] = [
168  "txt" => $this->lng->txt("exc_last_submission"),
169  "value" => ilDatePresentation::formatDate(new ilDateTime($submitted?->getTimestamp(), IL_CAL_DATETIME))
170  ];
171  }
172  }
173  return $ret;
174  }
const IL_CAL_DATETIME
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
Exercise submission //TODO: This class has many static methods related to delivered "files"...
+ Here is the call graph for this function:

Field Documentation

◆ $ass

ilExAssignment ilExAssignmentInfo::$ass
protected

Definition at line 25 of file class.ilExAssignmentInfo.php.

◆ $ctrl

ilCtrl ilExAssignmentInfo::$ctrl
protected

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

Referenced by getInstructionFileInfo().

◆ $lng

ilLanguage ilExAssignmentInfo::$lng
protected

Definition at line 27 of file class.ilExAssignmentInfo.php.

Referenced by getScheduleInfo().

◆ $state

ilExcAssMemberState ilExAssignmentInfo::$state
protected

Definition at line 24 of file class.ilExAssignmentInfo.php.

Referenced by getScheduleInfo().

◆ $user_id

int ilExAssignmentInfo::$user_id
protected

Definition at line 26 of file class.ilExAssignmentInfo.php.

Referenced by __construct().


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