30require
'../main.inc.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/lib/agenda.lib.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/core/class/defaultvalues.class.php';
41$langs->loadLangs(array(
'admin',
'other',
'agenda',
'users'));
43$action =
GETPOST(
'action',
'aZ09');
44$value =
GETPOST(
'value',
'alpha');
45$modulepart =
GETPOST(
'modulepart',
'aZ09');
47$param =
GETPOST(
'param',
'alpha');
48$cancel =
GETPOST(
'cancel',
'alpha');
49$scandir =
GETPOST(
'scan_dir',
'alpha');
60include DOL_DOCUMENT_ROOT.
'/core/actions_setmoduleoptions.inc.php';
63if (preg_match(
'/set_([a-z0-9_\-]+)/i', $action, $reg)) {
67 Header(
"Location: ".$_SERVER[
"PHP_SELF"]);
74if (preg_match(
'/del_([a-z0-9_\-]+)/i', $action, $reg)) {
77 Header(
"Location: ".$_SERVER[
"PHP_SELF"]);
83if ($action ==
'set') {
84 $getDefaultFilter =
GETPOST(
'AGENDA_DEFAULT_FILTER_TYPE');
85 $defaultfilter = (is_array($getDefaultFilter)) ? implode(
',', $getDefaultFilter) : $getDefaultFilter;
86 dolibarr_set_const($db,
'AGENDA_USE_EVENT_TYPE_DEFAULT',
GETPOST(
'AGENDA_USE_EVENT_TYPE_DEFAULT'),
'chaine', 0,
'', $conf->entity);
87 dolibarr_set_const($db,
'AGENDA_DEFAULT_FILTER_TYPE', $defaultfilter,
'chaine', 0,
'', $conf->entity);
88 dolibarr_set_const($db,
'AGENDA_DEFAULT_FILTER_STATUS',
GETPOST(
'AGENDA_DEFAULT_FILTER_STATUS'),
'chaine', 0,
'', $conf->entity);
92 $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));
93 if (!is_array($result) && $result < 0) {
95 } elseif (count($result) > 0) {
96 foreach ($result as $defval) {
97 $defaultValues->id = $defval->id;
98 $resultDel = $defaultValues->delete($user);
104 $defaultValues->type =
'createform';
105 $defaultValues->entity = $conf->entity;
106 $defaultValues->user_id = 0;
107 $defaultValues->page =
'comm/action/card.php';
108 $defaultValues->param =
'complete';
109 $defaultValues->value =
GETPOST(
'AGENDA_EVENT_DEFAULT_STATUS');
110 $resultCreat = $defaultValues->create($user);
111 if ($resultCreat < 0) {
116} elseif ($action ==
'specimen') {
117 $modele =
GETPOST(
'module',
'alpha');
120 $commande->initAsSpecimen();
121 $commande->thirdparty = $specimenthirdparty;
124 $file =
''; $classname =
''; $filefound = 0;
125 $dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
126 foreach ($dirmodels as $reldir) {
127 $file =
dol_buildpath($reldir.
"core/modules/action/doc/pdf_".$modele.
".modules.php", 0);
128 if (file_exists($file)) {
130 $classname =
"pdf_".$modele;
138 $module =
new $classname($db, $commande);
140 if ($module->write_file($commande, $langs) > 0) {
141 header(
"Location: ".DOL_URL_ROOT.
"/document.php?modulepart=action&file=SPECIMEN.pdf");
149 dol_syslog($langs->trans(
"ErrorModuleNotFound"), LOG_ERR);
151} elseif ($action ==
'setmodel') {
155} elseif ($action ==
'del') {
158 if ($conf->global->ACTION_EVENT_ADDON_PDF ==
"$value") {
162} elseif ($action ==
'setdoc') {
164 if (
dolibarr_set_const($db,
"ACTION_EVENT_ADDON_PDF", $value,
'chaine', 0,
'', $conf->entity)) {
167 $conf->global->ACTION_EVENT_ADDON_PDF = $value;
183$dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
185$wikihelp =
'EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda|DE:Modul_Terminplanung';
186llxHeader(
'', $langs->trans(
"AgendaSetup"), $wikihelp);
188$linkback =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToModuleList").
'</a>';
189print
load_fiche_titre($langs->trans(
"AgendaSetup"), $linkback,
'title_setup');
206$sql .=
" FROM ".MAIN_DB_PREFIX.
"document_model";
207$sql .=
" WHERE type = 'action'";
208$sql .=
" AND entity = ".$conf->entity;
210$resql = $db->query($sql);
213 $num_rows = $db->num_rows($resql);
214 while ($i < $num_rows) {
215 $array = $db->fetch_array($resql);
216 array_push($def, $array[0]);
223if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
226 print
'<table class="noborder centpercent">'.
"\n";
227 print
'<tr class="liste_titre">'.
"\n";
228 print
'<td width="100">'.$langs->trans(
"Name").
'</td>'.
"\n";
229 print
'<td>'.$langs->trans(
"Description").
'</td>'.
"\n";
230 print
'<td class="center" width="60">'.$langs->trans(
"Status").
'</td>'.
"\n";
231 print
'<td class="center" width="60">'.$langs->trans(
"Default").
'</td>'.
"\n";
232 print
'<td class="center" width="40">'.$langs->trans(
"ShortInfo").
'</td>';
233 print
'<td class="center" width="40">'.$langs->trans(
"Preview").
'</td>';
238 foreach ($dirmodels as $reldir) {
242 $handle = opendir($dir);
243 if (is_resource($handle)) {
244 while (($file = readdir($handle)) !==
false) {
245 if (preg_match(
'/\.modules\.php$/i', $file) && preg_match(
'/^(pdf_|doc_)/', $file)) {
246 $name = substr($file, 4,
dol_strlen($file) - 16);
247 $classname = substr($file, 0,
dol_strlen($file) - 12);
249 require_once $dir.
'/'.$file;
250 $module =
new $classname($db,
new ActionComm($db));
252 print
'<tr class="oddeven">'.
"\n";
254 print (empty($module->name) ? $name : $module->
name);
257 require_once $dir.
'/'.$file;
258 $module =
new $classname($db, $specimenthirdparty);
259 if (method_exists($module,
'info')) {
260 print $module->info($langs);
262 print $module->description;
267 if (in_array($name, $def)) {
268 print
'<td class="center">'.
"\n";
269 if ($conf->global->ACTION_EVENT_ADDON_PDF !=
"$name") {
270 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=del&token='.newToken().
'&value='.$name.
'&scan_dir='.$module->scandir.
'&label='.urlencode($module->name).
'&type=action">';
271 print
img_picto($langs->trans(
"Enabled"),
'switch_on');
274 print
img_picto($langs->trans(
"Enabled"),
'switch_on');
278 print
'<td class="center">'.
"\n";
279 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>';
284 print
'<td class="center">';
285 if ($conf->global->ACTION_EVENT_ADDON_PDF ==
"$name") {
286 print
img_picto($langs->trans(
"Default"),
'on');
288 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>';
293 $htmltooltip =
''.$langs->trans(
"Name").
': '.$module->name;
294 $htmltooltip .=
'<br>'.$langs->trans(
"Type").
': '.($module->type ? $module->type : $langs->trans(
"Unknown"));
295 $htmltooltip .=
'<br>'.$langs->trans(
"Width").
'/'.$langs->trans(
"Height").
': '.$module->page_largeur.
'/'.$module->page_hauteur;
296 $htmltooltip .=
'<br><br><u>'.$langs->trans(
"FeaturesSupported").
':</u>';
297 $htmltooltip .=
'<br>'.$langs->trans(
"Logo").
': '.
yn($module->option_logo, 1, 1);
298 print
'<td class="center">';
299 print $form->textwithpicto(
'', $htmltooltip, 1, 0);
301 print
'<td class="center">';
302 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=specimen&module='.$name.
'">'.
img_object($langs->trans(
"Preview"),
'pdf').
'</a>';
312 print
'</table><br>';
318print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" name="agenda">';
319print
'<input type="hidden" name="token" value="'.newToken().
'">';
320print
'<input type="hidden" name="action" value="set">';
322print
'<table class="noborder allwidth">'.
"\n";
323print
'<tr class="liste_titre">'.
"\n";
324print
'<td>'.$langs->trans(
"Parameters").
'</td>'.
"\n";
325print
'<td class="center"> </td>'.
"\n";
326print
'<td class="right">'.$langs->trans(
"Value").
'</td>'.
"\n";
330print
'<tr class="oddeven">'.
"\n";
331$htmltext = $langs->trans(
"ThisValueCanOverwrittenOnUserLevel", $langs->transnoentitiesnoconv(
"UserGUISetup"));
332print
'<td>'.$form->textwithpicto($langs->trans(
"AGENDA_DEFAULT_VIEW"), $htmltext).
'</td>'.
"\n";
333print
'<td class="center"> </td>'.
"\n";
334print
'<td class="right">'.
"\n";
335$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"));
336print $form->selectarray(
'AGENDA_DEFAULT_VIEW', $tmplist,
getDolGlobalString(
'AGENDA_DEFAULT_VIEW'));
337print
'</td></tr>'.
"\n";
341print
'<tr class="oddeven">'.
"\n";
342print
'<td>'.$langs->trans(
"AGENDA_USE_EVENT_TYPE").
'</td>'.
"\n";
343print
'<td class="center"> </td>'.
"\n";
344print
'<td class="right">'.
"\n";
346if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) {
347 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=set_AGENDA_USE_EVENT_TYPE&token='.newToken().
'">'.
img_picto($langs->trans(
"Disabled"),
'switch_off').
'</a>';
349 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=del_AGENDA_USE_EVENT_TYPE&token='.newToken().
'">'.
img_picto($langs->trans(
"Enabled"),
'switch_on').
'</a>';
351print
'</td></tr>'.
"\n";
353if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) {
354 print
'<!-- AGENDA_USE_EVENT_TYPE_DEFAULT -->';
355 print
'<tr class="oddeven">'.
"\n";
356 print
'<td>'.$langs->trans(
"AGENDA_USE_EVENT_TYPE_DEFAULT").
'</td>'.
"\n";
357 print
'<td class="center"> </td>'.
"\n";
358 print
'<td class="right nowrap">'.
"\n";
360 print
'</td></tr>'.
"\n";
364print
'<tr class="oddeven">'.
"\n";
365print
'<td>'.$langs->trans(
"AGENDA_EVENT_DEFAULT_STATUS").
'</td>'.
"\n";
366print
'<td class="center"> </td>'.
"\n";
367print
'<td class="right nowrap">'.
"\n";
370$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));
371if (!is_array($result) && $result < 0) {
373} elseif (count($result) > 0) {
374 $defval = reset($result)->value;
376$formactions->form_select_status_action(
'agenda', $defval, 1,
"AGENDA_EVENT_DEFAULT_STATUS", 0, 1,
'maxwidth200 onrightofpage');
377print
'</td></tr>'.
"\n";
380print
'<tr class="oddeven">'.
"\n";
381print
'<td>'.$langs->trans(
"AGENDA_DEFAULT_FILTER_TYPE").
'</td>'.
"\n";
382print
'<td class="center"> </td>'.
"\n";
383print
'<td class="right nowrap">'.
"\n";
385if (!empty($conf->global->MAIN_ENABLE_MULTISELECT_TYPE)) {
387 $multiselect = (!empty($conf->global->AGENDA_USE_EVENT_TYPE));
390print
'</td></tr>'.
"\n";
394print
'<tr class="oddeven">'.
"\n";
395print
'<td>'.$langs->trans(
"AGENDA_DEFAULT_FILTER_STATUS").
'</td>'.
"\n";
396print
'<td class="center"> </td>'.
"\n";
397print
'<td class="right">'.
"\n";
398$formactions->form_select_status_action(
'agenda',
getDolGlobalString(
'AGENDA_DEFAULT_FILTER_STATUS'), 1,
'AGENDA_DEFAULT_FILTER_STATUS', 1, 2,
'minwidth100');
399print
'</td></tr>'.
"\n";
403print $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') $formactions
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($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
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_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
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.
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.