egroupware_official/resources/inc/class.resources_hooks.inc.php

135 lines
4.4 KiB
PHP
Raw Normal View History

2005-02-23 12:48:59 +01:00
<?php
/**
2005-11-11 00:35:55 +01:00
* eGroupWare - resources
* General hook object for resources
* It encapsulats all the diffent hook methods
*
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
2005-11-11 00:35:55 +01:00
* @package resources
* @link http://www.egroupware.org
* @version $Id$
*/
/**
* General hook object for resources
* It encapsulats all the diffent hook methods
* @package resources
*/
2005-02-25 12:35:51 +01:00
class resources_hooks
2005-02-23 12:48:59 +01:00
{
2005-02-25 12:35:51 +01:00
function admin_prefs_sidebox($args)
2005-02-23 12:48:59 +01:00
{
$this->acl =& CreateObject('resources.bo_acl');
2008-04-20 21:37:12 +02:00
2005-02-23 12:48:59 +01:00
$appname = 'resources';
$location = is_array($args) ? $args['location'] : $args;
2008-04-20 21:37:12 +02:00
2005-02-23 12:48:59 +01:00
if ($location == 'sidebox_menu')
{
2005-06-12 15:14:46 +02:00
$title = $GLOBALS['egw_info']['apps']['resources']['title'].' '.lang('Menu');
$file[] = array(
'text' => lang('resources list'),
'no_lang' => true,
'link' => $GLOBALS['egw']->link('/index.php',array('menuaction' => 'resources.ui_resources.index' )),
2008-04-20 21:37:12 +02:00
// 'icon' =>
2005-06-12 15:14:46 +02:00
);
2008-04-20 21:37:12 +02:00
if($this->acl->get_cats(EGW_ACL_ADD))
{
$file[] = array(
2005-06-12 15:14:46 +02:00
'text' => '<a class="textSidebox" href="'.$GLOBALS['egw']->link('/index.php',array('menuaction' => 'resources.ui_resources.edit')).
2008-04-20 21:37:12 +02:00
'" onclick="window.open(this.href,\'_blank\',\'dependent=yes,width=800,height=600,scrollbars=yes,status=yes\');
2005-06-12 15:14:46 +02:00
return false;">'.lang('add resource').'</a>',
'no_lang' => true,
'link' => false
);
}
// $file[] = array(
// 'text' => lang('planer'),
// 'no_lang' => true,
// 'link' => $GLOBALS['egw']->link('/index.php',array('menuaction' => 'resources.ui_calviews.planer' )),
2008-04-20 21:37:12 +02:00
// 'icon' =>
// );
2005-06-12 15:14:46 +02:00
display_sidebox($appname,$title,$file);
2005-02-23 12:48:59 +01:00
}
/* if ($GLOBALS['egw_info']['user']['apps']['preferences'] && $location != 'admin')
2005-02-23 12:48:59 +01:00
{
$file = array(
'Preferences' => $GLOBALS['egw']->link('/preferences/preferences.php','appname='.$appname),
'Grant Access' => $GLOBALS['egw']->link('/index.php','menuaction=preferences.uiaclprefs.index&acl_app='.$appname),
'Edit Categories' => $GLOBALS['egw']->link('/index.php','menuaction=preferences.uicategories.index&cats_app=' . $appname . '&cats_level=True&global_cats=True')
2005-02-23 12:48:59 +01:00
);
if ($location == 'preferences')
{
display_section($appname,$file);
}
else
{
display_sidebox($appname,lang('Preferences'),$file);
}
}
*/
if ($GLOBALS['egw_info']['user']['apps']['admin'] && $location != 'preferences')
2005-02-23 12:48:59 +01:00
{
$file = Array(
'Global Categories' => $GLOBALS['egw']->link('/index.php',array(
2005-02-23 12:48:59 +01:00
'menuaction' => 'admin.uicategories.index',
'appname' => $appname,
'global_cats'=> true)),
'Configure Access Permissions' => $GLOBALS['egw']->link('/index.php',
'menuaction=resources.ui_acl.acllist'),
'Custom Fields'=>$GLOBALS['egw']->link('/index.php',
'menuaction=admin.customfields.edit&appname=resources'),
2005-02-23 12:48:59 +01:00
);
if ($location == 'admin')
{
display_section($appname,$file);
}
else
{
display_sidebox($appname,lang('Admin'),$file);
}
}
2005-02-25 09:55:37 +01:00
}
2008-04-20 21:37:12 +02:00
2005-02-25 09:55:37 +01:00
function search_link($args)
{
2005-06-12 11:56:49 +02:00
return array(
'query' => 'resources.bo_resources.link_query',
'title' => 'resources.bo_resources.link_title',
'titles' => 'resources.bo_resources.link_titles',
'view' => array(
'menuaction' => 'resources.ui_resources.show'
),
'view_id' => 'res_id',
'view_popup' => '850x600',
'view_list' => 'resources.ui_resources.index',
'add' => array(
'menuaction' => 'resources.ui_resources.edit',
),
'add_app' => 'link_app',
2008-04-20 21:37:12 +02:00
'add_id' => 'link_id',
'add_popup' => '800x600',
'find_extra' => array('name_preg' => '/^(?(?=^.picture.jpg$)|.+)$/'), // remove pictures from regular attachment list
2005-02-25 12:15:27 +01:00
);
2005-02-23 12:48:59 +01:00
}
2005-06-12 09:15:13 +02:00
function calendar_resources($args)
{
2008-04-20 21:37:12 +02:00
return array(
2005-09-20 23:54:08 +02:00
'widget' => 'resources_select',// widget to use for the selection of resources
'info' => 'resources.bo_resources.get_calendar_info',// info method, returns array with id, type & name for a given id
'max_quantity' => 'useable',// if set, key for max. quantity in array returned by info method
'new_status' => 'resources.bo_resources.get_calendar_new_status',// method returning the status for new items, else 'U' is used
'type' => 'r',// one char type-identifiy for this resources
2008-04-20 21:37:12 +02:00
'icon' => 'calicon',//icon
2005-09-20 23:54:08 +02:00
'participants_header' => lang('resources'), // header of participants from this type
2005-09-28 01:29:06 +02:00
'cal_sidebox' => array(
'menu_title' => lang('Select resources'),
'file' => 'resources.ui_resources.get_calendar_sidebox'
)
2005-06-11 21:28:57 +02:00
);
}
2005-02-23 12:48:59 +01:00
}