source: tags/version_1_3/template/default/htmlfunctions.inc.php @ 14166

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

Initial revision

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.0 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 affiche_icone_recent( $date_comparaison )
43{
44  global $user, $conf;
45  $difference = time() - $date_comparaison;
46  $jours = 24*60*60;
47  $output = '';
48  if ( $difference < $conf['periode_longue'] * $jours )
49  {
50    $icon_url = './theme/'.$user['theme'].'/';
51    if ( $difference < $conf['periode_courte'] * $jours )
52    {
53      $icon_url.= 'new_long.gif';
54    }
55    else
56    {
57      $icon_url.= 'new_short.gif';
58    }
59    $size = getimagesize( $icon_url );
60    $output = '<img src="'.$icon_url.'" style="border:0;height:'.$size[1].'px;width:'.$size[0].'px" alt="" />';
61  }
62  return $output;
63}
64*/
65
66function create_navigation_bar( $url, $nb_element, $start,
67                                $nb_element_page, $link_class )
68{
69  global $lang;
70  $navigation_bar = "";
71  // 0. détection de la page en cours
72  if( !isset( $start )
73      || !is_numeric( $start )
74      || ( is_numeric( $start ) && $start < 0 ) )
75  {
76    $start = 0;
77  }
78  // on n'affiche la bare de navigation que si on plus de 1 page
79  if ( $nb_element > $nb_element_page )
80  {
81    // 1.une page précédente ?
82    if ( $start != 0 )
83    {
84      $previous = $start - $nb_element_page;
85      $navigation_bar.= '<a href="';
86      $navigation_bar.= add_session_id( $url.'&amp;start='.$previous );
87      $navigation_bar.= '" class="'.$link_class.'">'.$lang['previous_page'];
88      $navigation_bar.= '</a>';
89      $navigation_bar.= ' | ';
90    }
91    // 2.liste des numéros de page
92    $maximum = ceil ( $nb_element / $nb_element_page );
93    for ( $i = 1; $i <= $maximum; $i++ )
94    {
95      $temp_start = ( $i - 1 ) * $nb_element_page;
96      if ( $temp_start == $start )
97      {
98        $navigation_bar.= ' <span style="font-weight:bold;">'.$i.'</span> ';
99      }
100      else
101      {
102        $navigation_bar.= ' <a href="';
103        $navigation_bar.= add_session_id( $url.'&amp;start='.$temp_start );
104        $navigation_bar.= '" class="'.$link_class.'">'.$i.'</a> ';
105      }
106    }
107    // 3.une page suivante ?
108    if ( $nb_element > $nb_element_page
109         && $start + $nb_element_page < $nb_element )
110    {
111      $next = $start + $nb_element_page;
112      $navigation_bar.= ' | <a href="';
113      $navigation_bar.= add_session_id( $url.'&amp;start='.$next );
114      $navigation_bar.= '" class="'.$link_class.'">'.$lang['next_page'].'</a>';
115    }
116  }
117  return $navigation_bar;
118}
119
120function get_frame_start()
121{
122  return '<table style="width:';
123}
124/*
125function get_frame_begin()
126{
127  return ';">
128            <tr>
129              <td style="border:2px solid lightgreen;width:100%;padding:5px;background-color:black;">';
130}
131
132function get_frame_end()
133{
134  return '
135              </td>
136            </tr>   
137          </table>';
138}
139*/       
140function get_frame_begin()
141{
142  global $user;
143  $path = './theme/'.$user['theme'].'/';
144  $size_01 = getimagesize( $path.'01.gif' );
145  $size_02 = getimagesize( $path.'02.gif' );
146  $size_03 = getimagesize( $path.'03.gif' );
147  return ';">
148            <tr>
149              <td><img src="'.$path.'01.gif" style="width:'.$size_01[0].'px;display:box;" alt="" /></td>
150              <td><img src="'.$path.'02.gif" style="display:box;width:100%;height:'.$size_02[1].'px;" alt="" /></td>
151              <td><img src="'.$path.'03.gif" style="display:box;width:'.$size_03[0].'px;" alt="" /></td>
152            </tr>
153            <tr>
154              <td style="background:url('.$path.'04.gif);"></td>
155              <td style="background:url('.$path.'05.gif);width:100%;">';
156}
157       
158function get_frame_end()
159{
160  global $user;
161  $path = './theme/'.$user['theme'].'/';
162  $size_08 = getimagesize( $path.'08.gif' );
163  return '
164              </td>
165              <td style="background:url('.$path.'06.gif);"></td>
166            </tr>
167            <tr>
168              <td><img src="'.$path.'07.gif" alt="" /></td>
169              <td><img src="'.$path.'08.gif" style="width:100%;height:'.$size_08[1].'px;" alt="" /></td>
170              <td><img src="'.$path.'09.gif" alt="" /></td>
171            </tr>   
172          </table>';
173}
174
175function initialize_template()
176{
177  global $vtp, $handle, $user;
178
179  $vtp->setGlobalVar( $handle, 'frame_start', get_frame_start() );
180  $vtp->setGlobalVar( $handle, 'frame_begin', get_frame_begin() );
181  $vtp->setGlobalVar( $handle, 'frame_end',   get_frame_end() );
182  $vtp->setVarF( $handle, 'header',
183                 './template/'.$user['template'].'/header.htm' );
184  $vtp->setVarF( $handle, 'footer',
185                 './template/'.$user['template'].'/footer.htm' );
186}
187?>
Note: See TracBrowser for help on using the repository browser.