2017-07-25 10:44:55 +00:00
< ? php
2024-11-04 22:53:20 +00:00
/* Copyright ( C ) 2017 Laurent Destailleur < eldy @ users . sourceforge . net >
2025-10-17 00:31:07 +00:00
* Copyright ( C ) 2024 - 2025 Frédéric France < frederic . france @ free . fr >
2024-08-18 16:16:08 +00:00
* Copyright ( C ) --- Replace with your own copyright and developer email ---
2026-08-01 22:11:28 +00:00
* Copyright ( C ) 2026 Jose MARTINEZ < jose . martinez @ pichinov . com >
2017-07-25 10:44:55 +00:00
*
* This program is free software ; you can redistribute it and / or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation ; either version 3 of the License , or
* ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
2019-09-23 19:55:30 +00:00
* along with this program . If not , see < https :// www . gnu . org / licenses />.
2017-07-25 10:44:55 +00:00
*/
/**
* \file htdocs / modulebuilder / template / myobject_agenda . php
* \ingroup mymodule
2020-09-18 02:30:24 +00:00
* \brief Tab of events on MyObject
2017-07-25 10:44:55 +00:00
*/
2020-10-17 17:05:08 +00:00
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Do not create database handler $db
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Do not load object $user
//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); // Do not load object $mysoc
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); // Do not load object $langs
//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION', '1'); // Do not check injection attack on GET parameters
//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION', '1'); // Do not check injection attack on POST parameters
//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on)
//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK', '1'); // Do not check style html tag into posted data
//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu
//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library
//if (! defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session). This include the NOIPCHECK too.
//if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT', 'auto'); // Force lang to a particular value
//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler
2022-08-16 13:19:21 +00:00
//if (! defined("MAIN_SECURITY_FORCECSP")) define('MAIN_SECURITY_FORCECSP', 'none'); // Disable all Content Security Policies
2020-10-17 17:05:08 +00:00
//if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET
2020-10-25 12:48:08 +00:00
//if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification
2020-09-18 02:30:24 +00:00
2017-07-25 10:44:55 +00:00
// Load Dolibarr environment
2019-11-12 08:46:08 +00:00
$res = 0 ;
2017-07-25 10:44:55 +00:00
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
2021-02-26 17:26:44 +00:00
if ( ! $res && ! empty ( $_SERVER [ " CONTEXT_DOCUMENT_ROOT " ])) {
2025-12-09 12:36:20 +00:00
$res = @ include str_replace ( " .. " , " " , $_SERVER [ " CONTEXT_DOCUMENT_ROOT " ]) . " /main.inc.php " ;
2021-02-26 17:26:44 +00:00
}
2018-05-23 15:16:58 +00:00
// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
2024-08-18 16:16:08 +00:00
$tmp = empty ( $_SERVER [ 'SCRIPT_FILENAME' ]) ? '' : $_SERVER [ 'SCRIPT_FILENAME' ];
$tmp2 = realpath ( __FILE__ );
$i = strlen ( $tmp ) - 1 ;
$j = strlen ( $tmp2 ) - 1 ;
2021-02-26 17:26:44 +00:00
while ( $i > 0 && $j > 0 && isset ( $tmp [ $i ]) && isset ( $tmp2 [ $j ]) && $tmp [ $i ] == $tmp2 [ $j ]) {
2023-12-04 12:46:42 +00:00
$i -- ;
$j -- ;
2021-02-26 17:26:44 +00:00
}
if ( ! $res && $i > 0 && file_exists ( substr ( $tmp , 0 , ( $i + 1 )) . " /main.inc.php " )) {
$res = @ include substr ( $tmp , 0 , ( $i + 1 )) . " /main.inc.php " ;
}
if ( ! $res && $i > 0 && file_exists ( dirname ( substr ( $tmp , 0 , ( $i + 1 ))) . " /main.inc.php " )) {
$res = @ include dirname ( substr ( $tmp , 0 , ( $i + 1 ))) . " /main.inc.php " ;
}
2017-07-25 10:44:55 +00:00
// Try main.inc.php using relative path
2021-02-26 17:26:44 +00:00
if ( ! $res && file_exists ( " ../main.inc.php " )) {
$res = @ include " ../main.inc.php " ;
}
if ( ! $res && file_exists ( " ../../main.inc.php " )) {
$res = @ include " ../../main.inc.php " ;
}
if ( ! $res && file_exists ( " ../../../main.inc.php " )) {
$res = @ include " ../../../main.inc.php " ;
}
if ( ! $res ) {
die ( " Include of main fails " );
}
2024-11-04 22:53:20 +00:00
/**
2025-08-07 21:50:05 +00:00
* The main . inc . php has been included so the following variable are now defined :
2024-11-04 22:53:20 +00:00
* @ var Conf $conf
2025-08-09 12:02:49 +00:00
* @ var DoliDB $db
2025-08-09 12:24:59 +00:00
* @ var HookManager $hookmanager
2024-11-04 22:53:20 +00:00
* @ var Translate $langs
* @ var User $user
*/
2025-08-07 21:50:05 +00:00
include_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php' ;
include_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php' ;
include_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php' ;
dol_include_once ( '/mymodule/class/myobject.class.php' );
dol_include_once ( '/mymodule/lib/mymodule_myobject.lib.php' );
2024-11-04 22:53:20 +00:00
2018-05-26 15:57:30 +00:00
// Load translation files required by the page
2019-11-12 08:46:08 +00:00
$langs -> loadLangs ( array ( " mymodule@mymodule " , " other " ));
2017-07-25 10:44:55 +00:00
// Get parameters
2024-03-24 15:36:08 +00:00
$id = GETPOSTINT ( 'id' );
2021-01-06 19:34:18 +00:00
$ref = GETPOST ( 'ref' , 'alpha' );
2020-09-16 17:39:50 +00:00
$action = GETPOST ( 'action' , 'aZ09' );
2025-11-24 15:03:38 +00:00
$cancel = GETPOST ( 'cancel' );
2025-11-17 18:35:10 +00:00
$contextpage = GETPOST ( 'contextpage' , 'aZ' ) ? GETPOST ( 'contextpage' , 'aZ' ) : getDolDefaultContextPage ( __FILE__ ); // To manage different context of search
2017-07-25 10:44:55 +00:00
$backtopage = GETPOST ( 'backtopage' , 'alpha' );
2026-02-12 00:22:01 +00:00
if ( GETPOSTISARRAY ( 'actioncode' )) {
$actioncode = GETPOST ( 'actioncode' , 'array:alpha' , 3 );
2021-01-06 19:34:18 +00:00
if ( ! count ( $actioncode )) {
$actioncode = '0' ;
}
2020-05-20 22:02:33 +00:00
} else {
2022-12-22 21:29:24 +00:00
$actioncode = GETPOST ( " actioncode " , " alpha " , 3 ) ? GETPOST ( " actioncode " , " alpha " , 3 ) : ( GETPOST ( " actioncode " ) == '0' ? '0' : getDolGlobalString ( 'AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT' ));
2017-07-25 10:44:55 +00:00
}
2023-02-20 01:08:04 +00:00
$search_rowid = GETPOST ( 'search_rowid' );
2019-11-02 08:14:15 +00:00
$search_agenda_label = GETPOST ( 'search_agenda_label' );
2026-02-12 00:22:01 +00:00
$search_complete = GETPOST ( 'search_complete' );
$search_filtert = GETPOSTINT ( 'search_filtert' );
$search_dateevent_start = GETPOSTDATE ( 'dateevent_start' );
$search_dateevent_end = GETPOSTDATE ( 'dateevent_end' );
2017-07-25 10:44:55 +00:00
2024-08-18 16:16:08 +00:00
$limit = GETPOSTINT ( 'limit' ) ? GETPOSTINT ( 'limit' ) : $conf -> liste_limit ;
2022-01-13 10:09:37 +00:00
$sortfield = GETPOST ( 'sortfield' , 'aZ09comma' );
$sortorder = GETPOST ( 'sortorder' , 'aZ09comma' );
2024-08-18 16:16:08 +00:00
$page = GETPOSTISSET ( 'pageplusone' ) ? ( GETPOSTINT ( 'pageplusone' ) - 1 ) : GETPOSTINT ( " page " );
2021-01-06 19:34:18 +00:00
if ( empty ( $page ) || $page == - 1 ) {
2026-02-12 00:22:01 +00:00
// If $page is not defined, or '' or -1 or if we click on clear filters
2021-01-06 19:34:18 +00:00
$page = 0 ;
2026-02-12 00:22:01 +00:00
}
2017-07-25 10:44:55 +00:00
$offset = $limit * $page ;
$pageprev = $page - 1 ;
$pagenext = $page + 1 ;
2021-01-06 19:34:18 +00:00
if ( ! $sortfield ) {
$sortfield = 'a.datep,a.id' ;
}
if ( ! $sortorder ) {
$sortorder = 'DESC,DESC' ;
}
2017-07-25 10:44:55 +00:00
2024-06-30 19:02:50 +00:00
// Initialize a technical objects
2019-11-02 08:14:15 +00:00
$object = new MyObject ( $db );
2017-07-25 10:44:55 +00:00
$extrafields = new ExtraFields ( $db );
2019-11-12 08:46:08 +00:00
$diroutputmassaction = $conf -> mymodule -> dir_output . '/temp/massgeneration/' . $user -> id ;
2023-08-01 16:46:33 +00:00
$hookmanager -> initHooks ( array ( $object -> element . 'agenda' , 'globalcard' )); // Note that conf->hooks_modules contains array
2017-07-25 10:44:55 +00:00
// Fetch optionals attributes and labels
2019-10-06 12:41:52 +00:00
$extrafields -> fetch_name_optionals_label ( $object -> table_element );
2017-07-25 10:44:55 +00:00
// Load object
2024-06-30 19:02:50 +00:00
include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php' ; // Must be 'include', not 'include_once'. Include fetch and fetch_thirdparty but not fetch_optionals
2021-01-06 19:34:18 +00:00
if ( $id > 0 || ! empty ( $ref )) {
2021-12-09 14:17:18 +00:00
$upload_dir = $conf -> mymodule -> multidir_output [ ! empty ( $object -> entity ) ? $object -> entity : $conf -> entity ] . " / " . $object -> id ;
2021-01-06 19:34:18 +00:00
}
2017-07-25 10:44:55 +00:00
2022-03-11 09:55:28 +00:00
// There is several ways to check permission.
// Set $enablepermissioncheck to 1 to enable a minimum low level of checks
2024-11-28 10:15:56 +00:00
$enablepermissioncheck = getDolGlobalInt ( 'MYMODULE_ENABLE_PERMISSION_CHECK' );
2022-03-11 09:55:28 +00:00
if ( $enablepermissioncheck ) {
2024-02-04 15:03:59 +00:00
$permissiontoread = $user -> hasRight ( 'mymodule' , 'myobject' , 'read' );
$permissiontoadd = $user -> hasRight ( 'mymodule' , 'myobject' , 'write' );
2022-03-11 09:55:28 +00:00
} else {
$permissiontoread = 1 ;
$permissiontoadd = 1 ;
}
2019-11-03 18:15:32 +00:00
2021-04-29 10:10:55 +00:00
// Security check (enable the most restrictive one)
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
2022-12-05 02:08:57 +00:00
//restrictedArea($user, $object->module, $object->id, $object->table_element, $object->element, 'fk_soc', 'rowid', $isdraft);
2022-09-08 14:19:11 +00:00
if ( ! isModEnabled ( " mymodule " )) {
accessforbidden ();
}
2023-12-04 12:46:42 +00:00
if ( ! $permissiontoread ) {
accessforbidden ();
}
2021-04-29 10:10:55 +00:00
2017-07-25 10:44:55 +00:00
/*
2019-11-02 08:14:15 +00:00
* Actions
2017-07-25 10:44:55 +00:00
*/
2024-08-18 16:16:08 +00:00
$parameters = array ( 'id' => $id );
2019-11-12 08:46:08 +00:00
$reshook = $hookmanager -> executeHooks ( 'doActions' , $parameters , $object , $action ); // Note that $action and $object may have been modified by some hooks
2021-01-06 19:34:18 +00:00
if ( $reshook < 0 ) {
setEventMessages ( $hookmanager -> error , $hookmanager -> errors , 'errors' );
}
2017-07-25 10:44:55 +00:00
2021-01-06 19:34:18 +00:00
if ( empty ( $reshook )) {
2020-05-01 06:40:55 +00:00
// Cancel
2021-01-06 19:34:18 +00:00
if ( GETPOST ( 'cancel' , 'alpha' ) && ! empty ( $backtopage )) {
2020-05-01 06:40:55 +00:00
header ( " Location: " . $backtopage );
exit ;
}
// Purge search criteria
2021-01-06 19:34:18 +00:00
if ( GETPOST ( 'button_removefilter_x' , 'alpha' ) || GETPOST ( 'button_removefilter.x' , 'alpha' ) || GETPOST ( 'button_removefilter' , 'alpha' )) { // All tests are required to be compatible with all browsers
2020-05-01 06:40:55 +00:00
$actioncode = '' ;
2026-02-12 00:22:01 +00:00
$search_rowid = '' ;
2020-05-01 06:40:55 +00:00
$search_agenda_label = '' ;
2026-02-12 00:22:01 +00:00
$search_complete = '' ;
$search_filtert = '' ;
2020-05-01 06:40:55 +00:00
}
2017-07-25 10:44:55 +00:00
}
/*
* View
*/
$form = new Form ( $db );
2021-01-06 19:34:18 +00:00
if ( $object -> id > 0 ) {
2023-08-04 16:33:07 +00:00
$title = $langs -> trans ( " MyObject " ) . " - " . $langs -> trans ( 'Agenda' );
//$title = $object->ref." - ".$langs->trans("Agenda");
2023-02-16 16:52:41 +00:00
$help_url = 'EN:Module_Agenda_En|DE:Modul_Terminplanung' ;
2023-08-16 09:59:14 +00:00
2023-12-16 13:38:13 +00:00
llxHeader ( '' , $title , $help_url , '' , 0 , 0 , '' , '' , '' , 'mod-mymodule page-card_agenda' );
2017-07-25 10:44:55 +00:00
2022-09-25 04:31:42 +00:00
if ( isModEnabled ( 'notification' )) {
2021-01-06 19:34:18 +00:00
$langs -> load ( " mails " );
}
2017-07-25 10:44:55 +00:00
$head = myobjectPrepareHead ( $object );
2022-03-11 09:55:28 +00:00
print dol_get_fiche_head ( $head , 'agenda' , $langs -> trans ( " MyObject " ), - 1 , $object -> picto );
2017-07-25 10:44:55 +00:00
// Object card
// ------------------------------------------------------------
2019-11-12 08:46:08 +00:00
$linkback = '<a href="' . dol_buildpath ( '/mymodule/myobject_list.php' , 1 ) . '?restore_lastsearch_values=1' . ( ! empty ( $socid ) ? '&socid=' . $socid : '' ) . '">' . $langs -> trans ( " BackToList " ) . '</a>' ;
2017-07-25 10:44:55 +00:00
2019-11-12 08:46:08 +00:00
$morehtmlref = '<div class="refidno">' ;
2017-07-25 10:44:55 +00:00
/*
2020-05-05 16:53:41 +00:00
// Ref customer
$morehtmlref .= $form -> editfieldkey ( " RefCustomer " , 'ref_client' , $object -> ref_client , $object , 0 , 'string' , '' , 0 , 1 );
$morehtmlref .= $form -> editfieldval ( " RefCustomer " , 'ref_client' , $object -> ref_client , $object , 0 , 'string' , '' , null , null , '' , 1 );
// Thirdparty
$morehtmlref .= '<br>' . $langs -> trans ( 'ThirdParty' ) . ' : ' . ( is_object ( $object -> thirdparty ) ? $object -> thirdparty -> getNomUrl ( 1 ) : '' );
// Project
2023-04-18 18:37:07 +00:00
if ( isModEnabled ( 'project' )) {
2020-05-05 16:53:41 +00:00
$langs -> load ( " projects " );
$morehtmlref .= '<br>' . $langs -> trans ( 'Project' ) . ' ' ;
2021-01-06 19:34:18 +00:00
if ( $permissiontoadd ) {
if ( $action != 'classify' ) {
2025-10-17 00:31:07 +00:00
//$morehtmlref.='<a class="editfielda" href="' . dolBuildUrl($_SERVER['PHP_SELF'], ['action' => 'classify', 'id' => $object->id], true) . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
2021-01-06 19:34:18 +00:00
}
2020-05-05 16:53:41 +00:00
$morehtmlref .= ' : ' ;
if ( $action == 'classify' ) {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref .= '<form method="post" action="' . $_SERVER [ 'PHP_SELF' ] . '?id=' . $object -> id . '">' ;
$morehtmlref .= '<input type="hidden" name="action" value="classin">' ;
$morehtmlref .= '<input type="hidden" name="token" value="' . newToken () . '">' ;
$morehtmlref .= $formproject -> select_projects ( $object -> socid , $object -> fk_project , 'projectid' , $maxlength , 0 , 1 , 0 , 1 , 0 , 0 , '' , 1 );
$morehtmlref .= '<input type="submit" class="button valignmiddle" value="' . $langs -> trans ( " Modify " ) . '">' ;
$morehtmlref .= '</form>' ;
} else {
$morehtmlref .= $form -> form_project ( $_SERVER [ 'PHP_SELF' ] . '?id=' . $object -> id , $object -> socid , $object -> fk_project , 'none' , 0 , 0 , 0 , 1 );
}
2020-05-01 06:40:55 +00:00
} else {
2022-08-31 20:14:20 +00:00
if ( ! empty ( $object -> fk_project )) {
2020-05-05 16:53:41 +00:00
$proj = new Project ( $db );
$proj -> fetch ( $object -> fk_project );
$morehtmlref .= ': ' . $proj -> getNomUrl ();
} else {
$morehtmlref .= '' ;
}
2020-05-01 06:40:55 +00:00
}
2020-05-05 16:53:41 +00:00
} */
2019-11-12 08:46:08 +00:00
$morehtmlref .= '</div>' ;
2017-07-25 10:44:55 +00:00
dol_banner_tab ( $object , 'ref' , $linkback , 1 , 'ref' , 'ref' , $morehtmlref );
2020-05-01 06:40:55 +00:00
print '<div class="fichecenter">' ;
print '<div class="underbanner clearboth"></div>' ;
2017-07-25 10:44:55 +00:00
2020-05-01 06:40:55 +00:00
$object -> info ( $object -> id );
2019-05-19 07:16:45 +00:00
dol_print_object_info ( $object , 1 );
2017-07-25 10:44:55 +00:00
print '</div>' ;
2020-10-27 17:19:31 +00:00
print dol_get_fiche_end ();
2017-07-25 10:44:55 +00:00
// Actions buttons
2020-05-01 06:40:55 +00:00
$objthirdparty = $object ;
$objcon = new stdClass ();
2025-11-12 08:44:39 +00:00
$out = '&origin=' . urlencode ( $object -> element . ( ! empty ( $object -> module ) ? '@' . $object -> module : '' )) . '&originid=' . urlencode (( string ) $object -> id );
2020-10-09 13:54:13 +00:00
$urlbacktopage = $_SERVER [ 'PHP_SELF' ] . '?id=' . $object -> id ;
2020-10-09 17:48:35 +00:00
$out .= '&backtopage=' . urlencode ( $urlbacktopage );
2023-06-14 17:54:16 +00:00
$permok = $user -> hasRight ( 'agenda' , 'myactions' , 'create' );
2021-01-06 19:34:18 +00:00
if (( ! empty ( $objthirdparty -> id ) || ! empty ( $objcon -> id )) && $permok ) {
2020-05-01 06:40:55 +00:00
//$out.='<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create';
2021-01-06 19:34:18 +00:00
if ( get_class ( $objthirdparty ) == 'Societe' ) {
2024-08-18 16:16:08 +00:00
$out .= '&socid=' . urlencode (( string ) $objthirdparty -> id );
2021-01-06 19:34:18 +00:00
}
2022-12-26 13:33:30 +00:00
$out .= ( ! empty ( $objcon -> id ) ? '&contactid=' . urlencode ( $objcon -> id ) : '' );
2020-05-01 06:40:55 +00:00
//$out.=$langs->trans("AddAnAction").' ';
//$out.=img_picto($langs->trans("AddAnAction"),'filenew');
//$out.="</a>";
2017-07-25 10:44:55 +00:00
}
2023-02-11 12:04:23 +00:00
$morehtmlright = '' ;
2017-07-25 10:44:55 +00:00
2023-02-11 12:04:23 +00:00
//$messagingUrl = DOL_URL_ROOT.'/societe/messaging.php?socid='.$object->id;
//$morehtmlright .= dolGetButtonTitle($langs->trans('ShowAsConversation'), '', 'fa fa-comments imgforviewmode', $messagingUrl, '', 1);
//$messagingUrl = DOL_URL_ROOT.'/societe/agenda.php?socid='.$object->id;
//$morehtmlright .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 2);
2017-07-25 10:44:55 +00:00
2022-06-09 20:16:48 +00:00
if ( isModEnabled ( 'agenda' )) {
2023-02-13 12:51:35 +00:00
if ( $user -> hasRight ( 'agenda' , 'myactions' , 'create' ) || $user -> hasRight ( 'agenda' , 'allactions' , 'create' )) {
2023-02-11 12:04:23 +00:00
$morehtmlright .= dolGetButtonTitle ( $langs -> trans ( 'AddAction' ), '' , 'fa fa-plus-circle' , DOL_URL_ROOT . '/comm/action/card.php?action=create' . $out );
2020-05-20 22:02:33 +00:00
} else {
2023-02-11 12:04:23 +00:00
$morehtmlright .= dolGetButtonTitle ( $langs -> trans ( 'AddAction' ), '' , 'fa fa-plus-circle' , DOL_URL_ROOT . '/comm/action/card.php?action=create' . $out , '' , 0 );
2020-05-01 06:40:55 +00:00
}
}
2017-07-25 10:44:55 +00:00
2023-06-12 18:10:42 +00:00
if ( isModEnabled ( 'agenda' ) && ( $user -> hasRight ( 'agenda' , 'myactions' , 'read' ) || $user -> hasRight ( 'agenda' , 'allactions' , 'read' ))) {
2023-02-11 12:04:23 +00:00
print '<br>' ;
2025-11-17 18:35:10 +00:00
$param = '&id=' . $object -> id ;
if ( ! empty ( $contextpage ) && $contextpage != getDolDefaultContextPage ( __FILE__ )) {
2021-01-06 19:34:18 +00:00
$param .= '&contextpage=' . urlencode ( $contextpage );
}
if ( $limit > 0 && $limit != $conf -> liste_limit ) {
2023-04-07 23:43:21 +00:00
$param .= '&limit=' . (( int ) $limit );
2021-01-06 19:34:18 +00:00
}
2026-02-12 00:22:01 +00:00
if ( $search_rowid ) {
$param .= '&search_rowid=' . urlencode ( $search_rowid );
}
if ( $actioncode !== '' && $actioncode !== '-1' ) {
$param .= '&actioncode=' . urlencode ( $actioncode );
}
if ( $search_agenda_label ) {
$param .= '&search_agenda_label=' . urlencode ( $search_agenda_label );
}
if ( $search_complete != '' ) {
$param .= '&search_complete=' . urlencode ( $search_complete );
}
if ( $search_filtert != '' ) {
2026-02-16 19:25:07 +00:00
$param .= '&search_filtert=' . urlencode (( string ) $search_filtert );
2026-02-12 00:22:01 +00:00
}
if ( $search_dateevent_start != '' ) {
$param .= '&dateevent_startyear=' . GETPOSTINT ( 'dateevent_startyear' );
$param .= '&dateevent_startmonth=' . GETPOSTINT ( 'dateevent_startmonth' );
$param .= '&dateevent_startday=' . GETPOSTINT ( 'dateevent_startday' );
}
if ( $search_dateevent_end != '' ) {
$param .= '&dateevent_endyear=' . GETPOSTINT ( 'dateevent_endyear' );
$param .= '&dateevent_endmonth=' . GETPOSTINT ( 'dateevent_endmonth' );
$param .= '&dateevent_endday=' . GETPOSTINT ( 'dateevent_endday' );
}
2017-07-25 10:44:55 +00:00
2023-03-06 16:42:06 +00:00
// Try to know count of actioncomm from cache
2023-10-20 10:44:08 +00:00
$nbEvent = 0 ;
2023-11-04 15:02:24 +00:00
//require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
//$cachekey = 'count_events_myobject_'.$object->id;
//$nbEvent = dol_getcache($cachekey);
2023-12-04 12:46:42 +00:00
$titlelist = $langs -> trans ( " Actions " ) . ( is_numeric ( $nbEvent ) ? '<span class="opacitymedium colorblack paddingleft">(' . $nbEvent . ')</span>' : '' );
2024-09-25 00:35:56 +00:00
if ( ! empty ( $conf -> dol_optimize_smallscreen )) {
$titlelist = $langs -> trans ( " Actions " ) . ( is_numeric ( $nbEvent ) ? '<span class="opacitymedium colorblack paddingleft">(' . $nbEvent . ')</span>' : '' );
}
2023-10-20 10:44:08 +00:00
2026-08-01 22:11:28 +00:00
// Hook to let external modules add buttons to the object right toolbar. Works on any object page; the hook gets the context (elementtype) so a module can scope itself (e.g. only on event pages).
$parameters = array ( 'morehtmlright' => & $morehtmlright , 'elementtype' => $object -> element );
$reshook = $hookmanager -> executeHooks ( 'printObjectRightToolbar' , $parameters , $object , $action );
if ( $reshook < 0 ) {
setEventMessages ( $hookmanager -> error , $hookmanager -> errors , 'errors' );
} else {
$morehtmlright .= $hookmanager -> resPrint ;
}
2026-02-12 00:22:01 +00:00
print_barre_liste ( $titlelist , 0 , $_SERVER [ " PHP_SELF " ], $param , $sortfield , $sortorder , '' , 0 , - 1 , '' , 0 , $morehtmlright , '' , 0 , 1 , 0 );
2017-07-25 10:44:55 +00:00
2020-05-01 06:40:55 +00:00
// List of all actions
2026-02-12 00:22:01 +00:00
$filters = array ();
$filters [ 'search_agenda_label' ] = $search_agenda_label ;
$filters [ 'search_rowid' ] = $search_rowid ;
$filters [ 'search_complete' ] = $search_complete ; // Can be 'na', '0', '100', '50'
$filters [ 'search_filtert' ] = $search_filtert ;
2017-07-25 10:44:55 +00:00
2026-02-12 00:22:01 +00:00
// TODO Replace this with the same code than into list.php
2025-11-12 08:44:39 +00:00
show_actions_done ( $conf , $langs , $db , $object , null , 0 , $actioncode , '' , $filters , $sortfield , $sortorder , ! empty ( $object -> module ) ? $object -> module : '' );
2020-05-01 06:40:55 +00:00
}
2017-07-25 10:44:55 +00:00
}
2018-08-14 07:55:58 +00:00
// End of page
2017-07-25 10:44:55 +00:00
llxFooter ();
$db -> close ();