1<?php 2 3/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */ 4 5include_once('Services/Table/classes/class.ilTable2GUI.php'); 6include_once("./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php"); 7 8/** 9 * Class ilChatroomSmiliesTableGUI 10 * Prepares table rows and fills them. 11 * @author Andreas Kordosz <akordosz@databay.de> 12 * @version $Id$ 13 * @ingroup ModulesChatroom 14 */ 15class ilChatroomSmiliesTableGUI extends ilTable2GUI 16{ 17 private $gui = null; 18 19 /** 20 * Constructor 21 * Prepares smilies table. 22 * @param ilObjChatroomAdminGUI $a_ref 23 * @param string $cmd 24 */ 25 public function __construct($a_ref, $cmd) 26 { 27 parent::__construct($a_ref, $cmd); 28 29 $this->gui = $a_ref; 30 31 $this->setTitle($this->lng->txt('chatroom_available_smilies')); 32 $this->setId('chatroom_smilies_tbl'); 33 34 $this->addColumn('', 'checkbox', '2%', true); 35 $this->addColumn($this->lng->txt('chatroom_smiley_image'), '', '28%'); 36 $this->addColumn($this->lng->txt('chatroom_smiley_keyword'), 'keyword', '55%'); 37 $this->addColumn($this->lng->txt('actions'), '', '15%'); 38 39 $this->setFormAction($this->ctrl->getFormAction($a_ref)); 40 $this->setRowTemplate('tpl.chatroom_smiley_list_row.html', 'Modules/Chatroom'); 41 $this->setSelectAllCheckbox('smiley_id'); 42 43 $this->addMultiCommand( 44 "smiley-deleteMultipleObject", 45 $this->lng->txt("chatroom_delete_selected") 46 ); 47 } 48 49 /** 50 * Fills table rows with content from $a_set. 51 * @param array $a_set 52 */ 53 public function fillRow($a_set) 54 { 55 $this->tpl->setVariable('VAL_SMILEY_ID', $a_set['smiley_id']); 56 $this->tpl->setVariable('VAL_SMILEY_PATH', $a_set['smiley_fullpath']); 57 $this->tpl->setVariable('VAL_SMILEY_KEYWORDS', $a_set['smiley_keywords']); 58 $this->tpl->setVariable( 59 'VAL_SMILEY_KEYWORDS_NONL', 60 str_replace("\n", "", $a_set['smiley_keywords']) 61 ); 62 $this->tpl->setVariable( 63 'VAL_SORTING_TEXTINPUT', 64 ilUtil::formInput( 65 'sorting[' . $a_set['id'] . ']', 66 $a_set['sorting'] 67 ) 68 ); 69 70 $this->ctrl->setParameter($this->gui, 'topic_id', $a_set['id']); 71 72 $current_selection_list = new ilAdvancedSelectionListGUI(); 73 $current_selection_list->setListTitle($this->lng->txt("actions")); 74 $current_selection_list->setId("act_" . $a_set['smiley_id']); 75 76 $current_selection_list->addItem( 77 $this->lng->txt("edit"), 78 '', 79 $this->ctrl->getLinkTarget($this->gui, 'smiley-showEditSmileyEntryFormObject') . 80 "&smiley_id=" . $a_set['smiley_id'] 81 ); 82 $current_selection_list->addItem( 83 $this->lng->txt("delete"), 84 '', 85 $this->ctrl->getLinkTarget($this->gui, 'smiley-showDeleteSmileyFormObject') . 86 "&smiley_id=" . $a_set['smiley_id'] 87 ); 88 89 $this->tpl->setVariable('VAL_ACTIONS', $current_selection_list->getHTML()); 90 } 91} 92