$groupslist = $usergroup->listGroupsForUser($fuser->id); if (!empty($groupslist)) { foreach ($groupslist as $groupforuser) { $exclude[] = $groupforuser->id; } } if ($caneditgroup) { $form = new Form($db); print '<form action="fiche.php?id=' . $id . '" method="post">' . "\n"; print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; print '<input type="hidden" name="action" value="addgroup">'; print '<input type="hidden" name="entity" value="' . $conf->entity . '">'; print '<table class="noborder" width="100%">' . "\n"; print '<tr class="liste_titre"><td class="liste_titre" width="25%">' . $langs->trans("GroupsToAdd") . '</td>' . "\n"; print '<td>'; print $form->select_dolgroups('', 'group', 1, $exclude); print ' '; print '<input type="submit" class="button" value="' . $langs->trans("Add") . '">'; print '</td></tr>' . "\n"; print '</table></form>' . "\n"; print '<br>'; } /* * Groupes affectes */ print '<table class="noborder" width="100%">'; print '<tr class="liste_titre">'; print '<td class="liste_titre" width="25%">' . $langs->trans("Groups") . '</td>'; print "<td> </td></tr>\n"; if (!empty($groupslist)) { $var = true;
print '<form method="post" action="' . $_SERVER['PHP_SELF'] . '" >'; print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; print '<input type="hidden" name="action" value="setvar">'; print '<table class="noborder" width="100%">'; print '<tr class="liste_titre">'; print '<td>' . $langs->trans("Name") . '</td>'; print '<td width="400px">' . $langs->trans("Valeur") . '</td>'; print "</tr>\n"; // Nb Days print '<tr class="pair"><td>' . $langs->trans("LeadNbDayDefaultClosure") . '</td>'; print '<td align="left">'; print '<input type="text" name="LEAD_NB_DAY_COSURE_AUTO" value="' . $conf->global->LEAD_NB_DAY_COSURE_AUTO . '" size="4" ></td>'; print '</tr>'; // User Group print '<tr class="impair"><td>' . $langs->trans("LeadUserGroupAffect") . '</td>'; print '<td align="left">'; print $form->select_dolgroups($conf->global->LEAD_GRP_USER_AFFECT, 'LEAD_GRP_USER_AFFECT', 1, array(), 0, '', '', $conf->entity); print '</tr>'; // Force use thirdparty print '<tr class="pair"><td>' . $langs->trans("LeadForceUseThirdparty") . '</td>'; print '<td align="left">'; $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); print $form->selectarray("LEAD_FORCE_USE_THIRDPARTY", $arrval, $conf->global->LEAD_FORCE_USE_THIRDPARTY); print '</tr>'; print '</table>'; print '<tr class="impair"><td colspan="2" align="right"><input type="submit" class="button" value="' . $langs->trans("Save") . '"></td>'; print '</tr>'; print '</table><br>'; print '</form>'; llxFooter(); $db->close();
function fiche(&$dashboard, $action = 'edit', $withHeader = true) { global $langs, $conf, $user, $db; $PDOdb = new TPDOdb(); $form = new TFormCore(); $cell_height = 200; $tab_object = GETPOST('tab_object'); $table_element = GETPOST('table_element'); $fk_object = GETPOST('fk_object'); if (empty($table_element)) { if ($tab_object == 'thirdparty') { $table_element = 'societe'; } else { if ($tab_object == 'project') { $table_element = 'projet'; } else { $table_element = $tab_object; } } } if ($withHeader) { llxHeader('', 'Query DashBoard', '', '', 0, 0, array('/query/js/dashboard.js', '/query/js/jquery.gridster.min.js'), array('/query/css/dashboard.css', '/query/css/jquery.gridster.min.css')); $head = TQueryMenu::getHeadForObject($tab_object, $fk_object); dol_fiche_head($head, 'tabQuery' . GETPOST('menuId'), 'Query'); print_fiche_titre($dashboard->title); } else { if (GETPOST('for_incusion') > 0) { ?> <div class="querydashboard"> <link rel="stylesheet" type="text/css" title="default" href="<?php echo dol_buildpath('/query/css/dashboard.css', 1); ?> "> <link rel="stylesheet" type="text/css" title="default" href="<?php echo dol_buildpath('/query/css/jquery.gridster.min.css', 1); ?> "> <script type="text/javascript" src="<?php echo dol_buildpath('/query/js/dashboard.js', 1); ?> "></script> <script type="text/javascript" src="<?php echo dol_buildpath('/query/js/jquery.gridster.min.js', 1); ?> "></script> <?php } else { ?> <html> <head> <meta charset="UTF-8"> <link rel="stylesheet" type="text/css" href="<?php echo dol_buildpath('/theme/eldy/style.css.php?lang=fr_FR&theme=eldy', 1); ?> "> <link rel="stylesheet" type="text/css" title="default" href="<?php echo dol_buildpath('/query/css/dashboard.css', 1); ?> "> <link rel="stylesheet" type="text/css" title="default" href="<?php echo dol_buildpath('/query/css/jquery.gridster.min.css', 1); ?> "> <script type="text/javascript" src="<?php echo dol_buildpath('/includes/jquery/js/jquery.min.js', 1); ?> "></script> <script type="text/javascript" src="<?php echo dol_buildpath('/query/js/dashboard.js', 1); ?> "></script> <script type="text/javascript" src="<?php echo dol_buildpath('/query/js/jquery.gridster.min.js', 1); ?> "></script> <style type="text/css"> .pagination { display : none; } <?php if ((int) GETPOST('allow_gen') != 1) { echo '.notInGeneration { display : none; }'; } ?> table.liste tr.impair,table.liste tr.pair,table.liste tr.liste_titre,div.titre { font-size: 12px; } </style> </head> <body > <?php } } ?> <script type="text/javascript"> var MODQUERY_INTERFACE = "<?php echo dol_buildpath('/query/script/interface.php', 1); ?> "; $(document).ready(function(){ //DOM Ready gridster_width = Math.round($('.gridster').innerWidth() / 5); if(gridster_width<50) gridster_width = 240; $(".gridster ul").gridster({ widget_margins: [10, 10] ,widget_base_dimensions: [gridster_width, <?php echo $cell_height; ?> ] ,min_cols:3 ,min_rows:5 ,serialize_params: function($w, wgd) { return { posx: wgd.col, posy: wgd.row, width: wgd.size_x, height: wgd.size_y, k : $w.attr('data-k') } } <?php if ($action == 'edit') { ?> ,resize: { enabled: true ,max_size: [4, 4] ,min_size: [1, 1] } <?php } ?> })<?php if ($action == 'view') { echo '.data(\'gridster\').disable()'; } ?> ; var gridster = $(".gridster ul").gridster().data('gridster'); $('#addQuery').click(function() { var fk_query = $('select[name=fk_query]').val(); $.ajax({ url: MODQUERY_INTERFACE ,data: { put:'dashboard-query' ,fk_query : fk_query ,fk_qdashboard:<?php echo $dashboard->getId(); ?> } ,dataType:'json' }).done(function(data) { var title = $('select[name=fk_query] option:selected').text(); gridster.add_widget('<li data-k="'+data+'">'+title+'</li>',1,1,1,1); }); }); $('#saveDashboard').click(function() { var $button = $(this); $button.hide(); $.ajax({ url: MODQUERY_INTERFACE ,data: { put:'dashboard' ,id:<?php echo $dashboard->getId(); ?> ,title:$('input[name=title]').val() ,fk_usergroup:$('select[name=fk_usergroup]').val() ,send_by_mail:$('select[name=send_by_mail]').val() ,hook:$('select[name=hook]').val() ,use_as_landing_page:$('select[name=use_as_landing_page]').val() ,refresh_dashboard:$('input[name=refresh_dashboard]').val() } }).done(function(data) { <?php if ($dashboard->getId() > 0) { ?> $.ajax({ url: MODQUERY_INTERFACE ,data: { put:'dashboard-query-link' ,TCoord:gridster.serialize( ) ,fk_qdashboard:<?php echo $dashboard->getId(); ?> } ,dataType:'json' }).done(function(data) { $button.show(); }); <?php } else { echo 'document.location.href="?action=view&id="+data;'; } ?> }); }); }); function delTile(idTile) { $('li[tile-id='+idTile+']').css('opacity',.5); $.ajax({ url: MODQUERY_INTERFACE ,data: { put:'dashboard-query-remove' ,id : idTile } ,dataType:'json' }).done(function(data) { $('li[tile-id='+idTile+']').toggle(); //document.location.hre }); } </script> <?php if ($action == 'edit') { ?> <div><?php $TQuery = TQuery::getQueries($PDOdb); echo $form->texte($langs->trans('Title'), 'title', $dashboard->title, 50, 255); $formDoli = new Form($db); echo ' - ' . $langs->trans('LimitAccessToThisGroup') . ' : ' . $formDoli->select_dolgroups($dashboard->fk_usergroup, 'fk_usergroup', 1) . '/' . $langs->trans('UseAsLandingPage') . $formDoli->selectarray('use_as_landing_page', array($langs->trans('No'), $langs->trans('Yes')), $dashboard->use_as_landing_page); echo $form->combo(' - ' . $langs->trans('SendByMailToThisGroup'), 'send_by_mail', $dashboard->TSendByMail, $dashboard->send_by_mail); echo $form->combo(' - ' . $langs->trans('ShowThisInCard'), 'hook', $dashboard->THook, $dashboard->hook); echo $form->number('<br />' . $langs->trans('RefreshDashboard'), 'refresh_dashboard', $dashboard->refresh_dashboard, 20, 1, 0); ?> <a href="#" class="butAction" id="saveDashboard"><?php echo $langs->trans('SaveDashboard'); ?> </a> </div> <?php if ($dashboard->getId() > 0) { ?> <div> <?php $TQuery = TQuery::getQueries($PDOdb); echo $form->combo('', 'fk_query', $TQuery, 0); ?> <a href="#" class="butAction" id="addQuery"><?php echo $langs->trans('AddThisQuery'); ?> </a> </div> <?php } } else { if (!empty($conf->global->QUERY_SHOW_PDF_TRANSFORM)) { echo '<div style="text-align:right" class="notInGeneration"><a class="butAction" style=";z-index:999;" href="download-dashboard.php?uid=' . $dashboard->uid . '">' . $langs->trans('Download') . '</a></div>'; } } ?> <div class="gridster"> <ul> <?php foreach ($dashboard->TQDashBoardQuery as $k => &$cell) { echo '<li tile-id="' . $cell->getId() . '" data-k="' . $k . '" data-row="' . $cell->posy . '" data-col="' . $cell->posx . '" data-sizex="' . $cell->width . '" data-sizey="' . $cell->height . '" ' . ($withHeader ? '' : 'style="overflow:hidden;"') . '>'; if ($action == 'edit') { echo '<a style="position:absolute; top:3px; right:3px; z-index:999;" href="javascript:delTile(' . $cell->getId() . ')">' . img_delete('DeleteThisTile') . '</a>'; } else { echo '<a style="position:absolute; top:3px; right:3px; z-index:999;" href="' . dol_buildpath('/query/query.php?action=run-in&id=' . $cell->query->getId(), 1) . '">' . img_picto($langs->trans('Run'), 'object_cron.png') . '</a>'; } if ($cell->query->type == 'LIST') { $cell->query->type = 'SIMPLELIST'; } if (!empty($cell->query)) { if (!$withHeader) { echo $cell->query->run(false, $cell->height * $cell_height, $table_element, $fk_object, 0); } else { echo $cell->query->run(false, $cell->height * $cell_height, $table_element, $fk_object); } } echo '</li>'; } ?> </ul> </div> <div style="clear:both"></div> <?php if ($dashboard->refresh_dashboard > 0 && !$withHeader) { echo "<script type=\"text/javascript\">\n"; echo " // Automatically refresh\n"; echo " setInterval(\"window.location.reload()\"," . 60000 * $dashboard->refresh_dashboard . ");\n"; echo "</script>\n"; } ?> <?php if ($withHeader) { if ($dashboard->getId() > 0) { print dol_buildpath('/query/dashboard.php?action=run&uid=' . $dashboard->uid, 2); } dol_fiche_end(); llxFooter(); } else { if (GETPOST('for_incusion') > 0) { ?> </div><?php } else { ?> </body></html> <?php } } }
{ print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">'."\n"; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />'; print '<input type="hidden" name="action" value="addgroup" />'; } print '<table class="noborder" width="100%">'."\n"; print '<tr class="liste_titre"><th class="liste_titre" width="25%">'.$langs->trans("Groups").'</th>'."\n"; if(! empty($conf->multicompany->enabled) && !empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity) { print '<td class="liste_titre" width="25%">'.$langs->trans("Entity").'</td>'; } print '<th align="right">'; if ($caneditgroup) { print $form->select_dolgroups('', 'group', 1, $exclude, 0, '', '', $object->entity); print ' '; // Multicompany if (! empty($conf->multicompany->enabled)) { if ($conf->entity == 1 && $conf->multicompany->transverse_mode) { print '</td><td>'.$langs->trans("Entity").'</td>'; print "<td>".$mc->select_entities($conf->entity); } else { print '<input type="hidden" name="entity" value="'.$conf->entity.'" />'; } } else
function _fiche(&$PDOdb, &$idea, $mode = 'view', $editValue = false) { global $db, $langs, $user; llxHeader('', $langs->trans('IdeaboxAddItem'), '', ''); /******/ $TBS = new TTemplateTBS(); $TBS->TBS->protect = false; $TBS->TBS->noerr = true; $form = new TFormCore($_SERVER['PHP_SELF'], 'form', 'POST'); $form->Set_typeaff($mode); echo $form->hidden('id', $idea->getId()); echo $form->hidden('action', 'save'); $TIdeaboxItem = _fiche_ligne_ideabox_item($PDOdb, $idea->getId(), $mode); $formDoli = new Form($db); print $TBS->render('tpl/ideabox.tpl.php', array('TIdeaboxItem' => $TIdeaboxItem), array('TIdeabox' => array('id' => (int) $idea->getId(), 'label' => $form->texte('', 'label', $idea->label, 80, 150, '', '', 'à saisir'), 'usergroup' => $mode == 'view' ? $idea->getNameUserGroup($db) : $formDoli->select_dolgroups($idea->fk_usergroup, 'fk_usergroup', 1)), 'view' => array('type' => 'showficheideabox', 'mode' => $mode, 'user_right' => $user->rights->ideabox->create, 'url' => dol_buildpath('/ideabox/ideabox.php', 2)))); $form->end(); llxFooter(); }