ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilObjectCopySearchResultTableGUI.php
Go to the documentation of this file.
1<?php
2/*
3 +-----------------------------------------------------------------------------+
4 | ILIAS open source |
5 +-----------------------------------------------------------------------------+
6 | Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
7 | |
8 | This program is free software; you can redistribute it and/or |
9 | modify it under the terms of the GNU General Public License |
10 | as published by the Free Software Foundation; either version 2 |
11 | of the License, or (at your option) any later version. |
12 | |
13 | This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. |
17 | |
18 | You should have received a copy of the GNU General Public License |
19 | along with this program; if not, write to the Free Software |
20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21 +-----------------------------------------------------------------------------+
22*/
23
24include_once './Services/Table/classes/class.ilTable2GUI.php';
25
37{
38 private $type = '';
39 private $selected_reference = null;
40
47 public function __construct($a_parent_class,$a_parent_cmd,$a_type)
48 {
49 global $lng,$ilCtrl,$ilUser,$objDefinition;
50
51 $this->setId('obj_copy_'.$a_type);
52 parent::__construct($a_parent_class,$a_parent_cmd);
53 $this->type = $a_type;
54
55 $this->lng = $lng;
56 $this->ctrl = $ilCtrl;
57
58 if(!$objDefinition->isPlugin($this->type))
59 {
60 $title = $this->lng->txt('obj_'.$this->type.'_duplicate');
61 }
62 else
63 {
64 include_once "Services/Component/classes/class.ilPlugin.php";
65 $plugin = ilPlugin::getPluginObject(IL_COMP_SERVICE, "Repository", "robj",
66 ilPlugin::lookupNameForId(IL_COMP_SERVICE, "Repository", "robj", $this->type));
67 $title = $plugin->txt('obj_'.$this->type.'_duplicate');
68 }
69
70 $this->setTitle($title);
71 $ilUser->getPref('search_max_hits');
72
73 $this->addColumn($this->lng->txt('search_title_description'),'title','99%');
74
75 $this->setEnableHeader(true);
76 $this->setRowTemplate("tpl.obj_copy_search_result_row.html", "Services/Object");
77 $this->setEnableTitle(true);
78 $this->setEnableNumInfo(true);
79 $this->setDefaultOrderField('title');
80 $this->setShowRowsSelector(TRUE);
81
82 if($objDefinition->isContainer($this->type))
83 {
84 $this->addCommandButton('saveSource', $this->lng->txt('btn_next'));
85 }
86 else
87 {
88 $this->addCommandButton('saveSource', $title);
89 }
90
91 $this->addCommandButton('cancel', $this->lng->txt('btn_back'));
92 }
93
99 public function setSelectedReference($a_selected_reference)
100 {
101 $this->selected_reference = $a_selected_reference;
102 }
103
108 public function getSelectedReference()
109 {
111 }
112
118 public function parseSearchResults($a_res)
119 {
120 foreach($a_res as $obj_id => $references)
121 {
122 $r['title'] = ilObject::_lookupTitle($obj_id);
123 $r['desc'] = ilObject::_lookupDescription($obj_id);
124 $r['obj_id'] = $obj_id;
125 $r['refs'] = $references;
126
127 $rows[] = $r;
128 }
129
130 $this->setData($rows ? $rows : array());
131 }
132
138 protected function fillRow($set)
139 {
140 $this->tpl->setVariable('VAL_TITLE',$set['title']);
141 if(strlen($set['desc']))
142 {
143 $this->tpl->setVariable('VAL_DESC',$set['desc']);
144 }
145 $this->tpl->setVariable('TXT_PATHES',$this->lng->txt('pathes'));
146
147 foreach((array) $set['refs'] as $reference)
148 {
149 include_once './Services/Tree/classes/class.ilPathGUI.php';
150 $path = new ilPathGUI();
151
152 $this->tpl->setCurrentBlock('path');
153 $this->tpl->setVariable('VAL_ID',$reference);
154 $this->tpl->setVariable('VAL_PATH',$path->getPath(ROOT_FOLDER_ID, $reference));
155
156 if($reference == $this->getSelectedReference())
157 {
158 $this->tpl->setVariable('VAL_CHECKED','checked="checked"');
159 }
160
161 $this->tpl->parseCurrentBlock();
162 }
163 }
164}
const IL_COMP_SERVICE
__construct($a_parent_class, $a_parent_cmd, $a_type)
setSelectedReference($a_selected_reference)
Set selected reference.
static _lookupTitle($a_id)
lookup object title
static _lookupDescription($a_id)
lookup object description
Creates a path for a start and endnode.
static getPluginObject($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get plugin object.
lookupNameForId($a_ctype, $a_cname, $a_slot_id, $a_plugin_id)
Lookup name for id.
Class ilTable2GUI.
setEnableHeader($a_enableheader)
Set Enable Header.
addColumn($a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.
setShowRowsSelector($a_value)
Toggle rows-per-page selector.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
setData($a_data)
set table data @access public
setEnableTitle($a_enabletitle)
Set Enable Title.
setEnableNumInfo($a_val)
Set enable num info.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
setId($a_val)
Set id.
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
$r
Definition: example_031.php:79
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:40
$path
Definition: index.php:22
global $ilUser
Definition: imgupload.php:15