cc-3936:
Refactored getUsers not to take multiple types of arguments.
This commit is contained in:
parent
996dcfd35f
commit
50de229258
|
@ -238,21 +238,17 @@ class Application_Model_User
|
|||
return $user;
|
||||
}
|
||||
|
||||
public static function getUsers($type, $search=null)
|
||||
public static function getUsers(array $type, $search=null)
|
||||
{
|
||||
$con = Propel::getConnection();
|
||||
|
||||
$sql_gen = "SELECT login AS value, login AS label, id as index FROM cc_subjs ";
|
||||
$sql = $sql_gen;
|
||||
|
||||
if (is_array($type)) {
|
||||
for ($i=0; $i<count($type); $i++) {
|
||||
$type[$i] = "type = '{$type[$i]}'";
|
||||
}
|
||||
$sql_type = join(" OR ", $type);
|
||||
} else {
|
||||
$sql_type = "type = {$type}";
|
||||
}
|
||||
$type = array_map( function($t) {
|
||||
return "type = '{$type[$i]}'";
|
||||
}, $type);
|
||||
$sql_type = join(" OR ", $type);
|
||||
|
||||
$sql = $sql_gen ." WHERE (". $sql_type.") ";
|
||||
|
||||
|
@ -345,16 +341,14 @@ class Application_Model_User
|
|||
|
||||
if (is_null($userinfo)) {
|
||||
return null;
|
||||
} else {
|
||||
try {
|
||||
return new self($userinfo->id);
|
||||
} catch (Exception $e) {
|
||||
//we get here if $userinfo->id is defined, but doesn't exist
|
||||
//in the database anymore.
|
||||
Zend_Auth::getInstance()->clearIdentity();
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
try {
|
||||
return new self($userinfo->id);
|
||||
} catch (Exception $e) {
|
||||
//we get here if $userinfo->id is defined, but doesn't exist
|
||||
//in the database anymore.
|
||||
Zend_Auth::getInstance()->clearIdentity();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue