• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

Services/Utilities/classes/class.ilConfirmationGUI.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003         +-----------------------------------------------------------------------------+
00004         | ILIAS open source                                                           |
00005         +-----------------------------------------------------------------------------+
00006         | Copyright (c) 1998-2005 ILIAS open source, University of Cologne            |
00007         |                                                                             |
00008         | This program is free software; you can redistribute it and/or               |
00009         | modify it under the terms of the GNU General Public License                 |
00010         | as published by the Free Software Foundation; either version 2              |
00011         | of the License, or (at your option) any later version.                      |
00012         |                                                                             |
00013         | This program is distributed in the hope that it will be useful,             |
00014         | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
00015         | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
00016         | GNU General Public License for more details.                                |
00017         |                                                                             |
00018         | You should have received a copy of the GNU General Public License           |
00019         | along with this program; if not, write to the Free Software                 |
00020         | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
00021         +-----------------------------------------------------------------------------+
00022 */
00023 
00024 require_once("Services/Table/classes/class.ilTableGUI.php");
00025 
00034 class ilConfirmationGUI
00035 {
00036         private $hidden_item = array();
00037         private $item = array();
00038         private $use_images = false;
00039         
00044         public function __construct()
00045         {
00046         }
00047 
00048         final public function setFormAction($a_form_action)
00049         {
00050                 $this->form_action = $a_form_action;
00051         }
00052         
00053         final public function getFormAction()
00054         {
00055                 return $this->form_action;
00056         }
00057 
00063         function setHeaderText($a_headertext)
00064         {
00065                 $this->headertext = $a_headertext;
00066         }
00067 
00073         function getHeaderText()
00074         {
00075                 return $this->headertext;
00076         }
00077 
00078         final public function setCancel($a_txt, $a_cmd)
00079         {
00080                 $this->cancel_txt = $a_txt;
00081                 $this->cancel_cmd = $a_cmd;
00082         }
00083 
00084         final public function setConfirm($a_txt, $a_cmd)
00085         {
00086                 $this->confirm_txt = $a_txt;
00087                 $this->confirm_cmd = $a_cmd;
00088         }
00089 
00098         public function addItem($a_post_var, $a_id, $a_text, $a_img = "")
00099         {
00100                 $this->item[] = array("var" => $a_post_var, "id" => $a_id,
00101                         "text" => $a_text, "img" => $a_img);
00102                 if ($a_img != "")
00103                 {
00104                         $this->use_images = true;
00105                 }
00106         }
00107         
00114         public function addHiddenItem($a_post_var, $a_value)
00115         {
00116                 $this->hidden_item[] = array("var" => $a_post_var, "value" => $a_value);
00117         }
00118 
00124         final public function getHTML()
00125         {
00126                 global $lng;
00127                 
00128                 $tpl = new ilTemplate("tpl.confirmation.html", true, true, "Services/Utilities");
00129 
00130                 // cancel/confirm buttons
00131                 $tpl->setCurrentBlock("cmd");
00132                 $tpl->setVariable("TXT_CMD", $this->confirm_txt);
00133                 $tpl->setVariable("CMD", $this->confirm_cmd);
00134                 $tpl->parseCurrentBlock();
00135                 $tpl->setCurrentBlock("cmd");
00136                 $tpl->setVariable("TXT_CMD", $this->cancel_txt);
00137                 $tpl->setVariable("CMD", $this->cancel_cmd);
00138                 $tpl->parseCurrentBlock();
00139                 
00140                 // output items
00141                 foreach ($this->item as $item)
00142                 {
00143                         if ($this->use_images)
00144                         {
00145                                 if ($item["img"] != "")
00146                                 {
00147                                         $tpl->setCurrentBlock("img_cell");
00148                                         $tpl->setVariable("IMG_ITEM", $item["img"]);
00149                                         $tpl->parseCurrentBlock();
00150                                 }
00151                                 else
00152                                 {
00153                                         $tpl->touchBlock("blank_cell");
00154                                 }
00155                         }
00156                         $tpl->setCurrentBlock("item_row");
00157                         $this->fillRowColor($tpl);
00158                         $tpl->setVariable("TXT_ITEM", $item["text"]);
00159                         $tpl->setVariable("VAR_ITEM", $item["var"]);
00160                         $tpl->setVariable("ID", $item["id"]);
00161                         $tpl->parseCurrentBlock();
00162                 }
00163                 
00164                 foreach ($this->hidden_item as $hidden_item)
00165                 {
00166                         $tpl->setCurrentBlock("hidden_item_row");
00167                         $tpl->setVariable("VAR_HIDDEN_VAR", $hidden_item["var"]);
00168                         $tpl->setVariable("VAR_HIDDEN_VALUE", $hidden_item["value"]);
00169                         $tpl->parseCurrentBlock();
00170                 }
00171                 
00172                 $tpl->setVariable("FORMACTION", $this->getFormAction());
00173                 $tpl->setVariable("TXT_HEADER", $this->getHeaderText());
00174                 
00175                 if ($this->use_images)
00176                 {
00177                         $tpl->setVariable("ROW_SPAN", 2);
00178                 }
00179                 else
00180                 {
00181                         $tpl->setVariable("ROW_SPAN", 1);
00182                 }
00183         
00184                 return $tpl->get();
00185         }
00186 
00187         final protected function fillRowColor(&$a_tpl, $a_placeholder = "CSS_ROW")
00188         {
00189                 $this->css_row = ($this->css_row != "tblrow1")
00190                         ? "tblrow1"
00191                         : "tblrow2";
00192                 $a_tpl->setVariable($a_placeholder, $this->css_row);
00193         }
00194 
00195 }
00196 ?>

Generated on Fri Dec 13 2013 17:57:02 for ILIAS Release_3_9_x_branch .rev 46835 by  doxygen 1.7.1