ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 ()
 @access 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$

@ilCtrl_Calls

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

Constructor & Destructor Documentation

◆ __construct()

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

Constructor.

@access public

Parameters

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

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 }

References $lng, $objDefinition, and $tree.

Member Function Documentation

◆ fetchSelected()

ilCopyWizardPage::fetchSelected (   $a_node_id)
protected

Check if it is checked.

@access protected

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

276 {
277 return $_POST['cp_options'][$a_node_id]['type'] ?
278 $_POST['cp_options'][$a_node_id]['type'] :
280 }
$_POST["username"]

References $_POST, and ilCopyWizardOptions\COPY_WIZARD_COPY.

Referenced by fillItemBlock().

+ Here is the caller graph for this function:

◆ fillAdditionalOptions()

ilCopyWizardPage::fillAdditionalOptions ( )
protected

Fill additional options.

@access protected

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

240 {
241 }

◆ fillItemBlock()

ilCopyWizardPage::fillItemBlock ( )
protected

Fill item block.

@access protected

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

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

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

+ Here is the call graph for this function:

◆ fillMainBlock()

ilCopyWizardPage::fillMainBlock ( )
protected

@access protected

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

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

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

+ Here is the call graph for this function:

◆ fillTreeSelection()

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

Fill selection template.

@access public

Parameters
intref_id of node
stringtype of current node

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

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 $this->tpl->setCurrentBlock('radio_copy');
88 $this->tpl->setVariable('TXT_COPY', $this->lng->txt('copy'));
89 $this->tpl->setVariable('NAME_COPY', 'cp_options[' . $a_ref_id . '][type]');
90 $this->tpl->setVariable('VALUE_COPY', ilCopyWizardOptions::COPY_WIZARD_COPY);
91 $this->tpl->setVariable('ID_COPY', $a_depth . '_' . $a_type . '_' . $a_ref_id . '_copy');
92 $this->tpl->setVariable('COPY_CHECKED', 'checked="checked"');
93 $this->tpl->parseCurrentBlock();
94 } elseif ($copy) {
95 $this->tpl->setCurrentBlock('missing_copy_perm');
96 $this->tpl->setVariable('TXT_MISSING_COPY_PERM', $this->lng->txt('missing_perm'));
97 $this->tpl->parseCurrentBlock();
98 }
99
100 // Show radio link
101 if ($perm_link and $link) {
102 $this->tpl->setCurrentBlock('radio_link');
103 $this->tpl->setVariable('TXT_LINK', $this->lng->txt('link'));
104 $this->tpl->setVariable('NAME_LINK', 'cp_options[' . $a_ref_id . '][type]');
105 $this->tpl->setVariable('VALUE_LINK', ilCopyWizardOptions::COPY_WIZARD_LINK);
106 $this->tpl->setVariable('ID_LINK', $a_depth . '_' . $a_type . '_' . $a_ref_id . '_link');
107 if (!$copy or !$perm_copy) {
108 $this->tpl->setVariable('LINK_CHECKED', 'checked="checked"');
109 }
110 $this->tpl->parseCurrentBlock();
111 } elseif ($link) {
112 $this->tpl->setCurrentBlock('missing_link_perm');
113 $this->tpl->setVariable('TXT_MISSING_LINK_PERM', $this->lng->txt('missing_perm'));
114 $this->tpl->parseCurrentBlock();
115 }
116
117 // Radio omit
118 $this->tpl->setVariable('TXT_OMIT', $this->lng->txt('omit'));
119 $this->tpl->setVariable('NAME_OMIT', 'cp_options[' . $a_ref_id . '][type]');
120 $this->tpl->setVariable('VALUE_OMIT', ilCopyWizardOptions::COPY_WIZARD_OMIT);
121 $this->tpl->setVariable('ID_OMIT', $a_depth . '_' . $a_type . '_' . $a_ref_id . '_omit');
122 if (((!$copy or !$perm_copy) and (!$link or !$perm_link))) {
123 $this->tpl->setVariable('OMIT_CHECKED', 'checked="checked"');
124 }
125 }
$tpl
Definition: ilias.php:10
$a_type
Definition: workflow.php:92

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

◆ getWizardPageBlockHTML()

ilCopyWizardPage::getWizardPageBlockHTML ( )

Get wizard page block html.

@access public

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

136 {
137 $this->readItems();
138
139 if (!count($this->items)) {
140 return '';
141 }
142 }

References readItems().

+ Here is the call graph for this function:

◆ readItems()

ilCopyWizardPage::readItems ( )
protected

Read items.

@access protected

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

249 {
250 $nodes = $this->tree->getSubTree($this->tree->getNodeData($this->source_id), true, $this->item_type);
251
252 $this->items = array();
253 switch ($nodes[0]['type']) {
254 case 'fold':
255 case 'grp':
256 case 'crs':
257 case 'cat':
258 foreach ($nodes as $node) {
259 if ($node['child'] != $this->source_id) {
260 $this->items[] = $node;
261 }
262 }
263 break;
264 default:
265 $this->items = $nodes;
266 break;
267 }
268 }

Referenced by getWizardPageBlockHTML().

+ 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.

◆ $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: