ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilObjectCopyProgressTableGUI.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 include_once './Services/Table/classes/class.ilTable2GUI.php';
6 
17 {
18  protected $objects = array();
19 
26  public function __construct($a_parent_obj, $a_parent_cmd, $a_id)
27  {
28  $this->setId('obj_copy_progress_table_' . $a_id);
29  parent::__construct($a_parent_obj, $a_parent_cmd, '');
30  }
31 
32  public function setObjectInfo($a_ref_ids)
33  {
34  $this->objects = $a_ref_ids;
35  }
36 
37  public function getObjects()
38  {
39  return $this->objects;
40  }
41 
42  public function setRedirectionUrl($a_url)
43  {
44  global $DIC;
45  $DIC->ui()->mainTemplate()->addOnLoadCode('il.CopyRedirection.setRedirectUrl("' . $a_url . '")');
46  }
47 
51  public function init()
52  {
53  global $DIC;
54 
55  $tpl = $DIC->ui()->mainTemplate();
56  $ctrl = $DIC->ctrl();
57  $lng = $DIC->language();
58 
59  $tpl->addJavaScript('./Services/CopyWizard/js/ilCopyRedirection.js');
60  $tpl->addOnLoadCode('il.CopyRedirection.checkDone()');
61  $this->setExternalSorting(true);
62  $this->setFormAction($ctrl->getFormAction($this->getParentObject()));
63 
64  $this->setRowTemplate('tpl.object_copy_progress_table_row.html', 'Services/Object');
65 
66  $this->addColumn($lng->txt('obj_target_location'), '');
67  $this->addColumn($lng->txt('obj_copy_progress'), '');
68  }
69 
74  public function fillRow($set)
75  {
76  global $DIC;
77 
78  $tpl = $DIC->ui()->mainTemplate();
79  $ctrl = $DIC->ctrl();
80  $lng = $DIC->language();
81 
82  $this->tpl->setVariable('VAL_ID', $set['ref_id']);
83  $this->tpl->setVariable('OBJ_TITLE', $set['title']);
84 
85  if (strlen($set['description'])) {
86  $this->tpl->setVariable('VAL_DESC', $set['description']);
87  }
88 
89  $this->tpl->setVariable('TYPE_IMG', ilUtil::getTypeIconPath($set['type'], $set['obj_id']));
90  $this->tpl->setVariable('TYPE_STR', $this->lng->txt('obj_' . $set['type']));
91 
92  include_once './Services/UIComponent/ProgressBar/classes/class.ilProgressBar.php';
93  $progress = ilProgressBar::getInstance();
94  $progress->setType(ilProgressBar::TYPE_SUCCESS);
95  $progress->setMin(0);
96  $progress->setMax($set['max_steps']);
97  $progress->setCurrent(0);
98  $progress->setAnimated(true);
99  $progress->setId($set['copy_id']);
100 
101  $ctrl->setParameter($this->getParentObject(), 'copy_id', $set['copy_id']);
102  $progress->setAsyncStatusUrl(
103  $ctrl->getLinkTarget(
104  $this->getParentObject(),
105  'updateProgress',
106  '',
107  true
108  )
109  );
110 
111  $progress->setAsynStatusTimeout(1);
112  $this->tpl->setVariable('PROGRESS_BAR', $progress->render());
113  }
114 
118  public function parse()
119  {
120  $counter = 0;
121  $set = array();
122  foreach ($this->getObjects() as $ref_id => $copy_id) {
123  $counter++;
124  $set[$counter]['ref_id'] = $ref_id;
125  $set[$counter]['copy_id'] = $copy_id;
126  $set[$counter]['obj_id'] = ilObject::_lookupObjId($ref_id);
127  $set[$counter]['type'] = ilObject::_lookupType(ilObject::_lookupObjId($ref_id));
128  $set[$counter]['title'] = ilObject::_lookupTitle(ilObject::_lookupObjId($ref_id));
129  $set[$counter]['description'] = ilObject::_lookupDescription(ilObject::_lookupObjId($ref_id));
130 
131  include_once './Services/CopyWizard/classes/class.ilCopyWizardOptions.php';
132  $copy_info = ilCopyWizardOptions::_getInstance($copy_id);
133  $copy_info->read();
134  $set[$counter]['max_steps'] = $copy_info->getRequiredSteps();
135  }
136  $this->setData($set);
137  }
138 }
setExternalSorting($a_val)
Set external sorting.
global $DIC
Definition: saml.php:7
static _lookupTitle($a_id)
lookup object title
__construct($a_parent_obj, $a_parent_cmd, $a_id)
Constructor.
static getTypeIconPath($a_type, $a_obj_id, $a_size='small')
Get type icon path path Return image path for icon_xxx.pngs Or (if enabled) path to custom icon Depre...
getParentObject()
Get parent object.
setId($a_val)
Set id.
static _getInstance($a_copy_id)
Get instance of copy wizard options.
Class ilTable2GUI.
static getInstance()
Factory.
static _lookupDescription($a_id)
lookup object description
static _lookupObjId($a_id)
setRowTemplate($a_template, $a_template_dir="")
Set row template.
static _lookupType($a_id, $a_reference=false)
lookup object type
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
addColumn( $a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.