source: extensions/stripped_responsive/themeconf.inc.php @ 29449

Last change on this file since 29449 was 29449, checked in by JanisV, 10 years ago

Initial commit

  • Property svn:executable set to *
File size: 3.5 KB
Line 
1<?php
2/*
3Theme Name: stripped_responsive
4Version: 0.1
5Description: Responsive stripped Theme
6Theme URI: http://piwigo.org/ext/extension_view.php?eid=773
7Author: JanisV
8*/
9
10global $conf, $user, $stripped_responsive;
11
12$stripped_responsive = array_merge( unserialize( $conf['stripped_responsive'] ), (array)$stripped_responsive );
13
14
15add_event_handler('init', 'set_config_values');
16function set_config_values()
17{
18  global $template, $pwg_loaded_plugins, $stripped_responsive;
19  $stripped_responsive['albumSize'] = ImageStdParams::get_custom(276, 276, 1, 276, 276);
20  $template->assign(array(
21                          'automatic_size_enabled'=> isset($pwg_loaded_plugins['automatic_size']),
22                          'HDShadowbox_loaded'=> isset($pwg_loaded_plugins['HDShadowbox']),
23                          'GMaps_loaded'=> isset($pwg_loaded_plugins['GMaps']),
24                          'ThumbScroller_loaded'=> isset($pwg_loaded_plugins[ 'rv_tscroller' ]),
25                          'usertags'=> isset($pwg_loaded_plugins['user_tags']),
26                          'stripped_responsive'=> $stripped_responsive
27                         ));
28}
29       
30$themeconf = array(
31  'parent' => 'default', 
32  'load_parent_css' => false,
33  'load_parent_local_head' => false,
34  'name' => 'stripped_responsive',
35  'theme_dir' => 'stripped_responsive',
36  'icon_dir' => 'themes/stripped_responsive/icon',
37  'img_dir'      => 'themes/stripped_responsive/images',
38  'admin_icon_dir' => 'themes/default/icon/admin',
39  'mime_icon_dir' => 'themes/default/icon/mimetypes/',
40  'local_head' => 'local_head.tpl',
41);
42
43load_language('theme.lang', PHPWG_THEMES_PATH.'stripped_responsive/');
44
45pwg_set_session_var('show_metadata', true);
46
47// max number of thumbnails by page
48
49add_event_handler('loc_begin_index', 'modify_nb_thumbnail_page');
50function modify_nb_thumbnail_page()
51{
52        global $user, $page, $stripped_responsive;
53
54        if (!isset($stripped_responsive['maxThumb'])) { $stripped_responsive['maxThumb']=15;}
55        $user['nb_image_page']=$stripped_responsive['maxThumb'];
56        $page['nb_image_page']=$stripped_responsive['maxThumb'];
57}
58
59// Preload function
60
61if (isset($stripped_responsive['imagePreload']) && ($user['theme'] == 'stripped_responsive')) {
62        add_event_handler('loc_end_picture', 'assign_next_images_url');
63}
64
65function assign_next_images_url()
66{
67        global $page, $template, $conf, $stripped_responsive;
68
69        $nb_image =$stripped_responsive['imagePreloadNb'];
70        $nb_max = $page['last_rank'] - $page['current_rank'];
71        $nb_image = min ($nb_image, $nb_max);
72
73        if ($nb_image < 1) return;
74
75        for ($n = 1; $n <= $nb_image; $n++) {
76                $pagenext[$n] = $page['items'][ $page['current_rank'] + $n ];
77        }
78
79        $picturenext = array();
80        $idnext = array();
81
82        for ($n = 1; $n <= $nb_image; $n++) {
83                array_push($idnext, $pagenext[$n]);
84        }
85
86        $query = '
87        SELECT *
88          FROM '.IMAGES_TABLE.'
89          WHERE id IN ('.implode(',', $idnext).')
90        ;';
91
92        $result = pwg_query($query);
93
94        while ($rownext = pwg_db_fetch_assoc($result))
95        {
96                for ($n = 1; $n <= $nb_image; $n++) {
97                        if (isset($pagenext[$n]) and $rownext['id'] == $pagenext[$n]) {$in = $n;}
98                }
99
100                $picturenext[$in] = $rownext;
101
102                $derivative = new DerivativeImage($stripped_responsive['imageSize'], new SrcImage($rownext));
103                $picturenext[$in]['image_url'] = $derivative->get_url();
104        }
105
106        for ($n = 1; $n <= $nb_image; $n++) {
107                if (isset($picturenext[$n]['image_url'])) { $image_next[$n] = $picturenext[$n]['image_url']; }
108        }
109 
110  $template->assign('U_IMGNEXT', $image_next );
111
112}
113
114?>
Note: See TracBrowser for help on using the repository browser.