PageRenderTime 143ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/baser/plugins/blog/views/elements/widgets/blog_monthly_archives.php

https://github.com/hashing/basercms
PHP | 73 lines | 53 code | 2 blank | 18 comment | 15 complexity | c162b856da925fa689277f9dfa556902 MD5 | raw file
Possible License(s): MIT
  1. <?php
  2. /* SVN FILE: $Id$ */
  3. /**
  4. * [PUBLISH] ブログ月別アーカイブ
  5. *
  6. * PHP versions 5
  7. *
  8. * baserCMS : Based Website Development Project <http://basercms.net>
  9. * Copyright 2008 - 2012, baserCMS Users Community <http://sites.google.com/site/baserusers/>
  10. *
  11. * @copyright Copyright 2008 - 2012, baserCMS Users Community
  12. * @link http://basercms.net baserCMS Project
  13. * @package baser.plugins.blog.views
  14. * @since baserCMS v 0.1.0
  15. * @version $Revision$
  16. * @modifiedby $LastChangedBy$
  17. * @lastmodified $Date$
  18. * @license http://basercms.net/license/index.html
  19. */
  20. if(!isset($view_count)) {
  21. $view_count = false;
  22. }
  23. if(!isset($limit)) {
  24. $limit = 12;
  25. }
  26. if(isset($blogContent)){
  27. $id = $blogContent['BlogContent']['id'];
  28. }else{
  29. $id = $blog_content_id;
  30. }
  31. $actionUrl = '/blog/blog/get_posted_months/'.$id.'/'.$limit;
  32. if($view_count) {
  33. $actionUrl .= '/1';
  34. }
  35. $data = $this->requestAction($actionUrl);
  36. $postedDates = $data['postedDates'];
  37. $blogContent = $data['blogContent'];
  38. $baseCurrentUrl = $blogContent['BlogContent']['name'].'/archives/date/';
  39. ?>
  40. <div class="widget widget-blog-monthly-archives widget-blog-monthly-archives-<?php echo $id ?> blog-widget">
  41. <?php if($name && $use_title): ?>
  42. <h2><?php echo $name ?></h2>
  43. <?php endif ?>
  44. <?php if(!empty($postedDates)): ?>
  45. <ul>
  46. <?php foreach($postedDates as $postedDate): ?>
  47. <?php if(isset($this->params['named']['year']) && isset($this->params['named']['month']) && $this->params['named']['year'] == $postedDate['year'] && $this->params['named']['month'] == $postedDate['month']): ?>
  48. <?php $class = ' class="selected"' ?>
  49. <?php elseif($this->params['url']['url'] == $baseCurrentUrl.$postedDate['year'].'/'.$postedDate['month']): ?>
  50. <?php $class = ' class="current"' ?>
  51. <?php else: ?>
  52. <?php $class = '' ?>
  53. <?php endif ?>
  54. <?php if($view_count): ?>
  55. <?php $title = $postedDate['year'].'年'.$postedDate['month'].'月'.'('.$postedDate['count'].')' ?>
  56. <?php else: ?>
  57. <?php $title = $postedDate['year'].'年'.$postedDate['month'].'月' ?>
  58. <?php endif ?>
  59. <li<?php echo $class ?>>
  60. <?php $bcBaser->link($title, array(
  61. 'admin' => false,
  62. 'plugin' => '',
  63. 'controller' => $blogContent['BlogContent']['name'],
  64. 'action' => 'archives',
  65. 'date', $postedDate['year'], $postedDate['month']
  66. )) ?>
  67. </li>
  68. <?php endforeach; ?>
  69. </ul>
  70. <?php endif; ?>
  71. </div>