source: extensions/stripped_black_bloc/themeconf.inc.php @ 16790

Revision 16790, 4.3 KB checked in by flop25, 7 years ago (diff)

better display of the calendar page

Line 
1<?php
2/*
3Theme Name: Stripped & Columns
4Version: auto
5Description: stripped_black_bloc
6Theme URI: http://piwigo.org/ext/extension_view.php?eid=568
7Author: flop25
8Author URI: http://www.planete-flop.fr
9*/
10
11
12 
13$themeconf = array(
14  'parent' => 'stripped',
15  'name' => 'stripped_black_bloc',
16  'theme_dir' => 'stripped_black_bloc',
17  'icon_dir' => 'themes/stripped/icon',
18  'img_dir' => 'themes/stripped_black_bloc/img',
19  'admin_icon_dir' => 'themes/default/icon/admin',
20  'mime_icon_dir' => 'themes/default/icon/mimetypes/',
21  'local_head' => 'local_head.tpl',
22  'load_parent_local_head' => true,
23);
24global $stripped;
25$stripped['themeStyle']='original';
26
27load_language('theme.lang', PHPWG_THEMES_PATH.'stripped_black_bloc/');
28
29// Need upgrade?
30
31include(PHPWG_THEMES_PATH.'stripped_black_bloc/admin/upgrade.inc.php');
32
33add_event_handler('loc_begin_page_header', 'set_config_values_stripped_black_bloc');
34
35function set_config_values_stripped_black_bloc()
36{
37  global $conf, $template;
38  $config = unserialize( $conf['stripped_black_bloc'] );
39  $template->assign( 'stripped_black_bloc', $config );
40}
41
42/// EVENT
43
44/************************************ thumbnails and category_thumbnails ************************************/
45add_event_handler('loc_end_index_category_thumbnails', 'stripped_black_bloc');
46add_event_handler('loc_end_index_thumbnails', 'stripped_black_bloc');
47function stripped_black_bloc($tpl_thumbnails_var)
48{
49  global $template, $conf;
50  if (defined('RVTS_VERSION'))
51  {
52    $template->func_combine_script( array(
53        'id'=> 'sc_tscroller',
54        'load'=> 'async',
55        'path'=> PHPWG_THEMES_PATH.'stripped_black_bloc/js/tscroller.min.js',
56        'require' => 'jquery',
57      ), $template->smarty);
58  }
59 
60  $config = unserialize( $conf['stripped_black_bloc'] );
61  $template->assign( 'stripped_black_bloc', $config );
62  $new_tplvar=array();
63  $i=1;
64  foreach ($tpl_thumbnails_var as $tplvar)
65  {
66    $tplvar['TN_CLASS']=($i==$config['starting_to']) ? "bloc_big" : "bloc";
67    $new_tplvar[]=$tplvar;
68    $i= ($i==$config['every_x']) ? 1 : $i+1 ;
69  }
70  return $new_tplvar;
71}
72add_event_handler('init', 'stripped_black_bloc_init');
73function stripped_black_bloc_init()
74{
75  remove_event_handler('loc_begin_index', 'modify_nb_thumbnail_page');
76}
77
78/************************************ index.tpl ************************************/
79add_event_handler('loc_end_index', 'stripped_black_bloc_index');
80function stripped_black_bloc_index()
81{
82    global $template;
83    $template->set_prefilter('index', 'stripped_black_bloc_prefilter_index');
84}
85function stripped_black_bloc_prefilter_index($content, &$smarty)
86{
87  global $page;
88  $search = "#\{\'Menu\'\|@translate\}#"; 
89  $replacement = "{'Show/hide menu'|@translate}</span>";
90  $content = preg_replace($search, $replacement, $content);
91  $search = '#<div id="subcontent">#'; 
92  $replacement = "";
93  $content = preg_replace($search, $replacement, $content);
94  $search = '#\{if \!empty\(\$CONTENT_DESCRIPTION\) \}#'; 
95  $replacement = ' <div id="subcontent">
96
97  {if !empty($CONTENT_DESCRIPTION) }';
98  $content = preg_replace($search, $replacement, $content);
99  $search = '#\{if \!empty\(\$navbar\) \}[\s]*\{include file=\'navigation_bar\.tpl\'\|@get_extent:\'navbar\'\}[\s]*\{/if\}#'; 
100  $replacement = '';
101  $content = preg_replace($search, $replacement, $content);
102
103  $search = '#\{\$PLUGIN_INDEX_CONTENT_AFTER\}</div>\{/if\}.*</div>#s'; 
104  $replacement = '{$PLUGIN_INDEX_CONTENT_AFTER}</div>{/if}
105        </div>
106  {if !empty($navbar) }
107  {include file=\'navigation_bar.tpl\'|@get_extent:\'navbar\'}
108  {/if}';
109  $content = preg_replace($search, $replacement, $content);
110  if ( isset($page['chronology_view']))
111  {
112    $search = '#\{if isset\(\$chronology\.TITLE\)#s';
113    $replacement = '<div class="bloc_stuff">
114{if isset($chronology.TITLE)';
115    $content = preg_replace($search, $replacement, $content);
116    $search = '#\{if \!empty\(\$PLUGIN_INDEX_CONTENT_BEGIN\)\}#s';
117    $replacement = '</div>
118{if !empty($PLUGIN_INDEX_CONTENT_BEGIN)}';
119    $content = preg_replace($search, $replacement, $content);
120    $search = '#calendar_block"#s';
121    if ($page['chronology_view']=='calendar')
122    {
123     $replacement = 'calendar_block" class="bloc_stuff" style="width:100%;padding:5px"';
124    }
125    else {
126     $replacement = 'calendar_block" class="bloc_stuff" style="padding:5px 0"';
127    }
128    $content = preg_replace($search, $replacement, $content);
129  }
130
131  return $content;
132}
133
134?>
Note: See TracBrowser for help on using the repository browser.