32require
'../main.inc.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/lib/agenda.lib.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
43require_once DOL_DOCUMENT_ROOT.
'/core/class/defaultvalues.class.php';
44require_once DOL_DOCUMENT_ROOT.
'/comm/action/class/actioncomm.class.php';
51$langs->loadLangs(array(
'admin',
'other',
'agenda',
'users'));
53$action =
GETPOST(
'action',
'aZ09');
54$value =
GETPOST(
'value',
'alpha');
55$label =
GETPOST(
'label',
'alpha');
56$modulepart =
GETPOST(
'modulepart',
'aZ09');
58$param =
GETPOST(
'param',
'alpha');
59$cancel =
GETPOST(
'cancel',
'alpha');
60$scandir =
GETPOST(
'scan_dir',
'alpha');
71include DOL_DOCUMENT_ROOT.
'/core/actions_setmoduleoptions.inc.php';
74if (preg_match(
'/set_([a-z0-9_\-]+)/i', $action, $reg)) {
78 header(
"Location: ".$_SERVER[
"PHP_SELF"]);
85if (preg_match(
'/del_([a-z0-9_\-]+)/i', $action, $reg)) {
88 header(
"Location: ".$_SERVER[
"PHP_SELF"]);
94if ($action ==
'set') {
95 $getDefaultFilter =
GETPOST(
'AGENDA_DEFAULT_FILTER_TYPE');
96 $defaultfilter = (is_array($getDefaultFilter)) ? implode(
',', $getDefaultFilter) : $getDefaultFilter;
103 $result = $defaultValues->fetchAll(
'',
'', 0, 0,
"(t.page:=:'comm/action/card.php') AND (t.param:=:'complete') AND (t.user_id:=:0) AND (t.type:=:'createform') AND (t.entity:=:".((
int)
$conf->entity).
")");
104 if (!is_array($result) && $result < 0) {
106 } elseif (count($result) > 0) {
107 foreach ($result as $defval) {
108 $defaultValues->id = $defval->id;
109 $resultDel = $defaultValues->delete($user);
110 if ($resultDel < 0) {
115 $defaultValues->type =
'createform';
116 $defaultValues->entity =
$conf->entity;
117 $defaultValues->user_id = 0;
118 $defaultValues->page =
'comm/action/card.php';
119 $defaultValues->param =
'complete';
120 $defaultValues->value =
GETPOST(
'AGENDA_EVENT_DEFAULT_STATUS');
121 $resultCreat = $defaultValues->create($user);
122 if ($resultCreat < 0) {
127} elseif ($action ==
'specimen') {
128 $modele =
GETPOST(
'module',
'alpha');
131 $action->initAsSpecimen();
133 $specimenthirdparty->initAsSpecimen();
134 $action->thirdparty = $specimenthirdparty;
139 $dirmodels = array_merge(array(
'/'), (array)
$conf->modules_parts[
'models']);
140 foreach ($dirmodels as $reldir) {
141 $file =
dol_buildpath($reldir.
"core/modules/action/doc/pdf_".$modele.
".modules.php", 0);
142 if (file_exists($file)) {
143 $classname =
"pdf_".$modele;
148 if ($classname !==
'') {
151 $module =
new $classname(
$db, $action);
152 '@phan-var-force pdf_standard_actions $module';
154 if ($module->write_file($action, $langs) > 0) {
155 header(
"Location: ".DOL_URL_ROOT.
"/document.php?modulepart=action&file=SPECIMEN.pdf");
163 dol_syslog($langs->trans(
"ErrorModuleNotFound"), LOG_ERR);
165} elseif ($action ==
'setmodel') {
169} elseif ($action ==
'del') {
176} elseif ($action ==
'setdoc') {
195$dirmodels = array_merge(array(
'/'), (array)
$conf->modules_parts[
'models']);
197$wikihelp =
'EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda|DE:Modul_Terminplanung';
198llxHeader(
'', $langs->trans(
"AgendaSetup"), $wikihelp,
'', 0, 0,
'',
'',
'',
'mod-admin page-agenda_other');
200$linkback =
'<a href="'.dolBuildUrl(DOL_URL_ROOT.
'/admin/modules.php', [
'restore_lastsearch_values' => 1]).
'">'.
img_picto($langs->trans(
"BackToModuleList"),
'back',
'class="pictofixedwidth"').
'<span class="hideonsmartphone">'.$langs->trans(
"BackToModuleList").
'</span></a>';
202print
load_fiche_titre($langs->trans(
"AgendaSetup"), $linkback,
'title_setup');
219$sql .=
" FROM ".MAIN_DB_PREFIX.
"document_model";
220$sql .=
" WHERE type = 'action'";
221$sql .=
" AND entity = ".((int)
$conf->entity);
223$resql =
$db->query($sql);
226 $num_rows =
$db->num_rows($resql);
227 while ($i < $num_rows) {
228 $array =
$db->fetch_array($resql);
229 if (is_array($array)) {
230 array_push($def, $array[0]);
241 print
'<div class="div-table-responsive-no-min">';
242 print
'<table class="noborder centpercent">'.
"\n";
243 print
'<tr class="liste_titre">'.
"\n";
244 print
'<td width="100">'.$langs->trans(
"Name").
'</td>'.
"\n";
245 print
'<td>'.$langs->trans(
"Description").
'</td>'.
"\n";
246 print
'<td class="center" width="60">'.$langs->trans(
"Status").
'</td>'.
"\n";
247 print
'<td class="center" width="60">'.$langs->trans(
"Default").
'</td>'.
"\n";
248 print
'<td class="center" width="40">'.$langs->trans(
"ShortInfo").
'</td>';
249 print
'<td class="center" width="40">'.$langs->trans(
"Preview").
'</td>';
255 $specimenthirdparty->initAsSpecimen();
257 foreach ($dirmodels as $reldir) {
261 $handle = opendir($dir);
262 if (is_resource($handle)) {
263 while (($file = readdir($handle)) !==
false) {
264 if (preg_match(
'/\.modules\.php$/i', $file) && preg_match(
'/^(pdf_|doc_)/', $file)) {
265 $name = substr($file, 4,
dol_strlen($file) - 16);
266 $classname = substr($file, 0,
dol_strlen($file) - 12);
267 require_once $dir.
'/'.$file;
270 '@phan-var-force ModeleAction $module';
272 print
'<tr class="oddeven">'.
"\n";
274 print(empty($module->name) ? $name : $module->
name);
277 require_once $dir.
'/'.$file;
278 $module =
new $classname(
$db, $specimenthirdparty);
279 '@phan-var-force ModeleAction $module';
280 if (method_exists($module,
'info')) {
281 print $module->info($langs);
283 print $module->description;
288 if (in_array($name, $def)) {
289 print
'<td class="center">'.
"\n";
291 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=del&token='.newToken().
'&value='.$name.
'&scan_dir='.$module->scandir.
'&label='.urlencode($module->name).
'&type=action">';
292 print
img_picto($langs->trans(
"Enabled"),
'switch_on');
295 print
img_picto($langs->trans(
"Enabled"),
'switch_on');
299 print
'<td class="center">'.
"\n";
300 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=setmodel&token='.newToken().
'&value='.$name.
'&scan_dir='.$module->scandir.
'&label='.urlencode($module->name).
'&type=action">'.
img_picto($langs->trans(
"Disabled"),
'switch_off').
'</a>';
305 print
'<td class="center">';
307 print
img_picto($langs->trans(
"Default"),
'on');
309 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=setdoc&token='.newToken().
'&value='.urlencode($name).
'&scan_dir='.urlencode($module->scandir).
'&label='.urlencode($module->name).
'&type=action"" alt="'.$langs->trans(
"Default").
'">'.
img_picto($langs->trans(
"Disabled"),
'off').
'</a>';
314 $htmltooltip =
''.$langs->trans(
"Name").
': '.$module->name;
315 $htmltooltip .=
'<br>'.$langs->trans(
"Type").
': '.($module->type ? $module->type : $langs->trans(
"Unknown"));
316 $htmltooltip .=
'<br>'.$langs->trans(
"Width").
'/'.$langs->trans(
"Height").
': '.$module->page_largeur.
'/'.$module->page_hauteur;
317 $htmltooltip .=
'<br><br><u>'.$langs->trans(
"FeaturesSupported").
':</u>';
318 $htmltooltip .=
'<br>'.$langs->trans(
"Logo").
': '.
yn($module->option_logo, 1, 1);
319 print
'<td class="center">';
320 print
$form->textwithpicto(
'', $htmltooltip, 1,
'info');
322 print
'<td class="center">';
323 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=specimen&module='.$name.
'">'.
img_object($langs->trans(
"Preview"),
'pdf').
'</a>';
341print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" name="agenda">';
342print
'<input type="hidden" name="token" value="'.newToken().
'">';
343print
'<input type="hidden" name="action" value="set">';
345print
'<div class="div-table-responsive-no-min">';
346print
'<table class="noborder allwidth">'.
"\n";
347print
'<tr class="liste_titre">'.
"\n";
348print
'<td>'.$langs->trans(
"Parameters").
'</td>'.
"\n";
349print
'<td class="center"> </td>'.
"\n";
350print
'<td class="right"></td>'.
"\n";
354print
'<tr class="oddeven">'.
"\n";
355$htmltext = $langs->trans(
"ThisValueCanOverwrittenOnUserLevel", $langs->transnoentitiesnoconv(
"UserGUISetup"));
356print
'<td class="minwidth200onall">'.$form->textwithpicto($langs->trans(
"AGENDA_DEFAULT_VIEW"), $htmltext).
'</td>'.
"\n";
357print
'<td class="center"> </td>'.
"\n";
358print
'<td class="right parentonrightofpage">'.
"\n";
359$tmplist = array(
'' =>
' ',
'show_list' => $langs->trans(
"ViewList"),
'show_month' => $langs->trans(
"ViewCal"),
'show_week' => $langs->trans(
"ViewWeek"),
'show_day' => $langs->trans(
"ViewDay"),
'show_peruser' => $langs->trans(
"ViewPerUser"));
360print
$form->selectarray(
'AGENDA_DEFAULT_VIEW', $tmplist,
getDolGlobalString(
'AGENDA_DEFAULT_VIEW',
'show_month'), 0, 0, 0,
'', 0, 0, 0,
'',
'right onrightofpage width150');
361print
'</td></tr>'.
"\n";
365print
'<tr class="oddeven">'.
"\n";
366print
'<td>'.$langs->trans(
"AGENDA_USE_EVENT_TYPE").
'</td>'.
"\n";
367print
'<td class="center"> </td>'.
"\n";
368print
'<td class="right">'.
"\n";
371 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=set_AGENDA_USE_EVENT_TYPE&token='.newToken().
'">'.
img_picto($langs->trans(
"Disabled"),
'switch_off').
'</a>';
373 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=del_AGENDA_USE_EVENT_TYPE&token='.newToken().
'">'.
img_picto($langs->trans(
"Enabled"),
'switch_on').
'</a>';
375print
'</td></tr>'.
"\n";
378 print
'<!-- AGENDA_USE_EVENT_TYPE_DEFAULT -->';
379 print
'<tr class="oddeven">'.
"\n";
380 print
'<td>'.$langs->trans(
"AGENDA_USE_EVENT_TYPE_DEFAULT").
'</td>'.
"\n";
381 print
'<td class="center"> </td>'.
"\n";
382 print
'<td class="right parentonrightofpage">'.
"\n";
383 print $formactions->select_type_actions(
getDolGlobalString(
'AGENDA_USE_EVENT_TYPE_DEFAULT'),
"AGENDA_USE_EVENT_TYPE_DEFAULT",
'systemauto', 0, 1, 0, 1,
'minwidth300 right onrightofpage', 1);
384 print
'</td></tr>'.
"\n";
388print
'<tr class="oddeven">'.
"\n";
389print
'<td>'.$langs->trans(
"AGENDA_EVENT_DEFAULT_STATUS").
'</td>'.
"\n";
390print
'<td class="center"> </td>'.
"\n";
391print
'<td class="right parentonrightofpage">'.
"\n";
394$result = $defaultValues->fetchAll(
'',
'', 0, 0,
"(t.page:=:'comm/action/card.php') AND (t.param:=:'complete') AND (t.user_id:=:0) AND (t.type:=:'createform') AND (t.entity:=:".((
int)
$conf->entity).
")");
395if (!is_array($result) && $result < 0) {
397} elseif (count($result) > 0) {
398 $defval = reset($result)->value;
400$formactions->form_select_status_action(
'agenda', $defval, 1,
"AGENDA_EVENT_DEFAULT_STATUS", 0, 1,
'right width200 onrightofpage');
401print
'</td></tr>'.
"\n";
404print
'<tr class="oddeven">'.
"\n";
405print
'<td>'.$langs->trans(
"AGENDA_DEFAULT_FILTER_TYPE").
'</td>'.
"\n";
406print
'<td class="center"> </td>'.
"\n";
407print
'<td class="right nowrap">'.
"\n";
413print $formactions->select_type_actions(
getDolGlobalString(
'AGENDA_DEFAULT_FILTER_TYPE'),
"AGENDA_DEFAULT_FILTER_TYPE",
'', (
getDolGlobalString(
'AGENDA_USE_EVENT_TYPE') ? -1 : 1), 1, $multiselect, 1,
'minwidth300', 1);
414print
'</td></tr>'.
"\n";
418print
'<tr class="oddeven">'.
"\n";
419print
'<td>'.$langs->trans(
"AGENDA_DEFAULT_FILTER_STATUS").
'</td>'.
"\n";
420print
'<td class="center"> </td>'.
"\n";
421print
'<td class="right">'.
"\n";
422$formactions->form_select_status_action(
'agenda',
getDolGlobalString(
'AGENDA_DEFAULT_FILTER_STATUS'), 1,
'AGENDA_DEFAULT_FILTER_STATUS', 1, 2,
'minwidth100');
423print
'</td></tr>'.
"\n";
428print
$form->buttonsSaveCancel(
"Save",
'');
addDocumentModel($name, $type, $label='', $description='')
Add document model used by doc generator.
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
dolibarr_del_const($db, $name, $entity=1)
Delete a constant.
delDocumentModel($name, $type)
Delete document model used by doc generator.
agenda_prepare_head()
Prepare array with list of tabs.
if(preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) if(preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) if($action=='set') elseif( $action=='specimen') elseif($action=='setmodel') elseif( $action=='del') elseif($action=='setdoc') $form
View.
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage agenda events (actions)
Class to manage third parties objects (customers, suppliers, prospects...)
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $allowothertags=array())
Show a picto called object_picto (generic function)
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
yn($yesno, $format=1, $color=0)
Return yes or no in current language.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
$conf db name
Only used if Module[ID]Name translation string is not found.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.