54 if (isset($_REQUEST[$name])) $this->_select = $_REQUEST[$name];
55 $this->_multi = $multi;
56 $this->_showtype =
$type;
58 $this->_onlyuser = $user;
60 if (isset($_REQUEST[$this->
getName()])){
61 $this->_select = $_REQUEST[$this->
getName()];
63 $this->_select = $select;
73 if ($value==0 || $value==1){
74 $this->_multi = $value;
92 if (is_array($value)){
93 $this->_select = $value;
95 $this->_select = explode(
',',$value);
112 if ($value==0 || $value==1) $this->_showtype = $value;
128 if ($value>0) $this->_cols = $value;
142 $db = EXMDatabase::get();
143 $sql =
"SELECT * FROM ".$db->prefix(
"avatar");
144 if ($this->_onlyuser){
147 $useravatar = $exmUser->getVar(
'user_avatar');
148 $sql .=
" WHERE avatar_display='1' AND (avatar_type='0' OR (avatar_type='1' AND avatar_file='$useravatar'))";
152 $sql .=
" ORDER BY avatar_name";
157 $typeinput = $this->_multi ?
'checkbox' :
'radio';
160 if ($this->_showtype){
161 $rtn =
"<div style='height: 200px; overflow: auto;'><table cellspacing='2' cellpadding='3' border='0'>";
163 $rtn .=
"<td align='left'><label><input type='$typeinput' name='$name' id='$name' value=''";
164 if (empty($this->_select))
$rtn .=
" checked='checked'";
165 $rtn .=
">"._RMS_CF_NOAVATAR.
"</label></td>";
169 if ($col>$this->_cols){
174 $rtn .=
"<td align='left'><label><img src='".ABSURL.
"/uploads/avatars/$row[avatar_file]' align='absmiddle' /> <input type='$typeinput' name='$name' id='$name' value='$row[avatar_file]'";
175 if (is_array($this->_select)){
176 if (in_array($row[
'avatar_file'], $this->_select)){
177 $rtn .=
" checked='checked'";
180 $rtn .=
">$row[avatar_name]</label>";
188 $rtn .=
"</table></div>";
190 $rtn =
"<script type='text/javascript'>
191 function showImageAvatar(){
193 var img = sel.options[sel.selectedIndex].value;
194 div = $('avatarimg');
195 div.innerHTML = \"<img src='".ABSURL.
"/uploads/avatars/\"+img+\"' />\";
200 $rtn .=
"<div id='avatarimg' style='float: right;'>";
201 if (count($this->_select)>0){
202 $rtn .=
"<img src='".ABSURL.
"/uploads/avatars/".$this->_select[0].
"' border='0' alt='' />";
205 <select name='$name' id='".$this->id().
"' onchange='showImageAvatar();'";
206 $rtn .= $this->_multi ?
" multiple='multiple' size='5'" :
"";
207 $rtn .=
"><option value='0'";
208 if (is_array($this->_select)){
209 if (in_array(0, $this->_select)){
210 $rtn .=
" selected='selected'";
213 $rtn .=
" selected='selected'";
216 $rtn .=
">"._RMS_CF_ALL.
"</option>";
219 $rtn .=
"<option value='$row[avatar_file]'";
220 if (is_array($this->_select)){
221 if (in_array($row[
'avatar_file'], $this->_select)){
222 $rtn .=
" selected='selected'";
225 $rtn .=
">".$row[
'avatar_name'].
"</option>";