ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 
24 include_once './Services/Table/classes/class.ilTable2GUI.php';
25 require_once('./Services/Repository/classes/class.ilObjectPlugin.php');
26 
38 {
42  protected $ctrl;
43 
47  protected $user;
48 
52  protected $obj_definition;
53 
54  private $type = '';
55  private $selected_reference = null;
56 
63  public function __construct($a_parent_class, $a_parent_cmd, $a_type)
64  {
65  global $DIC;
66 
67  $this->user = $DIC->user();
68  $this->obj_definition = $DIC["objDefinition"];
69  $lng = $DIC->language();
70  $ilCtrl = $DIC->ctrl();
71  $ilUser = $DIC->user();
72  $objDefinition = $DIC["objDefinition"];
73 
74  $this->setId('obj_copy_' . $a_type);
75  parent::__construct($a_parent_class, $a_parent_cmd);
76  $this->type = $a_type;
77 
78  $this->lng = $lng;
79  $this->ctrl = $ilCtrl;
80 
81  if (!$objDefinition->isPlugin($this->type)) {
82  $title = $this->lng->txt('obj_' . $this->type . '_duplicate');
83  } else {
84  include_once "Services/Component/classes/class.ilPlugin.php";
85  $plugin = ilObjectPlugin::getRepoPluginObjectByType($this->type);
86  $title = $plugin->txt('obj_' . $this->type . '_duplicate');
87  }
88 
89  $this->setTitle($title);
90  $ilUser->getPref('search_max_hits');
91 
92  $this->addColumn($this->lng->txt('search_title_description'), 'title', '99%');
93 
94  $this->setEnableHeader(true);
95  $this->setRowTemplate("tpl.obj_copy_search_result_row.html", "Services/Object");
96  $this->setEnableTitle(true);
97  $this->setEnableNumInfo(true);
98  $this->setDefaultOrderField('title');
99  $this->setShowRowsSelector(true);
100 
101  if ($objDefinition->isContainer($this->type)) {
102  $this->addCommandButton('saveSource', $this->lng->txt('btn_next'));
103  } else {
104  $this->addCommandButton('saveSource', $title);
105  }
106 
107  $this->addCommandButton('cancel', $this->lng->txt('btn_back'));
108  }
109 
115  public function setSelectedReference($a_selected_reference)
116  {
117  $this->selected_reference = $a_selected_reference;
118  }
119 
124  public function getSelectedReference()
125  {
127  }
128 
134  public function parseSearchResults($a_res)
135  {
136  foreach ($a_res as $obj_id => $references) {
137  $r['title'] = ilObject::_lookupTitle($obj_id);
138  $r['desc'] = ilObject::_lookupDescription($obj_id);
139  $r['obj_id'] = $obj_id;
140  $r['refs'] = $references;
141 
142  $rows[] = $r;
143  }
144 
145  $this->setData($rows ? $rows : array());
146  }
147 
153  protected function fillRow($set)
154  {
155  $this->tpl->setVariable('VAL_TITLE', $set['title']);
156  if (strlen($set['desc'])) {
157  $this->tpl->setVariable('VAL_DESC', $set['desc']);
158  }
159  $this->tpl->setVariable('TXT_PATHES', $this->lng->txt('pathes'));
160 
161  foreach ((array) $set['refs'] as $reference) {
162  include_once './Services/Tree/classes/class.ilPathGUI.php';
163  $path = new ilPathGUI();
164 
165  $this->tpl->setCurrentBlock('path');
166  $this->tpl->setVariable('VAL_ID', $reference);
167  $this->tpl->setVariable('VAL_PATH', $path->getPath(ROOT_FOLDER_ID, $reference));
168 
169  if ($reference == $this->getSelectedReference()) {
170  $this->tpl->setVariable('VAL_CHECKED', 'checked="checked"');
171  }
172 
173  $this->tpl->parseCurrentBlock();
174  }
175  }
176 }
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
Creates a path for a start and endnode.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
global $DIC
Definition: saml.php:7
setEnableNumInfo($a_val)
Set enable num info.
static _lookupTitle($a_id)
lookup object title
setId($a_val)
Set id.
user()
Definition: user.php:4
global $ilCtrl
Definition: ilias.php:18
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
$a_type
Definition: workflow.php:92
$r
Definition: example_031.php:79
Class ilTable2GUI.
static _lookupDescription($a_id)
lookup object description
$ilUser
Definition: imgupload.php:18
static getRepoPluginObjectByType($type)
Return either a repoObject plugin or a orgunit extension plugin or null if the type is not a plugin...
setRowTemplate($a_template, $a_template_dir="")
Set row template.
Create styles array
The data for the language used.
setSelectedReference($a_selected_reference)
Set selected reference.
__construct($a_parent_class, $a_parent_cmd, $a_type)
$rows
Definition: xhr_table.php:10
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.
setEnableHeader($a_enableheader)
Set Enable Header.
setEnableTitle($a_enabletitle)
Set Enable Title.