ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilObjectCopyProgressTableGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
27{
28 protected array $objects = [];
29
31 {
32 $this->setId('obj_cp_prog_tbl_' . $id);
34 }
35
36 public function setObjectInfo(array $ref_ids): void
37 {
38 $this->objects = $ref_ids;
39 }
40
41 public function getObjects(): array
42 {
43 return $this->objects;
44 }
45
46 public function setRedirectionUrl(?string $url): void
47 {
48 $this->main_tpl->addOnLoadCode('il.CopyRedirection.setRedirectUrl("' . $url . '")');
49 }
50
51 public function init(): void
52 {
53 $this->main_tpl->addJavaScript('assets/js/ilCopyRedirection.js');
54 $this->main_tpl->addOnLoadCode('il.CopyRedirection.checkDone()');
55 $this->setExternalSorting(true);
56 $this->setFormAction($this->ctrl->getFormAction($this->getParentObject()));
57
58 $this->setRowTemplate('tpl.object_copy_progress_table_row.html', 'components/ILIAS/ILIASObject');
59
60 $this->addColumn($this->lng->txt('obj_target_location'));
61 $this->addColumn($this->lng->txt('obj_copy_progress'));
62 }
63
64 protected function fillRow(array $set): void
65 {
66 $this->tpl->setVariable('VAL_ID', $set['ref_id']);
67 $this->tpl->setVariable('OBJ_TITLE', $set['title']);
68
69 if (strlen($set['description'])) {
70 $this->tpl->setVariable('VAL_DESC', $set['description']);
71 }
72
73 $this->tpl->setVariable('TYPE_IMG', ilObject::_getIcon($set['obj_id'], "small", $set['type']));
74 $this->tpl->setVariable('TYPE_STR', $this->lng->txt('obj_' . $set['type']));
75
76 $progress = ilProgressBar::getInstance();
77 $progress->setType(ilProgressBar::TYPE_SUCCESS);
78 $progress->setMin(0);
79 $progress->setMax($set['max_steps']);
80 $progress->setCurrent(0);
81 $progress->setAnimated(true);
82 $progress->setId((string) $set['copy_id']);
83
84 $this->ctrl->setParameter($this->getParentObject(), '_copy_id', $set['copy_id']);
85 $progress->setAsyncStatusUrl(
86 $this->ctrl->getLinkTarget(
87 $this->getParentObject(),
88 'updateProgress',
89 '',
90 true
91 )
92 );
93
94 $progress->setAsynStatusTimeout(1);
95 $this->tpl->setVariable('PROGRESS_BAR', $progress->render());
96 }
97
98 public function parse(): void
99 {
100 $counter = 0;
101 $set = [];
102 foreach ($this->getObjects() as $ref_id => $copy_id) {
103 $counter++;
104 $set[$counter]['ref_id'] = $ref_id;
105 $set[$counter]['copy_id'] = $copy_id;
106 $set[$counter]['obj_id'] = ilObject::_lookupObjId($ref_id);
110
111 $copy_info = ilCopyWizardOptions::_getInstance($copy_id);
112 $copy_info->read();
113 $set[$counter]['max_steps'] = $copy_info->getRequiredSteps();
114 }
115 $this->setData($set);
116 }
117}
static _getInstance(int $a_copy_id)
GUI class for the workflow of copying objects.
fillRow(array $set)
Standard Version of Fill Row.
__construct(ilObjectCopyGUI $parent_obj, string $parent_cmd, int $id)
static _lookupType(int $id, bool $reference=false)
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $offline=false)
Get icon for repository item.
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
static _lookupDescription(int $obj_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setFormAction(string $a_form_action, bool $a_multipart=false)
addColumn(string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)
setExternalSorting(bool $a_val)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setId(string $a_val)
setData(array $a_data)
Set table data.
$ref_id
Definition: ltiauth.php:66
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$url
Definition: shib_logout.php:68
$counter