diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 6fd3f2b3705..0cfade3c8f8 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -90,8 +90,6 @@ if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST( $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -//if (! $sortfield) $sortfield="p.date_fin"; -//if (! $sortorder) $sortorder="DESC"; // Initialize technical objects $object = new MyObject($db); @@ -146,8 +144,14 @@ if (is_array($extrafields->attributes[$object->table_element]['label']) && count { foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val) { - if (! empty($extrafields->attributes[$object->table_element]['list'][$key])) - $arrayfields["ef.".$key]=array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key]<0)?0:1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key])!=3 && $extrafields->attributes[$object->table_element]['perms'][$key])); + if (! empty($extrafields->attributes[$object->table_element]['list'][$key])) { + $arrayfields["ef.".$key] = array( + 'label'=>$extrafields->attributes[$object->table_element]['label'][$key], + 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key]<0)?0:1), + 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], + 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key])!=3 && $extrafields->attributes[$object->table_element]['perms'][$key]) + ); + } } } $object->fields = dol_sort_array($object->fields, 'position'); @@ -534,7 +538,7 @@ while ($i < min($num, $limit)) print ''; if (! $i) $totalarray['nbfield']++; - print ''; + print ''."\n"; $i++; } diff --git a/htdocs/opensurvey/list.php b/htdocs/opensurvey/list.php index aa01088744f..65c7c3ee12e 100644 --- a/htdocs/opensurvey/list.php +++ b/htdocs/opensurvey/list.php @@ -98,6 +98,10 @@ if (is_array($extrafields->attributes[$object->table_element]['label']) && count $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); +$permissiontoread = $user->rights->opensurvey->read; +$permissiontoadd = $user->rights->opensurvey->write; +$permissiontodelete = $user->rights->opensurvey->delete; + /* * Actions @@ -133,8 +137,6 @@ if (empty($reshook)) // Mass actions $objectclass='Opensurveysondage'; $objectlabel='Opensurveysondage'; - $permissiontoread = $user->rights->opensurvey->read; - $permissiontodelete = $user->rights->opensurvey->write; $uploaddir = $conf->opensurvey->dir_output; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } @@ -213,6 +215,9 @@ if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && } +// Output page +// -------------------------------------------------------------------- + llxHeader('', $title, $help_url); $arrayofselected=is_array($toselect)?$toselect:array(); @@ -231,7 +236,7 @@ $arrayofmassactions = array( //'presend'=>$langs->trans("SendByMail"), //'builddoc'=>$langs->trans("PDFMerge"), ); -if ($user->rights->opensurvey->write) $arrayofmassactions['predelete']=''.$langs->trans("Delete"); +if ($permissiontodelete) $arrayofmassactions['predelete']=''.$langs->trans("Delete"); if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); @@ -248,8 +253,7 @@ print ''; print ''; print ''; -$newcardbutton=''; -$newcardbutton.= dolGetButtonTitle($langs->trans('NewSurvey'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/opensurvey/wizard/index.php', '', $user->rights->opensurvey->write); +$newcardbutton = dolGetButtonTitle($langs->trans('NewSurvey'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/opensurvey/wizard/index.php', '', $user->rights->opensurvey->write); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'generic', 0, $newcardbutton, '', $limit); @@ -310,7 +314,7 @@ $parameters=array('arrayfields'=>$arrayfields); $reshook=$hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column -print ''; +print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print ''; @@ -333,6 +337,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; $parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); $reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; +// Action column print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ')."\n"; print ''."\n"; @@ -369,17 +374,21 @@ while ($i < min($num, $limit)) print ''; print $opensurvey_static->getNomUrl(1); print ''; - + if (! $i) $totalarray['nbfield']++; + // Title print ''.dol_htmlentities($obj->titre).''; - + if (! $i) $totalarray['nbfield']++; + // Type print ''; $type=($obj->format=='A')?'classic':'date'; print img_picto('', dol_buildpath('/opensurvey/img/'.($type == 'classic'?'chart-32.png':'calendar-32.png'), 1), 'width="16"', 1); print ' '.$langs->trans($type=='classic'?"TypeClassic":"TypeDate"); - print ''; - + print ''; + if (! $i) $totalarray['nbfield']++; + + print ''; // Author if ($obj->fk_user_creat) { $userstatic = new User($db); @@ -392,22 +401,25 @@ while ($i < min($num, $limit)) } else { print dol_htmlentities($obj->nom_admin); } - print ''; - + if (! $i) $totalarray['nbfield']++; + // Nb of voters print''.$nbuser.''."\n"; - + if (! $i) $totalarray['nbfield']++; + print ''.dol_print_date($db->jdate($obj->date_fin), 'day'); if ($db->jdate($obj->date_fin) < $now && $obj->status == Opensurveysondage::STATUS_VALIDATED) { print img_warning($langs->trans("Expired")); } print ''; - + if (! $i) $totalarray['nbfield']++; + print''.$opensurvey_static->getLibStatut(5).''."\n"; - + if (! $i) $totalarray['nbfield']++; + // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook - $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj); + $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); $reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column @@ -419,7 +431,8 @@ while ($i < min($num, $limit)) print ''; } print ''; - + if (! $i) $totalarray['nbfield']++; + print ''."\n"; $i++; } @@ -461,9 +474,9 @@ if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $n $urlsource.=str_replace('&', '&', $param); $filedir=$diroutputmassaction; - $genallowed=$user->rights->mymodule->read; - $delallowed=$user->rights->mymodule->create; - + $genallowed=$permissiontoread; + $delallowed=$permissiontoadd; + print $formfile->showdocuments('massfilesarea_mymodule', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty); }