ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilExerciseGSToolProvider Class Reference

Taxonomy GS tool provider. More...

+ Inheritance diagram for ilExerciseGSToolProvider:
+ Collaboration diagram for ilExerciseGSToolProvider:

Public Member Functions

 isInterestedInContexts ()
 @inheritDoc More...
 
 getToolsForContextStack (CalledContexts $called_contexts)
 @inheritDoc More...
 
- Public Member Functions inherited from ILIAS\GlobalScreen\Scope\Tool\Provider\AbstractDynamicToolProvider
 __construct (Container $dic)
 @inheritDoc More...
 
- Public Member Functions inherited from ILIAS\GlobalScreen\Provider\AbstractProvider
 __construct (Container $dic)
 @inheritDoc More...
 
 getFullyQualifiedClassName ()
 @inheritDoc More...
 
 getProviderNameForPresentation ()
 
 getFullyQualifiedClassName ()
 
 getProviderNameForPresentation ()
 
 getToolsForContextStack (CalledContexts $called_contexts)
 
 isInterestedInContexts ()
 

Data Fields

const SHOW_EXC_ASSIGNMENT_INFO = 'show_exc_assignment_info'
 
const EXC_ASS_IDS = 'exc_ass_ids'
 
const EXC_ASS_BUTTONS = "exc_ass_buttons"
 

Protected Member Functions

 addSection (ilTemplate $tpl, string $title, string $content)
 Add section. More...
 
- Protected Member Functions inherited from ILIAS\GlobalScreen\Provider\AbstractProvider
 globalScreen ()
 

Private Member Functions

 getAssignmentInfo ($ass_ids, $buttons)
 

Additional Inherited Members

- Protected Attributes inherited from ILIAS\GlobalScreen\Scope\Tool\Provider\AbstractDynamicToolProvider
 $identification_provider
 
 $context_collection
 
 $factory
 
- Protected Attributes inherited from ILIAS\GlobalScreen\Provider\AbstractProvider
 $dic
 

Detailed Description

Taxonomy GS tool provider.

Author
Alex Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..com

Definition at line 12 of file class.ilExerciseGSToolProvider.php.

Member Function Documentation

◆ addSection()

ilExerciseGSToolProvider::addSection ( ilTemplate  $tpl,
string  $title,
string  $content 
)
protected

Add section.

Parameters
ilTemplate$tpl
string$title
string$content

Definition at line 151 of file class.ilExerciseGSToolProvider.php.

152 {
153 $tpl->setCurrentBlock("section");
154 $tpl->setVariable("TITLE", $title);
155 $tpl->setVariable("CONTENT", $content);
156 $tpl->parseCurrentBlock();
157 }
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl

References $tpl.

Referenced by getAssignmentInfo().

+ Here is the caller graph for this function:

◆ getAssignmentInfo()

ilExerciseGSToolProvider::getAssignmentInfo (   $ass_ids,
  $buttons 
)
private
Parameters
$ass_id
Returns
string

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

