43 $service = $DIC->container()->internal();
48 $this->
lng = $domain->lng();
49 $this->obj_definition = $domain->objectDefinition();
50 $this->tree = $domain->repositoryTree();
51 $this->
access = $domain->access();
53 $this->
ctrl = $gui->ctrl();
61 $this->
lng->loadLanguageModule(
"classification");
62 $this->
setTitle($this->
lng->txt(
"clsfct_block_title"));
64 $this->cl_request = $gui->classification()->standardRequest();
66 $this->classification = $domain->classification($this->parent_ref_id);
84 $next_class = $ilCtrl->getNextClass($this);
86 switch ($next_class) {
89 if ($ilCtrl->isAsynch() && $cmd !=
"getAjax" && $cmd !=
"filterContainer") {
102 $ilCtrl = $DIC->ctrl();
104 if ($ilCtrl->isAsynch()) {
108 switch ($ilCtrl->getCmd()) {
109 case "filterContainer":
120 if (!$ilCtrl->isAsynch()) {
130 $tpl->addJavaScript(
"Services/Container/Classification/js/ilClassification.js");
132 return parent::getHTML();
142 echo
$tpl->getOnLoadCodeForAsynch();
154 foreach ($this->providers as
$provider) {
155 $provider->render($html, $this);
160 $ajax_block_id =
"block_" . $this->
getBlockType() .
"_0";
161 $ajax_block_url = $ilCtrl->getLinkTarget($this,
"getAjax",
"",
true,
false);
162 $ajax_content_id =
"il_center_col";
163 $ajax_content_url = $ilCtrl->getLinkTarget($this,
"filterContainer",
"",
true,
false);
166 $tabs->setBackTarget($this->
lng->txt(
"clsfct_back_to_cat"), $ilCtrl->getLinkTarget($this,
"returnToParent"));
167 $tabs->addTab(
"sel_objects", $this->
lng->txt(
"clsfct_selected_objects"),
"#");
168 $tabs_html = $tabs->getHTML();
172 $tpl->addOnLoadCode(
'il.Classification.setAjax("' . $ajax_block_id .
'", "' .
173 $ajax_block_url .
'", "' . $ajax_content_id .
'", "' . $ajax_content_url .
'", ' . json_encode($tabs_html) .
');');
177 $btpl =
new ilTemplate(
"tpl.classification_block.html",
true,
true,
"Services/Container/Classification");
179 foreach ($html as $item) {
180 $btpl->setCurrentBlock(
"provider_chunk_bl");
181 $btpl->setVariable(
"TITLE", $item[
"title"]);
182 $btpl->setVariable(
"CHUNK", $item[
"html"]);
183 $btpl->parseCurrentBlock();
186 $overall_html .= $btpl->get();
189 return $overall_html;
194 $this->classification->clearSelection();
195 $this->
ctrl->returnToParent($this);
214 if ($this->classification->isEmptySelection()) {
218 $all_matching_provider_object_ids = null;
220 foreach ($this->providers as
$provider) {
221 $id = get_class($provider);
222 $current = $this->classification->getSelectionOfProvider(
$id);
224 $no_provider =
false;
226 $provider_object_ids = $provider->getFilteredObjects();
227 if (isset($all_matching_provider_object_ids)) {
228 $all_matching_provider_object_ids = array_intersect($all_matching_provider_object_ids, $provider_object_ids);
230 $all_matching_provider_object_ids = $provider_object_ids;
234 $has_content =
false;
237 $ltpl =
new ilTemplate(
"tpl.classification_object_list.html",
true,
true,
"Services/Container/Classification");
239 if (isset($all_matching_provider_object_ids) &&
sizeof($all_matching_provider_object_ids)) {
241 "object_reference.ref_id" 242 ,
"object_data.obj_id" 245 ,
"object_data.description" 250 $this->parent_ref_id,
251 $all_matching_provider_object_ids,
255 if (
sizeof($matching)) {
256 $valid_objects = array();
260 foreach ($matching as $item) {
261 if ($item[
"ref_id"] != $this->parent_ref_id &&
263 $ilAccess->checkAccess(
"visible",
"", $item[
"ref_id"])) {
268 foreach ($tree->
getPathFull($item[
"ref_id"]) as $p) {
269 if (in_array($p[
"type"], array(
"root",
"cat",
"crs",
"grp"))) {
270 $block_ref_id = $p[
"ref_id"];
271 $block_title = $p[
"title"];
274 if ($block_ref_id > 0) {
275 if (!isset($valid_objects[$block_ref_id])) {
276 $valid_objects[$block_ref_id] = array(
277 "title" => $block_title,
281 $valid_objects[$block_ref_id][
"items"][] = $item;
284 $preloader->addItem($item[
"obj_id"], $item[
"type"], $item[
"ref_id"]);
288 if (
sizeof($valid_objects)) {
291 $preloader->preload();
293 $this->item_list_gui = array();
294 foreach ($valid_objects as $block) {
296 foreach ($items as $obj) {
297 $type = $obj[
"type"];
300 if (empty($this->item_list_gui[$type])) {
301 $class = $objDefinition->getClassName($type);
302 $location = $objDefinition->getLocation($type);
304 $full_class =
"ilObj" . $class .
"ListGUI";
306 $this->item_list_gui[$type] =
new $full_class();
307 $this->item_list_gui[$type]->enableDelete(
false);
308 $this->item_list_gui[$type]->enablePath(
310 $this->parent_ref_id,
313 $this->item_list_gui[$type]->enableLinkedPath(
true);
314 $this->item_list_gui[$type]->enableCut(
false);
315 $this->item_list_gui[$type]->enableCopy(
false);
316 $this->item_list_gui[$type]->enableSubscribe(
false);
317 $this->item_list_gui[$type]->enableLink(
false);
318 $this->item_list_gui[$type]->enableIcon(
true);
321 foreach ($this->providers as $provider) {
322 $provider->initListGUI($this->item_list_gui[$type]);
326 $html = $this->item_list_gui[$type]->getListItemHTML(
334 $ltpl->setCurrentBlock(
"res_row");
335 $ltpl->setVariable(
"RESOURCE_HTML", $html);
336 $ltpl->parseCurrentBlock();
339 $ltpl->setCurrentBlock(
"block");
340 $ltpl->setVariable(
"BLOCK_TITLE", $block[
"title"]);
341 $ltpl->parseCurrentBlock();
349 echo
"<span id='block_" . $this->
getBlockType() .
"_0_loader'></span>";
350 echo
"<script>il.Classification.returnToParent();</script>";
366 if (!isset(self::$providers_cache[$this->parent_ref_id])) {
368 $this->parent_ref_id,
369 $this->parent_obj_id,
370 $this->parent_obj_type
374 if ($a_check_post && !$this->cl_request->getRedraw()) {
375 foreach ($this->providers as
$provider) {
376 $id = get_class($provider);
377 $current = $provider->importPostData(
378 $this->classification->getSelectionOfProvider(
$id)
380 if (is_array($current) || $current) {
381 $this->classification->setSelectionOfProvider(
$id, $current);
386 foreach ($this->providers as
$provider) {
387 $id = get_class($provider);
388 $current = $this->classification->getSelectionOfProvider(
$id);
390 $provider->setSelection($current);
398 $this->
ctrl->returnToParent($this);
410 $matching = array_filter($tree->
getChilds($this->parent_ref_id),
function ($item) use ($obj_ids) {
411 return in_array($item[
"obj_id"], $obj_ids);
415 "object_reference.ref_id" 416 ,
"object_data.obj_id" 419 ,
"object_data.description" getSubItemIds(array $obj_ids)
Get sub item ids depending on container type that match the preselected object ids.
ILIAS Container Classification ClassificationManager $classification
static getSystemMessageHTML(string $a_txt, string $a_type="info")
Get HTML for a system message.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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...
getCmd(string $fallback_command=null)
$location
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getChilds(int $a_node_id, string $a_order="", string $a_direction="ASC")
get child nodes of given node
isDeleted(int $a_node_id)
This is a wrapper for isSaved() with a more useful name.
ilObjectDefinition $obj_definition
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getPathFull(int $a_endnode_id, int $a_startnode_id=0)
get path from a given startnode to a given endnode if startnode is not given the rootnode is startnod...
static _lookupObjId(int $ref_id)
Classification block, displayed in different contexts, e.g.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
parses the objects.xml it handles the xml-description of all ilias objects
ilGlobalTemplateInterface $main_tpl
getSubTreeFilteredByObjIds(int $a_node_id, array $a_obj_ids, array $a_fields=[])
get all node ids in the subtree under specified node id, filter by object ids
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
initProviders(bool $a_check_post=false)
static array $providers_cache
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
setTitle(string $a_title)
This class represents a block method of a block.
static _lookupType(int $id, bool $reference=false)
static getValidProviders(int $a_parent_ref_id, int $a_parent_obj_id, string $a_parent_obj_type)
Get all valid providers (for parent container)
StandardGUIRequest $cl_request
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)