##// END OF EJS Templates
modificaciones del componente usuarios. Reduccion de codigo
arturo -
r4:5
parent child
Show More
@@ -533,10 +533,9
533 533 $path = implode(DS, $url);
534 534
535 535 $flag = FALSE;
536 $result = $user->getAllUsers();
537 $data_list = $result->fetchAll();
536 $data_list = $user->getAllUsers();
538 537 foreach($data_list as $userdata){
539 if(strtolower($data_user['username']) == strtolower($userdata['username'])){$flag = TRUE; break;}
538 if(strtolower($data_user['username']) == strtolower($userdata->username)){$flag = TRUE; break;}
540 539 }
541 540
542 541 if($flag === FALSE){
@@ -200,8 +200,6
200 200 return $cadena;
201 201 }
202 202
203
204
205 203 public function getStringUser($iduser){
206 204 //realizamos la consulta de todos los items
207 205 $query = $this->db->prepare('SELECT u.* FROM sis_user AS u WHERE u.iduser = "'.$iduser.'" ');
@@ -240,16 +238,6
240 238 return array($consulta,$paginas,$navegador);
241 239 }
242 240
243 function addUser($username, $password, $data_user){
244 $query = "INSERT INTO sis_user( username, password, date_create, firstname, lastname, email,"
245 ." photo, usertype, state ) VALUES ( '$username' , md5('$password'), '".date("Y-m-d H:i:s")."',"
246 ." '".$data_user['firstname']."', '".$data_user['lastname']."', '".$data_user['email']."',"
247 ." '".$data_user['urlphoto']."', 1, 4)";
248 $result = $this->db->prepare($query);
249 $result->execute();
250 return $result;
251 }
252
253 241 function editUser($user){
254 242 $query = "SELECT * FROM sis_user WHERE iduser = '$user'";
255 243 $result = $this->db->prepare($query);
@@ -257,14 +245,6
257 245 return $result;
258 246 }
259 247
260 function updateUser($user, $firstname, $lastname, $state){
261 $query = "UPDATE sis_user SET firstname = '$firstname', lastname = '$lastname'"
262 .", state = $state WHERE iduser = $user";
263 $result = $this->db->prepare($query);
264 $result->execute();
265 return $result;
266 }
267
268 248 function delUser($user){
269 249 $query = "UPDATE sis_user SET state = 3 WHERE iduser = $user";
270 250 $result = $this->db->prepare($query);
@@ -287,10 +267,10
287 267 }
288 268
289 269 public function getAllUsers(){
290 $query = "SELECT username FROM sis_user WHERE usertype = 1";
291 $result = $this->db->prepare($query);
292 $result->execute();
293 return $result;
270 $str_query = "SELECT * FROM ".$this->tableName." WHERE usertype = 1";
271 $this->setQuery($str_query);
272 $query = $this->loadObjectList();
273 return $query;
294 274 }
295 275 }
296 276 ?>
@@ -1,5 +1,5
1 1 <?php
2 $html_select_pag = '<select onchange="window.location='.chr(39).'index.php?option=com_users&controller=Users&action=getUsers&inicio='.chr(39).'+this.value">';
2 $html_select_pag = '<select onchange="window.location='.chr(39).'index.php?option=com_users&controller=Users&action=dolist&inicio='.chr(39).'+this.value">';
3 3
4 4 $j = count($paginas);
5 5 for($i=0;$i<$j;$i++){
@@ -13,14 +13,14
13 13 $html_select_pag .= "</select>";
14 14
15 15 $html_pagination = '<ul class="mnu_pagination">';
16 $html_pagination .= '<li><a href="index.php?option=com_users&controller=Users&action=getUsers&inicio='.$navegador["fin"].'">';
16 $html_pagination .= '<li><a href="index.php?option=com_users&controller=Users&action=dolist&inicio='.$navegador["fin"].'">';
17 17 $html_pagination .= "Last</a></li>";
18 $html_pagination .= '<li><a href="index.php?option=com_users&controller=Users&action=getUsers&inicio='.$navegador["siguiente"].'">';
18 $html_pagination .= '<li><a href="index.php?option=com_users&controller=Users&action=dolist&inicio='.$navegador["siguiente"].'">';
19 19 $html_pagination .= "Next</a></li>";
20 20 $html_pagination .= '<li class="pages">Page'.$html_select_pag.'</li>';
21 $html_pagination .= '<li><a href="index.php?option=com_users&controller=Users&action=getUsers&inicio='.$navegador["anterior"].'">';
21 $html_pagination .= '<li><a href="index.php?option=com_users&controller=Users&action=dolist&inicio='.$navegador["anterior"].'">';
22 22 $html_pagination .= "Prev</a></li>";
23 $html_pagination .= '<li><a href="index.php?option=com_users&controller=Users&action=getUsers&inicio='.$navegador["inicio"].'">';
23 $html_pagination .= '<li><a href="index.php?option=com_users&controller=Users&action=dolist&inicio='.$navegador["inicio"].'">';
24 24 $html_pagination .= "Start</a></li>";
25 25 $html_pagination .= '</ul><div style="clear:both"></div>';
26 26 ?>
@@ -89,7 +89,7
89 89 <td align="center"><?php echo $datos_usuario['firstname']; ?></td>
90 90 <td align="center">
91 91 <?php if($datos_usuario['state'] == 1){ ?>
92 <img src="../imagenes/usractive.jpeg" alt="Active" border="0" />
92 <img src="images/system/tick.png" alt="Active" border="0" />
93 93 <?php } ?>
94 94 <?php if($datos_usuario['state'] == 2){ ?>
95 95 <img src="../imagenes/b_locked.png" alt="Locked" border="0" />
General Comments 0
You need to be logged in to leave comments. Login now