source: trunk/template/default/htmlfunctions.inc.php @ 14

Last change on this file since 14 was 14, checked in by z0rglub, 21 years ago

* empty log message *

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.4 KB
Line 
1<?php
2/***************************************************************************
3 *            htmlfunctions.inc.php is a part of PhpWebGallery             *
4 *                            -------------------                          *
5 *   last update          : Wednesday, 25 December 2002                    *
6 *   email                : pierrick@z0rglub.com                           *
7 *                                                                         *
8 ***************************************************************************
9
10 ***************************************************************************
11 *                                                                         *
12 *   This program is free software; you can redistribute it and/or modify  *
13 *   it under the terms of the GNU General Public License as published by  *
14 *   the Free Software Foundation;                                         *
15 *                                                                         *
16 ***************************************************************************/
17
18function get_icon( $date_comparaison )
19{
20  global $user, $conf;
21  $difference = time() - $date_comparaison;
22  $jours = 24*60*60;
23  $output = '';
24  if ( $difference < $user['long_period'] * $jours )
25  {
26    $icon_url = './theme/'.$user['theme'].'/';
27    if ( $difference < $user['short_period'] * $jours )
28    {
29      $icon_url.= 'new_short.gif';
30    }
31    else
32    {
33      $icon_url.= 'new_long.gif';
34    }
35    $size = getimagesize( $icon_url );
36    $output = '<img src="'.$icon_url.'" style="border:0;';
37    $output.= 'height:'.$size[1].'px;width:'.$size[0].'px" alt="" />';
38  }
39  return $output;
40}
41
42function create_navigation_bar( $url, $nb_element, $start,
43                                $nb_element_page, $link_class )
44{
45  global $lang;
46  $navigation_bar = "";
47  // 0. détection de la page en cours
48  if( !isset( $start )
49      || !is_numeric( $start )
50      || ( is_numeric( $start ) && $start < 0 ) )
51  {
52    $start = 0;
53  }
54  // on n'affiche la bare de navigation que si on plus de 1 page
55  if ( $nb_element > $nb_element_page )
56  {
57    // 1.une page précédente ?
58    if ( $start != 0 )
59    {
60      $previous = $start - $nb_element_page;
61      $navigation_bar.= '<a href="';
62      $navigation_bar.= add_session_id( $url.'&amp;start='.$previous );
63      $navigation_bar.= '" class="'.$link_class.'">'.$lang['previous_page'];
64      $navigation_bar.= '</a>';
65      $navigation_bar.= ' | ';
66    }
67    // 2.liste des numéros de page
68    $maximum = ceil ( $nb_element / $nb_element_page );
69    for ( $i = 1; $i <= $maximum; $i++ )
70    {
71      $temp_start = ( $i - 1 ) * $nb_element_page;
72      if ( $temp_start == $start )
73      {
74        $navigation_bar.= ' <span style="font-weight:bold;">'.$i.'</span> ';
75      }
76      else
77      {
78        $navigation_bar.= ' <a href="';
79        $navigation_bar.= add_session_id( $url.'&amp;start='.$temp_start );
80        $navigation_bar.= '" class="'.$link_class.'">'.$i.'</a> ';
81      }
82    }
83    // 3.une page suivante ?
84    if ( $nb_element > $nb_element_page
85         && $start + $nb_element_page < $nb_element )
86    {
87      $next = $start + $nb_element_page;
88      $navigation_bar.= ' | <a href="';
89      $navigation_bar.= add_session_id( $url.'&amp;start='.$next );
90      $navigation_bar.= '" class="'.$link_class.'">'.$lang['next_page'].'</a>';
91    }
92  }
93  return $navigation_bar;
94}
95
96function get_frame_start()
97{
98  return '<table style="width:';
99}
100
101function get_frame_begin()
102{
103  return ';">
104            <tr>
105              <td style="border:1px dashed gray;width:100%;padding:5px;background-color:white;">';
106}
107
108function get_frame_end()
109{
110  return '
111              </td>
112            </tr>   
113          </table>';
114}
115/*
116function get_frame_begin()
117{
118  global $user;
119  $path = './theme/'.$user['theme'].'/';
120  $size_01 = getimagesize( $path.'01.gif' );
121  $size_02 = getimagesize( $path.'02.gif' );
122  $size_03 = getimagesize( $path.'03.gif' );
123  return ';">
124            <tr>
125              <td><img src="'.$path.'01.gif" style="width:'.$size_01[0].'px;display:box;" alt="" /></td>
126              <td><img src="'.$path.'02.gif" style="display:box;width:100%;height:'.$size_02[1].'px;" alt="" /></td>
127              <td><img src="'.$path.'03.gif" style="display:box;width:'.$size_03[0].'px;" alt="" /></td>
128            </tr>
129            <tr>
130              <td style="background:url('.$path.'04.gif);"></td>
131              <td style="background:url('.$path.'05.gif);width:100%;">';
132}
133       
134function get_frame_end()
135{
136  global $user;
137  $path = './theme/'.$user['theme'].'/';
138  $size_08 = getimagesize( $path.'08.gif' );
139  return '
140              </td>
141              <td style="background:url('.$path.'06.gif);"></td>
142            </tr>
143            <tr>
144              <td><img src="'.$path.'07.gif" alt="" /></td>
145              <td><img src="'.$path.'08.gif" style="width:100%;height:'.$size_08[1].'px;" alt="" /></td>
146              <td><img src="'.$path.'09.gif" alt="" /></td>
147            </tr>   
148          </table>';
149}
150*/
151function initialize_template()
152{
153  global $vtp, $handle, $user;
154
155  $vtp->setGlobalVar( $handle, 'style', $user['style'] );
156  $vtp->setGlobalVar( $handle, 'frame_start', get_frame_start() );
157  $vtp->setGlobalVar( $handle, 'frame_begin', get_frame_begin() );
158  $vtp->setGlobalVar( $handle, 'frame_end',   get_frame_end() );
159  $vtp->setVarF( $handle, 'header',
160                 './template/'.$user['template'].'/header.htm' );
161  $vtp->setVarF( $handle, 'footer',
162                 './template/'.$user['template'].'/footer.htm' );
163}
164?>
Note: See TracBrowser for help on using the repository browser.