ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilCopyWizardPage Class Reference
+ Collaboration diagram for ilCopyWizardPage:

Public Member Functions

 __construct ($a_source_id, $a_item_type='')
 Constructor. More...
 
 fillTreeSelection ($a_ref_id, $a_type, $a_depth)
 Fill selection template. More...
 
 getWizardPageBlockHTML ()
 Get wizard page block html. More...
 

Protected Member Functions

 fillMainBlock ()
 protected More...
 
 fillItemBlock ()
 Fill item block. More...
 
 fillAdditionalOptions ()
 Fill additional options. More...
 
 readItems ()
 Read items. More...
 
 fetchSelected ($a_node_id)
 Check if it is checked. More...
 

Private Attributes

 $type
 
 $source_id
 
 $obj_id
 
 $item_type
 
 $tree
 
 $lng
 
 $objDefinition
 

Detailed Description

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

Definition at line 35 of file class.ilCopyWizardPage.php.

Constructor & Destructor Documentation

◆ __construct()

ilCopyWizardPage::__construct (   $a_source_id,
  $a_item_type = '' 
)

Constructor.

public

Parameters

Definition at line 53 of file class.ilCopyWizardPage.php.

References $DIC, $lng, $objDefinition, and $tree.

54  {
55  global $DIC;
56 
57  $ilObjDataCache = $DIC['ilObjDataCache'];
58  $tree = $DIC['tree'];
59  $lng = $DIC['lng'];
60  $objDefinition = $DIC['objDefinition'];
61 
62  $this->source_id = $a_source_id;
63  $this->item_type = $a_item_type;
64  $this->obj_id = $ilObjDataCache->lookupObjId($this->source_id);
65  $this->type = $ilObjDataCache->lookupType($this->obj_id);
66  $this->tree = $tree;
67  $this->lng = $lng;
68  $this->objDefinition = $objDefinition;
69  }
global $DIC
Definition: saml.php:7

Member Function Documentation

◆ fetchSelected()

ilCopyWizardPage::fetchSelected (   $a_node_id)
protected

Check if it is checked.

protected

Definition at line 283 of file class.ilCopyWizardPage.php.

References $_POST, and ilCopyWizardOptions\COPY_WIZARD_COPY.

Referenced by fillItemBlock().

284  {
285  return $_POST['cp_options'][$a_node_id]['type'] ?
286  $_POST['cp_options'][$a_node_id]['type'] :
288  }
$_POST["username"]
+ Here is the caller graph for this function:

◆ fillAdditionalOptions()

ilCopyWizardPage::fillAdditionalOptions ( )
protected

Fill additional options.

protected

Definition at line 247 of file class.ilCopyWizardPage.php.

248  {
249  }

◆ fillItemBlock()

ilCopyWizardPage::fillItemBlock ( )
protected

Fill item block.

protected

Definition at line 194 of file class.ilCopyWizardPage.php.

References ilCopyWizardOptions\COPY_WIZARD_COPY, ilCopyWizardOptions\COPY_WIZARD_LINK, ilCopyWizardOptions\COPY_WIZARD_OMIT, and fetchSelected().

195  {
196  foreach ($this->items as $node) {
197  $selected = $this->fetchSelected($node['child']);
198 
199 
200  $this->tpl->setCurrentBlock('item_options');
201  $this->tpl->setVariable('ITEM_CHECK_NAME', 'cp_options[' . $node['child'] . '][type]');
202  $this->tpl->setVariable('ITEM_VALUE', ilCopyWizardOptions::COPY_WIZARD_OMIT);
203  $this->tpl->setVariable('ITEM_NAME_OPTION', $this->lng->txt('omit'));
204  if ($selected == ilCopyWizardOptions::COPY_WIZARD_OMIT) {
205  $this->tpl->setVariable('ITEM_CHECKED', 'checked="checked"');
206  }
207  $this->tpl->setVariable('ITEM_ID', $this->item_type . '_' . ilCopyWizardOptions::COPY_WIZARD_OMIT);
208  $this->tpl->parseCurrentBlock();
209 
210 
211  if ($this->objDefinition->allowCopy($this->item_type)) {
212  $this->tpl->setCurrentBlock('item_options');
213  if ($selected == ilCopyWizardOptions::COPY_WIZARD_COPY) {
214  $this->tpl->setVariable('ITEM_CHECKED', 'checked="checked"');
215  }
216  $this->tpl->setVariable('ITEM_CHECK_NAME', 'cp_options[' . $node['child'] . '][type]');
217  $this->tpl->setVariable('ITEM_VALUE', ilCopyWizardOptions::COPY_WIZARD_COPY);
218  $this->tpl->setVariable('ITEM_NAME_OPTION', $this->lng->txt('copy'));
219  $this->tpl->setVariable('ITEM_ID', $this->item_type . '_' . ilCopyWizardOptions::COPY_WIZARD_COPY);
220  $this->tpl->parseCurrentBlock();
221  }
222  if ($this->objDefinition->allowLink($this->item_type)) {
223  $this->tpl->setCurrentBlock('item_options');
224  if ($selected == ilCopyWizardOptions::COPY_WIZARD_LINK) {
225  $this->tpl->setVariable('ITEM_CHECKED', 'checked="checked"');
226  }
227  $this->tpl->setVariable('ITEM_CHECK_NAME', 'cp_options[' . $node['child'] . '][type]');
228  $this->tpl->setVariable('ITEM_VALUE', ilCopyWizardOptions::COPY_WIZARD_LINK);
229  $this->tpl->setVariable('ITEM_NAME_OPTION', $this->lng->txt('link'));
230  $this->tpl->setVariable('ITEM_ID', $this->item_type . '_' . ilCopyWizardOptions::COPY_WIZARD_LINK);
231  $this->tpl->parseCurrentBlock();
232  }
233 
234 
235  $this->tpl->setCurrentBlock('item_row');
236  $this->tpl->setVariable('ITEM_TITLE', $node['title']);
237  $this->tpl->setVariable('DESCRIPTION', $node['description']);
238  $this->tpl->parseCurrentBlock();
239  }
240  }
fetchSelected($a_node_id)
Check if it is checked.
+ Here is the call graph for this function:

