egroupware/infolog/inc/class.infolog_prefs_sidebox_hooks.inc.php

104 lines
3.5 KiB
PHP

<?php
/**
* InfoLog - Admin-, Preferences- and SideboxMenu-Hooks
*
* @link http://www.egroupware.org
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
* @package infolog
* @copyright (c) 2003-6 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @version $Id$
*/
/**
* Class containing admin, preferences and sidebox-menus (used as hooks)
*/
class infolog_prefs_sidebox_hooks
{
function all_hooks($args)
{
$appname = 'infolog';
$location = is_array($args) ? $args['location'] : $args;
//echo "<p>admin_prefs_sidebox_hooks::all_hooks(".print_r($args,True).") appname='$appname', location='$location'</p>\n";
if ($location == 'sidebox_menu')
{
$file = array(
'infolog list' => $GLOBALS['egw']->link('/index.php',array(
'menuaction' => 'infolog.uiinfolog.index' )),
array(
'text' => '<a class="textSidebox" href="'.htmlspecialchars($GLOBALS['egw']->link('/index.php',array(
'menuaction' => 'infolog.uiinfolog.edit',
))).'" target="_blank" onclick="window.open(this.href,this.target,\'dependent=yes,width=750,height=550,scrollbars=yes,status=yes\'); return false;">'.lang('Add').'</a>',
'no_lang' => true,
)
);
display_sidebox($appname,$GLOBALS['egw_info']['apps']['infolog']['title'].' '.lang('Menu'),$file);
}
if ($GLOBALS['egw_info']['user']['apps']['preferences'] && $location != 'admin')
{
$file = array(
'Preferences' => $GLOBALS['egw']->link('/index.php','menuaction=preferences.uisettings.index&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')
);
if ($location == 'preferences')
{
display_section($appname,$file);
}
else
{
display_sidebox($appname,lang('Preferences'),$file);
}
}
if ($GLOBALS['egw_info']['user']['apps']['admin'] && $location != 'preferences')
{
$file = Array(
'Site configuration' => $GLOBALS['egw']->link('/index.php',array(
'menuaction' => 'infolog.uiinfolog.admin' )),
'Global Categories' => $GLOBALS['egw']->link('/index.php',array(
'menuaction' => 'admin.uicategories.index',
'appname' => $appname,
'global_cats'=> True)),
'Custom fields, typ and status' => $GLOBALS['egw']->link('/index.php',array(
'menuaction' => 'infolog.uicustomfields.edit')),
'CSV-Import' => $GLOBALS['egw']->link('/infolog/csv_import.php')
);
if ($location == 'admin')
{
display_section($appname,$file);
}
else
{
display_sidebox($appname,lang('Admin'),$file);
}
}
}
/**
* Verification hook called if settings / preferences get stored
*
* Installs a task to send async infolog notifications at 2h everyday
*
* @param array $data
*/
function verify_settings($data)
{
if ($data['prefs']['notify_due_delegated'] || $data['prefs']['notify_due_responsible'] ||
$data['prefs']['notify_start_delegated'] || $data['prefs']['notify_start_responsible'])
{
require_once(EGW_API_INC.'/class.asyncservice.inc.php');
$async =& new asyncservice();
//$async->cancel_timer('infolog-async-notification');
if (!$async->read('infolog-async-notification'))
{
$async->set_timer(array('hour' => 2),'infolog-async-notification','infolog.boinfolog.async_notification',null);
}
}
}
}