PageRenderTime 53ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

/baser/plugins/blog/controllers/blog_configs_controller.php

https://github.com/hashing/basercms
PHP | 113 lines | 35 code | 8 blank | 70 comment | 3 complexity | 8f9f28ea6f30ff4873d6b4ac68bda568 MD5 | raw file
Possible License(s): MIT
  1. <?php
  2. /* SVN FILE: $Id$ */
  3. /**
  4. * ブログ設定コントローラー
  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.controllers
  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. /**
  21. * Include files
  22. */
  23. /**
  24. * ブログ設定コントローラー
  25. *
  26. * @package baser.plugins.blog.controllers
  27. */
  28. class BlogConfigsController extends BlogAppController {
  29. /**
  30. * クラス名
  31. *
  32. * @var string
  33. * @access public
  34. */
  35. var $name = 'BlogConfigs';
  36. /**
  37. * モデル
  38. *
  39. * @var array
  40. * @access public
  41. */
  42. var $uses = array('User', 'Blog.BlogCategory', 'Blog.BlogConfig', 'Blog.BlogContent');
  43. /**
  44. * コンポーネント
  45. *
  46. * @var array
  47. * @access public
  48. */
  49. var $components = array('BcAuth','Cookie','BcAuthConfigure');
  50. /**
  51. * サブメニューエレメント
  52. *
  53. * @var array
  54. * @access public
  55. */
  56. var $subMenuElements = array();
  57. /**
  58. * ぱんくずナビ
  59. *
  60. * @var string
  61. * @access public
  62. */
  63. var $crumbs = array(
  64. array('name' => 'プラグイン管理', 'url' => array('plugin' => '', 'controller' => 'plugins', 'action' => 'index')),
  65. array('name' => 'ブログ管理', 'url' => array('controller' => 'blog_contents', 'action' => 'index'))
  66. );
  67. /**
  68. * before_filter
  69. *
  70. * @return void
  71. * @access public
  72. */
  73. function beforeFilter() {
  74. parent::beforeFilter();
  75. if($this->params['prefix']=='admin') {
  76. $this->subMenuElements = array('blog_common');
  77. }
  78. }
  79. /**
  80. * [ADMIN] サイト基本設定
  81. *
  82. * @return void
  83. * @access public
  84. */
  85. function admin_form() {
  86. if(empty($this->data)) {
  87. $this->data = $this->BlogConfig->read(null, 1);
  88. $blogContentList = $this->BlogContent->find("list");
  89. $this->set('blogContentList',$blogContentList);
  90. $userList = $this->User->find("list");
  91. $this->set('userList',$userList);
  92. }else {
  93. /* 更新処理 */
  94. if($this->BlogConfig->save($this->data)) {
  95. $this->Session->setFlash('ブログ設定を保存しました。');
  96. $this->redirect(array('action' => 'form'));
  97. }else {
  98. $this->Session->setFlash('入力エラーです。内容を修正してください。');
  99. }
  100. }
  101. /* 表示設定 */
  102. $this->pageTitle = 'ブログ設定';
  103. }
  104. }
  105. ?>