default.php 13.1 KB
<?php

/**
 * @package     Joomla.Site
 * @subpackage  mod_articles_category
 *
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;
$catid = JRequest::getInt('catid');
//echo $catid;
?>
<ul class="category-module<?php echo $moduleclass_sfx; ?>">
    <?php if ($grouped) : ?>
        <?php foreach ($list as $group_name => $group) : ?>
            <li>
                <div class="mod-articles-category-group"><?php echo $group_name; ?></div>
                <ul>
                    <?php foreach ($group as $item) : ?>
                        <li>
                            <?php if ($params->get('link_titles') == 1) : ?>
                                <a class="mod-articles-category-title <?php echo $item->active; ?>" href="<?php echo $item->link; ?>">
                                    <?php echo $item->title; ?>
                                </a>
                            <?php else : ?>
                                <?php echo $item->title; ?>
                            <?php endif; ?>

                            <?php if ($item->displayHits) : ?>
                                <span class="mod-articles-category-hits">
                                    (<?php echo $item->displayHits; ?>)
                                </span>
                            <?php endif; ?>

                            <?php if ($params->get('show_author')) : ?>
                                <span class="mod-articles-category-writtenby">
                                    <?php echo $item->displayAuthorName; ?>
                                </span>
                            <?php endif; ?>

                            <?php if ($item->displayCategoryTitle) : ?>
                                <span class="mod-articles-category-category">
                                    (<?php echo $item->displayCategoryTitle; ?>)
                                </span>
                            <?php endif; ?>

                            <?php if ($item->displayDate) : ?>
                                <span class="mod-articles-category-date"><?php echo $item->displayDate; ?></span>
                            <?php endif; ?>

                            <?php if ($params->get('show_introtext')) : ?>
                                <p class="mod-articles-category-introtext">
                                    <?php echo $item->displayIntrotext; ?>
                                </p>
                            <?php endif; ?>

                            <?php if ($params->get('show_readmore')) : ?>
                                <p class="mod-articles-category-readmore">
                                    <a class="mod-articles-category-title <?php echo $item->active; ?>" href="<?php echo $item->link; ?>">
                                        <?php if ($item->params->get('access-view') == false) : ?>
                                            <?php echo JText::_('MOD_ARTICLES_CATEGORY_REGISTER_TO_READ_MORE'); ?>
                                        <?php elseif ($readmore = $item->alternative_readmore) : ?>
                                            <?php echo $readmore; ?>
                                            <?php echo JHtml::_('string.truncate', $item->title, $params->get('readmore_limit')); ?>
                                            <?php if ($params->get('show_readmore_title', 0) != 0) : ?>
                                                <?php echo JHtml::_('string.truncate', $this->item->title, $params->get('readmore_limit')); ?>
                                            <?php endif; ?>
                                        <?php elseif ($params->get('show_readmore_title', 0) == 0) : ?>
                                            <?php echo JText::sprintf('MOD_ARTICLES_CATEGORY_READ_MORE_TITLE'); ?>
                                        <?php else : ?>
                                            <?php echo JText::_('MOD_ARTICLES_CATEGORY_READ_MORE'); ?>
                                            <?php echo JHtml::_('string.truncate', $item->title, $params->get('readmore_limit')); ?>
                                        <?php endif; ?>
                                    </a>
                                </p>
                            <?php endif; ?>
                        </li>
                    <?php endforeach; ?>
                </ul>
            </li>
        <?php endforeach; ?>
    <?php else : ?>
        <?php foreach ($list as $item) : ?>
            <li>
                <?php
                $timestamp = strtotime($item->publish_up) + 5 * 24 * 60 * 60;
                $timestamp2 = time();
                if ($timestamp2 < $timestamp) {
                    $new = 1;
                } else {
                    $new = 0;
                }
                ?>


                <?php if ($item->displayDate) : ?>
                    <div class="mod-articles-category-date day">
                        <?php echo $item->displayDate; ?>
                    </div>
                <?php endif; ?>

                <?php if (JRequest::getInt('Itemid') == 101) { //TOPのみ
                ?>
                    <?php if ($moduleclass_sfx == 'info02') { ?>
                        <div class="cate_wrap">
                            <div class="mod-articles-category-category cat10 cate"><a href="/info-record.html">競技成績</a></div>
                            <?php
                            if ($new == 1) {
                                echo '<div class="icon_new">NEW</div>';
                            }
                            ?>
                        </div>
                    <?php } ?>
                    <?php if ($moduleclass_sfx == 'info03') { ?>
                        <div class="cate_wrap">
                            <div class="mod-articles-category-category cat2 cate"><a href="/info-exam.html">入試情報</a></div>
                            <?php
                            if ($new == 1) {
                                echo '<div class="icon_new">NEW</div>';
                            }
                            ?>
                        </div>
                    <?php } ?>
                    <?php if ($moduleclass_sfx == 'info04') { ?>
                        <div class="cate_wrap">
                            <div class="mod-articles-category-category cat11 cate"><a href="/info-news.html">お知らせ</a></div>
                            <?php
                            if ($new == 1) {
                                echo '<div class="icon_new">NEW</div>';
                            }
                            # アイハントカスタマイズ
                            ?>
                        </div>
                    <?php } ?>
                    <?php if ($moduleclass_sfx == 'info05') { ?>
                        <div class="cate_wrap">
                            <div class="mod-articles-category-category cat9 cate"><a href="/info-topix.html">トピックス</a></div>
                            <?php
                            if ($new == 1) {
                                echo '<div class="icon_new">NEW</div>';
                            }
                            ?>
                        </div>
                    <?php } ?>
                    <?php if ($moduleclass_sfx == 'info12') { ?>
                        <div class="cate_wrap">
                            <div class="mod-articles-category-category cat12 cate"><a href="/info-media.html">メディア</a></div>
                            <?php
                            if ($new == 1) {
                                echo '<div class="icon_new">NEW</div>';
                            }
                            ?>
                        </div>
                    <?php } ?>
                    <?php if ($moduleclass_sfx == 'info01') { ?>

                        <?php echo '<div class="cate_wrap">'; ?>

                        <?php
                        $itemTags = (new JHelperTags)->getItemTags('com_content.article', $item->id);
                        forEach($itemTags as $tag) {
                            $chk = preg_match("/^info-/", $tag->alias);
                            if (preg_match("/^info-/", $tag->alias)) {
                                echo "<div class='mod-articles-category-category cat{$tag->tag_id} cate'><a href='/{$tag->alias}.html'>{$tag->title}</a></div>";
                            }
                        }
                        if ($new == 1) {
                            echo '<div class="icon_new">NEW</div>';
                        }
                        echo '</div>';
                        ?>

                    <?php
                    }
                } else { //TOP以外
                    ?>
                    <?php
                    // error_log("chk\n", 3, '/var/www/html/debug.log');
                    // error_log("\n", 3, '/var/www/html/debug.log');
                    // error_log($moduleclass_sfx, 3, '/var/www/html/debug.log');
                    // error_log("\n", 3, '/var/www/html/debug.log');
                    if ($moduleclass_sfx == 'covid-19-students' ||
                        $moduleclass_sfx == 'covid-19-staff') {
                    ?>
                        <span class="mod-articles-category-category cat<?php echo $item->catid; ?>">
                            <?php echo $item->displayCategoryTitle; ?>
                        </span>
                        <?php
                            if ($new == 1) {
                                echo '<div class="icon_new">NEW</div>';
                            }
                        ?>
                    <?php
                    }
                    ?>
                    <?php if ($item->displayCategoryTitle) : ?>
                        <span class="mod-articles-category-category cat<?php echo $item->catid; ?>">
                            <?php echo $item->displayCategoryTitle; ?>
                        </span>
                <?php endif;
                } //閉じる
                ?>

                <?php //TOPのインフォメーションでリンク先が東京サテライトになるのをinformation/に変更する処理 
                ?>
                <?php if ($params->get('link_titles') == 1) { ?>
                    <?php if (JRequest::getInt('Itemid') == 101) { //TOPのみ
                    ?>
                        <?php
                        $url = $item->link;
                        $tmp = explode("/", $url);
                        $end_word = end($tmp);
                        //echo "URL>".$end_word;
                        ?>

                        <div class="txt"><a class="mod-articles-category-title <?php echo $item->active; ?>" href="<?php echo "information/" . $end_word; ?>"><?php echo $item->title; ?></a></div>
                    <?php } else { ?>
                        <div class="txt"><a class="mod-articles-category-title <?php echo $item->active; ?>" href="<?php echo $item->link; ?>"><?php echo $item->title; ?></a></div>
                    <?php } ?>
                <?php } else { ?>
                    <?php echo $item->title; ?>
                <?php } ?>

                <?php if ($item->displayHits) : ?>
                    <span class="mod-articles-category-hits">
                        (<?php echo $item->displayHits; ?>)
                    </span>
                <?php endif; ?>

                <?php if ($params->get('show_author')) : ?>
                    <span class="mod-articles-category-writtenby">
                        <?php echo $item->displayAuthorName; ?>
                    </span>
                <?php endif; ?>

                <?php if ($params->get('show_introtext')) : ?>
                    <p class="mod-articles-category-introtext">
                        <?php echo $item->displayIntrotext; ?>
                    </p>
                <?php endif; ?>

                <?php if ($params->get('show_readmore')) : ?>
                    <p class="mod-articles-category-readmore">
                        <a class="mod-articles-category-title <?php echo $item->active; ?>" href="<?php echo $item->link; ?>">
                            <?php if ($item->params->get('access-view') == false) : ?>
                                <?php echo JText::_('MOD_ARTICLES_CATEGORY_REGISTER_TO_READ_MORE'); ?>
                            <?php elseif ($readmore = $item->alternative_readmore) : ?>
                                <?php echo $readmore; ?>
                                <?php echo JHtml::_('string.truncate', $item->title, $params->get('readmore_limit')); ?>
                            <?php elseif ($params->get('show_readmore_title', 0) == 0) : ?>
                                <?php echo JText::sprintf('MOD_ARTICLES_CATEGORY_READ_MORE_TITLE'); ?>
                            <?php else : ?>
                                <?php echo JText::_('MOD_ARTICLES_CATEGORY_READ_MORE'); ?>
                                <?php echo JHtml::_('string.truncate', $item->title, $params->get('readmore_limit')); ?>
                            <?php endif; ?>
                        </a>
                    </p>
                <?php endif; ?>
            </li>
        <?php endforeach; ?>
    <?php endif; ?>
</ul>