OSDN Git Service

初回コミット(v2.6.17.1)
[magic3/magic3.git] / templates / art41_sample2 / html / modules.php
1 <?php
2 defined('_JEXEC') or die;
3
4 if (!defined('_ARTX_FUNCTIONS'))
5   require_once dirname(__FILE__) . str_replace('/', DIRECTORY_SEPARATOR, '/../functions.php');
6
7 function modChrome_artstyle($module, &$params, &$attribs)
8 {
9   $style = isset($attribs['artstyle']) ? $attribs['artstyle'] : 'art-nostyle';
10   $styles = array(
11     'art-nostyle' => 'modChrome_artnostyle',
12     'art-block' => 'modChrome_artblock',
13     'art-article' => 'modChrome_artarticle',
14     'art-vmenu' => 'modChrome_artvmenu'
15   );
16   // moduleclass_sfx support:
17   //  '' or 'suffix'   - the default module style: custom suffix will not be added to the module tag
18   //                     but will be added to the module elements.
19   //  ' suffix'        - adds suffix to the module as well as to the module elements.
20   //  'art-...'        - overwrites the default module style.
21   //  'suffix art-...' - overwrites the default style and adds suffix to the module and
22   //                     to its elements, does not add art-... to the module elements.
23   
24   $classes = explode(' ', rtrim($params->get('moduleclass_sfx')));
25   $keys = array_keys($styles);
26   $art = array();
27   foreach ($classes as $key => $class) {
28     if (in_array($class, $keys)) {
29       $art[] = $class;
30       $classes[$key] = ' ';
31     }
32   }
33   $classes = str_replace('  ', ' ', rtrim(implode(' ', $classes)));
34   $style = count($art) ? array_pop($art) : $style;
35   $params->set('moduleclass_sfx', $classes);
36   call_user_func($styles[$style], $module, $params, $attribs);
37 }
38
39 function modChrome_artnostyle($module, &$params, &$attribs)
40 {
41 if (!empty ($module->content)) : ?>
42 <!-- begin nostyle -->
43 <div class="art-nostyle<?php echo $params->get('moduleclass_sfx'); ?>">
44 <?php if ($module->showtitle != 0) : ?>
45 <h3><?php echo $module->title; ?></h3>
46 <?php endif; ?>
47 <!-- begin nostyle content -->
48 <?php echo $module->content; ?>
49 <!-- end nostyle content -->
50 </div>
51 <!-- end nostyle -->
52 <?php endif;
53 }
54
55 function modChrome_artblock($module, &$params, &$attribs)
56 {
57   if (!empty ($module->content))
58     echo artxBlock(($module->showtitle != 0) ? $module->title : '', $module->content,
59       $params->get('moduleclass_sfx'));
60 }
61
62 function modChrome_artvmenu($module, &$params, &$attribs)
63 {
64   if (!empty ($module->content)) {
65     if (function_exists('artxVMenuBlock'))
66       echo artxVMenuBlock(($module->showtitle != 0) ? $module->title : '', $module->content,
67         $params->get('moduleclass_sfx'));
68     else
69       echo artxBlock(($module->showtitle != 0) ? $module->title : '', $module->content,
70         $params->get('moduleclass_sfx'));
71   }
72 }
73
74 function modChrome_artarticle($module, &$params, &$attribs)
75 {
76   if (!empty ($module->content)) {
77     $data = array('classes' => $params->get('moduleclass_sfx'), 'content' => $module->content);
78     if ($module->showtitle != 0)
79       $data['header-text'] = $module->title;
80     echo artxPost($data);
81   }
82 }