PageRenderTime 45ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 0ms

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

https://github.com/hashing/basercms
PHP | 78 lines | 58 code | 2 blank | 18 comment | 14 complexity | b68a208eecc75346ee4895c4a253d05a 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 = false;
  25. }
  26. if(isset($blogContent)){
  27. $id = $blogContent['BlogContent']['id'];
  28. }else{
  29. $id = $blog_content_id;
  30. }
  31. $actionUrl = '/blog/blog/get_posted_years/'.$id;
  32. if($limit) {
  33. $actionUrl .= '/'.$limit;
  34. } else {
  35. $actionUrl .= '/0';
  36. }
  37. if($view_count) {
  38. $actionUrl .= '/1';
  39. }
  40. $data = $this->requestAction($actionUrl);
  41. $postedDates = $data['postedDates'];
  42. $blogContent = $data['blogContent'];
  43. $baseCurrentUrl = $blogContent['BlogContent']['name'].'/archives/date/';
  44. ?>
  45. <div class="widget widget-blog-yearly-archives widget-blog-yearly-archives-<?php echo $id ?> blog-widget">
  46. <?php if($name && $use_title): ?>
  47. <h2><?php echo $name ?></h2>
  48. <?php endif ?>
  49. <?php if(!empty($postedDates)): ?>
  50. <ul>
  51. <?php foreach($postedDates as $postedDate): ?>
  52. <?php if(isset($this->params['named']['year']) && $this->params['named']['year'] == $postedDate['year']): ?>
  53. <?php $class = ' class="selected"' ?>
  54. <?php elseif($this->params['url']['url'] == $baseCurrentUrl.$postedDate['year']): ?>
  55. <?php $class = ' class="current"' ?>
  56. <?php else: ?>
  57. <?php $class = '' ?>
  58. <?php endif ?>
  59. <?php if($view_count): ?>
  60. <?php $title = $postedDate['year'].'年'.'('.$postedDate['count'].')' ?>
  61. <?php else: ?>
  62. <?php $title = $postedDate['year'].'年' ?>
  63. <?php endif ?>
  64. <li<?php echo $class ?>>
  65. <?php $bcBaser->link($title, array(
  66. 'admin' => false,
  67. 'plugin' => '',
  68. 'controller' => $blogContent['BlogContent']['name'],
  69. 'action' => 'archives',
  70. 'date', $postedDate['year']
  71. )) ?>
  72. </li>
  73. <?php endforeach; ?>
  74. </ul>
  75. <?php endif; ?>
  76. </div>