resources: allow to retrieve the elements of the resources sidebox calendar elements only and not as full html

This commit is contained in:
Klaus Leithoff 2010-10-13 07:15:09 +00:00
parent a104512988
commit 0aaf531ec7

View File

@ -479,7 +479,7 @@ class ui_resources
* get data für calendar sidebox * get data für calendar sidebox
* *
* @author Lukas Weiss <wnz_gh05t@users.sourceforge.net> * @author Lukas Weiss <wnz_gh05t@users.sourceforge.net>
* @param array $param with keys menuaction, owner and optional date * @param array $param with keys menuaction, owner and optional date and return_array
* @return array with: label=>link or array with text * @return array with: label=>link or array with text
*/ */
function get_calendar_sidebox($param) function get_calendar_sidebox($param)
@ -487,6 +487,12 @@ class ui_resources
$cats = $this->bo->acl->get_cats(EGW_ACL_READ); $cats = $this->bo->acl->get_cats(EGW_ACL_READ);
if (!$cats) return array(); if (!$cats) return array();
if(array_key_exists('return_array', $param))
{
$return_array = $param['return_array'];
unset($param['return_array']);
}
$owners = explode(',',$param['owner']); $owners = explode(',',$param['owner']);
unset($param['owner']); unset($param['owner']);
$res_cats = $selected = array(); $res_cats = $selected = array();
@ -529,22 +535,29 @@ class ui_resources
$resources['r'.$data['res_id']] = $data['name']; $resources['r'.$data['res_id']] = $data['name'];
} }
} }
$selectbox = html::select( if(!isset($return_array))
'owner', {
$selected, $selectbox = html::select(
array_merge($resources,$res_cats), 'owner',
$no_lang=true, $selected,
$options='style="width: 100%;" onchange="load_cal(\''. array_merge($resources,$res_cats),
egw::link('/index.php',$param,false).'\',\'uical_select_resource\');" id="uical_select_resource"', $no_lang=true,
$multiple=count($selected) ? 4 : 0 $options='style="width: 100%;" onchange="load_cal(\''.
); egw::link('/index.php',$param,false).'\',\'uical_select_resource\');" id="uical_select_resource"',
return array( $multiple=count($selected) ? 4 : 0
array( );
'text' => $selectbox, return array(
'no_lang' => True, array(
'link' => False 'text' => $selectbox,
) 'no_lang' => True,
); 'link' => False
)
);
}
else
{
return array_merge($resources,$res_cats);
}
} }
} }