Example #1
0
     print '<tr><td colspan="' . $colspan . '">&nbsp;</td></tr>';
     // Keep &nbsp; to have a line with enough height
 }
 print '</form>';
 // List of available values in database
 dol_syslog("htdocs/admin/dict", LOG_DEBUG);
 $resql = $db->query($sql);
 if ($resql) {
     $num = $db->num_rows($resql);
     $i = 0;
     $var = true;
     if ($num) {
         // There is several pages
         if ($num > $listlimit) {
             print '<tr class="none"><td align="right" colspan="' . (3 + count($fieldlist)) . '">';
             print_fleche_navigation($page, $_SERVER["PHP_SELF"], '&id=' . $id, $num > $listlimit, '<li class="pagination"><span>' . $langs->trans("Page") . ' ' . ($page + 1) . '</span></li>');
             print '</td></tr>';
         }
         // Title of lines
         print '<tr class="liste_titre">';
         foreach ($fieldlist as $field => $value) {
             // Determine le nom du champ par rapport aux noms possibles
             // dans les dictionnaires de donnees
             $showfield = 1;
             // Par defaut
             $align = "left";
             $sortable = 1;
             $valuetoshow = '';
             /*
                             $tmparray=getLabelOfField($fieldlist[$field]);
                             $showfield=$tmp['showfield'];
Example #2
0
/**
 *	Print a title with navigation controls for pagination
 *	@param	titre				Title to show (required)
 *	@param	page				Numero of page (required)
 *	@param	file				Url of page (required)
 *	@param	options         	parametres complementaires lien ('' par defaut)
 *	@param	sortfield       	champ de tri ('' par defaut)
 *	@param	sortorder       	ordre de tri ('' par defaut)
 *	@param	center          	chaine du centre ('' par defaut)
 *	@param	num					number of records found by select with limit+1
 *	@param	totalnboflines		Total number of records/lines for all pages (if known)
 *	@param	picto				Icon to use before title (should be a 32x32 transparent png file)
 *	@param	pictoisfullpath		1=Icon name is a full absolute url of image
 */
function print_barre_liste($titre, $page, $file, $options = '', $sortfield = '', $sortorder = '', $center = '', $num = -1, $totalnboflines = 0, $picto = 'title.png', $pictoisfullpath = 0)
{
    global $conf, $langs;
    if ($picto == 'setup') {
        $picto = 'title.png';
    }
    if (!empty($conf->browser->ie) && $picto == 'title.png') {
        $picto = 'title.gif';
    }
    if ($num > $conf->liste_limit or $num == -1) {
        $nextpage = 1;
    } else {
        $nextpage = 0;
    }
    print "\n";
    print "<!-- Begin title '" . $titre . "' -->\n";
    print '<table width="100%" border="0" class="notopnoleftnoright" style="margin-bottom: 2px;"><tr>';
    $pagelist = '';
    // Left
    if ($page > 0 || $num > $conf->liste_limit) {
        if ($totalnboflines) {
            if ($picto && $titre) {
                print '<td class="nobordernopadding" width="40" align="left" valign="middle">' . img_picto('', $picto, '', $pictoisfullpath) . '</td>';
            }
            print '<td class="nobordernopadding">';
            print '<div class="titre">' . $titre . '</div>';
            print '</td>';
            $maxnbofpage = 10;
            $nbpages = ceil($totalnboflines / $conf->liste_limit);
            $cpt = $page - $maxnbofpage;
            if ($cpt < 0) {
                $cpt = 0;
            }
            $pagelist .= $langs->trans('Page');
            if ($cpt >= 1) {
                $pagelist .= ' <a href="' . $file . '?page=0' . $options . '&amp;sortfield=' . $sortfield . '&amp;sortorder=' . $sortorder . '">1</a>';
                if ($cpt >= 2) {
                    $pagelist .= ' ...';
                }
            }
            do {
                if ($cpt == $page) {
                    $pagelist .= ' <u>' . ($page + 1) . '</u>';
                } else {
                    $pagelist .= ' <a href="' . $file . '?page=' . $cpt . $options . '&amp;sortfield=' . $sortfield . '&amp;sortorder=' . $sortorder . '">' . ($cpt + 1) . '</a>';
                }
                $cpt++;
            } while ($cpt < $nbpages && $cpt <= $page + $maxnbofpage);
            if ($cpt < $nbpages) {
                if ($cpt < $nbpages - 1) {
                    $pagelist .= ' ...';
                }
                $pagelist .= ' <a href="' . $file . '?page=' . ($nbpages - 1) . $options . '&amp;sortfield=' . $sortfield . '&amp;sortorder=' . $sortorder . '">' . $nbpages . '</a>';
            }
        } else {
            if (empty($conf->browser->phone) && $picto && $titre) {
                print '<td class="nobordernopadding" width="40" align="left" valign="middle">' . img_picto('', $picto, '', $pictoisfullpath) . '</td>';
            }
            print '<td class="nobordernopadding">';
            print '<div class="titre">' . $titre . '</div>';
            $pagelist .= $langs->trans('Page') . ' ' . ($page + 1);
            print '</td>';
        }
    } else {
        if (empty($conf->browser->phone) && $picto && $titre) {
            print '<td class="nobordernopadding" width="40" align="left" valign="middle">' . img_picto('', $picto, '', $pictoisfullpath) . '</td>';
        }
        print '<td class="nobordernopadding"><div class="titre">' . $titre . '</div></td>';
    }
    // Center
    if ($center) {
        print '<td class="nobordernopadding" align="left" valign="middle">' . $center . '</td>';
    }
    // Right
    print '<td class="nobordernopadding" align="right" valign="middle">';
    if ($sortfield) {
        $options .= "&amp;sortfield=" . $sortfield;
    }
    if ($sortorder) {
        $options .= "&amp;sortorder=" . $sortorder;
    }
    // Affichage des fleches de navigation
    print_fleche_navigation($page, $file, $options, $nextpage, $pagelist);
    print '</td>';
    print '</tr></table>' . "\n";
    print "<!-- End title -->\n\n";
}
Example #3
0
         print '<tr><td colspan="' . (count($fieldlist) + 2) . '">* ' . $langs->trans("LabelUsedByDefault") . '.</td></tr>';
     }
     print '<tr><td colspan="' . (count($fieldlist) + 2) . '">&nbsp;</td></tr>';
 }
 // List of available values in database
 dol_syslog("htdocs/admin/dict sql=" . $sql, LOG_DEBUG);
 $resql = $db->query($sql);
 if ($resql) {
     $num = $db->num_rows($resql);
     $i = 0;
     $var = true;
     if ($num) {
         // There is several pages
         if ($num > $listlimit) {
             print '<tr class="none"><td align="right" colspan="' . (3 + sizeof($fieldlist)) . '">';
             print_fleche_navigation($page, $_SERVER["PHP_SELF"], '&id=' . GETPOST('id'), $num > $listlimit, $langs->trans("Page") . ' ' . ($page + 1));
             print '</td></tr>';
         }
         // Title of lines
         print '<tr class="liste_titre">';
         foreach ($fieldlist as $field => $value) {
             // Determine le nom du champ par rapport aux noms possibles
             // dans les dictionnaires de donnees
             $showfield = 1;
             // Par defaut
             $valuetoshow = ucfirst($fieldlist[$field]);
             // Par defaut
             if ($fieldlist[$field] == 'source') {
                 $valuetoshow = $langs->trans("Contact");
             }
             if ($fieldlist[$field] == 'price') {
/**
 *	Print a title with navigation controls for pagination
 *
 *	@param	string	    $titre				Title to show (required)
 *	@param	string	    $page				Numero of page to show in navigation links (required)
 *	@param	string	    $file				Url of page (required)
 *	@param	string	    $options         	parametres complementaires lien ('' par defaut)
 *	@param	string    	$sortfield       	champ de tri ('' par defaut)
 *	@param	string	    $sortorder       	ordre de tri ('' par defaut)
 *	@param	string	    $center          	chaine du centre ('' par defaut). We often find here string $massaction comming from $form->selectMassAction() 
 *	@param	int		    $num				number of records found by select with limit+1
 *	@param	int		    $totalnboflines		Total number of records/lines for all pages (if known). Use a negative value to no show number.
 *	@param	string	    $picto				Icon to use before title (should be a 32x32 transparent png file)
 *	@param	int		    $pictoisfullpath	1=Icon name is a full absolute url of image
 *  @param	string	    $morehtml			More html to show
 *  @param  string      $morecss            More css to the table
 *  @param  int         $limit              Max number of lines (-1 = use default, 0 = no limit, > 0 = limit).
 *  @param  int         $hideselectlimit    Force to hide select limit
 *	@return	void
 */
function print_barre_liste($titre, $page, $file, $options = '', $sortfield = '', $sortorder = '', $center = '', $num = -1, $totalnboflines = 0, $picto = 'title_generic.png', $pictoisfullpath = 0, $morehtml = '', $morecss = '', $limit = -1, $hideselectlimit = 0)
{
    global $conf, $langs;
    $savlimit = $limit;
    $savtotalnboflines = $totalnboflines;
    $totalnboflines = abs($totalnboflines);
    if ($picto == 'setup') {
        $picto = 'title_setup.png';
    }
    if ($conf->browser->name == 'ie' && $picto == 'title_generic.png') {
        $picto = 'title.gif';
    }
    if ($limit < 0) {
        $limit = $conf->liste_limit;
    }
    if ($savlimit != 0 && ($num > $limit || $num == -1 || $limit == 0)) {
        $nextpage = 1;
    } else {
        $nextpage = 0;
    }
    //print 'totalnboflines='.$totalnboflines.'-savlimit='.$savlimit.'-limit='.$limit.'-num='.$num.'-nextpage='.$nextpage;
    print "\n";
    print "<!-- Begin title '" . $titre . "' -->\n";
    print '<table width="100%" border="0" class="notopnoleftnoright' . ($morecss ? ' ' . $morecss : '') . '" style="margin-bottom: 6px;"><tr>';
    // Left
    if ($picto && $titre) {
        print '<td class="nobordernopadding hideonsmartphone" width="40" align="left" valign="middle">' . img_picto('', $picto, '', $pictoisfullpath) . '</td>';
    }
    print '<td class="nobordernopadding"><div class="titre">' . $titre;
    if (!empty($titre) && $savtotalnboflines > 0) {
        print ' (' . $totalnboflines . ')';
    }
    print '</div></td>';
    // Center
    if ($center) {
        print '<td class="nobordernopadding" align="left" valign="middle">' . $center . '</td>';
    }
    // Right
    print '<td class="nobordernopadding" align="right" valign="middle">';
    if ($sortfield) {
        $options .= "&amp;sortfield=" . $sortfield;
    }
    if ($sortorder) {
        $options .= "&amp;sortorder=" . $sortorder;
    }
    // Show navigation bar
    $pagelist = '';
    if ($savlimit != 0 && ($page > 0 || $num > $limit)) {
        if ($totalnboflines) {
            $maxnbofpage = empty($conf->dol_optimize_smallscreen) ? 4 : 2;
            // page nb before and after selected page + ... + first or last
            if ($limit > 0) {
                $nbpages = ceil($totalnboflines / $limit);
            } else {
                $nbpages = 1;
            }
            $cpt = $page - $maxnbofpage;
            if ($cpt < 0) {
                $cpt = 0;
            }
            if ($cpt >= 1) {
                $pagelist .= '<li' . (empty($conf->dol_use_jmobile) ? ' class="pagination"' : '') . '><a ' . (empty($conf->dol_use_jmobile) ? '' : 'data-role="button" ') . 'href="' . $file . '?page=0' . $options . '&amp;sortfield=' . $sortfield . '&amp;sortorder=' . $sortorder . '">1</a></li>';
                if ($cpt > 2) {
                    $pagelist .= '<li' . (empty($conf->dol_use_jmobile) ? ' class="pagination"' : '') . '><span ' . (empty($conf->dol_use_jmobile) ? 'class="inactive"' : 'data-role="button"') . '>...</span></li>';
                } else {
                    if ($cpt == 2) {
                        $pagelist .= '<li' . (empty($conf->dol_use_jmobile) ? ' class="pagination"' : '') . '><a ' . (empty($conf->dol_use_jmobile) ? '' : 'data-role="button" ') . 'href="' . $file . '?page=1' . $options . '&amp;sortfield=' . $sortfield . '&amp;sortorder=' . $sortorder . '">2</a></li>';
                    }
                }
            }
            do {
                if ($cpt == $page) {
                    $pagelist .= '<li' . (empty($conf->dol_use_jmobile) ? ' class="pagination"' : '') . '><span ' . (empty($conf->dol_use_jmobile) ? 'class="active"' : 'data-role="button"') . '>' . ($page + 1) . '</span></li>';
                } else {
                    $pagelist .= '<li' . (empty($conf->dol_use_jmobile) ? ' class="pagination"' : '') . '><a ' . (empty($conf->dol_use_jmobile) ? '' : 'data-role="button" ') . 'href="' . $file . '?page=' . $cpt . $options . '&amp;sortfield=' . $sortfield . '&amp;sortorder=' . $sortorder . '">' . ($cpt + 1) . '</a></li>';
                }
                $cpt++;
            } while ($cpt < $nbpages && $cpt <= $page + $maxnbofpage);
            if ($cpt < $nbpages) {
                if ($cpt < $nbpages - 2) {
                    $pagelist .= '<li' . (empty($conf->dol_use_jmobile) ? ' class="pagination"' : '') . '><span ' . (empty($conf->dol_use_jmobile) ? 'class="inactive"' : 'data-role="button"') . '>...</span></li>';
                } else {
                    if ($cpt == $nbpages - 2) {
                        $pagelist .= '<li' . (empty($conf->dol_use_jmobile) ? ' class="pagination"' : '') . '><a ' . (empty($conf->dol_use_jmobile) ? '' : 'data-role="button" ') . 'href="' . $file . '?page=' . ($nbpages - 2) . $options . '&amp;sortfield=' . $sortfield . '&amp;sortorder=' . $sortorder . '">' . ($nbpages - 1) . '</a></li>';
                    }
                }
                $pagelist .= '<li' . (empty($conf->dol_use_jmobile) ? ' class="pagination"' : '') . '><a ' . (empty($conf->dol_use_jmobile) ? '' : 'data-role="button" ') . 'href="' . $file . '?page=' . ($nbpages - 1) . $options . '&amp;sortfield=' . $sortfield . '&amp;sortorder=' . $sortorder . '">' . $nbpages . '</a></li>';
            }
        } else {
            $pagelist .= '<li' . (empty($conf->dol_use_jmobile) ? ' class="pagination"' : '') . '><span ' . (empty($conf->dol_use_jmobile) ? 'class="active"' : 'data-role="button"') . '>' . ($page + 1) . "</li>";
        }
    }
    print_fleche_navigation($page, $file, $options, $nextpage, $pagelist, $morehtml, $savlimit, $totalnboflines, $hideselectlimit);
    // output the div and ul for previous/last completed with page numbers into $pagelist
    print '</td>';
    print '</tr></table>' . "\n";
    print "<!-- End title -->\n\n";
}