OSDN Git Service

初回コミット(v2.6.17.1)
[magic3/magic3.git] / templates / art26_test2 / 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'   - use default style, 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 root tag as well as to the module elements.
20   //  'art-...'        - overwrites module style.
21   //  'art-... suffix' - overwrites style and adds suffix to the module root tag and
22   //                     to the module elements, does not add art-... to the module elements.
23   $classes = '';
24   $sfx = $params->get('moduleclass_sfx');
25   if (strlen($sfx) != 0) {
26     if (' ' == $sfx[0])
27       $classes = $sfx;
28     else {
29       $parts = explode(' ', $sfx, 2);
30       if (in_array($parts[0], array_keys($styles))) {
31         $style = $parts[0];
32         if (count($parts) > 1)
33           $classes = ' ' . $parts[1];
34         $params->set('moduleclass_sfx', $classes);
35       }
36     }
37   }
38   $params->set('artx-module-classes', $classes);
39   call_user_func($styles[$style], $module, $params, $attribs);
40 }
41
42 function modChrome_artnostyle($module, &$params, &$attribs)
43 {
44 if (!empty ($module->content)) : ?>
45 <div class="art-nostyle<?php echo $params->get('artx-module-classes'); ?>">
46 <?php if ($module->showtitle != 0) : ?>
47 <h3><?php echo $module->title; ?></h3>
48 <?php endif; ?>
49 <?php echo $module->content; ?>
50 </div>
51 <?php endif;
52 }
53
54 function modChrome_artblock($module, &$params, &$attribs)
55 {
56   if (!empty ($module->content))
57     echo artxBlock(($module->showtitle != 0) ? $module->title : '', $module->content,
58       $params->get('artx-module-classes'));
59 }
60
61 function modChrome_artvmenu($module, &$params, &$attribs)
62 {
63   if (!empty ($module->content)) {
64     if (function_exists('artxVMenuBlock'))
65       echo artxVMenuBlock(($module->showtitle != 0) ? $module->title : '', $module->content,
66         $params->get('artx-module-classes'));
67     else
68       echo artxBlock(($module->showtitle != 0) ? $module->title : '', $module->content,
69         $params->get('artx-module-classes'));
70   }
71 }
72
73 function modChrome_artarticle($module, &$params, &$attribs)
74 {
75   if (!empty ($module->content)) {
76     $data = array('classes' => $params->get('artx-module-classes'), 'content' => $module->content);
77     if ($module->showtitle != 0)
78       $data['header-text'] = $module->title;
79     echo artxPost($data);
80   }
81 }