ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f87
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

 initTemplate ()
 init template More...
 
 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 $lng, $objDefinition, and $tree.

54  {
55  global $ilObjDataCache,$tree,$lng,$objDefinition;
56 
57  $this->source_id = $a_source_id;
58  $this->item_type = $a_item_type;
59  $this->obj_id = $ilObjDataCache->lookupObjId($this->source_id);
60  $this->type = $ilObjDataCache->lookupType($this->obj_id);
61  $this->tree = $tree;
62  $this->lng = $lng;
63  $this->objDefinition = $objDefinition;
64  }

Member Function Documentation

◆ fetchSelected()

ilCopyWizardPage::fetchSelected (   $a_node_id)
protected

Check if it is checked.

protected

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

References $_POST, and ilCopyWizardOptions\COPY_WIZARD_COPY.

Referenced by fillItemBlock().

314  {
315  return $_POST['cp_options'][$a_node_id]['type'] ?
316  $_POST['cp_options'][$a_node_id]['type'] :
318  }
$_POST['username']
Definition: cron.php:12
+ Here is the caller graph for this function:

◆ fillAdditionalOptions()

ilCopyWizardPage::fillAdditionalOptions ( )
protected

Fill additional options.

protected

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

274  {
275 
276  }

◆ fillItemBlock()

ilCopyWizardPage::fillItemBlock ( )
protected

Fill item block.

protected

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

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

215  {
216  foreach($this->items as $node)
217  {
218  $selected = $this->fetchSelected($node['child']);
219 
220 
221  $this->tpl->setCurrentBlock('item_options');
222  $this->tpl->setVariable('ITEM_CHECK_NAME','cp_options['.$node['child'].'][type]');
223  $this->tpl->setVariable('ITEM_VALUE',ilCopyWizardOptions::COPY_WIZARD_OMIT);
224  $this->tpl->setVariable('ITEM_NAME_OPTION',$this->lng->txt('omit'));
226  {
227  $this->tpl->setVariable('ITEM_CHECKED','checked="checked"');
228  }
229  $this->tpl->setVariable('ITEM_ID',$this->item_type.'_'.ilCopyWizardOptions::COPY_WIZARD_OMIT);
230  $this->tpl->parseCurrentBlock();
231 
232 
233  if($this->objDefinition->allowCopy($this->item_type))
234  {
235  $this->tpl->setCurrentBlock('item_options');
237  {
238  $this->tpl->setVariable('ITEM_CHECKED','checked="checked"');
239  }
240  $this->tpl->setVariable('ITEM_CHECK_NAME','cp_options['.$node['child'].'][type]');
241  $this->tpl->setVariable('ITEM_VALUE',ilCopyWizardOptions::COPY_WIZARD_COPY);
242  $this->tpl->setVariable('ITEM_NAME_OPTION',$this->lng->txt('copy'));
243  $this->tpl->setVariable('ITEM_ID',$this->item_type.'_'.ilCopyWizardOptions::COPY_WIZARD_COPY);
244  $this->tpl->parseCurrentBlock();
245  }
246  if($this->objDefinition->allowLink($this->item_type))
247  {
248  $this->tpl->setCurrentBlock('item_options');
250  {
251  $this->tpl->setVariable('ITEM_CHECKED','checked="checked"');
252  }
253  $this->tpl->setVariable('ITEM_CHECK_NAME','cp_options['.$node['child'].'][type]');
254  $this->tpl->setVariable('ITEM_VALUE',ilCopyWizardOptions::COPY_WIZARD_LINK);
255  $this->tpl->setVariable('ITEM_NAME_OPTION',$this->lng->txt('link'));
256  $this->tpl->setVariable('ITEM_ID',$this->item_type.'_'.ilCopyWizardOptions::COPY_WIZARD_LINK);
257  $this->tpl->parseCurrentBlock();
258  }
259 
260 
261  $this->tpl->setCurrentBlock('item_row');
262  $this->tpl->setVariable('ITEM_TITLE',$node['title']);
263  $this->tpl->setVariable('DESCRIPTION',$node['description']);
264  $this->tpl->parseCurrentBlock();
265  }
266  }
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 171 of file class.ilCopyWizardPage.php.

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

172  {
173 
174  if(count($this->items) > 1)
175  {
176  $this->tpl->setCurrentBlock('obj_options');
177  $this->tpl->setVariable('NAME_OPTIONS',$this->lng->txt('omit_all'));
178  $this->tpl->setVariable('JS_FIELD',$this->item_type.'_'.ilCopyWizardOptions::COPY_WIZARD_OMIT);
179  $this->tpl->setVariable('JS_TYPE',$this->item_type.'_omit');
180  $this->tpl->parseCurrentBlock();
181 
182  $this->tpl->setCurrentBlock('obj_options');
183  $this->tpl->setVariable('NAME_OPTIONS',$this->lng->txt('copy_all'));
184  $this->tpl->setVariable('OBJ_CHECKED','checked="checked"');
185  $this->tpl->setVariable('JS_FIELD',$this->item_type.'_'.ilCopyWizardOptions::COPY_WIZARD_COPY);
186  $this->tpl->setVariable('JS_TYPE',$this->item_type.'_copy');
187  $this->tpl->parseCurrentBlock();
188 
189  if($this->objDefinition->allowLink($this->item_type))
190  {
191  $this->tpl->setCurrentBlock('obj_options');
192  $this->tpl->setVariable('NAME_OPTIONS',$this->lng->txt('link_all'));
193  $this->tpl->setVariable('JS_FIELD',$this->item_type.'_'.ilCopyWizardOptions::COPY_WIZARD_LINK);
194  $this->tpl->setVariable('JS_TYPE',$this->item_type.'_link');
195  $this->tpl->parseCurrentBlock();
196 
197  }
198  $this->tpl->setVariable('OPTION_CLASS','option_value');
199  }
200  else
201  {
202  $this->tpl->setVariable('OPTION_CLASS','option');
203  }
204  $this->tpl->setVariable('OBJ_IMG',ilUtil::getImagePath('icon_'.$this->item_type.'.svg'));
205  $this->tpl->setVariable('OBJ_ALT',$this->lng->txt('objs_'.$this->item_type));
206  $this->tpl->setVariable('ROWSPAN',count($this->items) + 1);
207  }
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 74 of file class.ilCopyWizardPage.php.

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

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

◆ 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  {
149  return '';
150  }
151  }
+ Here is the call graph for this function:

◆ initTemplate()

ilCopyWizardPage::initTemplate ( )
protected

init template

protected

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

159  {
160 // alex I didn't find any use of this and the template contains a call setCheckedById()
161 // that I just deleted, since it is also not used anywhere else
162 die("ilCopyWizardPage->initTemplate. Deprecated.");
163  $this->tpl = new ilTemplate('tpl.copy_wizard_block.html',true,true,'Services/CopyWizard');
164  }
special template class to simplify handling of ITX/PEAR

◆ readItems()

ilCopyWizardPage::readItems ( )
protected

Read items.

protected

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

References $item_type.

Referenced by getWizardPageBlockHTML().

284  {
285  $nodes = $this->tree->getSubTree($this->tree->getNodeData($this->source_id),true,$this->item_type);
286 
287  $this->items = array();
288  switch($nodes[0]['type'])
289  {
290  case 'fold':
291  case 'grp':
292  case 'crs':
293  case 'cat':
294  foreach($nodes as $node)
295  {
296  if($node['child'] != $this->source_id)
297  {
298  $this->items[] = $node;
299  }
300  }
301  break;
302  default:
303  $this->items = $nodes;
304  break;
305  }
306  }
+ 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: