32require
'../main.inc.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
34require_once DOL_DOCUMENT_ROOT.
'/core/lib/agenda.lib.php';
35require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/core/class/defaultvalues.class.php';
43$langs->loadLangs(array(
'admin',
'other',
'agenda',
'users'));
45$action =
GETPOST(
'action',
'aZ09');
46$value =
GETPOST(
'value',
'alpha');
47$modulepart =
GETPOST(
'modulepart',
'aZ09');
49$param =
GETPOST(
'param',
'alpha');
50$cancel =
GETPOST(
'cancel',
'alpha');
51$scandir =
GETPOST(
'scan_dir',
'alpha');
62include DOL_DOCUMENT_ROOT.
'/core/actions_setmoduleoptions.inc.php';
65if (preg_match(
'/set_([a-z0-9_\-]+)/i', $action, $reg)) {
69 header(
"Location: ".$_SERVER[
"PHP_SELF"]);
76if (preg_match(
'/del_([a-z0-9_\-]+)/i', $action, $reg)) {
79 header(
"Location: ".$_SERVER[
"PHP_SELF"]);
85if ($action ==
'set') {
86 $getDefaultFilter =
GETPOST(
'AGENDA_DEFAULT_FILTER_TYPE');
87 $defaultfilter = (is_array($getDefaultFilter)) ? implode(
',', $getDefaultFilter) : $getDefaultFilter;
88 dolibarr_set_const($db,
'AGENDA_USE_EVENT_TYPE_DEFAULT',
GETPOST(
'AGENDA_USE_EVENT_TYPE_DEFAULT'),
'chaine', 0,
'', $conf->entity);
89 dolibarr_set_const($db,
'AGENDA_DEFAULT_FILTER_TYPE', $defaultfilter,
'chaine', 0,
'', $conf->entity);
90 dolibarr_set_const($db,
'AGENDA_DEFAULT_FILTER_STATUS',
GETPOST(
'AGENDA_DEFAULT_FILTER_STATUS'),
'chaine', 0,
'', $conf->entity);
94 $result = $defaultValues->fetchAll(
'',
'', 0, 0, array(
't.page' =>
'comm/action/card.php',
't.param' =>
'complete',
't.user_id' =>
'0',
't.type' =>
'createform',
't.entity' => $conf->entity));
95 if (!is_array($result) && $result < 0) {
97 } elseif (count($result) > 0) {
98 foreach ($result as $defval) {
99 $defaultValues->id = $defval->id;
100 $resultDel = $defaultValues->delete($user);
101 if ($resultDel < 0) {
106 $defaultValues->type =
'createform';
107 $defaultValues->entity = $conf->entity;
108 $defaultValues->user_id = 0;
109 $defaultValues->page =
'comm/action/card.php';
110 $defaultValues->param =
'complete';
111 $defaultValues->value =
GETPOST(
'AGENDA_EVENT_DEFAULT_STATUS');
112 $resultCreat = $defaultValues->create($user);
113 if ($resultCreat < 0) {
118} elseif ($action ==
'specimen') {
119 $modele =
GETPOST(
'module',
'alpha');
122 $commande->initAsSpecimen();
123 $commande->thirdparty = $specimenthirdparty;
128 $dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
129 foreach ($dirmodels as $reldir) {
130 $file =
dol_buildpath($reldir.
"core/modules/action/doc/pdf_".$modele.
".modules.php", 0);
131 if (file_exists($file)) {
132 $classname =
"pdf_".$modele;
137 if ($classname !==
'') {
140 $module =
new $classname($db, $commande);
141 '@phan-var-force pdf_standard_actions $module';
143 if ($module->write_file($commande, $langs) > 0) {
144 header(
"Location: ".DOL_URL_ROOT.
"/document.php?modulepart=action&file=SPECIMEN.pdf");
152 dol_syslog($langs->trans(
"ErrorModuleNotFound"), LOG_ERR);
154} elseif ($action ==
'setmodel') {
158} elseif ($action ==
'del') {
161 if ($conf->global->ACTION_EVENT_ADDON_PDF ==
"$value") {
165} elseif ($action ==
'setdoc') {
167 if (
dolibarr_set_const($db,
"ACTION_EVENT_ADDON_PDF", $value,
'chaine', 0,
'', $conf->entity)) {
170 $conf->global->ACTION_EVENT_ADDON_PDF = $value;
188$dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
190$wikihelp =
'EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda|DE:Modul_Terminplanung';
191llxHeader(
'', $langs->trans(
"AgendaSetup"), $wikihelp,
'', 0, 0,
'',
'',
'',
'mod-admin page-agenda_other');
193$linkback =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToModuleList").
'</a>';
194print
load_fiche_titre($langs->trans(
"AgendaSetup"), $linkback,
'title_setup');
211$sql .=
" FROM ".MAIN_DB_PREFIX.
"document_model";
212$sql .=
" WHERE type = 'action'";
213$sql .=
" AND entity = ".$conf->entity;
215$resql = $db->query($sql);
218 $num_rows = $db->num_rows($resql);
219 while ($i < $num_rows) {
220 $array = $db->fetch_array($resql);
221 if (is_array($array)) {
222 array_push($def, $array[0]);
233 print
'<table class="noborder centpercent">'.
"\n";
234 print
'<tr class="liste_titre">'.
"\n";
235 print
'<td width="100">'.$langs->trans(
"Name").
'</td>'.
"\n";
236 print
'<td>'.$langs->trans(
"Description").
'</td>'.
"\n";
237 print
'<td class="center" width="60">'.$langs->trans(
"Status").
'</td>'.
"\n";
238 print
'<td class="center" width="60">'.$langs->trans(
"Default").
'</td>'.
"\n";
239 print
'<td class="center" width="40">'.$langs->trans(
"ShortInfo").
'</td>';
240 print
'<td class="center" width="40">'.$langs->trans(
"Preview").
'</td>';
245 foreach ($dirmodels as $reldir) {
249 $handle = opendir($dir);
250 if (is_resource($handle)) {
251 while (($file = readdir($handle)) !==
false) {
252 if (preg_match(
'/\.modules\.php$/i', $file) && preg_match(
'/^(pdf_|doc_)/', $file)) {
253 $name = substr($file, 4,
dol_strlen($file) - 16);
254 $classname = substr($file, 0,
dol_strlen($file) - 12);
256 require_once $dir.
'/'.$file;
257 $module =
new $classname($db,
new ActionComm($db));
259 print
'<tr class="oddeven">'.
"\n";
261 print(empty($module->name) ? $name : $module->
name);
264 require_once $dir.
'/'.$file;
265 $module =
new $classname($db, $specimenthirdparty);
266 if (method_exists($module,
'info')) {
267 print $module->info($langs);
269 print $module->description;
274 if (in_array($name, $def)) {
275 print
'<td class="center">'.
"\n";
276 if ($conf->global->ACTION_EVENT_ADDON_PDF !=
"$name") {
277 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=del&token='.
newToken().
'&value='.$name.
'&scan_dir='.$module->scandir.
'&label='.urlencode($module->name).
'&type=action">';
278 print
img_picto($langs->trans(
"Enabled"),
'switch_on');
281 print
img_picto($langs->trans(
"Enabled"),
'switch_on');
285 print
'<td class="center">'.
"\n";
286 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>';
291 print
'<td class="center">';
292 if ($conf->global->ACTION_EVENT_ADDON_PDF ==
"$name") {
293 print
img_picto($langs->trans(
"Default"),
'on');
295 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>';
300 $htmltooltip =
''.$langs->trans(
"Name").
': '.$module->name;
301 $htmltooltip .=
'<br>'.$langs->trans(
"Type").
': '.($module->type ? $module->type : $langs->trans(
"Unknown"));
302 $htmltooltip .=
'<br>'.$langs->trans(
"Width").
'/'.$langs->trans(
"Height").
': '.$module->page_largeur.
'/'.$module->page_hauteur;
303 $htmltooltip .=
'<br><br><u>'.$langs->trans(
"FeaturesSupported").
':</u>';
304 $htmltooltip .=
'<br>'.$langs->trans(
"Logo").
': '.
yn($module->option_logo, 1, 1);
305 print
'<td class="center">';
306 print
$form->textwithpicto(
'', $htmltooltip, 1, 0);
308 print
'<td class="center">';
309 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=specimen&module='.$name.
'">'.
img_object($langs->trans(
"Preview"),
'pdf').
'</a>';
319 print
'</table><br>';
325print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" name="agenda">';
326print
'<input type="hidden" name="token" value="'.newToken().
'">';
327print
'<input type="hidden" name="action" value="set">';
329print
'<table class="noborder allwidth">'.
"\n";
330print
'<tr class="liste_titre">'.
"\n";
331print
'<td>'.$langs->trans(
"Parameters").
'</td>'.
"\n";
332print
'<td class="center"> </td>'.
"\n";
333print
'<td class="right">'.$langs->trans(
"Value").
'</td>'.
"\n";
337print
'<tr class="oddeven">'.
"\n";
338$htmltext = $langs->trans(
"ThisValueCanOverwrittenOnUserLevel", $langs->transnoentitiesnoconv(
"UserGUISetup"));
339print
'<td>'.$form->textwithpicto($langs->trans(
"AGENDA_DEFAULT_VIEW"), $htmltext).
'</td>'.
"\n";
340print
'<td class="center"> </td>'.
"\n";
341print
'<td class="right">'.
"\n";
342$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"));
344print
'</td></tr>'.
"\n";
348print
'<tr class="oddeven">'.
"\n";
349print
'<td>'.$langs->trans(
"AGENDA_USE_EVENT_TYPE").
'</td>'.
"\n";
350print
'<td class="center"> </td>'.
"\n";
351print
'<td class="right">'.
"\n";
354 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=set_AGENDA_USE_EVENT_TYPE&token='.
newToken().
'">'.
img_picto($langs->trans(
"Disabled"),
'switch_off').
'</a>';
356 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=del_AGENDA_USE_EVENT_TYPE&token='.
newToken().
'">'.
img_picto($langs->trans(
"Enabled"),
'switch_on').
'</a>';
358print
'</td></tr>'.
"\n";
361 print
'<!-- AGENDA_USE_EVENT_TYPE_DEFAULT -->';
362 print
'<tr class="oddeven">'.
"\n";
363 print
'<td>'.$langs->trans(
"AGENDA_USE_EVENT_TYPE_DEFAULT").
'</td>'.
"\n";
364 print
'<td class="center"> </td>'.
"\n";
365 print
'<td class="right nowrap">'.
"\n";
366 $formactions->select_type_actions(
getDolGlobalString(
'AGENDA_USE_EVENT_TYPE_DEFAULT'),
"AGENDA_USE_EVENT_TYPE_DEFAULT",
'systemauto', 0, 1);
367 print
'</td></tr>'.
"\n";
371print
'<tr class="oddeven">'.
"\n";
372print
'<td>'.$langs->trans(
"AGENDA_EVENT_DEFAULT_STATUS").
'</td>'.
"\n";
373print
'<td class="center"> </td>'.
"\n";
374print
'<td class="right nowrap">'.
"\n";
377$result = $defaultValues->fetchAll(
'',
'', 0, 0, array(
't.page' =>
'comm/action/card.php',
't.param' =>
'complete',
't.user_id' =>
'0',
't.type' =>
'createform',
't.entity' => $conf->entity));
378if (!is_array($result) && $result < 0) {
380} elseif (count($result) > 0) {
381 $defval = reset($result)->value;
383$formactions->form_select_status_action(
'agenda', $defval, 1,
"AGENDA_EVENT_DEFAULT_STATUS", 0, 1,
'maxwidth200 onrightofpage');
384print
'</td></tr>'.
"\n";
387print
'<tr class="oddeven">'.
"\n";
388print
'<td>'.$langs->trans(
"AGENDA_DEFAULT_FILTER_TYPE").
'</td>'.
"\n";
389print
'<td class="center"> </td>'.
"\n";
390print
'<td class="right nowrap">'.
"\n";
396$formactions->select_type_actions(
getDolGlobalString(
'AGENDA_DEFAULT_FILTER_TYPE'),
"AGENDA_DEFAULT_FILTER_TYPE",
'', (
getDolGlobalString(
'AGENDA_USE_EVENT_TYPE') ? -1 : 1), 1, $multiselect);
397print
'</td></tr>'.
"\n";
401print
'<tr class="oddeven">'.
"\n";
402print
'<td>'.$langs->trans(
"AGENDA_DEFAULT_FILTER_STATUS").
'</td>'.
"\n";
403print
'<td class="center"> </td>'.
"\n";
404print
'<td class="right">'.
"\n";
405$formactions->form_select_status_action(
'agenda',
getDolGlobalString(
'AGENDA_DEFAULT_FILTER_STATUS'), 1,
'AGENDA_DEFAULT_FILTER_STATUS', 1, 2,
'minwidth100');
406print
'</td></tr>'.
"\n";
410print
$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.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage agenda events (actions)
Class to manage predefined suppliers products.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
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...
getDolGlobalString($key, $default='')
Return 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.