source: tags/release-1_3_1/template/default/htmlfunctions.inc.php @ 427

Last change on this file since 427 was 427, checked in by (none), 20 years ago

This commit was manufactured by cvs2svn to create tag
'release-1_3_1'.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 8.1 KB
Line 
1<?php
2/***************************************************************************
3 *                           htmlfunctions.inc.php                         *
4 *                            -------------------                          *
5 *   application   : PhpWebGallery 1.3 <http://phpwebgallery.net>          *
6 *   author        : Pierrick LE GALL <pierrick@z0rglub.com>               *
7 *                                                                         *
8 *   $Id: htmlfunctions.inc.php 427 2004-06-03 21:47:38Z None $
9 *                                                                         *
10 ***************************************************************************
11
12 ***************************************************************************
13 *                                                                         *
14 *   This program is free software; you can redistribute it and/or modify  *
15 *   it under the terms of the GNU General Public License as published by  *
16 *   the Free Software Foundation;                                         *
17 *                                                                         *
18 ***************************************************************************/
19
20//include( PREFIX_INCLUDE.'./template/'.$user['template'].'/theme/conf.php' );
21$user['lien_expanded']='./template/'.$user['template'].'/theme/expanded.gif';
22$user['lien_collapsed']='./template/'.$user['template'].'/theme/collapsed.gif';
23//include_once( PREFIX_INCLUDE.'./template/'.$user['template'].'/style.inc.php');
24
25function get_icon( $date_comparaison )
26{
27  global $user, $conf;
28  $difference = time() - $date_comparaison;
29  $jours = 24*60*60;
30  $output = '';
31  if ( $difference < $user['long_period'] * $jours )
32  {
33    $icon_url = './template/'.$user['template'].'/theme/';
34    if ( $difference < $user['short_period'] * $jours )
35    {
36      $icon_url.= 'new_short.gif';
37    }
38    else
39    {
40      $icon_url.= 'new_long.gif';
41    }
42    $size = getimagesize( $icon_url );
43    $output = '<img src="'.$icon_url.'" style="border:0;';
44    $output.= 'height:'.$size[1].'px;width:'.$size[0].'px" alt="" />';
45  }
46  return $output;
47}
48
49function create_navigation_bar( $url, $nb_element, $start,
50                                $nb_element_page, $link_class )
51{
52  global $lang;
53  $navigation_bar = "";
54  // 0. détection de la page en cours
55  if( !isset( $start )
56      || !is_numeric( $start )
57      || ( is_numeric( $start ) && $start < 0 ) )
58  {
59    $start = 0;
60  }
61  // on n'affiche la bare de navigation que si on plus de 1 page
62  if ( $nb_element > $nb_element_page )
63  {
64    // 1.une page précédente ?
65    if ( $start != 0 )
66    {
67      $previous = $start - $nb_element_page;
68      $navigation_bar.= '<a href="';
69      $navigation_bar.= add_session_id( $url.'&amp;start='.$previous );
70      $navigation_bar.= '" class="'.$link_class.'">'.$lang['previous_page'];
71      $navigation_bar.= '</a>';
72      $navigation_bar.= ' | ';
73    }
74    // 2.liste des numéros de page
75    $maximum = ceil ( $nb_element / $nb_element_page );
76    for ( $i = 1; $i <= $maximum; $i++ )
77    {
78      $temp_start = ( $i - 1 ) * $nb_element_page;
79      if ( $temp_start == $start )
80      {
81        $navigation_bar.= ' <span style="font-weight:bold;">'.$i.'</span> ';
82      }
83      else
84      {
85        $navigation_bar.= ' <a href="';
86        $navigation_bar.= add_session_id( $url.'&amp;start='.$temp_start );
87        $navigation_bar.= '" class="'.$link_class.'">'.$i.'</a> ';
88      }
89    }
90    // 3.une page suivante ?
91    if ( $nb_element > $nb_element_page
92         && $start + $nb_element_page < $nb_element )
93    {
94      $next = $start + $nb_element_page;
95      $navigation_bar.= ' | <a href="';
96      $navigation_bar.= add_session_id( $url.'&amp;start='.$next );
97      $navigation_bar.= '" class="'.$link_class.'">'.$lang['next_page'].'</a>';
98    }
99  }
100  return $navigation_bar;
101}
102
103function get_frame_start()
104{
105  return '<table style="width:';
106}
107/*
108function get_frame_begin()
109{
110  return ';">
111            <tr>
112              <td style="border:1px dashed gray;width:100%;padding:5px;background-color:white;">';
113}
114
115function get_frame_end()
116{
117  return '
118              </td>
119            </tr>   
120          </table>';
121}
122*/
123
124function get_frame_begin()
125{
126  global $user;
127  $path = './template/'.$user['template'].'/theme/';
128  $size_01 = getimagesize( $path.'01.gif' );
129  $size_02 = getimagesize( $path.'02.gif' );
130  $size_03 = getimagesize( $path.'03.gif' );
131  return ';">
132            <tr>
133              <td><img src="'.$path.'01.gif" style="width:'.$size_01[0].'px;display:box;" alt="" /></td>
134              <td><img src="'.$path.'02.gif" style="display:box;width:100%;height:'.$size_02[1].'px;" alt="" /></td>
135              <td><img src="'.$path.'03.gif" style="display:box;width:'.$size_03[0].'px;" alt="" /></td>
136            </tr>
137            <tr>
138              <td style="background:url('.$path.'04.gif);"></td>
139              <td style="background:url('.$path.'05.gif);width:100%;">';
140}
141       
142function get_frame_end()
143{
144  global $user;
145  $path = './template/'.$user['template'].'/theme/';
146  $size_08 = getimagesize( $path.'08.gif' );
147  return '
148              </td>
149              <td style="background:url('.$path.'06.gif);"></td>
150            </tr>
151            <tr>
152              <td><img src="'.$path.'07.gif" alt="" /></td>
153              <td><img src="'.$path.'08.gif" style="width:100%;height:'.$size_08[1].'px;" alt="" /></td>
154              <td><img src="'.$path.'09.gif" alt="" /></td>
155            </tr>   
156          </table>';
157}
158
159function initialize_template()
160{
161  global $vtp, $handle, $user, $lang;
162
163 // $vtp->setGlobalVar( $handle, 'charset', $lang['charset'] );
164  //$vtp->setGlobalVar( $handle, 'style', $user['style'] );
165  $vtp->setGlobalVar( $handle, 'frame_start', get_frame_start() );
166  $vtp->setGlobalVar( $handle, 'frame_begin', get_frame_begin() );
167  $vtp->setGlobalVar( $handle, 'frame_end',   get_frame_end() );
168 //$vtp->setVarF( $handle, 'header',
169 //                './template/'.$user['template'].'/header.htm' );
170  //$vtp->setVarF( $handle, 'footer',
171   //              './template/'.$user['template'].'/footer.htm' );
172}
173
174function display_category( $category, $indent, $handle )
175{
176  global $user,$lang,$vtp;
177
178  $vtp->addSession( $handle, 'category' );
179  $vtp->setVar( $handle, 'category.indent', $indent );
180  if ( $user['expand'] or $category['nb_sub_categories'] == 0 )
181  {
182    $vtp->addSession( $handle, 'bullet_wo_link' );
183    $vtp->setVar( $handle, 'bullet_wo_link.bullet_url',
184                  $user['lien_collapsed'] );
185    $vtp->closeSession( $handle, 'bullet_wo_link' );
186  }
187  else
188  {
189    $vtp->addSession( $handle, 'bullet_w_link' );
190    $url = './category.php';
191        if (isset($page['cat']))
192        {
193        $url .='?cat='.$page['cat'];
194    $url.= '&amp;expand='.$category['expand_string'];
195        }
196        else if ($category['expand_string']<>'')
197        {
198                $url.= '?expand='.$category['expand_string'];
199        }
200    $vtp->setVar( $handle, 'bullet_w_link.bullet_link', add_session_id($url) );
201    if ( $category['expanded'] )
202    {
203      $vtp->setVar( $handle, 'bullet_w_link.bullet_url',
204                    $user['lien_expanded'] );
205    }
206    else
207    {
208      $vtp->setVar( $handle, 'bullet_w_link.bullet_url',
209                    $user['lien_collapsed'] );
210    }
211    $vtp->closeSession( $handle, 'bullet_w_link' );
212  }
213
214  $url = './category.php?cat='.$category['id'];
215  $url.= '&amp;expand='.$category['expand_string'];
216  $vtp->setVar( $handle, 'category.link_url', add_session_id( $url ) );
217
218  $name = $category['name'];
219  if ( $name == '' ) $name = str_replace( '_', ' ', $category['dir'] );
220  $vtp->setVar( $handle, 'category.link_name', $name );
221
222  if ( $category['id_uppercat'] == '' )
223  {
224    $vtp->setVar( $handle, 'category.name_style', 'font-weight:bold;' );
225  }
226  if ( $category['nb_sub_categories'] > 0 )
227  {
228    $vtp->addSession( $handle, 'subcat' );
229    $vtp->setVar( $handle,'subcat.nb_subcats',$category['nb_sub_categories'] );
230    $vtp->closeSession( $handle, 'subcat' );
231  }
232  $vtp->setVar( $handle, 'category.total_cat', $category['nb_images'] );
233  $vtp->setVar( $handle, 'category.cat_icon',get_icon($category['date_last']));
234  $vtp->closeSession( $handle, 'category' );
235
236  // recursive call
237  if ( $category['expanded'] )
238  {
239    foreach ( $category['subcats'] as $subcat ) {
240      display_category( $subcat, $indent.str_repeat( '&nbsp', 2 ), $handle );
241    }
242  }
243}
244?>
Note: See TracBrowser for help on using the repository browser.