26 require
'../main.inc.php';
27 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
28 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
33 $langs->loadLangs(array(
"mymodule@mymodule",
"other"));
38 $action =
GETPOST(
'action',
'aZ09');
39 $confirm =
GETPOST(
'confirm',
'alpha');
40 $cancel =
GETPOST(
'cancel',
'aZ09');
41 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'zapiercard';
42 $backtopage =
GETPOST(
'backtopage',
'alpha');
47 $diroutputmassaction = $conf->mymodule->dir_output.
'/temp/massgeneration/'.$user->id;
48 $hookmanager->initHooks(array(
'myobjectcard',
'globalcard'));
51 $extrafields->fetch_name_optionals_label($object->table_element);
53 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
56 $search_all =
GETPOST(
"search_all",
'alpha');
58 foreach ($object->fields as $key => $val) {
59 if (
GETPOST(
'search_'.$key,
'alpha')) $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
62 if (empty($action) && empty($id) && empty($ref)) $action =
'view';
65 include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
80 $parameters = array();
81 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
82 if ($reshook < 0)
setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
84 if (empty($reshook)) {
87 $permissiontoadd = $user->rights->mymodule->write;
88 $permissiontodelete = $user->rights->mymodule->delete || ($permissiontoadd && $object->status == 0);
89 $backurlforlist =
dol_buildpath(
'/mymodule/myobject_list.php', 1);
90 if (empty($backtopage)) {
91 if (empty($id)) $backtopage = $backurlforlist;
92 else $backtopage =
dol_buildpath(
'/mymodule/myobject_card.php', 1).($id > 0 ? $id :
'__ID__');
94 $triggermodname =
'MYMODULE_MYOBJECT_MODIFY';
97 include DOL_DOCUMENT_ROOT.
'/core/actions_addupdatedelete.inc.php';
100 include DOL_DOCUMENT_ROOT.
'/core/actions_dellink.inc.php';
103 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
115 $form =
new Form($db);
121 print '<script type="text/javascript" language="javascript">
122 jQuery(document).ready(function() {
123 function init_myfunc()
125 jQuery("#myid").removeAttr(\'disabled\');
126 jQuery("#myid").attr(\'disabled\',\'disabled\');
129 jQuery("#mybutton").click(function() {
137 if ($action ==
'create') {
140 print '<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
141 print '<input type="hidden" name="token" value="'.newToken().
'">';
142 print '<input type="hidden" name="action" value="add">';
143 print '<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
147 print '<table class="border centpercent">'.
"\n";
150 include DOL_DOCUMENT_ROOT.
'/core/tpl/commonfields_add.tpl.php';
153 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
155 print '</table>'.
"\n";
159 print '<div class="center">';
160 print '<input type="submit" class="button" name="add" value="'.dol_escape_htmltag($langs->trans(
"Create")).
'">';
162 print '<input type="'.($backtopage ?
"submit" :
"button").
'" class="button button-cancel" name="cancel" value="'.
dol_escape_htmltag($langs->trans(
"Cancel")).
'"'.($backtopage ?
'' :
' onclick="javascript:history.go(-1)"').
'>';
169 if (($id || $ref) && $action ==
'edit') {
172 print '<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
173 print '<input type="hidden" name="token" value="'.newToken().
'">';
174 print '<input type="hidden" name="action" value="update">';
175 print '<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
176 print '<input type="hidden" name="id" value="'.$object->id.
'">';
180 print '<table class="border centpercent">'.
"\n";
183 include DOL_DOCUMENT_ROOT.
'/core/tpl/commonfields_edit.tpl.php';
186 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_edit.tpl.php';
192 print '<div class="center"><input type="submit" class="button button-save" name="save" value="'.$langs->trans(
"Save").
'">';
193 print ' <input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
200 if ($object->id > 0 && (empty($action) || ($action !=
'edit' && $action !=
'create'))) {
201 $res = $object->fetch_optionals();
209 if ($action ==
'delete') {
210 $formconfirm = $form->formconfirm(
$_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'DeleteMyObject'), $langs->trans(
'ConfirmDeleteMyObject'),
'confirm_delete',
'', 0, 1);
214 if ($action ==
'clone') {
216 $formquestion = array();
217 $formconfirm = $form->formconfirm(
$_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'ToClone'), $langs->trans(
'ConfirmCloneMyObject', $object->ref),
'confirm_clone', $formquestion,
'yes', 1);
221 if ($action ==
'xxx') {
222 $formquestion = array();
233 $formconfirm = $form->formconfirm(
$_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'XXX'), $text,
'confirm_xxx', $formquestion, 0, 1, 220);
237 $parameters = array(
'formConfirm' => $formconfirm,
'lineid' => $lineid);
238 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
239 if (empty($reshook)) $formconfirm .= $hookmanager->resPrint;
240 elseif ($reshook > 0) $formconfirm = $hookmanager->resPrint;
248 $linkback = '<a href="'.
dol_buildpath('/mymodule/myobject_list.php', 1).'?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
250 $morehtmlref = '<div class="refidno">';
288 $morehtmlref .= '</div>';
291 dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
294 print '<div class="fichecenter">';
295 print '<div class="fichehalfleft">';
296 print '<div class="underbanner clearboth"></div>';
297 print '<table class="border centpercent">'."\
n";
301 include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
304 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
310 print '<div class="clearboth"></div><br>';
316 if ($action != 'presend' && $action != 'editline') {
317 print '<div class="tabsAction">'.
"\n";
318 $parameters = array();
319 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
320 if ($reshook < 0)
setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
322 if (empty($reshook)) {
324 if ($user->rights->mymodule->write) {
325 print '<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=edit">'.$langs->trans(
"Modify").
'</a>'.
"\n";
327 print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
'Modify').
'</a>'.
"\n";
331 if ($user->rights->mymodule->write) {
332 print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'&socid='.$object->socid.
'&action=clone&object=order">'.$langs->trans(
"ToClone").
'</a></div>';
349 if ($user->rights->mymodule->delete) {
350 print '<a class="butActionDelete" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=delete&token='.
newToken().
'">'.$langs->trans(
'Delete').
'</a>'.
"\n";
352 print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
'Delete').
'</a>'.
"\n";
360 if (
GETPOST(
'modelselected')) {
364 if ($action !=
'presend') {
365 print '<div class="fichecenter"><div class="fichehalfleft">';
366 print '<a name="builddoc"></a>';
369 $linktoelem = $form->showLinkToObjectBlock($object, null, array(
'myobject'));
370 $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
373 print '</div><div class="fichehalfright"><div class="ficheaddleft">';
377 $morehtmlright =
'<a href="'.dol_buildpath(
'/mymodule/myobject_info.php', 1).
'?id='.$object->id.
'">';
378 $morehtmlright .= $langs->trans(
"SeeAll");
379 $morehtmlright .=
'</a>';
382 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
384 $somethingshown =
$formactions->showactions($object,
'myobject', $socid, 1,
'', $MAXEVENT,
'', $morehtmlright);
386 print '</div></div></div>';
if(!function_exists('dol_getprefix')) dol_include_once($relpath, $classname= '')
Make an include_once using default root and alternate root if it fails.
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
myobjectPrepareHead($object)
Prepare array of tabs for MyObject.
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
print $_SERVER["PHP_SELF"]
Edit parameters.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
print
Draft customers invoices.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
print $_SERVER["PHP_SELF"] n
Edit parameters.
dol_banner_tab($object, $paramid, $morehtml= '', $shownav=1, $fieldid= 'rowid', $fieldref= 'ref', $morehtmlref= '', $moreparam= '', $nodbprefix=0, $morehtmlleft= '', $morehtmlstatus= '', $onlybanner=0, $morehtmlright= '')
Show tab footer of a card.
if(!defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN'
Draft customers invoices.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $keepmoretags= '', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields...