PageRenderTime 40ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/baser/views/elements/admin/searches/pages_index.php

https://github.com/hashing/basercms
PHP | 104 lines | 66 code | 14 blank | 24 comment | 7 complexity | 787dd1f4d8987fd93c9ba1137ca6ee2e MD5 | raw file
Possible License(s): MIT
  1. <?php
  2. /* SVN FILE: $Id$ */
  3. /**
  4. * [ADMIN] ページ一覧 検索ボックス
  5. *
  6. * PHP versions 4 and 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.views
  14. * @since baserCMS v 2.0.0
  15. * @version $Revision$
  16. * @modifiedby $LastChangedBy$
  17. * @lastmodified $Date$
  18. * @license http://basercms.net/license/index.html
  19. */
  20. $pageType = array();
  21. if(Configure::read('BcApp.mobile') || Configure::read('BcApp.smartphone')) {
  22. $pageType = array('1' => 'PC');
  23. }
  24. if(Configure::read('BcApp.mobile')) {
  25. $pageType['2'] = 'モバイル';
  26. }
  27. if(Configure::read('BcApp.smartphone')) {
  28. $pageType['3'] = 'スマートフォン';
  29. }
  30. ?>
  31. <script type="text/javascript">
  32. /**
  33. * 起動処理
  34. */
  35. $(function() {
  36. $('input[name="data[Page][page_type]"]').click(pageTypeChengeHandler);
  37. $.baserAjaxDataList.resetSearchBox = function() {
  38. $("#PagePageType1").attr('checked', true);
  39. pageTypeChengeHandler();
  40. }
  41. pageTypeChengeHandler();
  42. });
  43. /**
  44. * ページタイプ変更時イベント
  45. */
  46. function pageTypeChengeHandler() {
  47. var pageType = $('input[name="data[Page][page_type]"]:checked').val();
  48. $.ajax({
  49. type: "POST",
  50. url: $("#AjaxCategorySourceUrl").html()+'/'+pageType,
  51. beforeSend: function() {
  52. $("#PagePageCategoryId").attr('disabled', 'disabled');
  53. },
  54. success: function(result){
  55. if(result) {
  56. var categoryId = $("#PagePageCategoryId").val();
  57. $("#PagePageCategoryId option").remove();
  58. $("#PagePageCategoryId").append('<option value="">指定しない</option>');
  59. $("#PagePageCategoryId").append('<option value="noncat">カテゴリなし</option>');
  60. $("#PagePageCategoryId").append($(result).find('option'));
  61. $("#PagePageCategoryId").val(categoryId);
  62. }
  63. },
  64. complete: function() {
  65. $("#PagePageCategoryId").attr('disabled', false);
  66. }
  67. });
  68. }
  69. </script>
  70. <div id="AjaxCategorySourceUrl" class="display-none"><?php $bcBaser->url(array('action' => 'ajax_category_source')) ?></div>
  71. <?php echo $bcForm->create('Page', array('action' => 'index', 'url' => array('action' => 'index'))) ?>
  72. <p>
  73. <span><?php echo $bcForm->label('Page.name', 'ページ名') ?> <?php echo $bcForm->input('Page.name', array('type' => 'text', 'size' => '30')) ?></span>
  74. <span><?php echo $bcForm->label('Page.status', '公開状態') ?> <?php echo $bcForm->input('Page.status', array('type' => 'select', 'options' => $bcText->booleanMarkList(), 'empty' => '指定なし')) ?></span> 
  75. <span><?php echo $bcForm->label('Page.author_id', '作成者') ?> <?php echo $bcForm->input('Page.author_id', array('type' => 'select', 'options' => $users, 'empty' => '指定なし')) ?></span> 
  76. <span style="white-space: nowrap">
  77. <?php if($pageType): ?>
  78. <span><?php echo $bcForm->label('Page.page_type', 'タイプ') ?> <?php echo $bcForm->input('Page.page_type', array('type' => 'radio', 'options' => $pageType)) ?></span> 
  79. <?php endif ?>
  80. <?php if($pageCategories): ?>
  81. <span><?php echo $bcForm->label('Page.page_category_id', 'カテゴリー') ?> <?php echo $bcForm->input('Page.page_category_id', array('type' => 'select', 'options' => $pageCategories, 'escape' => false)) ?></span>
  82. <?php endif ?>
  83. </span>
  84. </p>
  85. <div class="button">
  86. <?php $bcBaser->link($bcBaser->getImg('admin/btn_search.png', array('alt' => '検索', 'class' => 'btn')), "javascript:void(0)", array('id' => 'BtnSearchSubmit')) ?>
  87. <?php $bcBaser->link($bcBaser->getImg('admin/btn_clear.png', array('alt' => 'クリア', 'class' => 'btn')), "javascript:void(0)", array('id' => 'BtnSearchClear')) ?>
  88. </div>
  89. <?php echo $bcForm->hidden('Page.open',array('value'=>true)) ?>
  90. <?php echo $bcForm->end() ?>