24 include_once(
'Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
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);
76 global
$tpl,$ilAccess;
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);
86 if($perm_copy and $copy)
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]');
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();
98 $this->tpl->setCurrentBlock(
'missing_copy_perm');
99 $this->tpl->setVariable(
'TXT_MISSING_COPY_PERM',$this->lng->txt(
'missing_perm'));
100 $this->tpl->parseCurrentBlock();
104 if($perm_link and $link)
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]');
110 $this->tpl->setVariable(
'ID_LINK',$a_depth.
'_'.$a_type.
'_'.$a_ref_id.
'_link');
111 if(!$copy or !$perm_copy)
113 $this->tpl->setVariable(
'LINK_CHECKED',
'checked="checked"');
115 $this->tpl->parseCurrentBlock();
119 $this->tpl->setCurrentBlock(
'missing_link_perm');
120 $this->tpl->setVariable(
'TXT_MISSING_LINK_PERM',$this->lng->txt(
'missing_perm'));
121 $this->tpl->parseCurrentBlock();
125 $this->tpl->setVariable(
'TXT_OMIT',$this->lng->txt(
'omit'));
126 $this->tpl->setVariable(
'NAME_OMIT',
'cp_options['.$a_ref_id.
'][type]');
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)))
131 $this->tpl->setVariable(
'OMIT_CHECKED',
'checked="checked"');
147 if(!count($this->items))
160 $this->tpl =
new ilTemplate(
'tpl.copy_wizard_block.html',
true,
true,
'Services/CopyWizard');
171 if(count($this->items) > 1)
173 $this->tpl->setCurrentBlock(
'obj_options');
174 $this->tpl->setVariable(
'NAME_OPTIONS',$this->lng->txt(
'omit_all'));
176 $this->tpl->setVariable(
'JS_TYPE',$this->item_type.
'_omit');
177 $this->tpl->parseCurrentBlock();
179 $this->tpl->setCurrentBlock(
'obj_options');
180 $this->tpl->setVariable(
'NAME_OPTIONS',$this->lng->txt(
'copy_all'));
181 $this->tpl->setVariable(
'OBJ_CHECKED',
'checked="checked"');
183 $this->tpl->setVariable(
'JS_TYPE',$this->item_type.
'_copy');
184 $this->tpl->parseCurrentBlock();
186 if($this->objDefinition->allowLink($this->item_type))
188 $this->tpl->setCurrentBlock(
'obj_options');
189 $this->tpl->setVariable(
'NAME_OPTIONS',$this->lng->txt(
'link_all'));
191 $this->tpl->setVariable(
'JS_TYPE',$this->item_type.
'_link');
192 $this->tpl->parseCurrentBlock();
195 $this->tpl->setVariable(
'OPTION_CLASS',
'option_value');
199 $this->tpl->setVariable(
'OPTION_CLASS',
'option');
202 $this->tpl->setVariable(
'OBJ_ALT',$this->lng->txt(
'objs_'.$this->item_type));
203 $this->tpl->setVariable(
'ROWSPAN',count($this->items) + 1);
213 foreach($this->items as $node)
218 $this->tpl->setCurrentBlock(
'item_options');
219 $this->tpl->setVariable(
'ITEM_CHECK_NAME',
'cp_options['.$node[
'child'].
'][type]');
221 $this->tpl->setVariable(
'ITEM_NAME_OPTION',$this->lng->txt(
'omit'));
224 $this->tpl->setVariable(
'ITEM_CHECKED',
'checked="checked"');
227 $this->tpl->parseCurrentBlock();
230 if($this->objDefinition->allowCopy($this->item_type))
232 $this->tpl->setCurrentBlock(
'item_options');
235 $this->tpl->setVariable(
'ITEM_CHECKED',
'checked="checked"');
237 $this->tpl->setVariable(
'ITEM_CHECK_NAME',
'cp_options['.$node[
'child'].
'][type]');
239 $this->tpl->setVariable(
'ITEM_NAME_OPTION',$this->lng->txt(
'copy'));
241 $this->tpl->parseCurrentBlock();
243 if($this->objDefinition->allowLink($this->item_type))
245 $this->tpl->setCurrentBlock(
'item_options');
248 $this->tpl->setVariable(
'ITEM_CHECKED',
'checked="checked"');
250 $this->tpl->setVariable(
'ITEM_CHECK_NAME',
'cp_options['.$node[
'child'].
'][type]');
252 $this->tpl->setVariable(
'ITEM_NAME_OPTION',$this->lng->txt(
'link'));
254 $this->tpl->parseCurrentBlock();
258 $this->tpl->setCurrentBlock(
'item_row');
259 $this->tpl->setVariable(
'ITEM_TITLE',$node[
'title']);
260 $this->tpl->setVariable(
'DESCRIPTION',$node[
'description']);
261 $this->tpl->parseCurrentBlock();
282 $nodes = $this->tree->getSubTree($this->tree->getNodeData($this->source_id),
true,
$this->item_type);
284 $this->items = array();
285 switch($nodes[0][
'type'])
291 foreach($nodes as $node)
293 if($node[
'child'] != $this->source_id)
295 $this->items[] = $node;
300 $this->items = $nodes;
312 return $_POST[
'cp_options'][$a_node_id][
'type'] ?
313 $_POST[
'cp_options'][$a_node_id][
'type'] :