◆ fillMainBlock()

ilCopyWizardPage::fillMainBlock ( )
protected

protected

Definition at line 157 of file class.ilCopyWizardPage.php.

References ilCopyWizardOptions\COPY_WIZARD_COPY, ilCopyWizardOptions\COPY_WIZARD_LINK, ilCopyWizardOptions\COPY_WIZARD_OMIT, and ilUtil\getImagePath().

158  {
159  if (count($this->items) > 1) {
160  $this->tpl->setCurrentBlock('obj_options');
161  $this->tpl->setVariable('NAME_OPTIONS', $this->lng->txt('omit_all'));
162  $this->tpl->setVariable('JS_FIELD', $this->item_type . '_' . ilCopyWizardOptions::COPY_WIZARD_OMIT);
163  $this->tpl->setVariable('JS_TYPE', $this->item_type . '_omit');
164  $this->tpl->parseCurrentBlock();
165 
166  $this->tpl->setCurrentBlock('obj_options');
167  $this->tpl->setVariable('NAME_OPTIONS', $this->lng->txt('copy_all'));
168  $this->tpl->setVariable('OBJ_CHECKED', 'checked="checked"');
169  $this->tpl->setVariable('JS_FIELD', $this->item_type . '_' . ilCopyWizardOptions::COPY_WIZARD_COPY);
170  $this->tpl->setVariable('JS_TYPE', $this->item_type . '_copy');
171  $this->tpl->parseCurrentBlock();
172 
173  if ($this->objDefinition->allowLink($this->item_type)) {
174  $this->tpl->setCurrentBlock('obj_options');
175  $this->tpl->setVariable('NAME_OPTIONS', $this->lng->txt('link_all'));
176  $this->tpl->setVariable('JS_FIELD', $this->item_type . '_' . ilCopyWizardOptions::COPY_WIZARD_LINK);
177  $this->tpl->setVariable('JS_TYPE', $this->item_type . '_link');
178  $this->tpl->parseCurrentBlock();
179  }
180  $this->tpl->setVariable('OPTION_CLASS', 'option_value');
181  } else {
182  $this->tpl->setVariable('OPTION_CLASS', 'option');
183  }
184  $this->tpl->setVariable('OBJ_IMG', ilUtil::getImagePath('icon_' . $this->item_type . '.svg'));
185  $this->tpl->setVariable('OBJ_ALT', $this->lng->txt('objs_' . $this->item_type));
186  $this->tpl->setVariable('ROWSPAN', count($this->items) + 1);
187  }
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
+ Here is the call graph for this function:

◆ fillTreeSelection()

ilCopyWizardPage::fillTreeSelection (   $a_ref_id,
  $a_type,
  $a_depth 
)

Fill selection template.

public

Parameters
intref_id of node
stringtype of current node

Definition at line 79 of file class.ilCopyWizardPage.php.

References $a_type, $DIC, $tpl, ilCopyWizardOptions\COPY_WIZARD_COPY, ilCopyWizardOptions\COPY_WIZARD_LINK, and ilCopyWizardOptions\COPY_WIZARD_OMIT.

