XOOPS RMCommon Utilities  2.1.8.91RC
 All Classes Namespaces Files Functions Variables
textoptions.class.php
Go to the documentation of this file.
1 <?php
2 // $Id: textoptions.class.php 825 2011-12-09 00:06:11Z i.bitcero $
3 // --------------------------------------------------------------
4 // Red México Common Utilities
5 // A framework for Red México Modules
6 // Author: Eduardo Cortés <i.bitcero@gmail.com>
7 // Email: i.bitcero@gmail.com
8 // License: GPL 2.0
9 // --------------------------------------------------------------
10 
15 {
16  private $html = 0;
17  private $xcode = 0;
18  private $smiley = 0;
19  private $image = 0;
20  private $br = 0;
31  function __construct($caption, $html=0, $xcode=0, $image=0, $smiley=0, $br=0, $cols=5){
32  $this->setCaption($caption);
33  $this->html = $html;
34  $this->xcode = $xcode;
35  $this->smiley = $smiley;
36  $this->image = $image;
37  $this->br = $br;
38  $this->cols = $cols>5 ? 5 : ($cols <=0 ? 1 : $cols);
39  }
40 
41  public function html(){
42  return $this->html;
43  }
47  public function setHtml($val){
48  $this->html = $val;
49  }
50 
51  public function xcode(){
52  return $this->xcode;
53  }
57  public function setXcode($val){
58  $this->xcode = $val;
59  }
60 
61  public function image(){
62  return $this->image;
63  }
67  public function setImage($val){
68  $this->image = $val;
69  }
70 
71  public function smiley(){
72  return $this->smiley;
73  }
77  public function setSmiley($val){
78  $this->smiley = $val;
79  }
80 
81  public function br(){
82  return $this->br;
83  }
87  public function setBR($val){
88  $this->br = $val;
89  }
90 
91  public function cols(){
92  return $this->cols;
93  }
97  public function setCols($val){
98  $this->cols = $val;
99  }
100 
101  public function render(){
102 
103  $rtn = '<table cellspacing="2" cellpadding="2" border="0">'."\n<tr>";
104 
105  $cols = 1;
106  for ($i=1;$i<=5;$i++){
107 
108  if ($cols>$this->cols){
109  $rtn .= "</tr><tr>";
110  $cols = 1;
111  }
112  $rtn .="<td>";
113  if ($i==1){
114  $rtn .= '<label><input type="checkbox" name="dohtml" value="1"'.($this->html ? ' checked="checked"' : '')." /> ".__('Allow HTML','rmcommon')."</label>\n";
115  }elseif ($i==2){
116  $rtn .= '<label><input type="checkbox" name="doxcode" value="1"'.($this->xcode ? ' checked="checked"' : '')." /> ".__('Allow Xoops Code','rmcommon')."</label>\n";
117  }elseif ($i==3){
118  $rtn .= '<label><input type="checkbox" name="dosmiley" value="1"'.($this->smiley ? ' checked="checked"' : '')." /> ".__('Allow Smilies','rmcommon')."</label>\n";
119  }elseif ($i==4){
120  $rtn .= '<label><input type="checkbox" name="dobr" value="1"'.($this->br ? ' checked="checked"' : '')." /> ".__('Allow break lines','rmcommon')."</label>\n";
121  }elseif ($i==5){
122  $rtn .= '<label><input type="checkbox" name="doimage" value="1"'.($this->image ? ' checked="checked"' : '')." /> ".__('Do images','rmcommon')."</label>\n";
123  }
124  $rtn.="</td>";
125 
126  }
127  $rtn .= "</tr>\n</table>";
128 
129  return $rtn;
130 
131  }
132 
133 }