ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilECSCategoryMappingTableGUI.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2006 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 
36 {
41  public function __construct($a_parent_obj,$a_parent_cmd)
42  {
43  global $lng,$ilCtrl;
44 
45  $this->lng = $lng;
46  $this->ctrl = $ilCtrl;
47 
48  parent::__construct($a_parent_obj,$a_parent_cmd);
49  $this->addColumn('','f','1px');
50  $this->addColumn($this->lng->txt('obj_cat'),'category','40%');
51  $this->addColumn($this->lng->txt('ecs_cat_mapping_type'),'kind','50%');
52  $this->addColumn('','edit','10%');
53  $this->setRowTemplate('tpl.rule_row.html','Services/WebServices/ECS');
54  $this->setDefaultOrderField('title');
55  $this->setDefaultOrderDirection('asc');
56  $this->setFormAction($this->ctrl->getFormAction($a_parent_obj));
57  $this->setSelectAllCheckbox('rules');
58  $this->setTitle($this->lng->txt('ecs_tbl_active_rules'));
59  $this->addMultiCommand('deleteCategoryMappings',$this->lng->txt('delete'));
60  }
61 
67  public function fillRow($a_set)
68  {
69  $this->tpl->setVariable('VAL_ID',$a_set['id']);
70  $this->tpl->setVariable('TXT_ID',$this->lng->txt('ecs_import_id'));
71  $this->tpl->setVariable('VAL_CAT_ID',$a_set['category_id']);
72  $this->tpl->setVariable('TXT_TITLE',$this->lng->txt('title'));
73  $this->tpl->setVariable('VAL_CAT_TITLE',$a_set['category']);
74  $this->tpl->setVariable('VAL_CONDITION',$a_set['kind']);
75  $this->tpl->setVariable('TXT_EDIT',$this->lng->txt('edit'));
76  $this->tpl->setVariable('PATH',$this->buildPath($a_set['category_id']));
77 
78  $this->ctrl->setParameterByClass(get_class($this->getParentObject()),'rule_id',$a_set['id']);
79  $this->tpl->setVariable('EDIT_LINK',$this->ctrl->getLinkTargetByClass(get_class($this->getParentObject()),'editCategoryMapping'));
80  $this->ctrl->clearParametersByClass(get_class($this->getParentObject()));
81  }
82 
88  public function parse($a_rules)
89  {
90  foreach($a_rules as $rule)
91  {
92  $tmp_arr['id'] = $rule->getMappingId();
93  $tmp_arr['category_id'] = $rule->getContainerId();
94  $tmp_arr['category'] = ilObject::_lookupTitle(ilObject::_lookupObjId($rule->getContainerId()));
95  $tmp_arr['kind'] = $rule->conditionToString();
96 
97  $content[] = $tmp_arr;
98  }
99  $this->setData($content ? $content : array());
100  }
101 
102  private function buildPath($a_ref_id)
103  {
104  $loc = new ilLocatorGUI();
105  $loc->setTextOnly(false);
106  $loc->addContextItems($a_ref_id);
107 
108  return $loc->getHTML();
109  }
110 
111 }
112 ?>