ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
ilExAssignmentInfo Class Reference
+ Collaboration diagram for ilExAssignmentInfo:

Public Member Functions

 __construct (int $ass_id, int $user_id)
 Constructor. More...
 
 getInstructionInfo ()
 Get instruction info. More...
 
 getInstructionFileInfo ($readable_ref_id=0)
 Get instruction file info. More...
 
 getScheduleInfo ()
 
 getSubmissionInfo ()
 Get submission info. More...
 

Protected Attributes

 $state
 
 $ass
 
 $user_id
 

Detailed Description

Author
.de

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

Constructor & Destructor Documentation

◆ __construct()

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

Constructor.

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

References $DIC, $user_id, and ilExcAssMemberState\getInstanceByIds().

32  {
33  global $DIC;
34 
35  $this->state = ilExcAssMemberState::getInstanceByIds($ass_id, $user_id);
36  $this->lng = $DIC->language();
37  $this->ass = new ilExAssignment($ass_id);
38  $this->ctrl = $DIC->ctrl();
39  $this->user_id = $user_id;
40  }
Exercise assignment.
static getInstanceByIds($a_ass_id, $a_user_id=0)
Get instance by IDs (recommended for consumer code)
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:

Member Function Documentation

◆ getInstructionFileInfo()

ilExAssignmentInfo::getInstructionFileInfo (   $readable_ref_id = 0)

Get instruction file info.

Parameters

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

70  {
71  $ctrl = $this->ctrl;
72  $ass_files = $this->ass->getFiles();
73  if (count($ass_files) > 0) {
74  $items = [];
75 
76  foreach ($ass_files as $file) {
77  $dl_link = "";
78  if ($readable_ref_id > 0) {
79  $ctrl->setParameterByClass("ilExSubmissionGUI", "ref_id", $readable_ref_id);
80  $ctrl->setParameterByClass("ilExSubmissionGUI", "ass_id", $this->ass->getId());
81  $ctrl->setParameterByClass("ilExSubmissionGUI", "file", urlencode($file["name"]));
82  $dl_link = $ctrl->getLinkTargetByClass([
83  "ilExerciseHandlerGUI",
84  "ilObjExerciseGUI",
85  "ilExSubmissionGUI"
86  ], "downloadFile");
87  $ctrl->clearParametersByClass("ilExSubmissionGUI");
88  }
89  $items[] = [
90  "txt" => $file["name"],
91  "value" => $dl_link
92  ];
93  }
94  }
95  return $items;
96  }

◆ getInstructionInfo()

ilExAssignmentInfo::getInstructionInfo ( )

Get instruction info.

Returns
array

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

Referenced by ilExAssignmentGUI\addInstructions().

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

◆ getScheduleInfo()

ilExAssignmentInfo::getScheduleInfo ( )
Parameters

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

References $lng, $ret, $state, and $txt.

Referenced by ilExAssignmentGUI\addSchedule().

106  {
107  $lng = $this->lng;
108  $ret = [];
110 
111  if ($state->getGeneralStart() > 0) {
112  if ($state->getRelativeDeadline()) {
113  $txt = $lng->txt("exc_earliest_start_time");
114  } else {
115  $txt = $lng->txt("exc_start_time");
116  }
117  $ret["start_time"] = [
118  "txt" => $txt,
119  "value" => $state->getGeneralStartPresentation()
120  ];
121  }
122 
123  // extended deadline info/warning
124  $late_dl = "";
125  if ($state->inLateSubmissionPhase()) {
126  // extended deadline date should not be presented anywhere
127  $late_dl = $state->getOfficialDeadlinePresentation();
128  $late_dl = "<br />" . sprintf($lng->txt("exc_late_submission_warning"), $late_dl);
129  $late_dl = '<span class="warning">' . $late_dl . '</span>';
130  }
131 
132  if ($state->getCommonDeadline()) { // if we have a common deadline (target timestamp)
133  $until = $state->getCommonDeadlinePresentation();
134 
135  // add late info if no idl
136  if ($late_dl &&
137  $state->getOfficialDeadline() == $state->getCommonDeadline()) {
138  $until .= $late_dl;
139  }
140 
141  $prop = $lng->txt("exc_edit_until");
142  if ($state->exceededOfficialDeadline()) {
143  $prop = $lng->txt("exc_ended_on");
144  }
145 
146  $ret["until"] = ["txt" => $prop, "value" => $until];
147  } elseif ($state->getRelativeDeadline()) { // if we only have a relative deadline (not started yet)
148  $ret["time_after_start"] = ["txt" => $lng->txt("exc_rem_time_after_start"), "value" => $state->getRelativeDeadlinePresentation()];
149  }
150 
151  if ($state->getOfficialDeadline() > $state->getCommonDeadline()) {
152  $until = $state->getOfficialDeadlinePresentation();
153 
154  // add late info?
155  if ($late_dl) {
156  $until .= $late_dl;
157  }
158 
159  $ret["individual_deadline"] = ["txt" => $lng->txt("exc_individual_deadline"), "value" => $until];
160  }
161 
162  if ($state->hasSubmissionStarted()) {
163  $ret["time_to_send"] = ["txt" => $lng->txt("exc_time_to_send"), "value" => "<b>" . $state->getRemainingTimePresentation() . "</b>"];
164  }
165  return $ret;
166  }
$lng
$txt
Definition: error.php:13
$ret
Definition: parser.php:6
+ Here is the caller graph for this function:

◆ getSubmissionInfo()

ilExAssignmentInfo::getSubmissionInfo ( )

Get submission info.

Returns
array

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

References $ret, ilDatePresentation\formatDate(), and IL_CAL_DATETIME.

174  {
175  // submitted files
176  $submission = new ilExSubmission($this->ass, $this->user_id);
177  $ret = [];
178  if ($submission->hasSubmitted()) {
179  // #16888
180  $submitted = $submission->getSelectedObject();
181  if ($submitted["ts"] != "") {
182  $ret["submitted"] = [
183  "txt" => $this->lng->txt("exc_last_submission"),
184  "value" => ilDatePresentation::formatDate(new ilDateTime($submitted["ts"], IL_CAL_DATETIME))
185  ];
186  }
187  }
188  return $ret;
189  }
const IL_CAL_DATETIME
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
$ret
Definition: parser.php:6
Exercise submission //TODO: This class has to much static methods related to delivered "files"...
+ Here is the call graph for this function:

Field Documentation

◆ $ass

ilExAssignmentInfo::$ass
protected

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

◆ $state

ilExAssignmentInfo::$state
protected

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

Referenced by getScheduleInfo().

◆ $user_id

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: