Commit b1a970d43f5480dfce550a5bc9a61d6b63cbd877

Authored by mukhtar
1 parent b081ba6b

moved getGroup function into groupmanager

- modified functions as such


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@278 c91229c3-7414-0410-bfa2-8a42b809f60b
lib/administration/UserManager.inc
@@ -14,7 +14,7 @@ require_once("$default->owl_fs_root/lib/authentication/class.AuthLdap.php"); @@ -14,7 +14,7 @@ require_once("$default->owl_fs_root/lib/authentication/class.AuthLdap.php");
14 */ 14 */
15 15
16 //common admin functions that dont really form part of class 16 //common admin functions that dont really form part of class
17 -require ("$default->owl_fs_root/lib/administration/adminLib.inc"); 17 +require_once ("$default->owl_fs_root/lib/administration/GroupManager.inc");
18 18
19 class UserManager 19 class UserManager
20 { 20 {
@@ -547,6 +547,7 @@ class UserManager @@ -547,6 +547,7 @@ class UserManager
547 global $default; 547 global $default;
548 $groups = array(); 548 $groups = array();
549 $sql = new Owl_DB; 549 $sql = new Owl_DB;
  550 + $groupName = new GroupManager;
550 551
551 552
552 // check that username exists if it does'nt return false 553 // check that username exists if it does'nt return false
@@ -568,7 +569,7 @@ class UserManager @@ -568,7 +569,7 @@ class UserManager
568 while($sql->next_record()) 569 while($sql->next_record())
569 { 570 {
570 $groups[$i] = array("id" => $sql->f("group_id"), 571 $groups[$i] = array("id" => $sql->f("group_id"),
571 - "name" => $this->getGroupName($sql->f("group_id")) 572 + "name" => $groupName->getGroupName($sql->f("group_id"))
572 ); 573 );
573 $i++; 574 $i++;
574 } 575 }
@@ -576,47 +577,7 @@ class UserManager @@ -576,47 +577,7 @@ class UserManager
576 return $groups; 577 return $groups;
577 } 578 }
578 579
579 - /*  
580 - * Function getGroupName($groupID)  
581 - *  
582 - * gets the id of a user using their username  
583 - *  
584 - * @param $username  
585 - * The username for which we want its ID  
586 - * @return char  
587 - * name of group  
588 - */  
589 -  
590 - function getGroupName($groupID)  
591 - {  
592 - global $default;  
593 -  
594 - $sql = new Owl_DB;  
595 -  
596 -  
597 - // check that username exists if it does'nt return false  
598 - $query = "SELECT name FROM $default->owl_groups_table WHERE id = '" . $groupID . "'";  
599 - $sql->query($query);  
600 - $rows = $sql->num_rows($sql);  
601 - // go into record set  
602 - $sql->next_record();  
603 -  
604 - // store the id in a variable  
605 - $name = $sql->f("name");  
606 -  
607 - // if no entry..group name does'nt exist  
608 - if ($rows == 0)  
609 - {  
610 - // duplicate username  
611 - $default->errorMessage = "UserManager::The group does not exist<br>";  
612 - $default->log->debug($default->errorMessage);  
613 - return false;  
614 - }  
615 - else  
616 - {  
617 - return $name;  
618 - }  
619 - } 580 +
620 581
621 } 582 }
622 ?> 583 ?>