24 include_once(
'Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
57 $ilObjDataCache = $DIC[
'ilObjDataCache'];
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);
84 $ilAccess = $DIC[
'ilAccess'];
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);
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]');
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();
103 $this->tpl->setCurrentBlock(
'missing_copy_perm');
104 $this->tpl->setVariable(
'TXT_MISSING_COPY_PERM', $this->lng->txt(
'missing_perm'));
105 $this->tpl->parseCurrentBlock();
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]');
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"');
118 $this->tpl->parseCurrentBlock();
120 $this->tpl->setCurrentBlock(
'missing_link_perm');
121 $this->tpl->setVariable(
'TXT_MISSING_LINK_PERM', $this->lng->txt(
'missing_perm'));
122 $this->tpl->parseCurrentBlock();
126 $this->tpl->setVariable(
'TXT_OMIT', $this->lng->txt(
'omit'));
127 $this->tpl->setVariable(
'NAME_OMIT',
'cp_options[' . $a_ref_id .
'][type]');
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"');
147 if (!count($this->items)) {
159 if (count($this->items) > 1) {
160 $this->tpl->setCurrentBlock(
'obj_options');
161 $this->tpl->setVariable(
'NAME_OPTIONS', $this->lng->txt(
'omit_all'));
163 $this->tpl->setVariable(
'JS_TYPE', $this->item_type .
'_omit');
164 $this->tpl->parseCurrentBlock();
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"');
170 $this->tpl->setVariable(
'JS_TYPE', $this->item_type .
'_copy');
171 $this->tpl->parseCurrentBlock();
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'));
177 $this->tpl->setVariable(
'JS_TYPE', $this->item_type .
'_link');
178 $this->tpl->parseCurrentBlock();
180 $this->tpl->setVariable(
'OPTION_CLASS',
'option_value');
182 $this->tpl->setVariable(
'OPTION_CLASS',
'option');
185 $this->tpl->setVariable(
'OBJ_ALT', $this->lng->txt(
'objs_' . $this->item_type));
186 $this->tpl->setVariable(
'ROWSPAN', count($this->items) + 1);
196 foreach ($this->items as $node) {
200 $this->tpl->setCurrentBlock(
'item_options');
201 $this->tpl->setVariable(
'ITEM_CHECK_NAME',
'cp_options[' . $node[
'child'] .
'][type]');
203 $this->tpl->setVariable(
'ITEM_NAME_OPTION', $this->lng->txt(
'omit'));
205 $this->tpl->setVariable(
'ITEM_CHECKED',
'checked="checked"');
208 $this->tpl->parseCurrentBlock();
211 if ($this->objDefinition->allowCopy($this->item_type)) {
212 $this->tpl->setCurrentBlock(
'item_options');
214 $this->tpl->setVariable(
'ITEM_CHECKED',
'checked="checked"');
216 $this->tpl->setVariable(
'ITEM_CHECK_NAME',
'cp_options[' . $node[
'child'] .
'][type]');
218 $this->tpl->setVariable(
'ITEM_NAME_OPTION', $this->lng->txt(
'copy'));
220 $this->tpl->parseCurrentBlock();
222 if ($this->objDefinition->allowLink($this->item_type)) {
223 $this->tpl->setCurrentBlock(
'item_options');
225 $this->tpl->setVariable(
'ITEM_CHECKED',
'checked="checked"');
227 $this->tpl->setVariable(
'ITEM_CHECK_NAME',
'cp_options[' . $node[
'child'] .
'][type]');
229 $this->tpl->setVariable(
'ITEM_NAME_OPTION', $this->lng->txt(
'link'));
231 $this->tpl->parseCurrentBlock();
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();
260 $this->items = array();
261 switch (
$nodes[0][
'type']) {
266 foreach (
$nodes as $node) {
267 if ($node[
'child'] != $this->source_id) {
268 $this->items[] = $node;
285 return $_POST[
'cp_options'][$a_node_id][
'type'] ?
286 $_POST[
'cp_options'][$a_node_id][
'type'] :
__construct($a_source_id, $a_item_type='')
Constructor.
fetchSelected($a_node_id)
Check if it is checked.
fillAdditionalOptions()
Fill additional options.
getWizardPageBlockHTML()
Get wizard page block html.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
fillItemBlock()
Fill item block.
fillTreeSelection($a_ref_id, $a_type, $a_depth)
Fill selection template.