2008-10-07 14:50:14 +02:00
< ? php
/**
2016-04-30 19:05:23 +02:00
* EGroupware InfoLog - Admin - , Preferences - and SideboxMenu - Hooks
2008-10-07 14:50:14 +02:00
*
* @ link http :// www . egroupware . org
* @ author Ralf Becker < RalfBecker - AT - outdoor - training . de >
* @ package infolog
2016-04-30 19:05:23 +02:00
* @ copyright ( c ) 2003 - 16 by Ralf Becker < RalfBecker - AT - outdoor - training . de >
2008-10-07 14:50:14 +02:00
* @ license http :// opensource . org / licenses / gpl - license . php GPL - GNU General Public License
* @ version $Id $
*/
2016-04-30 19:05:23 +02:00
use EGroupware\Api ;
use EGroupware\Api\Link ;
use EGroupware\Api\Framework ;
use EGroupware\Api\Egw ;
use EGroupware\Api\Acl ;
2008-10-07 14:50:14 +02:00
/**
* Class containing admin , preferences and sidebox - menus ( used as hooks )
*/
class infolog_hooks
{
2010-04-20 08:57:57 +02:00
/**
* For which groups should no group acl be used : infolog group owners
*
2014-01-28 11:08:43 +01:00
* @ param array | string $location location and other parameters ( not used )
2010-04-20 08:57:57 +02:00
* @ return boolean | array true , false or array with group - account_id ' s
*/
2014-01-28 11:08:43 +01:00
static function not_enum_group_acls ( $location )
2010-04-20 08:57:57 +02:00
{
2014-01-28 11:08:43 +01:00
unset ( $location ); // not used, but part of hook signature
2016-04-30 19:05:23 +02:00
$config = Api\Config :: read ( 'infolog' );
2010-04-20 08:57:57 +02:00
return $config [ 'group_owners' ];
}
2008-10-07 14:50:14 +02:00
/**
* Hook called by link - class to include infolog in the appregistry of the linkage
*
2014-01-28 11:08:43 +01:00
* @ param array | string $location location and other parameters ( not used )
2008-10-07 14:50:14 +02:00
* @ return array with method - names
*/
static function search_link ( $location )
{
2014-01-28 11:08:43 +01:00
unset ( $location ); // not used, but part of hook signature
2010-04-20 08:57:57 +02:00
2008-10-07 14:50:14 +02:00
return array (
'query' => 'infolog.infolog_bo.link_query' ,
'title' => 'infolog.infolog_bo.link_title' ,
'titles' => 'infolog.infolog_bo.link_titles' ,
'view' => array (
2011-05-18 16:18:37 +02:00
'menuaction' => 'infolog.infolog_ui.edit' ,
2008-10-07 14:50:14 +02:00
),
2011-05-18 16:18:37 +02:00
'view_id' => 'info_id' ,
2016-05-06 17:12:27 +02:00
'view_popup' => '760x570' ,
2014-01-16 15:51:35 +01:00
'list' => array (
'menuaction' => 'infolog.infolog_ui.index' ,
'ajax' => 'true'
),
2008-10-07 14:50:14 +02:00
'add' => array (
'menuaction' => 'infolog.infolog_ui.edit' ,
2014-07-03 15:44:04 +02:00
'type' => $GLOBALS [ 'egw_info' ][ 'user' ][ 'preferences' ][ 'preferred_type' ]
2008-10-07 14:50:14 +02:00
),
'add_app' => 'action' ,
'add_id' => 'action_id' ,
2016-05-06 17:12:27 +02:00
'add_popup' => '760x570' ,
2008-10-07 14:50:14 +02:00
'file_access' => 'infolog.infolog_bo.file_access' ,
2011-06-26 14:32:06 +02:00
'file_access_user' => true , // file_access supports 4th parameter $user
2010-01-21 00:26:05 +01:00
'edit' => array (
'menuaction' => 'infolog.infolog_ui.edit' ,
),
'edit_id' => 'info_id' ,
2016-05-06 17:12:27 +02:00
'edit_popup' => '760x570' ,
2012-07-04 19:00:03 +02:00
'merge' => true ,
2008-10-07 14:50:14 +02:00
);
}
/**
* hooks to build sidebox - menu plus the admin and preferences sections
*
* @ param string / array $args hook args
*/
static 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' )
{
2013-04-09 11:37:30 +02:00
// Magic etemplate2 favorites menu (from nextmatch widget)
2016-04-30 19:05:23 +02:00
display_sidebox ( $appname , lang ( 'Favorites' ), Framework\Favorites :: list_favorites ( $appname ));
2014-02-12 22:51:25 +01:00
2008-10-07 14:50:14 +02:00
$file = array (
2016-04-30 19:05:23 +02:00
'infolog list' => Egw :: link ( '/index.php' , array (
2014-01-14 16:11:51 +01:00
'menuaction' => 'infolog.infolog_ui.index' ,
'ajax' => 'true' )),
2015-09-10 00:20:25 +02:00
array (
2016-04-30 19:05:23 +02:00
'text' => lang ( 'Add %1' , lang ( Link :: get_registry ( $appname , 'entry' ))),
2015-09-10 00:20:25 +02:00
'no_lang' => true ,
'link' => " javascript:app.infolog.add_link_sidemenu(); "
),
2016-04-30 19:05:23 +02:00
'Placeholders' => Egw :: link ( '/index.php' , 'menuaction=infolog.infolog_merge.show_replacements' )
2008-10-07 14:50:14 +02:00
);
display_sidebox ( $appname , $GLOBALS [ 'egw_info' ][ 'apps' ][ 'infolog' ][ 'title' ] . ' ' . lang ( 'Menu' ), $file );
}
2016-04-30 19:05:23 +02:00
if ( $GLOBALS [ 'egw_info' ][ 'user' ][ 'apps' ][ 'admin' ] && ! Api\Header\UserAgent :: mobile ())
2008-10-07 14:50:14 +02:00
{
$file = Array (
2016-04-30 19:05:23 +02:00
'Site configuration' => Egw :: link ( '/index.php' , array (
2016-08-12 11:35:30 +02:00
'menuaction' => 'infolog.infolog_ui.admin' ,
2019-01-25 12:41:13 +01:00
'ajax' => 'true' ,
2016-08-12 11:35:30 +02:00
)),
2016-04-30 19:05:23 +02:00
'Global Categories' => Egw :: link ( '/index.php' , array (
2011-06-21 23:14:51 +02:00
'menuaction' => 'admin.admin_categories.index' ,
2008-10-07 14:50:14 +02:00
'appname' => $appname ,
2016-08-12 11:35:30 +02:00
'global_cats' => True ,
'ajax' => 'true' ,
)),
'Custom fields, type and status' => Egw :: link ( '/index.php' , array (
'menuaction' => 'infolog.infolog_customfields.index' ,
'ajax' => 'true' ,
)),
2008-10-07 14:50:14 +02:00
);
if ( $location == 'admin' )
{
display_section ( $appname , $file );
}
else
{
display_sidebox ( $appname , lang ( 'Admin' ), $file );
}
}
}
/**
2016-04-30 19:05:23 +02:00
* populates $settings for the Api\Preferences
2009-05-08 18:01:33 +02:00
*
* @ return array
2008-10-07 14:50:14 +02:00
*/
static function settings ()
{
/* Setup some values to fill the array of this app's settings below */
2009-05-08 18:01:33 +02:00
$info = new infolog_bo (); // need some labels from
2008-10-07 14:50:14 +02:00
$filters = $show_home = array ();
$show_home [] = lang ( " DON'T show InfoLog " );
2013-11-14 22:51:52 +01:00
$filters [ 'none' ] = $info -> filters [ '' ];
2009-05-08 18:01:33 +02:00
foreach ( $info -> filters as $key => $label )
2008-10-07 14:50:14 +02:00
{
$show_home [ $key ] = $filters [ $key ] = lang ( $label );
}
// migrage old filter-pref 1,2 to the filter one 'own-open-today'
if ( isset ( $GLOBALS [ 'type' ]) && in_array ( $GLOBALS [ 'egw' ] -> preferences -> { $GLOBALS [ 'type' ]}[ 'homeShowEvents' ], array ( '1' , '2' )))
{
$GLOBALS [ 'egw' ] -> preferences -> add ( 'infolog' , 'homeShowEvents' , 'own-open-today' , $GLOBALS [ 'type' ]);
$GLOBALS [ 'egw' ] -> preferences -> save_repository ();
}
$show_links = array (
'all' => lang ( 'all links and attachments' ),
'links' => lang ( 'only the links' ),
'attach' => lang ( 'only the attachments' ),
'none' => lang ( 'no links or attachments' ),
'no_describtion' => lang ( 'no describtion, links or attachments' ),
);
$show_details = array (
0 => lang ( 'No' ),
1 => lang ( 'Yes' ),
2 => lang ( 'Only for details' ),
);
/* Settings array for this app */
2009-05-08 18:01:33 +02:00
$settings = array (
2013-01-21 21:28:13 +01:00
array (
'type' => 'section' ,
'title' => lang ( 'General settings' ),
'no_lang' => true ,
'xmlrpc' => False ,
'admin' => False
),
2008-10-07 14:50:14 +02:00
'defaultFilter' => array (
'type' => 'select' ,
'label' => 'Default Filter for InfoLog' ,
'name' => 'defaultFilter' ,
'values' => $filters ,
'help' => 'This is the filter InfoLog uses when you enter the application. Filters limit the entries to show in the actual view. There are filters to show only finished, still open or futures entries of yourself or all users.' ,
'xmlrpc' => True ,
2010-05-20 20:00:49 +02:00
'admin' => False ,
2013-06-03 21:54:11 +02:00
'default' => '' ,
2008-10-07 14:50:14 +02:00
),
2014-08-27 11:06:20 +02:00
/* disabled until we have a home app again
2008-10-07 14:50:14 +02:00
'homeShowEvents' => array (
'type' => 'select' ,
2018-12-20 16:06:12 +01:00
'label' => 'InfoLog filter for the home screen' ,
2008-10-07 14:50:14 +02:00
'name' => 'homeShowEvents' ,
'values' => $show_home ,
2018-12-20 16:06:12 +01:00
'help' => 'Should InfoLog show up on the home screen and with which filter. Works only if you dont selected an application for the home screen (in your preferences).' ,
2008-10-07 14:50:14 +02:00
'xmlrpc' => True ,
2010-05-20 20:00:49 +02:00
'admin' => False ,
'default' => 'responsible-open-today' ,
2014-08-27 11:06:20 +02:00
), */
2013-01-21 21:28:13 +01:00
'set_start' => array (
'type' => 'select' ,
'label' => 'Startdate for new entries' ,
'name' => 'set_start' ,
'values' => array (
'date' => lang ( 'todays date' ),
'datetime' => lang ( 'actual date and time' ),
'empty' => lang ( 'leave it empty' ),
),
'help' => 'To what should the startdate of new entries be set.' ,
'xmlrpc' => True ,
'admin' => False ,
'default' => 'date' ,
),
'cat_add_default' => array (
'type' => 'select' ,
'label' => 'Default category for new Infolog entries' ,
'name' => 'cat_add_default' ,
'values' => self :: all_cats (),
'help' => 'You can choose a categorie to be preselected, when you create a new Infolog entry' ,
'xmlrpc' => True ,
'admin' => False ,
),
'show_id' => array (
'type' => 'select' ,
'label' => 'Show ticket Id' ,
'name' => 'show_id' ,
'values' => $show_details ,
'help' => 'Should the Infolog list show a unique numerical Id, which can be used eg. as ticket Id.' ,
'xmlrpc' => True ,
'admin' => False ,
'default' => '1' , // Yes
),
2014-08-27 16:38:03 +02:00
'listNoSubs' => array (
'type' => 'select' ,
'label' => 'Show sub-entries' ,
'name' => 'listNoSubs' ,
'values' => array (
'0' => lang ( 'Always show them' ),
'filter' => lang ( 'Only show them if there is a filter' ),
'1' => lang ( 'Only show them while searching' ),
),
'help' => 'Should InfoLog show Subtasks, -calls or -notes in the normal view or not. You can always view the Subs via there parent.' ,
'xmlrpc' => True ,
'admin' => False ,
'default' => '0' , // Allways show them
),
2008-10-07 14:50:14 +02:00
'show_links' => array (
'type' => 'select' ,
'label' => 'Show in the InfoLog list' ,
'name' => 'show_links' ,
'values' => $show_links ,
'help' => 'Should InfoLog show the links to other applications and/or the file-attachments in the InfoLog list (normal view when you enter InfoLog).' ,
'xmlrpc' => True ,
2010-05-20 20:00:49 +02:00
'admin' => False ,
'default' => 'all' ,
2008-10-07 14:50:14 +02:00
),
'show_percent' => array (
'type' => 'select' ,
'label' => 'Show status and percent done separate' ,
'name' => 'show_percent' ,
'values' => $show_details ,
'help' => 'Should the Infolog list show the percent done only for status ongoing or two separate icons.' ,
'xmlrpc' => True ,
2010-05-20 20:00:49 +02:00
'admin' => False ,
'default' => 1 , // Yes
2008-10-07 14:50:14 +02:00
),
2009-05-08 18:01:33 +02:00
'limit_des_lines' => array (
'type' => 'input' ,
'size' => 5 ,
'label' => 'Limit number of description lines (default 5, 0 for no limit)' ,
'name' => 'limit_des_lines' ,
2018-03-26 16:02:42 +02:00
'help' => 'How many description lines should be directly visible. Further lines are available via a scrollbar.' ,
2009-05-08 18:01:33 +02:00
'xmlrpc' => True ,
2010-05-20 20:00:49 +02:00
'admin' => False ,
'default' => 5 ,
2009-05-08 18:01:33 +02:00
),
2013-01-22 16:12:50 +01:00
);
$settings [] = array (
2013-01-21 21:28:13 +01:00
'type' => 'section' ,
'title' => lang ( 'Notification settings' ),
'no_lang' => true ,
'xmlrpc' => False ,
'admin' => False
2008-10-07 14:50:14 +02:00
);
// notification preferences
2009-05-08 18:01:33 +02:00
$settings [ 'notify_creator' ] = array (
2008-10-07 14:50:14 +02:00
'type' => 'check' ,
'label' => 'Receive notifications about own items' ,
'name' => 'notify_creator' ,
'help' => 'Do you want a notification, if items you created get updated?' ,
'xmlrpc' => True ,
'admin' => False ,
2010-05-20 20:00:49 +02:00
'default' => '1' , // Yes
2008-10-07 14:50:14 +02:00
);
2009-05-08 18:01:33 +02:00
$settings [ 'notify_assigned' ] = array (
2008-10-07 14:50:14 +02:00
'type' => 'select' ,
'label' => 'Receive notifications about items assigned to you' ,
'name' => 'notify_assigned' ,
'help' => 'Do you want a notification, if items get assigned to you or assigned items get updated?' ,
'values' => array (
'0' => lang ( 'No' ),
'1' => lang ( 'Yes' ),
'assignment' => lang ( 'Only if I get assigned or removed' ),
),
'xmlrpc' => True ,
'admin' => False ,
2010-05-20 20:00:49 +02:00
'default' => '1' , // Yes
2008-10-07 14:50:14 +02:00
);
// to add options for more then 3 days back or in advance, you need to update soinfolog::users_with_open_entries()!
$options = array (
'0' => lang ( 'No' ),
'-1d' => lang ( 'one day after' ),
'0d' => lang ( 'same day' ),
'1d' => lang ( 'one day in advance' ),
'2d' => lang ( '%1 days in advance' , 2 ),
'3d' => lang ( '%1 days in advance' , 3 ),
);
2009-05-08 18:01:33 +02:00
$settings [ 'notify_due_delegated' ] = array (
2008-10-07 14:50:14 +02:00
'type' => 'select' ,
'label' => 'Receive notifications about due entries you delegated' ,
'name' => 'notify_due_delegated' ,
'help' => 'Do you want a notification, if items you delegated are due?' ,
'values' => $options ,
'xmlrpc' => True ,
'admin' => False ,
2010-05-20 20:00:49 +02:00
'default' => '0' , // No
2008-10-07 14:50:14 +02:00
);
2009-05-08 18:01:33 +02:00
$settings [ 'notify_due_responsible' ] = array (
2008-10-07 14:50:14 +02:00
'type' => 'select' ,
'label' => 'Receive notifications about due entries you are responsible for' ,
'name' => 'notify_due_responsible' ,
'help' => 'Do you want a notification, if items you are responsible for are due?' ,
'values' => $options ,
'xmlrpc' => True ,
'admin' => False ,
2010-05-20 20:00:49 +02:00
'default' => '0d' , // Same day
2008-10-07 14:50:14 +02:00
);
2009-05-08 18:01:33 +02:00
$settings [ 'notify_start_delegated' ] = array (
2008-10-07 14:50:14 +02:00
'type' => 'select' ,
'label' => 'Receive notifications about starting entries you delegated' ,
'name' => 'notify_start_delegated' ,
'help' => 'Do you want a notification, if items you delegated are about to start?' ,
'values' => $options ,
'xmlrpc' => True ,
'admin' => False ,
2010-05-20 20:00:49 +02:00
'default' => '0' , // No
2008-10-07 14:50:14 +02:00
);
2009-05-08 18:01:33 +02:00
$settings [ 'notify_start_responsible' ] = array (
2008-10-07 14:50:14 +02:00
'type' => 'select' ,
'label' => 'Receive notifications about starting entries you are responsible for' ,
'name' => 'notify_start_responsible' ,
'help' => 'Do you want a notification, if items you are responsible for are about to start?' ,
'values' => $options ,
'xmlrpc' => True ,
'admin' => False ,
2010-05-20 20:00:49 +02:00
'default' => '0d' , // Same day
2008-10-07 14:50:14 +02:00
);
2012-02-27 15:59:00 +01:00
// receive notification for items owned by groups you are part of
$settings [ 'notify_owner_group_member' ] = array (
'type' => 'check' ,
'label' => 'Receive notifications about items of type owned by groups you are part of' ,
'name' => 'notify_owner_group_member' ,
'help' => 'Do you want a notification if items owned by groups you are part of get updated ?' ,
'xmlrpc' => True ,
'admin' => False ,
'default' => '0' , // No
);
2018-09-07 17:14:04 +02:00
// Notify for types (default)
$settings [ 'no_notification_types' ] = array (
'type' => 'multiselect' ,
'label' => 'Do not notify' ,
'name' => 'no_notification_types' ,
'help' => " Automatically check 'Do not notify' for these types " ,
'values' => $info -> enums [ 'type' ],
'default' => array (), // None
);
2012-02-27 15:59:00 +01:00
2013-01-21 21:28:13 +01:00
$settings [] = array (
'type' => 'section' ,
'title' => lang ( 'Data exchange settings' ),
'no_lang' => true ,
'xmlrpc' => False ,
'admin' => False
);
2011-01-26 21:16:18 +01:00
// Merge print
if ( $GLOBALS [ 'egw_info' ][ 'user' ][ 'apps' ][ 'filemanager' ])
{
$settings [ 'default_document' ] = array (
2012-05-22 15:51:30 +02:00
'type' => 'vfs_file' ,
2011-01-26 21:16:18 +01:00
'size' => 60 ,
'label' => 'Default document to insert entries' ,
'name' => 'default_document' ,
2011-07-04 21:07:48 +02:00
'help' => lang ( 'If you specify a document (full vfs path) here, %1 displays an extra document icon for each entry. That icon allows to download the specified document with the data inserted.' , lang ( 'infolog' )) . ' ' .
2014-06-24 11:47:08 +02:00
lang ( 'The document can contain placeholder like {{%1}}, to be replaced with the data.' , 'info_subject' ) . ' ' .
2011-07-04 21:07:48 +02:00
lang ( 'The following document-types are supported:' ) . '*.rtf, *.txt' ,
2011-01-26 21:16:18 +01:00
'run_lang' => false ,
'xmlrpc' => True ,
'admin' => False ,
);
$settings [ 'document_dir' ] = array (
2012-05-22 15:51:30 +02:00
'type' => 'vfs_dirs' ,
2011-01-26 21:16:18 +01:00
'size' => 60 ,
'label' => 'Directory with documents to insert entries' ,
'name' => 'document_dir' ,
2011-07-04 22:04:42 +02:00
'help' => lang ( 'If you specify a directory (full vfs path) here, %1 displays an action for each document. That action allows to download the specified document with the data inserted.' , lang ( 'infolog' )) . ' ' .
2014-06-24 11:47:08 +02:00
lang ( 'The document can contain placeholder like {{%1}}, to be replaced with the data.' , 'info_subject' ) . ' ' .
2011-07-04 21:07:48 +02:00
lang ( 'The following document-types are supported:' ) . '*.rtf, *.txt' ,
2011-01-26 21:16:18 +01:00
'run_lang' => false ,
'xmlrpc' => True ,
'admin' => False ,
2011-06-11 13:57:51 +02:00
'default' => '/templates/infolog' ,
2011-01-26 21:16:18 +01:00
);
}
2011-02-28 18:43:01 +01:00
// Import / Export for nextmatch
if ( $GLOBALS [ 'egw_info' ][ 'user' ][ 'apps' ][ 'importexport' ])
{
$definitions = new importexport_definitions_bo ( array (
'type' => 'export' ,
'application' => 'infolog'
));
2011-11-18 17:01:57 +01:00
$options = array (
2011-11-21 11:01:08 +01:00
'~nextmatch~' => lang ( 'Old fixed definition' )
2011-11-18 17:01:57 +01:00
);
2011-03-21 17:13:00 +01:00
foreach (( array ) $definitions -> get_definitions () as $identifier )
{
try
{
2011-02-28 18:43:01 +01:00
$definition = new importexport_definition ( $identifier );
2011-03-21 17:13:00 +01:00
}
catch ( Exception $e )
{
2014-01-28 11:08:43 +01:00
unset ( $e );
2011-02-28 18:43:01 +01:00
// permission error
continue ;
}
2014-01-28 11:08:43 +01:00
if (( $title = $definition -> get_title ()))
2011-03-21 17:13:00 +01:00
{
2011-02-28 18:43:01 +01:00
$options [ $title ] = $title ;
}
unset ( $definition );
}
2011-03-21 17:13:00 +01:00
$default_def = 'export-infolog' ;
2011-02-28 18:43:01 +01:00
$settings [ 'nextmatch-export-definition' ] = array (
'type' => 'select' ,
'values' => $options ,
2011-07-04 22:00:26 +02:00
'label' => 'Export definition to use for nextmatch export' ,
2011-02-28 18:43:01 +01:00
'name' => 'nextmatch-export-definition' ,
'help' => lang ( 'If you specify an export definition, it will be used when you export' ),
'run_lang' => false ,
'xmlrpc' => True ,
2011-05-18 16:18:37 +02:00
'admin' => False ,
2011-03-21 17:13:00 +01:00
'default' => isset ( $options [ $default_def ]) ? $default_def : false ,
2011-02-28 18:43:01 +01:00
);
}
2013-01-23 16:54:40 +01:00
if ( $GLOBALS [ 'egw_info' ][ 'user' ][ 'apps' ][ 'calendar' ])
{
$settings [ 'cal_show' ] = array (
'type' => 'multiselect' ,
'label' => 'Which types should the calendar show' ,
'name' => 'cal_show' ,
2015-04-10 16:48:49 +02:00
'values' => array ( 0 => lang ( 'None' )) + $info -> enums [ 'type' ],
2013-01-23 16:54:40 +01:00
'help' => 'Can be used to show further InfoLog types in the calendar or limit it to show eg. only tasks.' ,
'xmlrpc' => True ,
'admin' => False ,
'default' => 'tasks,phone' ,
);
$settings [ 'calendar_set' ] = array (
'type' => 'multiselect' ,
'label' => 'Participants for scheduling an appointment' ,
'name' => 'calendar_set' ,
'values' => array (
'responsible' => lang ( 'Responsible' ),
'contact' => lang ( 'Contact' ),
'owner' => lang ( 'Owner' ),
'user' => lang ( 'Current user' ),
'selected' => lang ( 'Selected calendars' ),
),
'help' => 'Which participants should be preselected when scheduling an appointment.' ,
'xmlrpc' => True ,
'admin' => False ,
'default' => 'responsible,contact,user' ,
);
}
2009-05-08 18:01:33 +02:00
return $settings ;
2008-10-07 14:50:14 +02:00
}
/**
* Return InoLog Categories ( used for setting )
*
* @ return array
*/
private static function all_cats ()
{
2016-04-30 19:05:23 +02:00
$categories = new Api\Categories ( '' , 'infolog' );
2009-07-15 22:04:17 +02:00
$accountId = $GLOBALS [ 'egw_info' ][ 'user' ][ 'account_id' ];
2008-10-07 14:50:14 +02:00
foreach (( array ) $categories -> return_sorted_array ( 0 , False , '' , '' , '' , true ) as $cat )
{
$s = str_repeat ( ' ' , $cat [ 'level' ]) . stripslashes ( $cat [ 'name' ]);
if ( $cat [ 'app_name' ] == 'phpgw' || $cat [ 'owner' ] == '-1' )
{
$s .= ' ♦' ;
}
2009-07-15 22:04:17 +02:00
elseif ( $cat [ 'owner' ] != $accountId )
{
$s .= '<' . $GLOBALS [ 'egw' ] -> accounts -> id2name ( $cat [ 'owner' ], 'account_fullname' ) . '>' ;
}
elseif ( $cat [ 'access' ] == 'private' )
{
$s .= ' ♥' ;
}
2008-10-07 14:50:14 +02:00
$sel_options [ $cat [ 'id' ]] = $s ; // 0.9.14 only
}
return $sel_options ;
}
/**
* Verification hook called if settings / preferences get stored
*
* Installs a task to send async infolog notifications at 2 h everyday
*
* @ param array $data
*/
static 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' ])
{
2016-05-02 11:39:07 +02:00
$async = new Api\Asyncservice ();
2008-10-07 14:50:14 +02:00
if ( ! $async -> read ( 'infolog-async-notification' ))
{
$async -> set_timer ( array ( 'hour' => 2 ), 'infolog-async-notification' , 'infolog.infolog_bo.async_notification' , null );
}
}
}
2013-08-26 20:25:43 +02:00
/**
* ACL rights and labels used
*
* @ param string | array string with location or array with parameters incl . " location " , specially " owner " for selected acl owner
2016-04-30 19:05:23 +02:00
* @ return array Acl :: ( READ | ADD | EDIT | DELETE | PRIVAT | CUSTOM ( 1 | 2 | 3 )) => $label pairs
2013-08-26 20:25:43 +02:00
*/
public static function acl_rights ( $params )
{
2014-01-28 11:08:43 +01:00
unset ( $params ); // not used, but default function signature for hooks
2013-08-26 20:25:43 +02:00
return array (
2016-04-30 19:05:23 +02:00
Acl :: READ => 'read' ,
Acl :: ADD => 'add' ,
Acl :: EDIT => 'edit' ,
Acl :: DELETE => 'delete' ,
Acl :: PRIVAT => 'private' ,
2013-08-26 20:25:43 +02:00
);
}
2013-10-03 11:23:18 +02:00
/**
* Hook to tell framework we use standard categories method
*
2014-01-28 11:08:43 +01:00
* @ param array | string $location location and other parameters ( not used )
2013-10-03 11:23:18 +02:00
* @ return boolean
*/
2014-01-28 11:08:43 +01:00
public static function categories ( $location )
2013-10-03 11:23:18 +02:00
{
2014-01-28 11:08:43 +01:00
unset ( $location ); // not used, but part of hook signature
2013-10-03 11:23:18 +02:00
return true ;
}
2016-04-30 19:05:23 +02:00
2015-04-15 13:23:59 +02:00
/**
* Mail integration hook to import mail message contents into an infolog entry
*
* @ return array
*/
public static function mail_import ( $args )
{
2016-04-30 19:05:23 +02:00
unset ( $args ); // not used, but required by function signature
2015-04-15 17:55:18 +02:00
return array (
'menuaction' => 'infolog.infolog_ui.mail_import' ,
2016-04-30 19:05:23 +02:00
'popup' => Link :: get_registry ( 'infolog' , 'edit_popup' )
2015-04-15 17:55:18 +02:00
);
2015-04-15 13:23:59 +02:00
}
2008-10-07 14:50:14 +02:00
}