ILIAS  Release_4_1_x_branch Revision 61804
 All Data Structures Namespaces Files Functions Variables Groups Pages
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 
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  parent::__construct($a_parent_class,$a_parent_cmd);
52  $this->type = $a_type;
53 
54  $this->lng = $lng;
55  $this->ctrl = $ilCtrl;
56 
57  $this->setTitle($this->lng->txt('obj_'.$this->type.'_duplicate'));
58  $ilUser->getPref('search_max_hits');
59 
60  $this->addColumn($this->lng->txt('search_title_description'),'title','99%');
61 
62  $this->setEnableHeader(true);
63  $this->setFormAction($ilCtrl->getFormAction($this->getParentObject()));
64  $this->setRowTemplate("tpl.obj_copy_search_result_row.html", "Services/Object");
65  $this->setEnableTitle(true);
66  $this->setEnableNumInfo(true);
67  $this->setDefaultOrderField('title');
68 
69  if($objDefinition->isContainer($this->type))
70  {
71  $this->addCommandButton('saveSource', $this->lng->txt('btn_next'));
72  }
73  else
74  {
75  $this->addCommandButton('saveSource', $this->lng->txt('obj_'.$this->type.'_duplicate'));
76  }
77 
78  $this->addCommandButton('cancel', $this->lng->txt('btn_back'));
79  }
80 
86  public function setSelectedReference($a_selected_reference)
87  {
88  $this->selected_reference = $a_selected_reference;
89  }
90 
95  public function getSelectedReference()
96  {
98  }
99 
105  public function parseSearchResults($a_res)
106  {
107  foreach($a_res as $obj_id => $references)
108  {
109  $r['title'] = ilObject::_lookupTitle($obj_id);
110  $r['desc'] = ilObject::_lookupDescription($obj_id);
111  $r['obj_id'] = $obj_id;
112  $r['refs'] = $references;
113 
114  $rows[] = $r;
115  }
116 
117  $this->setData($rows ? $rows : array());
118  }
119 
125  protected function fillRow($set)
126  {
127  $this->tpl->setVariable('VAL_TITLE',$set['title']);
128  if(strlen($set['desc']))
129  {
130  $this->tpl->setVariable('VAL_DESC',$set['desc']);
131  }
132  $this->tpl->setVariable('TXT_PATHES',$this->lng->txt('pathes'));
133 
134  foreach((array) $set['refs'] as $reference)
135  {
136  include_once './Services/Tree/classes/class.ilPathGUI.php';
137  $path = new ilPathGUI();
138 
139  $this->tpl->setCurrentBlock('path');
140  $this->tpl->setVariable('VAL_ID',$reference);
141  $this->tpl->setVariable('VAL_PATH',$path->getPath(ROOT_FOLDER_ID, $reference));
142 
143  if($reference == $this->getSelectedReference())
144  {
145  $this->tpl->setVariable('VAL_CHECKED','checked="checked"');
146  }
147 
148  $this->tpl->parseCurrentBlock();
149  }
150  }
151 }