ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilImageFileInputGUI.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2007 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 
32 {
33 
40  function __construct($a_title = "", $a_postvar = "")
41  {
42  parent::__construct($a_title, $a_postvar);
43  $this->setType("image_file");
44  $this->setSuffixes(array("jpg", "jpeg", "png", "gif"));
45  }
46 
52  function setImage($a_image)
53  {
54  $this->image = $a_image;
55  }
56 
62  function getImage()
63  {
64  return $this->image;
65  }
66 
72  function setAlt($a_alt)
73  {
74  $this->alt = $a_alt;
75  }
76 
82  function getAlt()
83  {
84  return $this->alt;
85  }
86 
90  function insert(&$a_tpl)
91  {
92  global $lng;
93 
94  $this->outputSuffixes($a_tpl, "allowed_image_suffixes");
95 
96  if ($this->getImage() != "")
97  {
98  $a_tpl->setCurrentBlock("image");
99  $a_tpl->setVariable("SRC_IMAGE", $this->getImage());
100  $a_tpl->setVariable("ALT_IMAGE", $this->getAlt());
101  $a_tpl->setVariable("POST_VAR_D", $this->getPostVar());
102  $a_tpl->setVariable("TXT_DELETE_EXISTING",
103  $lng->txt("delete_existing_file"));
104  $a_tpl->parseCurrentBlock();
105  }
106 
107  $a_tpl->setCurrentBlock("prop_image_file");
108  $a_tpl->setVariable("POST_VAR", $this->getPostVar());
109  $a_tpl->setVariable("ID", $this->getFieldId());
110  $a_tpl->setVariable("TXT_MAX_SIZE", $lng->txt("file_notice")." ".
111  $this->getMaxFileSizeString());
112  $a_tpl->parseCurrentBlock();
113  }
114 
118  function getDeletionFlag()
119  {
120  if ($_POST[$this->getPostVar()."_delete"])
121  {
122  return true;
123  }
124  return false;
125  }
126 
127 }