80  {
81  global $DIC;
82 
83  $tpl = $DIC['tpl'];
84  $ilAccess = $DIC['ilAccess'];
85 
86  $this->tpl = $tpl;
87 
88  $perm_copy = $ilAccess->checkAccess('copy', '', $a_ref_id);
89  $copy = $this->objDefinition->allowCopy($a_type);
90  $perm_link = $ilAccess->checkAccess('write', '', $a_ref_id);
91  $link = $this->objDefinition->allowLink($a_type);
92 
93  // Show radio copy
94  if ($perm_copy and $copy) {
95  $this->tpl->setCurrentBlock('radio_copy');
96  $this->tpl->setVariable('TXT_COPY', $this->lng->txt('copy'));
97  $this->tpl->setVariable('NAME_COPY', 'cp_options[' . $a_ref_id . '][type]');
98  $this->tpl->setVariable('VALUE_COPY', ilCopyWizardOptions::COPY_WIZARD_COPY);
99  $this->tpl->setVariable('ID_COPY', $a_depth . '_' . $a_type . '_' . $a_ref_id . '_copy');
100  $this->tpl->setVariable('COPY_CHECKED', 'checked="checked"');
101  $this->tpl->parseCurrentBlock();
102  } elseif ($copy) {
103  $this->tpl->setCurrentBlock('missing_copy_perm');
104  $this->tpl->setVariable('TXT_MISSING_COPY_PERM', $this->lng->txt('missing_perm'));
105  $this->tpl->parseCurrentBlock();
106  }
107 
108  // Show radio link
109  if ($perm_link and $link) {
110  $this->tpl->setCurrentBlock('radio_link');
111  $this->tpl->setVariable('TXT_LINK', $this->lng->txt('link'));
112  $this->tpl->setVariable('NAME_LINK', 'cp_options[' . $a_ref_id . '][type]');
113  $this->tpl->setVariable('VALUE_LINK', ilCopyWizardOptions::COPY_WIZARD_LINK);
114  $this->tpl->setVariable('ID_LINK', $a_depth . '_' . $a_type . '_' . $a_ref_id . '_link');
115  if (!$copy or !$perm_copy) {
116  $this->tpl->setVariable('LINK_CHECKED', 'checked="checked"');
117  }
118  $this->tpl->parseCurrentBlock();
119  } elseif ($link) {
120  $this->tpl->setCurrentBlock('missing_link_perm');
121  $this->tpl->setVariable('TXT_MISSING_LINK_PERM', $this->lng->txt('missing_perm'));
122  $this->tpl->parseCurrentBlock();
123  }
124 
125  // Radio omit
126  $this->tpl->setVariable('TXT_OMIT', $this->lng->txt('omit'));
127  $this->tpl->setVariable('NAME_OMIT', 'cp_options[' . $a_ref_id . '][type]');
128  $this->tpl->setVariable('VALUE_OMIT', ilCopyWizardOptions::COPY_WIZARD_OMIT);
129  $this->tpl->setVariable('ID_OMIT', $a_depth . '_' . $a_type . '_' . $a_ref_id . '_omit');
130  if (((!$copy or !$perm_copy) and (!$link or !$perm_link))) {
131  $this->tpl->setVariable('OMIT_CHECKED', 'checked="checked"');
132  }
133  }
global $DIC
Definition: saml.php:7
$tpl
Definition: ilias.php:10
$a_type
Definition: workflow.php:92

◆ getWizardPageBlockHTML()

ilCopyWizardPage::getWizardPageBlockHTML ( )

Get wizard page block html.

public

Definition at line 143 of file class.ilCopyWizardPage.php.

References readItems().

144  {
145  $this->readItems();
146 
147  if (!count($this->items)) {
148  return '';
149  }
150  }
+ Here is the call graph for this function:

◆ readItems()

ilCopyWizardPage::readItems ( )
protected

Read items.

protected

Definition at line 256 of file class.ilCopyWizardPage.php.

References $item_type, and $nodes.

Referenced by getWizardPageBlockHTML().

257  {
258  $nodes = $this->tree->getSubTree($this->tree->getNodeData($this->source_id), true, $this->item_type);
259 
260  $this->items = array();
261  switch ($nodes[0]['type']) {
262  case 'fold':
263  case 'grp':
264  case 'crs':
265  case 'cat':
266  foreach ($nodes as $node) {
267  if ($node['child'] != $this->source_id) {
268  $this->items[] = $node;
269  }
270  }
271  break;
272  default:
273  $this->items = $nodes;
274  break;
275  }
276  }
+ Here is the caller graph for this function:

Field Documentation

◆ $item_type

ilCopyWizardPage::$item_type
private

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

Referenced by readItems().

◆ $lng

ilCopyWizardPage::$lng
private

Definition at line 43 of file class.ilCopyWizardPage.php.

Referenced by __construct().

◆ $obj_id

ilCopyWizardPage::$obj_id
private

Definition at line 39 of file class.ilCopyWizardPage.php.

◆ $objDefinition

ilCopyWizardPage::$objDefinition
private

Definition at line 44 of file class.ilCopyWizardPage.php.

Referenced by __construct().

◆ $source_id

ilCopyWizardPage::$source_id
private

Definition at line 38 of file class.ilCopyWizardPage.php.

◆ $tree

ilCopyWizardPage::$tree
private

Definition at line 42 of file class.ilCopyWizardPage.php.

Referenced by __construct().

◆ $type

ilCopyWizardPage::$type
private

Definition at line 37 of file class.ilCopyWizardPage.php.


The documentation for this class was generated from the following file: