Revize 2146
Přidáno uživatelem David Raška před asi 11 roky(ů)
freenetis/branches/1.1/application/controllers/address_points.php | ||
---|---|---|
$members = array
|
||
(
|
||
NULL => '----- '.__('Select member').' -----'
|
||
) + arr::from_objects(ORM::factory('member')->get_all_members_to_dropdown());
|
||
) + Member_Model::select_list_grouped();
|
||
|
||
// form to group by type
|
||
$form = new Forge(url::base(TRUE).url::current(TRUE));
|
freenetis/branches/1.1/application/models/member.php | ||
---|---|---|
ORDER BY name
|
||
", User_Model::MAIN_USER);
|
||
}
|
||
|
||
/**
|
||
* Gets array of members for selectbox
|
||
*
|
||
* @return array[string]
|
||
*/
|
||
public static function select_list_grouped($optgroup = TRUE)
|
||
{
|
||
$list = array();
|
||
|
||
$assoc = ORM::factory('member', self::ASSOCIATION);
|
||
|
||
if ($optgroup)
|
||
$list[__('Association')][self::ASSOCIATION] = $assoc->name . ' (ID '.self::ASSOCIATION.')';
|
||
else
|
||
$list[self::ASSOCIATION] = $assoc->name . ' (ID '.self::ASSOCIATION.')';
|
||
|
||
$concat = "CONCAT(
|
||
IF(
|
||
CONCAT(users.name,' ',users.surname) = members.name,
|
||
CONCAT(users.surname,' ',users.name),
|
||
members.name
|
||
), ' (ID ',members.id,')')";
|
||
|
||
if ($optgroup)
|
||
{
|
||
$list[__('Members')] = $assoc
|
||
->join('users', array('members.id' => 'users.member_id'))
|
||
->where('members.id !=', self::ASSOCIATION)
|
||
->select_list('member_id', $concat, array('surname' => 'ASC', 'users.name' => 'ASC'));
|
||
}
|
||
else
|
||
{
|
||
$list += $assoc
|
||
->join('users', array('members.id' => 'users.member_id'))
|
||
->where('members.id !=', self::ASSOCIATION)
|
||
->select_list('member_id', $concat, array('surname' => 'ASC', 'users.name' => 'ASC'));
|
||
}
|
||
|
||
return $list;
|
||
}
|
||
|
||
/**
|
||
* Returns doubleentry account of member by given account attribute id
|
Také k dispozici: Unified diff
Nove:
- closes #733: Zvyrazneni sdruzeni (clena s ID 1) ve filtru adresnich bodu
- Do Member_Model pridana funkce select_list_grouped() pro ziskani clenu do selecboxu