ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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  $GLOBALS['tpl']->addOnLoadCode('il.CopyRedirection.setRedirectUrl("' . $a_url . '")');
45  }
46 
50  public function init()
51  {
52  $GLOBALS['tpl']->addJavaScript('./Services/CopyWizard/js/ilCopyRedirection.js');
53  $GLOBALS['tpl']->addOnLoadCode('il.CopyRedirection.checkDone()');
54  $this->setExternalSorting(true);
55  $this->setFormAction($GLOBALS['ilCtrl']->getFormAction($this->getParentObject()));
56 
57  $this->setRowTemplate('tpl.object_copy_progress_table_row.html', 'Services/Object');
58 
59  $this->addColumn($this->lng->txt('obj_target_location'), '');
60  $this->addColumn($this->lng->txt('obj_copy_progress'), '');
61  }
62 
67  public function fillRow($set)
68  {
69  $this->tpl->setVariable('VAL_ID', $set['ref_id']);
70  $this->tpl->setVariable('OBJ_TITLE', $set['title']);
71 
72  if (strlen($set['description'])) {
73  $this->tpl->setVariable('VAL_DESC', $set['description']);
74  }
75 
76  $this->tpl->setVariable('TYPE_IMG', ilUtil::getTypeIconPath($set['type'], $set['obj_id']));
77  $this->tpl->setVariable('TYPE_STR', $this->lng->txt('obj_' . $set['type']));
78 
79  include_once './Services/UIComponent/ProgressBar/classes/class.ilProgressBar.php';
80  $progress = ilProgressBar::getInstance();
81  $progress->setType(ilProgressBar::TYPE_SUCCESS);
82  $progress->setMin(0);
83  $progress->setMax($set['max_steps']);
84  $progress->setCurrent(0);
85  $progress->setAnimated(true);
86  $progress->setId($set['copy_id']);
87 
88  $GLOBALS['ilCtrl']->setParameter($this->getParentObject(), 'copy_id', $set['copy_id']);
89  $progress->setAsyncStatusUrl(
90  $GLOBALS['ilCtrl']->getLinkTarget(
91  $this->getParentObject(),
92  'updateProgress',
93  '',
94  true
95  )
96  );
97 
98  $progress->setAsynStatusTimeout(1);
99  $this->tpl->setVariable('PROGRESS_BAR', $progress->render());
100  }
101 
105  public function parse()
106  {
107  $counter = 0;
108  $set = array();
109  foreach ($this->getObjects() as $ref_id => $copy_id) {
110  $counter++;
111  $set[$counter]['ref_id'] = $ref_id;
112  $set[$counter]['copy_id'] = $copy_id;
113  $set[$counter]['obj_id'] = ilObject::_lookupObjId($ref_id);
114  $set[$counter]['type'] = ilObject::_lookupType(ilObject::_lookupObjId($ref_id));
115  $set[$counter]['title'] = ilObject::_lookupTitle(ilObject::_lookupObjId($ref_id));
116  $set[$counter]['description'] = ilObject::_lookupDescription(ilObject::_lookupObjId($ref_id));
117 
118  include_once './Services/CopyWizard/classes/class.ilCopyWizardOptions.php';
119  $copy_info = ilCopyWizardOptions::_getInstance($copy_id);
120  $copy_info->read();
121  $set[$counter]['max_steps'] = $copy_info->getRequiredSteps();
122  }
123  $this->setData($set);
124  }
125 }
setExternalSorting($a_val)
Set external sorting.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
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.
$counter
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)
getFormAction()
Get Form action parameter.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
Create styles array
The data for the language used.
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.