67 : string
68 {
69 global $DIC;
70
71 $lng = $DIC->language();
72 $user = $DIC->user();
73 $ui = $DIC->ui();
74 $access = $DIC->access();
75
76
77 foreach ($ass_ids as $ass_id) {
78 $info = new ilExAssignmentInfo($ass_id, $user->getId());
79 $exc_id = ilExAssignment::lookupExerciseId($ass_id);
80 foreach (ilObject::_getAllReferences($exc_id) as $ref_id) {
81 if ($access->checkAccess("read", "", $ref_id)) {
82 $readable_ref_id = $ref_id;
83 }
84 }
85
86 $tpl = new ilTemplate("tpl.ass_info_tool.html", true, true, "Modules/Exercise");
87 $assignment = new ilExAssignment($ass_id);
88
89 $title = ilObject::_lookupTitle($exc_id) . ": " . $assignment->getTitle();
90 if ($readable_ref_id > 0) {
91 $title = $ui->renderer()->render(
92 $ui->factory()->link()->standard($title, ilLink::_getLink($readable_ref_id))
93 );
94 }
95
96 $this->addSection($tpl, $lng->txt("exc_assignment"), $title);
97
98 // schedule info
99 $schedule = $info->getScheduleInfo();
100 $list = $ui->factory()->listing()->unordered(array_map(function ($i) {
101 return $i["txt"] . ": " . $i["value"];
102 }, $schedule));
103 $this->addSection($tpl, $lng->txt("exc_schedule"), $ui->renderer()->render($list));
104
105 // latest submission
106 $subm = $info->getSubmissionInfo();
107 if (isset($subm["submitted"])) {
108 $this->addSection($tpl, $subm["submitted"]["txt"], $subm["submitted"]["value"]);
109 }
110
111 // instruction
112 $inst = $info->getInstructionInfo();
113 if (count($inst)) {
114 $this->addSection($tpl, $inst["instruction"]["txt"], $inst["instruction"]["value"]);
115 }
116
117 // instruction files
118 $files = $info->getInstructionFileInfo($readable_ref_id);
119 if (is_array($files)) {
120 $list = $ui->factory()->listing()->unordered(array_map(function ($i) use ($ui) {
121 $v = $i["txt"];
122 if ($i["value"] != "") {
123 $v = $ui->renderer()->render($ui->factory()->button()->shy($v, $i["value"]));
124 }
125 return $v;
126 }, $files));
127 $this->addSection($tpl, $lng->txt("exc_instruction_files"), $ui->renderer()->render($list));
128 }
129
130 // buttons
131 if (is_array($buttons[$ass_id])) {
132 $tpl->setVariable("BUTTONS", implode(" ", array_map(function ($b) use ($ui) {
133 return $ui->renderer()->render($b);
134 }, $buttons[$ass_id])));
135 }
136
137 $tpl->setCurrentBlock("ass_info");
138 $tpl->parseCurrentBlock();
139 }
140
141 return $tpl->get();
142 }
Exercise assignment.
static lookupExerciseId($a_ass_id)
Lookup excercise id for assignment id.
addSection(ilTemplate $tpl, string $title, string $content)
Add section.
static _lookupTitle($a_id)
lookup object title
static _getAllReferences($a_id)
get all reference ids of object
special template class to simplify handling of ITX/PEAR
$i
Definition: metadata.php:24
$lng
$DIC
Definition: xapitoken.php:46

References Vendor\Package\$b, $DIC, $i, $lng, $tpl, ilObject\_getAllReferences(), ilLink\_getLink(), ilObject\_lookupTitle(), addSection(), and ilExAssignment\lookupExerciseId().

Referenced by getToolsForContextStack().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getToolsForContextStack()

ilExerciseGSToolProvider::getToolsForContextStack ( CalledContexts  $called_contexts)

@inheritDoc

Implements ILIAS\GlobalScreen\Scope\Tool\Provider\DynamicToolProvider.

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

30 : array
31 {
32 global $DIC;
33
34 $lng = $DIC->language();
35 $lng->loadLanguageModule("exc");
36
37 $title = $lng->txt("exc_assignment");
38 $icon = $this->dic->ui()->factory()->symbol()->icon()->standard("exc", $title)->withIsOutlined(true);
39
40 $tools = [];
41 $additional_data = $called_contexts->current()->getAdditionalData();
42 if ($additional_data->is(self::SHOW_EXC_ASSIGNMENT_INFO, true)) {
43 $iff = function ($id) {
44 return $this->identification_provider->contextAwareIdentifier($id);
45 };
46 $l = function (string $content) {
47 return $this->dic->ui()->factory()->legacy($content);
48 };
49 $tools[] = $this->factory->tool($iff("exc_ass_info"))
50 ->withTitle($title)
51 ->withSymbol($icon)
52 ->withContentWrapper(function () use ($l, $additional_data) {
53 return $l($this->getAssignmentInfo(
54 $additional_data->get(self::EXC_ASS_IDS),
55 $additional_data->get(self::EXC_ASS_BUTTONS)
56 ));
57 });
58 }
59
60 return $tools;
61 }

References $DIC, $lng, ILIAS\GlobalScreen\ScreenContext\Stack\CalledContexts\current(), and getAssignmentInfo().

+ Here is the call graph for this function:

◆ isInterestedInContexts()

ilExerciseGSToolProvider::isInterestedInContexts ( )

Field Documentation

◆ EXC_ASS_BUTTONS

const ilExerciseGSToolProvider::EXC_ASS_BUTTONS = "exc_ass_buttons"

◆ EXC_ASS_IDS

◆ SHOW_EXC_ASSIGNMENT_INFO

const ilExerciseGSToolProvider::SHOW_EXC_ASSIGNMENT_INFO = 'show_exc_assignment_info'

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