start work on calendar sidebox hook

This commit is contained in:
Cornelius Weiß 2005-09-27 23:29:06 +00:00
parent ba79aa917f
commit 7bba0e916d
3 changed files with 48 additions and 1 deletions

View File

@ -38,7 +38,7 @@
$this->so =& CreateObject('resources.so_acl');
$this->permissions = $this->so->get_permissions($GLOBALS['egw_info']['user']['account_id'],true);
$this->egw_cats =& createobject('phpgwapi.categories');
$this->egw_cats = createobject('phpgwapi.categories','','resources');
$this->accounts = $GLOBALS['egw']->accounts->get_list();
$this->debug = False;

View File

@ -114,6 +114,10 @@ class resources_hooks
'type' => 'r',// one char type-identifiy for this resources
'icon' => 'calicon',//icon
'participants_header' => lang('resources'), // header of participants from this type
'cal_sidebox' => array(
'menu_title' => lang('Select resources'),
'file' => 'resources.ui_resources.get_calendar_sidebox'
)
);
}
}

View File

@ -33,6 +33,7 @@ class ui_resources
// print_r($GLOBALS['egw_info']); die();
$this->tmpl =& CreateObject('etemplate.etemplate','resources.show');
$this->bo =& CreateObject('resources.bo_resources');
$this->html =& $GLOBALS['egw']->html;
// $this->calui = CreateObject('resources.ui_calviews');
if(!@is_object($GLOBALS['egw']->js))
@ -459,5 +460,47 @@ class ui_resources
$this->tmpl->read('resources.resource_select');
$this->tmpl->exec('resources.ui_resources.select',$content,$sel_options,$no_button,$preserv,2);
}
/**
* get_calendar_sidebox
* get data für calendar sidebox
*
* @author Lukas Weiss <wnz_gh05t@users.sourceforge.net>
* @return array with: label=>link or array with text
*/
function get_calendar_sidebox($view_menuaction, $date='')
{
$selectbox_content = array(lang('Select resources'));
$selectbox_content[0] = lang('Select resources');
$cats = $this->bo->acl->get_cats(EGW_ACL_READ);
// this gets the resource-ids of the cats and implodes them to the array-key of the selectbox,
// so it is possible to select all resources of a category
foreach($cats as $cat_id => $cat_name)
{
$resources = $this->bo->so->search(array('cat_id' => $cat_id),'res_id');
foreach($resources as $res) $key .= ($key == "")?'r'.$res['res_id']:',r'.$res['res_id'];
$selectbox_content[$key] = $cat_name;
}
$selectbox = $this->html->select(
'owner',
'uical_select_resource',
$selectbox_content,
$no_lang=true,
$options='style="width: 165px;" name="res_id" onchange="load_cal(\''.
$GLOBALS['egw']->link('/index.php',array(
'menuaction' => $view_menuaction,
'date' => $date,
)).'\',\'uical_select_resource\');" id="uical_select_resource"',
$multiple=0
);
return array(
array(
'text' => $selectbox,
'no_lang' => True,
'link' => False
)
);
}
}