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

Taxonomy GS tool provider. More...

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

Public Member Functions

 isInterestedInContexts ()
 
 getToolsForContextStack (CalledContexts $called_contexts)
 
- 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 (protected Container $dic)
 
 getFullyQualifiedClassName ()
 
 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)
 
- Protected Member Functions inherited from ILIAS\GlobalScreen\Provider\AbstractProvider
 globalScreen ()
 

Private Member Functions

 getAssignmentInfo (array $ass_ids, array $buttons)
 

Additional Inherited Members

- Protected Attributes inherited from ILIAS\GlobalScreen\Scope\Tool\Provider\AbstractDynamicToolProvider
ToolIdentificationProviderInterface $identification_provider
 
ContextCollection $context_collection
 
ToolFactory $factory
 

Detailed Description

Taxonomy GS tool provider.

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

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

Member Function Documentation

◆ addSection()

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

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

176 : void {
177 $tpl->setCurrentBlock("section");
178 $tpl->setVariable("TITLE", $title);
179 $tpl->setVariable("CONTENT", $content);
180 $tpl->parseCurrentBlock();
181 }
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:544
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)

◆ getAssignmentInfo()

ilExerciseGSToolProvider::getAssignmentInfo ( array  $ass_ids,
array  $buttons 
)
private
Parameters
int[]$ass_ids
Button[][]$buttons
Returns
string
Exceptions
ilDateTimeException
ilExcUnknownAssignmentTypeException

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

93 : string {
94 global $DIC;
95
96 $lng = $DIC->language();
97 $user = $DIC->user();
98 $ui = $DIC->ui();
99 $access = $DIC->access();
100 $link_service = $DIC->exercise()->internal()->gui()->permanentLink();
101
102 $html = "";
103
104 foreach ($ass_ids as $ass_id) {
105 $info = new ilExAssignmentInfo($ass_id, $user->getId());
107 $readable_ref_id = 0;
108 foreach (ilObject::_getAllReferences($exc_id) as $ref_id) {
109 if ($access->checkAccess("read", "", $ref_id)) {
110 $readable_ref_id = $ref_id;
111 }
112 }
113
114 $tpl = new ilTemplate("tpl.ass_info_tool.html", true, true, "components/ILIAS/Exercise");
115 $assignment = new ilExAssignment($ass_id);
116
117 $title = ilObject::_lookupTitle($exc_id) . ": " . $assignment->getTitle();
118 if ($readable_ref_id > 0) {
119 $title = $ui->renderer()->render(
120 $ui->factory()->link()->standard($title, $link_service->getPermanentLink($readable_ref_id, $ass_id))
121 );
122 }
123
124 $this->addSection($tpl, $lng->txt("exc_assignment"), $title);
125
126 // schedule info
127 $schedule = $info->getScheduleInfo();
128 $list = $ui->factory()->listing()->unordered(array_map(function ($i) {
129 return $i["txt"] . ": " . $i["value"];
130 }, $schedule));
131 $this->addSection($tpl, $lng->txt("exc_schedule"), $ui->renderer()->render($list));
132
133 // latest submission
134 $subm = $info->getSubmissionInfo();
135 if (isset($subm["submitted"])) {
136 $this->addSection($tpl, $subm["submitted"]["txt"], $subm["submitted"]["value"]);
137 }
138
139 // instruction
140 $inst = $info->getInstructionInfo();
141 if (count($inst)) {
142 $this->addSection($tpl, $inst["instruction"]["txt"], $inst["instruction"]["value"]);
143 }
144
145 // instruction files
146 $files = $info->getInstructionFileInfo($readable_ref_id);
147 if (is_array($files)) {
148 $list = $ui->factory()->listing()->unordered(array_map(function ($i) use ($ui) {
149 $v = $i["txt"];
150 if ($i["value"] != "") {
151 $v = $ui->renderer()->render($ui->factory()->button()->shy($v, $i["value"]));
152 }
153 return $v;
154 }, $files));
155 $this->addSection($tpl, $lng->txt("exc_instruction_files"), $ui->renderer()->render($list));
156 }
157
158 // buttons
159 if (isset($buttons[$ass_id])) {
160 $tpl->setVariable("BUTTONS", implode(" ", array_map(function ($b) use ($ui) {
161 return $ui->renderer()->render($b);
162 }, $buttons[$ass_id])));
163 }
164
165 $tpl->setCurrentBlock("ass_info");
166 $tpl->parseCurrentBlock();
167 $html .= $tpl->get();
168 }
169 return $html;
170 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Exercise assignment.
static lookupExerciseId(int $a_ass_id)
addSection(ilTemplate $tpl, string $title, string $content)
static _getAllReferences(int $id)
get all reference ids for object ID
static _lookupTitle(int $obj_id)
special template class to simplify handling of ITX/PEAR
$info
Definition: entry_point.php:21
$ref_id
Definition: ltiauth.php:66
global $lng
Definition: privfeed.php:31
global $DIC
Definition: shib_login.php:26

References $ass_id, Vendor\Package\$b, $info, $lng, $ref_id, ilObject\_getAllReferences(), ilObject\_lookupTitle(), 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)
Parameters
CalledContexts$called_contexts
Returns
Tool[] These Slates can be passed to the MainMenu dynamic for a specific location/context.
See also
DynamicProvider
Exceptions
ilExcUnknownAssignmentTypeException
ilDateTimeException

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

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

42 : array {
43 global $DIC;
44
45 $lng = $DIC->language();
46 $lng->loadLanguageModule("exc");
47
48 $title = $lng->txt("exc_assignment");
49 $icon = $this->dic->ui()->factory()->symbol()->icon()->standard("exc", $title);
50
51 $tools = [];
52 $additional_data = $called_contexts->current()->getAdditionalData();
53 if ($additional_data->is(self::SHOW_EXC_ASSIGNMENT_INFO, true)) {
54 $iff = function ($id) {
55 return $this->identification_provider->contextAwareIdentifier($id);
56 };
57 $l = function (string $content) {
58 return $this->dic->ui()->factory()->legacy()->content($content);
59 };
60 $tools[] = $this->factory->tool($iff("exc_ass_info"))
61 ->withTitle($title)
62 ->withSymbol($icon)
63 ->withContentWrapper(
68 function () use ($l, $additional_data) {
69 $buttons = $additional_data->exists(self::EXC_ASS_BUTTONS)
70 ? $additional_data->get(self::EXC_ASS_BUTTONS)
71 : [];
72 return $l($this->getAssignmentInfo(
73 $additional_data->get(self::EXC_ASS_IDS),
74 $buttons
75 ));
76 }
77 );
78 }
79
80 return $tools;
81 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
factory()
getAssignmentInfo(array $ass_ids, array $buttons)

References $id, factory(), getAssignmentInfo(), and ILIAS\GlobalScreen\Scope\Footer\Factory\withTitle().

+ 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: