diff --git a/.gitattributes b/.gitattributes
deleted file mode 100644
index f550414..0000000
--- a/.gitattributes
+++ /dev/null
@@ -1,6 +0,0 @@
-# Remove files for archives generated using `git archive`
-Test export-ignore
-.gitattributes export-ignore
-.gitignore export-ignore
-.travis.yml export-ignore
-phpunit.xml.dist export-ignore
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
deleted file mode 100644
index 592d72f..0000000
--- a/.github/workflows/release.yml
+++ /dev/null
@@ -1,59 +0,0 @@
-on:
- push:
- # Sequence of patterns matched against refs/tags
- tags:
- - '3*'
-
-name: create_release
-
-jobs:
- build:
- name: create_release
- runs-on: ubuntu-latest
- steps:
- - name: Checkout code
- uses: actions/checkout@v2
-
- - name: Slack Notification on Start
- uses: rtCamp/action-slack-notify@v2.2.0
- env:
- SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_RELEASE }}
- SLACK_CHANNEL: notify-nc3-release
- SLACK_TITLE: "${{ github.repository }}"
- SLACK_COLOR: "#f0ad4e"
- SLACK_MESSAGE: "Start Job"
-
- - name: Create Release
- id: create_release
- uses: actions/create-release@v1
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
- with:
- tag_name: ${{ github.ref }}
- release_name: ${{ github.ref }}
- body: |
- NetCommons ${{ github.ref }} released.
- draft: false
- prerelease: false
-
- # テスト成功時はこちらのステップが実行される
- - name: Slack Notification on Finish
- uses: rtCamp/action-slack-notify@v2.2.0
- if: success()
- env:
- SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_RELEASE }}
- SLACK_CHANNEL: notify-nc3-release
- SLACK_TITLE: "${{ github.repository }}"
- SLACK_COLOR: good
- SLACK_MESSAGE: "Job Success"
-
- # テスト失敗時はこちらのステップが実行される
- - name: Slack Notification on Failure
- uses: rtCamp/action-slack-notify@v2.2.0
- if: failure()
- env:
- SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_RELEASE }}
- SLACK_CHANNEL: notify-nc3-tests
- SLACK_TITLE: "${{ github.repository }}"
- SLACK_COLOR: danger
- SLACK_MESSAGE: "Job Failure"
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
deleted file mode 100644
index 577445c..0000000
--- a/.github/workflows/tests.yml
+++ /dev/null
@@ -1,170 +0,0 @@
-on:
- push:
- branches:
- - main
- - master
- - availability
- pull_request:
- branches:
- - main
- - master
- - availability
-
-name: tests
-
-jobs:
- setup:
- name: setup
- runs-on: ubuntu-latest
- steps:
- - name: Slack Notification on Start
- uses: rtCamp/action-slack-notify@v2.2.0
- if: env.SLACK_WEBHOOK != ''
- env:
- SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_TESTS }}
- SLACK_CHANNEL: notify-nc3-tests
- SLACK_TITLE: "${{ github.repository }}"
- SLACK_COLOR: "#f0ad4e"
-
- tests:
- name: tests
- needs: setup
- runs-on: ubuntu-latest
- strategy:
- matrix:
- php: [ '7.4' ]
- mysql: [ '8.0' ]
-
- env:
- NC3_BUILD_DIR: "/opt/nc3"
- NC3_DOCKER_DIR: "/opt/docker"
- NC3_GIT_URL: "git://github.com/NetCommons3/NetCommons3.git"
- NC3_GIT_BRANCH: "master"
- PLUGIN_BUILD_DIR: ${{ github.workspace }}
- PHP_VERSION: ${{ matrix.php }}
- MYSQL_VERSION: ${{ matrix.mysql }}
- MYSQL_ROOT_PASSWORD: root
- MYSQL_DATABASE: cakephp_test
- COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-
- steps:
- - uses: actions/checkout@v2
-
- - name: Fix up git URLs
- run: echo -e '[url "https://github.com/"]\n insteadOf = "git://github.com/"' >> ~/.gitconfig
-
- - name: environment
- run: |
- echo "GITHUB_WORKSPACE=${GITHUB_WORKSPACE}"
- echo "PLUGIN_BUILD_DIR=${PLUGIN_BUILD_DIR}"
- echo "PHP_VERSION=${PHP_VERSION}"
- echo "MYSQL_VERSION=${MYSQL_VERSION}"
- ls -al ${PLUGIN_BUILD_DIR}
-
- - name: docker-compose install
- run: |
- curl -L https://github.com/docker/compose/releases/download/1.29.2/docker-compose-`uname -s`-`uname -m` > ~/docker-compose
- chmod +x ~/docker-compose
- sudo mv ~/docker-compose /usr/local/bin/docker-compose
- docker-compose --version
-
- - name: git clone nc3
- run: git clone -b ${NC3_GIT_BRANCH} ${NC3_GIT_URL} ${NC3_BUILD_DIR}
-
- - name: git clone nc3_docker
- run: git clone https://github.com/NetCommons3/nc3app-docker.git ${NC3_DOCKER_DIR}
-
- - name: docker-compose start
- run: |
- cd ${NC3_DOCKER_DIR}
- docker-compose up -d
- docker-compose start
-
- - run: docker ps
-
- - name: check libraries
- run: |
- cd ${NC3_DOCKER_DIR}
- docker-compose exec -T nc3app bash /opt/scripts/start-on-docker.sh
-
- - name: nc3 build
- run: |
- cd ${NC3_DOCKER_DIR}
- docker-compose exec -T nc3app bash /opt/scripts/app-build.sh
-
- - name: phpcs (PHP CodeSniffer)
- if: always()
- run: |
- cd ${NC3_DOCKER_DIR}
- docker-compose exec -T nc3app bash /opt/scripts/phpcs.sh
-
- - name: phpmd (PHP Mess Detector)
- if: always()
- run: |
- cd ${NC3_DOCKER_DIR}
- docker-compose exec -T nc3app bash /opt/scripts/phpmd.sh
-
- - name: phpcpd (PHP Copy/Paste Detector)
- if: always()
- run: |
- cd ${NC3_DOCKER_DIR}
- docker-compose exec -T nc3app bash /opt/scripts/phpcpd.sh
-
- - name: gjslint (JavaScript Style Check)
- if: always()
- run: |
- cd ${NC3_DOCKER_DIR}
- docker-compose exec -T nc3app bash /opt/scripts/gjslint.sh
-
- - name: phpdoc (PHP Documentor)
- if: always()
- run: |
- cd ${NC3_DOCKER_DIR}
- docker-compose exec -T nc3app bash /opt/scripts/phpdoc.sh
-
- - name: phpunit (PHP UnitTest)
- if: always()
- run: |
- cd ${NC3_DOCKER_DIR}
- docker-compose exec -T nc3app bash /opt/scripts/phpunit.sh
- sudo -s chmod a+w -R ${NC3_BUILD_DIR}/build
-
-# - name: push coveralls
-# env:
-# COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-# COVERALLS_FLAG_NAME: ${{ matrix.php }}
-# run: |
-# cd ${NC3_BUILD_DIR}
-# ls -la ${NC3_BUILD_DIR}
-# vendors/bin/php-coveralls --coverage_clover=build/logs/clover.xml -v
-
- - name: docker-compose remove
- if: always()
- run: |
- cd ${NC3_DOCKER_DIR}
- docker-compose rm -f
-
- # テスト失敗時はこちらのステップが実行される
- - name: Slack Notification on Failure
- uses: rtCamp/action-slack-notify@v2.2.0
- if: env.SLACK_WEBHOOK != '' && failure()
- env:
- SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_TESTS }}
- SLACK_CHANNEL: notify-nc3-tests
- SLACK_TITLE: "${{ github.repository }}(php${{ matrix.php }}, mysql${{ matrix.mysql }})"
- SLACK_COLOR: danger
-
- teardown:
- name: teardown
- runs-on: ubuntu-latest
- needs: tests
- steps:
- # テスト成功時はこちらのステップが実行される
- - name: Slack Notification on Success
- uses: rtCamp/action-slack-notify@v2.2.0
- if: env.SLACK_WEBHOOK != '' && success()
- env:
- SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_TESTS }}
- SLACK_CHANNEL: notify-nc3-tests
- SLACK_TITLE: "${{ github.repository }}"
- SLACK_COLOR: good
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..8c29ba5
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,40 @@
+language: php
+
+php:
+ - 5.4
+ - 5.5
+ - 5.6
+ - 7.0
+
+sudo: required
+
+env:
+ matrix:
+ - NETCOMMONS_VERSION=master DB=mysql
+ global:
+ - secure: "szHvmXAIkT3JaTfcPtHlTG7gpLnwR93Wd6l6IhkJZotPXVkNTWKYEGCGJtm/9uM3rnLFoTPS1XRrusm+J0Tt/DmjDVMTb/LU74e0+VlAO4Cu8Zw6nCUfXgdMBIq/4wjedgvfgL2Q8yLXMChRtImhVqvdtDM8shiJVBuUDWq0FftACItpYygB518sOj6i+/n9/awXAlzZZxWxJ/1GLshaQ+PXBZuDkG06rIcYZWSNKI1N78WzXDlqv/7mnVluPe0dsbAPC9qKpQr+0EpMI8ymXeVeUFFqb9i3Kujc72S4bpt+Y0Wv+i+U78/Yf/6qPKaJQXHD4GkZ08XknRBFDKXvq2cx8aIecbBOia0s5g2nCgfZFqqFE+Zguq8EPk0KgQZAVAJiZ4ZkXdSwTI1z36jkPWr2KKleULpp6JRD+9D6uANx6bVmMvgymxT+EuC8LfFgLBfo9crXoQ02KknSIJPPlj7rDdWp8ukcknM8zRr+mTCpa8KUSCejZZRBU9pU1QvBIdKeqAXmbJhU/3OvUeS+3AvZchhOsY18jrdoyCNipzQsSWzz1NNUxeLp0o6I/QYFbylWWXVZGz6s6Rk5UTCXr9q99QhmZCICiZlofJu3ldZ4UpgFeBMQY1OSTLjKS65nT1HpoMsqSqCvmllS7JM/0dmmjnkeCngUZepxWafohnE="
+ - GIT_COMMITTER_NAME=RyujiAMANO
+ - GIT_COMMITTER_EMAIL=ryuji@ryus.co.jp
+ - GIT_AUTHOR_NAME=RyujiAMANO
+ - GIT_AUTHOR_EMAIL=ryuji@ryus.co.jp
+
+before_script:
+ - export NETCOMMONS_BUILD_DIR=`dirname $TRAVIS_BUILD_DIR`/NetCommons3
+ - git clone git://github.com/NetCommons3/NetCommons3 $NETCOMMONS_BUILD_DIR
+ - cd $NETCOMMONS_BUILD_DIR
+ - git checkout $NETCOMMONS_VERSION
+ - travis_wait . tools/build/plugins/cakephp/travis/pre.sh
+ - . tools/build/plugins/cakephp/travis/environment.sh
+
+script:
+ - . tools/build/plugins/cakephp/travis/main.sh
+
+after_script:
+ - . tools/build/plugins/cakephp/travis/post.sh
+
+notifications:
+ email:
+ recipients:
+ - netcommons3@googlegroups.com
+ on_success: never # default: change
+ on_failure: always # default: always
diff --git a/Config/Migration/001_plugin_records.php b/Config/Migration/001_plugin_records.php
index b978ebb..ea2d9d7 100644
--- a/Config/Migration/001_plugin_records.php
+++ b/Config/Migration/001_plugin_records.php
@@ -9,7 +9,6 @@
*/
App::uses('NetCommonsMigration', 'NetCommons.Config/Migration');
-App::uses('Space', 'Rooms.Model');
/**
* Add plugin migration
@@ -46,29 +45,21 @@ class PluginRecords extends NetCommonsMigration {
array(
'language_id' => '2',
'key' => 'registrations',
- 'is_origin' => true,
- 'is_translation' => true,
'namespace' => 'netcommons/registrations',
'default_action' => 'registrations/index',
'default_setting_action' => 'registration_blocks/index',
'name' => '登録フォーム',
'type' => 1,
- 'display_topics' => 1,
- 'display_search' => 1,
),
//英語
array(
'language_id' => '1',
'key' => 'registrations',
- 'is_origin' => false,
- 'is_translation' => true,
'namespace' => 'netcommons/registrations',
'default_action' => 'registrations/index',
'default_setting_action' => 'registration_blocks/index',
'name' => 'Registrations',
'type' => 1,
- 'display_topics' => 1,
- 'display_search' => 1,
),
),
'PluginsRole' => array(
@@ -77,7 +68,14 @@ class PluginRecords extends NetCommonsMigration {
'plugin_key' => 'registrations'
),
),
- //PluginsRoomは、beforeでセットする
+ 'PluginsRoom' => array(
+ //パブリックスペース
+ array('room_id' => '1', 'plugin_key' => 'registrations', ),
+ ////プライベートスペース
+ //array('room_id' => '2', 'plugin_key' => 'registrations', ),
+ //グループスペース
+ array('room_id' => '3', 'plugin_key' => 'registrations', ),
+ ),
);
/**
@@ -87,29 +85,6 @@ class PluginRecords extends NetCommonsMigration {
* @return bool Should process continue
*/
public function before($direction) {
- $pluginName = $this->records['Plugin'][0]['key'];
- $this->records['PluginsRoom'] = array(
- //サイト全体
- array(
- 'room_id' => Space::getRoomIdRoot(Space::WHOLE_SITE_ID, 'Room'),
- 'plugin_key' => $pluginName
- ),
- //パブリックスペース
- array(
- 'room_id' => Space::getRoomIdRoot(Space::PUBLIC_SPACE_ID, 'Room'),
- 'plugin_key' => $pluginName
- ),
- ////プライベートスペース
- //array(
- // 'room_id' => Space::getRoomIdRoot(Space::PRIVATE_SPACE_ID, 'Room'),
- // 'plugin_key' => $pluginName
- //),
- //グループスペース
- array(
- 'room_id' => Space::getRoomIdRoot(Space::COMMUNITY_SPACE_ID, 'Room'),
- 'plugin_key' => $pluginName
- ),
- );
return true;
}
diff --git a/Config/Migration/002_mail_setting_records.php b/Config/Migration/002_mail_setting_records.php
deleted file mode 100644
index 87409e0..0000000
--- a/Config/Migration/002_mail_setting_records.php
+++ /dev/null
@@ -1,145 +0,0 @@
-
- * @link http://www.netcommons.org NetCommons Project
- * @license http://www.netcommons.org/license.txt NetCommons License
- * @copyright Copyright 2014, NetCommons Project
- */
-
-App::uses('MailsMigration', 'Mails.Config/Migration');
-
-/**
- * メール設定データのMigration
- *
- * @package NetCommons\Registrations\Config\Migration
- */
-class RegistrationMailSettingRecords extends MailsMigration {
-
-/**
- * プラグインキー
- *
- * @var string
- */
- const PLUGIN_KEY = 'registrations';
-
-/**
- * Migration description
- *
- * @var string
- */
- public $description = 'mail_setting_records';
-
-/**
- * Actions to be performed
- *
- * @var array $migration
- */
- public $migration = array(
- 'up' => array(),
- 'down' => array(),
- );
-
-/**
- * mail setting data
- *
- * @var array $migration
- */
- public $records = array(
- 'MailSetting' => array(
- //コンテンツ通知 - 設定
- array(
- 'plugin_key' => self::PLUGIN_KEY,
- 'block_key' => null,
- 'is_mail_send' => false,
- 'is_mail_send_approval' => true,
- ),
- ),
- 'MailSettingFixedPhrase' => array(
- //コンテンツ通知 - 定型文
- // * 英語
- array(
- 'language_id' => '1',
- 'plugin_key' => self::PLUGIN_KEY,
- 'block_key' => null,
- 'type_key' => 'contents',
- 'mail_fixed_phrase_subject' => '', //デフォルト(__d('mails', 'MailSetting.mail_fixed_phrase_subject'))
- 'mail_fixed_phrase_body' => '', //デフォルト(__d('mails', 'MailSetting.mail_fixed_phrase_body'))
- ),
- // * 日本語
- array(
- 'language_id' => '2',
- 'plugin_key' => self::PLUGIN_KEY,
- 'block_key' => null,
- 'type_key' => 'contents',
- 'mail_fixed_phrase_subject' => '[{X-SITE_NAME}-{X-PLUGIN_NAME}]{X-SUBJECT}({X-ROOM})',
- 'mail_fixed_phrase_body' => '{X-SUBJECT}が開始されます。
-ルーム名:{X-ROOM}
-登録フォーム名:{X-SUBJECT}
-
-登録のご協力をお願いいたします。
-下記のリンクをクリックしてください。
-{X-URL}',
- ),
- //登録通知 - 定型文
- // * 英語
- array(
- 'language_id' => '1',
- 'plugin_key' => self::PLUGIN_KEY,
- 'block_key' => null,
- 'type_key' => 'answer',
- 'mail_fixed_phrase_subject' => '[{X-SITE_NAME}-{X-PLUGIN_NAME}]{X-SUBJECT} answer',
- 'mail_fixed_phrase_body' => 'Thank you for your registration.
-
-Registration form:{X-SUBJECT}
-
-Registered date:{X-TO_DATE}
-
-
-{X-DATA}
-
-Please print this mail and bring it with you.'
- ),
- // * 日本語
- array(
- 'language_id' => '2',
- 'plugin_key' => self::PLUGIN_KEY,
- 'block_key' => null,
- 'type_key' => 'answer',
- 'mail_fixed_phrase_subject' => '[{X-SITE_NAME}-{X-PLUGIN_NAME}]{X-SUBJECT}を受け付けました。',
- 'mail_fixed_phrase_body' => '{X-SUBJECT}の登録通知先メールアドレスとしてあなたのメールアドレスが使用されました。
-もし{X-SUBJECT}への登録に覚えがない場合はこのメールを破棄してください。
-
-
-{X-SUBJECT}を受け付けました。
-
-登録日時:{X-TO_DATE}
-
-
-{X-DATA}
-
-メール内容を印刷の上、会場にご持参ください。',
- ),
- ));
-
-/**
- * Before migration callback
- *
- * @param string $direction Direction of migration process (up or down)
- * @return bool Should process continue
- */
- public function before($direction) {
- return true;
- }
-
-/**
- * After migration callback
- *
- * @param string $direction Direction of migration process (up or down)
- * @return bool Should process continue
- */
- public function after($direction) {
- return parent::updateAndDelete($direction, self::PLUGIN_KEY);
- }
-}
diff --git a/Config/Migration/1450753185_init.php b/Config/Migration/1450753185_init.php
index 196b01f..b89f5d7 100644
--- a/Config/Migration/1450753185_init.php
+++ b/Config/Migration/1450753185_init.php
@@ -151,14 +151,14 @@ class Init extends CakeMigration {
'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary'),
'key' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
'language_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false),
- 'question_sequence' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'comment' => '項目表示順'),
+ 'question_sequence' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'comment' => '質問表示順'),
'question_value' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
- 'question_type' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 4, 'unsigned' => false, 'comment' => '項目タイプ | 1:択一選択 | 2:複数選択 | 3:テキスト | 4:テキストエリア | 5:マトリクス(択一) | 6:マトリクス(複数) | 7:日付・時刻 | 8:リスト
+ 'question_type' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 4, 'unsigned' => false, 'comment' => '質問タイプ | 1:択一選択 | 2:複数選択 | 3:テキスト | 4:テキストエリア | 5:マトリクス(択一) | 6:マトリクス(複数) | 7:日付・時刻 | 8:リスト
'),
'description' => array('type' => 'text', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
'is_require' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'comment' => '登録必須フラグ | 0:不要 | 1:必須'),
'question_type_option' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 4, 'unsigned' => false, 'comment' => '1: 数値 | 2:日付(未実装) | 3:時刻(未実装) | 4:メール(未実装) | 5:URL(未実装) | 6:電話番号(未実装) | HTML5チェックで将来的に実装されそうなものに順次対応'),
- 'is_choice_random' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'comment' => '選択肢表示順序ランダム化 | 項目タイプが1:択一選択 2:複数選択 6:マトリクス(択一) 7:マトリクス(複数) のとき有効 ただし、6,7については行がランダムになるだけで列はランダム化されない'),
+ 'is_choice_random' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'comment' => '選択肢表示順序ランダム化 | 質問タイプが1:択一選択 2:複数選択 6:マトリクス(択一) 7:マトリクス(複数) のとき有効 ただし、6,7については行がランダムになるだけで列はランダム化されない'),
'is_skip' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'comment' => '登録フォーム登録のスキップ有無 0:スキップ 無し 1:スキップ有り'),
'is_jump' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'comment' => '登録フォーム登録の分岐'),
'is_range' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'comment' => '範囲設定しているか否か'),
@@ -178,6 +178,20 @@ class Init extends CakeMigration {
),
'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB'),
),
+ 'registration_settings' => array(
+ 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary'),
+ 'block_key' => array('type' => 'string', 'null' => false, 'default' => null, 'key' => 'index', 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
+ 'use_workflow' => array('type' => 'boolean', 'null' => false, 'default' => '1'),
+ 'created_user' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false),
+ 'created' => array('type' => 'datetime', 'null' => true, 'default' => null),
+ 'modified_user' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false),
+ 'modified' => array('type' => 'datetime', 'null' => true, 'default' => null),
+ 'indexes' => array(
+ 'PRIMARY' => array('column' => 'id', 'unique' => 1),
+ 'fk_registration_blocks_settings_blocks1_idx' => array('column' => 'block_key', 'unique' => 0),
+ ),
+ 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB'),
+ ),
'registrations' => array(
'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary'),
'key' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
@@ -185,7 +199,7 @@ class Init extends CakeMigration {
'is_active' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'comment' => '公開中データか否か'),
'is_latest' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'comment' => '最新編集データであるか否か'),
'block_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'index'),
- 'status' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 4, 'unsigned' => false, 'comment' => '公開状況 1:公開中、2:公開申請中、3:下書き中、4:差し戻し'),
+ 'status' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 4, 'unsigned' => false, 'comment' => 'public status, 1: public, 2: public pending, 3: draft during 4: remand | 公開状況 1:公開中、2:公開申請中、3:下書き中、4:差し戻し |'),
'title' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => '登録フォームタイトル', 'charset' => 'utf8'),
'sub_title' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => '登録フォームサブタイトル', 'charset' => 'utf8'),
'public_type' => array('type' => 'integer', 'null' => false, 'default' => '1', 'length' => 4, 'unsigned' => false),
@@ -225,7 +239,7 @@ class Init extends CakeMigration {
),
'down' => array(
'drop_table' => array(
- 'registration_answer_summaries', 'registration_answers', 'registration_choices', 'registration_frame_display_registrations', 'registration_frame_settings', 'registration_pages', 'registration_questions', 'registrations'
+ 'registration_answer_summaries', 'registration_answers', 'registration_choices', 'registration_frame_display_registrations', 'registration_frame_settings', 'registration_pages', 'registration_questions', 'registration_settings', 'registrations'
),
),
);
diff --git a/Config/Migration/1454726319_change_public_type.php b/Config/Migration/1454726319_change_public_type.php
deleted file mode 100644
index 563b205..0000000
--- a/Config/Migration/1454726319_change_public_type.php
+++ /dev/null
@@ -1,83 +0,0 @@
-
- * @author Allcreator
- * @link http://www.netcommons.org NetCommons Project
- * @license http://www.netcommons.org/license.txt NetCommons License
- * @copyright Copyright 2014, NetCommons Project
- */
-
-/**
- * Registrations Migration
- *
- * @author Allcreator
- * @package NetCommons\Registrations\Config\Migration
- */
-class ChangePublicType extends CakeMigration {
-
-/**
- * Migration description
- *
- * @var string
- */
- public $description = 'change_public_type';
-
-/**
- * Actions to be performed
- *
- * @var array $migration
- */
- public $migration = array(
- 'up' => array(
- 'create_table' => array(
- ),
- 'create_field' => array(
- 'registrations' => array(
- 'answer_timing' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => 4, 'unsigned' => false, 'after' => 'sub_title'),
- 'answer_start_period' => array('type' => 'datetime', 'null' => true, 'default' => null, 'after' => 'answer_timing'),
- 'answer_end_period' => array('type' => 'datetime', 'null' => true, 'default' => null, 'after' => 'answer_start_period'),
- ),
- ),
- 'drop_field' => array(
- 'registrations' => array('public_type', 'publish_start', 'publish_end', 'key_phrase'),
- ),
- ),
- 'down' => array(
- 'drop_table' => array(
- ),
- 'drop_field' => array(
- 'registrations' => array('answer_timing', 'answer_start_period', 'answer_end_period'),
- ),
- 'create_field' => array(
- 'registrations' => array(
- 'public_type' => array('type' => 'integer', 'null' => false, 'default' => '1', 'length' => 4, 'unsigned' => false),
- 'publish_start' => array('type' => 'datetime', 'null' => true, 'default' => null),
- 'publish_end' => array('type' => 'datetime', 'null' => true, 'default' => null),
- 'key_phrase' => array('type' => 'string', 'null' => true, 'default' => 'NetCommons', 'length' => 128, 'collate' => 'utf8_general_ci', 'comment' => 'キーフレーズ', 'charset' => 'utf8'),
- ),
- ),
- ),
- );
-
-/**
- * Before migration callback
- *
- * @param string $direction Direction of migration process (up or down)
- * @return bool Should process continue
- */
- public function before($direction) {
- return true;
- }
-
-/**
- * After migration callback
- *
- * @param string $direction Direction of migration process (up or down)
- * @return bool Should process continue
- */
- public function after($direction) {
- return true;
- }
-}
diff --git a/Config/Migration/1455254505_fix.php b/Config/Migration/1455254505_fix.php
new file mode 100644
index 0000000..cb12f4a
--- /dev/null
+++ b/Config/Migration/1455254505_fix.php
@@ -0,0 +1,125 @@
+ array(
+ 'alter_field' => array(
+ 'registration_answer_summaries' => array(
+ 'answer_status' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 4, 'unsigned' => false, 'comment' => '回答状態 1ページずつ表示するような登録フォームの場合、途中状態か否か | 0:回答未完了 | 1:回答完了'),
+ 'test_status' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 4, 'unsigned' => false, 'comment' => 'テスト時の回答かどうか 0:本番回答 | 1:テスト時回答'),
+ 'answer_number' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false, 'comment' => '回答回数 ログインして回答している人物の場合に限定して回答回数をカウントする'),
+ 'answer_time' => array('type' => 'datetime', 'null' => true, 'default' => null, 'comment' => '回答完了の時刻 ページわけされている場合、insert_timeは回答開始時刻となるため、完了時刻を設ける'),
+ 'session_value' => array('type' => 'text', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => '登録フォーム回答した時のセッション値を保存します。', 'charset' => 'utf8'),
+ 'user_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false, 'comment' => 'ログイン後、登録フォームに回答した人のusersテーブルのid。未ログインの場合NULL'),
+ ),
+ 'registration_answers' => array(
+ 'answer_value' => array('type' => 'text', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => '回答した文字列を設定する
+選択肢、リストなどの選ぶだけの場合は、選択肢のid値:ラベルを入れる
+
+選択肢タイプで「その他」を選んだ場合は、入力されたテキストは、ここではなく、other_answer_valueに入れる。
+
+複数選択肢
+これらの場合は、(id値):(ラベル)を|つなぎで並べる。
+', 'charset' => 'utf8'),
+ ),
+ 'registration_frame_settings' => array(
+ 'sort_type' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 4, 'unsigned' => false, 'comment' => '表示並び順 0:新着順 1:回答期間順(降順) 2:登録フォームステータス順(昇順) 3:タイトル順(昇順)'),
+ ),
+ 'registration_questions' => array(
+ 'is_require' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'comment' => '回答必須フラグ | 0:不要 | 1:必須'),
+ 'is_skip' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'comment' => '登録フォーム回答のスキップ有無 0:スキップ 無し 1:スキップ有り'),
+ 'is_jump' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'comment' => '登録フォーム回答の分岐'),
+ ),
+ 'registrations' => array(
+ 'is_no_member_allow' => array('type' => 'boolean', 'null' => true, 'default' => '0', 'comment' => '非会員の回答を許可するか | 0:許可しない | 1:許可する'),
+ 'is_anonymity' => array('type' => 'boolean', 'null' => true, 'default' => '0', 'comment' => '会員回答であっても匿名扱いとするか否か | 0:非匿名 | 1:匿名'),
+ 'is_key_pass_use' => array('type' => 'boolean', 'null' => true, 'default' => '0', 'comment' => 'キーフレーズによる回答ガードを設けるか | 0:キーフレーズガードは用いない | 1:キーフレーズガードを用いる'),
+ 'is_repeat_allow' => array('type' => 'boolean', 'null' => true, 'default' => '1'),
+ 'total_show_timing' => array('type' => 'integer', 'null' => true, 'default' => '0', 'length' => 4, 'unsigned' => false, 'comment' => '集計結果を表示するタイミング | 0:登録フォーム回答後、すぐ | 1:期間設定'),
+ 'is_answer_mail_send' => array('type' => 'boolean', 'null' => true, 'default' => '0', 'comment' => '登録フォーム回答時に編集者、編集長にメールで知らせるか否か | 0:知らせない| 1:知らせる
+'),
+ ),
+ ),
+ 'create_field' => array(
+ 'registrations' => array(
+ 'is_limit_number' => array('type' => 'boolean', 'null' => true, 'default' => '0', 'after' => 'modified'),
+ 'limit_number' => array('type' => 'integer', 'null' => true, 'default' => '0', 'unsigned' => false, 'after' => 'is_limit_number'),
+ ),
+ ),
+ ),
+ 'down' => array(
+ 'alter_field' => array(
+ 'registration_answer_summaries' => array(
+ 'answer_status' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 4, 'unsigned' => false, 'comment' => '登録状態 1ページずつ表示するような登録フォームの場合、途中状態か否か | 0:登録未完了 | 1:登録完了'),
+ 'test_status' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 4, 'unsigned' => false, 'comment' => 'テスト時の登録かどうか 0:本番登録 | 1:テスト時登録'),
+ 'answer_number' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false, 'comment' => '登録回数 ログインして登録している人物の場合に限定して登録回数をカウントする'),
+ 'answer_time' => array('type' => 'datetime', 'null' => true, 'default' => null, 'comment' => '登録完了の時刻 ページわけされている場合、insert_timeは登録開始時刻となるため、完了時刻を設ける'),
+ 'session_value' => array('type' => 'text', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => '登録フォーム登録した時のセッション値を保存します。', 'charset' => 'utf8'),
+ 'user_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false, 'comment' => 'ログイン後、登録フォームに登録した人のusersテーブルのid。未ログインの場合NULL'),
+ ),
+ 'registration_answers' => array(
+ 'answer_value' => array('type' => 'text', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => '登録した文字列を設定する
+選択肢、リストなどの選ぶだけの場合は、選択肢のid値:ラベルを入れる
+
+選択肢タイプで「その他」を選んだ場合は、入力されたテキストは、ここではなく、other_answer_valueに入れる。
+
+複数選択肢
+これらの場合は、(id値):(ラベル)を|つなぎで並べる。
+', 'charset' => 'utf8'),
+ ),
+ 'registration_frame_settings' => array(
+ 'sort_type' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 4, 'unsigned' => false, 'comment' => '表示並び順 0:新着順 1:登録期間順(降順) 2:登録フォームステータス順(昇順) 3:タイトル順(昇順)'),
+ ),
+ 'registration_questions' => array(
+ 'is_require' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'comment' => '登録必須フラグ | 0:不要 | 1:必須'),
+ 'is_skip' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'comment' => '登録フォーム登録のスキップ有無 0:スキップ 無し 1:スキップ有り'),
+ 'is_jump' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'comment' => '登録フォーム登録の分岐'),
+ ),
+ 'registrations' => array(
+ 'is_no_member_allow' => array('type' => 'boolean', 'null' => true, 'default' => '0', 'comment' => '非会員の登録を許可するか | 0:許可しない | 1:許可する'),
+ 'is_anonymity' => array('type' => 'boolean', 'null' => true, 'default' => '0', 'comment' => '会員登録であっても匿名扱いとするか否か | 0:非匿名 | 1:匿名'),
+ 'is_key_pass_use' => array('type' => 'boolean', 'null' => true, 'default' => '0', 'comment' => 'キーフレーズによる登録ガードを設けるか | 0:キーフレーズガードは用いない | 1:キーフレーズガードを用いる'),
+ 'is_repeat_allow' => array('type' => 'boolean', 'null' => true, 'default' => '0'),
+ 'total_show_timing' => array('type' => 'integer', 'null' => true, 'default' => '0', 'length' => 4, 'unsigned' => false, 'comment' => '集計結果を表示するタイミング | 0:登録フォーム登録後、すぐ | 1:期間設定'),
+ 'is_answer_mail_send' => array('type' => 'boolean', 'null' => true, 'default' => '0', 'comment' => '登録フォーム登録時に編集者、編集長にメールで知らせるか否か | 0:知らせない| 1:知らせる
+'),
+ ),
+ ),
+ 'drop_field' => array(
+ 'registrations' => array('is_limit_number', 'limit_number'),
+ ),
+ ),
+ );
+
+/**
+ * Before migration callback
+ *
+ * @param string $direction Direction of migration process (up or down)
+ * @return bool Should process continue
+ */
+ public function before($direction) {
+ return true;
+ }
+
+/**
+ * After migration callback
+ *
+ * @param string $direction Direction of migration process (up or down)
+ * @return bool Should process continue
+ */
+ public function after($direction) {
+ return true;
+ }
+}
diff --git a/Config/Migration/1457770131_add_title_icon.php b/Config/Migration/1457770131_add_title_icon.php
deleted file mode 100644
index 0b90e75..0000000
--- a/Config/Migration/1457770131_add_title_icon.php
+++ /dev/null
@@ -1,70 +0,0 @@
-
- * @author Allcreator
- * @link http://www.netcommons.org NetCommons Project
- * @license http://www.netcommons.org/license.txt NetCommons License
- * @copyright Copyright 2014, NetCommons Project
- */
-
-/**
- * Registrations Migration
- *
- * @author Allcreator
- * @package NetCommons\Registrations\Config\Migration
- */
-class AddTitleIcon extends CakeMigration {
-
-/**
- * Migration description
- *
- * @var string
- */
- public $description = 'add_title_icon';
-
-/**
- * Actions to be performed
- *
- * @var array $migration
- */
- public $migration = array(
- 'up' => array(
- 'create_table' => array(
- ),
- 'create_field' => array(
- 'registrations' => array(
- 'title_icon' => array('type' => 'string', 'null' => true, 'collate' => 'utf8_general_ci', 'charset' => 'utf8', 'after' => 'title'),
- ),
- ),
- ),
- 'down' => array(
- 'drop_table' => array(
- ),
- 'drop_field' => array(
- 'registrations' => array('title_icon'),
- ),
- ),
- );
-
-/**
- * Before migration callback
- *
- * @param string $direction Direction of migration process (up or down)
- * @return bool Should process continue
- */
- public function before($direction) {
- return true;
- }
-
-/**
- * After migration callback
- *
- * @param string $direction Direction of migration process (up or down)
- * @return bool Should process continue
- */
- public function after($direction) {
- return true;
- }
-}
diff --git a/Config/Migration/1457841779_change_sort_type.php b/Config/Migration/1457841779_change_sort_type.php
deleted file mode 100644
index 287b7d9..0000000
--- a/Config/Migration/1457841779_change_sort_type.php
+++ /dev/null
@@ -1,72 +0,0 @@
-
- * @author Allcreator
- * @link http://www.netcommons.org NetCommons Project
- * @license http://www.netcommons.org/license.txt NetCommons License
- * @copyright Copyright 2014, NetCommons Project
- */
-
-/**
- * Registrations Migration
- *
- * @author Allcreator
- * @package NetCommons\Registrations\Config\Migration
- */
-class ChangeSortType extends CakeMigration {
-
-/**
- * Migration description
- *
- * @var string
- */
- public $description = 'change_sort_type';
-
-/**
- * Actions to be performed
- *
- * @var array $migration
- */
- public $migration = array(
- 'up' => array(
- 'create_table' => array(
- ),
- 'alter_field' => array(
- 'registration_frame_settings' => array(
- 'sort_type' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
- ),
- ),
- ),
- 'down' => array(
- 'drop_table' => array(
- ),
- 'alter_field' => array(
- 'registration_frame_settings' => array(
- 'sort_type' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 4, 'unsigned' => false, 'comment' => '表示並び順 0:新着順 1:登録期間順(降順) 2:登録フォームステータス順(昇順) 3:タイトル順(昇順)'),
- ),
- ),
- ),
- );
-
-/**
- * Before migration callback
- *
- * @param string $direction Direction of migration process (up or down)
- * @return bool Should process continue
- */
- public function before($direction) {
- return true;
- }
-
-/**
- * After migration callback
- *
- * @param string $direction Direction of migration process (up or down)
- * @return bool Should process continue
- */
- public function after($direction) {
- return true;
- }
-}
diff --git a/Config/Migration/1459399981_change_default.php b/Config/Migration/1459399981_change_default.php
new file mode 100644
index 0000000..c69b5d4
--- /dev/null
+++ b/Config/Migration/1459399981_change_default.php
@@ -0,0 +1,52 @@
+ array(
+ 'alter_field' => array(
+ 'registrations' => array(
+ 'is_no_member_allow' => array('type' => 'boolean', 'null' => true, 'default' => '1', 'comment' => '非会員の回答を許可するか | 0:許可しない | 1:許可する'),
+ ),
+ ),
+ ),
+ 'down' => array(
+ 'alter_field' => array(
+ 'registrations' => array(
+ 'is_no_member_allow' => array('type' => 'boolean', 'null' => true, 'default' => '0', 'comment' => '非会員の回答を許可するか | 0:許可しない | 1:許可する'),
+ ),
+ ),
+ ),
+ );
+
+/**
+ * Before migration callback
+ *
+ * @param string $direction Direction of migration process (up or down)
+ * @return bool Should process continue
+ */
+ public function before($direction) {
+ return true;
+ }
+
+/**
+ * After migration callback
+ *
+ * @param string $direction Direction of migration process (up or down)
+ * @return bool Should process continue
+ */
+ public function after($direction) {
+ return true;
+ }
+}
diff --git a/Config/Migration/1460445665_add_chice_horizon.php b/Config/Migration/1460445665_add_chice_horizon.php
deleted file mode 100644
index 8eedf72..0000000
--- a/Config/Migration/1460445665_add_chice_horizon.php
+++ /dev/null
@@ -1,80 +0,0 @@
-
- * @author Allcreator
- * @link http://www.netcommons.org NetCommons Project
- * @license http://www.netcommons.org/license.txt NetCommons License
- * @copyright Copyright 2014, NetCommons Project
- */
-
-/**
- * Registrations Migration
- *
- * @author Allcreator
- * @package NetCommons\Registrations\Config\Migration
- */
-class AddChoiceHorizon extends CakeMigration {
-
-/**
- * Migration description
- *
- * @var string
- */
- public $description = 'add_choice_horizon';
-
-/**
- * Actions to be performed
- *
- * @var array $migration
- */
- public $migration = array(
- 'up' => array(
- 'create_table' => array(
- ),
- 'create_field' => array(
- 'registration_questions' => array(
- 'is_choice_horizon' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'after' => 'is_choice_random'),
- ),
- ),
- 'alter_field' => array(
- 'registrations' => array(
- 'title_icon' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
- ),
- ),
- ),
- 'down' => array(
- 'drop_table' => array(
- ),
- 'drop_field' => array(
- 'registration_questions' => array('is_choice_horizon'),
- ),
- 'alter_field' => array(
- 'registrations' => array(
- 'title_icon' => array('type' => 'string', 'null' => true, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
- ),
- ),
- ),
- );
-
-/**
- * Before migration callback
- *
- * @param string $direction Direction of migration process (up or down)
- * @return bool Should process continue
- */
- public function before($direction) {
- return true;
- }
-
-/**
- * After migration callback
- *
- * @param string $direction Direction of migration process (up or down)
- * @return bool Should process continue
- */
- public function after($direction) {
- return true;
- }
-}
diff --git a/Config/Migration/1466752360_alter_table.php b/Config/Migration/1466752360_alter_table.php
deleted file mode 100644
index 5eb181c..0000000
--- a/Config/Migration/1466752360_alter_table.php
+++ /dev/null
@@ -1,86 +0,0 @@
-
- * @link http://www.netcommons.org NetCommons Project
- * @license http://www.netcommons.org/license.txt NetCommons License
- */
-
-/**
- * Class AlterTable
- */
-class AlterTable extends CakeMigration {
-
-/**
- * Migration description
- *
- * @var string
- */
- public $description = 'alter_table';
-
-/**
- * Actions to be performed
- *
- * @var array $migration
- */
- public $migration = array(
- 'up' => array(
- 'alter_field' => array(
- 'registration_questions' => array(
- 'question_sequence' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'comment' => '項目表示順'),
- 'question_type' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 4, 'unsigned' => false, 'comment' => '項目タイプ | 1:択一選択 | 2:複数選択 | 3:テキスト | 4:テキストエリア | 5:マトリクス(択一) | 6:マトリクス(複数) | 7:日付・時刻 | 8:リスト
-'),
- 'is_choice_random' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'comment' => '選択肢表示順序ランダム化 | 項目タイプが1:択一選択 2:複数選択 6:マトリクス(択一) 7:マトリクス(複数) のとき有効 ただし、6,7については行がランダムになるだけで列はランダム化されない'),
- ),
- 'registrations' => array(
- 'is_no_member_allow' => array('type' => 'boolean', 'null' => true, 'default' => '1', 'comment' => '非会員の登録を許可するか | 0:許可しない | 1:許可する'),
- 'is_repeat_allow' => array('type' => 'boolean', 'null' => true, 'default' => '1'),
- ),
- ),
- 'create_field' => array(
- 'registrations' => array(
- 'is_limit_number' => array('type' => 'boolean', 'null' => true, 'default' => '0', 'after' => 'is_page_random'),
- 'limit_number' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false, 'after' => 'is_limit_number'),
- ),
- ),
- ),
- 'down' => array(
- 'alter_field' => array(
- 'registration_questions' => array(
- 'question_sequence' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'comment' => '項目表示順'),
- 'question_type' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 4, 'unsigned' => false, 'comment' => '項目タイプ | 1:択一選択 | 2:複数選択 | 3:テキスト | 4:テキストエリア | 5:マトリクス(択一) | 6:マトリクス(複数) | 7:日付・時刻 | 8:リスト
-'),
- 'is_choice_random' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'comment' => '選択肢表示順序ランダム化 | 項目タイプが1:択一選択 2:複数選択 6:マトリクス(択一) 7:マトリクス(複数) のとき有効 ただし、6,7については行がランダムになるだけで列はランダム化されない'),
- ),
- 'registrations' => array(
- 'is_no_member_allow' => array('type' => 'boolean', 'null' => true, 'default' => '0', 'comment' => '非会員の登録を許可するか | 0:許可しない | 1:許可する'),
- 'is_repeat_allow' => array('type' => 'boolean', 'null' => true, 'default' => '0'),
- ),
- ),
- 'drop_field' => array(
- 'registrations' => array('is_limit_number', 'limit_number'),
- ),
- ),
- );
-
-/**
- * Before migration callback
- *
- * @param string $direction Direction of migration process (up or down)
- * @return bool Should process continue
- */
- public function before($direction) {
- return true;
- }
-
-/**
- * After migration callback
- *
- * @param string $direction Direction of migration process (up or down)
- * @return bool Should process continue
- */
- public function after($direction) {
- return true;
- }
-}
diff --git a/Config/Migration/1467867697_add_registration_mail.php b/Config/Migration/1467867697_add_registration_mail.php
deleted file mode 100644
index 704f1db..0000000
--- a/Config/Migration/1467867697_add_registration_mail.php
+++ /dev/null
@@ -1,80 +0,0 @@
-
- * @link http://www.netcommons.org NetCommons Project
- * @license http://www.netcommons.org/license.txt NetCommons License
- */
-
-/**
- * Class AddRegistrationMail
- */
-class AddRegistrationMail extends CakeMigration {
-
-/**
- * Migration description
- *
- * @var string
- */
- public $description = 'add_registration_mail';
-
-/**
- * Actions to be performed
- *
- * @var array $migration
- */
- public $migration = array(
- 'up' => array(
- 'alter_field' => array(
- 'registration_questions' => array(
- 'question_sequence' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'comment' => '質問表示順'),
- 'question_type' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 4, 'unsigned' => false, 'comment' => '質問タイプ | 1:択一選択 | 2:複数選択 | 3:テキスト | 4:テキストエリア | 5:マトリクス(択一) | 6:マトリクス(複数) | 7:日付・時刻 | 8:リスト
-'),
- 'is_choice_random' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'comment' => '選択肢表示順序ランダム化 | 質問タイプが1:択一選択 2:複数選択 6:マトリクス(択一) 7:マトリクス(複数) のとき有効 ただし、6,7については行がランダムになるだけで列はランダム化されない'),
- ),
- ),
- 'create_field' => array(
- 'registrations' => array(
- 'reply_to' => array('type' => 'string', 'null' => true, 'collate' => 'utf8_general_ci', 'charset' => 'utf8', 'after' => 'is_answer_mail_send'),
- 'is_regist_user_send' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'after' => 'reply_to'),
- 'registration_mail_subject' => array('type' => 'string', 'null' => false, 'collate' => 'utf8_general_ci', 'charset' => 'utf8', 'after' => 'is_regist_user_send'),
- 'registration_mail_body' => array('type' => 'text', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8', 'after' => 'registration_mail_subject'),
- ),
- ),
- ),
- 'down' => array(
- 'alter_field' => array(
- 'registration_questions' => array(
- 'question_sequence' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'comment' => '項目表示順'),
- 'question_type' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 4, 'unsigned' => false, 'comment' => '項目タイプ | 1:択一選択 | 2:複数選択 | 3:テキスト | 4:テキストエリア | 5:マトリクス(択一) | 6:マトリクス(複数) | 7:日付・時刻 | 8:リスト
-'),
- 'is_choice_random' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'comment' => '選択肢表示順序ランダム化 | 項目タイプが1:択一選択 2:複数選択 6:マトリクス(択一) 7:マトリクス(複数) のとき有効 ただし、6,7については行がランダムになるだけで列はランダム化されない'),
- ),
- ),
- 'drop_field' => array(
- 'registrations' => array('reply_to', 'is_regist_user_send', 'registration_mail_subject', 'registration_mail_body'),
- ),
- ),
- );
-
-/**
- * Before migration callback
- *
- * @param string $direction Direction of migration process (up or down)
- * @return bool Should process continue
- */
- public function before($direction) {
- return true;
- }
-
-/**
- * After migration callback
- *
- * @param string $direction Direction of migration process (up or down)
- * @return bool Should process continue
- */
- public function after($direction) {
- return true;
- }
-}
diff --git a/Config/Migration/1481702298_drop_table_registration_frames.php b/Config/Migration/1481702298_drop_table_registration_frames.php
deleted file mode 100644
index 6b3ff23..0000000
--- a/Config/Migration/1481702298_drop_table_registration_frames.php
+++ /dev/null
@@ -1,94 +0,0 @@
-
- * @link http://www.netcommons.org NetCommons Project
- * @license http://www.netcommons.org/license.txt NetCommons License
- * @copyright Copyright 2014, NetCommons Project
- */
-
-App::uses('NetCommonsMigration', 'NetCommons.Config/Migration');
-
-/**
- * registration_frame_display_registrations、registration_frame_settingsの削除
- *
- * @author Shohei Nakajima
- * @package NetCommons\Registrations\Config\Migration
- */
-class DropTableRegistrationFrames extends CakeMigration {
-
-/**
- * Migration description
- *
- * @var string
- */
- public $description = 'drop_table_registration_frames';
-
-/**
- * Actions to be performed
- *
- * @var array $migration
- */
- public $migration = array(
- 'up' => array(
- 'drop_table' => array(
- 'registration_frame_display_registrations', 'registration_frame_settings'
- ),
- ),
- 'down' => array(
- 'create_table' => array(
- 'registration_frame_display_registrations' => array(
- 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary'),
- 'frame_key' => array('type' => 'string', 'null' => false, 'default' => null, 'key' => 'index', 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
- 'registration_key' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
- 'created_user' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false),
- 'created' => array('type' => 'datetime', 'null' => true, 'default' => null),
- 'modified_user' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false),
- 'modified' => array('type' => 'datetime', 'null' => true, 'default' => null),
- 'indexes' => array(
- 'PRIMARY' => array('column' => 'id', 'unique' => 1),
- 'fk_registration_frame_display_registrations_registration_idx' => array('column' => 'frame_key', 'unique' => 0),
- ),
- 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB'),
- ),
- 'registration_frame_settings' => array(
- 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary'),
- 'display_type' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 4, 'unsigned' => false, 'comment' => '0:単一表示(default)|1:リスト表示'),
- 'display_num_per_page' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 3, 'unsigned' => false, 'comment' => 'リスト表示の場合、1ページ当たりに表示する登録フォーム件数'),
- 'sort_type' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
- 'frame_key' => array('type' => 'string', 'null' => false, 'default' => null, 'key' => 'index', 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
- 'created_user' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false),
- 'created' => array('type' => 'datetime', 'null' => true, 'default' => null),
- 'modified_user' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false),
- 'modified' => array('type' => 'datetime', 'null' => true, 'default' => null),
- 'indexes' => array(
- 'PRIMARY' => array('column' => 'id', 'unique' => 1),
- 'fk_registration_frame_settings_frames1_idx' => array('column' => 'frame_key', 'unique' => 0),
- ),
- 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB'),
- ),
- ),
- ),
- );
-
-/**
- * Before migration callback
- *
- * @param string $direction Direction of migration process (up or down)
- * @return bool Should process continue
- */
- public function before($direction) {
- return true;
- }
-
-/**
- * After migration callback
- *
- * @param string $direction Direction of migration process (up or down)
- * @return bool Should process continue
- */
- public function after($direction) {
- return true;
- }
-}
diff --git a/Config/Migration/1481704096_add_fields_for_m17n.php b/Config/Migration/1481704096_add_fields_for_m17n.php
deleted file mode 100644
index b623092..0000000
--- a/Config/Migration/1481704096_add_fields_for_m17n.php
+++ /dev/null
@@ -1,83 +0,0 @@
-
- * @link http://www.netcommons.org NetCommons Project
- * @license http://www.netcommons.org/license.txt NetCommons License
- * @copyright Copyright 2014, NetCommons Project
- */
-
-App::uses('NetCommonsMigration', 'NetCommons.Config/Migration');
-
-/**
- * 多言語化対応
- *
- * @author Shohei Nakajima
- * @package NetCommons\Registrations\Config\Migration
- */
-class AddFieldsForM17n extends NetCommonsMigration {
-
-/**
- * Migration description
- *
- * @var string
- */
- public $description = 'add_fields_for_m17n';
-
-/**
- * Actions to be performed
- *
- * @var array $migration
- */
- public $migration = array(
- 'up' => array(
- 'create_field' => array(
- 'registration_choices' => array(
- 'is_origin' => array('type' => 'boolean', 'null' => false, 'default' => '1', 'comment' => 'オリジナルかどうか', 'after' => 'language_id'),
- 'is_translation' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'comment' => '翻訳したかどうか', 'after' => 'is_origin'),
- ),
- 'registration_pages' => array(
- 'is_origin' => array('type' => 'boolean', 'null' => false, 'default' => '1', 'comment' => 'オリジナルかどうか', 'after' => 'language_id'),
- 'is_translation' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'comment' => '翻訳したかどうか', 'after' => 'is_origin'),
- ),
- 'registration_questions' => array(
- 'is_origin' => array('type' => 'boolean', 'null' => false, 'default' => '1', 'comment' => 'オリジナルかどうか', 'after' => 'language_id'),
- 'is_translation' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'comment' => '翻訳したかどうか', 'after' => 'is_origin'),
- ),
- 'registrations' => array(
- 'is_origin' => array('type' => 'boolean', 'null' => false, 'default' => '1', 'comment' => 'オリジナルかどうか', 'after' => 'language_id'),
- 'is_translation' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'comment' => '翻訳したかどうか', 'after' => 'is_origin'),
- ),
- ),
- ),
- 'down' => array(
- 'drop_field' => array(
- 'registration_choices' => array('is_origin', 'is_translation'),
- 'registration_pages' => array('is_origin', 'is_translation'),
- 'registration_questions' => array('is_origin', 'is_translation'),
- 'registrations' => array('is_origin', 'is_translation'),
- ),
- ),
- );
-
-/**
- * Before migration callback
- *
- * @param string $direction Direction of migration process (up or down)
- * @return bool Should process continue
- */
- public function before($direction) {
- return true;
- }
-
-/**
- * After migration callback
- *
- * @param string $direction Direction of migration process (up or down)
- * @return bool Should process continue
- */
- public function after($direction) {
- return true;
- }
-}
diff --git a/Config/Migration/1484546502_add_is_original_copy.php b/Config/Migration/1484546502_add_is_original_copy.php
deleted file mode 100644
index 661ddd4..0000000
--- a/Config/Migration/1484546502_add_is_original_copy.php
+++ /dev/null
@@ -1,79 +0,0 @@
-
- * @link http://www.netcommons.org NetCommons Project
- * @license http://www.netcommons.org/license.txt NetCommons License
- * @copyright Copyright 2014, NetCommons Project
- */
-
-App::uses('NetCommonsMigration', 'NetCommons.Config/Migration');
-
-/**
- * 多言語化対応
- *
- * @author Shohei Nakajima
- * @package NetCommons\Registrations\Config\Migration
- */
-class AddIsOriginalCopy extends NetCommonsMigration {
-
-/**
- * Migration description
- *
- * @var string
- */
- public $description = 'add_is_original_copy';
-
-/**
- * Actions to be performed
- *
- * @var array $migration
- */
- public $migration = array(
- 'up' => array(
- 'create_field' => array(
- 'registration_choices' => array(
- 'is_original_copy' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'comment' => 'オリジナルのコピー。言語を新たに追加したときに使用する', 'after' => 'is_translation'),
- ),
- 'registration_pages' => array(
- 'is_original_copy' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'comment' => 'オリジナルのコピー。言語を新たに追加したときに使用する', 'after' => 'is_translation'),
- ),
- 'registration_questions' => array(
- 'is_original_copy' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'comment' => 'オリジナルのコピー。言語を新たに追加したときに使用する', 'after' => 'is_translation'),
- ),
- 'registrations' => array(
- 'is_original_copy' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'comment' => 'オリジナルのコピー。言語を新たに追加したときに使用する', 'after' => 'is_translation'),
- ),
- ),
- ),
- 'down' => array(
- 'drop_field' => array(
- 'registration_choices' => array('is_original_copy'),
- 'registration_pages' => array('is_original_copy'),
- 'registration_questions' => array('is_original_copy'),
- 'registrations' => array('is_original_copy'),
- ),
- ),
- );
-
-/**
- * Before migration callback
- *
- * @param string $direction Direction of migration process (up or down)
- * @return bool Should process continue
- */
- public function before($direction) {
- return true;
- }
-
-/**
- * After migration callback
- *
- * @param string $direction Direction of migration process (up or down)
- * @return bool Should process continue
- */
- public function after($direction) {
- return true;
- }
-}
diff --git a/Config/Migration/1507450204_add_answer_summary_serial_number.php b/Config/Migration/1507450204_add_answer_summary_serial_number.php
deleted file mode 100644
index 175b179..0000000
--- a/Config/Migration/1507450204_add_answer_summary_serial_number.php
+++ /dev/null
@@ -1,79 +0,0 @@
-
- * @link http://www.netcommons.org NetCommons Project
- * @license http://www.netcommons.org/license.txt NetCommons License
- */
-
-/**
- * Class AddAnswerSummarySerialNumber
- */
-class AddAnswerSummarySerialNumber extends CakeMigration {
-
-/**
- * Migration description
- *
- * @var string
- */
- public $description = 'add_answer_summary_serial_number';
-
-/**
- * Actions to be performed
- *
- * @var array $migration
- */
- public $migration = array(
- 'up' => array(
- 'create_field' => array(
- 'registration_answer_summaries' => array(
- 'serial_number' => array('type' => 'integer', 'null' => false, 'default' => '0', 'unsigned' => true, 'after' => 'id'),
- ),
- ),
- ),
- 'down' => array(
- 'drop_field' => array(
- 'registration_answer_summaries' => array('serial_number'),
- ),
- ),
- );
-
-/**
- * Before migration callback
- *
- * @param string $direction Direction of migration process (up or down)
- * @return bool Should process continue
- */
- public function before($direction) {
- return true;
- }
-
-/**
- * After migration callback
- *
- * @param string $direction Direction of migration process (up or down)
- * @return bool Should process continue
- */
- public function after($direction) {
- $this->RegistrationAnswerSummary = $this->generateModel('RegistrationAnswerSummary');
-
- if ($direction == 'up') {
- // 受付番号をIDで埋める。
- $summaries = $this->RegistrationAnswerSummary->find('all', [
- 'conditions' => [
- 'answer_status' => 2
- ]
- ]);
- foreach ($summaries as $summary) {
- $summary['RegistrationAnswerSummary']['serial_number'] = $summary['RegistrationAnswerSummary']['id'];
- $this->RegistrationAnswerSummary->create();
- $this->RegistrationAnswerSummary->save($summary, [
- 'validate' => false,
- 'callbacks' => false
- ]);
- }
- }
- return true;
- }
-}
diff --git a/Config/Schema/empty b/Config/Schema/empty
new file mode 100644
index 0000000..e69de29
diff --git a/Config/Schema/schema.php b/Config/Schema/schema.php
index 09e9ecf..f3e0fc2 100644
--- a/Config/Schema/schema.php
+++ b/Config/Schema/schema.php
@@ -1,64 +1,24 @@
-
- * @author AllCreator
- * @link http://www.netcommons.org NetCommons Project
- * @license http://www.netcommons.org/license.txt NetCommons License
- * @copyright Copyright 2014, NetCommons Project
- */
-/**
- * Schema file
- *
- * @author AllCreator
- * @package NetCommons\Registration\Config\Schema
- * @SuppressWarnings(PHPMD.LongVariable)
- * @SuppressWarnings(PHPMD.TooManyFields)
- */
+ array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary'),
- 'serial_number' => array('type' => 'integer', 'null' => false, 'default' => '0', 'unsigned' => true),
- 'answer_status' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 4, 'unsigned' => false, 'comment' => '登録状態 1ページずつ表示するような登録フォームの場合、途中状態か否か | 0:登録未完了 | 1:登録完了'),
- 'test_status' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 4, 'unsigned' => false, 'comment' => 'テスト時の登録かどうか 0:本番登録 | 1:テスト時登録'),
- 'answer_number' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false, 'comment' => '登録回数 ログインして登録している人物の場合に限定して登録回数をカウントする'),
- 'answer_time' => array('type' => 'datetime', 'null' => true, 'default' => null, 'comment' => '登録完了の時刻 ページわけされている場合、insert_timeは登録開始時刻となるため、完了時刻を設ける'),
+ 'answer_status' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 4, 'unsigned' => false, 'comment' => '回答状態 1ページずつ表示するような登録フォームの場合、途中状態か否か | 0:回答未完了 | 1:回答完了'),
+ 'test_status' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 4, 'unsigned' => false, 'comment' => 'テスト時の回答かどうか 0:本番回答 | 1:テスト時回答'),
+ 'answer_number' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false, 'comment' => '回答回数 ログインして回答している人物の場合に限定して回答回数をカウントする'),
+ 'answer_time' => array('type' => 'datetime', 'null' => true, 'default' => null, 'comment' => '回答完了の時刻 ページわけされている場合、insert_timeは回答開始時刻となるため、完了時刻を設ける'),
'registration_key' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
- 'session_value' => array('type' => 'text', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => '登録フォーム登録した時のセッション値を保存します。', 'charset' => 'utf8'),
- 'user_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false, 'comment' => 'ログイン後、登録フォームに登録した人のusersテーブルのid。未ログインの場合NULL'),
+ 'session_value' => array('type' => 'text', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => '登録フォーム回答した時のセッション値を保存します。', 'charset' => 'utf8'),
+ 'user_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false, 'comment' => 'ログイン後、登録フォームに回答した人のusersテーブルのid。未ログインの場合NULL'),
'created_user' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false),
'created' => array('type' => 'datetime', 'null' => true, 'default' => null),
'modified_user' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false),
@@ -69,15 +29,10 @@ public function after($event = array()) {
'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB')
);
-/**
- * registration_answers table
- *
- * @var array
- */
public $registration_answers = array(
'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary'),
'matrix_choice_key' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
- 'answer_value' => array('type' => 'text', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => '登録した文字列を設定する
+ 'answer_value' => array('type' => 'text', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => '回答した文字列を設定する
選択肢、リストなどの選ぶだけの場合は、選択肢のid値:ラベルを入れる
選択肢タイプで「その他」を選んだ場合は、入力されたテキストは、ここではなく、other_answer_valueに入れる。
@@ -99,18 +54,10 @@ public function after($event = array()) {
'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB')
);
-/**
- * registration_choices table
- *
- * @var array
- */
public $registration_choices = array(
'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary'),
'key' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
'language_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false),
- 'is_origin' => array('type' => 'boolean', 'null' => false, 'default' => '1', 'comment' => 'オリジナルかどうか'),
- 'is_translation' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'comment' => '翻訳したかどうか'),
- 'is_original_copy' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'comment' => 'オリジナルのコピー。言語を新たに追加したときに使用する'),
'matrix_type' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 4, 'unsigned' => false, 'comment' => 'マトリックスタイプの場合の行列区分 | 0:行 | 1:列'),
'other_choice_type' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => 4, 'unsigned' => false, 'comment' => 'その他欄か否か、また、その他欄の入力エリアタイプ | 0:その他欄でない | 1:テキストタイプを伴ったその他欄 | 2:テキストエリアタイプを伴ったその他欄
@@ -133,18 +80,42 @@ public function after($event = array()) {
'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB')
);
-/**
- * registration_pages table
- *
- * @var array
- */
+ public $registration_frame_display_registrations = array(
+ 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary'),
+ 'frame_key' => array('type' => 'string', 'null' => false, 'default' => null, 'key' => 'index', 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
+ 'registration_key' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
+ 'created_user' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false),
+ 'created' => array('type' => 'datetime', 'null' => true, 'default' => null),
+ 'modified_user' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false),
+ 'modified' => array('type' => 'datetime', 'null' => true, 'default' => null),
+ 'indexes' => array(
+ 'PRIMARY' => array('column' => 'id', 'unique' => 1),
+ 'fk_registration_frame_display_registrations_registration_idx' => array('column' => 'frame_key', 'unique' => 0)
+ ),
+ 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB')
+ );
+
+ public $registration_frame_settings = array(
+ 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary'),
+ 'display_type' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 4, 'unsigned' => false, 'comment' => '0:単一表示(default)|1:リスト表示'),
+ 'display_num_per_page' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 3, 'unsigned' => false, 'comment' => 'リスト表示の場合、1ページ当たりに表示する登録フォーム件数'),
+ 'sort_type' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 4, 'unsigned' => false, 'comment' => '表示並び順 0:新着順 1:回答期間順(降順) 2:登録フォームステータス順(昇順) 3:タイトル順(昇順)'),
+ 'frame_key' => array('type' => 'string', 'null' => false, 'default' => null, 'key' => 'index', 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
+ 'created_user' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false),
+ 'created' => array('type' => 'datetime', 'null' => true, 'default' => null),
+ 'modified_user' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false),
+ 'modified' => array('type' => 'datetime', 'null' => true, 'default' => null),
+ 'indexes' => array(
+ 'PRIMARY' => array('column' => 'id', 'unique' => 1),
+ 'fk_registration_frame_settings_frames1_idx' => array('column' => 'frame_key', 'unique' => 0)
+ ),
+ 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB')
+ );
+
public $registration_pages = array(
'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary'),
'key' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
'language_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false),
- 'is_origin' => array('type' => 'boolean', 'null' => false, 'default' => '1', 'comment' => 'オリジナルかどうか'),
- 'is_translation' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'comment' => '翻訳したかどうか'),
- 'is_original_copy' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'comment' => 'オリジナルのコピー。言語を新たに追加したときに使用する'),
'registration_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'index'),
'page_title' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => 'ページ名', 'charset' => 'utf8'),
'route_number' => array('type' => 'integer', 'null' => false, 'default' => '0', 'unsigned' => false),
@@ -160,29 +131,20 @@ public function after($event = array()) {
'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB')
);
-/**
- * registration_questions table
- *
- * @var array
- */
public $registration_questions = array(
'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary'),
'key' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
'language_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false),
- 'is_origin' => array('type' => 'boolean', 'null' => false, 'default' => '1', 'comment' => 'オリジナルかどうか'),
- 'is_translation' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'comment' => '翻訳したかどうか'),
- 'is_original_copy' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'comment' => 'オリジナルのコピー。言語を新たに追加したときに使用する'),
'question_sequence' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'comment' => '質問表示順'),
'question_value' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
'question_type' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 4, 'unsigned' => false, 'comment' => '質問タイプ | 1:択一選択 | 2:複数選択 | 3:テキスト | 4:テキストエリア | 5:マトリクス(択一) | 6:マトリクス(複数) | 7:日付・時刻 | 8:リスト
'),
'description' => array('type' => 'text', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
- 'is_require' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'comment' => '登録必須フラグ | 0:不要 | 1:必須'),
+ 'is_require' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'comment' => '回答必須フラグ | 0:不要 | 1:必須'),
'question_type_option' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 4, 'unsigned' => false, 'comment' => '1: 数値 | 2:日付(未実装) | 3:時刻(未実装) | 4:メール(未実装) | 5:URL(未実装) | 6:電話番号(未実装) | HTML5チェックで将来的に実装されそうなものに順次対応'),
'is_choice_random' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'comment' => '選択肢表示順序ランダム化 | 質問タイプが1:択一選択 2:複数選択 6:マトリクス(択一) 7:マトリクス(複数) のとき有効 ただし、6,7については行がランダムになるだけで列はランダム化されない'),
- 'is_choice_horizon' => array('type' => 'boolean', 'null' => false, 'default' => '0'),
- 'is_skip' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'comment' => '登録フォーム登録のスキップ有無 0:スキップ 無し 1:スキップ有り'),
- 'is_jump' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'comment' => '登録フォーム登録の分岐'),
+ 'is_skip' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'comment' => '登録フォーム回答のスキップ有無 0:スキップ 無し 1:スキップ有り'),
+ 'is_jump' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'comment' => '登録フォーム回答の分岐'),
'is_range' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'comment' => '範囲設定しているか否か'),
'min' => array('type' => 'string', 'null' => true, 'default' => null, 'length' => 32, 'collate' => 'utf8_general_ci', 'comment' => '最小値 question_typeがテキストで数値タイプのときのみ有効 ', 'charset' => 'utf8'),
'max' => array('type' => 'string', 'null' => true, 'default' => null, 'length' => 32, 'collate' => 'utf8_general_ci', 'comment' => '最大値 question_typeがテキストで数値タイプのときのみ有効 ', 'charset' => 'utf8'),
@@ -201,34 +163,41 @@ public function after($event = array()) {
'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB')
);
-/**
- * registrations table
- *
- * @var array
- */
+ public $registration_settings = array(
+ 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary'),
+ 'block_key' => array('type' => 'string', 'null' => false, 'default' => null, 'key' => 'index', 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
+ 'use_workflow' => array('type' => 'boolean', 'null' => false, 'default' => '1'),
+ 'created_user' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false),
+ 'created' => array('type' => 'datetime', 'null' => true, 'default' => null),
+ 'modified_user' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false),
+ 'modified' => array('type' => 'datetime', 'null' => true, 'default' => null),
+ 'indexes' => array(
+ 'PRIMARY' => array('column' => 'id', 'unique' => 1),
+ 'fk_registration_blocks_settings_blocks1_idx' => array('column' => 'block_key', 'unique' => 0)
+ ),
+ 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB')
+ );
+
public $registrations = array(
'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary'),
'key' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
'language_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false),
- 'is_origin' => array('type' => 'boolean', 'null' => false, 'default' => '1', 'comment' => 'オリジナルかどうか'),
- 'is_translation' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'comment' => '翻訳したかどうか'),
- 'is_original_copy' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'comment' => 'オリジナルのコピー。言語を新たに追加したときに使用する'),
'is_active' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'comment' => '公開中データか否か'),
'is_latest' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'comment' => '最新編集データであるか否か'),
'block_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'index'),
- 'status' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 4, 'unsigned' => false, 'comment' => '公開状況 1:公開中、2:公開申請中、3:下書き中、4:差し戻し'),
+ 'status' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 4, 'unsigned' => false, 'comment' => 'public status, 1: public, 2: public pending, 3: draft during 4: remand | 公開状況 1:公開中、2:公開申請中、3:下書き中、4:差し戻し |'),
'title' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => '登録フォームタイトル', 'charset' => 'utf8'),
- 'title_icon' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
'sub_title' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => '登録フォームサブタイトル', 'charset' => 'utf8'),
- 'answer_timing' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => 4, 'unsigned' => false),
- 'answer_start_period' => array('type' => 'datetime', 'null' => true, 'default' => null),
- 'answer_end_period' => array('type' => 'datetime', 'null' => true, 'default' => null),
- 'is_no_member_allow' => array('type' => 'boolean', 'null' => true, 'default' => '1', 'comment' => '非会員の登録を許可するか | 0:許可しない | 1:許可する'),
- 'is_anonymity' => array('type' => 'boolean', 'null' => true, 'default' => '0', 'comment' => '会員登録であっても匿名扱いとするか否か | 0:非匿名 | 1:匿名'),
- 'is_key_pass_use' => array('type' => 'boolean', 'null' => true, 'default' => '0', 'comment' => 'キーフレーズによる登録ガードを設けるか | 0:キーフレーズガードは用いない | 1:キーフレーズガードを用いる'),
+ 'public_type' => array('type' => 'integer', 'null' => false, 'default' => '1', 'length' => 4, 'unsigned' => false),
+ 'publish_start' => array('type' => 'datetime', 'null' => true, 'default' => null),
+ 'publish_end' => array('type' => 'datetime', 'null' => true, 'default' => null),
+ 'is_no_member_allow' => array('type' => 'boolean', 'null' => true, 'default' => '1', 'comment' => '非会員の回答を許可するか | 0:許可しない | 1:許可する'),
+ 'is_anonymity' => array('type' => 'boolean', 'null' => true, 'default' => '0', 'comment' => '会員回答であっても匿名扱いとするか否か | 0:非匿名 | 1:匿名'),
+ 'is_key_pass_use' => array('type' => 'boolean', 'null' => true, 'default' => '0', 'comment' => 'キーフレーズによる回答ガードを設けるか | 0:キーフレーズガードは用いない | 1:キーフレーズガードを用いる'),
+ 'key_phrase' => array('type' => 'string', 'null' => true, 'default' => 'NetCommons', 'length' => 128, 'collate' => 'utf8_general_ci', 'comment' => 'キーフレーズ', 'charset' => 'utf8'),
'is_repeat_allow' => array('type' => 'boolean', 'null' => true, 'default' => '1'),
'is_total_show' => array('type' => 'boolean', 'null' => true, 'default' => '1', 'comment' => '集計結果を表示するか否か | 0:表示しない | 1:表示する'),
- 'total_show_timing' => array('type' => 'integer', 'null' => true, 'default' => '0', 'length' => 4, 'unsigned' => false, 'comment' => '集計結果を表示するタイミング | 0:登録フォーム登録後、すぐ | 1:期間設定'),
+ 'total_show_timing' => array('type' => 'integer', 'null' => true, 'default' => '0', 'length' => 4, 'unsigned' => false, 'comment' => '集計結果を表示するタイミング | 0:登録フォーム回答後、すぐ | 1:期間設定'),
'total_show_start_period' => array('type' => 'datetime', 'null' => true, 'default' => null),
'total_comment' => array('type' => 'text', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => '集計表示ページの先頭に書くメッセージコメント', 'charset' => 'utf8'),
'is_image_authentication' => array('type' => 'boolean', 'null' => true, 'default' => '0', 'comment' => 'SPAMガード項目を表示するか否か | 0:表示しない | 1:表示する'),
@@ -236,22 +205,18 @@ public function after($event = array()) {
'is_open_mail_send' => array('type' => 'boolean', 'null' => true, 'default' => '0', 'comment' => '登録フォーム開始メールを送信するか(現在未使用) | 0:しない | 1:する'),
'open_mail_subject' => array('type' => 'string', 'null' => true, 'default' => 'Registration to you has arrived', 'collate' => 'utf8_general_ci', 'comment' => '登録フォーム開始メールタイトル(現在未使用)', 'charset' => 'utf8'),
'open_mail_body' => array('type' => 'text', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => '登録フォーム開始通知メール本文(現在未使用)', 'charset' => 'utf8'),
- 'is_answer_mail_send' => array('type' => 'boolean', 'null' => true, 'default' => '0', 'comment' => '登録フォーム登録時に編集者、編集長にメールで知らせるか否か | 0:知らせない| 1:知らせる
+ 'is_answer_mail_send' => array('type' => 'boolean', 'null' => true, 'default' => '0', 'comment' => '登録フォーム回答時に編集者、編集長にメールで知らせるか否か | 0:知らせない| 1:知らせる
'),
- 'reply_to' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
- 'is_regist_user_send' => array('type' => 'boolean', 'null' => false, 'default' => '0'),
- 'registration_mail_subject' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
- 'registration_mail_body' => array('type' => 'text', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
'is_page_random' => array('type' => 'boolean', 'null' => true, 'default' => '0', 'comment' => 'ページ表示順序ランダム化(※将来機能)
選択肢分岐機能との兼ね合いを考えなくてはならないため、現時点での機能盛り込みは見送る'),
- 'is_limit_number' => array('type' => 'boolean', 'null' => true, 'default' => '0'),
- 'limit_number' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false),
'import_key' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
'export_key' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
'created_user' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false),
'created' => array('type' => 'datetime', 'null' => true, 'default' => null),
'modified_user' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false),
'modified' => array('type' => 'datetime', 'null' => true, 'default' => null),
+ 'is_limit_number' => array('type' => 'boolean', 'null' => true, 'default' => '0'),
+ 'limit_number' => array('type' => 'integer', 'null' => true, 'default' => '0', 'unsigned' => false),
'indexes' => array(
'PRIMARY' => array('column' => 'id', 'unique' => 1),
'fk_registrations_blocks1_idx' => array('column' => 'block_id', 'unique' => 0)
diff --git a/Config/routes.php b/Config/routes.php
deleted file mode 100644
index ec7553f..0000000
--- a/Config/routes.php
+++ /dev/null
@@ -1,47 +0,0 @@
-
- * @author Shohei Nakajima
- * @link http://www.netcommons.org NetCommons Project
- * @license http://www.netcommons.org/license.txt NetCommons License
- * @copyright Copyright 2014, NetCommons Project
- */
-
-App::uses('Current', 'NetCommons.Utility');
-
-$params = array(
- 'plugin' => 'registrations',
- 'controller' => 'registration_edit'
-);
-$options = array(
- 'block_id' => '[0-9]+',
- 'key' => '[a-zA-Z0-9_]+', //_は、UnitTestで使用するため
-);
-
-if (Current::isSettingMode()) {
- Router::connect(
- '/' . Current::SETTING_MODE_WORD .
- '/' . $params['plugin'] . '/' . $params['controller'] . '/:action/:block_id/:key/*',
- $params,
- $options
- );
- Router::connect(
- '/' . Current::SETTING_MODE_WORD .
- '/' . $params['plugin'] . '/' . $params['controller'] . '/:action/:block_id/*',
- $params,
- $options
- );
-}
-
-Router::connect(
- '/' . $params['plugin'] . '/' . $params['controller'] . '/:action/:block_id/:key/*',
- $params,
- $options
-);
-Router::connect(
- '/' . $params['plugin'] . '/' . $params['controller'] . '/:action/:block_id/*',
- $params,
- $options
-);
diff --git a/Console/Command/Task/empty b/Console/Command/Task/empty
new file mode 100644
index 0000000..e69de29
diff --git a/Controller/Component/RegistrationBlockTabsComponent.php b/Controller/Component/RegistrationBlockTabsComponent.php
deleted file mode 100644
index 20832f3..0000000
--- a/Controller/Component/RegistrationBlockTabsComponent.php
+++ /dev/null
@@ -1,47 +0,0 @@
-
- * @link http://www.netcommons.org NetCommons Project
- * @license http://www.netcommons.org/license.txt NetCommons License
- */
-
-/**
- * Class RegistrationBlockTabsComponent
- */
-class RegistrationBlockTabsComponent extends Component {
-
-/**
- * initialize BlockTabsヘルパの設定
- *
- * @param Controller $controller コントローラ
- * @return void
- */
- public function initialize(Controller $controller) {
- $controller->helpers['Blocks.BlockTabs'] = array(
- 'mainTabs' => array(
- 'block_index' => array(
- 'url' => array('controller' => 'registration_blocks')
- ),
- ),
- 'blockTabs' => array(
- 'block_settings' => array(
- 'url' => array('controller' => 'registration_edit', 'action' =>
- 'edit_question', 'q_mode' => 'setting')
- ),
- 'role_permissions' => array(
- 'url' => array('controller' => 'registration_block_role_permissions')
- ),
- 'mail_settings' => array(
- 'url' => array('controller' => 'registration_mail_settings')
- ),
- 'answer_list' => array(
- 'url' => array('controller' => 'registration_blocks', 'action' =>
- 'answer_list'),
- 'label' => ['registrations', 'Answer List'],
- ),
- ),
- );
- }
-}
\ No newline at end of file
diff --git a/Controller/Component/RegistrationsComponent.php b/Controller/Component/RegistrationsComponent.php
index c2392b1..e12593c 100644
--- a/Controller/Component/RegistrationsComponent.php
+++ b/Controller/Component/RegistrationsComponent.php
@@ -19,6 +19,13 @@
*/
class RegistrationsComponent extends Component {
+/**
+ * コンテンツキーがパスに含まれる位置
+ *
+ * @var int
+ */
+ const REGISTRATION_KEY_PASS_INDEX = 1;
+
/**
* バリデートタイプ
* ウィザード画面で形成中の判定をしてほしいときに使う
@@ -127,16 +134,13 @@ class RegistrationsComponent extends Component {
* @var string
*/
const ACTION_NOT_ACT = '0';
- const ACTION_BEFORE_ACT = '1';
- const ACTION_ACT = '2';
/**
- * question, choice max count
+ * action. act
*
- * @var integer
+ * @var string
*/
- const MAX_QUESTION_COUNT = 50;
- const MAX_CHOICE_COUNT = 50;
+ const ACTION_ACT = '1';
/**
* type. selection
@@ -194,18 +198,7 @@ class RegistrationsComponent extends Component {
*/
const TYPE_SINGLE_SELECT_BOX = '8';
-/**
- * type. Email
- *
- * @var string
- */
const TYPE_EMAIL = '9';
-
-/**
- * type. File
- *
- * @var string
- */
const TYPE_FILE = '10';
/**
@@ -223,7 +216,7 @@ class RegistrationsComponent extends Component {
self::TYPE_DATE_AND_TIME,
self::TYPE_SINGLE_SELECT_BOX,
self::TYPE_EMAIL,
- self::TYPE_FILE,
+ self::TYPE_FILE
);
/**
@@ -300,7 +293,7 @@ class RegistrationsComponent extends Component {
self::TYPE_OPTION_TIME,
self::TYPE_OPTION_EMAIL,
self::TYPE_OPTION_URL,
- self::TYPE_OPTION_PHONE_NUMBER,
+ self::TYPE_OPTION_PHONE_NUMBER
);
/**
@@ -384,6 +377,46 @@ class RegistrationsComponent extends Component {
*/
const DISPLAY_TYPE_LIST = '1';
+/**
+ * display_sort_type. new arrivals
+ *
+ * @var string
+ */
+ const DISPLAY_SORT_TYPE_NEW_ARRIVALS = '0';
+
+/**
+ * display_sort_type. response time (descending)
+ *
+ * @var string
+ */
+ const DISPLAY_SORT_TYPE_RESPONSE_TIME_DESC = '1';
+
+/**
+ * display_sort_type. survey status order (ascending)
+ *
+ * @var string
+ */
+ const DISPLAY_SORT_TYPE_SURVEY_STATUS_ORDER_ASC = '2';
+
+/**
+ * display_sort_type. by title (ascending order)
+ *
+ * @var string
+ */
+ const DISPLAY_SORT_TYPE_BY_TITLE_ASC = '3';
+
+/**
+ * display_sort_types list
+ *
+ * @var array
+ */
+ static public $displaySortTypesList = array(
+ self::DISPLAY_SORT_TYPE_NEW_ARRIVALS,
+ self::DISPLAY_SORT_TYPE_RESPONSE_TIME_DESC,
+ self::DISPLAY_SORT_TYPE_SURVEY_STATUS_ORDER_ASC,
+ self::DISPLAY_SORT_TYPE_BY_TITLE_ASC
+ );
+
/**
* skip_flag. no_skip
*
@@ -454,6 +487,16 @@ class RegistrationsComponent extends Component {
const REGISTRATION_PERIOD_STAT_BEFORE = 2;
const REGISTRATION_PERIOD_STAT_END = 3;
+/**
+ * registration sort type
+ *
+ * @var integer
+ */
+ const REGISTRATION_SORT_MODIFIED = 0;
+ const REGISTRATION_SORT_CREATED = 1;
+ const REGISTRATION_SORT_TITLE = 2;
+ const REGISTRATION_SORT_END = 3;
+
/**
* registration template exoprt file name
*
@@ -465,11 +508,19 @@ class RegistrationsComponent extends Component {
const REGISTRATION_FINGER_PRINT_FILENAME = 'finger_print.txt';
/**
- * 添付ファイルダウンロード時のanswer.id path index
+ * getDisplayNumberOptions
*
- * @var int
+ * @return array
*/
- const REGISTRATION_DOWNLOAD_FILE_ANSWER_ID_PATH_INDEX = 0;
+ public static function getDisplayNumberOptions() {
+ return array(
+ 5 => 5 . __d('registrations', 'item'),
+ 10 => 10 . __d('registrations', 'item'),
+ 20 => 20 . __d('registrations', 'item'),
+ 50 => 50 . __d('registrations', 'item'),
+ 100 => 100 . __d('registrations', 'item'),
+ );
+ }
/**
* getSortOrders
@@ -478,30 +529,31 @@ class RegistrationsComponent extends Component {
*/
public static function getSortOrders() {
return array(
- 'Registration.modified DESC' => __d('net_commons', 'Newest'),
- 'Registration.created ASC' => __d('net_commons', 'Oldest'),
- 'Registration.title ASC' => __d('net_commons', 'Title'),
- 'Registration.answer_end_period ASC' => __d('registrations', 'End period'),
+ self::REGISTRATION_SORT_MODIFIED => __d('registrations', 'New Modified'),
+ self::REGISTRATION_SORT_CREATED => __d('registrations', 'Registration order'),
+ self::REGISTRATION_SORT_TITLE => __d('registrations', 'Title'),
+ self::REGISTRATION_SORT_END => __d('registrations', 'End period'),
);
}
/**
- * 登録フォーム項目タイプのデータ配列を返す
+ * 登録フォーム質問タイプのデータ配列を返す
*
- * @return array 項目タイプの定値とそれに相応するラベル
+ * @return array 質問タイプの定値とそれに相応するラベル
*/
public function getQuestionTypeOptionsWithLabel() {
return array(
- self::TYPE_SELECTION => __d('net_commons', 'Single choice'),
- self::TYPE_MULTIPLE_SELECTION => __d('net_commons', 'Multiple choice'),
- self::TYPE_TEXT => __d('net_commons', 'Text'),
- self::TYPE_TEXT_AREA => __d('net_commons', 'Free style'),
+ self::TYPE_SELECTION => __d('registrations', 'Single choice'),
+ self::TYPE_MULTIPLE_SELECTION => __d('registrations', 'Multiple choice'),
+ self::TYPE_TEXT => __d('registrations', 'Single text'),
+ self::TYPE_TEXT_AREA => __d('registrations', 'Multiple text'),
//self::TYPE_MATRIX_SELECTION_LIST => __d('registrations', 'Single choice matrix'),
//self::TYPE_MATRIX_MULTIPLE => __d('registrations', 'Multiple choice matrix'),
- self::TYPE_DATE_AND_TIME => __d('net_commons', 'Date and time'),
- self::TYPE_SINGLE_SELECT_BOX => __d('net_commons', 'List select'),
- self::TYPE_EMAIL => __d('net_commons', 'Email'),
- self::TYPE_FILE => __d('net_commons', 'File'),
+ self::TYPE_DATE_AND_TIME => __d('registrations', 'Date and time'),
+ self::TYPE_SINGLE_SELECT_BOX => __d('registrations', 'List select'),
+ //self::TYPE_FROM_EMAIL => __d('registrations', '送信者メールアドレス'),
+ self::TYPE_EMAIL => __d('registrations', 'メールアドレス'),
+ self::TYPE_FILE => __d('registrations', 'ファイル'),
);
}
@@ -525,9 +577,6 @@ public static function isOnlyInputType($type) {
if ($type == self::TYPE_EMAIL) {
return true;
}
- if ($type == self::TYPE_FILE) {
- return true;
- }
return false;
}
diff --git a/Controller/Component/RegistrationsOwnAnswerComponent.php b/Controller/Component/RegistrationsOwnAnswerComponent.php
index 0b343a7..d4bd5dc 100644
--- a/Controller/Component/RegistrationsOwnAnswerComponent.php
+++ b/Controller/Component/RegistrationsOwnAnswerComponent.php
@@ -32,60 +32,34 @@ class RegistrationsOwnAnswerComponent extends Component {
* 指定された登録フォームに該当する登録中登録フォームのサマリを取得する
*
* @param string $registrationKey 登録済に追加する登録フォームキー
- * @return array progressive Answer Summary
+ * @return progressive Answer Summary id list
*/
public function getProgressiveSummaryOfThisUser($registrationKey) {
- $summaryId = null;
- // 未ログインの人の場合はセッションにある登録中データを参照する
- if (! Current::read('User.id')) {
- $session = $this->_Collection->load('Session');
- $summaryId = $session->read('Registrations.progressiveSummary.' . $registrationKey);
- // セッションに「登録中ID」がない場合はfalseリターン
- if (! $summaryId) {
- return false;
- }
- }
- $answerSummary = ClassRegistry::init('Registrations.RegistrationAnswerSummary');
- $summary = $answerSummary->getProgressiveSummary($registrationKey, $summaryId);
- return $summary;
- }
-
-/**
- * 指定された登録フォームに該当する確認待ち登録フォームのサマリを取得する
- *
- * @param string $registrationKey 登録済に追加する登録フォームキー
- * @return array before confirm Answer Summary
- */
- public function getConfirmSummaryOfThisUser($registrationKey) {
// 戻り値初期化
$summary = false;
$answerSummary = ClassRegistry::init('Registrations.RegistrationAnswerSummary');
// 未ログインの人の場合はセッションにある登録中データを参照する
- if (! Current::read('User.id')) {
+ //if (! Current::read('User.id')) {
+ // 登録フォームとしてはセッションだけで充分
$session = $this->_Collection->load('Session');
$summaryId = $session->read('Registrations.progressiveSummary.' . $registrationKey);
- if (! $summaryId) {
- return false;
+ if ($summaryId) {
+ $summary = $answerSummary->findById($summaryId);
}
- $conditions = array(
- 'id' => $summaryId,
- 'answer_status' => RegistrationsComponent::ACTION_BEFORE_ACT,
- );
- } else {
- $conditions = array(
- 'answer_status' => RegistrationsComponent::ACTION_BEFORE_ACT,
- 'registration_key' => $registrationKey,
- 'user_id' => Current::read('User.id'),
- );
- }
- $summary = $answerSummary->find('first', array(
- 'conditions' => $conditions,
- 'recursive' => -1,
- 'order' => 'RegistrationAnswerSummary.created DESC' // 最も新しいものを一つ選ぶ
- ));
- return $summary;
+ return $summary;
+ //}
+ //// ログインユーザーはDBから探す
+ //$conditions = array(
+ // 'answer_status' => RegistrationsComponent::ACTION_NOT_ACT,
+ // 'registration_key' => $registrationKey,
+ // 'user_id' => Current::read('User.id'),
+ //);
+ //$summary = $answerSummary->find('first', array(
+ // 'conditions' => $conditions,
+ // 'order' => 'RegistrationAnswerSummary.created DESC' // 最も新しいものを一つ選ぶ
+ //));
+ //return $summary;
}
-
/**
* 指定された登録フォームに対応する登録中サマリを作成
*
@@ -93,19 +67,13 @@ public function getConfirmSummaryOfThisUser($registrationKey) {
* @return progressive Answer Summary data
*/
public function forceGetProgressiveAnswerSummary($registration) {
- $summary = $this->getProgressiveSummaryOfThisUser(
- $registration['Registration']['key']);
-
+ $summary = $this->getProgressiveSummaryOfThisUser($registration['Registration']['key']);
if (! $summary) {
$answerSummary = ClassRegistry::init('Registrations.RegistrationAnswerSummary');
$session = $this->_Collection->load('Session');
- $summary = $answerSummary->forceGetProgressiveAnswerSummary(
- $registration, Current::read('User.id'),
- $session->id());
+ $summary = $answerSummary->forceGetProgressiveAnswerSummary($registration, Current::read('User.id'), $session->id());
if ($summary) {
- $this->saveProgressiveSummaryOfThisUser(
- $registration['Registration']['key'],
- $summary['RegistrationAnswerSummary']['id']);
+ $this->saveProgressiveSummaryOfThisUser($registration['Registration']['key'], $summary['RegistrationAnswerSummary']['id']);
}
}
@@ -161,7 +129,7 @@ public function getOwnAnsweredKeys() {
$conditions = array(
'user_id' => Current::read('User.id'),
'answer_status' => RegistrationsComponent::ACTION_ACT,
- //'test_status' => RegistrationsComponent::TEST_ANSWER_STATUS_PEFORM,
+ 'test_status' => RegistrationsComponent::TEST_ANSWER_STATUS_PEFORM,
'answer_number' => 1
);
$ownAnsweredKeys = $answerSummary->find(
@@ -172,7 +140,7 @@ public function getOwnAnsweredKeys() {
'recursive' => -1
)
);
- $this->__ownAnsweredKeys = array_values($ownAnsweredKeys);
+ $this->__ownAnsweredKeys = array_values($ownAnsweredKeys); // idの使用を防ぐ(いらない?)
return $this->__ownAnsweredKeys;
}
@@ -206,15 +174,14 @@ public function saveOwnAnsweredKeys($registrationKey) {
// 登録済み登録フォーム配列に追加
$this->__ownAnsweredKeys[] = $registrationKey;
// ログイン状態の人の場合はこれ以上の処理は不要
- if (Current::read('User.id')) {
- return;
- }
+ // 登録フォームではどちらもセッション保存にしたのでログインユーザでもセッション削除を行う
+ //if (Current::read('User.id')) {
+ // return;
+ //}
// 未ログインの人の場合はセッションに書いておく
$session = $this->_Collection->load('Session');
$blockId = Current::read('Block.id');
- $session->write(
- 'Registrations.ownAnsweredKeys.' . $blockId,
- implode(',', $this->__ownAnsweredKeys));
+ $session->write('Registrations.ownAnsweredKeys.' . $blockId, implode(',', $this->__ownAnsweredKeys));
// 登録中登録フォームからは削除しておく
$this->deleteProgressiveSummaryOfThisUser($registrationKey);
diff --git a/Controller/Component/empty b/Controller/Component/empty
new file mode 100644
index 0000000..e69de29
diff --git a/Controller/RegistrationAddController.php b/Controller/RegistrationAddController.php
index 73b4a64..68469fb 100644
--- a/Controller/RegistrationAddController.php
+++ b/Controller/RegistrationAddController.php
@@ -25,6 +25,7 @@ class RegistrationAddController extends RegistrationsAppController {
* @var array
*/
public $uses = array(
+ 'Files.FileModel', // FileUpload
'PluginManager.Plugin',
);
@@ -42,8 +43,6 @@ class RegistrationAddController extends RegistrationsAppController {
),
),
'Registrations.Registrations',
- 'Registrations.RegistrationBlockTabs',
-
);
/**
@@ -56,17 +55,6 @@ class RegistrationAddController extends RegistrationsAppController {
'Registrations.RegistrationUtil'
);
-/**
- * beforeFilter
- *
- * @return void
- */
- public function beforeFilter() {
- parent::beforeFilter();
- // ここへは設定画面の一覧から来たのか、一般画面の一覧から来たのか
- $this->_decideSettingLayout();
- }
-
/**
* add registration display method
*
@@ -76,66 +64,35 @@ public function add() {
// NetCommonsお約束:投稿権限のある人物しかこのアクションにアクセスできない
// それは$componentsの組み込みでallow => add => content_creatableで担保される
// アクション処理内でチェックする必要はない
- unset($this->helpers['Blocks.BlockTabs']['blockTabs']['role_permissions']);
- unset($this->helpers['Blocks.BlockTabs']['blockTabs']['mail_settings']);
- unset($this->helpers['Blocks.BlockTabs']['blockTabs']['answer_list']);
// POSTされたデータを読み取り
- if ($this->request->is('post')) {
+ if ($this->request->isPost()) {
// Postデータをもとにした新登録フォームデータの取得をModelに依頼する
$actionModel = ClassRegistry::init('Registrations.ActionRegistrationAdd', 'true');
-
if ($registration = $actionModel->createRegistration($this->request->data)) {
$tm = $this->_getRegistrationEditSessionIndex();
// 作成中登録フォームデータをセッションキャッシュに書く
$this->Session->write('Registrations.registrationEdit.' . $tm, $registration);
// 次の画面へリダイレクト
- $urlArray = array(
+ $this->redirect(NetCommonsUrl::actionUrl(array(
'controller' => 'registration_edit',
'action' => 'edit_question',
Current::read('Block.id'),
'frame_id' => Current::read('Frame.id'),
's_id' => $tm,
- );
- if ($this->layout == 'NetCommons.setting') {
- $urlArray['q_mode'] = 'setting';
- }
- $this->redirect(NetCommonsUrl::actionUrl($urlArray));
+ )));
return;
} else {
// データに不備があった場合
$this->NetCommons->handleValidationError($actionModel->validationErrors);
}
- } else {
- // 新規に登録フォームを作成するときは最初にブロックをつくっておく
- $frame['Frame'] = Current::read('Frame');
- $this->Registration->createBlock($frame);
}
// 過去データ 取り出し
- $conditions = Hash::remove($this->Registration->getBaseCondition(), 'block_id');
- unset($conditions['Registration.block_id']);
- $conditions['Block.room_id'] = Current::read('Room.id');
- $pastRegistrations = $this->Registration->find('all',
- array(
- 'fields' => array(
- 'id', 'title', 'status', 'answer_timing', 'answer_start_period', 'answer_end_period',
- ),
-
- 'conditions' => $conditions,
- 'offset' => 0,
- 'limit' => 1000,
- 'recursive' => 0,
- 'order' => array('Registration.modified DESC'),
- ));
+ $pastRegistrations = $this->Registration->getRegistrationsList(array(), array('limit' => 1000), array('recursive' => -1));
$this->set('pastRegistrations', $pastRegistrations);
- if ($this->layout == 'NetCommons.setting') {
- $this->set('cancelUrl', NetCommonsUrl::backToIndexUrl('default_setting_action'));
- } else {
- $this->set('cancelUrl', NetCommonsUrl::backToPageUrl());
- }
//
// NetCommonsお約束:投稿のデータはrequest dataに設定する
//
@@ -143,9 +100,7 @@ public function add() {
$this->request->data['Block'] = Current::read('Block');
// create_optionが未設定のときは初期値として「NEW」を設定する
if (! $this->request->data('ActionRegistrationAdd.create_option')) {
- $this->request->data(
- 'ActionRegistrationAdd.create_option',
- RegistrationsComponent::REGISTRATION_CREATE_OPT_NEW);
+ $this->request->data('ActionRegistrationAdd.create_option', RegistrationsComponent::REGISTRATION_CREATE_OPT_NEW);
}
}
-}
+}
\ No newline at end of file
diff --git a/Controller/RegistrationAnswerSummariesController.php b/Controller/RegistrationAnswerSummariesController.php
new file mode 100644
index 0000000..afe4494
--- /dev/null
+++ b/Controller/RegistrationAnswerSummariesController.php
@@ -0,0 +1,117 @@
+
+ * @author Allcreator
+ * @link http://www.netcommons.org NetCommons Project
+ * @license http://www.netcommons.org/license.txt NetCommons License
+ * @copyright Copyright 2014, NetCommons Project
+ */
+
+App::uses('AppController', 'Controller');
+
+/**
+ * RegistrationAnswerSummariesController
+ *
+ * @author Allcreator
+ * @package NetCommons\Registrations\Controller
+ */
+class RegistrationAnswerSummariesController extends RegistrationsAppController {
+
+/**
+ * use model
+ *
+ * @var array
+ */
+ public $uses = array(
+ 'Registrations.Registration',
+ 'Registrations.RegistrationPage',
+ 'Registrations.RegistrationQuestion',
+ 'Registrations.RegistrationChoice',
+ 'Registrations.RegistrationAnswerSummary',
+ 'Registrations.RegistrationAnswer',
+ );
+
+/**
+ * use components
+ *
+ * @var array
+ */
+ public $components = array(
+ 'NetCommons.Permission',
+ 'Registrations.Registrations',
+ );
+
+/**
+ * use helpers
+ *
+ */
+ public $helpers = array(
+ 'Workflow.Workflow',
+ );
+
+/**
+ * target registration data
+ *
+ */
+ private $__registration = null;
+
+/**
+ * beforeFilter
+ *
+ * @return void
+ */
+ public function beforeFilter() {
+ parent::beforeFilter();
+
+ // ゲストアクセスOKのアクションを設定
+ $this->Auth->allow('view');
+
+ // NetCommonsお約束:編集画面へのURLに編集対象のコンテンツキーが含まれている
+ // まずは、そのキーを取り出す
+ // 登録フォームキー
+ $registrationKey = $this->_getRegistrationKeyFromPass();
+
+ // キーで指定された登録フォームデータを取り出しておく
+ $conditions = $this->Registration->getBaseCondition(
+ array('Registration.key' => $registrationKey)
+ );
+ // 集計結果の表示は登録フォーム公開時期とは異なるので
+ $conditions = Hash::remove($conditions, 'public_type');
+ $conditions = Hash::remove($conditions, 'publish_start');
+ $conditions = Hash::remove($conditions, 'publish_end');
+
+ $this->__registration = $this->Registration->find('first', array(
+ 'conditions' => $conditions,
+ ));
+ if (! $this->__registration) {
+ $this->setAction('throwBadRequest');
+ return;
+ }
+
+ //集計表示していいかどうかの判断
+
+ if (! $this->isAbleToDisplayAggregatedData($this->__registration)) {
+ $this->setAction('throwBadRequest');
+ return;
+ }
+ }
+
+/**
+ * result method
+ *
+ * @return void
+ */
+ public function view() {
+ $registration = $this->__registration;
+
+ //集計処理を行います。
+ $questions = $this->RegistrationAnswerSummary->getAggregate($registration);
+
+ //画面用データをセットする。
+ $this->set('registration', $registration);
+ $this->set('questions', $questions);
+ }
+
+}
\ No newline at end of file
diff --git a/Controller/RegistrationAnswersController.php b/Controller/RegistrationAnswersController.php
index 01ded77..2c49754 100644
--- a/Controller/RegistrationAnswersController.php
+++ b/Controller/RegistrationAnswersController.php
@@ -16,11 +16,6 @@
*
* @author Allcreator
* @package NetCommons\Registrations\Controller
- * @property RegistrationAnswer $RegistrationAnswer
- * @property RegistrationsOwnAnswerComponent $RegistrationOwnAnswer
- * @property RegistrationAnswerSummary $RegistrationAnswerSummary
- *
- * @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
*/
class RegistrationAnswersController extends RegistrationsAppController {
@@ -33,7 +28,6 @@ class RegistrationAnswersController extends RegistrationsAppController {
'Registrations.RegistrationPage',
'Registrations.RegistrationAnswerSummary',
'Registrations.RegistrationAnswer',
- //'Registrations.RegistrationFrameSetting',
);
/**
@@ -46,12 +40,12 @@ class RegistrationAnswersController extends RegistrationsAppController {
'Registrations.Registrations',
'Registrations.RegistrationsOwnAnswer',
'AuthorizationKeys.AuthorizationKey' => array(
- 'operationType' => 'embed',
+ 'operationType' => 'none',
'targetAction' => 'view',
'model' => 'Registration',
'contentId' => 0),
'VisualCaptcha.VisualCaptcha' => array(
- 'operationType' => 'embed',
+ 'operationType' => 'none',
'targetAction' => 'view'),
);
@@ -61,7 +55,6 @@ class RegistrationAnswersController extends RegistrationsAppController {
*/
public $helpers = [
'NetCommons.Date',
- 'NetCommons.TitleIcon',
'Workflow.Workflow',
'Registrations.RegistrationAnswer'
];
@@ -78,17 +71,6 @@ class RegistrationAnswersController extends RegistrationsAppController {
*/
private $__ableToAnswerAction = ['view', 'confirm'];
-/**
- * target remainingCount Action
- *
- */
- private $__remainingCountAction = ['view', 'confirm', 'key_auth', 'img_auth'];
-
-/**
- * frame setting display type
- */
- private $__displayType = null;
-
/**
* beforeFilter
* NetCommonsお約束:できることならControllerのbeforeFilterで実行可/不可の判定して流れを変える
@@ -97,8 +79,7 @@ class RegistrationAnswersController extends RegistrationsAppController {
*/
public function beforeFilter() {
// ゲストアクセスOKのアクションを設定
- $this->Auth->allow('view', 'confirm', 'thanks', 'no_more_answer', 'key_auth', 'img_auth',
- 'empty_form', 'limit');
+ $this->Auth->allow('view', 'confirm', 'thanks', 'no_more_answer');
// 親クラスのbeforeFilterを済ませる
parent::beforeFilter();
@@ -106,32 +87,24 @@ public function beforeFilter() {
// NetCommonsお約束:編集画面へのURLに編集対象のコンテンツキーが含まれている
// まずは、そのキーを取り出す
// 登録フォームキー
- //$registrationKey = $this->_getRegistrationKeyFromPass();
+ $registrationKey = $this->_getRegistrationKeyFromPass();
// キーで指定された登録フォームデータを取り出しておく
- $conditions = $this->Registration->getWorkflowConditions(
- //array('Registration.key' => $registrationKey)
- array('Registration.block_id' => Current::read('Block.id'))
+ $conditions = $this->Registration->getBaseCondition(
+ array('Registration.key' => $registrationKey)
);
$this->__registration = $this->Registration->find('first', array(
'conditions' => $conditions,
- 'recursive' => 1
));
if (! $this->__registration) {
- // 権限が無くて表示できないブロックがページに配置されることもあるので、emptyRenderにする。
- if ($this->action === 'view') {
- $this->setAction('empty_form');
- return;
- }
- //$this->setAction('throwBadRequest'); // returnをつけるとテストコードが通らない
+ // 単純に期間外のこともある
+ $this->setAction('emptyRender');
+ return;
+ $this->setAction('throwBadRequest');
+ return;
}
- // 現在の表示形態を調べておく
- //list($this->__displayType) = $this->RegistrationFrameSetting->getRegistrationFrameSetting(
- // Current::read('Frame.key')
- //);
-
// 以下のisAbleto..の内部関数にてNetCommonsお約束である編集権限、参照権限チェックを済ませています
// 閲覧可能か
if (!$this->isAbleTo($this->__registration)) {
@@ -147,36 +120,21 @@ public function beforeFilter() {
return;
}
}
-
- if (in_array($this->action, $this->__remainingCountAction)) {
- //残りの登録可能数を取得
- $remainingCount = $this->__remainingCount($this->__registration);
- if ($remainingCount == 0) {
- $this->setAction('limit');
- return;
+ // 登録の初めのページであることが各種認証行う条件
+ if (!$this->request->isPost() || !isset($this->request->data['RegistrationPage']['page_sequence'])) {
+ // 認証キーコンポーネントお約束:
+ // 取り出した登録フォームが認証キー確認を求めているなら、operationTypeをすり替える
+ if ($this->__registration['Registration']['is_key_pass_use'] == RegistrationsComponent::USES_USE) {
+ $this->AuthorizationKey->operationType = 'redirect';
+ $this->AuthorizationKey->contentId = $this->__registration['Registration']['id'];
+ }
+ // 画像認証コンポーネントお約束:
+ // 取り出した登録フォームが画像認証ありならば、operationTypeをすり替える
+ if ($this->__registration['Registration']['is_image_authentication'] == RegistrationsComponent::USES_USE) {
+ $this->VisualCaptcha->operationType = 'redirect';
}
- $this->set('remainingCount', $remainingCount);
}
}
-
-/**
- * 権限のないviewアクションにきたときに表示(一度も公開されてないフレーム)
- *
- * @return void
- */
- public function empty_form() {
- $this->emptyRender();
- }
-
-/**
- * 登録数を超過したときに表示
- *
- * @return void
- */
- public function limit() {
- $this->set('registration', $this->__registration);
- }
-
/**
* test_mode
*
@@ -194,128 +152,19 @@ public function test_mode() {
$status = $this->__registration['Registration']['status'];
// テストモード確認画面からのPOSTや、現在の登録フォームデータのステータスが公開状態の時
// 次へリダイレクト
- if ($this->request->is('post') || $status == WorkflowComponent::STATUS_PUBLISHED) {
- $this->_redirectAnswerPage();
- return;
- }
- $this->request->data['Frame'] = Current::read('Frame');
- $this->request->data['Block'] = Current::read('Block');
- $this->set('registration', $this->__registration);
- }
-
-/**
- * _viewGuard
- *
- * 登録フォームが認証キーや画像認証でガードされているかどうかを調べ、
- * ガードがある場合は適宜、相当のアクションへ転送する
- *
- * @return void
- */
- protected function _viewGuard() {
- $registrationKey = $this->_getRegistrationKey($this->__registration);
- $quest = $this->__registration['Registration'];
-
- if (!$this->Session->check('Registration.auth_ok.' . $registrationKey)) {
- if ($this->request->is('get') ||
- !isset($this->request->data['RegistrationPage']['page_sequence'])) {
- // 認証キーコンポーネントお約束:
- if ($quest['is_key_pass_use'] == RegistrationsComponent::USES_USE) {
- $this->AuthorizationKey->contentId = $quest['id'];
- $this->AuthorizationKey->guard(
- AuthorizationKeyComponent::OPERATION_EMBEDDING,
- 'Registration',
- $this->__registration);
- $this->setAction('key_auth');
- return;
- }
- if ($quest['is_image_authentication'] == RegistrationsComponent::USES_USE) {
- // 画像認証コンポーネントお約束:
- $this->setAction('img_auth');
- return;
- }
- }
- } else {
- $this->Session->delete('Registration.auth_ok.' . $registrationKey);
- }
- }
-
-/**
- * key_auth
- *
- * 認証キーガード
- *
- * @return void
- */
- public function key_auth() {
- $isKeyPassUse = $this->__registration['Registration']['is_key_pass_use'];
- if ($isKeyPassUse != RegistrationsComponent::USES_USE) {
- $this->_redirectAnswerPage();
+ if ($this->request->isPost() || $status == WorkflowComponent::STATUS_PUBLISHED) {
+ $this->redirect(NetCommonsUrl::actionUrl(array(
+ 'controller' => 'registration_answers',
+ 'action' => 'view',
+ Current::read('Block.id'),
+ $this->_getRegistrationKey($this->__registration),
+ 'frame_id' => Current::read('Frame.id')
+ )));
return;
}
- $qKey = $this->_getRegistrationKey($this->__registration);
- if ($this->request->is('post')) {
- if ($this->AuthorizationKey->check()) {
- $this->Session->write('Registration.auth_ok.' . $qKey, 'OK');
- // 画面へ行く
- $url = NetCommonsUrl::actionUrl(array(
- 'controller' => 'registration_answers',
- 'action' => 'view',
- Current::read('Block.id'),
- $qKey,
- 'frame_id' => Current::read('Frame.id'),
- ));
- $this->redirect($url);
- return;
- }
- }
- $url = NetCommonsUrl::actionUrl(array(
- 'controller' => 'registration_answers',
- 'action' => 'key_auth',
- Current::read('Block.id'),
- $qKey,
- 'frame_id' => Current::read('Frame.id'),
- ));
- $this->set('registration', $this->__registration);
- $this->set('displayType', $this->__displayType);
- $this->set('postUrl', $url);
$this->request->data['Frame'] = Current::read('Frame');
$this->request->data['Block'] = Current::read('Block');
- }
-
-/**
- * img_auth
- *
- * 画像認証ガード
- *
- * @return void
- */
- public function img_auth() {
- $isImgUse = $this->__registration['Registration']['is_image_authentication'];
- if ($isImgUse != RegistrationsComponent::USES_USE) {
- $this->_redirectAnswerPage();
- return;
- }
- $qKey = $this->_getRegistrationKey($this->__registration);
- if ($this->request->is('post')) {
- if ($this->VisualCaptcha->check()) {
- $this->Session->write('Registration.auth_ok.' . $qKey, 'OK');
- // 画面へ行く
- $this->_redirectAnswerPage();
- return;
- }
- }
- $url = NetCommonsUrl::actionUrl(array(
- 'controller' => 'registration_answers',
- 'action' => 'img_auth',
- Current::read('Block.id'),
- $qKey,
- 'frame_id' => Current::read('Frame.id'),
- ));
$this->set('registration', $this->__registration);
- $this->set('displayType', $this->__displayType);
- $this->set('postUrl', $url);
- $this->request->data['Frame'] = Current::read('Frame');
- $this->request->data['Block'] = Current::read('Block');
}
/**
@@ -328,48 +177,35 @@ public function view() {
$registration = $this->__registration;
$registrationKey = $this->_getRegistrationKey($this->__registration);
- //
- $this->_viewGuard();
-
// 選択肢ランダム表示対応
$this->__shuffleChoice($registration);
// ページの指定のない場合はFIRST_PAGE_SEQUENCEをデフォルトとする
$nextPageSeq = RegistrationsComponent::FIRST_PAGE_SEQUENCE; // default
- $postPageSeq = null;
- if (isset($this->data['RegistrationPage']['page_sequence'])) {
- $postPageSeq = $this->data['RegistrationPage']['page_sequence'];
- }
-
// POSTチェック
- if ($this->request->is('post')) {
- // サマリ情報準備
- $summary = $this->RegistrationsOwnAnswer->forceGetProgressiveAnswerSummary(
- $this->__registration
- );
- $nextPageSeq = $postPageSeq;
-
+ if ($this->request->isPost()) {
// 登録データがある場合は登録をDBに書きこむ
if (isset($this->data['RegistrationAnswer'])) {
- if (! $this->RegistrationAnswer->saveAnswer($this->data, $registration, $summary)) {
+ $summary = $this->RegistrationsOwnAnswer->forceGetProgressiveAnswerSummary($this->__registration);
+ if (! $summary) {
// 保存エラーの場合は今のページを再表示
- $nextPageSeq = $postPageSeq;
+ $nextPageSeq = $this->data['RegistrationPage']['page_sequence'];
} else {
- // 登録データがあり、無事保存できたら次ページを取得する
- $nextPageSeq = $this->RegistrationPage->getNextPage(
- $registration,
- $postPageSeq,
- $this->data['RegistrationAnswer']);
+ if (! $this->RegistrationAnswer->saveAnswer($this->data, $registration, $summary)) {
+ // 保存エラーの場合は今のページを再表示
+ $nextPageSeq = $this->data['RegistrationPage']['page_sequence'];
+ } else {
+ // 登録データがあり、無事保存できたら次ページを取得する
+ $nextPageSeq = $this->RegistrationPage->getNextPage(
+ $registration,
+ $this->data['RegistrationPage']['page_sequence'],
+ $this->data['RegistrationAnswer']);
+ }
}
}
// 次ページはもう存在しない
if ($nextPageSeq === false) {
- // 確認画面へいってもよい状態ですと書きこむ
- $this->RegistrationAnswerSummary->saveAnswerStatus(
- $summary,
- RegistrationsComponent::ACTION_BEFORE_ACT
- );
// 確認画面へ
$url = NetCommonsUrl::actionUrl(array(
'controller' => 'registration_answers',
@@ -382,12 +218,11 @@ public function view() {
return;
}
}
- if (! ($this->request->is('post') && $nextPageSeq == $postPageSeq)) {
- $summary = $this->RegistrationsOwnAnswer->getProgressiveSummaryOfThisUser(
- $registrationKey);
- $setAnswers = $this->RegistrationAnswer->getProgressiveAnswerOfThisSummary(
- $registration,
- $summary);
+ if (! ($this->request->isPost() && $nextPageSeq == $this->data['RegistrationPage']['page_sequence'])) {
+ // 確認画面から戻ってきたときもDBからデータを取り出してる。
+ $summary = $this->RegistrationsOwnAnswer->getProgressiveSummaryOfThisUser($registrationKey);
+ //$summary = false;
+ $setAnswers = $this->RegistrationAnswer->getProgressiveAnswerOfThisSummary($summary);
$this->set('answers', $setAnswers);
$this->request->data['RegistrationAnswer'] = $setAnswers;
@@ -398,44 +233,38 @@ public function view() {
$this->set('answers', $this->request->data['RegistrationAnswer']);
}
- // 項目情報をView変数にセット
+ // 質問情報をView変数にセット
$this->request->data['Frame'] = Current::read('Frame');
$this->request->data['Block'] = Current::read('Block');
$this->request->data['RegistrationPage'] = $registration['RegistrationPage'][$nextPageSeq];
$this->set('registration', $registration);
$this->set('questionPage', $registration['RegistrationPage'][$nextPageSeq]);
- $this->set('displayType', $this->__displayType);
$this->NetCommons->handleValidationError($this->RegistrationAnswer->validationErrors);
-
- //新着データを既読にする
- $this->Registration->saveTopicUserStatus($registration);
}
-
/**
* confirm method
*
* @return void
*/
public function confirm() {
- // 確認してもいいサマリレコード取得
- $summary = $this->RegistrationsOwnAnswer->getConfirmSummaryOfThisUser(
+ // 解答入力画面で表示していたときのシャッフルを取り出す
+ $this->__shuffleChoice($this->__registration);
+
+ // 登録中サマリレコード取得
+ $summary = $this->RegistrationsOwnAnswer->getProgressiveSummaryOfThisUser(
$this->_getRegistrationKey($this->__registration));
if (!$summary) {
$this->setAction('throwBadRequest');
return;
}
- // 解答入力画面で表示していたときのシャッフルを取り出す
- $this->__shuffleChoice($this->__registration);
-
// POSTチェック
- if ($this->request->is('post')) {
+ if ($this->request->isPost()) {
// サマリの状態を完了にして確定する
- $this->RegistrationAnswerSummary->saveAnswerStatus(
- $summary,
- RegistrationsComponent::ACTION_ACT);
- $this->RegistrationsOwnAnswer->saveOwnAnsweredKeys(
- $this->_getRegistrationKey($this->__registration));
+ $summary['RegistrationAnswerSummary']['answer_status'] = RegistrationsComponent::ACTION_ACT;
+ $summary['RegistrationAnswerSummary']['answer_time'] = (new NetCommonsTime())->getNowDatetime();
+ $this->RegistrationAnswerSummary->save($summary['RegistrationAnswerSummary']);
+ $this->RegistrationsOwnAnswer->saveOwnAnsweredKeys($this->_getRegistrationKey($this->__registration));
// ありがとう画面へ行く
$url = NetCommonsUrl::actionUrl(array(
@@ -444,63 +273,37 @@ public function confirm() {
Current::read('Block.id'),
$this->_getRegistrationKey($this->__registration),
'frame_id' => Current::read('Frame.id'),
- 'summary_id' => $summary['RegistrationAnswerSummary']['id']
));
$this->redirect($url);
}
// 登録情報取得
// 登録情報並べ替え
- $setAnswers = $this->RegistrationAnswer->getProgressiveAnswerOfThisSummary(
- $this->__registration,
- $summary);
+ $setAnswers = $this->RegistrationAnswer->getProgressiveAnswerOfThisSummary($summary);
- // 項目情報をView変数にセット
+ // 質問情報をView変数にセット
$this->request->data['Frame'] = Current::read('Frame');
$this->request->data['Block'] = Current::read('Block');
$this->set('registration', $this->__registration);
$this->request->data['RegistrationAnswer'] = $setAnswers;
$this->set('answers', $setAnswers);
- $this->set('displayType', $this->__displayType);
}
-
/**
* thanks method
*
* @return void
*/
public function thanks() {
- $qKey = $this->__registration['Registration']['key'];
- // 登録済みか確認
- if (! $this->RegistrationsOwnAnswer->checkOwnAnsweredKeys($qKey)) {
- $this->setAction('throwBadRequest');
- return;
- }
// 後始末
// 登録中にたまっていたセッションキャッシュをクリア
- $this->Session->delete('Registrations.' . $qKey);
-
- // 登録データを取得
- $summary = $this->RegistrationAnswerSummary->findById($this->request->named['summary_id']);
- // 項目のIDを取得
- $questionIds = Hash::extract(
- $this->__registration['RegistrationPage'],
- '{n}.RegistrationQuestion.{n}.id');
- $answers = $this->RegistrationAnswer->getAnswersBySummary($summary, $questionIds);
- $this->set('summary', $summary);
- $this->set('answers', $answers);
+ $this->Session->delete('Registrations.' . $this->__registration['Registration']['key']);
// View変数にセット
$this->request->data['Frame'] = Current::read('Frame');
$this->request->data['Block'] = Current::read('Block');
$this->set('registration', $this->__registration);
$this->set('ownAnsweredKeys', $this->RegistrationsOwnAnswer->getOwnAnsweredKeys());
- $this->set('displayType', $this->__displayType);
-
- //新着データを登録済みにする
- $this->Registration->saveTopicUserStatus($this->__registration, true);
}
-
/**
* no_more_answer method
* 条件によって登録できない登録フォームにアクセスしたときに表示
@@ -508,9 +311,7 @@ public function thanks() {
* @return void
*/
public function no_more_answer() {
- $this->set('displayType', $this->__displayType);
}
-
/**
* _shuffleChoice
* shuffled choices and write into session
@@ -523,11 +324,7 @@ private function __shuffleChoice(&$registration) {
foreach ($page['RegistrationQuestion'] as &$q) {
$choices = $q['RegistrationChoice'];
if ($q['is_choice_random'] == RegistrationsComponent::USES_USE) {
- $sessionPath = sprintf(
- 'Registrations.%s.RegistrationQuestion.%s.RegistrationChoice',
- $registration['Registration']['key'],
- $q['key']
- );
+ $sessionPath = 'Registrations.' . $registration['Registration']['key'] . '.RegistrationQuestion.' . $q['key'] . '.RegistrationChoice';
if ($this->Session->check($sessionPath)) {
$choices = $this->Session->read($sessionPath);
} else {
@@ -539,53 +336,4 @@ private function __shuffleChoice(&$registration) {
}
}
}
-/**
- * _redirectAnswerPage
- *
- * @return void
- */
- protected function _redirectAnswerPage() {
- $this->redirect(NetCommonsUrl::actionUrl(array(
- 'controller' => 'registration_answers',
- 'action' => 'view',
- Current::read('Block.id'),
- $this->_getRegistrationKey($this->__registration),
- 'frame_id' => Current::read('Frame.id')
- )));
- }
-
-/**
- * 残りの登録可能数を取得
- *
- * @param array $registration Registrationデータ
- * @return int 残りの登録可能数 登録数制限を行わない場合は-1を返す。
- */
- private function __remainingCount($registration) {
- if ($registration['Registration']['is_limit_number']) {
- $limit = $registration['Registration']['limit_number'];
- // 登録数カウント
- $options = [
- 'conditions' => $this->RegistrationAnswerSummary->getResultCondition($registration)
- ];
- $answerCount = $this->RegistrationAnswerSummary->find('count', $options);
- if ($limit > $answerCount) {
- //登録可能
- return $limit - $answerCount;
- } else {
- //登録数制限を超過
- if ($this->request->is('post') &&
- ($this->action === 'view' || $this->action === 'confirm')) {
- //回答画面で次へ、もしくは確認画面で決定をクリックしたときはフラッシュメッセージ表示
- $this->NetCommons->setFlashNotification(
- __d('net_commons', 'Failed to save.'),
- ['class' => 'danger'],
- 400
- );
- }
- return 0;
- }
- }
- //登録数制限を行わない
- return -1;
- }
}
diff --git a/Controller/RegistrationBlockRolePermissionsController.php b/Controller/RegistrationBlockRolePermissionsController.php
index 722a0f2..0f7ea66 100644
--- a/Controller/RegistrationBlockRolePermissionsController.php
+++ b/Controller/RegistrationBlockRolePermissionsController.php
@@ -3,7 +3,7 @@
* RegistrationBlockRolePermissions Controller
*
* @author Noriko Arai
- * @author Allcreator
+ * @author Shohei Nakajima
* @link http://www.netcommons.org NetCommons Project
* @license http://www.netcommons.org/license.txt NetCommons License
* @copyright Copyright 2014, NetCommons Project
@@ -43,13 +43,10 @@ class RegistrationBlockRolePermissionsController extends RegistrationBlocksContr
public $components = array(
'NetCommons.Permission' => array(
//アクセスの権限
- // HACK: RegistrationBlocksControllerを継承しているので
- // 親クラスの "*" 権限指定が上書きされるように "*" 指定をしている。
'allow' => array(
- '*' => 'block_permission_editable',
+ 'edit' => 'block_permission_editable',
),
),
- 'Registrations.RegistrationBlockTabs',
);
/**
@@ -59,32 +56,14 @@ class RegistrationBlockRolePermissionsController extends RegistrationBlocksContr
*/
public $helpers = array(
'Blocks.BlockRolePermissionForm',
- //'Blocks.BlockTabs' => array(
- // 'mainTabs' => array(
- // 'block_index' => array(
- // 'url' => array('controller' => 'registration_blocks')
- // ),
- // ),
- // 'blockTabs' => array(
- // 'block_settings' => array(
- // 'url' => array('controller' => 'registration_edit', 'action' =>
- // 'edit_question', 'q_mode' => 'setting')
- // ),
- // 'role_permissions' => array(
- // 'url' => array('controller' => 'registration_block_role_permissions')
- // ),
- // 'mail_settings' => array(
- // 'url' => array('controller' => 'registration_mail_settings')
- // ),
- // 'answer_list' => array(
- // 'url' => array('controller' => 'registration_blocks', 'action' =>
- // 'answer_list'),
- // 'label' => ['registrations', 'Answer List'],
- // ),
- //
- // ),
- //),
'NetCommons.Date',
+ 'Blocks.BlockTabs' => array(
+ 'mainTabs' => array(
+ 'block_index' => array('url' => array('controller' => 'registration_blocks')),
+ 'role_permissions' => array('url' => array('controller' => 'registration_block_role_permissions')),
+ 'frame_settings' => array('url' => array('controller' => 'registration_frame_settings')),
+ ),
+ ),
);
/**
@@ -93,26 +72,20 @@ class RegistrationBlockRolePermissionsController extends RegistrationBlocksContr
* @return void
*/
public function edit() {
- // この処理に来る前に必ずSettingレコードは作成される(beforeFilterで
- // (作成できてないときはExceptionエラーが発生して、ここにはこれない
$registrationSetting = $this->RegistrationSetting->getSetting();
+ if (! $registrationSetting) {
+ $this->setAction('throwBadRequest');
+ return false;
+ }
$permissions = $this->Workflow->getBlockRolePermissions(
- array(
- 'content_creatable',
- 'content_publishable',
- 'content_comment_creatable',
- 'content_comment_publishable'
- )
+ array('content_creatable', 'content_publishable', 'content_comment_creatable', 'content_comment_publishable')
);
$this->set('roles', $permissions['Roles']);
- if ($this->request->is('post')) {
+ if ($this->request->isPost()) {
if ($this->RegistrationSetting->saveRegistrationSetting($this->request->data)) {
- $this->NetCommons->setFlashNotification(
- __d('net_commons', 'Successfully saved.'),
- array(
- 'class' => 'success',
- )
- );
+ $this->NetCommons->setFlashNotification(__d('net_commons', 'Successfully saved.'), array(
+ 'class' => 'success',
+ ));
$this->redirect(NetCommonsUrl::backToIndexUrl('default_setting_action'));
return;
}
diff --git a/Controller/RegistrationBlocksController.php b/Controller/RegistrationBlocksController.php
index 4cbef7b..cfaeb1e 100644
--- a/Controller/RegistrationBlocksController.php
+++ b/Controller/RegistrationBlocksController.php
@@ -3,7 +3,7 @@
* RegistrationBlocksController
*
* @author Noriko Arai
- * @author Allcreator
+ * @author Ryo Ozawa
* @link http://www.netcommons.org NetCommons Project
* @license http://www.netcommons.org/license.txt NetCommons License
* @copyright Copyright 2014, NetCommons Project
@@ -17,7 +17,7 @@
/**
* BlocksController
*
- * @author AllCreator
+ * @author Ryo Ozawa
* @package NetCommons\Registrations\Controller
*/
class RegistrationBlocksController extends RegistrationsAppController {
@@ -43,11 +43,11 @@ class RegistrationBlocksController extends RegistrationsAppController {
*/
public $uses = array(
'Registrations.Registration',
- //'Registrations.RegistrationFrameSetting',
+ 'Registrations.RegistrationFrameSetting',
'Registrations.RegistrationAnswerSummary',
'Registrations.RegistrationAnswerSummaryCsv',
- 'Registrations.RegistrationAnswer',
'Blocks.Block',
+ 'Registrations.RegistrationExport',
);
/**
@@ -59,11 +59,10 @@ class RegistrationBlocksController extends RegistrationsAppController {
'NetCommons.Permission' => array(
//アクセスの権限
'allow' => array(
- '*' => 'block_editable',
+ 'index,add,edit,delete' => 'block_editable',
),
),
'Paginator',
- 'Files.Download',
);
/**
@@ -74,47 +73,15 @@ class RegistrationBlocksController extends RegistrationsAppController {
public $helpers = array(
'Session',
'Blocks.BlockForm',
+ 'NetCommons.NetCommonsForm',
+ 'NetCommons.Date',
'Blocks.BlockTabs' => array(
'mainTabs' => array(
- 'block_index' => array(
- 'url' => array('controller' => 'registration_blocks')
- ),
- //'role_permissions' => array(
- // 'url' => array('controller' => 'registration_block_role_permissions')
- //),
- ////'frame_settings' => array(
- //// 'url' => array('controller' => 'registration_frame_settings')
- ////),
- //'mail_settings' => array(
- // 'url' => array('controller' => 'registration_mail_settings')
- //),
- ),
- 'blockTabs' => array(
- 'block_settings' => array(
- 'url' => array('controller' => 'registration_edit', 'action' =>
- 'edit_question', 'q_mode' => 'setting')
- ),
- 'role_permissions' => array(
- 'url' => array('controller' => 'registration_block_role_permissions')
- ),
- //'frame_settings' => array(
- // 'url' => array('controller' => 'registration_frame_settings')
- //),
- 'mail_settings' => array(
- 'url' => array('controller' => 'registration_mail_settings')
- ),
- 'answer_list' => array(
- 'url' => array('controller' => 'registration_blocks', 'action' =>
- 'answer_list'),
- 'label' => ['registrations', 'Answer List'],
- ),
+ 'block_index' => array('url' => array('controller' => 'registration_blocks')),
+ 'role_permissions' => array('url' => array('controller' => 'registration_block_role_permissions')),
+ 'frame_settings' => array('url' => array('controller' => 'registration_frame_settings')),
),
),
- 'Blocks.BlockIndex',
- 'NetCommons.NetCommonsForm',
- 'NetCommons.Date',
- 'NetCommons.TitleIcon',
- 'AuthorizationKeys.AuthKeyPopupButton',
);
/**
@@ -125,13 +92,6 @@ class RegistrationBlocksController extends RegistrationsAppController {
public function beforeFilter() {
parent::beforeFilter();
$this->Auth->deny('index');
- // 設定画面を表示する前にこのルームの登録フォームブロックがあるか確認
- // 万が一、まだ存在しない場合には作成しておく
- // afterFrameSaveが呼ばれないような状況の想定
-
- // このタイミングで作るのはやめてみる by Ryuji AMANO
- //$frame['Frame'] = Current::read('Frame');
- //$this->Registration->afterFrameSave($frame);
}
/**
@@ -140,34 +100,26 @@ public function beforeFilter() {
* @return void
*/
public function index() {
- // 未使用のまま残ってるregistraionsのブロックを削除する
- $this->_deleteNotUsedBlocks();
-
+ // 条件設定値取得
+ // 条件設定値取得
$conditions = $this->Registration->getBaseCondition();
- unset($conditions['block_id']);
- unset($conditions['Registration.block_id']);
- $this->Paginator->settings = array(
- 'Registration' => $this->Registration->getBlockIndexSettings([
- 'conditions' => $conditions,
- 'recursive' => 0
- ])
- );
- //$this->Paginator->settings = array(
- // 'Registration' => array(
- // 'order' => array('Registration.id' => 'desc'),
- // 'conditions' => $this->Registration->getBlockConditions($conditions),
- // 'recursive' => 0,
- // )
- //);
- $registrations = $this->Paginator->paginate('Registration');
- if (!$registrations) {
+ // データ取得
+ $this->paginate = array(
+ 'conditions' => $conditions,
+ 'page' => 1,
+ 'sort' => RegistrationsComponent::DISPLAY_SORT_TYPE_NEW_ARRIVALS,
+ 'limit' => RegistrationsComponent::REGISTRATION_DEFAULT_DISPLAY_NUM_PER_PAGE,
+ 'direction' => 'desc',
+ 'recursive' => 0,
+ );
+ $registration = $this->paginate('Registration');
+ if (! $registration) {
$this->view = 'not_found';
return;
}
- $this->set('registrations', $registrations);
- $this->request->data['Frame'] = Current::read('Frame');
+ $this->set('registrations', $registration);
}
/**
@@ -182,19 +134,21 @@ public function download() {
// 登録フォームキー
$registrationKey = $this->_getRegistrationKeyFromPass();
// キー情報をもとにデータを取り出す
- $registration = $this->RegistrationAnswerSummaryCsv->getRegistrationForAnswerCsv(
- $registrationKey);
+ $registration = $this->RegistrationAnswerSummaryCsv->getRegistrationForAnswerCsv($registrationKey);
if (! $registration) {
- $this->_setFlashMessageAndRedirect(
- __d('registrations', 'Designation of the registration does not exist.'));
+ $this->setAction('throwBadRequest');
return;
}
// 圧縮用パスワードキーを求める
if (! empty($this->request->data['AuthorizationKey']['authorization_key'])) {
$zipPassword = $this->request->data['AuthorizationKey']['authorization_key'];
} else {
- $this->_setFlashMessageAndRedirect(
- __d('registrations', 'Setting of password is required always to download answers.'));
+ $this->NetCommons->setFlashNotification(__d('registrations', 'Setting of password is required always to download answers.'),
+ array('interval' => NetCommonsComponent::ALERT_VALIDATE_ERROR_INTERVAL));
+ $this->redirect(NetCommonsUrl::actionUrl(array(
+ 'controller' => 'registration_blocks',
+ 'action' => 'index',
+ 'frame_id' => Current::read('Frame.id'))));
return;
}
@@ -203,29 +157,28 @@ public function download() {
$csvFile = new CsvFileWriter(array(
'folder' => $tmpFolder->path
));
- // ヘッダ出力
- $header = $this->RegistrationAnswerSummaryCsv->getHeader($registration);
- $csvFile->add($header);
-
// 登録データを一気に全部取得するのは、データ爆発の可能性があるので
// REGISTRATION_CSV_UNIT_NUMBER分に制限して取得する
$offset = 0;
do {
- $datas = $this->RegistrationAnswerSummaryCsv->getAnswerSummaryCsv(
- $registration,
- self::REGISTRATION_CSV_UNIT_NUMBER, $offset);
+ $datas = $this->RegistrationAnswerSummaryCsv->getAnswerSummaryCsv($registration, self::REGISTRATION_CSV_UNIT_NUMBER, $offset);
// CSV形式で書きこみ
foreach ($datas as $data) {
$csvFile->add($data);
}
$dataCount = count($datas); // データ数カウント
$offset += $dataCount; // 次の取得開始位置をずらす
- } while ($dataCount === self::REGISTRATION_CSV_UNIT_NUMBER);
+ } while ($dataCount == self::REGISTRATION_CSV_UNIT_NUMBER);
// データ取得数が制限値分だけとれている間は繰り返す
} catch (Exception $e) {
// NetCommonsお約束:エラーメッセージのFlash表示
- $this->_setFlashMessageAndRedirect(__d('registrations', 'download error'));
+ $this->NetCommons->setFlashNotification(__d('registrations', 'download error'),
+ array('interval' => NetCommonsComponent::ALERT_VALIDATE_ERROR_INTERVAL));
+ $this->redirect(NetCommonsUrl::actionUrl(array(
+ 'controller' => 'registration_blocks',
+ 'action' => 'index',
+ 'frame_id' => Current::read('Frame.id'))));
return;
}
// Downloadの時はviewを使用しない
@@ -238,178 +191,63 @@ public function download() {
}
/**
- * 登録一覧
+ * export
+ *
+ * template file about registration export action
*
* @return void
- * @throws InternalErrorException
*/
- public function answer_list() {
+ public function export() {
// NetCommonsお約束:コンテンツ操作のためのURLには対象のコンテンツキーが必ず含まれている
// まずは、そのキーを取り出す
// 登録フォームキー
$registrationKey = $this->_getRegistrationKeyFromPass();
// キー情報をもとにデータを取り出す
- if ($registrationKey) {
- $conditions = [$this->Registration->alias . '.key' => $registrationKey];
- } else {
- // 登録フォームキーが指定されてなければブロックIDから
- $blockId = Current::read('Block.id');
- $conditions = [$this->Registration->alias . '.block_id' => $blockId];
- }
- // 登録一覧は公開されてる登録フォームが対象。
- $conditions = Hash::merge([
- 'Registration.is_active' => true,
- ],
- $conditions);
- $registration = $this->Registration->find('first', array(
- 'conditions' => $conditions,
- 'recursive' => -1
- ));
- //$registration = $this->RegistrationAnswerSummaryCsv->getRegistrationForAnswerCsv(
- // $registrationKey
- //);
-
- if (!$registration) {
- // 公開されてなければメッセージをだして一覧へ
- $this->_setFlashMessageAndRedirect(
- __d('registrations', 'The registration form has not been published.'));
- return;
- }
- $registrationKey = $registration['Registration']['key'];
- $this->set('registration', $registration);
- // 一覧用に登録データを取得する
- $this->Paginator->settings = array_merge(
- $this->Paginator->settings,
- array(
- 'RegistrationAnswerSummary' => [
- 'conditions' => array(
- 'answer_status' => RegistrationsComponent::ACTION_ACT,
- 'test_status' => RegistrationsComponent::TEST_ANSWER_STATUS_PEFORM,
- 'registration_key' => $registrationKey,
- ),
- //'limit' => $this->_frameSetting['BlogFrameSetting']['articles_per_page'],
- 'order' => 'RegistrationAnswerSummary.modified DESC',
- ]
- )
- );
- $summaries = $this->Paginator->paginate('RegistrationAnswerSummary');
- if (empty($summaries)) {
- $this->set('summaries', $summaries);
- return;
- }
-
- // 項目のIDを取得
- $questionIds = Hash::extract(
- $registration['RegistrationPage'],
- '{n}.RegistrationQuestion.{n}.id');
-
- // summary loop
- foreach ($summaries as & $summary) {
- $answers = $this->RegistrationAnswer->getAnswersBySummary($summary, $questionIds);
- $summary['RegistrationAnswer'] = $answers;
- }
- $this->set('summaries', $summaries);
- }
-
-/**
- * delete answer
- *
- * @return void
- */
- public function delete_answer() {
- if (! $this->request->is('delete')) {
- $this->throwBadRequest();
- return;
- }
-
- $registrationKey = $this->_getRegistrationKeyFromPass();
- // 削除処理
- if (! $this->RegistrationAnswerSummary->deleteAnswerSummary($registrationKey)) {
- $this->throwBadRequest();
+ $registration = $this->RegistrationAnswerSummaryCsv->getRegistrationForAnswerCsv($registrationKey);
+ if (! $registration) {
+ $this->setAction('throwBadRequest');
return;
}
- $this->redirect(NetCommonsUrl::actionUrl([
+ try {
+ // zipファイル準備
+ $zipFile = new ZipDownloader();
+
+ // Export用のデータ配列を取得する
+ $zipData = $this->RegistrationExport->getExportData($registrationKey);
+
+ // Export用ファイルデータをZIPファイルに出力する
+ // ※この中でWYSISWYGエディタデータは適宜処理されている
+ $this->RegistrationExport->putToZip($zipFile, $zipData);
+
+ // アーカイブ閉じる
+ $zipFile->close();
+ } catch(Exception $e) {
+ $this->Session->setFlash(__d('registrations', 'export error') . $e->getMessage(),
+ array('interval' => NetCommonsComponent::ALERT_VALIDATE_ERROR_INTERVAL));
+ $this->redirect(NetCommonsUrl::actionUrl(array(
+ 'controller' => 'registration_blocks',
'action' => 'index',
- 'frame_id' => Current::read('Frame.id'),
- ]));
- }
-
-/**
- * 添付ファイルダウンロード
- *
- * @return mixed
- */
- public function download_file() {
- // ここから元コンテンツを取得する処理
- $answerId = $this->params['key'];
- return $this->Download->doDownload(
- $answerId,
- [
- 'field' => 'answer_value_file',
- 'download' => true,
- ]
- );
- }
-
-/**
- * _setFlashMessageAndRedirect
- *
- * @param string $message flash error message
- *
- * @return void
- */
- protected function _setFlashMessageAndRedirect($message) {
- $this->NetCommons->setFlashNotification(
- $message,
- array(
- 'interval' => NetCommonsComponent::ALERT_VALIDATE_ERROR_INTERVAL
- ));
- $this->redirect(NetCommonsUrl::actionUrl(array(
- 'controller' => 'registration_blocks',
- 'action' => 'index',
- 'frame_id' => Current::read('Frame.id')
- )));
- }
-
-/**
- * 24時間以上Registrationと関連づいてないゴミブロックを削除する
- *
- * @return void
- */
- protected function _deleteNotUsedBlocks() {
- // 24時間以上Registrationsと関連づいてないブロックを探す。
- $date = new DateTime(NetCommonsTime::getNowDatetime());
- $date->sub(new DateInterval('P1D'));
-
- $options = [
- 'conditions' => [
- 'Block.plugin_key' => 'registrations',
- 'Registration.id' => null,
- 'Block.modified <' => $date->format('Y-m-d H:i:s'),
- ],
- 'joins' => [
- [
- 'table' => $this->Registration->table,
- 'alias' => $this->Registration->alias,
- 'type' => 'LEFT',
- 'conditions' => array(
- 'Block.id = Registration.block_id',
- )
- ],
- ],
- // ブロックのIDだけ取得できればOK
- 'fields' => ['Block.id']
- ];
-
- $blocks = $this->Block->find('all', $options);
- $blockIds = Hash::extract($blocks, '{n}.Block.id');
- if (empty($blockIds)) {
+ 'frame_id' => Current::read('Frame.id'))));
return;
}
- // 削除実行
- $this->Block->begin();
- $this->Block->deleteAll(['Block.id' => $blockIds]);
- $this->Block->commit();
+ // 大外枠zipファイル準備
+ $zipWrapperFile = new ZipDownloader();
+ // 登録フォームデータファイルのフィンガープリントを得る
+ $fingerPrint = sha1_file($zipFile->path, false);
+ // フィンガープリントをアーカイブに加える
+ $zipWrapperFile->addFromString(RegistrationsComponent::REGISTRATION_FINGER_PRINT_FILENAME, $fingerPrint);
+ // 本体ファイルを
+ $zipWrapperFile->addFile($zipFile->path, RegistrationsComponent::REGISTRATION_TEMPLATE_FILENAME);
+ // export-key 設定
+ $this->Registration->saveExportKey($registration['Registration']['id'], $fingerPrint);
+
+ // viewを使用しない
+ $this->autoRender = false;
+
+ // ダウンロード出力ファイル名確定
+ $exportFileName = $registration['Registration']['title'] . '.zip';
+ // 出力
+ return $zipWrapperFile->download(rawurlencode($exportFileName));
}
}
\ No newline at end of file
diff --git a/Controller/RegistrationEditController.php b/Controller/RegistrationEditController.php
index b573691..c527594 100644
--- a/Controller/RegistrationEditController.php
+++ b/Controller/RegistrationEditController.php
@@ -10,7 +10,6 @@
*/
App::uses('AppController', 'Controller');
-App::uses('MailSetting', 'Mails.Model');
/**
* RegistrationEditController
@@ -27,23 +26,12 @@ class RegistrationEditController extends RegistrationsAppController {
*/
const REGISTRATION_EDIT_SESSION_INDEX = 'Registrations.registrationEdit.';
-/**
- * layout
- *
- * @var array
- */
- public $layout = '';
-
/**
* use model
*
* @var array
*/
public $uses = array(
- // 登録通知メール
- 'Mails.MailSetting',
- //'Mails.MailSettingFixedPhrase',
- 'DataTypes.DataTypeChoice',
);
/**
@@ -59,8 +47,6 @@ class RegistrationEditController extends RegistrationsAppController {
),
),
'Registrations.Registrations',
- 'NetCommons.NetCommonsTime',
- 'Registrations.RegistrationBlockTabs',
);
/**
@@ -69,56 +55,7 @@ class RegistrationEditController extends RegistrationsAppController {
*/
public $helpers = array(
'Workflow.Workflow',
- 'NetCommons.TitleIcon',
- 'Registrations.RegistrationEdit',
- 'NetCommons.Wizard' => array(
- 'navibar' => array(
- 'edit_question' => array(
- 'url' => array(
- 'controller' => 'registration_edit',
- 'action' => 'edit_question',
- ),
- 'label' => array('registrations', 'Set questions'),
- ),
- 'edit' => array(
- 'url' => array(
- 'controller' => 'registration_edit',
- 'action' => 'edit',
- ),
- 'label' => array('registrations', 'Set registration'),
- ),
- ),
- 'cancelUrl' => null
- ),
- 'Wysiwyg.Wysiwyg',
- //'Blocks.BlockTabs' => array(
- // 'mainTabs' => array(
- // 'block_index' => array(
- // 'url' => array('controller' => 'registration_blocks')
- // ),
- // ),
- // 'blockTabs' => array(
- // 'block_settings' => array(
- // 'url' => array('controller' => 'registration_edit', 'action' =>
- // 'edit_question', 'q_mode' => 'setting')
- // ),
- // 'role_permissions' => array(
- // 'url' => array('controller' => 'registration_block_role_permissions')
- // ),
- // 'mail_settings' => array(
- // 'url' => array('controller' => 'registration_mail_settings')
- // ),
- // 'answer_list' => array(
- // 'url' => array('controller' => 'registration_blocks', 'action' =>
- // 'answer_list'),
- // 'label' => ['registrations', 'Answer List'],
- // ),
- // ),
- //),
-
- // 登録通知メール
- //'Blocks.BlockRolePermissionForm',
- //'Mails.MailForm',
+ 'Registrations.QuestionEdit'
);
/**
@@ -139,19 +76,16 @@ class RegistrationEditController extends RegistrationsAppController {
* @return void
*/
public function beforeFilter() {
- // 登録通知メール
- //$this->MailSettings->permission =
- // array('mail_answer_receivable');
- //$this->MailSettings->typeKeys =
- // array(MailSettingFixedPhrase::ANSWER_TYPE); //
-
parent::beforeFilter();
+ // NetCommonsお約束:編集画面へのURLに編集対象のコンテンツキーが含まれている
+ // まずは、そのキーを取り出す
+ // 登録フォームキー
+ $registrationKey = $this->_getRegistrationKeyFromPass();
// セッションインデックスパラメータ
- $sessionName =
- self::REGISTRATION_EDIT_SESSION_INDEX . $this->_getRegistrationEditSessionIndex();
+ $sessionName = self::REGISTRATION_EDIT_SESSION_INDEX . $this->_getRegistrationEditSessionIndex();
- if ($this->request->is('post') || $this->request->is('put')) {
+ if ($this->request->isPost() || $this->request->isPut()) {
// ウィザード画面なのでセッションに記録された前画面データが必要
$this->_registration = $this->Session->read($sessionName);
if (! $this->_registration) {
@@ -163,24 +97,15 @@ public function beforeFilter() {
// セッションに記録された値がある場合はそちらを優先
if ($this->Session->check($sessionName)) {
$this->_registration = $this->Session->read($sessionName);
- } else {
- // NetCommonsお約束:編集画面へのURLに編集対象のコンテンツキーが含まれている
- // まずは、そのキーを取り出す
- // 登録フォームキー
- $registrationKey = $this->_getRegistrationKeyFromPass();
- if ($registrationKey) {
- $conditions = [$this->Registration->alias . '.key' => $registrationKey];
- } else {
- // 登録フォームキーが指定されてなければブロックIDから。編集時にブロックタブから遷移したとき
- $blockId = Current::read('Block.id');
- $conditions = [$this->Registration->alias . '.block_id' => $blockId];
- }
+ } elseif (! empty($registrationKey)) {
// 登録フォームキーの指定がある場合は過去データ編集と判断
// 指定された登録フォームデータを取得
// NetCommonsお約束:履歴を持つタイプのコンテンツデータはgetWorkflowContentsで取り出す
$this->_registration = $this->Registration->getWorkflowContents('first', array(
'recursive' => 0,
- 'conditions' => $conditions
+ 'conditions' => array(
+ $this->Registration->alias . '.key' => $registrationKey
+ )
));
// NetCommonsお約束:編集の場合には改めて編集権限をチェックする必要がある
// getWorkflowContentsはとりあえず自分が「見られる」コンテンツデータを取ってきてしまうので
@@ -189,35 +114,6 @@ public function beforeFilter() {
}
}
}
- if ($this->_registration === null ||
- ! Hash::check($this->_registration, 'Registration.id')) {
- // 登録フォーム新規作成時はブロック設定以外のタブは表示しない
- unset($this->helpers['Blocks.BlockTabs']['blockTabs']['role_permissions']);
- unset($this->helpers['Blocks.BlockTabs']['blockTabs']['mail_settings']);
- unset($this->helpers['Blocks.BlockTabs']['blockTabs']['answer_list']);
- }
- // ここへは設定画面の一覧から来たのか、一般画面の一覧から来たのか
- $this->_decideSettingLayout();
- }
-/**
- * Before render callback. beforeRender is called before the view file is rendered.
- *
- * Overridden in subclasses.
- *
- * @return void
- */
- public function beforeRender() {
- parent::beforeRender();
-
- //ウィザード
- foreach ($this->helpers['NetCommons.Wizard']['navibar'] as &$actions) {
- $urlParam = $actions['url'];
- $urlParam = Hash::merge($urlParam, $this->request->params['named']);
- foreach ($this->request->params['pass'] as $passParam) {
- $urlParam[$passParam] = null;
- }
- $actions['url'] = $urlParam;
- }
}
/**
@@ -234,42 +130,38 @@ public function edit_question() {
}
// Postの場合
- if ($this->request->is('post') || $this->request->is('put')) {
+ if ($this->request->isPost()) {
+
$postRegistration = $this->request->data;
- // 登録フォームデータに作成されたPost項目データをかぶせる
- // (項目作成画面では項目データ属性全てをPOSTしているのですり替えでOK)
+
+ // 登録フォームデータに作成されたPost質問データをかぶせる
+ // (質問作成画面では質問データ属性全てをPOSTしているのですり替えでOK)
$registration = $this->_registration;
- $registration['Registration'] = Hash::merge(
- $this->_registration['Registration'],
- $postRegistration['Registration']);
+ $registration['Registration'] = Hash::merge($this->_registration['Registration'], $postRegistration['Registration']);
- // 発行後の登録フォームは項目情報は書き換えない→アンケートと違っていつでも編集OK
+ // 発行後の登録フォームは質問情報は書き換えない
// 未発行の場合はPostデータを上書き設定して
//if ($this->Registration->hasPublished($registration) == 0) {
// $registration['RegistrationPage'] = $postRegistration['RegistrationPage'];
//} else {
- // $this->Registration->clearRegistrationId($registration, true);
// // booleanの値がPOST時と同じようになるように調整
- // $registration['RegistrationPage'] =
- // RegistrationsAppController::changeBooleansToNumbers(
- // $registration['RegistrationPage']);
+ // $registration['RegistrationPage'] = RegistrationsAppController::changeBooleansToNumbers($registration['RegistrationPage']);
//}
+ // いつも編集OK
$registration['RegistrationPage'] = $postRegistration['RegistrationPage'];
// バリデート
$this->Registration->set($registration);
- if (! $this->Registration->validates(
- array('validate' => RegistrationsComponent::REGISTRATION_VALIDATE_TYPE))) {
+ if (! $this->Registration->validates(array('validate' => 'duringSetup'))) {
$this->__setupViewParameters($registration, '');
return;
}
// バリデートがOKであればPOSTで出来上がったデータをセッションキャッシュに書く
- $this->Session->write(
- self::REGISTRATION_EDIT_SESSION_INDEX . $this->_sessionIndex,
- $registration);
+ $this->Session->write(self::REGISTRATION_EDIT_SESSION_INDEX . $this->_sessionIndex, $registration);
// 次の画面へリダイレクト
+ //$this->redirect($this->_getActionUrl('edit_result'));
$this->redirect($this->_getActionUrl('edit'));
} else {
// 登録フォームデータが取り出せている場合、それをキャッシュに書く
@@ -280,6 +172,43 @@ public function edit_question() {
}
}
+/**
+ * edit_result
+ *
+ * @throws BadRequestException
+ * @return void
+ */
+ public function edit_result() {
+ // 処理対象の登録フォームデータが見つかっていない場合、エラー
+ if (empty($this->_registration)) {
+ $this->throwBadRequest();
+ return;
+ }
+
+ if ($this->request->isPost()) {
+
+ $postRegistration = $this->request->data;
+
+ // 集計設定画面では集計に纏わる情報のみがPOSTされるので安心してマージ
+ $registration = Hash::merge($this->_registration, $postRegistration);
+ // バリデート
+ $this->Registration->set($registration);
+ if (! $this->Registration->validates(array('validate' => 'duringSetup'))) {
+ $this->__setupViewParameters($registration, $this->_getActionUrl('edit_question'));
+ return;
+ }
+ // それをキャッシュに書く
+ $this->Session->write(self::REGISTRATION_EDIT_SESSION_INDEX . $this->_getRegistrationEditSessionIndex(), $registration);
+
+ // 次の画面へリダイレクト
+ $this->redirect($this->_getActionUrl('edit'));
+
+ } else {
+ $this->Session->write(self::REGISTRATION_EDIT_SESSION_INDEX . $this->_getRegistrationEditSessionIndex(), $this->_registration);
+ $this->__setupViewParameters($this->_registration, $this->_getActionUrl('edit_question'));
+ }
+ }
+
/**
* edit method
*
@@ -293,8 +222,7 @@ public function edit() {
return;
}
- if ($this->request->is('post') || $this->request->is('put')) {
-
+ if ($this->request->isPost() || $this->request->isPut()) {
$postRegistration = $this->request->data;
$beforeStatus = $this->_registration['Registration']['status'];
@@ -310,46 +238,20 @@ public function edit() {
// エラー
if ($saveRegistration == false) {
$registration['Registration']['status'] = $beforeStatus;
+ //$this->__setupViewParameters($registration, $this->_getActionUrl('edit_result'));
$this->__setupViewParameters($registration, $this->_getActionUrl('edit_question'));
return;
}
-
// 成功時 セッションに書き溜めた編集情報を削除
- $this->Session->delete(
- self::REGISTRATION_EDIT_SESSION_INDEX . $this->_getRegistrationEditSessionIndex());
-
- if ($this->layout == 'NetCommons.setting') {
- $this->redirect(NetCommonsUrl::backToIndexUrl('default_setting_action'));
- } else {
- // 登録画面(詳細)へリダイレクト
- $action = 'view';
- //if ($saveRegistration['Registration']['status'] == WorkflowComponent::STATUS_PUBLISHED) {
- // $action = 'view';
- //} else {
- // $action = 'test_mode';
- //}
- $urlArray = array(
- 'controller' => 'registration_answers',
- 'action' => $action,
- Current::read('Block.id'),
- $this->_getRegistrationKey($saveRegistration),
- 'frame_id' => Current::read('Frame.id'),
- );
- $this->redirect(NetCommonsUrl::actionUrl($urlArray));
- }
- return;
- } else {
- // 登録通知メール
+ $this->Session->delete(self::REGISTRATION_EDIT_SESSION_INDEX . $this->_getRegistrationEditSessionIndex());
+ // ページトップへリダイレクト
+ $this->redirect(NetCommonsUrl::backToPageUrl());
+ } else {
// 指定されて取り出した登録フォームデータをセッションキャッシュに書く
- $this->Session->write(
- $this->_getRegistrationEditSessionIndex(),
- $this->_registration);
+ $this->Session->write($this->_getRegistrationEditSessionIndex(), $this->_registration);
$this->__setupViewParameters($this->_registration, $this->_getActionUrl('edit_question'));
}
- $registrationKey = $this->_registration['Registration']['key'];
- $comments = $this->Registration->getCommentsByContentKey($registrationKey);
- $this->set('comments', $comments);
}
/**
@@ -358,7 +260,7 @@ public function edit() {
* @return void
*/
public function delete() {
- if (! $this->request->is('delete')) {
+ if (! $this->request->isDelete()) {
$this->throwBadRequest();
return;
}
@@ -377,11 +279,7 @@ public function delete() {
$this->Session->delete(self::REGISTRATION_EDIT_SESSION_INDEX . $this->_sessionIndex);
- if ($this->layout == 'NetCommons.setting') {
- $this->redirect(NetCommonsUrl::backToIndexUrl('default_setting_action'));
- } else {
- $this->redirect(NetCommonsUrl::backToPageUrl());
- }
+ $this->redirect(NetCommonsUrl::backToPageUrl());
}
/**
@@ -400,18 +298,14 @@ public function cancel() {
* @return void
*/
protected function _getActionUrl($method) {
- $urlArray = array(
+ return NetCommonsUrl::actionUrl(array(
'controller' => Inflector::underscore($this->name),
'action' => $method,
Current::read('Block.id'),
$this->_getRegistrationKey($this->_registration),
'frame_id' => Current::read('Frame.id'),
's_id' => $this->_getRegistrationEditSessionIndex()
- );
- if ($this->layout == 'NetCommons.setting') {
- $urlArray['q_mode'] = 'setting';
- }
- return NetCommonsUrl::actionUrl($urlArray);
+ ));
}
/**
* __setupViewParameters method
@@ -421,9 +315,9 @@ protected function _getActionUrl($method) {
* @return void
*/
private function __setupViewParameters($registration, $backUrl) {
- //$isPublished = $this->Registration->hasPublished($registration);
+ $isPublished = $this->Registration->hasPublished($registration);
- // エラーメッセージはページ、項目、選択肢要素のそれぞれの場所に割り当てる
+ // エラーメッセージはページ、質問、選択肢要素のそれぞれの場所に割り当てる
$this->NetCommons->handleValidationError($this->Registration->validationErrors);
$flatError = Hash::flatten($this->Registration->validationErrors);
$newFlatError = array();
@@ -433,61 +327,24 @@ private function __setupViewParameters($registration, $backUrl) {
}
}
$registration = Hash::merge($registration, Hash::expand($newFlatError));
- $registration = $this->NetCommonsTime->toUserDatetimeArray(
- $registration,
- array(
- 'Registration.answer_start_period',
- 'Registration.answer_end_period',
- 'Registration.total_show_start_period',
- ));
+ $this->set('backUrl', $backUrl);
$this->set('postUrl', array('url' => $this->_getActionUrl($this->action)));
- if ($this->layout == 'NetCommons.setting') {
- $this->set('cancelUrl', array('url' => NetCommonsUrl::backToIndexUrl('default_setting_action')));
- } else {
- $this->set('cancelUrl', array('url' => NetCommonsUrl::backToPageUrl()));
- }
- $this->set('deleteUrl', array('url' => $this->_getActionUrl('delete')));
-
+ $this->set('cancelUrl', $this->_getActionUrl('cancel'));
$this->set('questionTypeOptions', $this->Registrations->getQuestionTypeOptionsWithLabel());
-
- // 都道府県データ
- $prefectures = $this->_getPrefectures();
- $this->set('prefectures', $prefectures);
+ $this->set('newPageLabel', __d('registrations', 'page'));
+ $this->set('newQuestionLabel', __d('registrations', 'New Question'));
+ $this->set('newChoiceLabel', __d('registrations', 'new choice'));
+ $this->set('newChoiceColumnLabel', __d('registrations', 'new column choice'));
+ $this->set('newChoiceOtherLabel', __d('registrations', 'other choice'));
//$this->set('isPublished', $isPublished);
$this->set('isPublished', false);
-
$this->request->data = $registration;
$this->request->data['Frame'] = Current::read('Frame');
$this->request->data['Block'] = Current::read('Block');
- // メール通知設定
- //$conditions = [
- // 'plugin_key' => 'registrations',
- // 'block_key' => Current::read('Block.key')
- //];
- //$mailSetting = $this->MailSetting->find('first', ['conditions' => $conditions]);
- //$this->set('mailSetting', $mailSetting);
- }
-
-/**
- * DataTypeから都道府県データを取得してJSON形式で返す
- *
- * @return string json形式の都道府県リスト
- */
- protected function _getPrefectures() {
- // メタデータから取得
- $options = [
- 'conditions' => [
- 'data_type_key' => 'prefecture',
- 'language_id' => Current::read('Language.id'),
- ],
- 'order' => 'DataTypeChoice.weight ASC'
- ];
- $prefectures = $this->DataTypeChoice->find('all', $options);
- $prefectures = Hash::extract($prefectures, '{n}.DataTypeChoice.name');
- // json形式にする
- $prefectures = json_encode($prefectures);
- return $prefectures;
+ // ? FUJI いる?
+ //$this->set('contentStatus', $registration['Registration']['status']);
+ //$this->set('comments', $this->Registration->getCommentsByContentKey($registration['Registration']['key']));
}
}
diff --git a/Controller/RegistrationFrameSettingsController.php b/Controller/RegistrationFrameSettingsController.php
new file mode 100644
index 0000000..671219d
--- /dev/null
+++ b/Controller/RegistrationFrameSettingsController.php
@@ -0,0 +1,138 @@
+
+ * @author Allcreator
+ * @link http://www.netcommons.org NetCommons Project
+ * @license http://www.netcommons.org/license.txt NetCommons License
+ * @copyright Copyright 2014, NetCommons Project
+ */
+
+App::uses('RegistrationBlocksController', 'Registrations.Controller');
+
+/**
+ * RegistrationFrameSettingsController
+ *
+ * @author Allcreator
+ * @package NetCommons\Registrations\Controller
+ *
+ * @property RegistrationFrameSetting RegistrationFrameSetting
+ */
+class RegistrationFrameSettingsController extends RegistrationBlocksController {
+
+/**
+ * layout
+ *
+ * @var array
+ */
+ public $layout = 'NetCommons.setting';
+
+/**
+ * use model
+ *
+ * @var array
+ */
+ public $uses = array(
+ 'Blocks.Block',
+ 'Frames.Frame',
+ 'Registrations.Registration',
+ 'Registrations.RegistrationFrameSetting',
+ 'Registrations.RegistrationFrameDisplayRegistration',
+ );
+
+/**
+ * use components
+ *
+ * @var array
+ */
+ public $components = array(
+ 'NetCommons.Permission' => array(
+ //アクセスの権限
+ 'allow' => array(
+ 'edit' => 'page_editable',
+ ),
+ ),
+ 'Registrations.Registrations',
+ 'Paginator',
+ );
+
+/**
+ * use helpers
+ *
+ * @var array
+ */
+ public $helpers = array(
+ 'NetCommons.Date',
+ 'Registrations.RegistrationUtil',
+ 'Blocks.BlockTabs' => array(
+ 'mainTabs' => array(
+ 'block_index' => array('url' => array('controller' => 'registration_blocks')),
+ 'role_permissions' => array('url' => array('controller' => 'registration_block_role_permissions')),
+ 'frame_settings' => array('url' => array('controller' => 'registration_frame_settings')),
+ ),
+ ),
+
+ );
+
+/**
+ * edit method
+ *
+ * @return void
+ */
+ public function edit() {
+ // Postデータ登録
+ if ($this->request->isPut() || $this->request->isPost()) {
+ if ($this->RegistrationFrameSetting->saveFrameSettings($this->request->data)) {
+ $this->NetCommons->setFlashNotification(__d('net_commons', 'Successfully saved.'), array(
+ 'class' => 'success',
+ ));
+ $this->redirect(NetCommonsUrl::backToPageUrl());
+ return;
+ }
+ $this->NetCommons->handleValidationError($this->RegistrationFrameSetting->validationErrors);
+ }
+
+ $conditions = array(
+ 'block_id' => Current::read('Block.id'),
+ 'is_latest' => true,
+ );
+ $this->paginate = array(
+ 'fields' => array('Registration.*', 'RegistrationFrameDisplayRegistration.*'),
+ 'conditions' => $conditions,
+ 'page' => 1,
+ 'sort' => RegistrationsComponent::DISPLAY_SORT_TYPE_NEW_ARRIVALS,
+ 'limit' => 1000,
+ 'direction' => 'desc',
+ 'recursive' => -1,
+ 'joins' => array(
+ array(
+ 'table' => 'registration_frame_display_registrations',
+ 'alias' => 'RegistrationFrameDisplayRegistration',
+ 'type' => 'LEFT',
+ 'conditions' => array(
+ 'RegistrationFrameDisplayRegistration.registration_key = Registration.key',
+ 'RegistrationFrameDisplayRegistration.frame_key' => Current::read('Frame.key'),
+ ),
+ )
+ )
+ );
+ $registrations = $this->paginate('Registration');
+
+ $frame = $this->RegistrationFrameSetting->find('first', array(
+ 'conditions' => array(
+ 'frame_key' => Current::read('Frame.key'),
+ ),
+ 'order' => 'RegistrationFrameSetting.id DESC'
+ ));
+ if (!$frame) {
+ $frame = $this->RegistrationFrameSetting->getDefaultFrameSetting();
+ }
+
+ $this->set('registrations', $registrations);
+ $this->set('registrationFrameSettings', $frame['RegistrationFrameSetting']);
+ $this->request->data['RegistrationFrameSetting'] = $frame['RegistrationFrameSetting'];
+ $this->request->data['Frame'] = Current::read('Frame');
+ $this->request->data['Block'] = Current::read('Block');
+ }
+}
\ No newline at end of file
diff --git a/Controller/RegistrationMailSettingsController.php b/Controller/RegistrationMailSettingsController.php
deleted file mode 100644
index 1d1329d..0000000
--- a/Controller/RegistrationMailSettingsController.php
+++ /dev/null
@@ -1,77 +0,0 @@
-
- * @author AllCreator
- * @link http://www.netcommons.org NetCommons Project
- * @license http://www.netcommons.org/license.txt NetCommons License
- * @copyright Copyright 2014, NetCommons Project
- */
-
-App::uses('MailSettingsController', 'Mails.Controller');
-App::uses('MailSettingFixedPhrase', 'Mails.Model');
-
-/**
- * Registration Mail Setting Controller
- *
- * @author AllCreator
- * @package NetCommons\Registrations\Controller
- */
-class RegistrationMailSettingsController extends MailSettingsController {
-
-/**
- * use helpers
- *
- * @var array
- */
- public $helpers = array(
- 'Blocks.BlockRolePermissionForm',
- 'Blocks.BlockTabs' => array(
- 'mainTabs' => array(
- 'block_index' => array(
- 'url' => array('controller' => 'registration_blocks')
- ),
- ),
- 'blockTabs' => array(
- 'block_settings' => array(
- 'url' => array('controller' => 'registration_edit', 'action' =>
- 'edit_question', 'q_mode' => 'setting')
- ),
- 'role_permissions' => array(
- 'url' => array('controller' => 'registration_block_role_permissions')
- ),
- 'mail_settings' => array(
- 'url' => array('controller' => 'registration_mail_settings')
- ),
- 'answer_list' => array(
- 'url' => array('controller' => 'registration_blocks', 'action' =>
- 'answer_list'),
- 'label' => ['registrations', 'Answer List'],
- ),
- ),
- ),
- 'Mails.MailForm',
- );
-
-/**
- * beforeFilter
- *
- * @return void
- * @see NetCommonsAppController::beforeFilter()
- */
- public function beforeFilter() {
- parent::beforeFilter();
- // 親クラスが独自コントローラのためcomponentsがマージされないので自分で読みこむ。
- $this->RegistrationBlockTabs =
- $this->Components->load('Registrations.RegistrationBlockTabs');
-
- // メール設定 多段の場合にセット
- $this->MailSettings->permission =
- array('mail_content_receivable', 'mail_answer_receivable');
- $this->MailSettings->typeKeys =
- array(MailSettingFixedPhrase::DEFAULT_TYPE, MailSettingFixedPhrase::ANSWER_TYPE);
-
- $this->backUrl = NetCommonsUrl::backToIndexUrl('default_setting_action');
- }
-}
diff --git a/Controller/RegistrationsAppController.php b/Controller/RegistrationsAppController.php
index 16619d5..5850e75 100644
--- a/Controller/RegistrationsAppController.php
+++ b/Controller/RegistrationsAppController.php
@@ -53,18 +53,15 @@ protected function _sorted($obj) {
if (!Hash::check($obj, 'RegistrationPage.{n}')) {
return $obj;
}
- $obj['RegistrationPage'] =
- Hash::sort($obj['RegistrationPage'], '{n}.page_sequence', 'asc', 'numeric');
+ $obj['RegistrationPage'] = Hash::sort($obj['RegistrationPage'], '{n}.page_sequence', 'asc', 'numeric');
foreach ($obj['RegistrationPage'] as &$page) {
- if (Hash::check($page, 'RegistrationQuestion.{n}')) {
- $page['RegistrationQuestion'] =
- Hash::sort($page['RegistrationQuestion'], '{n}.question_sequence', 'asc', 'numeric');
+ if (!Hash::check($page, 'RegistrationQuestion.{n}')) {
+ $page['RegistrationQuestion'] = Hash::sort($page['RegistrationQuestion'], '{n}.question_sequence', 'asc', 'numeric');
foreach ($page['RegistrationQuestion'] as &$question) {
- if (Hash::check($question, 'RegistrationChoice.{n}')) {
- $question['RegistrationChoice'] =
- Hash::sort($question['RegistrationChoice'], '{n}.choice_sequence', 'asc', 'numeric');
+ if (!Hash::check($question, 'RegistrationChoice.{n}')) {
+ $question['RegistrationChoice'] = Hash::sort($question['RegistrationChoice'], '{n}.choice_sequence', 'asc', 'numeric');
}
}
}
@@ -100,22 +97,6 @@ public static function converter(&$value, $key) {
}
}
-/**
- * _decideSettingLayout
- *
- * セッティング系の画面からの流れなのかどうかを判断し、レイアウトを決める
- *
- * @return void
- */
- protected function _decideSettingLayout() {
- $isSetting = Hash::get($this->request->params, 'named.q_mode');
- if ($isSetting == 'setting') {
- if (Current::permission('block_editable')) {
- $this->layout = 'NetCommons.setting';
- }
- return;
- }
- }
/**
* isAbleTo
* Whether access to survey of the specified ID
@@ -163,18 +144,16 @@ public function isAbleTo($registration) {
return false;
}
- $quest = $registration['Registration'];
-
// 基本、権限上、見ることができるコンテンツだ
// しかし、登録フォーム独自の条件部分のチェックを行う必要がある
// 期間外
- if ($quest['answer_timing'] == RegistrationsComponent::USES_USE
- && $quest['period_range_stat'] != RegistrationsComponent::REGISTRATION_PERIOD_STAT_IN) {
+ if ($registration['Registration']['public_type'] == WorkflowBehavior::PUBLIC_TYPE_LIMITED
+ && $registration['Registration']['period_range_stat'] != RegistrationsComponent::REGISTRATION_PERIOD_STAT_IN) {
return false;
}
// 会員以外には許していないのに未ログイン
- if ($quest['is_no_member_allow'] == RegistrationsComponent::PERMISSION_NOT_PERMIT) {
+ if ($registration['Registration']['is_no_member_allow'] == RegistrationsComponent::PERMISSION_NOT_PERMIT) {
if (! Current::read('User.id')) {
return false;
}
@@ -196,13 +175,12 @@ public function isAbleTo($registration) {
* @return bool
*/
public function isAbleToAnswer($registration) {
- $quest = $registration['Registration'];
- if ($quest['status'] != WorkflowComponent::STATUS_PUBLISHED) {
+ if ($registration['Registration']['status'] != WorkflowComponent::STATUS_PUBLISHED) {
return true;
}
// 繰り返し登録を許していないのにすでに登録済みか
- if ($quest['is_repeat_allow'] == RegistrationsComponent::PERMISSION_NOT_PERMIT) {
- if ($this->RegistrationsOwnAnswer->checkOwnAnsweredKeys($quest['key'])) {
+ if ($registration['Registration']['is_repeat_allow'] == RegistrationsComponent::PERMISSION_NOT_PERMIT) {
+ if ($this->RegistrationsOwnAnswer->checkOwnAnsweredKeys($registration['Registration']['key'])) {
return false;
}
}
@@ -216,9 +194,8 @@ public function isAbleToAnswer($registration) {
* @return bool
*/
public function isAbleToDisplayAggregatedData($registration) {
- $quest = $registration['Registration'];
// 集計表示許さているか
- if ($quest['is_total_show'] != RegistrationsComponent::EXPRESSION_SHOW) {
+ if ($registration['Registration']['is_total_show'] != RegistrationsComponent::EXPRESSION_SHOW) {
return false;
}
@@ -229,24 +206,17 @@ public function isAbleToDisplayAggregatedData($registration) {
// 集計表示に期間設定しているか
// 期間設定がある
- if ($quest['total_show_timing'] == RegistrationsComponent::USES_USE) {
+ if ($registration['Registration']['total_show_timing'] == RegistrationsComponent::USES_USE) {
$nowDatetime = (new NetCommonsTime())->getNowDatetime();
// まだ公開期間ではない
- if (strtotime($nowDatetime) < strtotime($quest['total_show_start_period'])) {
- return false;
- }
- }
-
- // 会員以外には許していないのに未ログイン
- if ($quest['is_no_member_allow'] == RegistrationsComponent::PERMISSION_NOT_PERMIT) {
- if (! Current::read('User.id')) {
+ if (strtotime($nowDatetime) < strtotime($registration['Registration']['total_show_start_period'])) {
return false;
}
}
// していない または 公開期間内
// 本人登録があるかどうがか表示有無の判断基準
- if (! $this->RegistrationsOwnAnswer->checkOwnAnsweredKeys($quest['key'])) {
+ if (! $this->RegistrationsOwnAnswer->checkOwnAnsweredKeys($registration['Registration']['key'])) {
//本人による「登録」データなし
return false; // 見てはいけない
}
@@ -260,12 +230,11 @@ public function isAbleToDisplayAggregatedData($registration) {
* @return string
*/
protected function _getRegistrationKeyFromPass() {
- if (isset($this->params['key'])) {
- $key = $this->params['key'];
- if (strpos($key, 's_id:') === 0) {
+ if (isset($this->params['pass'][RegistrationsComponent::REGISTRATION_KEY_PASS_INDEX])) {
+ if (strpos($this->params['pass'][RegistrationsComponent::REGISTRATION_KEY_PASS_INDEX], 's_id:') === 0) {
return '';
}
- return $key;
+ return $this->params['pass'][RegistrationsComponent::REGISTRATION_KEY_PASS_INDEX];
}
return '';
}
diff --git a/Controller/RegistrationsController.php b/Controller/RegistrationsController.php
index 8c0e5cc..c8d2a06 100644
--- a/Controller/RegistrationsController.php
+++ b/Controller/RegistrationsController.php
@@ -27,7 +27,8 @@ class RegistrationsController extends RegistrationsAppController {
* @var array
*/
public $uses = array(
- //'Registrations.RegistrationFrameSetting',
+ 'Registrations.RegistrationFrameSetting',
+ 'Registrations.RegistrationFrameDisplayRegistration',
);
/**
@@ -57,7 +58,6 @@ class RegistrationsController extends RegistrationsAppController {
'NetCommons.Date',
'NetCommons.DisplayNumber',
'NetCommons.Button',
- 'NetCommons.TitleIcon',
'Registrations.RegistrationStatusLabel',
'Registrations.RegistrationUtil'
);
@@ -81,8 +81,44 @@ public function index() {
if (Current::permission('content_creatable')) {
// 追加ボタン表示
$this->view = 'Registrations/noRegistration';
+ return;
} else {
$this->setAction('emptyRender');
+ return;
+ }
+ //if (! $this->FaqQuestion->canCreateWorkflowContent()) {
+ // $this->throwBadRequest();
+ // return false;
+ //}
+ // 表示方法設定値取得
+ list(, $displayNum, $sort, $dir) =
+ $this->RegistrationFrameSetting->getRegistrationFrameSetting(Current::read('Frame.key'));
+
+ // 条件設定値取得
+ $conditions = $this->Registration->getCondition();
+
+ // データ取得
+ $this->Paginator->settings = array_merge(
+ $this->Paginator->settings,
+ array(
+ 'conditions' => $conditions,
+ 'page' => 1,
+ 'sort' => $sort,
+ 'limit' => $displayNum,
+ 'direction' => $dir,
+ 'recursive' => 0,
+ )
+ );
+ if (!isset($this->params['named']['answer_status'])) {
+ $this->request->params['named']['answer_status'] = RegistrationsComponent::REGISTRATION_ANSWER_VIEW_ALL;
+ }
+ $registration = $this->paginate('Registration', $this->_getPaginateFilter());
+ $this->set('registrations', $registration);
+
+ $this->__setOwnAnsweredKeys();
+
+ if (count($registration) == 0) {
+ $this->view = 'Registrations/noRegistration';
}
}
@@ -94,23 +130,19 @@ public function index() {
protected function _getPaginateFilter() {
$filter = array();
- $answerStat = $this->request->params['named']['answer_status'];
-
- if ($answerStat == RegistrationsComponent::REGISTRATION_ANSWER_TEST) {
+ if ($this->request->params['named']['answer_status'] == RegistrationsComponent::REGISTRATION_ANSWER_TEST) {
$filter = array(
'Registration.status !=' => WorkflowComponent::STATUS_PUBLISHED
);
return $filter;
}
- $filterCondition = array(
- 'Registration.key' => $this->RegistrationsOwnAnswer->getOwnAnsweredKeys()
- );
- if ($answerStat == RegistrationsComponent::REGISTRATION_ANSWER_UNANSWERED) {
+ $filterCondition = array('Registration.key' => $this->RegistrationsOwnAnswer->getOwnAnsweredKeys());
+ if ($this->request->params['named']['answer_status'] == RegistrationsComponent::REGISTRATION_ANSWER_UNANSWERED) {
$filter = array(
'NOT' => $filterCondition
);
- } elseif ($answerStat == RegistrationsComponent::REGISTRATION_ANSWER_ANSWERED) {
+ } elseif ($this->request->params['named']['answer_status'] == RegistrationsComponent::REGISTRATION_ANSWER_ANSWERED) {
$filter = array(
$filterCondition
);
@@ -118,4 +150,20 @@ protected function _getPaginateFilter() {
return $filter;
}
+
+/**
+ * Set view value of answered registration keys
+ *
+ * @return void
+ */
+ private function __setOwnAnsweredKeys() {
+ if ($this->request->params['named']['answer_status'] == RegistrationsComponent::REGISTRATION_ANSWER_UNANSWERED) {
+ $this->set('ownAnsweredKeys', array());
+
+ return;
+ }
+
+ $this->set('ownAnsweredKeys', $this->RegistrationsOwnAnswer->getOwnAnsweredKeys());
+ }
+
}
\ No newline at end of file
diff --git a/Lib/empty b/Lib/empty
new file mode 100644
index 0000000..e69de29
diff --git a/Locale/eng/LC_MESSAGES/registrations.po b/Locale/eng/LC_MESSAGES/registrations.po
deleted file mode 100644
index e812ff6..0000000
--- a/Locale/eng/LC_MESSAGES/registrations.po
+++ /dev/null
@@ -1,825 +0,0 @@
-# LANGUAGE translation of CakePHP Application
-# Copyright YEAR NAME
-#
-#, fuzzy
-msgid ""
-msgstr ""
-"Project-Id-Version: PROJECT VERSION\n"
-"PO-Revision-Date: YYYY-mm-DD HH:MM+ZZZZ\n"
-"Last-Translator: NAME \n"
-"Language-Team: LANGUAGE \n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=utf-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
-
-#: Registrations/Controller/RegistrationBlocksController.php:188
-#: Registrations/Test/Case/Controller/RegistrationBlocksController/DownloadTest.php:169
-msgid "Designation of the registration does not exist."
-msgstr ""
-
-#: Registrations/Controller/RegistrationBlocksController.php:196
-#: Registrations/Test/Case/Controller/RegistrationBlocksController/DownloadTest.php:196
-msgid "Setting of password is required always to download answers."
-msgstr ""
-
-#: Registrations/Controller/RegistrationBlocksController.php:223
-#: Registrations/Test/Case/Controller/RegistrationBlocksController/DownloadTest.php:226
-msgid "download error"
-msgstr ""
-
-#: Registrations/Controller/RegistrationBlocksController.php:271
-msgid "The registration form has not been published."
-msgstr ""
-
-#: Registrations/Controller/RegistrationEditController.php:453
-#: Registrations/View/Elements/scripts.ctp:18
-msgid "page"
-msgstr ""
-
-#: Registrations/Controller/RegistrationEditController.php:454
-#: Registrations/Model/RegistrationQuestion.php:235
-#: Registrations/Test/Case/Controller/RegistrationEditController/DeleteTest.php:115
-#: Registrations/Test/Case/Controller/RegistrationEditController/EditQuestionTest.php:122
-#: Registrations/Test/Case/Controller/RegistrationEditController/EditTest.php:126
-#: Registrations/Test/Case/Model/RegistrationQuestion/GetDefaultQuestionTest.php:91
-#: Registrations/View/Elements/scripts.ctp:19
-msgid "New Question"
-msgstr ""
-
-#: Registrations/Controller/RegistrationEditController.php:455
-#: Registrations/Model/RegistrationChoice.php:130
-#: Registrations/Test/Case/Controller/RegistrationEditController/DeleteTest.php:127
-#: Registrations/Test/Case/Controller/RegistrationEditController/EditQuestionTest.php:134
-#: Registrations/Test/Case/Controller/RegistrationEditController/EditTest.php:138
-#: Registrations/Test/Case/Model/RegistrationChoice/GetDefaultChoiceTest.php:90
-#: Registrations/View/Elements/scripts.ctp:20
-msgid "new choice"
-msgstr ""
-
-#: Registrations/Controller/RegistrationEditController.php:456
-#: Registrations/View/Elements/scripts.ctp:21
-msgid "new column choice"
-msgstr ""
-
-#: Registrations/Controller/RegistrationEditController.php:457
-#: Registrations/View/Elements/scripts.ctp:22
-msgid "other choice"
-msgstr ""
-
-#: Registrations/Controller/Component/RegistrationsComponent.php:484
-msgid "End period"
-msgstr ""
-
-#: Registrations/Model/ActionRegistrationAdd.php:54
-#: Registrations/Test/Case/Controller/RegistrationAddController/AddTest.php:289
-msgid "Please choose create option."
-msgstr ""
-
-#: Registrations/Model/ActionRegistrationAdd.php:62
-#: Registrations/Model/Registration.php:162
-#: Registrations/Test/Case/Controller/RegistrationAddController/AddTest.php:296
-#: Registrations/Test/Case/Controller/RegistrationEditController/EditTest.php:431
-#: Registrations/View/RegistrationBlocks/index.ctp:45
-#: Registrations/View/RegistrationEdit/edit.ctp:53
-msgid "Title"
-msgstr ""
-
-#: Registrations/Model/ActionRegistrationAdd.php:71;75
-#: Registrations/Test/Case/Controller/RegistrationAddController/AddTest.php:303;310
-msgid "Please select past registration."
-msgstr ""
-
-#: Registrations/Model/ActionRegistrationAdd.php:233
-msgid "Thank you for registering."
-msgstr ""
-
-#: Registrations/Model/ActionRegistrationAdd.php:271
-msgid "Please input template file."
-msgstr ""
-
-#: Registrations/Model/ActionRegistrationAdd.php:285;292;301
-msgid "illegal import file."
-msgstr ""
-
-#: Registrations/Model/ActionRegistrationAdd.php:312
-msgid "file upload error."
-msgstr ""
-
-#: Registrations/Model/ActionRegistrationAdd.php:319
-msgid "version is different."
-msgstr ""
-
-#: Registrations/Model/Registration.php:181
-msgid "if you set the period, please set time."
-msgstr ""
-
-#: Registrations/Model/Registration.php:187;193
-msgid "Invalid datetime format."
-msgstr ""
-
-#: Registrations/Model/Registration.php:197
-#: Registrations/Test/Case/Controller/RegistrationEditController/EditTest.php:445;452
-msgid "start period must be smaller than end period"
-msgstr ""
-
-#: Registrations/Model/Registration.php:255
-msgid "if you set the use key phrase period, please set key phrase text."
-msgstr ""
-
-#: Registrations/Model/Registration.php:266;289
-msgid "Authentication key setting , image authentication , either only one can not be selected."
-msgstr ""
-
-#: Registrations/Model/Registration.php:319
-msgid "please set at least one page."
-msgstr ""
-
-#: Registrations/Model/Registration.php:575
-msgid "%s started"
-msgstr ""
-
-#: Registrations/Model/RegistrationAnswer.php:126
-#: Registrations/Test/Case/Model/RegistrationAnswer/ValidateAnswerDatetimeTest.php:79
-#: Registrations/Test/Case/Model/RegistrationAnswer/ValidateAnswerMultipleMatrixTest.php:92
-#: Registrations/Test/Case/Model/RegistrationAnswer/ValidateAnswerMultipleSelectTest.php:67
-#: Registrations/Test/Case/Model/RegistrationAnswer/ValidateAnswerSingleMatrixTest.php:92
-#: Registrations/Test/Case/Model/RegistrationAnswer/ValidateAnswerSingleSelectTest.php:67
-#: Registrations/Test/Case/Model/RegistrationAnswer/ValidateAnswerTextAreaTest.php:65
-#: Registrations/Test/Case/Model/RegistrationAnswer/ValidateAnswerTextTest.php:71
-msgid "Input required"
-msgstr ""
-
-#: Registrations/Model/RegistrationAnswer.php:134
-#: Registrations/Test/Case/Model/RegistrationAnswer/ValidateAnswerTextAreaTest.php:63
-#: Registrations/Test/Case/Model/RegistrationAnswer/ValidateAnswerTextTest.php:69
-msgid "the answer is too long. Please enter under %d letters."
-msgstr ""
-
-#: Registrations/Model/RegistrationAnswerSummary.php:460
-#: Registrations/View/RegistrationAnswers/thanks.ctp:27
-#: Registrations/View/RegistrationBlocks/answer_list.ctp:15
-msgid "RegistrationAnswerSummary ID"
-msgstr ""
-
-#: Registrations/Model/RegistrationAnswerSummaryCsv.php:205
-#: Registrations/Test/Case/Model/RegistrationAnswerSummaryCsv/GetAnswerSummaryCsvTest.php:257;305;309;327
-msgid "Respondent"
-msgstr ""
-
-#: Registrations/Model/RegistrationAnswerSummaryCsv.php:206
-#: Registrations/Test/Case/Model/RegistrationAnswerSummaryCsv/GetAnswerSummaryCsvTest.php:257;305;309;327
-msgid "Answer Date"
-msgstr ""
-
-#: Registrations/Model/RegistrationAnswerSummaryCsv.php:207
-#: Registrations/Test/Case/Model/RegistrationAnswerSummaryCsv/GetAnswerSummaryCsvTest.php:257;305;309;327
-msgid "Number"
-msgstr ""
-
-#: Registrations/Model/RegistrationAnswerSummaryCsv.php:283
-#: Registrations/Test/Case/Model/RegistrationAnswerSummaryCsv/GetAnswerSummaryCsvTest.php:315;321
-msgid "Anonymity"
-msgstr ""
-
-#: Registrations/Model/RegistrationAnswerSummaryCsv.php:286
-msgid "Guest"
-msgstr ""
-
-#: Registrations/Model/RegistrationChoice.php:80
-#: Registrations/Test/Case/Model/RegistrationChoice/SaveRegistrationChoiceTest.php:157
-msgid "Please input choice text."
-msgstr ""
-
-#: Registrations/Model/RegistrationChoice.php:84
-#: Registrations/Test/Case/Model/RegistrationChoice/SaveRegistrationChoiceTest.php:159
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_before_published/matrix_choice_option.ctp:94
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_before_published/simple_choice_option.ctp:125
-msgid "You can not use the character of |, : for choice text "
-msgstr ""
-
-#: Registrations/Model/RegistrationChoice.php:101
-#: Registrations/Test/Case/Model/RegistrationChoice/SaveRegistrationChoiceTest.php:163
-msgid "choice sequence is illegal."
-msgstr ""
-
-#: Registrations/Model/RegistrationChoice.php:107
-#: Registrations/Test/Case/Model/RegistrationChoice/SaveRegistrationChoiceTest.php:165
-msgid "First character is \"#\". And input the hexadecimal numbers by six digits."
-msgstr ""
-
-#: Registrations/Model/RegistrationChoice.php:186
-#: Registrations/Test/Case/Model/RegistrationChoice/SaveRegistrationChoiceTest.php:169
-msgid "Invalid skip page. Please set forward page."
-msgstr ""
-
-#: Registrations/Model/RegistrationChoice.php:191
-#: Registrations/Test/Case/Model/RegistrationChoice/SaveRegistrationChoiceTest.php:167;171
-msgid "Invalid skip page. page does not exist."
-msgstr ""
-
-#: Registrations/Model/RegistrationPage.php:99
-#: Registrations/Test/Case/Controller/RegistrationEditController/DeleteTest.php:109
-#: Registrations/Test/Case/Controller/RegistrationEditController/EditQuestionTest.php:116
-#: Registrations/Test/Case/Controller/RegistrationEditController/EditTest.php:120
-#: Registrations/Test/Case/Model/RegistrationPage/GetDefaultPageTest.php:90
-msgid "First Page"
-msgstr ""
-
-#: Registrations/Model/RegistrationPage.php:221
-#: Registrations/Test/Case/Model/RegistrationAnswer/SaveAnswerTest.php:448
-#: Registrations/Test/Case/Model/RegistrationPage/SaveRegistrationPageTest.php:190
-msgid "page sequence is illegal."
-msgstr ""
-
-#: Registrations/Model/RegistrationPage.php:241
-#: Registrations/Test/Case/Model/RegistrationAnswer/SaveAnswerTest.php:450
-#: Registrations/Test/Case/Model/RegistrationPage/SaveRegistrationPageTest.php:192
-msgid "please set at least one question."
-msgstr ""
-
-#: Registrations/Model/RegistrationQuestion.php:118
-msgid "question sequence is illegal."
-msgstr ""
-
-#: Registrations/Model/RegistrationQuestion.php:130
-msgid "Please input question text."
-msgstr ""
-
-#: Registrations/Model/RegistrationQuestion.php:179;189
-#: Registrations/Test/Case/Model/RegistrationQuestion/SaveRegistrationQuestionTest.php:225
-msgid "Please enter both the maximum and minimum values."
-msgstr ""
-
-#: Registrations/Model/RegistrationQuestion.php:183
-msgid "Please enter smaller value than max."
-msgstr ""
-
-#: Registrations/Model/RegistrationQuestion.php:193
-msgid "Please enter bigger value than min."
-msgstr ""
-
-#: Registrations/Model/RegistrationQuestion.php:337
-#: Registrations/Test/Case/Model/RegistrationQuestion/SaveRegistrationQuestionTest.php:221
-msgid "please set at least one choice."
-msgstr ""
-
-#: Registrations/Model/RegistrationQuestion.php:353
-#: Registrations/Test/Case/Model/RegistrationQuestion/SaveRegistrationQuestionTest.php:223
-msgid "please set at least one choice at row and column."
-msgstr ""
-
-#: Registrations/Model/Behavior/RegistrationAnswerDatetimeBehavior.php:87
-#: Registrations/Test/Case/Model/RegistrationAnswer/ValidateAnswerDatetimeTest.php:75;77
-msgid "Please enter a valid date in YY-MM-DD format."
-msgstr ""
-
-#: Registrations/Model/Behavior/RegistrationAnswerDatetimeBehavior.php:93
-#: Registrations/Test/Case/Model/RegistrationAnswer/ValidateAnswerDatetimeTest.php:83
-msgid "Please enter the time."
-msgstr ""
-
-#: Registrations/Model/Behavior/RegistrationAnswerDatetimeBehavior.php:99
-#: Registrations/Test/Case/Model/RegistrationAnswer/ValidateAnswerDatetimeTest.php:87
-msgid "Please enter a valid date and time."
-msgstr ""
-
-#: Registrations/Model/Behavior/RegistrationAnswerDatetimeBehavior.php:129
-#: Registrations/Model/Behavior/RegistrationAnswerTextBehavior.php:92
-#: Registrations/Test/Case/Model/RegistrationAnswer/ValidateAnswerDatetimeTest.php:81;85;89
-#: Registrations/Test/Case/Model/RegistrationAnswer/ValidateAnswerTextTest.php:79;81
-msgid "Please enter the answer between %s and %s."
-msgstr ""
-
-#: Registrations/Model/Behavior/RegistrationAnswerMatrixSingleChoiceBehavior.php:137;143
-#: Registrations/Model/Behavior/RegistrationAnswerSingleListBehavior.php:104
-#: Registrations/Test/Case/Model/RegistrationAnswer/ValidateAnswerMultipleMatrixTest.php:87;89
-#: Registrations/Test/Case/Model/RegistrationAnswer/ValidateAnswerMultipleSelectTest.php:65
-#: Registrations/Test/Case/Model/RegistrationAnswer/ValidateAnswerSingleMatrixTest.php:87;89
-#: Registrations/Test/Case/Model/RegistrationAnswer/ValidateAnswerSingleSelectTest.php:65
-msgid "Invalid choice"
-msgstr ""
-
-#: Registrations/Model/Behavior/RegistrationAnswerMatrixSingleChoiceBehavior.php:174
-#: Registrations/Test/Case/Model/RegistrationAnswer/ValidateAnswerMultipleMatrixTest.php:95
-#: Registrations/Test/Case/Model/RegistrationAnswer/ValidateAnswerSingleMatrixTest.php:95
-msgid "Please enter something in other item"
-msgstr ""
-
-#: Registrations/Model/Behavior/RegistrationAnswerMatrixSingleChoiceBehavior.php:213
-#: Registrations/Test/Case/Model/RegistrationAnswer/ValidateAnswerMultipleMatrixTest.php:98
-#: Registrations/Test/Case/Model/RegistrationAnswer/ValidateAnswerSingleMatrixTest.php:98
-msgid "Please answer about all rows."
-msgstr ""
-
-#: Registrations/Model/Behavior/RegistrationAnswerSingleListBehavior.php:114
-#: Registrations/Test/Case/Model/RegistrationAnswer/ValidateAnswerMultipleSelectTest.php:69
-#: Registrations/Test/Case/Model/RegistrationAnswer/ValidateAnswerSingleSelectTest.php:69
-msgid "Please enter something, if you chose the other item"
-msgstr ""
-
-#: Registrations/Model/Behavior/RegistrationAnswerTextBehavior.php:82
-#: Registrations/Test/Case/Model/RegistrationAnswer/ValidateAnswerTextTest.php:77
-msgid "Number required"
-msgstr ""
-
-#: Registrations/Model/Behavior/RegistrationAnswerTextBehavior.php:103
-#: Registrations/Test/Case/Model/RegistrationAnswer/ValidateAnswerTextTest.php:73;75
-msgid "Please enter the answer between %s letters and %s letters."
-msgstr ""
-
-#: Registrations/Test/Case/Controller/RegistrationAnswersController/ViewTest.php:110;114;118;189;240
-#: Registrations/View/RegistrationAnswers/no_more_answer.ctp:12
-msgid "you will not be able to answer this registration."
-msgstr ""
-
-#: Registrations/Test/Case/Controller/RegistrationAnswersController/ViewTest.php:124
-msgid "Test Mode"
-msgstr ""
-
-#: Registrations/Test/Case/Controller/RegistrationAnswersController/ViewTest.php:298
-#: Registrations/View/Elements/Answers/answer_test_mode_header.ctp:17
-msgid "This registration is being temporarily stored . You can registration test before performed in this page . If you want to modify or change the registration , you will be able to edit by pressing the [ Edit question ] button in the upper-right corner ."
-msgstr ""
-
-#: Registrations/Test/Case/Controller/RegistrationEditController/EditQuestionTest.php:206
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/add_question_button.ctp:17
-msgid "Add Question"
-msgstr ""
-
-#: Registrations/Test/Case/Controller/RegistrationsController/IndexTest.php:141
-#: Registrations/View/Registrations/noRegistration.ctp:22
-msgid "no registration"
-msgstr ""
-
-#: Registrations/Test/Case/View/Helper/RegistrationAnswer/ChoiceTest.php:225
-#: Registrations/View/Helper/RegistrationAnswerHelper.php:268
-msgid "Please choose one"
-msgstr ""
-
-#: Registrations/Test/Case/View/Helper/RegistrationAnswer/DatetimeTest.php:136;188;244
-#: Registrations/View/Helper/RegistrationAnswerHelper.php:359;370;380
-msgid "Please enter at %s to %s"
-msgstr ""
-
-#: Registrations/Test/Case/View/Helper/RegistrationAnswer/TextTest.php:107
-#: Registrations/View/Helper/RegistrationAnswerHelper.php:214
-msgid "Please enter between %s letters and %s letters"
-msgstr ""
-
-#: Registrations/Test/Case/View/Helper/RegistrationAnswer/TextTest.php:135
-#: Registrations/View/Helper/RegistrationAnswerHelper.php:209
-msgid "Please enter a number between %s and %s"
-msgstr ""
-
-#: Registrations/View/Elements/ng_status_label.ctp:18
-#: Registrations/View/Helper/RegistrationStatusLabelHelper.php:50
-msgid "Before public"
-msgstr ""
-
-#: Registrations/View/Elements/ng_status_label.ctp:19
-#: Registrations/View/Helper/RegistrationStatusLabelHelper.php:54
-msgid "End"
-msgstr ""
-
-#: Registrations/View/Elements/scripts.ctp:6
-msgid "Number of questions that can be created is up %d . Already it has become %d ."
-msgstr ""
-
-#: Registrations/View/Elements/scripts.ctp:11
-msgid "Number of choices that can be created is up %d per question. Already it has become %d ."
-msgstr ""
-
-#: Registrations/View/Elements/RegistrationAdd/create_new.ctp:14
-msgid "Create new registration"
-msgstr ""
-
-#: Registrations/View/Elements/RegistrationAdd/create_new.ctp:22
-msgid "Registration title"
-msgstr ""
-
-#: Registrations/View/Elements/RegistrationAdd/create_new.ctp:24
-msgid "Please input registration title"
-msgstr ""
-
-#: Registrations/View/Elements/RegistrationAdd/create_reuse.ctp:14
-msgid "Re-use past registration"
-msgstr ""
-
-#: Registrations/View/Elements/RegistrationAdd/create_reuse.ctp:25
-msgid "Past registration"
-msgstr ""
-
-#: Registrations/View/Elements/RegistrationAdd/create_reuse.ctp:34
-msgid "Refine by entering the part of the registration name"
-msgstr ""
-
-#: Registrations/View/Elements/RegistrationAdd/create_reuse.ctp:51
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_after_published/date_option.ctp:61
-#: Registrations/View/RegistrationAnswers/test_mode.ctp:28;41
-#: Registrations/View/Registrations/index.ctp:32
-msgid " - "
-msgstr ""
-
-#: Registrations/View/Elements/RegistrationAdd/create_reuse.ctp:53
-msgid "Implementation"
-msgstr ""
-
-#: Registrations/View/Elements/RegistrationAdd/create_template.ctp:13
-msgid "Create from Template"
-msgstr ""
-
-#: Registrations/View/Elements/RegistrationAdd/create_template.ctp:24
-msgid "Registration template file"
-msgstr ""
-
-#: Registrations/View/Elements/RegistrationBlockRolePermissions/edit_form.ctp:20
-msgid "Content creatable roles"
-msgstr ""
-
-#: Registrations/View/Elements/RegistrationEdit/registration_title.ctp:23
-msgid "If you want to change the registration title, please edit in \"Set registration\" step."
-msgstr ""
-
-#: Registrations/View/Elements/RegistrationEdit/Edit/delete_form.ctp:26
-msgid "Registration"
-msgstr ""
-
-#: Registrations/View/Elements/RegistrationEdit/Edit/mail_setting.ctp:1
-msgid "Deliver e-mail when submitted?"
-msgstr ""
-
-#: Registrations/View/Elements/RegistrationEdit/Edit/mail_setting.ctp:4
-msgid "E-mail notifications are disabled"
-msgstr ""
-
-#: Registrations/View/Elements/RegistrationEdit/Edit/mail_setting.ctp:10
-msgid "Answer mail send"
-msgstr ""
-
-#: Registrations/View/Elements/RegistrationEdit/Edit/mail_setting.ctp:22
-msgid "Notify the applicant by e-mail,if there is metadata of e-mail"
-msgstr ""
-
-#: Registrations/View/Elements/RegistrationEdit/Edit/mail_setting.ctp:40
-#: Registrations/View/RegistrationMailSettings/edit.ctp:28
-msgid "Registration mail"
-msgstr ""
-
-#: Registrations/View/Elements/RegistrationEdit/Edit/mail_setting.ctp:61
-msgid "Registration.mail.popover"
-msgstr ""
-
-#: Registrations/View/Elements/RegistrationEdit/Edit/method_in_public.ctp:25
-#: Registrations/View/RegistrationAnswers/test_mode.ctp:62
-msgid "use key phrase"
-msgstr ""
-
-#: Registrations/View/Elements/RegistrationEdit/Edit/method_in_public.ctp:32
-#: Registrations/View/RegistrationAnswers/test_mode.ctp:90
-msgid "do image authentication"
-msgstr ""
-
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/accordion_heading.ctp:17
-msgid "Do you want to delete this question ?"
-msgstr ""
-
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/accordion_heading.ctp:48
-msgid "Skip"
-msgstr ""
-
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_after_published/choice.ctp:14
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_before_published/choice.ctp:19
-msgid "(This is [other] choice. Area to enter the text is automatically granted at the time of implementation.)"
-msgstr ""
-
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_after_published/date_option.ctp:18
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_before_published/date_option.ctp:27
-msgid "Date"
-msgstr ""
-
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_after_published/date_option.ctp:19
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_before_published/date_option.ctp:28
-msgid "Time"
-msgstr ""
-
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_after_published/date_option.ctp:20
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_before_published/date_option.ctp:29
-msgid "Date and Time"
-msgstr ""
-
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_after_published/date_option.ctp:37
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_before_published/date_option.ctp:46
-msgid "set range to answer date and time"
-msgstr ""
-
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_after_published/matrix_choice_option.ctp:16
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_before_published/matrix_choice_option.ctp:29
-msgid "Line choices"
-msgstr ""
-
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_after_published/matrix_choice_option.ctp:27
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_before_published/matrix_choice_option.ctp:67
-msgid "Column choices"
-msgstr ""
-
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_after_published/simple_choice_option.ctp:26
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_before_published/simple_choice_option.ctp:34
-msgid "horizontal choices"
-msgstr ""
-
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_after_published/simple_choice_option.ctp:37
-msgid "randomaize choices"
-msgstr ""
-
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_after_published/simple_choice_option.ctp:48
-msgid "set page skip"
-msgstr ""
-
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_after_published/text_option.ctp:24
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_before_published/text_option.ctp:30
-msgid "Numeric"
-msgstr ""
-
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_after_published/text_option.ctp:37
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_before_published/text_option.ctp:44
-msgid "Please check if you want to set limit(or length) value."
-msgstr ""
-
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_after_published/text_option.ctp:43
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_before_published/text_option.ctp:58
-msgid "Minimum"
-msgstr ""
-
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_after_published/text_option.ctp:49
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_before_published/text_option.ctp:74
-msgid "Maximum"
-msgstr ""
-
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_before_published/matrix_choice_option.ctp:27;50
-msgid "Add line choices"
-msgstr ""
-
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_before_published/matrix_choice_option.ctp:57
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_before_published/simple_choice_option.ctp:130
-msgid "add another choice"
-msgstr ""
-
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_before_published/matrix_choice_option.ctp:65;86
-msgid "Add column choices"
-msgstr ""
-
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_before_published/matrix_choice_option.ctp:74
-msgid "Do you want to delete this choice ?"
-msgstr ""
-
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_before_published/simple_choice_option.ctp:20;122
-msgid "add choices"
-msgstr ""
-
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_before_published/simple_choice_option.ctp:23
-msgid "add prefecture"
-msgstr ""
-
-#: Registrations/View/Elements/Registrations/add_button.ctp:23
-msgid "Create article"
-msgstr ""
-
-#: Registrations/View/Elements/Registrations/detail_for_editor.ctp:24
-msgid "Author"
-msgstr ""
-
-#: Registrations/View/Elements/Registrations/detail_for_editor.ctp:32
-msgid "Modified by"
-msgstr ""
-
-#: Registrations/View/Elements/Registrations/detail_for_editor.ctp:43
-msgid "Pages"
-msgstr ""
-
-#: Registrations/View/Elements/Registrations/detail_for_editor.ctp:45
-msgid "Questions"
-msgstr ""
-
-#: Registrations/View/Elements/Registrations/detail_for_editor.ctp:47
-msgid "Answers"
-msgstr ""
-
-#: Registrations/View/Helper/RegistrationStatusLabelHelper.php:31
-msgid "Undefined"
-msgstr ""
-
-#: Registrations/View/Helper/RegistrationUtilHelper.php:78
-msgid "Test"
-msgstr ""
-
-#: Registrations/View/Helper/RegistrationUtilHelper.php:98
-msgid "Answer"
-msgstr ""
-
-#: Registrations/View/Helper/RegistrationUtilHelper.php:118
-msgid "Unpublished"
-msgstr ""
-
-#: Registrations/View/Helper/RegistrationUtilHelper.php:122
-msgid "Finished"
-msgstr ""
-
-#: Registrations/View/RegistrationAdd/add.ctp:32
-msgid "You can create a new registration. Please choose how to create."
-msgstr ""
-
-#: Registrations/View/RegistrationAnswerSummaries/no_summaries.ctp:12
-msgid "you will not be able to see this result."
-msgstr ""
-
-#: Registrations/View/RegistrationAnswerSummaries/view.ctp:89
-#: Registrations/View/RegistrationBlocks/answer_list.ctp:98
-msgid "Back to page"
-msgstr ""
-
-#: Registrations/View/RegistrationAnswers/confirm.ctp:22
-msgid "Please confirm your answers."
-msgstr ""
-
-#: Registrations/View/RegistrationAnswers/confirm.ctp:62
-msgid "Start over"
-msgstr ""
-
-#: Registrations/View/RegistrationAnswers/limit.ctp:3
-msgid "Sorry, but no vacancy left."
-msgstr ""
-
-#: Registrations/View/RegistrationAnswers/test_mode.ctp:25
-#: Registrations/View/RegistrationEdit/edit.ctp:70
-msgid "Registration answer period"
-msgstr ""
-
-#: Registrations/View/RegistrationAnswers/test_mode.ctp:31
-msgid "do not set the answer period"
-msgstr ""
-
-#: Registrations/View/RegistrationAnswers/test_mode.ctp:38
-msgid "Counting result display start date"
-msgstr ""
-
-#: Registrations/View/RegistrationAnswers/test_mode.ctp:43
-msgid "do not set the aggregate display period"
-msgstr ""
-
-#: Registrations/View/RegistrationAnswers/test_mode.ctp:50
-msgid "Registration method"
-msgstr ""
-
-#: Registrations/View/RegistrationAnswers/test_mode.ctp:54
-msgid "accept the non-members answer"
-msgstr ""
-
-#: Registrations/View/RegistrationAnswers/test_mode.ctp:56
-msgid "do not accept the non-members answer"
-msgstr ""
-
-#: Registrations/View/RegistrationAnswers/test_mode.ctp:64
-msgid "key phrase"
-msgstr ""
-
-#: Registrations/View/RegistrationAnswers/test_mode.ctp:68
-msgid "do not use key phrase"
-msgstr ""
-
-#: Registrations/View/RegistrationAnswers/test_mode.ctp:74
-msgid "anonymous answer"
-msgstr ""
-
-#: Registrations/View/RegistrationAnswers/test_mode.ctp:76
-msgid "register answer"
-msgstr ""
-
-#: Registrations/View/RegistrationAnswers/test_mode.ctp:82
-msgid "forgive the repetition of the answer"
-msgstr ""
-
-#: Registrations/View/RegistrationAnswers/test_mode.ctp:84
-msgid "do not forgive the repetition of the answer"
-msgstr ""
-
-#: Registrations/View/RegistrationAnswers/test_mode.ctp:92
-msgid "do not image authentication"
-msgstr ""
-
-#: Registrations/View/RegistrationAnswers/test_mode.ctp:98
-msgid "Deliver e-mail when submitted"
-msgstr ""
-
-#: Registrations/View/RegistrationAnswers/test_mode.ctp:100
-msgid "do not deliver e-mail when submitted"
-msgstr ""
-
-#: Registrations/View/RegistrationAnswers/test_mode.ctp:106
-msgid "Deliver e-mail when started"
-msgstr ""
-
-#: Registrations/View/RegistrationAnswers/test_mode.ctp:108
-msgid "do not deliver e-mail when started"
-msgstr ""
-
-#: Registrations/View/RegistrationAnswers/test_mode.ctp:117
-msgid "Start the test answers of this registration"
-msgstr ""
-
-#: Registrations/View/RegistrationBlocks/answer_list.ctp:6;90
-msgid "Registration data"
-msgstr ""
-
-#: Registrations/View/RegistrationBlocks/answer_list.ctp:89
-msgid "Delete all answer"
-msgstr ""
-
-#: Registrations/View/RegistrationBlocks/index.ctp:41
-msgid "Status"
-msgstr ""
-
-#: Registrations/View/RegistrationBlocks/index.ctp:53
-msgid "Answer CSV"
-msgstr ""
-
-#: Registrations/View/RegistrationBlocks/index.ctp:57;115
-msgid "Answer List"
-msgstr ""
-
-#: Registrations/View/RegistrationEdit/edit.ctp:58
-msgid "Sub Title"
-msgstr ""
-
-#: Registrations/View/RegistrationEdit/edit.ctp:74
-msgid "set the answer period"
-msgstr ""
-
-#: Registrations/View/RegistrationEdit/edit.ctp:76
-msgid "After approval will be immediately published . Stop of the registration to select the stop from the registration data list ."
-msgstr ""
-
-#: Registrations/View/RegistrationEdit/edit.ctp:113
-msgid "Registration number limit"
-msgstr ""
-
-#: Registrations/View/RegistrationEdit/edit.ctp:116
-msgid "To limit the number of registrations"
-msgstr ""
-
-#: Registrations/View/RegistrationEdit/edit.ctp:122
-msgid "Limit number"
-msgstr ""
-
-#: Registrations/View/RegistrationEdit/edit.ctp:134
-msgid "Auth method"
-msgstr ""
-
-#: Registrations/View/RegistrationEdit/edit.ctp:142
-msgid "Thanks page message settings"
-msgstr ""
-
-#: Registrations/View/RegistrationEdit/edit_question.ctp:86
-msgid "question title"
-msgstr ""
-
-#: Registrations/View/RegistrationEdit/edit_question.ctp:93
-msgid "Required"
-msgstr ""
-
-#: Registrations/View/RegistrationEdit/edit_question.ctp:99
-msgid "set answer to this question is required"
-msgstr ""
-
-#: Registrations/View/RegistrationEdit/edit_question.ctp:102
-msgid "question sentence"
-msgstr ""
-
-#: Registrations/View/RegistrationEdit/edit_question.ctp:109
-msgid "Question type"
-msgstr ""
-
-#: Registrations/View/RegistrationMailSettings/edit.ctp:24
-msgid "MailSetting.mail_fixed_phrase_body.popover"
-msgstr ""
-
-msgid "Registration.mail.default.subject"
-msgstr "[{X-SITE_NAME}-{X-PLUGIN_NAME}]{X-SUBJECT} answer"
-
-msgid "Registration.mail.default.body"
-msgstr ""
-"Thank you for your registration.\n"
-"\n"
-"Registration form:{X-SUBJECT}\n"
-"\n"
-"Registered date:{X-TO_DATE}\n"
-"\n"
-"\n"
-"{X-DATA}\n"
-"\n"
-"Please print this mail and bring it with you."
-
-msgid "Registration.mail.after.body"
-msgstr ""
-"Registration detail URL\n"
-"{X-URL}"
diff --git a/Locale/jpn/LC_MESSAGES/registrations.po b/Locale/jpn/LC_MESSAGES/registrations.po
index 3d3725d..2bb81ed 100644
--- a/Locale/jpn/LC_MESSAGES/registrations.po
+++ b/Locale/jpn/LC_MESSAGES/registrations.po
@@ -16,8 +16,6 @@ msgstr ""
"X-Generator: Poedit 1.8.6\n"
#: /Controller/RegistrationBlocksController.php:148
-msgid "Designation of the registration does not exist."
-msgstr "指定の登録フォームデータは存在しません。"
msgid "Setting of password is required always to download answers."
msgstr "登録データをダウンロードする場合は必ず圧縮パスワードの設定が必要です。"
@@ -113,8 +111,6 @@ msgstr "作成方法を選択してください。"
#: /Model/ActionRegistrationAdd.php:66;70
msgid "Please select past registration."
msgstr "過去の登録フォームを選んでください。"
-msgid "Please input template file."
-msgstr "テンプレートファイルを選んでください。"
#: /Model/ActionRegistrationAdd.php:254
msgid "file upload error."
@@ -142,7 +138,7 @@ msgstr "開始日時は終了日時より前の日時を指定する必要があ
#: /Model/Registration.php:164
msgid "if you set the use key phrase period, please set key phrase text."
-msgstr "認証キーを使う場合、キーフレーズを設定してください。"
+msgstr "認証キーを使う場合、キーフレーズを設定してください"
#: /Model/Registration.php:168;184
msgid "Authentication key setting , image authentication , either only one can not be selected."
@@ -184,7 +180,7 @@ msgstr "選択肢内容を入力してください。"
#: /View/Elements/RegistrationEdit/EditQuestion/options_before_published/matrix_choice_option.ctp:71
#: /View/Elements/RegistrationEdit/EditQuestion/options_before_published/simple_choice_option.ctp:89
msgid "You can not use the character of |, : for choice text "
-msgstr "選択肢に「|」、「:」を使ってはいけません。"
+msgstr "選択肢に「|」、「:」を使ってはいけません"
#: /Model/RegistrationChoice.php:103
msgid "choice sequence is illegal."
@@ -262,7 +258,7 @@ msgstr "登録は%sから%sの範囲で入力してください。"
#: /Model/Behavior/RegistrationAnswerMatrixSingleChoiceBehavior.php:113;119
#: /Model/Behavior/RegistrationAnswerSingleListBehavior.php:90
msgid "Invalid choice"
-msgstr "不正な選択です。"
+msgstr "不正な選択です"
#: /Model/Behavior/RegistrationAnswerMatrixSingleChoiceBehavior.php:143
msgid "Please enter something in other item"
@@ -278,7 +274,7 @@ msgstr "その他を選択する場合は、内容を入力してください。
#: /Model/Behavior/RegistrationAnswerTextBehavior.php:64
msgid "Number required"
-msgstr "半角数字を入力してください。"
+msgstr "数字を入力してください。"
#: /Model/Behavior/RegistrationAnswerTextBehavior.php:76
msgid "Please enter the answer between %s letters and %s letters."
@@ -349,11 +345,11 @@ msgstr "割合"
#: /View/Elements/Answers/answer_test_mode_header.ctp:31
msgid "Test Mode"
-msgstr "(テストモード)"
+msgstr "一時保存(テストモード)"
#: /View/Elements/Answers/answer_test_mode_header.ctp:34
msgid "This registration is being temporarily stored . You can registration test before performed in this page . If you want to modify or change the registration , you will be able to edit by pressing the [ Edit question ] button in the upper-right corner ."
-msgstr "この登録フォームはまだ公開されていません。このページで実施前の登録フォームテストをすることができます。"
+msgstr "この登録フォームは一時保存中です。このページで実施前の登録フォームテストをすることができます。
登録フォームを修正・変更したい場合は、上部にある編集ボタンを押すと編集することができます。"
#: /View/Elements/FrameSettings/edit_display_registration.ctp:12
msgid "select display registrations."
@@ -383,7 +379,7 @@ msgstr "集計結果"
#: /View/RegistrationAnswers/test_mode.ctp:28;41
#: /View/RegistrationEdit/edit.ctp:81 /View/Registrations/index.ctp:36
msgid " - "
-msgstr " ~ "
+msgstr "~"
#: /View/Elements/FrameSettings/edit_display_registration.ctp:90
msgid "On"
@@ -419,7 +415,7 @@ msgstr "登録フォームタイトル"
#: /View/Elements/RegistrationAdd/create_new.ctp:23
msgid "Please input registration title"
-msgstr "登録フォームタイトルを入力してください。"
+msgstr "登録フォームタイトルを入力して下さい"
#: /View/Elements/RegistrationAdd/create_reuse.ctp:14
msgid "Re-use past registration"
@@ -431,7 +427,7 @@ msgstr "過去の登録フォーム"
#: /View/Elements/RegistrationAdd/create_reuse.ctp:34
msgid "Refine by entering the part of the registration name"
-msgstr "ここに登録フォーム名の一部を入力すると、下のリストの内容を絞り込むことができます。"
+msgstr "ここに登録フォーム名の一部を入力すると、下のリストの内容を絞り込むことができます"
#: /View/Elements/RegistrationAdd/create_reuse.ctp:52
msgid "Implementation"
@@ -522,15 +518,13 @@ msgstr "列の選択肢"
#: /View/Elements/RegistrationEdit/EditQuestion/options_after_published/simple_choice_option.ctp:26
#: /View/Elements/RegistrationEdit/EditQuestion/options_before_published/simple_choice_option.ctp:30
-msgid "horizontal choices"
-msgstr "横並び表示"
msgid "randomaize choices"
-msgstr "ランダム表示"
+msgstr "選択肢をランダムに表示する"
#: /View/Elements/RegistrationEdit/EditQuestion/options_after_published/simple_choice_option.ctp:37
#: /View/Elements/RegistrationEdit/EditQuestion/options_before_published/simple_choice_option.ctp:41
msgid "set page skip"
-msgstr "スキップページ設定"
+msgstr "スキップロジックを設定する"
#: /View/Elements/RegistrationEdit/EditQuestion/options_after_published/text_option.ctp:24
#: /View/Elements/RegistrationEdit/EditQuestion/options_before_published/text_option.ctp:32
@@ -567,7 +561,7 @@ msgstr "この選択肢を削除してもよろしいですか?"
#: /View/Elements/RegistrationEdit/EditQuestion/options_before_published/matrix_choice_option.ctp:91
#: /View/Elements/RegistrationEdit/EditQuestion/options_before_published/simple_choice_option.ctp:103
msgid "add another choice"
-msgstr "その他の選択肢を追加"
+msgstr "その他の選択肢を追加する"
#: /View/Elements/RegistrationEdit/EditQuestion/options_before_published/simple_choice_option.ctp:20;98
msgid "add choices"
@@ -668,19 +662,19 @@ msgstr "登録数"
#: /View/Helper/RegistrationAnswerHelper.php:181
msgid "Please enter a number between %s and %s"
-msgstr "%s から %s の間の数値を入力してください。"
+msgstr "%s から %s の間の数値を入力してください"
#: /View/Helper/RegistrationAnswerHelper.php:183
msgid "Please enter between %s letters and %s letters"
-msgstr "%s文字から%s文字の入力をしてください。"
+msgstr "%s文字から%s文字の入力をしてください"
#: /View/Helper/RegistrationAnswerHelper.php:235
msgid "Please choose one"
-msgstr "一つ選択してください。"
+msgstr "一つ選択してください"
#: /View/Helper/RegistrationAnswerHelper.php:314;323;331
msgid "Please enter at %s to %s"
-msgstr "%s から %sまでの間で入力してください。"
+msgstr "%s から %sまでの間で入力してください"
#: /View/Helper/RegistrationStatusLabelHelper.php:31
msgid "Undefined"
@@ -705,7 +699,7 @@ msgstr "新しい登録フォームを作成します。作成方法を選んで
#: /View/RegistrationAnswerSummaries/view.ctp:86
#: /View/RegistrationAnswers/no_more_answer.ctp:14
msgid "Back to Top"
-msgstr "戻る"
+msgstr "Topに戻る"
#: /View/RegistrationAnswers/confirm.ctp:22
msgid "Please confirm your answers."
@@ -718,13 +712,11 @@ msgstr "最初からやり直す"
#: /View/RegistrationAnswers/no_more_answer.ctp:12
msgid "you will not be able to answer this registration."
msgstr "この登録フォームには登録することはできません。"
-msgid "you will not be able to see this result."
-msgstr "この登録フォームの集計結果をみることはできません。"
#: /View/RegistrationAnswers/test_mode.ctp:25
#: /View/RegistrationEdit/edit.ctp:58
msgid "Registration answer period"
-msgstr "登録期間"
+msgstr "登録フォーム登録期間"
#: /View/RegistrationAnswers/test_mode.ctp:31
msgid "do not set the answer period"
@@ -741,8 +733,8 @@ msgstr "公開期間を制限しない"
#: /View/RegistrationAnswers/test_mode.ctp:50
#: /View/RegistrationEdit/edit.ctp:113
-msgid "Auth method"
-msgstr "認証方式"
+msgid "Registration method"
+msgstr "登録フォーム方式"
#: /View/RegistrationAnswers/test_mode.ctp:54
#: /View/RegistrationEdit/edit.ctp:117
@@ -796,11 +788,11 @@ msgstr "画像認証は行わない"
#: /View/RegistrationAnswers/test_mode.ctp:98
#: /View/RegistrationEdit/edit.ctp:140
msgid "Deliver e-mail when submitted"
-msgstr "提出されたらメールで通知する"
+msgstr "メールで通知する"
#: /View/RegistrationAnswers/test_mode.ctp:100
msgid "do not deliver e-mail when submitted"
-msgstr "登録時のメール通知は行わない"
+msgstr "メール通知は行わない"
#: /View/RegistrationAnswers/test_mode.ctp:106
msgid "Deliver e-mail when started"
@@ -816,7 +808,7 @@ msgstr "この登録フォームのテスト登録を始める"
#: /View/RegistrationAnswers/thanks.ctp:32
msgid "Back to page"
-msgstr "登録フォーム一覧へ"
+msgstr "登録フォーム一覧に戻る"
#: /View/RegistrationAnswers/thanks.ctp:37
msgid "Aggregate"
@@ -840,7 +832,7 @@ msgstr "サブタイトル"
#: /View/RegistrationEdit/edit.ctp:53
msgid "Please enter if there is a sub title"
-msgstr "サブタイトルを入力してください。"
+msgstr "サブタイトルを入力してください"
#: /View/RegistrationEdit/edit.ctp:63
msgid "set the answer period"
@@ -848,7 +840,8 @@ msgstr "登録期間を設定する"
#: /View/RegistrationEdit/edit.ctp:71
msgid "After approval will be immediately published . Stop of the registration to select the stop from the registration data list ."
-msgstr "登録できる期間を設定します。"
+#msgstr "承認後即時公開されます。登録フォームの停止は登録フォームデータ一覧から停止を選びます。"
+msgstr "登録期間を設定しない場合、承認後即時公開されます。"
#: /View/RegistrationEdit/edit.ctp:97
msgid "set the aggregate display period"
@@ -860,18 +853,23 @@ msgstr "設定しない場合、登録者が登録した後すぐに表示され
#: /View/RegistrationEdit/edit.ctp:108
msgid "Result will display at this time."
-msgstr "ここで指定された日から集計結果を閲覧できるようになります。"
+msgstr "から集計結果を表示する"
#: /View/RegistrationEdit/edit.ctp:144
-msgid "Registration answer mail"
-msgstr "登録フォームの登録通知メール"
-
-msgid "registration.answer.mail.subject"
-msgstr "[{X-SITE_NAME}-{X-PLUGIN_NAME}]{X-SUBJECT}({X-ROOM})登録通知"
-msgid "registration.answer.mail.body"
-msgstr "{X-SUBJECT}に登録されたのでお知らせします。\nルーム名:{X-ROOM}\n登録フォーム名:{X-SUBJECT}\n登録日時:{X-TO_DATE}"
-msgid "registration.answer.mail.body.help"
-msgstr ""
+msgid "Registration open mail"
+msgstr "登録フォーム開始メール"
+
+#: /View/RegistrationEdit/edit.ctp:148
+msgid "Deliver e-mail when registration has opened"
+msgstr "登録フォームが開始されたらメールで通知する"
+
+#: /View/RegistrationEdit/edit.ctp:153
+msgid "open mail subject"
+msgstr "開始メールタイトル"
+
+#: /View/RegistrationEdit/edit.ctp:156
+msgid "open mail text"
+msgstr "開始メール本文"
#: /View/RegistrationEdit/edit.ctp:162
msgid "Thanks page message settings"
@@ -936,117 +934,3 @@ msgstr "登録フォームがありません。"
#: /View/Registrations/noRegistration.ctp:33
msgid "Please create new registration by pressing the \"+\" button."
msgstr "+ボタンをクリックして登録フォームを作成してください。"
-
-# メール関連
-msgid "MailSetting.mail_fixed_phrase_body.popover"
-msgstr "{X-SITE_NAME} : サイト名
{X-PLUGIN_NAME} : プラグイン名
{X-ROOM} : ルーム名
{X-SUBJECT} : 登録フォーム名
{X-TO_DATE} : 開始日時
{X-URL} : 登録フォームへのURL"
-
-msgid "If you allowed to say also to non-members , the registration will be possible to repeatedly answer."
-msgstr "非会員にも登録することを許した場合は、登録フォームは繰り返し登録が可能のものになります。
また非会員にも登録を許す場合は、認証キーや画像認証を併用することが望ましいです。"
-
-# 新着関連
-msgid "%s started"
-msgstr "「%s」が公開されました。"
-
-msgid "Content creatable roles"
-msgstr "登録フォームを作成できる権限"
-
-msgid "Email"
-msgstr "メールアドレス"
-
-msgid "File"
-msgstr "ファイル"
-
-msgid "Registration number limit"
-msgstr "登録数制限"
-
-msgid "To limit the number of registrations"
-msgstr "登録数を制限する"
-
-msgid "Limit number"
-msgstr "登録数"
-
-msgid "Sorry, but no vacancy left."
-msgstr "制限数に達したため受付けを終了しました。"
-
-msgid "Deliver e-mail when submitted?"
-msgstr "メール配信設定"
-
-msgid "Answer mail send"
-msgstr "登録通知メールを送る"
-
-msgid "Registration mail"
-msgstr "登録メール"
-
-msgid "Notify the applicant by e-mail,if there is metadata of e-mail"
-msgstr "本人にも送る(メールアドレス項目があるときのみ)"
-
-msgid "Registration.mail.default.subject"
-msgstr "[{X-SITE_NAME}-{X-PLUGIN_NAME}]{X-SUBJECT}を受け付けました。"
-
-msgid "Registration.mail.default.body"
-msgstr ""
-"{X-SUBJECT}の登録通知先メールアドレスとしてあなたのメールアドレスが使用されました。\n"
-"もし{X-SUBJECT}への登録に覚えがない場合はこのメールを破棄してください。\n"
-"\n"
-"\n"
-"{X-SUBJECT}を受け付けました。\n"
-"\n"
-"登録日時:{X-TO_DATE}\n"
-"\n"
-"\n"
-"{X-DATA}\n"
-"\n"
-"メール内容を印刷の上、会場にご持参ください。"
-
-msgid "Registration.mail.after.body"
-msgstr ""
-"登録内容確認画面URL\n"
-"{X-URL}"
-
-msgid "Registration.mail.popover"
-msgstr ""
-"{X-SITE_NAME} : サイト名
{X-PLUGIN_NAME} : プラグイン名
{X-ROOM} : ルーム名
{X-SUBJECT} : タイトル
{X-USER} : 登録者
{X-TO_DATE} : 登録日時
"
-"{X-DATA} : 登録内容
"
-"本人に送るメール以外には登録内容確認画面URLが付加されます。"
-
-msgid "RegistrationAnswerSummary ID"
-msgstr "受付ID"
-
-msgid "add prefecture"
-msgstr "都道府県選択肢の追加"
-
-msgid "Answer List"
-msgstr "登録一覧"
-
-msgid "The registration form has not been published."
-msgstr "この登録フォームはまだ公開されていません。"
-
-msgid "Registration data"
-msgstr "登録データ"
-
-msgid "Delete Answer"
-msgstr "データ削除"
-
-msgid "Delete all answer"
-msgstr "登録データを全て削除"
-
-msgid "E-mail notifications are disabled"
-msgstr "このフォームではメール通知は許可されていないため設定できません。"
-
-msgid "Thank you for registering."
-msgstr "ご登録ありがとうございました。"
-
-msgid "Number of questions that can be created is up %d . Already it has become %d ."
-msgstr "作成できる項目数は1フォームにつき%dまでです。%d個を超えようとしています。"
-msgid "Number of choices that can be created is up %d per question. Already it has become %d ."
-msgstr "作成できる選択肢の数は1項目につき%dまでです。%d個を超えようとしています。"
-
-msgid "Answer Number"
-msgstr "登録数"
-
-msgid "Registration Number"
-msgstr "受付番号"
-
-msgid "(Remaining: %s)"
-msgstr "(残り: %s)"
diff --git a/Locale/registrations.pot b/Locale/registrations.pot
index d39bc3d..531bca1 100644
--- a/Locale/registrations.pot
+++ b/Locale/registrations.pot
@@ -13,805 +13,925 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
-#: Registrations/Controller/RegistrationBlocksController.php:188
-#: Registrations/Test/Case/Controller/RegistrationBlocksController/DownloadTest.php:169
-msgid "Designation of the registration does not exist."
-msgstr ""
-
-#: Registrations/Controller/RegistrationBlocksController.php:196
-#: Registrations/Test/Case/Controller/RegistrationBlocksController/DownloadTest.php:196
+#: /Controller/RegistrationBlocksController.php:148
msgid "Setting of password is required always to download answers."
msgstr ""
-#: Registrations/Controller/RegistrationBlocksController.php:223
-#: Registrations/Test/Case/Controller/RegistrationBlocksController/DownloadTest.php:226
+#: /Controller/RegistrationBlocksController.php:178
msgid "download error"
msgstr ""
-#: Registrations/Controller/RegistrationBlocksController.php:271
-msgid "The registration form has not been published."
+#: /Controller/RegistrationBlocksController.php:228
+msgid "export error"
msgstr ""
-#: Registrations/Controller/RegistrationEditController.php:453
-#: Registrations/View/Elements/scripts.ctp:18
+#: /Controller/RegistrationEditController.php:331
msgid "page"
msgstr ""
-#: Registrations/Controller/RegistrationEditController.php:454
-#: Registrations/Model/RegistrationQuestion.php:235
-#: Registrations/Test/Case/Controller/RegistrationEditController/DeleteTest.php:115
-#: Registrations/Test/Case/Controller/RegistrationEditController/EditQuestionTest.php:122
-#: Registrations/Test/Case/Controller/RegistrationEditController/EditTest.php:126
-#: Registrations/Test/Case/Model/RegistrationQuestion/GetDefaultQuestionTest.php:91
-#: Registrations/View/Elements/scripts.ctp:19
+#: /Controller/RegistrationEditController.php:332
+#: /Model/RegistrationQuestion.php:220
msgid "New Question"
msgstr ""
-#: Registrations/Controller/RegistrationEditController.php:455
-#: Registrations/Model/RegistrationChoice.php:130
-#: Registrations/Test/Case/Controller/RegistrationEditController/DeleteTest.php:127
-#: Registrations/Test/Case/Controller/RegistrationEditController/EditQuestionTest.php:134
-#: Registrations/Test/Case/Controller/RegistrationEditController/EditTest.php:138
-#: Registrations/Test/Case/Model/RegistrationChoice/GetDefaultChoiceTest.php:90
-#: Registrations/View/Elements/scripts.ctp:20
+#: /Controller/RegistrationEditController.php:333
+#: /Model/RegistrationChoice.php:140
msgid "new choice"
msgstr ""
-#: Registrations/Controller/RegistrationEditController.php:456
-#: Registrations/View/Elements/scripts.ctp:21
+#: /Controller/RegistrationEditController.php:334
msgid "new column choice"
msgstr ""
-#: Registrations/Controller/RegistrationEditController.php:457
-#: Registrations/View/Elements/scripts.ctp:22
+#: /Controller/RegistrationEditController.php:335
msgid "other choice"
msgstr ""
-#: Registrations/Controller/Component/RegistrationsComponent.php:484
-msgid "End period"
+#: /Controller/Component/RegistrationsComponent.php:512;513;514;515;516
+msgid "item"
msgstr ""
-#: Registrations/Model/ActionRegistrationAdd.php:54
-#: Registrations/Test/Case/Controller/RegistrationAddController/AddTest.php:289
-msgid "Please choose create option."
+#: /Controller/Component/RegistrationsComponent.php:527
+msgid "New Modified"
msgstr ""
-#: Registrations/Model/ActionRegistrationAdd.php:62
-#: Registrations/Model/Registration.php:162
-#: Registrations/Test/Case/Controller/RegistrationAddController/AddTest.php:296
-#: Registrations/Test/Case/Controller/RegistrationEditController/EditTest.php:431
-#: Registrations/View/RegistrationBlocks/index.ctp:45
-#: Registrations/View/RegistrationEdit/edit.ctp:53
+#: /Controller/Component/RegistrationsComponent.php:528
+msgid "Registration order"
+msgstr ""
+
+#: /Controller/Component/RegistrationsComponent.php:529
+#: /Model/ActionRegistrationAdd.php:60
+#: /Model/Registration.php:98
+#: /View/Elements/FrameSettings/edit_display_registration.ctp:34
+#: /View/RegistrationBlocks/index.ctp:37
+#: /View/RegistrationEdit/edit.ctp:46
msgid "Title"
msgstr ""
-#: Registrations/Model/ActionRegistrationAdd.php:71;75
-#: Registrations/Test/Case/Controller/RegistrationAddController/AddTest.php:303;310
-msgid "Please select past registration."
+#: /Controller/Component/RegistrationsComponent.php:530
+msgid "End period"
msgstr ""
-#: Registrations/Model/ActionRegistrationAdd.php:229
-msgid "Registration.mail.default.subject"
+#: /Controller/Component/RegistrationsComponent.php:541
+msgid "Single choice"
msgstr ""
-#: Registrations/Model/ActionRegistrationAdd.php:231
-msgid "Registration.mail.default.body"
+#: /Controller/Component/RegistrationsComponent.php:542
+msgid "Multiple choice"
msgstr ""
-#: Registrations/Model/ActionRegistrationAdd.php:233
-msgid "Thank you for registering."
+#: /Controller/Component/RegistrationsComponent.php:543
+msgid "Single text"
msgstr ""
-#: Registrations/Model/ActionRegistrationAdd.php:271
-msgid "Please input template file."
+#: /Controller/Component/RegistrationsComponent.php:544
+msgid "Multiple text"
msgstr ""
-#: Registrations/Model/ActionRegistrationAdd.php:285;292;301
-msgid "illegal import file."
+#: /Controller/Component/RegistrationsComponent.php:545
+msgid "Single choice matrix"
+msgstr ""
+
+#: /Controller/Component/RegistrationsComponent.php:546
+msgid "Multiple choice matrix"
+msgstr ""
+
+#: /Controller/Component/RegistrationsComponent.php:547
+msgid "Date and time"
msgstr ""
-#: Registrations/Model/ActionRegistrationAdd.php:312
+#: /Controller/Component/RegistrationsComponent.php:548
+msgid "List select"
+msgstr ""
+
+#: /Model/ActionRegistrationAdd.php:54
+msgid "Please choose create option."
+msgstr ""
+
+#: /Model/ActionRegistrationAdd.php:66;70
+msgid "Please select past registration."
+msgstr ""
+
+#: /Model/ActionRegistrationAdd.php:254
msgid "file upload error."
msgstr ""
-#: Registrations/Model/ActionRegistrationAdd.php:319
+#: /Model/ActionRegistrationAdd.php:263;270;277
+msgid "illegal import file."
+msgstr ""
+
+#: /Model/ActionRegistrationAdd.php:290
msgid "version is different."
msgstr ""
-#: Registrations/Model/Registration.php:181
+#: /Model/Registration.php:110;136
msgid "if you set the period, please set time."
msgstr ""
-#: Registrations/Model/Registration.php:187;193
+#: /Model/Registration.php:116;122;142
msgid "Invalid datetime format."
msgstr ""
-#: Registrations/Model/Registration.php:197
-#: Registrations/Test/Case/Controller/RegistrationEditController/EditTest.php:445;452
+#: /Model/Registration.php:126
msgid "start period must be smaller than end period"
msgstr ""
-#: Registrations/Model/Registration.php:255
+#: /Model/Registration.php:164
msgid "if you set the use key phrase period, please set key phrase text."
msgstr ""
-#: Registrations/Model/Registration.php:266;289
+#: /Model/Registration.php:168;184
msgid "Authentication key setting , image authentication , either only one can not be selected."
msgstr ""
-#: Registrations/Model/Registration.php:319
+#: /Model/Registration.php:199
msgid "please set at least one page."
msgstr ""
-#: Registrations/Model/Registration.php:575
-msgid "%s started"
-msgstr ""
-
-#: Registrations/Model/RegistrationAnswer.php:126
-#: Registrations/Test/Case/Model/RegistrationAnswer/ValidateAnswerDatetimeTest.php:79
-#: Registrations/Test/Case/Model/RegistrationAnswer/ValidateAnswerMultipleMatrixTest.php:92
-#: Registrations/Test/Case/Model/RegistrationAnswer/ValidateAnswerMultipleSelectTest.php:67
-#: Registrations/Test/Case/Model/RegistrationAnswer/ValidateAnswerSingleMatrixTest.php:92
-#: Registrations/Test/Case/Model/RegistrationAnswer/ValidateAnswerSingleSelectTest.php:67
-#: Registrations/Test/Case/Model/RegistrationAnswer/ValidateAnswerTextAreaTest.php:65
-#: Registrations/Test/Case/Model/RegistrationAnswer/ValidateAnswerTextTest.php:71
+#: /Model/RegistrationAnswer.php:118
msgid "Input required"
msgstr ""
-#: Registrations/Model/RegistrationAnswer.php:134
-#: Registrations/Test/Case/Model/RegistrationAnswer/ValidateAnswerTextAreaTest.php:63
-#: Registrations/Test/Case/Model/RegistrationAnswer/ValidateAnswerTextTest.php:69
+#: /Model/RegistrationAnswer.php:122
msgid "the answer is too long. Please enter under %d letters."
msgstr ""
-#: Registrations/Model/RegistrationAnswerSummary.php:170
-msgid "Registration.mail.after.body"
-msgstr ""
-
-#: Registrations/Model/RegistrationAnswerSummary.php:460
-#: Registrations/View/RegistrationAnswers/thanks.ctp:27
-#: Registrations/View/RegistrationBlocks/answer_list.ctp:15
-msgid "RegistrationAnswerSummary ID"
-msgstr ""
-
-#: Registrations/Model/RegistrationAnswerSummaryCsv.php:205
-#: Registrations/Test/Case/Model/RegistrationAnswerSummaryCsv/GetAnswerSummaryCsvTest.php:257;305;309;327
+#: /Model/RegistrationAnswerSummaryCsv.php:152
msgid "Respondent"
msgstr ""
-#: Registrations/Model/RegistrationAnswerSummaryCsv.php:206
-#: Registrations/Test/Case/Model/RegistrationAnswerSummaryCsv/GetAnswerSummaryCsvTest.php:257;305;309;327
+#: /Model/RegistrationAnswerSummaryCsv.php:153
msgid "Answer Date"
msgstr ""
-#: Registrations/Model/RegistrationAnswerSummaryCsv.php:207
-#: Registrations/Test/Case/Model/RegistrationAnswerSummaryCsv/GetAnswerSummaryCsvTest.php:257;305;309;327
+#: /Model/RegistrationAnswerSummaryCsv.php:154
msgid "Number"
msgstr ""
-#: Registrations/Model/RegistrationAnswerSummaryCsv.php:283
-#: Registrations/Test/Case/Model/RegistrationAnswerSummaryCsv/GetAnswerSummaryCsvTest.php:315;321
+#: /Model/RegistrationAnswerSummaryCsv.php:191
msgid "Anonymity"
msgstr ""
-#: Registrations/Model/RegistrationAnswerSummaryCsv.php:286
-msgid "Guest"
-msgstr ""
-
-#: Registrations/Model/RegistrationChoice.php:80
-#: Registrations/Test/Case/Model/RegistrationChoice/SaveRegistrationChoiceTest.php:157
+#: /Model/RegistrationChoice.php:80
msgid "Please input choice text."
msgstr ""
-#: Registrations/Model/RegistrationChoice.php:84
-#: Registrations/Test/Case/Model/RegistrationChoice/SaveRegistrationChoiceTest.php:159
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_before_published/matrix_choice_option.ctp:94
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_before_published/simple_choice_option.ctp:125
+#: /Model/RegistrationChoice.php:84
+#: /View/Elements/RegistrationEdit/EditQuestion/options_before_published/matrix_choice_option.ctp:71
+#: /View/Elements/RegistrationEdit/EditQuestion/options_before_published/simple_choice_option.ctp:89
msgid "You can not use the character of |, : for choice text "
msgstr ""
-#: Registrations/Model/RegistrationChoice.php:101
-#: Registrations/Test/Case/Model/RegistrationChoice/SaveRegistrationChoiceTest.php:163
+#: /Model/RegistrationChoice.php:103
msgid "choice sequence is illegal."
msgstr ""
-#: Registrations/Model/RegistrationChoice.php:107
-#: Registrations/Test/Case/Model/RegistrationChoice/SaveRegistrationChoiceTest.php:165
+#: /Model/RegistrationChoice.php:108
msgid "First character is \"#\". And input the hexadecimal numbers by six digits."
msgstr ""
-#: Registrations/Model/RegistrationChoice.php:186
-#: Registrations/Test/Case/Model/RegistrationChoice/SaveRegistrationChoiceTest.php:169
+#: /Model/RegistrationChoice.php:196
msgid "Invalid skip page. Please set forward page."
msgstr ""
-#: Registrations/Model/RegistrationChoice.php:191
-#: Registrations/Test/Case/Model/RegistrationChoice/SaveRegistrationChoiceTest.php:167;171
+#: /Model/RegistrationChoice.php:200
msgid "Invalid skip page. page does not exist."
msgstr ""
-#: Registrations/Model/RegistrationPage.php:99
-#: Registrations/Test/Case/Controller/RegistrationEditController/DeleteTest.php:109
-#: Registrations/Test/Case/Controller/RegistrationEditController/EditQuestionTest.php:116
-#: Registrations/Test/Case/Controller/RegistrationEditController/EditTest.php:120
-#: Registrations/Test/Case/Model/RegistrationPage/GetDefaultPageTest.php:90
+#: /Model/RegistrationPage.php:85
msgid "First Page"
msgstr ""
-#: Registrations/Model/RegistrationPage.php:221
-#: Registrations/Test/Case/Model/RegistrationAnswer/SaveAnswerTest.php:448
-#: Registrations/Test/Case/Model/RegistrationPage/SaveRegistrationPageTest.php:190
+#: /Model/RegistrationPage.php:198
msgid "page sequence is illegal."
msgstr ""
-#: Registrations/Model/RegistrationPage.php:241
-#: Registrations/Test/Case/Model/RegistrationAnswer/SaveAnswerTest.php:450
-#: Registrations/Test/Case/Model/RegistrationPage/SaveRegistrationPageTest.php:192
+#: /Model/RegistrationPage.php:230
msgid "please set at least one question."
msgstr ""
-#: Registrations/Model/RegistrationQuestion.php:118
+#: /Model/RegistrationQuestion.php:97
msgid "question sequence is illegal."
msgstr ""
-#: Registrations/Model/RegistrationQuestion.php:130
+#: /Model/RegistrationQuestion.php:109
msgid "Please input question text."
msgstr ""
-#: Registrations/Model/RegistrationQuestion.php:179;189
-#: Registrations/Test/Case/Model/RegistrationQuestion/SaveRegistrationQuestionTest.php:225
+#: /Model/RegistrationQuestion.php:155;165
msgid "Please enter both the maximum and minimum values."
msgstr ""
-#: Registrations/Model/RegistrationQuestion.php:183
+#: /Model/RegistrationQuestion.php:159
msgid "Please enter smaller value than max."
msgstr ""
-#: Registrations/Model/RegistrationQuestion.php:193
+#: /Model/RegistrationQuestion.php:169
msgid "Please enter bigger value than min."
msgstr ""
-#: Registrations/Model/RegistrationQuestion.php:337
-#: Registrations/Test/Case/Model/RegistrationQuestion/SaveRegistrationQuestionTest.php:221
+#: /Model/RegistrationQuestion.php:318
msgid "please set at least one choice."
msgstr ""
-#: Registrations/Model/RegistrationQuestion.php:353
-#: Registrations/Test/Case/Model/RegistrationQuestion/SaveRegistrationQuestionTest.php:223
+#: /Model/RegistrationQuestion.php:329
msgid "please set at least one choice at row and column."
msgstr ""
-#: Registrations/Model/Behavior/RegistrationAnswerDatetimeBehavior.php:87
-#: Registrations/Test/Case/Model/RegistrationAnswer/ValidateAnswerDatetimeTest.php:75;77
+#: /Model/Behavior/RegistrationAnswerDatetimeBehavior.php:75
msgid "Please enter a valid date in YY-MM-DD format."
msgstr ""
-#: Registrations/Model/Behavior/RegistrationAnswerDatetimeBehavior.php:93
-#: Registrations/Test/Case/Model/RegistrationAnswer/ValidateAnswerDatetimeTest.php:83
+#: /Model/Behavior/RegistrationAnswerDatetimeBehavior.php:80
msgid "Please enter the time."
msgstr ""
-#: Registrations/Model/Behavior/RegistrationAnswerDatetimeBehavior.php:99
-#: Registrations/Test/Case/Model/RegistrationAnswer/ValidateAnswerDatetimeTest.php:87
+#: /Model/Behavior/RegistrationAnswerDatetimeBehavior.php:85
msgid "Please enter a valid date and time."
msgstr ""
-#: Registrations/Model/Behavior/RegistrationAnswerDatetimeBehavior.php:129
-#: Registrations/Model/Behavior/RegistrationAnswerTextBehavior.php:92
-#: Registrations/Test/Case/Model/RegistrationAnswer/ValidateAnswerDatetimeTest.php:81;85;89
-#: Registrations/Test/Case/Model/RegistrationAnswer/ValidateAnswerTextTest.php:79;81
+#: /Model/Behavior/RegistrationAnswerDatetimeBehavior.php:104
+#: /Model/Behavior/RegistrationAnswerTextBehavior.php:69
msgid "Please enter the answer between %s and %s."
msgstr ""
-#: Registrations/Model/Behavior/RegistrationAnswerMatrixSingleChoiceBehavior.php:137;143
-#: Registrations/Model/Behavior/RegistrationAnswerSingleListBehavior.php:104
-#: Registrations/Test/Case/Model/RegistrationAnswer/ValidateAnswerMultipleMatrixTest.php:87;89
-#: Registrations/Test/Case/Model/RegistrationAnswer/ValidateAnswerMultipleSelectTest.php:65
-#: Registrations/Test/Case/Model/RegistrationAnswer/ValidateAnswerSingleMatrixTest.php:87;89
-#: Registrations/Test/Case/Model/RegistrationAnswer/ValidateAnswerSingleSelectTest.php:65
+#: /Model/Behavior/RegistrationAnswerMatrixSingleChoiceBehavior.php:113;119
+#: /Model/Behavior/RegistrationAnswerSingleListBehavior.php:90
msgid "Invalid choice"
msgstr ""
-#: Registrations/Model/Behavior/RegistrationAnswerMatrixSingleChoiceBehavior.php:174
-#: Registrations/Test/Case/Model/RegistrationAnswer/ValidateAnswerMultipleMatrixTest.php:95
-#: Registrations/Test/Case/Model/RegistrationAnswer/ValidateAnswerSingleMatrixTest.php:95
+#: /Model/Behavior/RegistrationAnswerMatrixSingleChoiceBehavior.php:143
msgid "Please enter something in other item"
msgstr ""
-#: Registrations/Model/Behavior/RegistrationAnswerMatrixSingleChoiceBehavior.php:213
-#: Registrations/Test/Case/Model/RegistrationAnswer/ValidateAnswerMultipleMatrixTest.php:98
-#: Registrations/Test/Case/Model/RegistrationAnswer/ValidateAnswerSingleMatrixTest.php:98
+#: /Model/Behavior/RegistrationAnswerMatrixSingleChoiceBehavior.php:181
msgid "Please answer about all rows."
msgstr ""
-#: Registrations/Model/Behavior/RegistrationAnswerSingleListBehavior.php:114
-#: Registrations/Test/Case/Model/RegistrationAnswer/ValidateAnswerMultipleSelectTest.php:69
-#: Registrations/Test/Case/Model/RegistrationAnswer/ValidateAnswerSingleSelectTest.php:69
+#: /Model/Behavior/RegistrationAnswerSingleListBehavior.php:98
msgid "Please enter something, if you chose the other item"
msgstr ""
-#: Registrations/Model/Behavior/RegistrationAnswerTextBehavior.php:82
-#: Registrations/Test/Case/Model/RegistrationAnswer/ValidateAnswerTextTest.php:77
+#: /Model/Behavior/RegistrationAnswerTextBehavior.php:64
msgid "Number required"
msgstr ""
-#: Registrations/Model/Behavior/RegistrationAnswerTextBehavior.php:103
-#: Registrations/Test/Case/Model/RegistrationAnswer/ValidateAnswerTextTest.php:73;75
+#: /Model/Behavior/RegistrationAnswerTextBehavior.php:76
msgid "Please enter the answer between %s letters and %s letters."
msgstr ""
-#: Registrations/Test/Case/Controller/RegistrationAnswersController/ViewTest.php:110;114;118;189;240
-#: Registrations/View/RegistrationAnswers/no_more_answer.ctp:12
-msgid "you will not be able to answer this registration."
+#: /View/Elements/ng_status_label.ctp:18
+#: /View/Helper/RegistrationStatusLabelHelper.php:49
+msgid "Before public"
msgstr ""
-#: Registrations/Test/Case/Controller/RegistrationAnswersController/ViewTest.php:124
-msgid "Test Mode"
+#: /View/Elements/ng_status_label.ctp:19
+#: /View/Helper/RegistrationStatusLabelHelper.php:53
+msgid "End"
msgstr ""
-#: Registrations/Test/Case/Controller/RegistrationAnswersController/ViewTest.php:298
-#: Registrations/View/Elements/Answers/answer_test_mode_header.ctp:17
-msgid "This registration is being temporarily stored . You can registration test before performed in this page . If you want to modify or change the registration , you will be able to edit by pressing the [ Edit question ] button in the upper-right corner ."
+#: /View/Elements/AnswerSummaries/aggregate_common_footer.ctp:15
+msgid "Note: Which may not be 100% because of rounding of numeric total."
msgstr ""
-#: Registrations/Test/Case/Controller/RegistrationEditController/EditQuestionTest.php:206
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/add_question_button.ctp:17
-msgid "Add Question"
+#: /View/Elements/AnswerSummaries/aggregate_common_footer.ctp:20
+msgid "Note: Matrix if the number in parentheses is a percentage of the total number of responses."
msgstr ""
-#: Registrations/Test/Case/Controller/RegistrationsController/IndexTest.php:141
-#: Registrations/View/Registrations/noRegistration.ctp:22
-msgid "no registration"
+#: /View/Elements/AnswerSummaries/aggregate_common_footer.ctp:26
+msgid "Note: If multiple selection is possible, total more than 100% to be."
msgstr ""
-#: Registrations/Test/Case/View/Helper/RegistrationAnswer/ChoiceTest.php:225
-#: Registrations/View/Helper/RegistrationAnswerHelper.php:268
-msgid "Please choose one"
+#: /View/Elements/AnswerSummaries/aggregate_common_header.ctp:21
+msgid "The total number of answers: "
msgstr ""
-#: Registrations/Test/Case/View/Helper/RegistrationAnswer/DatetimeTest.php:136;188;244
-#: Registrations/View/Helper/RegistrationAnswerHelper.php:359;370;380
-msgid "Please enter at %s to %s"
+#: /View/Elements/AnswerSummaries/aggregate_common_header.ctp:29
+msgid "Select one"
msgstr ""
-#: Registrations/Test/Case/View/Helper/RegistrationAnswer/TextTest.php:107
-#: Registrations/View/Helper/RegistrationAnswerHelper.php:214
-msgid "Please enter between %s letters and %s letters"
+#: /View/Elements/AnswerSummaries/aggregate_common_header.ctp:32
+msgid "Select more than one"
msgstr ""
-#: Registrations/Test/Case/View/Helper/RegistrationAnswer/TextTest.php:135
-#: Registrations/View/Helper/RegistrationAnswerHelper.php:209
-msgid "Please enter a number between %s and %s"
+#: /View/Elements/AnswerSummaries/aggregate_common_header.ctp:35
+msgid "Matrix (selection list)"
msgstr ""
-#: Registrations/View/Elements/ng_status_label.ctp:18
-#: Registrations/View/Helper/RegistrationStatusLabelHelper.php:50
-msgid "Before public"
+#: /View/Elements/AnswerSummaries/aggregate_common_header.ctp:38
+msgid "Matrix (multiple)"
msgstr ""
-#: Registrations/View/Elements/ng_status_label.ctp:19
-#: Registrations/View/Helper/RegistrationStatusLabelHelper.php:54
-msgid "End"
+#: /View/Elements/AnswerSummaries/aggregate_common_header.ctp:41
+msgid "List selection"
msgstr ""
-#: Registrations/View/Elements/scripts.ctp:6
-msgid "Number of questions that can be created is up %d . Already it has become %d ."
+#: /View/Elements/AnswerSummaries/aggregate_common_header.ctp:44
+msgid "Not selection"
msgstr ""
-#: Registrations/View/Elements/scripts.ctp:11
-msgid "Number of choices that can be created is up %d per question. Already it has become %d ."
+#: /View/Elements/AnswerSummaries/aggregate_matrix_table.ctp:18
+#: /View/Elements/AnswerSummaries/aggregate_table.ctp:17
+msgid "Item name"
msgstr ""
-#: Registrations/View/Elements/RegistrationAdd/create_new.ctp:14
-msgid "Create new registration"
+#: /View/Elements/AnswerSummaries/aggregate_table.ctp:18
+msgid "Aggregate value"
msgstr ""
-#: Registrations/View/Elements/RegistrationAdd/create_new.ctp:22
-msgid "Registration title"
+#: /View/Elements/AnswerSummaries/aggregate_table.ctp:19
+msgid "The percentage"
msgstr ""
-#: Registrations/View/Elements/RegistrationAdd/create_new.ctp:24
-msgid "Please input registration title"
+#: /View/Elements/Answers/answer_test_mode_header.ctp:31
+msgid "Test Mode"
msgstr ""
-#: Registrations/View/Elements/RegistrationAdd/create_reuse.ctp:14
-msgid "Re-use past registration"
+#: /View/Elements/Answers/answer_test_mode_header.ctp:34
+msgid "This registration is being temporarily stored . You can registration test before performed in this page . If you want to modify or change the registration , you will be able to edit by pressing the [ Edit question ] button in the upper-right corner ."
msgstr ""
-#: Registrations/View/Elements/RegistrationAdd/create_reuse.ctp:25
-msgid "Past registration"
+#: /View/Elements/FrameSettings/edit_display_registration.ctp:12
+msgid "select display registrations."
msgstr ""
-#: Registrations/View/Elements/RegistrationAdd/create_reuse.ctp:34
-msgid "Refine by entering the part of the registration name"
+#: /View/Elements/FrameSettings/edit_display_registration.ctp:18
+msgid "Display"
+msgstr ""
+
+#: /View/Elements/FrameSettings/edit_display_registration.ctp:31
+#: /View/RegistrationBlocks/index.ctp:34
+msgid "Status"
+msgstr ""
+
+#: /View/Elements/FrameSettings/edit_display_registration.ctp:37
+msgid "Implementation date"
msgstr ""
-#: Registrations/View/Elements/RegistrationAdd/create_reuse.ctp:51
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_after_published/date_option.ctp:61
-#: Registrations/View/RegistrationAnswers/test_mode.ctp:28;41
-#: Registrations/View/Registrations/index.ctp:32
+#: /View/Elements/FrameSettings/edit_display_registration.ctp:40
+msgid "Aggregates"
+msgstr ""
+
+#: /View/Elements/FrameSettings/edit_display_registration.ctp:84
+#: /View/Elements/RegistrationAdd/create_reuse.ctp:50
+#: /View/Elements/RegistrationEdit/EditQuestion/options_after_published/date_option.ctp:69
+#: /View/Elements/RegistrationEdit/EditQuestion/options_before_published/date_option.ctp:88
+#: /View/RegistrationAnswers/test_mode.ctp:28;41
+#: /View/RegistrationEdit/edit.ctp:81
+#: /View/Registrations/index.ctp:36
msgid " - "
msgstr ""
-#: Registrations/View/Elements/RegistrationAdd/create_reuse.ctp:53
-msgid "Implementation"
+#: /View/Elements/FrameSettings/edit_display_registration.ctp:90
+msgid "On"
msgstr ""
-#: Registrations/View/Elements/RegistrationAdd/create_template.ctp:13
-msgid "Create from Template"
+#: /View/Elements/FrameSettings/edit_display_type.ctp:12
+msgid "Registration display setting"
msgstr ""
-#: Registrations/View/Elements/RegistrationAdd/create_template.ctp:24
-msgid "Registration template file"
+#: /View/Elements/FrameSettings/edit_display_type.ctp:17
+msgid "Show only one registration"
msgstr ""
-#: Registrations/View/Elements/RegistrationBlockRolePermissions/edit_form.ctp:20
-msgid "Content creatable roles"
+#: /View/Elements/FrameSettings/edit_display_type.ctp:18
+msgid "Show registrations list"
msgstr ""
-#: Registrations/View/Elements/RegistrationEdit/registration_title.ctp:23
-msgid "If you want to change the registration title, please edit in \"Set registration\" step."
+#: /View/Elements/FrameSettings/edit_list_display_option.ctp:15
+msgid "Visible registration row"
msgstr ""
-#: Registrations/View/Elements/RegistrationEdit/Edit/delete_form.ctp:26
-msgid "Registration"
+#: /View/Elements/FrameSettings/edit_list_display_option.ctp:26
+msgid "Visible row order"
msgstr ""
-#: Registrations/View/Elements/RegistrationEdit/Edit/mail_setting.ctp:1
-msgid "Deliver e-mail when submitted?"
+#: /View/Elements/RegistrationAdd/create_new.ctp:14
+msgid "Create new registration"
msgstr ""
-#: Registrations/View/Elements/RegistrationEdit/Edit/mail_setting.ctp:4
-msgid "E-mail notifications are disabled"
+#: /View/Elements/RegistrationAdd/create_new.ctp:21
+msgid "Registration title"
msgstr ""
-#: Registrations/View/Elements/RegistrationEdit/Edit/mail_setting.ctp:10
-msgid "Answer mail send"
+#: /View/Elements/RegistrationAdd/create_new.ctp:23
+msgid "Please input registration title"
msgstr ""
-#: Registrations/View/Elements/RegistrationEdit/Edit/mail_setting.ctp:22
-msgid "Notify the applicant by e-mail,if there is metadata of e-mail"
+#: /View/Elements/RegistrationAdd/create_reuse.ctp:14
+msgid "Re-use past registration"
msgstr ""
-#: Registrations/View/Elements/RegistrationEdit/Edit/mail_setting.ctp:40
-#: Registrations/View/RegistrationMailSettings/edit.ctp:28
-msgid "Registration mail"
+#: /View/Elements/RegistrationAdd/create_reuse.ctp:25
+msgid "Past registration"
msgstr ""
-#: Registrations/View/Elements/RegistrationEdit/Edit/mail_setting.ctp:61
-msgid "Registration.mail.popover"
+#: /View/Elements/RegistrationAdd/create_reuse.ctp:34
+msgid "Refine by entering the part of the registration name"
msgstr ""
-#: Registrations/View/Elements/RegistrationEdit/Edit/method_in_public.ctp:25
-#: Registrations/View/RegistrationAnswers/test_mode.ctp:62
-msgid "use key phrase"
+#: /View/Elements/RegistrationAdd/create_reuse.ctp:52
+msgid "Implementation"
msgstr ""
-#: Registrations/View/Elements/RegistrationEdit/Edit/method_in_public.ctp:32
-#: Registrations/View/RegistrationAnswers/test_mode.ctp:90
-msgid "do image authentication"
+#: /View/Elements/RegistrationAdd/create_template.ctp:13
+msgid "Create from Template"
+msgstr ""
+
+#: /View/Elements/RegistrationAdd/create_template.ctp:23
+msgid "Registration template file"
+msgstr ""
+
+#: /View/Elements/RegistrationEdit/edit_flow_chart.ctp:14
+msgid "Set questions"
+msgstr ""
+
+#: /View/Elements/RegistrationEdit/edit_flow_chart.ctp:15
+msgid "Set result display"
+msgstr ""
+
+#: /View/Elements/RegistrationEdit/edit_flow_chart.ctp:16
+msgid "Set registration"
+msgstr ""
+
+#: /View/Elements/RegistrationEdit/registration_title.ctp:14
+msgid "If you want to change the registration title, please edit in \"Set registration\" step."
+msgstr ""
+
+#: /View/Elements/RegistrationEdit/Edit/delete_form.ctp:31
+msgid "Registration"
+msgstr ""
+
+#: /View/Elements/RegistrationEdit/EditQuestion/accordion_heading.ctp:16
+msgid "copy to another page"
+msgstr ""
+
+#: /View/Elements/RegistrationEdit/EditQuestion/accordion_heading.ctp:20
+msgid "destination page number"
msgstr ""
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/accordion_heading.ctp:17
+#: /View/Elements/RegistrationEdit/EditQuestion/accordion_heading.ctp:28
msgid "Do you want to delete this question ?"
msgstr ""
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/accordion_heading.ctp:48
+#: /View/Elements/RegistrationEdit/EditQuestion/accordion_heading.ctp:58
msgid "Skip"
msgstr ""
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_after_published/choice.ctp:14
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_before_published/choice.ctp:19
+#: /View/Elements/RegistrationEdit/EditQuestion/add_question_button.ctp:18
+msgid "Add Question"
+msgstr ""
+
+#: /View/Elements/RegistrationEdit/EditQuestion/options_after_published/choice.ctp:14
+#: /View/Elements/RegistrationEdit/EditQuestion/options_before_published/choice.ctp:18
msgid "(This is [other] choice. Area to enter the text is automatically granted at the time of implementation.)"
msgstr ""
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_after_published/date_option.ctp:18
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_before_published/date_option.ctp:27
+#: /View/Elements/RegistrationEdit/EditQuestion/options_after_published/date_option.ctp:21
+#: /View/Elements/RegistrationEdit/EditQuestion/options_before_published/date_option.ctp:30
msgid "Date"
msgstr ""
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_after_published/date_option.ctp:19
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_before_published/date_option.ctp:28
+#: /View/Elements/RegistrationEdit/EditQuestion/options_after_published/date_option.ctp:22
+#: /View/Elements/RegistrationEdit/EditQuestion/options_before_published/date_option.ctp:31
msgid "Time"
msgstr ""
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_after_published/date_option.ctp:20
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_before_published/date_option.ctp:29
+#: /View/Elements/RegistrationEdit/EditQuestion/options_after_published/date_option.ctp:23
+#: /View/Elements/RegistrationEdit/EditQuestion/options_before_published/date_option.ctp:32
msgid "Date and Time"
msgstr ""
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_after_published/date_option.ctp:37
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_before_published/date_option.ctp:46
+#: /View/Elements/RegistrationEdit/EditQuestion/options_after_published/date_option.ctp:49
+#: /View/Elements/RegistrationEdit/EditQuestion/options_before_published/date_option.ctp:59
msgid "set range to answer date and time"
msgstr ""
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_after_published/matrix_choice_option.ctp:16
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_before_published/matrix_choice_option.ctp:29
+#: /View/Elements/RegistrationEdit/EditQuestion/options_after_published/matrix_choice_option.ctp:16
+#: /View/Elements/RegistrationEdit/EditQuestion/options_before_published/matrix_choice_option.ctp:24
msgid "Line choices"
msgstr ""
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_after_published/matrix_choice_option.ctp:27
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_before_published/matrix_choice_option.ctp:67
+#: /View/Elements/RegistrationEdit/EditQuestion/options_after_published/matrix_choice_option.ctp:27
+#: /View/Elements/RegistrationEdit/EditQuestion/options_before_published/matrix_choice_option.ctp:52
msgid "Column choices"
msgstr ""
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_after_published/simple_choice_option.ctp:26
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_before_published/simple_choice_option.ctp:34
-msgid "horizontal choices"
-msgstr ""
-
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_after_published/simple_choice_option.ctp:37
+#: /View/Elements/RegistrationEdit/EditQuestion/options_after_published/simple_choice_option.ctp:26
+#: /View/Elements/RegistrationEdit/EditQuestion/options_before_published/simple_choice_option.ctp:30
msgid "randomaize choices"
msgstr ""
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_after_published/simple_choice_option.ctp:48
+#: /View/Elements/RegistrationEdit/EditQuestion/options_after_published/simple_choice_option.ctp:37
+#: /View/Elements/RegistrationEdit/EditQuestion/options_before_published/simple_choice_option.ctp:41
msgid "set page skip"
msgstr ""
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_after_published/text_option.ctp:24
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_before_published/text_option.ctp:30
+#: /View/Elements/RegistrationEdit/EditQuestion/options_after_published/text_option.ctp:24
+#: /View/Elements/RegistrationEdit/EditQuestion/options_before_published/text_option.ctp:32
msgid "Numeric"
msgstr ""
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_after_published/text_option.ctp:37
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_before_published/text_option.ctp:44
+#: /View/Elements/RegistrationEdit/EditQuestion/options_after_published/text_option.ctp:37
+#: /View/Elements/RegistrationEdit/EditQuestion/options_before_published/text_option.ctp:44
msgid "Please check if you want to set limit(or length) value."
msgstr ""
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_after_published/text_option.ctp:43
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_before_published/text_option.ctp:58
+#: /View/Elements/RegistrationEdit/EditQuestion/options_after_published/text_option.ctp:42
+#: /View/Elements/RegistrationEdit/EditQuestion/options_before_published/text_option.ctp:57
msgid "Minimum"
msgstr ""
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_after_published/text_option.ctp:49
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_before_published/text_option.ctp:74
+#: /View/Elements/RegistrationEdit/EditQuestion/options_after_published/text_option.ctp:50
+#: /View/Elements/RegistrationEdit/EditQuestion/options_before_published/text_option.ctp:73
msgid "Maximum"
msgstr ""
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_before_published/matrix_choice_option.ctp:27;50
+#: /View/Elements/RegistrationEdit/EditQuestion/options_before_published/matrix_choice_option.ctp:28;47
msgid "Add line choices"
msgstr ""
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_before_published/matrix_choice_option.ctp:57
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_before_published/simple_choice_option.ctp:130
-msgid "add another choice"
-msgstr ""
-
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_before_published/matrix_choice_option.ctp:65;86
+#: /View/Elements/RegistrationEdit/EditQuestion/options_before_published/matrix_choice_option.ctp:55;78
msgid "Add column choices"
msgstr ""
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_before_published/matrix_choice_option.ctp:74
+#: /View/Elements/RegistrationEdit/EditQuestion/options_before_published/matrix_choice_option.ctp:62
msgid "Do you want to delete this choice ?"
msgstr ""
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_before_published/simple_choice_option.ctp:20;122
+#: /View/Elements/RegistrationEdit/EditQuestion/options_before_published/matrix_choice_option.ctp:91
+#: /View/Elements/RegistrationEdit/EditQuestion/options_before_published/simple_choice_option.ctp:103
+msgid "add another choice"
+msgstr ""
+
+#: /View/Elements/RegistrationEdit/EditQuestion/options_before_published/simple_choice_option.ctp:20;98
msgid "add choices"
msgstr ""
-#: Registrations/View/Elements/RegistrationEdit/EditQuestion/options_before_published/simple_choice_option.ctp:23
-msgid "add prefecture"
+#: /View/Elements/RegistrationEdit/EditQuestion/options_before_published/simple_choice_option.ctp:64
+msgid "goto end"
+msgstr ""
+
+#: /View/Elements/RegistrationEdit/EditQuestion/options_before_published/simple_choice_option.ctp:68
+msgid "(new page will be created)"
msgstr ""
-#: Registrations/View/Elements/Registrations/add_button.ctp:23
+#: /View/Elements/RegistrationEdit/EditQuestion/options_before_published/simple_choice_option.ctp:69
+msgid "create new page for this skip"
+msgstr ""
+
+#: /View/Elements/RegistrationEdit/EditResult/accordion_heading.ctp:23
+msgid "There is an error"
+msgstr ""
+
+#: /View/Elements/RegistrationEdit/EditResult/display_type_set.ctp:13
+msgid "display type"
+msgstr ""
+
+#: /View/Elements/RegistrationEdit/EditResult/display_type_set.ctp:28
+msgid "Bar Chart"
+msgstr ""
+
+#: /View/Elements/RegistrationEdit/EditResult/display_type_set.ctp:36
+msgid "Pie Chart"
+msgstr ""
+
+#: /View/Elements/RegistrationEdit/EditResult/display_type_set.ctp:44
+msgid "Table"
+msgstr ""
+
+#: /View/Elements/RegistrationEdit/EditResult/graph_color_set.ctp:13
+msgid "graph color"
+msgstr ""
+
+#: /View/Elements/RegistrationEdit/EditResult/is_display_set.ctp:14
+msgid "aggregate display"
+msgstr ""
+
+#: /View/Elements/RegistrationEdit/EditResult/is_display_set.ctp:29
+msgid "The results of this question will not be displayed"
+msgstr ""
+
+#: /View/Elements/RegistrationEdit/EditResult/is_display_set.ctp:38
+msgid "The results of this question will be displayed"
+msgstr ""
+
+#: /View/Elements/Registrations/add_button.ctp:23
msgid "Create article"
msgstr ""
-#: Registrations/View/Elements/Registrations/detail_for_editor.ctp:24
+#: /View/Elements/Registrations/answer_status.ctp:13
+msgid "View All"
+msgstr ""
+
+#: /View/Elements/Registrations/answer_status.ctp:14
+msgid "Unanswered"
+msgstr ""
+
+#: /View/Elements/Registrations/answer_status.ctp:15
+msgid "Answered"
+msgstr ""
+
+#: /View/Elements/Registrations/answer_status.ctp:18
+#: /View/Helper/RegistrationUtilHelper.php:90
+msgid "Test"
+msgstr ""
+
+#: /View/Elements/Registrations/answer_status.ctp:30
+msgid "Answer status"
+msgstr ""
+
+#: /View/Elements/Registrations/detail_for_editor.ctp:24
msgid "Author"
msgstr ""
-#: Registrations/View/Elements/Registrations/detail_for_editor.ctp:32
+#: /View/Elements/Registrations/detail_for_editor.ctp:26
msgid "Modified by"
msgstr ""
-#: Registrations/View/Elements/Registrations/detail_for_editor.ctp:43
+#: /View/Elements/Registrations/detail_for_editor.ctp:32
msgid "Pages"
msgstr ""
-#: Registrations/View/Elements/Registrations/detail_for_editor.ctp:45
+#: /View/Elements/Registrations/detail_for_editor.ctp:34
msgid "Questions"
msgstr ""
-#: Registrations/View/Elements/Registrations/detail_for_editor.ctp:47
+#: /View/Elements/Registrations/detail_for_editor.ctp:36
msgid "Answers"
msgstr ""
-#: Registrations/View/Helper/RegistrationStatusLabelHelper.php:31
-msgid "Undefined"
+#: /View/Helper/RegistrationAnswerHelper.php:181
+msgid "Please enter a number between %s and %s"
msgstr ""
-#: Registrations/View/Helper/RegistrationUtilHelper.php:78
-msgid "Test"
+#: /View/Helper/RegistrationAnswerHelper.php:183
+msgid "Please enter between %s letters and %s letters"
+msgstr ""
+
+#: /View/Helper/RegistrationAnswerHelper.php:235
+msgid "Please choose one"
msgstr ""
-#: Registrations/View/Helper/RegistrationUtilHelper.php:98
+#: /View/Helper/RegistrationAnswerHelper.php:314;323;331
+msgid "Please enter at %s to %s"
+msgstr ""
+
+#: /View/Helper/RegistrationStatusLabelHelper.php:31
+msgid "Undefined"
+msgstr ""
+
+#: /View/Helper/RegistrationUtilHelper.php:110
msgid "Answer"
msgstr ""
-#: Registrations/View/Helper/RegistrationUtilHelper.php:118
+#: /View/Helper/RegistrationUtilHelper.php:127
msgid "Unpublished"
msgstr ""
-#: Registrations/View/Helper/RegistrationUtilHelper.php:122
+#: /View/Helper/RegistrationUtilHelper.php:131
msgid "Finished"
msgstr ""
-#: Registrations/View/RegistrationAdd/add.ctp:32
+#: /View/RegistrationAdd/add.ctp:27
msgid "You can create a new registration. Please choose how to create."
msgstr ""
-#: Registrations/View/RegistrationAnswerSummaries/no_summaries.ctp:12
-msgid "you will not be able to see this result."
-msgstr ""
-
-#: Registrations/View/RegistrationAnswerSummaries/view.ctp:89
-#: Registrations/View/RegistrationBlocks/answer_list.ctp:98
-msgid "Back to page"
+#: /View/RegistrationAnswerSummaries/view.ctp:86
+#: /View/RegistrationAnswers/no_more_answer.ctp:14
+msgid "Back to Top"
msgstr ""
-#: Registrations/View/RegistrationAnswers/confirm.ctp:22
+#: /View/RegistrationAnswers/confirm.ctp:22
msgid "Please confirm your answers."
msgstr ""
-#: Registrations/View/RegistrationAnswers/confirm.ctp:62
+#: /View/RegistrationAnswers/confirm.ctp:64
msgid "Start over"
msgstr ""
-#: Registrations/View/RegistrationAnswers/limit.ctp:3
-msgid "Sorry, but no vacancy left."
+#: /View/RegistrationAnswers/no_more_answer.ctp:12
+msgid "you will not be able to answer this registration."
msgstr ""
-#: Registrations/View/RegistrationAnswers/test_mode.ctp:25
-#: Registrations/View/RegistrationEdit/edit.ctp:70
+#: /View/RegistrationAnswers/test_mode.ctp:25
+#: /View/RegistrationEdit/edit.ctp:58
msgid "Registration answer period"
msgstr ""
-#: Registrations/View/RegistrationAnswers/test_mode.ctp:31
+#: /View/RegistrationAnswers/test_mode.ctp:31
msgid "do not set the answer period"
msgstr ""
-#: Registrations/View/RegistrationAnswers/test_mode.ctp:38
+#: /View/RegistrationAnswers/test_mode.ctp:38
+#: /View/RegistrationEdit/edit.ctp:92
msgid "Counting result display start date"
msgstr ""
-#: Registrations/View/RegistrationAnswers/test_mode.ctp:43
+#: /View/RegistrationAnswers/test_mode.ctp:43
msgid "do not set the aggregate display period"
msgstr ""
-#: Registrations/View/RegistrationAnswers/test_mode.ctp:50
+#: /View/RegistrationAnswers/test_mode.ctp:50
+#: /View/RegistrationEdit/edit.ctp:113
msgid "Registration method"
msgstr ""
-#: Registrations/View/RegistrationAnswers/test_mode.ctp:54
+#: /View/RegistrationAnswers/test_mode.ctp:54
+#: /View/RegistrationEdit/edit.ctp:117
msgid "accept the non-members answer"
msgstr ""
-#: Registrations/View/RegistrationAnswers/test_mode.ctp:56
+#: /View/RegistrationAnswers/test_mode.ctp:56
msgid "do not accept the non-members answer"
msgstr ""
-#: Registrations/View/RegistrationAnswers/test_mode.ctp:64
+#: /View/RegistrationAnswers/test_mode.ctp:62
+#: /View/RegistrationEdit/edit.ctp:120
+msgid "use key phrase"
+msgstr ""
+
+#: /View/RegistrationAnswers/test_mode.ctp:64
msgid "key phrase"
msgstr ""
-#: Registrations/View/RegistrationAnswers/test_mode.ctp:68
+#: /View/RegistrationAnswers/test_mode.ctp:68
msgid "do not use key phrase"
msgstr ""
-#: Registrations/View/RegistrationAnswers/test_mode.ctp:74
+#: /View/RegistrationAnswers/test_mode.ctp:74
+#: /View/RegistrationEdit/edit.ctp:129
msgid "anonymous answer"
msgstr ""
-#: Registrations/View/RegistrationAnswers/test_mode.ctp:76
+#: /View/RegistrationAnswers/test_mode.ctp:76
msgid "register answer"
msgstr ""
-#: Registrations/View/RegistrationAnswers/test_mode.ctp:82
+#: /View/RegistrationAnswers/test_mode.ctp:82
+#: /View/RegistrationEdit/edit.ctp:132
msgid "forgive the repetition of the answer"
msgstr ""
-#: Registrations/View/RegistrationAnswers/test_mode.ctp:84
+#: /View/RegistrationAnswers/test_mode.ctp:84
msgid "do not forgive the repetition of the answer"
msgstr ""
-#: Registrations/View/RegistrationAnswers/test_mode.ctp:92
+#: /View/RegistrationAnswers/test_mode.ctp:90
+#: /View/RegistrationEdit/edit.ctp:135
+msgid "do image authentication"
+msgstr ""
+
+#: /View/RegistrationAnswers/test_mode.ctp:92
msgid "do not image authentication"
msgstr ""
-#: Registrations/View/RegistrationAnswers/test_mode.ctp:98
+#: /View/RegistrationAnswers/test_mode.ctp:98
+#: /View/RegistrationEdit/edit.ctp:140
msgid "Deliver e-mail when submitted"
msgstr ""
-#: Registrations/View/RegistrationAnswers/test_mode.ctp:100
+#: /View/RegistrationAnswers/test_mode.ctp:100
msgid "do not deliver e-mail when submitted"
msgstr ""
-#: Registrations/View/RegistrationAnswers/test_mode.ctp:106
+#: /View/RegistrationAnswers/test_mode.ctp:106
msgid "Deliver e-mail when started"
msgstr ""
-#: Registrations/View/RegistrationAnswers/test_mode.ctp:108
+#: /View/RegistrationAnswers/test_mode.ctp:108
msgid "do not deliver e-mail when started"
msgstr ""
-#: Registrations/View/RegistrationAnswers/test_mode.ctp:117
+#: /View/RegistrationAnswers/test_mode.ctp:117
msgid "Start the test answers of this registration"
msgstr ""
-#: Registrations/View/RegistrationBlocks/answer_list.ctp:6;90
-msgid "Registration data"
+#: /View/RegistrationAnswers/thanks.ctp:32
+msgid "Back to page"
msgstr ""
-#: Registrations/View/RegistrationBlocks/answer_list.ctp:89
-msgid "Delete all answer"
+#: /View/RegistrationAnswers/thanks.ctp:37
+msgid "Aggregate"
msgstr ""
-#: Registrations/View/RegistrationBlocks/index.ctp:41
-msgid "Status"
+#: /View/RegistrationBlockRolePermissions/noRegistrationBlock.ctp:19
+msgid "There is no registration. First, please create a registration."
msgstr ""
-#: Registrations/View/RegistrationBlocks/index.ctp:53
+#: /View/RegistrationBlocks/index.ctp:43
msgid "Answer CSV"
msgstr ""
-#: Registrations/View/RegistrationBlocks/index.ctp:57;115
-msgid "Answer List"
+#: /View/RegistrationBlocks/index.ctp:46
+msgid "Templates"
msgstr ""
-#: Registrations/View/RegistrationEdit/edit.ctp:58
+#: /View/RegistrationEdit/edit.ctp:51
msgid "Sub Title"
msgstr ""
-#: Registrations/View/RegistrationEdit/edit.ctp:74
+#: /View/RegistrationEdit/edit.ctp:53
+msgid "Please enter if there is a sub title"
+msgstr ""
+
+#: /View/RegistrationEdit/edit.ctp:63
msgid "set the answer period"
msgstr ""
-#: Registrations/View/RegistrationEdit/edit.ctp:76
+#: /View/RegistrationEdit/edit.ctp:71
msgid "After approval will be immediately published . Stop of the registration to select the stop from the registration data list ."
msgstr ""
-#: Registrations/View/RegistrationEdit/edit.ctp:113
-msgid "Registration number limit"
+#: /View/RegistrationEdit/edit.ctp:97
+msgid "set the aggregate display period"
msgstr ""
-#: Registrations/View/RegistrationEdit/edit.ctp:116
-msgid "To limit the number of registrations"
+#: /View/RegistrationEdit/edit.ctp:99
+msgid "If not set , it will be displayed after the respondent answers."
msgstr ""
-#: Registrations/View/RegistrationEdit/edit.ctp:122
-msgid "Limit number"
+#: /View/RegistrationEdit/edit.ctp:108
+msgid "Result will display at this time."
msgstr ""
-#: Registrations/View/RegistrationEdit/edit.ctp:134
-msgid "Auth method"
+#: /View/RegistrationEdit/edit.ctp:144
+msgid "Registration open mail"
msgstr ""
-#: Registrations/View/RegistrationEdit/edit.ctp:142
-msgid "Thanks page message settings"
+#: /View/RegistrationEdit/edit.ctp:148
+msgid "Deliver e-mail when registration has opened"
msgstr ""
-#: Registrations/View/RegistrationEdit/edit_question.ctp:86
-msgid "question title"
+#: /View/RegistrationEdit/edit.ctp:153
+msgid "open mail subject"
+msgstr ""
+
+#: /View/RegistrationEdit/edit.ctp:156
+msgid "open mail text"
+msgstr ""
+
+#: /View/RegistrationEdit/edit.ctp:162
+msgid "Thanks page message settings"
msgstr ""
-#: Registrations/View/RegistrationEdit/edit_question.ctp:93
+#: /View/RegistrationEdit/edit_question.ctp:88
msgid "Required"
msgstr ""
-#: Registrations/View/RegistrationEdit/edit_question.ctp:99
+#: /View/RegistrationEdit/edit_question.ctp:95
msgid "set answer to this question is required"
msgstr ""
-#: Registrations/View/RegistrationEdit/edit_question.ctp:102
+#: /View/RegistrationEdit/edit_question.ctp:98
+msgid "question title"
+msgstr ""
+
+#: /View/RegistrationEdit/edit_question.ctp:106
msgid "question sentence"
msgstr ""
-#: Registrations/View/RegistrationEdit/edit_question.ctp:109
+#: /View/RegistrationEdit/edit_question.ctp:116
msgid "Question type"
msgstr ""
-#: Registrations/View/RegistrationMailSettings/edit.ctp:24
-msgid "MailSetting.mail_fixed_phrase_body.popover"
+#: /View/RegistrationEdit/edit_question.ctp:165
+msgid "Do you want to delete this page?"
+msgstr ""
+
+#: /View/RegistrationEdit/edit_question.ctp:166
+msgid "Delete this page"
+msgstr ""
+
+#: /View/RegistrationEdit/edit_question.ctp:174
+msgid "Add Page"
+msgstr ""
+
+#: /View/RegistrationEdit/edit_result.ctp:48
+msgid "Published aggregate results"
+msgstr ""
+
+#: /View/RegistrationEdit/edit_result.ctp:51
+msgid "not disclose the total result"
+msgstr ""
+
+#: /View/RegistrationEdit/edit_result.ctp:51
+msgid "publish aggregate result"
+msgstr ""
+
+#: /View/RegistrationEdit/edit_result.ctp:65
+msgid "Text to be displayed in the aggregate results page"
+msgstr ""
+
+#: /View/RegistrationEdit/edit_result.ctp:78
+msgid "Question you want to display the aggregate results"
+msgstr ""
+
+#: /View/Registrations/noRegistration.ctp:28
+msgid "no registration"
+msgstr ""
+
+#: /View/Registrations/noRegistration.ctp:33
+msgid "Please create new registration by pressing the \"+\" button."
msgstr ""
diff --git a/Model/ActionRegistrationAdd.php b/Model/ActionRegistrationAdd.php
index b630e0e..31cd3ca 100644
--- a/Model/ActionRegistrationAdd.php
+++ b/Model/ActionRegistrationAdd.php
@@ -11,7 +11,9 @@
App::uses('RegistrationsAppModel', 'Registrations.Model');
App::uses('TemporaryUploadFile', 'Files.Utility');
App::uses('UnZip', 'Files.Utility');
-App::uses('WysiwygZip', 'Wysiwyg.Utility');
+App::uses('WysIsWygDownloader', 'Registrations.Utility');
+
+App::uses('RegistrationsComponent', 'Registrations.Controller/Component');
/**
* Summary for ActionRegistrationAdd Model
@@ -44,7 +46,7 @@ class ActionRegistrationAdd extends RegistrationsAppModel {
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function beforeValidate($options = array()) {
- $this->validate = ValidateMerge::merge($this->validate, array(
+ $this->validate = Hash::merge($this->validate, array(
'create_option' => array(
'rule' => array(
'inList', array(
@@ -56,18 +58,13 @@ public function beforeValidate($options = array()) {
),
'title' => array(
'rule' => array(
- 'requireWhen',
- 'create_option',
- RegistrationsComponent::REGISTRATION_CREATE_OPT_NEW),
+ 'requireWhen', 'create_option', RegistrationsComponent::REGISTRATION_CREATE_OPT_NEW),
'message' => sprintf(__d('net_commons', 'Please input %s.'), __d('registrations', 'Title')),
'required' => false,
),
'past_registration_id' => array(
'requireWhen' => array(
- 'rule' => array(
- 'requireWhen',
- 'create_option',
- RegistrationsComponent::REGISTRATION_CREATE_OPT_REUSE),
+ 'rule' => array('requireWhen', 'create_option', RegistrationsComponent::REGISTRATION_CREATE_OPT_REUSE),
'message' => __d('registrations', 'Please select past registration.'),
),
'checkPastRegistration' => array(
@@ -130,20 +127,11 @@ public function requireWhen($check, $sourceField, $sourceValue) {
* @return bool
*/
public function checkPastRegistration($check) {
- if ($this->data['ActionRegistrationAdd']['create_option'] !=
- RegistrationsComponent::REGISTRATION_CREATE_OPT_REUSE) {
+ if ($this->data['ActionRegistrationAdd']['create_option'] != RegistrationsComponent::REGISTRATION_CREATE_OPT_REUSE) {
return true;
}
$this->Registration = ClassRegistry::init('Registrations.Registration', true);
- $baseCondition = $this->Registration->getBaseCondition(array(
- 'Registration.id' => $check['past_registration_id']
- ));
- unset($baseCondition['block_id']);
- unset($baseCondition['Registration.block_id']);
- $cnt = $this->Registration->find('count', array(
- 'conditions' => $baseCondition,
- 'recursive' => -1
- ));
+ $cnt = $this->Registration->find('count', array('id' => $check));
if ($cnt == 0) {
return false;
}
@@ -203,8 +191,7 @@ protected function _createFromReuse() {
// そのデータから今回作成する登録フォームデータ基本構成を作成し返す
// 過去の登録フォームのコピー・クローンで作成
- $registrationId = $this->data['ActionRegistrationAdd']['past_registration_id'];
- $registration = $this->_getRegistrationCloneById($registrationId);
+ $registration = $this->_getRegistrationCloneById($this->data['ActionRegistrationAdd']['past_registration_id']);
return $registration;
}
/**
@@ -223,15 +210,9 @@ protected function _getDefaultRegistration($addData) {
'key' => '',
'status' => WorkflowComponent::STATUS_IN_DRAFT,
'is_total_show' => RegistrationsComponent::EXPRESSION_SHOW,
- 'answer_timing' => RegistrationsComponent::USES_NOT_USE,
+ 'public_type' => WorkflowBehavior::PUBLIC_TYPE_PUBLIC,
'is_key_pass_use' => RegistrationsComponent::USES_NOT_USE,
'total_show_timing' => RegistrationsComponent::USES_NOT_USE,
- 'registration_mail_subject' =>
- __d('registrations', 'Registration.mail.default.subject'),
- 'registration_mail_body' =>
- __d('registrations', 'Registration.mail.default.body'),
- 'thanks_content' =>
- __d('registrations', 'Thank you for registering.'),
),
$addData);
@@ -245,55 +226,18 @@ protected function _getDefaultRegistration($addData) {
* @return array
*/
protected function _getRegistrationCloneById($registrationId) {
- // 前もってValidate処理で存在確認されている場合しか
- // この関数が呼ばれないので$registrationの判断は不要
$registration = $this->Registration->find('first', array(
'conditions' => array('Registration.id' => $registrationId),
- 'recursive' => 1
));
+
+ if (!$registration) {
+ return $this->getDefaultRegistration(array('title' => ''));
+ }
// ID値のみクリア
$this->Registration->clearRegistrationId($registration);
- // Wysiwygエディタ内のファイルの複製処理
- $registration = $this->_copyWysiwygFiles($registration);
return $registration;
}
-/**
- * _copyWysiwygFiles
- *
- * 引数で指定された登録フォームの中を分析し、
- * ウィジウィグに設定されているファイルは複製を作ります
- *
- * @param array $registration 登録フォームデータ
- * @return array $registration 複製を作り終えた登録フォームデータ
- */
- protected function _copyWysiwygFiles($registration) {
- $wysiswyg = new WysiwygZip();
- $flatRegistration = Hash::flatten($registration);
- foreach ($flatRegistration as $key => &$value) {
- $model = null;
- if (strpos($key, 'RegistrationQuestion.') !== false) {
- $model = $this->RegistrationQuestion;
- } elseif (strpos($key, 'RegistrationPage.') !== false) {
- $model = $this->RegistrationPage;
- } elseif (strpos($key, 'Registration.') !== false) {
- $model = $this->Registration;
- }
- if (!$model) {
- continue;
- }
- $columnName = substr($key, strrpos($key, '.') + 1);
- if ($model->hasField($columnName)) {
- if ($model->getColumnType($columnName) == 'text') {
- $wysiswygZipFile = $wysiswyg->createWysiwygZip($value);
- $value = $wysiswyg->getFromWysiwygZip($wysiswygZipFile);
- }
- }
- }
- $registration = Hash::expand($flatRegistration);
- return $registration;
- }
-
/**
* _createFromTemplate
*
@@ -305,57 +249,47 @@ protected function _createFromTemplate() {
// アップされたファイルをもとに、登録フォームデータを解凍、取得し、
// そのデータから今回作成する登録フォームデータ基本構成を作成し返す
- if (empty($this->data['ActionRegistrationAdd']['template_file']['name'])) {
- $this->validationErrors['template_file'][] =
- __d('registrations', 'Please input template file.');
+ // アップロードファイルを受け取り、
+ $uploadFile = new TemporaryUploadFile(Hash::get($this->data, 'ActionRegistrationAdd.template_file'));
+ // エラーチェック
+ if (! $uploadFile) {
+ $this->validationErrors['Registration']['template_file'] = __d('registrations', 'file upload error.');
return null;
}
- try {
- // アップロードファイルを受け取り、
- // エラーチェックはない。ここでのエラー時はInternalErrorExceptionとなる
- $uploadFile = new TemporaryUploadFile($this->data['ActionRegistrationAdd']['template_file']);
-
- // アップロードファイル解凍
- $unZip = new UnZip($uploadFile->path);
- $temporaryFolder = $unZip->extract();
- // エラーチェック
- if (! $temporaryFolder) {
- $this->validationErrors['template_file'][] = __d('registrations', 'illegal import file.');
- return null;
- }
-
- // フィンガープリント確認
- $fingerPrint = $this->__checkFingerPrint($temporaryFolder->path);
- if ($fingerPrint === false) {
- $this->validationErrors['template_file'][] = __d('registrations', 'illegal import file.');
- return null;
- }
+ // アップロードファイル解凍
+ $unZip = new UnZip($uploadFile->path);
+ $temporaryFolder = $unZip->extract();
+ // エラーチェック
+ if (! $temporaryFolder) {
+ $this->validationErrors['Registration']['template_file'] = __d('registrations', 'illegal import file.');
+ return null;
+ }
- // 登録フォームテンプレートファイル本体をテンポラリフォルダに展開する。
- $registrationZip = new UnZip(
- $temporaryFolder->path . DS . RegistrationsComponent::REGISTRATION_TEMPLATE_FILENAME);
- if (! $registrationZip->extract()) {
- $this->validationErrors['template_file'][] =
- __d('registrations', 'illegal import file.');
- return null;
- }
+ // フィンガープリント確認
+ $fingerPrint = $this->__checkFingerPrint($temporaryFolder->path);
+ if ($fingerPrint === false) {
+ $this->validationErrors['Registration']['template_file'] = __d('registrations', 'illegal import file.');
+ return null;
+ }
- // jsonファイルを読み取り、PHPオブジェクトに変換
- $jsonFilePath =
- $registrationZip->path . DS . RegistrationsComponent::REGISTRATION_JSON_FILENAME;
- $jsonFile = new File($jsonFilePath);
- $jsonData = $jsonFile->read();
- $jsonRegistration = json_decode($jsonData, true);
- } catch (Exception $ex) {
- $this->validationErrors['template_file'][] = __d('registrations', 'file upload error.');
+ // 登録フォームテンプレートファイル本体をテンポラリフォルダに展開する。
+ $registrationZip = new UnZip($temporaryFolder->path . DS . RegistrationsComponent::REGISTRATION_TEMPLATE_FILENAME);
+ if (! $registrationZip->extract()) {
+ $this->validationErrors['Registration']['template_file'] = __d('registrations', 'illegal import file.');
return null;
}
+ // jsonファイルを読み取り、PHPオブジェクトに変換
+ $jsonFilePath = $registrationZip->path . DS . RegistrationsComponent::REGISTRATION_JSON_FILENAME;
+ $jsonFile = new File($jsonFilePath);
+ $jsonData = $jsonFile->read();
+ $jsonRegistration = json_decode($jsonData, true);
+
// 初めにファイルに記載されている登録フォームプラグインのバージョンと
// 現サイトの登録フォームプラグインのバージョンを突合し、差分がある場合はインポート処理を中断する。
- if ($this->_checkVersion($jsonRegistration) === false) {
- $this->validationErrors['template_file'][] = __d('registrations', 'version is different.');
+ if ($this->__checkVersion($jsonRegistration) === false) {
+ $this->validationErrors['Registration']['template_file'] = __d('registrations', 'version is different.');
return null;
}
@@ -378,7 +312,7 @@ protected function _createFromTemplate() {
* @return array RegistrationData
*/
protected function _getRegistrations($folderPath, $registrations, $importKey) {
- $wysiswyg = new WysiwygZip();
+ $wysiswyg = new WysIsWygDownloader();
foreach ($registrations as &$q) {
// WysIsWygのデータを入れなおす
@@ -401,9 +335,7 @@ protected function _getRegistrations($folderPath, $registrations, $importKey) {
if ($model->getColumnType($columnName) == 'text') {
// keyと同じ名前のフォルダの下にあるkeyの名前のZIPファイルを渡して
// その返ってきた値をこのカラムに設定
- $value =
- $wysiswyg->getFromWysiwygZip(
- $folderPath . DS . $value, $model->alias . '.' . $columnName);
+ $value = $wysiswyg->getFromWysIsWygZIP($folderPath . DS . $value, $model->alias . '.' . $columnName);
}
}
}
@@ -420,15 +352,12 @@ protected function _getRegistrations($folderPath, $registrations, $importKey) {
*/
private function __checkFingerPrint($folderPath) {
// フィンガープリントファイルを取得
- $file = new File(
- $folderPath . DS . RegistrationsComponent::REGISTRATION_FINGER_PRINT_FILENAME,
- false);
+ $file = new File($folderPath . DS . RegistrationsComponent::REGISTRATION_FINGER_PRINT_FILENAME, false);
$fingerPrint = $file->read();
// ファイル内容から算出されるハッシュ値と指定されたフットプリント値を比較し
// 同一であれば正当性が保証されたと判断する(フォーマットチェックなどは行わない)
- $registrationZipFile =
- $folderPath . DS . RegistrationsComponent::REGISTRATION_TEMPLATE_FILENAME;
+ $registrationZipFile = $folderPath . DS . RegistrationsComponent::REGISTRATION_TEMPLATE_FILENAME;
if (sha1_file($registrationZipFile, false) != $fingerPrint) {
return false;
}
@@ -436,14 +365,14 @@ private function __checkFingerPrint($folderPath) {
return $fingerPrint;
}
/**
- * _checkVersion
+ * __checkVersion
*
* @param array $jsonData バージョンが含まれたJson
* @return bool
*/
- protected function _checkVersion($jsonData) {
+ private function __checkVersion($jsonData) {
// バージョン情報を取得するためComposer情報を得る
- $Plugin = ClassRegistry::init('PluginManager.Plugin');
+ $Plugin = ClassRegistry::init('Plugins.Plugin');
$composer = $Plugin->getComposer('netcommons/registrations');
if (!$composer) {
return false;
diff --git a/Model/Behavior/MailSettingBehavior.php b/Model/Behavior/MailSettingBehavior.php
deleted file mode 100644
index d38bf8b..0000000
--- a/Model/Behavior/MailSettingBehavior.php
+++ /dev/null
@@ -1,105 +0,0 @@
-
- * @author Ryuji AMANO
- * @link http://www.netcommons.org NetCommons Project
- * @license http://www.netcommons.org/license.txt NetCommons License
- * @copyright Copyright 2014, NetCommons Project
- */
-
-App::uses('ModelBehavior', 'Model');
-
-/**
- * Answer Behavior
- *
- * @package Registrations\Registrations\Model\Befavior
- * @author Ryuji AMANO
- */
-class MailSettingBehavior extends ModelBehavior {
-
-/**
- * setup
- *
- * @param Model $model モデル
- * @param array $settings 設定値
- * @return void
- * @link http://book.cakephp.org/2.0/ja/models/behaviors.html#ModelBehavior::setup
- */
- public function setup(Model $model, $settings = array()) {
- $this->settings[$model->alias] = $settings;
-
- // Registrationモデルで、MailSettingをloadModels()してないけど、なぜか使えてる。
- // 念のため、ここでloadModels()しておく
- $model->loadModels([
- 'MailSetting' => 'Mails.MailSetting',
- 'MailSettingFixedPhrase' => 'Mails.MailSettingFixedPhrase',
- ]);
- }
-
-/**
- * フォーム設定にあるメール文面等をメール設定へ反映する
- *
- * @param Model $model Model
- * @param array $saveRegistration Registraion データ
- * @return void
- * @throws InternalErrorException
- */
- public function updateMailSetting(Model $model, $saveRegistration) {
- // 登録通知メール設定を取得
- $mailSetting = $model->MailSetting->getMailSettingPlugin(
- $saveRegistration[$model->alias]['language_id'],
- array(MailSettingFixedPhrase::DEFAULT_TYPE, MailSettingFixedPhrase::ANSWER_TYPE),
- $model->plugin
- );
- if (! Hash::check($mailSetting, 'MailSetting.id')) {
- // まだメール設定がないときは、登録フォームで登録通知メールONならメール設定も送信する設定にする。
- // 上記はとりやめて、「メール通知機能を使う」と「登録通知メールを送る」のOn/Offは連動しないように変更
- $model->MailSetting->create();
- $model->MailSettingFixedPhrase->create();
- }
- // 登録通知メール設定を変更
- $pluginLowercase = strtolower(Inflector::singularize($model->plugin));
- $mailSetting['MailSetting']['plugin_key'] = strtolower($model->plugin);
- $mailSetting['MailSetting']['block_key'] = Current::read('Block.key');
- $mailSetting['MailSetting']['reply_to']
- = $saveRegistration[$model->alias]['reply_to'];
- $mailSetting['MailSettingFixedPhrase']['answer']['mail_fixed_phrase_subject']
- = $saveRegistration[$model->alias][$pluginLowercase . '_mail_subject'];
- $mailSetting['MailSettingFixedPhrase']['answer']['mail_fixed_phrase_body']
- = $saveRegistration[$model->alias][$pluginLowercase . '_mail_body'];
- $mailSetting['MailSettingFixedPhrase']['answer']['plugin_key'] = strtolower($model->plugin);
- $mailSetting['MailSettingFixedPhrase']['answer']['block_key'] = Current::read('Block.key');
- $mailSetting['MailSettingFixedPhrase']['contents']['plugin_key'] = strtolower($model->plugin);
- $mailSetting['MailSettingFixedPhrase']['contents']['block_key'] = Current::read('Block.key');
-
- // 登録通知メール設定を保存
- if ($model->MailSetting->save($mailSetting)) {
- $mailSetting = Hash::insert(
- $mailSetting,
- 'MailSettingFixedPhrase.answer.mail_setting_id',
- $model->MailSetting->id
- );
- $mailSetting = Hash::insert(
- $mailSetting,
- 'MailSettingFixedPhrase.contents.mail_setting_id',
- $model->MailSetting->id
- );
- $answerPhrase = $mailSetting['MailSettingFixedPhrase']['answer'];
- if (!$model->MailSettingFixedPhrase->save($answerPhrase)) {
- throw new InternalErrorException(
- __d('net_commons', 'Internal Server Error')
- );
- }
- $model->MailSettingFixedPhrase->create();
- $contentsPhrase = $mailSetting['MailSettingFixedPhrase']['contents'];
- if (!$model->MailSettingFixedPhrase->save($contentsPhrase)) {
- throw new InternalErrorException(
- __d('net_commons', 'Internal Server Error')
- );
- }
- }
- }
-
-}
\ No newline at end of file
diff --git a/Model/Behavior/RegistrationAnswerBehavior.php b/Model/Behavior/RegistrationAnswerBehavior.php
index fda7de4..055097b 100644
--- a/Model/Behavior/RegistrationAnswerBehavior.php
+++ b/Model/Behavior/RegistrationAnswerBehavior.php
@@ -10,6 +10,7 @@
*/
App::uses('ModelBehavior', 'Model');
+App::uses('RegistrationsComponent', 'Registrations.Controller/Component');
/**
* Answer Behavior
@@ -66,8 +67,7 @@ public function setup(Model $Model, $settings = array()) {
*/
public function beforeSave(Model $model, $options = array()) {
if (isset($model->data['RegistrationAnswer']['multi_answer_values'])) {
- $model->data['RegistrationAnswer']['answer_value'] =
- $model->data['RegistrationAnswer']['multi_answer_values'];
+ $model->data['RegistrationAnswer']['answer_value'] = $model->data['RegistrationAnswer']['multi_answer_values'];
}
// elseif (isset($this->data['RegistrationAnswer']['matrix_answer_values'])) {
return true;
@@ -86,39 +86,24 @@ public function afterFind(Model $model, $results, $primary = false) {
// afterFind 選択肢系の登録の場合、answer_value に [id:value|id:value....]の形で収まっているので
// それをデータ入力画面から渡されるデータ形式と同じにする
foreach ($results as &$val) {
-
- if (isset($val['RegistrationAnswer']['answer_value']) &&
- isset($val['RegistrationQuestion']['question_type'])) {
-
+ if (isset($val['RegistrationAnswer']['answer_value']) && isset($val['RegistrationQuestion']['question_type'])) {
if ($val['RegistrationQuestion']['question_type'] != $this->_myType) {
continue;
}
- if (! $this->_isTypeAnsChgArr) {
- continue;
- }
- //$val['RegistrationAnswer']['answer_value'] == 選択肢登録の場合、登録が|区切りで1行にまとまっています
- $val['RegistrationAnswer']['answer_values'] = array();
- // まとまっているものを分割します
- $answers = explode(
- RegistrationsComponent::ANSWER_DELIMITER,
- trim(
- $val['RegistrationAnswer']['answer_value'],
- RegistrationsComponent::ANSWER_DELIMITER));
- // valuesエリアに分割したデータを保存
- $val['RegistrationAnswer']['answer_values'] = Hash::combine(
- array_map(
- 'explode',
- array_fill(0, count($answers), RegistrationsComponent::ANSWER_VALUE_DELIMITER),
- $answers),
- '{n}.0',
- '{n}.1');
- // answer_valueは画面で登録してもらうための変数なので、画面に見合った形に整形
- $val['RegistrationAnswer']['answer_value'] = array_map(
- array($this, 'setDelimiter'),
- $answers);
- // array_mapで配列化するのでSingle選択のときはFlatに戻す必要がある
- if ($this->_isTypeAnsArrShiftUp) {
- $val['RegistrationAnswer']['answer_value'] = $val['RegistrationAnswer']['answer_value'][0];
+ if ($this->_isTypeAnsChgArr) {
+ $val['RegistrationAnswer']['answer_values'] = array();
+ $answers = explode(RegistrationsComponent::ANSWER_DELIMITER, trim($val['RegistrationAnswer']['answer_value'], RegistrationsComponent::ANSWER_DELIMITER));
+ $val['RegistrationAnswer']['answer_values'] = Hash::combine(
+ array_map('explode',
+ array_fill(0, count($answers), RegistrationsComponent::ANSWER_VALUE_DELIMITER),
+ $answers),
+ '{n}.0', '{n}.1');
+ $val['RegistrationAnswer']['answer_value'] = array_map(array($this, 'setDelimiter'), $answers);
+
+ // array_mapで配列化するのでSingle選択のときはFlatに戻す必要がある
+ if ($this->_isTypeAnsArrShiftUp) {
+ $val['RegistrationAnswer']['answer_value'] = $val['RegistrationAnswer']['answer_value'][0];
+ }
}
}
}
@@ -148,9 +133,7 @@ protected function _decomposeAnswerValue(&$dst, $src) {
if (!is_array($dst)) {
$dst = array(); // 初期化
}
- $answers = explode(
- RegistrationsComponent::ANSWER_VALUE_DELIMITER,
- trim($src, RegistrationsComponent::ANSWER_DELIMITER));
+ $answers = explode(RegistrationsComponent::ANSWER_VALUE_DELIMITER, trim($src, RegistrationsComponent::ANSWER_DELIMITER));
$dst[$answers[0]] = isset($answers[1]) ? $answers[1] : '';
}
@@ -159,13 +142,11 @@ protected function _decomposeAnswerValue(&$dst, $src) {
* その他オプションにチェックが入っていないのにその他欄に何か書いてあったら空にする
*
* @param Model $model Model using this behavior
- * @param array $question 項目データ
+ * @param array $question 質問データ
* @return void
*/
protected function _setupOtherAnswerValue(Model $model, $question) {
- $choice = Hash::extract(
- $question['RegistrationChoice'],
- '{n}[other_choice_type!=' . RegistrationsComponent::OTHER_CHOICE_TYPE_NO_OTHER_FILED . ']');
+ $choice = Hash::extract($question['RegistrationChoice'], '{n}[other_choice_type!=' . RegistrationsComponent::OTHER_CHOICE_TYPE_NO_OTHER_FILED . ']');
if (! $choice) {
return;
}
@@ -177,17 +158,18 @@ protected function _setupOtherAnswerValue(Model $model, $question) {
}
/**
- * answerRequire 登録必須の項目の場合登録されているかの確認
+ * answerRequire 登録必須の質問の場合登録されているかの確認
*
- * @param object $model use model
+ * @param object &$model use model
* @param array $data Validation対象データ
- * @param array $question 登録データに対応する項目
+ * @param array $question 登録データに対応する質問
* @return bool
*/
- public function answerRequire($model, $data, $question) {
+ public function answerRequire(&$model, $data, $question) {
if ($question['is_require'] != RegistrationsComponent::REQUIRES_REQUIRE) {
return true;
}
+
if (isset($model->data['RegistrationAnswer']['multi_answer_values'])) {
return Validation::notBlank($model->data['RegistrationAnswer']['multi_answer_values']);
} else {
@@ -195,4 +177,29 @@ public function answerRequire($model, $data, $question) {
}
}
+/**
+ * answerMaxLength 登録が登録フォームが許す最大長を超えていないかの確認
+ *
+ * @param object &$model use model
+ * @param array $data Validation対象データ
+ * @param array $question 登録データに対応する質問
+ * @param int $max 最大長
+ * @return bool
+ */
+ public function answerMaxLength(&$model, $data, $question, $max) {
+ return true;
+ }
+
+/**
+ * answerValidation 登録内容の正当性
+ *
+ * @param object &$model use model
+ * @param array $data Validation対象データ
+ * @param array $question 登録データに対応する質問
+ * @param array $allAnswers 入力された登録すべて
+ * @return bool
+ */
+ public function answerValidation(&$model, $data, $question, $allAnswers) {
+ return true;
+ }
}
\ No newline at end of file
diff --git a/Model/Behavior/RegistrationAnswerDatetimeBehavior.php b/Model/Behavior/RegistrationAnswerDatetimeBehavior.php
index 6433c19..9c8db73 100644
--- a/Model/Behavior/RegistrationAnswerDatetimeBehavior.php
+++ b/Model/Behavior/RegistrationAnswerDatetimeBehavior.php
@@ -26,15 +26,6 @@ class RegistrationAnswerDatetimeBehavior extends RegistrationAnswerBehavior {
*/
protected $_myType = RegistrationsComponent::TYPE_DATE_AND_TIME;
-/**
- * datetime validate check type
- *
- * @var array
- */
- protected $_datetmValidateType = array(
- RegistrationsComponent::TYPE_DATE_AND_TIME
- );
-
/**
* Answer datetime format
*
@@ -49,59 +40,52 @@ class RegistrationAnswerDatetimeBehavior extends RegistrationAnswerBehavior {
/**
* answerValidation 登録内容の正当性
*
- * @param object $model use model
+ * @param object &$model use model
* @param array $data Validation対象データ
- * @param array $question 登録データに対応する項目
+ * @param array $question 登録データに対応する質問
* @param array $allAnswers 入力された登録すべて
* @return bool
*/
- public function answerDatetimeValidation($model, $data, $question, $allAnswers) {
- if (! in_array($question['question_type'], $this->_datetmValidateType)) {
+ public function answerValidation(&$model, $data, $question, $allAnswers) {
+ if ($question['question_type'] != $this->_myType) {
return true;
}
$answer = $data['answer_value'];
$ret = true;
- if ($question['is_require'] === true || $data['answer_value']) {
- if (!$this->_validateDatetime($model, $question['question_type_option'], $answer)) {
- $ret = false;
- }
- if (!$this->_validateTimeRange($model, $question, $answer)) {
- $ret = false;
- }
+ if (! $this->_validateDatetime($model, $question['question_type_option'], $answer)) {
+ $ret = false;
+ }
+ if (! $this->_validateTimeRange($model, $question, $answer)) {
+ $ret = false;
}
return $ret;
}
/**
* _validateDatetime 日付・時間の正当性
*
- * @param object $model use model
+ * @param object &$model use model
* @param int $questionTypeOption 時間・日付オプション
* @param string $answer 登録データ
* @return bool
*/
- protected function _validateDatetime($model, $questionTypeOption, $answer) {
+ protected function _validateDatetime(&$model, $questionTypeOption, $answer) {
if ($questionTypeOption == RegistrationsComponent::TYPE_OPTION_DATE) {
if (! Validation::date($answer, 'ymd')) {
- $model->validationErrors['answer_value'][] =
- __d('registrations', 'Please enter a valid date in YY-MM-DD format.');
+ $model->validationErrors['answer_value'][] = sprintf(__d('registrations', 'Please enter a valid date in YY-MM-DD format.'));
return false;
}
} elseif ($questionTypeOption == RegistrationsComponent::TYPE_OPTION_TIME) {
if (! Validation::time($answer)) {
- $model->validationErrors['answer_value'][] =
- __d('registrations', 'Please enter the time.');
+ $model->validationErrors['answer_value'][] = sprintf(__d('registrations', 'Please enter the time.'));
return false;
}
} elseif ($questionTypeOption == RegistrationsComponent::TYPE_OPTION_DATE_TIME) {
if (! Validation::datetime($answer, 'ymd')) {
- $model->validationErrors['answer_value'][] =
- __d('registrations', 'Please enter a valid date and time.');
+ $model->validationErrors['answer_value'][] = sprintf(__d('registrations', 'Please enter a valid date and time.'));
return false;
}
} else {
- $model->validationErrors['answer_value'][] =
- __d('net_commons', 'Invalid request.');
return false;
}
return true;
@@ -109,26 +93,20 @@ protected function _validateDatetime($model, $questionTypeOption, $answer) {
/**
* _validateDatetime 日付・時間の正当性
*
- * @param object $model use model
- * @param array $question 登録データに対応する項目
+ * @param object &$model use model
+ * @param array $question 登録データに対応する質問
* @param string $answer 登録データ
* @return bool
*/
- protected function _validateTimeRange($model, $question, $answer) {
- if ($question['is_range'] != RegistrationsComponent::USES_USE) {
- return true;
- }
- $rangeResult = Validation::range(
- strtotime($answer),
- strtotime($question['min']) - 1,
- strtotime($question['max']) + 1);
- if ($rangeResult) {
- return true;
+ protected function _validateTimeRange(&$model, $question, $answer) {
+ if ($question['is_range'] == RegistrationsComponent::USES_USE) {
+ if (! Validation::range(strtotime($answer), strtotime($question['min']) - 1, strtotime($question['max']) + 1)) {
+ $model->validationErrors['answer_value'][] = sprintf(__d('registrations', 'Please enter the answer between %s and %s.',
+ date($this->_datetimeFormat[$question['question_type_option']], strtotime($question['min'])),
+ date($this->_datetimeFormat[$question['question_type_option']], strtotime($question['max']))));
+ return false;
+ }
}
- $model->validationErrors['answer_value'][] = sprintf(
- __d('registrations', 'Please enter the answer between %s and %s.'),
- date($this->_datetimeFormat[$question['question_type_option']], strtotime($question['min'])),
- date($this->_datetimeFormat[$question['question_type_option']], strtotime($question['max'])));
- return false;
+ return true;
}
}
\ No newline at end of file
diff --git a/Model/Behavior/RegistrationAnswerEmailBehavior.php b/Model/Behavior/RegistrationAnswerEmailBehavior.php
index fa9957c..57bb022 100644
--- a/Model/Behavior/RegistrationAnswerEmailBehavior.php
+++ b/Model/Behavior/RegistrationAnswerEmailBehavior.php
@@ -3,7 +3,7 @@
* RegistrationValidate Behavior
*
* @author Noriko Arai
- * @author Ryuji AMANO
+ * @author Allcreator
* @link http://www.netcommons.org NetCommons Project
* @license http://www.netcommons.org/license.txt NetCommons License
* @copyright Copyright 2014, NetCommons Project
@@ -12,7 +12,7 @@
App::uses('RegistrationAnswerBehavior', 'Registrations.Model/Behavior');
/**
- * Email Behavior
+ * Text Behavior
*
* @package Registrations\Registrations\Model\Befavior\Answer
* @author Allcreator
@@ -29,13 +29,13 @@ class RegistrationAnswerEmailBehavior extends RegistrationAnswerBehavior {
/**
* answerMaxLength 登録が登録フォームが許す最大長を超えていないかの確認
*
- * @param object $model use model
+ * @param object &$model use model
* @param array $data Validation対象データ
- * @param array $question 登録データに対応する項目
+ * @param array $question 登録データに対応する質問
* @param int $max 最大長
* @return bool
*/
- public function answerMaxLength($model, $data, $question, $max) {
+ public function answerMaxLength(&$model, $data, $question, $max) {
if ($question['question_type'] != $this->_myType) {
return true;
}
@@ -45,38 +45,25 @@ public function answerMaxLength($model, $data, $question, $max) {
/**
* answerValidation 登録内容の正当性
*
- * @param object $model use model
+ * @param object &$model use model
* @param array $data Validation対象データ
- * @param array $question 登録データに対応する項目
+ * @param array $question 登録データに対応する質問
* @param array $allAnswers 入力された登録すべて
* @return bool
*/
- public function answerEmailValidation($model, $data, $question, $allAnswers) {
+ public function answerEmailValidation(&$model, $data, $question, $allAnswers) {
if ($question['question_type'] != $this->_myType) {
return true;
}
- if ($question['is_require'] === true || $data['answer_value']) {
- return Validation::email($data['answer_value']);
- }
- return true;
+ return Validation::email($data['answer_value']);
}
-
-/**
- * 確認用メールアドレスが一致するか
- *
- * @param Model $model Model
- * @param array $data Validation対象データ
- * @param array $question 登録データに対する項目
- * @param array $allAnswers 入力された登録すべて
- * @return bool
- */
- public function answerEmailConfirmValidation($model, $data, $question, $allAnswers) {
+ public function answerEmailConfirmValidation(&$model, $data, $question, $allAnswers) {
if ($question['question_type'] != $this->_myType) {
return true;
}
$questionKey = $question['key'];
- $confirmData = $allAnswers[$questionKey][0]['answer_value_again'];
+ $confirmData = $allAnswers[$questionKey][0]['answer_value_confirm'];
return ($confirmData == $data['answer_value']);
- }
-}
+ }
+}
\ No newline at end of file
diff --git a/Model/Behavior/RegistrationAnswerFileBehavior.php b/Model/Behavior/RegistrationAnswerFileBehavior.php
deleted file mode 100644
index 5cc1dea..0000000
--- a/Model/Behavior/RegistrationAnswerFileBehavior.php
+++ /dev/null
@@ -1,61 +0,0 @@
-
- * @author Ryuji AMANO
- * @link http://www.netcommons.org NetCommons Project
- * @license http://www.netcommons.org/license.txt NetCommons License
- * @copyright Copyright 2014, NetCommons Project
- */
-
-App::uses('RegistrationAnswerBehavior', 'Registrations.Model/Behavior');
-
-/**
- * Email Behavior
- *
- * @package Registrations\Registrations\Model\Befavior\Answer
- * @author Allcreator
- */
-class RegistrationAnswerFileBehavior extends RegistrationAnswerBehavior {
-
-/**
- * this answer type
- *
- * @var int
- */
- protected $_myType = RegistrationsComponent::TYPE_FILE;
-
-/**
- * answerMaxLength 登録が登録フォームが許す最大長を超えていないかの確認
- *
- * @param object $model use model
- * @param array $data Validation対象データ
- * @param array $question 登録データに対応する項目
- * @param int $max 最大長
- * @return bool
- */
- public function answerMaxLength($model, $data, $question, $max) {
- if ($question['question_type'] != $this->_myType) {
- return true;
- }
- return Validation::maxLength($data['answer_value'], $max);
- }
-
-/**
- * answerValidation 登録内容の正当性
- *
- * @param object $model use model
- * @param array $data Validation対象データ
- * @param array $question 登録データに対応する項目
- * @param array $allAnswers 入力された登録すべて
- * @return bool
- */
- public function answerFileValidation($model, $data, $question, $allAnswers) {
- if ($question['question_type'] != $this->_myType) {
- return true;
- }
- return Validation::email($data['answer_value']);
- }
-}
-
diff --git a/Model/Behavior/RegistrationAnswerMatrixMultipleChoiceBehavior.php b/Model/Behavior/RegistrationAnswerMatrixMultipleChoiceBehavior.php
index 806331d..41511e7 100644
--- a/Model/Behavior/RegistrationAnswerMatrixMultipleChoiceBehavior.php
+++ b/Model/Behavior/RegistrationAnswerMatrixMultipleChoiceBehavior.php
@@ -17,8 +17,7 @@
* @package Registrations\Registrations\Model\Befavior\Answer
* @author Allcreator
*/
-class RegistrationAnswerMatrixMultipleChoiceBehavior
- extends RegistrationAnswerMatrixSingleChoiceBehavior {
+class RegistrationAnswerMatrixMultipleChoiceBehavior extends RegistrationAnswerMatrixSingleChoiceBehavior {
/**
* this answer type
@@ -63,9 +62,7 @@ public function beforeValidate(Model $model, $options = array()) {
$matrixChoiceId = $model->data['RegistrationAnswer']['matrix_choice_key'];
if (is_array($model->data['RegistrationAnswer']['answer_value'])) {
foreach ($model->data['RegistrationAnswer']['answer_value'] as $ans) {
- $this->_decomposeAnswerValue(
- $model->data['RegistrationAnswer']['matrix_answer_values'][$matrixChoiceId],
- $ans);
+ $this->_decomposeAnswerValue($model->data['RegistrationAnswer']['matrix_answer_values'][$matrixChoiceId], $ans);
$model->data['RegistrationAnswer']['multi_answer_values'] .= $ans;
}
}
diff --git a/Model/Behavior/RegistrationAnswerMatrixSingleChoiceBehavior.php b/Model/Behavior/RegistrationAnswerMatrixSingleChoiceBehavior.php
index cee85ce..aa7ff5c 100644
--- a/Model/Behavior/RegistrationAnswerMatrixSingleChoiceBehavior.php
+++ b/Model/Behavior/RegistrationAnswerMatrixSingleChoiceBehavior.php
@@ -42,16 +42,6 @@ class RegistrationAnswerMatrixSingleChoiceBehavior extends RegistrationAnswerBeh
*/
protected $_isTypeAnsArrShiftUp = true;
-/**
- * matrix validate check type
- *
- * @var array
- */
- protected $_matrixValidateType = array(
- RegistrationsComponent::TYPE_MATRIX_SELECTION_LIST,
- RegistrationsComponent::TYPE_MATRIX_MULTIPLE,
- );
-
/**
* beforeValidate is called before a model is validated, you can use this callback to
* add behavior validation rules into a models validate array. Returning false
@@ -69,13 +59,10 @@ public function beforeValidate(Model $model, $options = array()) {
}
$model->data['RegistrationAnswer']['matrix_answer_values'] = array();
$matrixChoiceId = $model->data['RegistrationAnswer']['matrix_choice_key'];
-
if (isset($model->data['RegistrationAnswer']['answer_value'])) {
- $this->_decomposeAnswerValue(
- $model->data['RegistrationAnswer']['answer_values'],
+ $this->_decomposeAnswerValue($model->data['RegistrationAnswer']['answer_values'],
$model->data['RegistrationAnswer']['answer_value']);
- $this->_decomposeAnswerValue(
- $model->data['RegistrationAnswer']['matrix_answer_values'][$matrixChoiceId],
+ $this->_decomposeAnswerValue($model->data['RegistrationAnswer']['matrix_answer_values'][$matrixChoiceId],
$model->data['RegistrationAnswer']['answer_value']);
}
$this->_setupOtherAnswerValue($model, $question);
@@ -84,37 +71,26 @@ public function beforeValidate(Model $model, $options = array()) {
/**
* answerValidation 登録内容の正当性
*
- * @param object $model use model
+ * @param object &$model use model
* @param array $data Validation対象データ
- * @param array $question 登録データに対応する項目
+ * @param array $question 登録データに対応する質問
* @param array $allAnswers 入力された登録すべて
* @return bool
*/
- public function answerMatrixValidation($model, $data, $question, $allAnswers) {
- if (! in_array($question['question_type'], $this->_matrixValidateType)) {
+ public function answerValidation(&$model, $data, $question, $allAnswers) {
+ if ($question['question_type'] != $this->_myType) {
return true;
}
$ret = true;
if (isset($model->data['RegistrationAnswer']['matrix_answer_values'])) {
$list = Hash::combine($question['RegistrationChoice'], '{n}.key', '{n}.key');
- if (! $this->checkMatrixAnswerInList(
- $model,
- $model->data['RegistrationAnswer']['matrix_answer_values'],
- $list)) {
+ if (! $this->checkMatrixAnswerInList($model, $model->data['RegistrationAnswer']['matrix_answer_values'], $list)) {
$ret = false;
}
- if (! $this->checkMatrixOtherAnswer(
- $model,
- $question,
- $model->data['RegistrationAnswer']['matrix_answer_values'],
- $model->data['RegistrationAnswer'])) {
+ if (! $this->checkMatrixOtherAnswer($model, $question, $model->data['RegistrationAnswer']['matrix_answer_values'], $model->data['RegistrationAnswer'])) {
$ret = false;
}
- if (! $this->checkMatrixAnswerFill(
- $model,
- $question,
- $model->data['RegistrationAnswer'],
- $allAnswers)) {
+ if (! $this->checkMatrixAnswerFill($model, $question, $model->data['RegistrationAnswer'], $allAnswers)) {
$ret = false;
}
}
@@ -124,12 +100,12 @@ public function answerMatrixValidation($model, $data, $question, $allAnswers) {
/**
* checkMatrixAnswerInList
*
- * @param object $model use model
+ * @param object &$model use model
* @param string $answers answer value
* @param int $list choice list ( choice key list)
* @return bool
*/
- public function checkMatrixAnswerInList($model, $answers, $list) {
+ public function checkMatrixAnswerInList(&$model, $answers, $list) {
$ret = true;
foreach ($answers as $matrixRowId => $matrixColAns) {
if (!Validation::inList(strval($matrixRowId), $list)) {
@@ -150,28 +126,21 @@ public function checkMatrixAnswerInList($model, $answers, $list) {
/**
* checkMatrixOtherAnswer
*
- * @param object $model use model
+ * @param object &$model use model
* @param array $question question
* @param string $answers answer value
* @param string $otherAnswer other answer string
* @return bool
*/
- public function checkMatrixOtherAnswer($model, $question, $answers, $otherAnswer) {
+ public function checkMatrixOtherAnswer(&$model, $question, $answers, $otherAnswer) {
// このやり方だと、「その他」行がマトリクスにある時は必ず入力しなきゃいけなくなる?
// 選択肢を何も選択しなかったらAnswerデータが飛んでこないからチェックにかからないか?
$rowIds = array_keys($answers);
-
foreach ($rowIds as $matrixRowId) {
-
- $results = Hash::extract(
- $question['RegistrationChoice'],
- '{n}[key=' . $matrixRowId . ']');
-
- if ($results &&
- $results[0]['other_choice_type'] != RegistrationsComponent::OTHER_CHOICE_TYPE_NO_OTHER_FILED) {
+ $results = Hash::extract($question['RegistrationChoice'], '{n}[key=' . $matrixRowId . ']');
+ if ($results && $results[0]['other_choice_type'] != RegistrationsComponent::OTHER_CHOICE_TYPE_NO_OTHER_FILED) {
if (empty($otherAnswer['other_answer_value'])) {
- $model->validationErrors['answer_value'][] =
- __d('registrations', 'Please enter something in other item');
+ $model->validationErrors['answer_value'][] = __d('registrations', 'Please enter something in other item');
return false;
}
}
@@ -182,13 +151,13 @@ public function checkMatrixOtherAnswer($model, $question, $answers, $otherAnswer
/**
* checkMatrixAnswerFill
*
- * @param object $model use model
+ * @param object &$model use model
* @param array $question question
* @param string $answers all row answer value
* @param array $allAnswers 入力された登録すべて
* @return array error message
*/
- public function checkMatrixAnswerFill($model, $question, $answers, $allAnswers) {
+ public function checkMatrixAnswerFill(&$model, $question, $answers, $allAnswers) {
if ($model->oneTimeValidateFlag) { // チェック済
return true;
}
@@ -209,8 +178,7 @@ public function checkMatrixAnswerFill($model, $question, $answers, $allAnswers)
}
$model->oneTimeValidateFlag = true; // チェックした
if ($noAnswerCount > 0 && $noAnswerCount < $answerCount) {
- $model->validationErrors['answer_value'][] =
- __d('registrations', 'Please answer about all rows.');
+ $model->validationErrors['answer_value'][] = __d('registrations', 'Please answer about all rows.');
return false;
}
return true;
diff --git a/Model/Behavior/RegistrationAnswerSingleListBehavior.php b/Model/Behavior/RegistrationAnswerSingleListBehavior.php
index 0e25939..15f294c 100644
--- a/Model/Behavior/RegistrationAnswerSingleListBehavior.php
+++ b/Model/Behavior/RegistrationAnswerSingleListBehavior.php
@@ -42,17 +42,6 @@ class RegistrationAnswerSingleListBehavior extends RegistrationAnswerBehavior {
*/
protected $_isTypeAnsArrShiftUp = true;
-/**
- * choice validate check type
- *
- * @var array
- */
- protected $_choiceValidateType = array(
- RegistrationsComponent::TYPE_SELECTION,
- RegistrationsComponent::TYPE_MULTIPLE_SELECTION,
- RegistrationsComponent::TYPE_SINGLE_SELECT_BOX,
- );
-
/**
* beforeValidate is called before a model is validated, you can use this callback to
* add behavior validation rules into a models validate array. Returning false
@@ -77,41 +66,37 @@ public function beforeValidate(Model $model, $options = array()) {
/**
* answerValidation 登録内容の正当性
*
- * @param object $model use model
+ * @param object &$model use model
* @param array $data Validation対象データ
- * @param array $question 登録データに対応する項目
+ * @param array $question 登録データに対応する質問
* @param array $allAnswers 入力された登録すべて
* @return bool
*/
- public function answerChoiceValidation($model, $data, $question, $allAnswers) {
- if (! in_array($question['question_type'], $this->_choiceValidateType)) {
- return true;
- }
- if (! isset($model->data['RegistrationAnswer']['answer_values'])) {
+ public function answerValidation(&$model, $data, $question, $allAnswers) {
+ if ($question['question_type'] != $this->_myType) {
return true;
}
- // 項目に設定されている選択肢を配列にまとめる
- $list = Hash::combine($question['RegistrationChoice'], '{n}.id', '{n}.key');
-
$ret = true;
- // 選択された選択肢IDすべてについて調査する
- $choiceIds = array_keys($model->data['RegistrationAnswer']['answer_values']);
- foreach ($choiceIds as $choiceId) {
- // 選択されたIDは、ちゃんと用意されている選択肢の中のひとつであるか
- if ($choiceId != '' && !Validation::inList(strval($choiceId), $list)) {
- $ret = false;
- $model->validationErrors['answer_value'][] =
- __d('registrations', 'Invalid choice');
- }
- // チェックされている選択肢が「その他」の項目である場合は
- $choice = Hash::extract($question['RegistrationChoice'], '{n}[key=' . $choiceId . ']');
- if ($choice &&
- $choice[0]['other_choice_type'] != RegistrationsComponent::OTHER_CHOICE_TYPE_NO_OTHER_FILED) {
- // 具体的なテキストが書かれていないといけない
- if (empty($model->data['RegistrationAnswer']['other_answer_value'])) {
+ if (isset($model->data['RegistrationAnswer']['answer_values'])) {
+ // 質問に設定されている選択肢を配列にまとめる
+ $list = Hash::combine($question['RegistrationChoice'], '{n}.id', '{n}.key');
+
+ // 選択された選択肢IDすべてについて調査する
+ $choiceIds = array_keys($model->data['RegistrationAnswer']['answer_values']);
+ foreach ($choiceIds as $choiceId) {
+ // 選択されたIDは、ちゃんと用意されている選択肢の中のひとつであるか
+ if ($choiceId != '' && !Validation::inList(strval($choiceId), $list)) {
$ret = false;
- $model->validationErrors['answer_value'][] =
- __d('registrations', 'Please enter something, if you chose the other item');
+ $model->validationErrors['answer_value'][] = __d('registrations', 'Invalid choice');
+ }
+ // チェックされている選択肢が「その他」の項目である場合は
+ $choice = Hash::extract($question['RegistrationChoice'], '{n}[key=' . $choiceId . ']');
+ if ($choice && $choice[0]['other_choice_type'] != RegistrationsComponent::OTHER_CHOICE_TYPE_NO_OTHER_FILED) {
+ // 具体的なテキストが書かれていないといけない
+ if (empty($model->data['RegistrationAnswer']['other_answer_value'])) {
+ $ret = false;
+ $model->validationErrors['answer_value'][] = __d('registrations', 'Please enter something, if you chose the other item');
+ }
}
}
}
diff --git a/Model/Behavior/RegistrationAnswerTextAreaBehavior.php b/Model/Behavior/RegistrationAnswerTextAreaBehavior.php
index 0126183..475ffb1 100644
--- a/Model/Behavior/RegistrationAnswerTextAreaBehavior.php
+++ b/Model/Behavior/RegistrationAnswerTextAreaBehavior.php
@@ -9,7 +9,7 @@
* @copyright Copyright 2014, NetCommons Project
*/
-App::uses('RegistrationAnswerTextBehavior', 'Registrations.Model/Behavior');
+App::uses('RegistrationAnswerBehavior', 'Registrations.Model/Behavior');
/**
* TextArea Behavior
@@ -17,7 +17,7 @@
* @package Registrations\Registrations\Model\Befavior\Answer
* @author Allcreator
*/
-class RegistrationAnswerTextAreaBehavior extends RegistrationAnswerTextBehavior {
+class RegistrationAnswerTextAreaBehavior extends RegistrationAnswerBehavior {
/**
* this answer type
@@ -27,11 +27,19 @@ class RegistrationAnswerTextAreaBehavior extends RegistrationAnswerTextBehavior
protected $_myType = RegistrationsComponent::TYPE_TEXT_AREA;
/**
- * this answer type
- * needs max length check
+ * answerMaxLength 登録が登録フォームが許す最大長を超えていないかの確認
*
- * @var int
+ * @param object &$model use model
+ * @param array $data Validation対象データ
+ * @param array $question 登録データに対応する質問
+ * @param int $max 最大長
+ * @return bool
*/
- protected $_isMaxLengthCheck = true;
+ public function answerMaxLength(&$model, $data, $question, $max) {
+ if ($question['question_type'] != $this->_myType) {
+ return true;
+ }
+ return Validation::maxLength($data['answer_value'], $max);
+ }
}
\ No newline at end of file
diff --git a/Model/Behavior/RegistrationAnswerTextBehavior.php b/Model/Behavior/RegistrationAnswerTextBehavior.php
index 2a47566..c9f900e 100644
--- a/Model/Behavior/RegistrationAnswerTextBehavior.php
+++ b/Model/Behavior/RegistrationAnswerTextBehavior.php
@@ -26,36 +26,17 @@ class RegistrationAnswerTextBehavior extends RegistrationAnswerBehavior {
*/
protected $_myType = RegistrationsComponent::TYPE_TEXT;
-/**
- * max length check type
- *
- * @var array
- */
- protected $_maxLengthCheckType = array(
- RegistrationsComponent::TYPE_TEXT,
- RegistrationsComponent::TYPE_TEXT_AREA
- );
-
-/**
- * text validate check type
- *
- * @var array
- */
- protected $_textValidateType = array(
- RegistrationsComponent::TYPE_TEXT,
- );
-
/**
* answerMaxLength 登録が登録フォームが許す最大長を超えていないかの確認
*
- * @param object $model use model
+ * @param object &$model use model
* @param array $data Validation対象データ
- * @param array $question 登録データに対応する項目
+ * @param array $question 登録データに対応する質問
* @param int $max 最大長
* @return bool
*/
- public function answerMaxLength($model, $data, $question, $max) {
- if (! in_array($question['question_type'], $this->_maxLengthCheckType)) {
+ public function answerMaxLength(&$model, $data, $question, $max) {
+ if ($question['question_type'] != $this->_myType) {
return true;
}
return Validation::maxLength($data['answer_value'], $max);
@@ -64,46 +45,35 @@ public function answerMaxLength($model, $data, $question, $max) {
/**
* answerValidation 登録内容の正当性
*
- * @param object $model use model
+ * @param object &$model use model
* @param array $data Validation対象データ
- * @param array $question 登録データに対応する項目
+ * @param array $question 登録データに対応する質問
* @param array $allAnswers 入力された登録すべて
* @return bool
- * @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
- public function answerTextValidation($model, $data, $question, $allAnswers) {
- if (! in_array($question['question_type'], $this->_textValidateType)) {
+ public function answerValidation(&$model, $data, $question, $allAnswers) {
+ if ($question['question_type'] != $this->_myType) {
return true;
}
$ret = true;
+
// 数値型登録を望まれている場合
if ($question['question_type_option'] == RegistrationsComponent::TYPE_OPTION_NUMERIC) {
- if (mb_strlen($data['answer_value']) !== 0 && !Validation::numeric($data['answer_value'])) {
+ if (!Validation::numeric($data['answer_value'])) {
$ret = false;
$model->validationErrors['answer_value'][] = __d('registrations', 'Number required');
}
if ($question['is_range'] == RegistrationsComponent::USES_USE) {
- $rangeRes = Validation::range(
- $data['answer_value'],
- intval($question['min']),
- intval($question['max']));
- if (mb_strlen($data['answer_value']) !== 0 && !$rangeRes) {
+ if (!Validation::range($data['answer_value'], intval($question['min']), intval($question['max']))) {
$ret = false;
- $model->validationErrors['answer_value'][] = sprintf(
- __d('registrations', 'Please enter the answer between %s and %s.'),
- $question['min'],
- $question['max']);
+ $model->validationErrors['answer_value'][] = sprintf(__d('registrations', 'Please enter the answer between %s and %s.', $question['min'], $question['max']));
}
}
} else {
if ($question['is_range'] == RegistrationsComponent::USES_USE) {
- if (! Validation::minLength($data['answer_value'], intval($question['min'])) ||
- ! Validation::maxLength($data['answer_value'], intval($question['max']))) {
+ if (!Validation::minLength($data['answer_value'], intval($question['min'])) || !Validation::maxLength($data['answer_value'], intval($question['max']))) {
$ret = false;
- $model->validationErrors['answer_value'][] = sprintf(
- __d('registrations', 'Please enter the answer between %s letters and %s letters.'),
- $question['min'],
- $question['max']);
+ $model->validationErrors['answer_value'][] = sprintf(__d('registrations', 'Please enter the answer between %s letters and %s letters.', $question['min'], $question['max']));
}
}
}
diff --git a/Model/Behavior/RegistrationValidateBehavior.php b/Model/Behavior/RegistrationValidateBehavior.php
index 06ad81b..e78ce3f 100644
--- a/Model/Behavior/RegistrationValidateBehavior.php
+++ b/Model/Behavior/RegistrationValidateBehavior.php
@@ -22,42 +22,18 @@ class RegistrationValidateBehavior extends ModelBehavior {
/**
* Checks if flag is on, required other fields
*
- * @param object $model use model
+ * @param object &$model use model
* @param array $check check data array
* @param mix $requireValue when check data value equal this value, then require other field
* @param array $others require data field names
* @param string $ope require condition AND or OR or XOR
* @return bool
*/
- public function requireOtherFields($model, $check, $requireValue, $others, $ope) {
+ public function requireOtherFields(&$model, $check, $requireValue, $others, $ope) {
$checkPatterns = array(
- 'AND' => array(
- 'midstream' => array(
- 'chk' => true,
- 'ret' => false
- ),
- 'end' => array(
- 'ret' => true
- )
- ),
- 'OR' => array(
- 'midstream' => array(
- 'chk' => false,
- 'ret' => true
- ),
- 'end' => array(
- 'ret' => false
- )
- ),
- 'XOR' => array(
- 'midstream' => array(
- 'chk' => false,
- 'ret' => false
- ),
- 'end' => array(
- 'ret' => true
- )
- ),
+ 'AND' => array('midstream' => array('chk' => true, 'ret' => false), 'end' => array('ret' => true)),
+ 'OR' => array('midstream' => array('chk' => false, 'ret' => true), 'end' => array('ret' => false)),
+ 'XOR' => array('midstream' => array('chk' => false, 'ret' => false), 'end' => array('ret' => true)),
);
$ope = strtoupper($ope);
$checkPattern = $checkPatterns[$ope];
@@ -86,11 +62,11 @@ public function requireOtherFields($model, $check, $requireValue, $others, $ope)
/**
* Checks datetime null or datetime
*
- * @param object $model use model
+ * @param object &$model use model
* @param array $check check data array
* @return bool
*/
- public function checkDateTime($model, $check) {
+ public function checkDateTime(&$model, $check) {
foreach ($check as $val) {
if (Validation::blank($val)) {
continue;
@@ -106,7 +82,7 @@ public function checkDateTime($model, $check) {
/**
* Used to compare 2 datetime values.
*
- * @param object $model use model
+ * @param object &$model use model
* @param string|array $check datetime string
* @param string $operator Can be either a word or operand
* is greater >, is less <, greater or equal >=
@@ -114,7 +90,7 @@ public function checkDateTime($model, $check) {
* @param string $compare compare datetime string
* @return bool Success
*/
- public function checkDateComp($model, $check, $operator, $compare) {
+ public function checkDateComp(&$model, $check, $operator, $compare) {
// 比較対象がないので比較する必要なし
if (Validation::blank($model->data['Registration'][$compare])) {
return true;
@@ -134,20 +110,51 @@ public function checkDateComp($model, $check, $operator, $compare) {
return true;
}
+/**
+ * checkMinMax
+ * min and max is require both value
+ *
+ * @param object &$model use model
+ * @param bool $check post data
+ * @return bool
+ */
+ public function checkMinMax(&$model, $check) {
+ // 範囲使わない設定のときはチェックしない
+ if ($model->data['RegistrationQuestion']['is_range'] == RegistrationsComponent::USES_NOT_USE) {
+ return true;
+ }
+
+ // 最大値、最小値はテキストで「数値型」の場合と、日付け型の「日」「日時」の場合のみ設定可能
+ if (!$this->__checkMinMaxNumeric($model, $check)) {
+ return false;
+ }
+ if (!$this->__checkMinMaxDate($model, $check)) {
+ return false;
+ }
+ if (!$this->__checkMinMaxDateTime($model, $check)) {
+ return false;
+ }
+ if ($model->data['RegistrationQuestion']['min'] >= $model->data['RegistrationQuestion']['max']) {
+ return false;
+ }
+
+ return true;
+ }
+
/**
* getPeriodStatus
* get period status now and specified time
*
- * @param object $model use model
+ * @param object &$model use model
* @param bool $check flag data
* @param string $startTime start time
* @param string $endTime end time
* @return int
*/
- public function getPeriodStatus($model, $check, $startTime, $endTime) {
+ public function getPeriodStatus(&$model, $check, $startTime, $endTime) {
$ret = RegistrationsComponent::REGISTRATION_PERIOD_STAT_IN;
- if ($check == RegistrationsComponent::USES_USE) {
+ if ($check == WorkflowBehavior::PUBLIC_TYPE_LIMITED) {
$nowTime = (new NetCommonsTime())->getNowDatetime();
$nowTime = strtotime($nowTime);
if ($nowTime < strtotime($startTime)) {
@@ -159,4 +166,64 @@ public function getPeriodStatus($model, $check, $startTime, $endTime) {
}
return $ret;
}
+
+/**
+ * __checkMinMaxNumeric
+ * min and max is require both value
+ *
+ * @param object &$model use model
+ * @param bool $check post data
+ * @return bool
+ */
+ private function __checkMinMaxNumeric(&$model, $check) {
+ if ($model->data['RegistrationQuestion']['question_type_option'] == RegistrationsComponent::TYPE_OPTION_NUMERIC) {
+ if (!Validation::numeric($model->data['RegistrationQuestion']['min'])) {
+ return false;
+ }
+ if (!Validation::numeric($model->data['RegistrationQuestion']['max'])) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+/**
+ * __checkMinMaxDate
+ * min and max is require both value
+ *
+ * @param object &$model use model
+ * @param bool $check post data
+ * @return bool
+ */
+ private function __checkMinMaxDate(&$model, $check) {
+ if ($model->data['RegistrationQuestion']['question_type_option'] == RegistrationsComponent::TYPE_OPTION_DATE) {
+ if (!Validation::date($model->data['RegistrationQuestion']['min'])) {
+ return false;
+ }
+ if (!Validation::date($model->data['RegistrationQuestion']['max'])) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+/**
+ * __checkMinMaxDateTime
+ * min and max is require both value
+ *
+ * @param object &$model use model
+ * @param bool $check post data
+ * @return bool
+ */
+ private function __checkMinMaxDateTime(&$model, $check) {
+ if ($model->data['RegistrationQuestion']['question_type_option'] == RegistrationsComponent::TYPE_OPTION_DATE_TIME) {
+ if (!Validation::datetime($model->data['RegistrationQuestion']['min'])) {
+ return false;
+ }
+ if (!Validation::datetime($model->data['RegistrationQuestion']['max'])) {
+ return false;
+ }
+ }
+ return true;
+ }
}
\ No newline at end of file
diff --git a/Model/Behavior/empty b/Model/Behavior/empty
new file mode 100644
index 0000000..e69de29
diff --git a/Model/Datasource/empty b/Model/Datasource/empty
new file mode 100644
index 0000000..e69de29
diff --git a/Model/Registration.php b/Model/Registration.php
index b6697dd..befd65a 100644
--- a/Model/Registration.php
+++ b/Model/Registration.php
@@ -9,7 +9,7 @@
*/
App::uses('RegistrationsAppModel', 'Registrations.Model');
-App::uses('NetCommonsUrl', 'NetCommons.Utility');
+App::uses('RegistrationsComponent', 'Registrations.Controller/Component');
/**
* Summary for Registration Model
@@ -22,100 +22,11 @@ class Registration extends RegistrationsAppModel {
* @var array
*/
public $actsAs = array(
- 'Blocks.Block' => array(
- 'name' => 'Registration.title',
- 'loadModels' => array(
- 'WorkflowComment' => 'Workflow.WorkflowComment',
- )
- ),
'NetCommons.OriginalKey',
'Workflow.Workflow',
'Workflow.WorkflowComment',
'AuthorizationKeys.AuthorizationKey',
'Registrations.RegistrationValidate',
- // 自動でメールキューの登録, 削除。ワークフロー利用時はWorkflow.Workflowより下に記述する
- 'Mails.MailQueue' => array(
- 'embedTags' => array(
- 'X-SUBJECT' => 'Registration.title',
- ),
- 'publishStartField' => 'answer_start_period',
- ),
- 'Mails.MailQueueDelete',
- //新着情報
- 'Topics.Topics' => array(
- 'fields' => array(
- //※登録フォームの場合、'title'は$this->dataの値をセットしないので、
- // ここではセットせずに、save直前で新着タイトルをセットする
- 'publish_start' => 'answer_start_period',
- 'answer_period_start' => 'answer_start_period',
- 'answer_period_end' => 'answer_end_period',
- 'path' => '/:plugin_key/registration_answers/view/:block_id/:content_key',
- ),
- 'search_contents' => array(
- 'title', 'sub_title'
- ),
- ),
- 'Wysiwyg.Wysiwyg' => array(
- 'fields' => array('total_comment', 'thanks_content')
- ),
- 'Registrations.MailSetting',
- //多言語
- 'M17n.M17n' => array(
- 'commonFields' => array(
- 'title_icon',
- 'status',
- 'is_active',
- 'is_latest',
- 'answer_timing',
- 'answer_start_period',
- 'answer_end_period',
- 'is_no_member_allow',
- 'is_anonymity',
- 'is_key_pass_use',
- 'is_repeat_allow',
- 'is_total_show',
- 'total_show_timing',
- 'total_show_start_period',
- 'is_image_authentication',
- 'is_open_mail_send',
- 'is_answer_mail_send',
- 'reply_to',
- 'is_regist_user_send',
- 'is_page_random',
- 'is_limit_number',
- 'limit_number',
- 'import_key',
- 'export_key',
- ),
- 'associations' => array(
- 'RegistrationPage' => array(
- 'class' => 'Registrations.RegistrationPage',
- 'foreignKey' => 'registration_id',
- 'associations' => array(
- 'RegistrationQuestion' => array(
- 'class' => 'Registrations.RegistrationQuestion',
- 'foreignKey' => 'registration_page_id',
- 'associations' => array(
- 'RegistrationChoice' => array(
- 'class' => 'Registrations.RegistrationChoice',
- 'foreignKey' => 'registration_question_id',
- 'isM17n' => true,
- ),
- ),
- 'isM17n' => true,
- ),
- ),
- 'isM17n' => true,
- ),
- 'AuthorizationKey' => array(
- 'class' => 'AuthorizationKeys.AuthorizationKey',
- 'foreignKey' => 'content_id',
- 'fieldForIdentifyPlugin' => array('field' => 'model', 'value' => 'Registration'),
- 'isM17n' => false
- ),
- ),
- 'afterCallback' => false,
- ),
);
/**
@@ -155,7 +66,7 @@ class Registration extends RegistrationsAppModel {
'dependent' => true,
'conditions' => '',
'fields' => '',
- 'order' => array('page_sequence ASC'),
+ 'order' => array('page_sequence' => 'ASC'),
'limit' => '',
'offset' => '',
'exclusive' => '',
@@ -164,31 +75,6 @@ class Registration extends RegistrationsAppModel {
),
);
-/**
- * Constructor. Binds the model's database table to the object.
- *
- * @param bool|int|string|array $id Set this ID for this model on startup,
- * can also be an array of options, see above.
- * @param string $table Name of database table to use.
- * @param string $ds DataSource connection name.
- * @see Model::__construct()
- * @SuppressWarnings(PHPMD.BooleanArgumentFlag)
- */
- public function __construct($id = false, $table = null, $ds = null) {
- parent::__construct($id, $table, $ds);
-
- $this->loadModels([
- 'Frame' => 'Frames.Frame',
- 'RegistrationPage' => 'Registrations.RegistrationPage',
- 'RegistrationSetting' =>
- 'Registrations.RegistrationSetting',
- //'RegistrationFrameDisplayRegistration' =>
- // 'Registrations.RegistrationFrameDisplayRegistration',
- 'RegistrationAnswerSummary' =>
- 'Registrations.RegistrationAnswerSummary',
- ]);
- }
-
/**
* Called during validation operations, before validation. Please note that custom
* validation rules can be defined in $validate.
@@ -200,18 +86,12 @@ public function __construct($id = false, $table = null, $ds = null) {
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function beforeValidate($options = array()) {
- // ウィザード画面中はstatusチェックをしないでほしいので
- // ここに来る前にWorkflowBehaviorでつけられたstatus-validateを削除しておく
- if (Hash::check($options, 'validate') == RegistrationsComponent::REGISTRATION_VALIDATE_TYPE) {
- $this->validate = Hash::remove($this->validate, 'status');
- }
- $this->validate = ValidateMerge::merge($this->validate, array(
+ $this->validate = Hash::merge($this->validate, array(
'block_id' => array(
'numeric' => array(
'rule' => array('numeric'),
'message' => __d('net_commons', 'Invalid request.'),
- // Limit validation to 'create' or 'update' operations 新規の時はブロックIDがなかったりするから
- 'on' => 'update',
+ 'on' => 'update', // Limit validation to 'create' or 'update' operations 新規の時はブロックIDがなかったりするから
)
),
'title' => array(
@@ -219,165 +99,109 @@ public function beforeValidate($options = array()) {
'message' => sprintf(__d('net_commons', 'Please input %s.'), __d('registrations', 'Title')),
'required' => true,
'allowEmpty' => false,
+ 'required' => true,
),
- 'answer_timing' => array(
+ 'public_type' => array(
'publicTypeCheck' => array(
- 'rule' => array(
- 'inList', array(
- RegistrationsComponent::USES_USE, RegistrationsComponent::USES_NOT_USE
- )),
+ 'rule' => array('inList', array(WorkflowBehavior::PUBLIC_TYPE_PUBLIC, WorkflowBehavior::PUBLIC_TYPE_LIMITED)),
'message' => __d('net_commons', 'Invalid request.'),
),
'requireOtherFields' => array(
- 'rule' => array(
- 'requireOtherFields',
- RegistrationsComponent::USES_USE,
- array('Registration.answer_start_period', 'Registration.answer_end_period'),
- 'OR'
- ),
+ 'rule' => array('requireOtherFields', WorkflowBehavior::PUBLIC_TYPE_LIMITED, array('Registration.publish_start', 'Registration.publish_end'), 'OR'),
'message' => __d('registrations', 'if you set the period, please set time.')
)
),
- 'answer_start_period' => array(
+ 'publish_start' => array(
'checkDateTime' => array(
'rule' => 'checkDateTime',
'message' => __d('registrations', 'Invalid datetime format.')
)
),
- 'answer_end_period' => array(
+ 'publish_end' => array(
'checkDateTime' => array(
'rule' => 'checkDateTime',
'message' => __d('registrations', 'Invalid datetime format.')
),
'checkDateComp' => array(
- 'rule' => array('checkDateComp', '>=', 'answer_start_period'),
+ 'rule' => array('checkDateComp', '>=', 'publish_start'),
'message' => __d('registrations', 'start period must be smaller than end period')
)
),
- //'is_total_show' => array(
- // 'boolean' => array(
- // 'rule' => array('boolean'),
- // 'message' => __d('net_commons', 'Invalid request.'),
- // ),
- //),
- //'total_show_timing' => array(
- // 'inList' => array(
- // 'rule' => array(
- // 'inList',
- // array(RegistrationsComponent::USES_USE, RegistrationsComponent::USES_NOT_USE)
- // ),
- // 'message' => __d('net_commons', 'Invalid request.'),
- // ),
- // 'requireOtherFields' => array(
- // 'rule' => array(
- // 'requireOtherFields',
- // RegistrationsComponent::USES_USE,
- // array('Registration.total_show_start_period'),
- // 'AND'
- // ),
- // 'message' => __d('registrations', 'if you set the period, please set time.')
- // )
- //),
- //'total_show_start_period' => array(
- // 'checkDateTime' => array(
- // 'rule' => 'checkDateTime',
- // 'message' => __d('registrations', 'Invalid datetime format.')
- // )
- //),
+ 'total_show_timing' => array(
+ 'inList' => array(
+ 'rule' => array('inList', array(RegistrationsComponent::USES_USE, RegistrationsComponent::USES_NOT_USE)),
+ 'message' => __d('net_commons', 'Invalid request.'),
+ ),
+ 'requireOtherFields' => array(
+ 'rule' => array('requireOtherFields', RegistrationsComponent::USES_USE, array('Registration.total_show_start_period'), 'AND'),
+ 'message' => __d('registrations', 'if you set the period, please set time.')
+ )
+ ),
+ 'total_show_start_period' => array(
+ 'checkDateTime' => array(
+ 'rule' => 'checkDateTime',
+ 'message' => __d('registrations', 'Invalid datetime format.')
+ )
+ ),
//'is_no_member_allow' => array(
// 'boolean' => array(
// 'rule' => array('boolean'),
// 'message' => __d('net_commons', 'Invalid request.'),
// ),
//),
- //'is_anonymity' => array(
- // 'boolean' => array(
- // 'rule' => array('boolean'),
- // 'message' => __d('net_commons', 'Invalid request.'),
- // ),
- //),
+ 'is_anonymity' => array(
+ 'boolean' => array(
+ 'rule' => array('boolean'),
+ 'message' => __d('net_commons', 'Invalid request.'),
+ ),
+ ),
'is_key_pass_use' => array(
'boolean' => array(
'rule' => array('boolean'),
'message' => __d('net_commons', 'Invalid request.'),
),
'requireOtherFieldsKey' => array(
- 'rule' => array(
- 'requireOtherFields',
- RegistrationsComponent::USES_USE,
- array('AuthorizationKey.authorization_key'),
- 'AND'
- ),
- 'message' =>
- __d('registrations',
- 'if you set the use key phrase period, please set key phrase text.')
+ 'rule' => array('requireOtherFields', RegistrationsComponent::USES_USE, array('AuthorizationKey.authorization_key'), 'AND'),
+ 'message' => __d('registrations', 'if you set the use key phrase period, please set key phrase text.')
),
'authentication' => array(
- 'rule' => array(
- 'requireOtherFields',
- RegistrationsComponent::USES_USE,
- array('Registration.is_image_authentication'),
- 'XOR'
- ),
- 'message' =>
- __d('registrations',
- 'Authentication key setting , image authentication , either only one can not be selected.')
+ 'rule' => array('requireOtherFields', RegistrationsComponent::USES_USE, array('Registration.is_image_authentication'), 'XOR'),
+ 'message' => __d('registrations', 'Authentication key setting , image authentication , either only one can not be selected.')
)
),
- //'is_repeat_allow' => array(
- // 'boolean' => array(
- // 'rule' => array('boolean'),
- // 'message' => __d('net_commons', 'Invalid request.'),
- // ),
- //),
- 'is_image_authentication' => array(
+ 'is_repeat_allow' => array(
'boolean' => array(
'rule' => array('boolean'),
'message' => __d('net_commons', 'Invalid request.'),
),
- 'authentication' => array(
- 'rule' => array(
- 'requireOtherFields',
- RegistrationsComponent::USES_USE,
- array('Registration.is_key_pass_use'),
- 'XOR'
- ),
- 'message' =>
- __d('registrations',
- 'Authentication key setting , image authentication , either only one can not be selected.')
- )
),
- 'is_answer_mail_send' => array(
+ 'is_image_authentication' => array(
'boolean' => array(
'rule' => array('boolean'),
'message' => __d('net_commons', 'Invalid request.'),
),
+ 'authentication' => array(
+ 'rule' => array('requireOtherFields', RegistrationsComponent::USES_USE, array('Registration.is_key_pass_use'), 'XOR'),
+ 'message' => __d('registrations', 'Authentication key setting , image authentication , either only one can not be selected.')
+ )
),
- 'is_regist_user_send' => array(
+ 'is_answer_mail_send' => array(
'boolean' => array(
'rule' => array('boolean'),
'message' => __d('net_commons', 'Invalid request.'),
),
),
- 'reply_to' => array(
- 'email' => array(
- 'rule' => array('email', false, null),
- 'message' => sprintf(__d('mails', '%s, please enter by e-mail format'),
- __d('mails', 'E-mail address to receive a reply')),
- 'allowEmpty' => true,
- ),
- ),
));
parent::beforeValidate($options);
// 最低でも1ページは存在しないとエラー
if (! isset($this->data['RegistrationPage'][0])) {
- $this->validationErrors['pickup_error'] =
- __d('registrations', 'please set at least one page.');
+ $this->validationErrors['pickup_error'] = __d('registrations', 'please set at least one page.');
} else {
// ページデータが存在する場合
// 配下のページについてバリデート
$validationErrors = array();
+ $this->RegistrationPage = ClassRegistry::init('Registrations.RegistrationPage', true);
$maxPageIndex = count($this->data['RegistrationPage']);
$options['maxPageIndex'] = $maxPageIndex;
foreach ($this->data['RegistrationPage'] as $pageIndex => $page) {
@@ -387,22 +211,14 @@ public function beforeValidate($options = array()) {
// ページシーケンス番号の正当性を確認するため、現在の配列インデックスを渡す
$options['pageIndex'] = $pageIndex;
if (! $this->RegistrationPage->validates($options)) {
- $validationErrors['RegistrationPage'][$pageIndex] =
- $this->RegistrationPage->validationErrors;
+ $validationErrors['RegistrationPage'][$pageIndex] = $this->RegistrationPage->validationErrors;
}
-
- $data = $this->RegistrationPage->data['RegistrationPage'];
- unset($this->RegistrationPage->data['RegistrationPage']);
- $this->data['RegistrationPage'][$pageIndex] =
- array_merge($data, $this->RegistrationPage->data);
}
$this->validationErrors += $validationErrors;
}
-
// 引き続き登録フォーム本体のバリデートを実施してもらうためtrueを返す
return true;
}
-
/**
* AfterFind Callback function
*
@@ -415,6 +231,8 @@ public function afterFind($results, $primary = false) {
if ($this->recursive == -1) {
return $results;
}
+ $this->RegistrationPage = ClassRegistry::init('Registrations.RegistrationPage', true);
+ $this->RegistrationAnswerSummary = ClassRegistry::init('Registrations.RegistrationAnswerSummary', true);
foreach ($results as &$val) {
// この場合はcount
@@ -427,46 +245,31 @@ public function afterFind($results, $primary = false) {
}
$val['Registration']['period_range_stat'] = $this->getPeriodStatus(
- isset($val['Registration']['answer_timing']) ? $val['Registration']['answer_timing'] : false,
- $val['Registration']['answer_start_period'],
- $val['Registration']['answer_end_period']);
+ isset($val['Registration']['public_type']) ? $val['Registration']['public_type'] : false,
+ $val['Registration']['publish_start'],
+ $val['Registration']['publish_end']);
//
- // ページ配下の項目データも取り出す
- // かつ、ページ数、項目数もカウントする
+ // ページ配下の質問データも取り出す
+ // かつ、ページ数、質問数もカウントする
$val['Registration']['page_count'] = 0;
$val['Registration']['question_count'] = 0;
$this->RegistrationPage->setPageToRegistration($val);
- $val['Registration']['all_answer_count'] =
- $this->RegistrationAnswerSummary->find('count', array(
- 'conditions' => array(
- 'registration_key' => $val['Registration']['key'],
- 'answer_status' => RegistrationsComponent::ACTION_ACT,
- 'test_status' => RegistrationsComponent::TEST_ANSWER_STATUS_PEFORM
- ),
- 'recursive' => -1
+ $val['Registration']['all_answer_count'] = $this->RegistrationAnswerSummary->find('count', array(
+ 'conditions' => array(
+ 'registration_key' => $val['Registration']['key'],
+ 'answer_status' => RegistrationsComponent::ACTION_ACT,
+ 'test_status' => RegistrationsComponent::TEST_ANSWER_STATUS_PEFORM
+ ),
+ 'recursive' => -1
));
}
return $results;
}
/**
- * afterFrameSave
- *
- * @param array $frame Frame data
- * @return void
- */
- public function afterFrameSave($frame) {
- // フレームに紐づく登録フォームがあるのにdefault_actionが設定されてなかったら設定する
- if ($frame['Frame']['block_id'] && empty($frame['Frame']['default_action'])) {
- $frame['Frame']['default_action'] = 'registration_answers/view';
- $this->Frame->save($frame, false);
- }
- }
-
-/**
- * ブロック作成
+ * After frame save hook
*
* このルームにすでに登録フォームブロックが存在した場合で、かつ、現在フレームにまだブロックが結びついてない場合、
* すでに存在するブロックと現在フレームを結びつける
@@ -475,38 +278,72 @@ public function afterFrameSave($frame) {
* @return mixed On success Model::$data if its not empty or true, false on failure
* @throws InternalErrorException
*/
- public function createBlock($data) {
- $frame['Frame'] = $data['Frame'];
-
- $this->begin();
+ public function afterFrameSave($data) {
+ // すでに結びついている場合は何もしないでよい
+ if (!empty($data['Frame']['block_id'])) {
+ return $data;
+ }
+ $frame = $data['Frame'];
+ // ルームに存在するブロックを探す
+ $block = $this->Block->find('first', array(
+ 'conditions' => array(
+ 'Block.room_id' => $frame['room_id'],
+ 'Block.plugin_key' => $frame['plugin_key'],
+ )
+ ));
+ // まだない場合
+ if (empty($block)) {
+ // 作成する
+ $block = $this->Block->save(array(
+ 'room_id' => $frame['room_id'],
+ 'language_id' => $frame['language_id'],
+ 'plugin_key' => $frame['plugin_key'],
+ ));
+ if (! $block) {
+ return false;
+ }
+ Current::$current['Block'] = $block['Block'];
+ }
- try {
- $this->RegistrationSetting->saveBlock($frame);
- // 設定情報も
- $this->RegistrationSetting->saveSetting();
- $this->commit();
- } catch (Exception $ex) {
- //トランザクションRollback
- $this->rollback();
- //エラー出力
- CakeLog::error($ex);
- throw $ex;
+ $this->loadModels([
+ 'Frame' => 'Frames.Frame',
+ 'RegistrationSetting' => 'Registrations.RegistrationSetting',
+ ]);
+ $data['Frame']['block_id'] = $block['Block']['id'];
+ if (! $this->Frame->save($data)) {
+ return false;
}
+ Current::$current['Frame']['block_id'] = $block['Block']['id'];
+
+ $blockSetting = $this->RegistrationSetting->create();
+ $blockSetting['RegistrationSetting']['block_key'] = $block['Block']['key'];
+ $this->RegistrationSetting->saveRegistrationSetting($blockSetting);
return $data;
}
-
/**
- * get index sql condition method
+ * geRegistrationsList
+ * get registrations by specified block id and specified user id limited number
*
- * @param array $addConditions 追加条件
+ * @param array $conditions find condition
+ * @param array $options 検索オプション
* @return array
*/
- public function getBaseCondition($addConditions = array()) {
- $conditions = $this->getWorkflowConditions(array(
- 'block_id' => Current::read('Block.id'),
+ public function getRegistrationsList($conditions, $options = array()) {
+ //$limit = RegistrationsComponent::REGISTRATION_DEFAULT_DISPLAY_NUM_PER_PAGE}, $offset = 0, $sort = 'modified DESC') {
+ // 絞込条件
+ $baseConditions = $this->getBaseCondition();
+ $conditions = Hash::merge($baseConditions, $conditions);
+
+ // 取得オプション
+ $this->RegistrationFrameSetting = ClassRegistry::init('Registrations.RegistrationFrameSetting', true);
+ $defaultOptions = $this->RegistrationFrameSetting->getRegistrationFrameSettingConditions(Current::read('Frame.key'));
+ $options = Hash::merge($defaultOptions, $options);
+ $list = $this->find('all', array(
+ 'recursive' => 0,
+ 'conditions' => $conditions,
+ $options
));
- $conditions = array_merge($conditions, $addConditions);
- return $conditions;
+ return $list;
}
/**
@@ -515,93 +352,46 @@ public function getBaseCondition($addConditions = array()) {
* @param array $addConditions 追加条件
* @return array
*/
- //public function getCondition($addConditions = array()) {
- // // 基本条件(ワークフロー条件)
- // $conditions = $this->getBaseCondition($addConditions);
- // // 現在フレームに表示設定されている登録フォームか
- // $keys = $this->RegistrationFrameDisplayRegistration->find(
- // 'list',
- // array(
- // 'conditions' => array(
- // 'RegistrationFrameDisplayRegistration.frame_key' => Current::read('Frame.key')),
- // 'fields' => array('RegistrationFrameDisplayRegistration.registration_key'),
- // 'recursive' => -1
- // )
- // );
- // $conditions['Registration.key'] = $keys;
- //
- // $periodCondition = $this->_getPeriodConditions();
- // $conditions[] = $periodCondition;
- //
- // if (! Current::read('User.id')) {
- // $conditions['is_no_member_allow'] = RegistrationsComponent::PERMISSION_PERMIT;
- // }
- // $conditions = Hash::merge($conditions, $addConditions);
- // return $conditions;
- //}
+ public function getCondition($addConditions = array()) {
+ // ベースとなる権限のほかに現在フレームに表示設定されている登録フォームか見ている
+ $conditions = $this->getBaseCondition($addConditions);
+
+ $frameDisplay = ClassRegistry::init('Registrations.RegistrationFrameDisplayRegistrations');
+ $keys = $frameDisplay->find(
+ 'list',
+ array(
+ 'conditions' => array('RegistrationFrameDisplayRegistrations.frame_key' => Current::read('Frame.key')),
+ 'fields' => array('RegistrationFrameDisplayRegistrations.registration_key'),
+ 'recursive' => -1
+ )
+ );
+ $conditions['Registration.key'] = $keys;
+
+ if ($addConditions) {
+ $conditions = array_merge($conditions, $addConditions);
+ }
+ return $conditions;
+ }
/**
- * 時限公開のconditionsを返す
+ * get index sql condition method
*
+ * @param array $addConditions 追加条件
* @return array
*/
- protected function _getPeriodConditions() {
- if (Current::permission('content_editable')) {
- return array();
- }
- $netCommonsTime = new NetCommonsTime();
- $nowTime = $netCommonsTime->getNowDatetime();
-
- $limitedConditions[] = array('OR' => array(
- 'Registration.answer_start_period <=' => $nowTime,
- 'Registration.answer_start_period' => null,
- ));
- $limitedConditions[] = array('OR' => array(
- 'Registration.answer_end_period >=' => $nowTime,
- 'Registration.answer_end_period' => null,
- ));
-
- $timingConditions = array(
- 'OR' => array(
- 'Registration.answer_timing' => RegistrationsComponent::USES_NOT_USE,
- 'AND' => array(
- 'Registration.answer_timing' => RegistrationsComponent::USES_USE,
- $limitedConditions,
- )
- ));
-
- // 集計結果の表示は登録フォーム登録が始まっていることが前提
- $totalLimitPreCond = array(
- 'OR' => array(
- 'Registration.answer_timing' => RegistrationsComponent::USES_NOT_USE,
- 'AND' => array(
- 'Registration.answer_timing' => RegistrationsComponent::USES_USE,
- 'OR' => array(
- 'Registration.answer_start_period <=' => $nowTime,
- 'Registration.answer_start_period' => null,
- )
- )
- )
- );
- $totalLimitCond[] = array('OR' => array(
- 'Registration.total_show_start_period <=' => $nowTime,
- 'Registration.total_show_start_period' => null,
- ));
-
- $totalTimingCond = array(
- 'Registration.is_total_show' => RegistrationsComponent::USES_USE,
- $totalLimitPreCond,
- 'OR' => array(
- 'Registration.total_show_timing' => RegistrationsComponent::USES_NOT_USE,
- $totalLimitCond,
+ public function getBaseCondition($addConditions = array()) {
+ $conditions = $this->getWorkflowConditions(array(
+ 'block_id' => Current::read('Block.id'),
));
- $timingConditions['OR'][] = $totalTimingCond;
- if (Current::permission('content_creatable')) {
- $timingConditions['OR']['Registration.created_user'] = Current::read('User.id');
+ if (! Current::read('User.id')) {
+ $conditions['is_no_member_allow'] = RegistrationsComponent::PERMISSION_PERMIT;
}
- return $timingConditions;
+ if ($addConditions) {
+ $conditions = array_merge($conditions, $addConditions);
+ }
+ return $conditions;
}
/**
@@ -613,26 +403,16 @@ protected function _getPeriodConditions() {
* @return bool
*/
public function saveRegistration(&$registration) {
- $this->loadModels(['Frames.Frame']);
- // 設定画面を表示する前にこのルームの登録フォームブロックがあるか確認
- // 万が一、まだ存在しない場合には作成しておく
- // afterFrameSaveが呼ばれず、また最初に設定画面が開かれもしなかったような状況の想定
- //$frame['Frame'] = Current::read('Frame');
- //$this->createBlock($frame);
+ $this->loadModels([
+ 'RegistrationPage' => 'Registrations.RegistrationPage',
+ 'RegistrationFrameDisplayRegistration' => 'Registrations.RegistrationFrameDisplayRegistration',
+ 'RegistrationAnswerSummary' => 'Registrations.RegistrationAnswerSummary',
+ ]);
//トランザクションBegin
$this->begin();
try {
- //$registration['Registration']['block_id'] = Current::read('Frame.block_id');
- $registration['Registration']['block_id'] = Current::read('Block.id');
- // is_no_member_allowの値によってis_repeat_allowを決定する
- $registration['Registration']['is_repeat_allow'] = RegistrationsComponent::USES_NOT_USE;
- //if (Hash::get(
- // $registration,
- // 'Registration.is_no_member_allow') == RegistrationsComponent::USES_USE) {
- $registration['Registration']['is_repeat_allow'] = RegistrationsComponent::USES_USE;
- //}
$status = $registration['Registration']['status'];
$this->create();
// 登録フォームは履歴を取っていくタイプのコンテンツデータなのでSave前にはID項目はカット
@@ -642,71 +422,38 @@ public function saveRegistration(&$registration) {
$registration = Hash::remove($registration, 'Registration.id');
$this->set($registration);
- if (!$this->validates()) {
- return false;
- }
-
- //新着データセット
- $this->setTopicValue(
- 'title', sprintf(__d('registrations', '%s started'), $registration['Registration']['title'])
- );
- if (! $registration['Registration']['answer_timing']) {
- $this->setTopicValue('publish_start', null);
- $this->setTopicValue('answer_period_start', null);
- $this->setTopicValue('answer_period_end', null);
- }
- // Block.nameが入ってるとBlockビヘイビアが名前を同期してくれないのでremove
- $registration = Hash::remove($registration, 'BlocksLanguage.name');
- // modified に値があると modified が更新されないのでnullに
- $registration['Registration']['modified'] = null;
- $saveRegistration = $this->save(null, false);
+ $saveRegistration = $this->save($registration);
if (! $saveRegistration) {
- throw new InternalErrorException(__d('net_commons', 'Internal Server Error'));
+ $this->rollback();
+ return false;
}
$registrationId = $this->id;
// ページ以降のデータを登録
- $saveRegistration = Hash::insert(
- $saveRegistration,
- 'RegistrationPage.{n}.registration_id',
- $registrationId);
-
- if (! $this->RegistrationPage->saveRegistrationPage(
- $saveRegistration['RegistrationPage'], $saveRegistration['Block'])) {
- throw new InternalErrorException(__d('net_commons', 'Internal Server Error'));
+ $registration = Hash::insert($registration, 'RegistrationPage.{n}.registration_id', $registrationId);
+ if (! $this->RegistrationPage->saveRegistrationPage($registration['RegistrationPage'])) {
+ $this->rollback();
+ return false;
}
- // フレームのdefault_actionが設定されてないなら、設定する。
- if (! Current::read('Frame.default_action')) {
- // フレームのdefault_actionを更新する
- $frame = Current::read('Frame');
- $frame['default_action'] = 'registration_answers/view/';
- $frame['block_id'] = Current::read('Block.id');
-
- if (! $this->Frame->save($frame)) {
- throw new InternalErrorException(__d('net_commons', 'Internal Server Error'));
- }
+ // フレーム内表示対象登録フォームに登録する
+ if (! $this->RegistrationFrameDisplayRegistration->saveDisplayRegistration(array(
+ 'registration_key' => $saveRegistration['Registration']['key'],
+ 'frame_key' => Current::read('Frame.key')
+ ))) {
+ $this->rollback();
+ return false;
}
// これまでのテスト登録データを消す
- $this->RegistrationAnswerSummary->deleteTestAnswerSummary(
- $saveRegistration['Registration']['key'],
- $status);
-
- // Registrationのステータスが公開なら登録通知メール設定を上書きする
- if ($status == WorkflowComponent::STATUS_PUBLISHED) {
- /** @see \MailSettingBehavior::updateMailSetting */
- $this->updateMailSetting($saveRegistration);
- }
-
- //多言語化の処理
- $this->set($saveRegistration);
- $this->saveM17nData();
+ $this->RegistrationAnswerSummary->deleteTestAnswerSummary($saveRegistration['Registration']['key'], $status);
$this->commit();
} catch (Exception $ex) {
- $this->rollback($ex);
+ $this->rollback();
+ CakeLog::error($ex);
+ throw $ex;
}
- return $saveRegistration;
+ return $registration;
}
/**
@@ -718,29 +465,31 @@ public function saveRegistration(&$registration) {
* @return bool
*/
public function deleteRegistration($data) {
+ $this->loadModels([
+ 'RegistrationFrameDisplayRegistration' => 'Registrations.RegistrationFrameDisplayRegistration',
+ 'RegistrationAnswerSummary' => 'Registrations.RegistrationAnswerSummary',
+ ]);
$this->begin();
try {
- // 登録フォーム項目データ削除
- $this->contentKey = $data['Registration']['key'];
+ // 登録フォーム質問データ削除
if (! $this->deleteAll(array(
- 'Registration.key' => $data['Registration']['key']), true, true)) {
+ 'Registration.key' => $data['Registration']['key']), true, false)) {
throw new InternalErrorException(__d('net_commons', 'Internal Server Error'));
}
- //// 登録フォーム表示設定削除
- //if (! $this->RegistrationFrameDisplayRegistration->deleteAll(array(
- // 'registration_key' => $data['Registration']['key']), true, false)) {
- // throw new InternalErrorException(__d('net_commons', 'Internal Server Error'));
- //}
+ //コメントの削除
+ $this->deleteCommentsByContentKey($this->data['Registration']['key']);
+
+ // 登録フォーム表示設定削除
+ if (! $this->RegistrationFrameDisplayRegistration->deleteAll(array(
+ 'registration_key' => $data['Registration']['key']), true, false)) {
+ throw new InternalErrorException(__d('net_commons', 'Internal Server Error'));
+ }
// 登録フォーム登録削除
if (! $this->RegistrationAnswerSummary->deleteAll(array(
'registration_key' => $data['Registration']['key']), true, false)) {
throw new InternalErrorException(__d('net_commons', 'Internal Server Error'));
}
- // ブロック削除
- //Blockデータ削除
- $blockKey = Current::read('Block.key');
- $this->deleteBlock($blockKey);
$this->commit();
} catch (Exception $ex) {
//トランザクションRollback
@@ -765,12 +514,7 @@ public function saveExportKey($registrationId, $exportKey) {
$this->begin();
try {
$this->id = $registrationId;
- $this->Behaviors->unload('Mails.MailQueue');
- $this->Behaviors->unload('Wysiwyg.Wysiwyg');
- if (! $this->saveField('export_key', $exportKey, ['callbacks' => false])) {
- throw new InternalErrorException(__d('net_commons', 'Internal Server Error'));
- }
- $this->commit();
+ $this->saveField('export_key', $exportKey);
} catch (Exception $ex) {
//トランザクションRollback
$this->rollback();
@@ -805,28 +549,18 @@ public function hasPublished($registration) {
* clearRegistrationId 登録フォームデータからIDのみをクリアする
*
* @param array &$registration 登録フォームデータ
- * @param bool $isIdOnly 純粋にIDフィールドのみをクリアするのか
* @return void
- * @SuppressWarnings(PHPMD.BooleanArgumentFlag)
*/
- public function clearRegistrationId(&$registration, $isIdOnly = false) {
+ public function clearRegistrationId(&$registration) {
foreach ($registration as $qKey => $q) {
if (is_array($q)) {
- $this->clearRegistrationId($registration[$qKey], $isIdOnly);
- } else {
- if ($isIdOnly) {
- $judge = preg_match('/^id$/', $qKey);
- } else {
- $judge = preg_match('/^id$/', $qKey) ||
- preg_match('/^key$/', $qKey) ||
- preg_match('/^created(.*?)/', $qKey) ||
- preg_match('/^modified(.*?)/', $qKey);
- }
- if ($judge) {
- unset($registration[$qKey]);
- }
+ $this->clearRegistrationId($registration[$qKey]);
+ } elseif (preg_match('/^id$/', $qKey) ||
+ preg_match('/^key$/', $qKey) ||
+ preg_match('/^created(.*?)/', $qKey) ||
+ preg_match('/^modified(.*?)/', $qKey)) {
+ unset($registration[$qKey]);
}
}
}
-
}
diff --git a/Model/RegistrationAnswer.php b/Model/RegistrationAnswer.php
index a7df869..f4ac300 100644
--- a/Model/RegistrationAnswer.php
+++ b/Model/RegistrationAnswer.php
@@ -13,6 +13,7 @@
*/
App::uses('RegistrationsAppModel', 'Registrations.Model');
+App::uses('RegistrationsComponent', 'Registrations.Controller/Component');
/**
* Summary for RegistrationAnswer Model
@@ -34,13 +35,6 @@ class RegistrationAnswer extends RegistrationsAppModel {
'Registrations.RegistrationAnswerMatrixMultipleChoice',
'Registrations.RegistrationAnswerDatetime',
'Registrations.RegistrationAnswerEmail',
- 'NetCommons.OriginalKey',
- 'Files.Attachment' => [
- 'answer_value_file' => [
- 'contentKeyFieldName' => 'id',
- 'fileNameFieldName' => 'answer_value'
- ]
- ],
);
/**
@@ -80,11 +74,6 @@ class RegistrationAnswer extends RegistrationsAppModel {
)
);
-/**
- * @var null|array Behaviorによって追加される添付ファイルのバリデーションルールのバックアップ
- */
- private $__fileValidate = null;
-
/**
* Called during validation operations, before validation. Please note that custom
* validation rules can be defined in $validate.
@@ -102,12 +91,6 @@ public function beforeValidate($options = array()) {
$question = $options['question'];
$allAnswers = $options['allAnswers'];
- // Behaviorによる添付ファイル用のバリデーションをバックアップ(他のvalidateルールを初期化しておきたいので)
- // └ ファイル項目でないときは、ファイルのバリデーション無し、ファイル項目のみバリデーション有効とするため。
- if ($this->__fileValidate === null) {
- $this->__fileValidate = $this->validate['answer_value_file'] ?? [];
- }
-
// Answerモデルは繰り返し判定が行われる可能性高いのでvalidateルールは最初に初期化
// mergeはしません
$this->validate = array(
@@ -137,58 +120,26 @@ public function beforeValidate($options = array()) {
'message' => __d('registrations', 'Input required'),
),
'answerMaxLength' => array(
- 'rule' => array(
- 'answerMaxLength',
- $question, RegistrationsComponent::REGISTRATION_MAX_ANSWER_LENGTH
- ),
- 'message' => sprintf(
- __d('registrations', 'the answer is too long. Please enter under %d letters.',
- RegistrationsComponent::REGISTRATION_MAX_ANSWER_LENGTH)),
- ),
- 'answerChoiceValidation' => array(
- 'rule' => array('answerChoiceValidation', $question, $allAnswers),
- 'last' => true,
- 'message' => ''
- ),
- 'answerTextValidation' => array(
- 'rule' => array('answerTextValidation', $question, $allAnswers),
- 'last' => true,
- 'message' => ''
+ 'rule' => array('answerMaxLength', $question, RegistrationsComponent::REGISTRATION_MAX_ANSWER_LENGTH),
+ 'message' => sprintf(__d('registrations', 'the answer is too long. Please enter under %d letters.', RegistrationsComponent::REGISTRATION_MAX_ANSWER_LENGTH)),
),
- 'answerDatetimeValidation' => array(
- 'rule' => array('answerDatetimeValidation', $question, $allAnswers),
- 'last' => true,
- 'message' => ''
- ),
- 'answerMatrixValidation' => array(
- 'rule' => array('answerMatrixValidation', $question, $allAnswers),
+ 'answerValidation' => array(
+ 'rule' => array('answerValidation', $question, $allAnswers),
'last' => true,
'message' => ''
),
'answerEmailValidation' => array(
'rule' => array('answerEmailValidation', $question, $allAnswers),
'last' => true,
- 'message' => __d('mails', '%s, please enter by e-mail format',
- $question['question_value']),
+ 'message' => __d('registrations', 'メールアドレスを正しく入力してください'),
),
'answerEmailConfirmValidation' => array(
'rule' => array('answerEmailConfirmValidation', $question, $allAnswers),
'last' => true,
- 'message' => __d('net_commons', 'The input data does not match. Please try again.'),
+ 'message' => __d('registrations', 'メールアドレスが確認用と一致しません'),
),
-
),
);
-
- if ($question['question_type'] === RegistrationsComponent::TYPE_FILE) {
- $this->validate['answer_value_file'] = $this->__fileValidate;
- if ($question['is_require']) {
- $this->validate['answer_value_file']['notBlank'] = [
- 'rule' => array('isFileUpload'),
- 'message' => array(__d('files', 'Please specify the file'))
- ];
- }
- }
parent::beforeValidate($options);
return true;
@@ -197,38 +148,23 @@ public function beforeValidate($options = array()) {
/**
* getProgressiveAnswerOfThisSummary
*
- * @param array $registration registration data
* @param array $summary registration summary ( one record )
* @return array
*/
- public function getProgressiveAnswerOfThisSummary($registration, $summary) {
+ public function getProgressiveAnswerOfThisSummary($summary) {
$answers = array();
if (empty($summary)) {
return $answers;
}
- // 指定のサマリに該当する登録フォームの項目ID配列を取得
- $questionIds = Hash::extract(
- $registration,
- 'RegistrationPage.{n}.RegistrationQuestion.{n}.id');
- $choiceIds = Hash::extract(
- $registration,
- 'RegistrationPage.{n}.RegistrationQuestion.{n}.RegistrationChoice.{n}.id');
- // その項目配列を取得条件に加える(間違った項目が入らないよう)
$answer = $this->find('all', array(
'conditions' => array(
- 'registration_answer_summary_id' => $summary['RegistrationAnswerSummary']['id'],
- 'RegistrationQuestion.id' => $questionIds,
- 'OR' => array(
- array('RegistrationChoice.id' => $choiceIds),
- array('RegistrationChoice.id' => null),
- )
+ 'registration_answer_summary_id' => $summary['RegistrationAnswerSummary']['id']
),
- //'recursive' => 1
+ 'recursive' => 0
));
if (!empty($answer)) {
foreach ($answer as $ans) {
- $answerIndex = $ans['RegistrationAnswer']['registration_question_key'];
- $answers[$answerIndex][] = $ans['RegistrationAnswer'];
+ $answers[$ans['RegistrationAnswer']['registration_question_key']][] = $ans['RegistrationAnswer'];
}
}
return $answers;
@@ -243,17 +179,6 @@ public function getProgressiveAnswerOfThisSummary($registration, $summary) {
public function getAnswerCount($conditions) {
$cnt = $this->find('count', array(
'conditions' => $conditions,
- 'recursive' => -1,
- 'joins' => array(
- array(
- 'table' => 'registration_answer_summaries',
- 'alias' => 'RegistrationAnswerSummary',
- 'type' => 'LEFT',
- 'conditions' => array(
- 'RegistrationAnswerSummary.id = RegistrationAnswer.registration_answer_summary_id',
- )
- )
- )
));
return $cnt;
}
@@ -265,7 +190,7 @@ public function getAnswerCount($conditions) {
* @param array $data Postされた登録データ
* @param array $registration registration data
* @param array $summary answer summary data
- * @throws InternalErrorException
+ * @throws $ex
* @return bool
*/
public function saveAnswer($data, $registration, $summary) {
@@ -278,27 +203,15 @@ public function saveAnswer($data, $registration, $summary) {
$validationErrors = array();
foreach ($data['RegistrationAnswer'] as $answer) {
$targetQuestionKey = $answer[0]['registration_question_key'];
- $targetQuestion = Hash::extract(
- $registration['RegistrationPage'],
- '{n}.RegistrationQuestion.{n}[key=' . $targetQuestionKey . ']');
- if (! $targetQuestion) {
- throw new InternalErrorException(__d('net_commons', 'Internal Server Error'));
- }
+ $targetQuestion = Hash::extract($registration['RegistrationPage'], '{n}.RegistrationQuestion.{n}[key=' . $targetQuestionKey . ']');
// データ保存
// Matrixタイプの場合はanswerが配列になっているがsaveでかまわない
- // saveMany中で1回しかValidateしなくてよい関数のためのフラグ
- $this->oneTimeValidateFlag = false;
- // Validate、Saveで使用するオプションデータ
- $options = array(
+ $this->oneTimeValidateFlag = false; // saveMany中で1回しかValidateしなくてよい関数のためのフラグ
+ if (!$this->saveMany($answer, array(
'registration_answer_summary_id' => $summaryId,
'question' => $targetQuestion[0],
- 'allAnswers' => $data['RegistrationAnswer'],
- );
-
- if (! $this->saveMany($answer, $options)) {
- $validationErrors[$targetQuestionKey] = $this->__errorMessageUnique(
- $targetQuestion[0],
- Hash::filter($this->validationErrors));
+ 'allAnswers' => $data['RegistrationAnswer']))) {
+ $validationErrors[$targetQuestionKey] = Hash::filter($this->validationErrors);
}
}
if (! empty($validationErrors)) {
@@ -314,63 +227,4 @@ public function saveAnswer($data, $registration, $summary) {
}
return true;
}
-
-/**
- * サマリとQuestion.idから登録データ(answer)を返す
- *
- * @param array $summary 登録データサマリ
- * @param array $questionIds QustionIdのリスト
- * @param string $aliasName 別の名前で取得したいときは設定する
- * @see RegistrationAnswerSummaryCsv::getAnswerSummaryCsv
- * @return array|null
- */
- public function getAnswersBySummary($summary, $questionIds,
- $aliasName = 'RegistrationAnswerSummary') {
- // 何回もSQLを発行するのは無駄かなと思いつつも
- // RegistrationAnswerに登録データの取り扱いしやすい形への整備機能を組み込んであるので、それを利用したかった
- // このクラスからでも利用できないかと試みたが
- // AnswerとQuestionがJOINされた形でFindしないと整備機能が発動しない
- // そうするためにはrecursive=2でないといけないわけだが、recursive=2にするとRoleのFindでSQLエラーになる
- // 仕方ないのでこの形式で処理を行う
- $answers = $this->find('all', array(
- 'fields' => array('RegistrationAnswer.*', 'RegistrationQuestion.*'),
- 'conditions' => array(
- 'registration_answer_summary_id' => $summary[$aliasName]['id'],
- 'RegistrationQuestion.id' => $questionIds
- ),
- 'recursive' => -1,
- 'joins' => array(
- array(
- 'table' => 'registration_questions',
- 'alias' => 'RegistrationQuestion',
- 'type' => 'LEFT',
- 'conditions' => array(
- 'RegistrationAnswer.registration_question_key = RegistrationQuestion.key',
- )
- )
- ),
- 'order' => array('RegistrationQuestion.question_sequence' => 'asc'),
- ));
- return $answers;
- }
-/**
- * __errorMessageUnique
- * マトリクスの同じエラーメッセージをまとめる
- *
- * @param array $question question
- * @param array $errors error message
- * @return array
- */
- private function __errorMessageUnique($question, $errors) {
- if (! RegistrationsComponent::isMatrixInputType($question['question_type'])) {
- return $errors;
- }
- $ret = array();
- foreach ($errors as $err) {
- if (! in_array($err, $ret)) {
- $ret[] = $err;
- }
- }
- return $ret;
- }
-}
+}
\ No newline at end of file
diff --git a/Model/RegistrationAnswerSummary.php b/Model/RegistrationAnswerSummary.php
index 847a8c9..b9b1305 100644
--- a/Model/RegistrationAnswerSummary.php
+++ b/Model/RegistrationAnswerSummary.php
@@ -3,6 +3,7 @@
* RegistrationAnswerSummary Model
*
* @property Registration $Registration
+ * @property User $User
* @property RegistrationAnswer $RegistrationAnswer
*
* @author Noriko Arai
@@ -12,33 +13,13 @@
*/
App::uses('RegistrationsAppModel', 'Registrations.Model');
-App::uses('WorkflowComponent', 'Workflow.Controller/Component');
-App::uses('NetCommonsTime', 'NetCommons.Utility');
-App::uses('NetCommonsUrl', 'NetCommons.Utility');
-App::uses('MailSettingFixedPhrase', 'Mails.Model');
+App::uses('RegistrationsComponent', 'Registrations.Controller/Component');
/**
* Summary for RegistrationAnswerSummary Model
*/
class RegistrationAnswerSummary extends RegistrationsAppModel {
-/**
- * use behaviors
- *
- * @var array
- */
- public $actsAs = array(
- // 自動でメールキューの登録, 削除。ワークフロー利用時はWorkflow.Workflowより下に記述する
- 'Mails.MailQueue' => array(
- 'embedTags' => array(
- 'X-SUBJECT' => 'Registration.title',
- ),
- 'keyField' => 'id',
- 'typeKey' => MailSettingFixedPhrase::ANSWER_TYPE,
- ),
- 'Mails.MailQueueDelete',
- );
-
/**
* Validation rules
*
@@ -103,92 +84,35 @@ class RegistrationAnswerSummary extends RegistrationsAppModel {
);
/**
- * 登録受け付け番号の発行
- *
- * @param array $summary RegistrationAnswerSummary data
- * @return int
- */
- protected function _getNewSerialNumber($summary) {
- $conditions = [
- 'answer_status' => RegistrationsComponent::ACTION_ACT,
- 'registration_key' => $summary['RegistrationAnswerSummary']['registration_key']
- ];
- $result = $this->find('first', [
- 'conditions' => $conditions,
- 'order' => 'serial_number DESC',
- 'fields' => ['serial_number'],
- 'recursive' => -1
- ]);
- $serialNumber = isset($result['RegistrationAnswerSummary']['serial_number']) ?
- (int)$result['RegistrationAnswerSummary']['serial_number'] : 0;
- $serialNumber++;
- return $serialNumber;
- }
-
-/**
- * saveAnswerStatus
- * 登録状態を書き換える
- *
- * @param array $summary summary data
- * @param int $status status
- * @throws InternalErrorException
- * @return bool
- */
- public function saveAnswerStatus($summary, $status) {
- $summary['RegistrationAnswerSummary']['answer_status'] = $status;
-
- if ($status == RegistrationsComponent::ACTION_ACT) {
- // シリアルナンバー発行
- $summary['RegistrationAnswerSummary']['serial_number'] = $this->_getNewSerialNumber($summary);
- // サマリの状態を完了にして確定する
- $summary['RegistrationAnswerSummary']['answer_time'] = (new NetCommonsTime())->getNowDatetime();
- $this->_sendMails($summary);
- } else {
- // 完了時以外はメールBehaviorを外す
- $this->Behaviors->unload('Mails.MailQueue');
- }
- $this->begin();
- try {
- $this->set($summary);
- if (! $this->validates()) {
- $this->rollback();
- return false;
- }
- if (! $this->save($summary, false)) {
- throw new InternalErrorException(__d('net_commons', 'Internal Server Error'));
- }
- $this->commit();
- } catch (Exception $ex) {
- $this->rollback();
- CakeLog::error($ex);
- throw $ex;
- }
- return true;
- }
-/**
- * getProgressiveSummary
- * 登録中サマリを取得する
+ * getNowSummaryOfThisUser 指定された登録フォームIDと指定ユーザーに合致する登録フォーム登録を取得する
*
- * @param string $registrationKey registration key
- * @param int $summaryId summary id
+ * @param int $registrationKey 登録フォームKey
+ * @param int $userId ユーザID (指定しない場合は null)
+ * @param string $sessionId セッションID
* @return array
*/
- public function getProgressiveSummary($registrationKey, $summaryId = null) {
- $conditions = array(
- 'answer_status !=' => RegistrationsComponent::ACTION_ACT,
- 'registration_key' => $registrationKey,
- 'user_id' => Current::read('User.id'),
- );
- if (! is_null($summaryId)) {
- $conditions['RegistrationAnswerSummary.id'] = $summaryId;
+ public function getNowSummaryOfThisUser($registrationKey, $userId, $sessionId) {
+ if ($userId) {
+ $conditions = array(
+ 'answer_status' => RegistrationsComponent::ACTION_ACT,
+ 'registration_key' => $registrationKey,
+ 'user_id' => $userId
+ );
+ } else {
+ $conditions = array(
+ 'answer_status' => RegistrationsComponent::ACTION_ACT,
+ 'registration_key' => $registrationKey,
+ 'session_value' => $sessionId
+ );
}
- $summary = $this->find('first', array(
- 'conditions' => $conditions,
- 'recursive' => -1,
- 'order' => 'RegistrationAnswerSummary.created DESC' // 最も新しいものを一つ選ぶ
+
+ $summary = $this->find('all', array(
+ 'conditions' => $conditions
));
+
return $summary;
}
+
/**
* forceGetProgressiveAnswerSummary
* get answer summary record if there is no summary , then create
@@ -196,58 +120,34 @@ public function getProgressiveSummary($registrationKey, $summaryId = null) {
* @param array $registration registration
* @param int $userId user id
* @param string $sessionId session id
+ * @throws $ex
* @return array summary
- * @throws InternalErrorException
*/
public function forceGetProgressiveAnswerSummary($registration, $userId, $sessionId) {
$this->begin();
try {
- $answerTime = 1;
- if ($userId) {
- $maxTime = $this->find('first', array(
- 'fields' => array('MAX(answer_number) AS max_answer_time'),
- 'conditions' => array(
- 'registration_key' => $registration['Registration']['key'],
- 'user_id' => $userId
- )
- ));
- if ($maxTime) {
- $answerTime = $maxTime[0]['max_answer_time'] + 1;
- }
- }
- // 完全にこのコード上で作成しているものであるのでvalidatesでのチェックは行っていない
$this->create();
-
- $testStatus = RegistrationsComponent::TEST_ANSWER_STATUS_PEFORM;
- if ($registration['Registration']['status'] != WorkflowComponent::STATUS_PUBLISHED) {
- $testStatus = RegistrationsComponent::TEST_ANSWER_STATUS_TEST;
- }
-
- // サマリ新規作成時は一時保存なので、メール送信させない
- $this->Behaviors->unload('Mails.MailQueue');
-
if (! $this->save(array(
'answer_status' => RegistrationsComponent::ACTION_NOT_ACT,
- 'test_status' => $testStatus,
- 'answer_number' => $answerTime,
+ 'test_status' => ($registration['Registration']['status'] != WorkflowComponent::STATUS_PUBLISHED) ? RegistrationsComponent::TEST_ANSWER_STATUS_TEST : RegistrationsComponent::TEST_ANSWER_STATUS_PEFORM,
+ 'answer_number' => 1,
'registration_key' => $registration['Registration']['key'],
'session_value' => $sessionId,
'user_id' => $userId,
))) {
- throw new InternalErrorException(__d('net_commons', 'Internal Server Error'));
+ $this->rollback();
+ return false;
}
+ //$summary = array();
+ //$summary['RegistrationAnswerSummary']['id'] = $this->id;
+ //return $summary;
$this->commit();
} catch (Exception $ex) {
$this->rollback();
CakeLog::error($ex);
- throw new InternalErrorException(__d('net_commons', 'Internal Server Error'));
+ throw $ex;
}
- $summary = $this->find('first', array(
- 'recursive' => -1,
- 'conditions' => array(
- 'id' => $this->id
- )
- ));
+ $summary = $this->findById($this->id);
return $summary;
}
@@ -265,8 +165,7 @@ public function getResultCondition($registration) {
);
//公開時は本番時登録のみ、テスト時(=非公開時)は本番登録+テスト登録を対象とする。
if ($registration['Registration']['status'] == WorkflowComponent::STATUS_PUBLISHED) {
- $baseConditions['RegistrationAnswerSummary.test_status'] =
- RegistrationsComponent::TEST_ANSWER_STATUS_PEFORM;
+ $baseConditions['RegistrationAnswerSummary.test_status'] = RegistrationsComponent::TEST_ANSWER_STATUS_PEFORM;
}
return $baseConditions;
}
@@ -280,7 +179,7 @@ public function getResultCondition($registration) {
*/
public function getAggregate($registration) {
$this->RegistrationAnswer = ClassRegistry::init('Registrations.RegistrationAnswer', true);
- // 項目データのとりまとめ
+ // 質問データのとりまとめ
//$questionsは、registration_question_keyをキーとし、registration_question配下が代入されている。
$questions = Hash::combine($registration,
'RegistrationPage.{n}.RegistrationQuestion.{n}.key',
@@ -289,16 +188,13 @@ public function getAggregate($registration) {
// 集計データを集める際の基本条件
$baseConditions = $this->getResultCondition($registration);
- //項目毎に集計
+ //質問毎に集計
foreach ($questions as &$question) {
- if (RegistrationsComponent::isOnlyInputType($question['question_type'])) {
- continue;
- }
if ($question['is_result_display'] != RegistrationsComponent::EXPRESSION_SHOW) {
//集計表示をしない、なので飛ばす
continue;
}
- // 戻り値の、この項目の合計登録数を記録しておく。
+ // 戻り値の、この質問の合計登録数を記録しておく。
// skip ロジックがあるため、単純にsummaryのcountじゃない..
$questionConditions = $baseConditions + array(
'RegistrationAnswer.registration_question_key' => $question['key'],
@@ -318,27 +214,19 @@ public function getAggregate($registration) {
* __aggregateAnswerForMatrix
* matrix aggregate
*
- * @param array &$question 登録フォーム項目(集計結果を配列追加して返します)
+ * @param array &$question 登録フォーム質問(集計結果を配列追加して返します)
* @param array $questionConditions get aggregate base condition
* @return void
*/
private function __aggregateAnswerForMatrix(&$question, $questionConditions) {
$rowCnt = 0;
- $cols = Hash::extract(
- $question['RegistrationChoice'],
- '{n}[matrix_type=' . RegistrationsComponent::MATRIX_TYPE_COLUMN . ']');
-
+ $cols = Hash::extract($question['RegistrationChoice'], '{n}[matrix_type=' . RegistrationsComponent::MATRIX_TYPE_COLUMN . ']');
foreach ($question['RegistrationChoice'] as &$c) {
if ($c['matrix_type'] == RegistrationsComponent::MATRIX_TYPE_ROW_OR_NO_MATRIX) {
foreach ($cols as $col) {
- $searchWord = sprintf(
- '%%%s%s%s%%',
- RegistrationsComponent::ANSWER_DELIMITER,
- $col['key'],
- RegistrationsComponent::ANSWER_VALUE_DELIMITER);
$conditions = $questionConditions + array(
'RegistrationAnswer.matrix_choice_key' => $c['key'],
- 'RegistrationAnswer.answer_value LIKE ' => $searchWord,
+ 'RegistrationAnswer.answer_value LIKE ' => '%' . RegistrationsComponent::ANSWER_DELIMITER . $col['key'] . RegistrationsComponent::ANSWER_VALUE_DELIMITER . '%',
);
$cnt = $this->RegistrationAnswer->getAnswerCount($conditions);
$c['aggregate_total'][$col['key']] = $cnt;
@@ -353,19 +241,14 @@ private function __aggregateAnswerForMatrix(&$question, $questionConditions) {
* __aggregateAnswerForNotMatrix
* not matrix aggregate
*
- * @param array &$question 登録フォーム項目(集計結果を配列追加して返します)
+ * @param array &$question 登録フォーム質問(集計結果を配列追加して返します)
* @param array $questionConditions get aggregate base condition
* @return void
*/
private function __aggregateAnswerForNotMatrix(&$question, $questionConditions) {
foreach ($question['RegistrationChoice'] as &$c) {
- $searchWord = sprintf(
- '%%%s%s%s%%',
- RegistrationsComponent::ANSWER_DELIMITER,
- $c['key'],
- RegistrationsComponent::ANSWER_VALUE_DELIMITER);
$conditions = $questionConditions + array(
- 'RegistrationAnswer.answer_value LIKE ' => $searchWord,
+ 'RegistrationAnswer.answer_value LIKE ' => '%' . RegistrationsComponent::ANSWER_DELIMITER . $c['key'] . RegistrationsComponent::ANSWER_VALUE_DELIMITER . '%',
);
$cnt = $this->RegistrationAnswer->getAnswerCount($conditions);
$c['aggregate_total']['aggregate_not_matrix'] = $cnt;
@@ -390,202 +273,4 @@ public function deleteTestAnswerSummary($key, $status) {
return true;
}
-/**
- * deleteAnswerSummary
- * when registration is published, delete answer summary
- *
- * @param int $key registration key
- * @return bool
- */
- public function deleteAnswerSummary($key) {
- $this->deleteAll(array(
- 'registration_key' => $key,
- ), true);
- return true;
- }
-
-/**
- * メール送信のX-DATAタグ用文字列の生成
- *
- * @param array $summary RegistrationAnswerSummmaryデータ
- * @param array $answers RegistrationAnswerデータ(複数)
- * @return array|string X-DATA
- */
- protected function _makeXData($summary, $answers) {
- $xData = array();
- //$xData[] = __d('registrations', 'RegistrationAnswerSummary ID') . ':' .
- // $summary['RegistrationAnswerSummary']['id'];
- $xData[] = __d('registrations', 'Registration Number') . ':' .
- $summary['RegistrationAnswerSummary']['serial_number'];
- foreach ($answers as $answer) {
- // answer_valuesがあるときは選択式
- $xDataString = $answer['RegistrationQuestion']['question_value'] . ':';
-
- if (Hash::check($answer, 'RegistrationAnswer.answer_values')) {
- // 選択式
- $otherAnswer = Hash::get($answer,
- 'RegistrationAnswer.other_answer_value');
- if ($otherAnswer) {
- // 「その他」を取り除いて代わりにその他に入力されたテキストを追加
- array_pop($answer['RegistrationAnswer']['answer_values']);
- $answer['RegistrationAnswer']['answer_values'][] =
- $otherAnswer;
- }
- $xDataString .= implode("\n", $answer['RegistrationAnswer']['answer_values']);
- } else {
- $xDataString .= $answer['RegistrationAnswer']['answer_value'];
- }
- $xData[] = $xDataString;
- }
- $xData = implode("\n", $xData);
- return $xData;
- }
-
-/**
- * フォームからの登録時のメール送信処理
- *
- * @param array $summary RegistrationAnswerSummary data
- * @return void
- */
- protected function _sendMails($summary) {
- // メールのembed のURL設定を行っておく
- $url = NetCommonsUrl::actionUrl(
- array(
- 'controller' => 'registration_blocks',
- 'action' => 'index',
- Current::read('Block.id'),
- 'frame_id' => Current::read('Frame.id'),
- ),
- true
- );
- $this->setAddEmbedTagValue('X-URL', $url);
-
- // 本人にもメールする設定でメールアドレス欄があったら、一番最初のメールアドレス宛にメールする
- $condition = $this->Registration->getBaseCondition();
- $registration = $this->Registration->find('first', ['conditions' => $condition]);
-
- //フォーム設定した文面でメールをおくれるようにMailQueueBehaviorを設定する。
- $this->__setMailFixedPhraseForAllLanguages($registration);
-
- if (! $registration['Registration']['is_answer_mail_send']) {
- $this->Behaviors->unload('Mails.MailQueue');
- return;
- }
-
- // X-SUBJECT設定
- $this->setAddEmbedTagValue('X-SUBJECT', $registration['Registration']['title']);
-
- // 登録された項目の取得
- // RegistrationAnswerに登録データの取り扱いしやすい形への整備機能を組み込んであるので、それを利用したかった
- // AnswerとQuestionがJOINされた形でFindしないと整備機能が発動しない
- // そうするためにはrecursive=2でないといけないわけだが、recursive=2にするとRoleのFindでSQLエラーになる
- // 仕方ないのでこの形式で処理を行う
- // 単純にRegistrationAnswerSummary.idでFindすると、LEFT JOIN の関係で同じ項目が複数でてきてしまう。
- $questionIds = Hash::extract(
- $registration['RegistrationPage'],
- '{n}.RegistrationQuestion.{n}.id'
- );
- $answers = $this->RegistrationAnswer->find(
- 'all',
- array(
- 'fields' => array('RegistrationAnswer.*', 'RegistrationQuestion.*'),
- 'conditions' => array(
- 'registration_answer_summary_id' => $summary[$this->alias]['id'],
- 'RegistrationQuestion.id' => $questionIds
- ),
- 'recursive' => -1,
- 'joins' => array(
- array(
- 'table' => 'registration_questions',
- 'alias' => 'RegistrationQuestion',
- 'type' => 'LEFT',
- 'conditions' => array(
- 'RegistrationAnswer.registration_question_key = RegistrationQuestion.key',
- )
- )
- )
- )
- );
-
- // X-DATA展開
- $xData = $this->_makeXData($summary, $answers);
- $this->setAddEmbedTagValue('X-DATA', $xData);
-
- // TO_ADDRESSESには表示しない(ルーム配信のみ表示)末尾定型文を追加(登録フォーム回答)
- $this->setSetting(
- MailQueueBehavior::MAIL_QUEUE_SETTING_MAIL_BODY_AFTER,
- __d('registrations', 'Registration.mail.after.body')
- );
-
- if ($registration['Registration']['is_regist_user_send']) {
- // 本人にもメールする
- foreach ($registration['RegistrationPage'][0]['RegistrationQuestion'] as $index => $question) {
- if ($question['question_type'] == RegistrationsComponent::TYPE_EMAIL) {
- // メール項目あり
- // メアドをregistration_answersから取得
- $registerUserMail = $answers[$index]['RegistrationAnswer']['answer_value'];
-
- if (!$this->__isSameLoginUserEmail($registerUserMail)) {
- // 送信先にset
- $this->setSetting(
- MailQueueBehavior::MAIL_QUEUE_SETTING_TO_ADDRESSES,
- [$registerUserMail]
- );
- }
- // ループから抜ける
- break;
- }
- }
- }
- }
-
-/**
- * __isSameLoginUserEmail
- *
- * @param string $registerUserMail email
- * @return bool
- */
- private function __isSameLoginUserEmail($registerUserMail) {
- $email = Current::read('User.email');
- return ($email === $registerUserMail);
- }
-
-/**
- * MailQueueBehaviorにメール設定をセット。
- *
- * 登録フォームの編集画面で登録した登録通知メールの文面をどの言語でも有効にするために自前でセットしている。
- *
- * @param array $registration Registration data
- * @return void
- */
- private function __setMailFixedPhraseForAllLanguages(array $registration) {
- $languageId = $registration['Registration']['language_id'];
- $typeKey = \MailSettingFixedPhrase::ANSWER_TYPE;
- $settingPluginKey = 'registrations';
-
- $mailSettingPlugin = $this->MailSetting->getMailSettingPlugin(
- $languageId,
- $typeKey,
- $settingPluginKey
- );
-
- // 有効になってる全言語に同じメール設定をセットする
- foreach ($this->__findActiveLanguageIds() as $languageId) {
- /** @uses MailQueueBehavior::setMailSettingPlugin() */
- $this->setMailSettingPlugin($languageId, $typeKey, $settingPluginKey, $mailSettingPlugin);
- }
- }
-
-/**
- * 有効になってる言語IDを取得
- *
- * @return int[] Language.id[]
- */
- private function __findActiveLanguageIds() : array {
- /** @var Language $languageModel */
- $languageModel = ClassRegistry::init('M17n.Language');
- $languages = $languageModel->getLanguages();
- return array_map('intval', array_column(array_column($languages, 'Language'), 'id'));
- }
-
}
diff --git a/Model/RegistrationAnswerSummaryCsv.php b/Model/RegistrationAnswerSummaryCsv.php
index 4971af5..ea6b5dc 100644
--- a/Model/RegistrationAnswerSummaryCsv.php
+++ b/Model/RegistrationAnswerSummaryCsv.php
@@ -13,7 +13,7 @@
*/
App::uses('RegistrationsAppModel', 'Registrations.Model');
-App::uses('NetCommonsTime', 'NetCommons.Utility');
+App::uses('RegistrationsComponent', 'Registrations.Controller/Component');
/**
* Summary for RegistrationAnswerSummary Model
@@ -62,33 +62,6 @@ class RegistrationAnswerSummaryCsv extends RegistrationsAppModel {
public $hasMany = array(
);
-/**
- * 日時を変換するクラス
- *
- * @var NetCommonsTime
- */
- private $__NetCommonsTime;
-
-/**
- * Constructor. Binds the model's database table to the object.
- *
- * @param bool|int|string|array $id Set this ID for this model on startup,
- * can also be an array of options, see above.
- * @param string $table Name of database table to use.
- * @param string $ds DataSource connection name.
- * @see Model::__construct()
- * @SuppressWarnings(PHPMD.BooleanArgumentFlag)
- */
- public function __construct($id = false, $table = null, $ds = null) {
- parent::__construct($id, $table, $ds);
-
- $this->loadModels([
- 'Registration' => 'Registrations.Registration',
- 'RegistrationAnswer' => 'Registrations.RegistrationAnswer',
- ]);
- $this->__NetCommonsTime = new NetCommonsTime();
- }
-
/**
* getRegistrationForAnswerCsv
*
@@ -96,11 +69,10 @@ public function __construct($id = false, $table = null, $ds = null) {
* @return array registration data
*/
public function getRegistrationForAnswerCsv($registrationKey) {
+ $this->Registration = ClassRegistry::init('Registrations.Registration', true);
// 指定の登録フォームデータを取得
- // CSVの取得は公開してちゃんとした登録を得ている登録フォームに限定である
$registration = $this->Registration->find('first', array(
'conditions' => array(
- 'Registration.block_id' => Current::read('Block.id'),
'Registration.key' => $registrationKey,
'Registration.is_active' => true,
),
@@ -110,7 +82,7 @@ public function getRegistrationForAnswerCsv($registrationKey) {
}
/**
- * getAnswerSummaryCsv
+ * getAnswerSummaryCsv
*
* @param array $registration registration data
* @param int $limit record limit
@@ -118,46 +90,36 @@ public function getRegistrationForAnswerCsv($registrationKey) {
* @return array
*/
public function getAnswerSummaryCsv($registration, $limit, $offset) {
+ $this->RegistrationAnswer = ClassRegistry::init('Registrations.RegistrationAnswer', true);
+
// 指定された登録フォームの登録データをCsvに出力しやすい行形式で返す
$retArray = array();
- // $registrationにはページデータ、項目データが入っていることを前提とする
+ // $offset == 0 のときのみヘッダ行を出す
+ if ($offset == 0) {
+ $retArray[] = $this->_putHeader($registration);
+ }
+
+ // $registrationにはページデータ、質問データが入っていることを前提とする
// 登録フォームのkeyを取得
$key = $registration['Registration']['key'];
// keyに一致するsummaryを取得(テストじゃない、完了している)
$summaries = $this->find('all', array(
- 'fields' => array('RegistrationAnswerSummaryCsv.*', 'User.handlename'),
'conditions' => array(
'answer_status' => RegistrationsComponent::ACTION_ACT,
'test_status' => RegistrationsComponent::TEST_ANSWER_STATUS_PEFORM,
'registration_key' => $key,
),
- 'recursive' => -1,
- 'joins' => array(
- array(
- 'table' => 'users',
- 'alias' => 'User',
- 'type' => 'LEFT',
- 'conditions' => array(
- 'RegistrationAnswerSummaryCsv.user_id = User.id',
- )
- )
- ),
'limit' => $limit,
'offset' => $offset,
- 'order' => array('RegistrationAnswerSummaryCsv.answer_time ASC'),
+ 'order' => 'RegistrationAnswerSummaryCsv.created',
));
if (empty($summaries)) {
return $retArray;
}
- // 項目のIDを取得
- $questionIds = Hash::extract(
- $registration['RegistrationPage'],
- '{n}.RegistrationQuestion.{n}.id');
-
// summary loop
foreach ($summaries as $summary) {
//$answers = $summary['RegistrationAnswer'];
@@ -167,28 +129,11 @@ public function getAnswerSummaryCsv($registration, $limit, $offset) {
// AnswerとQuestionがJOINされた形でFindしないと整備機能が発動しない
// そうするためにはrecursive=2でないといけないわけだが、recursive=2にするとRoleのFindでSQLエラーになる
// 仕方ないのでこの形式で処理を行う
- //$answers = $this->RegistrationAnswer->find('all', array(
- // 'fields' => array('RegistrationAnswer.*', 'RegistrationQuestion.*'),
- // 'conditions' => array(
- // 'registration_answer_summary_id' => $summary[$this->alias]['id'],
- // 'RegistrationQuestion.id' => $questionIds
- // ),
- // 'recursive' => -1,
- // 'joins' => array(
- // array(
- // 'table' => 'registration_questions',
- // 'alias' => 'RegistrationQuestion',
- // 'type' => 'LEFT',
- // 'conditions' => array(
- // 'RegistrationAnswer.registration_question_key = RegistrationQuestion.key',
- // )
- // )
- // )
- //));
- $answers = $this->RegistrationAnswer->getAnswersBySummary(
- $summary,
- $questionIds,
- $this->alias);
+ $answers = $this->RegistrationAnswer->find('all', array(
+ 'conditions' => array(
+ 'registration_answer_summary_id' => $summary[$this->alias]['id']
+ ),
+ ));
$retArray[] = $this->_getRows($registration, $summary, $answers);
}
@@ -196,15 +141,14 @@ public function getAnswerSummaryCsv($registration, $limit, $offset) {
}
/**
- * getHeader
+ * _putHeader
*
* @param array $registration registration data
* @return array
*/
- public function getHeader($registration) {
+ protected function _putHeader($registration) {
$cols = array();
- $cols[] = __d('registrations', 'Registration Number');
// "登録者","登録日","回数"
$cols[] = __d('registrations', 'Respondent');
$cols[] = __d('registrations', 'Answer Date');
@@ -212,25 +156,15 @@ public function getHeader($registration) {
foreach ($registration['RegistrationPage'] as $page) {
foreach ($page['RegistrationQuestion'] as $question) {
- $pageNumber = $page['page_sequence'] + 1;
- $questionNumber = $question['question_sequence'] + 1;
if (RegistrationsComponent::isMatrixInputType($question['question_type'])) {
$choiceSeq = 1;
foreach ($question['RegistrationChoice'] as $choice) {
if ($choice['matrix_type'] == RegistrationsComponent::MATRIX_TYPE_ROW_OR_NO_MATRIX) {
- $cols[] = sprintf('%d-%d-%d. %s:%s',
- $pageNumber,
- $questionNumber,
- $choiceSeq++,
- $question['question_value'],
- $choice['choice_label']);
+ $cols[] = $page['page_sequence'] . '-' . $question['question_sequence'] . '-' . $choiceSeq++ . '. ' . $choice['choice_label'];
}
}
} else {
- $cols[] = sprintf('%d-%d. %s',
- $pageNumber,
- $questionNumber,
- $question['question_value']);
+ $cols[] = $page['page_sequence'] . '-' . $question['question_sequence'] . '. ' . $question['question_value'];
}
}
}
@@ -246,7 +180,7 @@ public function getHeader($registration) {
* @return array
*/
protected function _getRows($registration, $summary, $answers) {
- // ページ、項目のループから、取り出すべき項目のIDを順番に取り出す
+ // ページ、質問のループから、取り出すべき質問のIDを順番に取り出す
// question loop
// 返却用配列にquestionのIDにマッチするAnswerを配列要素として追加、Answerがないときは空文字
// なお選択肢系のものはchoice_idが登録にくっついているのでそれを削除する
@@ -254,12 +188,9 @@ protected function _getRows($registration, $summary, $answers) {
// その他の選択肢の場合は、入力されたその他のテキストを入れる
$cols = array();
- $cols[] = $summary['RegistrationAnswerSummaryCsv']['serial_number'];
- $cols[] = $this->_getUserName($registration, $summary);
- $cols[] = $this->__NetCommonsTime->dateFormat(
- $summary['RegistrationAnswerSummaryCsv']['answer_time'],
- 'Y-m-d H:i:s'
- );
+
+ $cols[] = ($registration['Registration']['is_anonymity']) ? __d('registrations', 'Anonymity') : $summary['TrackableCreator']['username'];
+ $cols[] = $summary['RegistrationAnswerSummaryCsv']['modified'];
$cols[] = $summary['RegistrationAnswerSummaryCsv']['answer_number'];
foreach ($registration['RegistrationPage'] as $page) {
@@ -278,22 +209,6 @@ protected function _getRows($registration, $summary, $answers) {
return $cols;
}
-/**
- * _getUserName
- *
- * @param array $registration registration data
- * @param array $summary answer summary
- * @return string
- */
- protected function _getUserName($registration, $summary) {
- if ($registration['Registration']['is_anonymity']) {
- return __d('registrations', 'Anonymity');
- }
- if (empty($summary['User']['handlename'])) {
- return __d('registrations', 'Guest');
- }
- return $summary['User']['handlename'];
- }
/**
* _getAns
*
@@ -303,45 +218,31 @@ protected function _getUserName($registration, $summary) {
*/
protected function _getAns($question, $answers) {
$retAns = '';
- // 登録配列データの中から、現在指定された項目に該当するものを取り出す
- $ans = Hash::extract(
- $answers,
- '{n}.RegistrationAnswer[registration_question_key=' . $question['key'] . ']');
+ // 登録配列データの中から、現在指定された質問に該当するものを取り出す
+ $ans = Hash::extract($answers, '{n}.RegistrationAnswer[registration_question_key=' . $question['key'] . ']');
// 登録が存在するとき処理
- if (! $ans) {
- // 通常の処理ではこのような場面はありえない
- // 登録フォームは空登録であっても登録レコードを作成するからです
- // データレコード異常があった場合のみです
- // ただ、この登録を異常データだからといってオミットすると、サマリの合計数と
- // 合わなくなって集計データが狂ってしまうので空登録だったように装って処理します
- return $retAns;
- }
-
- $ans = $ans[0];
-
- // 単純入力タイプのときは登録の値をそのまま返す
- if (RegistrationsComponent::isOnlyInputType($question['question_type'])) {
- $retAns = $ans['answer_value'];
- } elseif (RegistrationsComponent::isSelectionInputType($question['question_type'])) {
- // choice_id と choice_valueに分けられた登録選択肢配列を得る
- // 選択されていた数分処理
- foreach ($ans['answer_values'] as $choiceKey => $dividedAns) {
- // idから判断して、その他が選ばれていた場合、other_answer_valueを入れる
- $choice = Hash::extract(
- $question['RegistrationChoice'],
- '{n}[key=' . $choiceKey . ']');
- if ($choice) {
- $choice = $choice[0];
- if ($choice['other_choice_type'] !=
- RegistrationsComponent::OTHER_CHOICE_TYPE_NO_OTHER_FILED) {
- $retAns .= $ans['other_answer_value'];
- } else {
- $retAns .= $dividedAns;
+ if ($ans) {
+ $ans = $ans[0];
+ // 単純入力タイプのときは登録の値をそのまま返す
+ if (RegistrationsComponent::isOnlyInputType($question['question_type'])) {
+ $retAns = $ans['answer_value'];
+ } elseif (RegistrationsComponent::isSelectionInputType($question['question_type'])) {
+ // choice_id と choice_valueに分けられた登録選択肢配列を得る
+ // 選択されていた数分処理
+ foreach ($ans['answer_values'] as $choiceKey => $dividedAns) {
+ // idから判断して、その他が選ばれていた場合、other_answer_valueを入れる
+ $choice = Hash::extract($question['RegistrationChoice'], '{n}[key=' . $choiceKey . ']');
+ if ($choice) {
+ if ($choice[0]['other_choice_type'] != RegistrationsComponent::OTHER_CHOICE_TYPE_NO_OTHER_FILED) {
+ $retAns .= $ans['other_answer_value'];
+ } else {
+ $retAns .= $dividedAns;
+ }
+ $retAns .= RegistrationsComponent::ANSWER_DELIMITER;
}
- $retAns .= RegistrationsComponent::ANSWER_DELIMITER;
}
+ $retAns = trim($retAns, RegistrationsComponent::ANSWER_DELIMITER);
}
- $retAns = trim($retAns, RegistrationsComponent::ANSWER_DELIMITER);
}
return $retAns;
}
@@ -356,17 +257,10 @@ protected function _getAns($question, $answers) {
*/
protected function _getMatrixAns($question, $choice, $answers) {
$retAns = '';
- // 登録配列データの中から、現在指定された項目に該当するものを取り出す
+ // 登録配列データの中から、現在指定された質問に該当するものを取り出す
// マトリクスタイプのときは複数存在する(行数分)
- $anss = Hash::extract(
- $answers,
- '{n}.RegistrationAnswer[registration_question_key=' . $question['key'] . ']');
+ $anss = Hash::extract($answers, '{n}.RegistrationAnswer[registration_question_key=' . $question['key'] . ']');
if (empty($anss)) {
- // 通常の処理ではこのような場面はありえない
- // 登録フォームは空登録であっても登録レコードを作成するからです
- // データレコード異常があった場合のみです
- // ただ、この登録を異常データだからといってオミットすると、サマリの合計数と
- // 合わなくなって集計データが狂ってしまうので空登録だったように装って処理します
return $retAns;
}
// その中かから現在指定された選択肢行に該当するものを取り出す
@@ -378,7 +272,7 @@ protected function _getMatrixAns($question, $choice, $answers) {
if ($choice['other_choice_type'] != RegistrationsComponent::OTHER_CHOICE_TYPE_NO_OTHER_FILED) {
$retAns = $ans['other_answer_value'] . RegistrationsComponent::ANSWER_VALUE_DELIMITER;
}
- $retAns .= implode(RegistrationsComponent::ANSWER_DELIMITER, $ans['answer_values']);
+ $retAns = implode(RegistrationsComponent::ANSWER_DELIMITER, $ans['answer_values']);
}
return $retAns;
}
diff --git a/Model/RegistrationChoice.php b/Model/RegistrationChoice.php
index 7306d70..105a6a0 100644
--- a/Model/RegistrationChoice.php
+++ b/Model/RegistrationChoice.php
@@ -11,6 +11,7 @@
*/
App::uses('RegistrationsAppModel', 'Registrations.Model');
+App::uses('RegistrationsComponent', 'Registrations.Controller/Component');
/**
* Summary for RegistrationChoice Model
@@ -33,9 +34,6 @@ class RegistrationChoice extends RegistrationsAppModel {
*/
public $actsAs = array(
'NetCommons.OriginalKey',
- 'M17n.M17n' => array(
- 'afterCallback' => false,
- ),
);
/**
@@ -106,16 +104,22 @@ public function beforeValidate($options = array()) {
),
'graph_color' => array(
'rule' => '/^#[a-f0-9]{6}$/i',
- 'message' =>
- __d('registrations',
- 'First character is "#". And input the hexadecimal numbers by six digits.'),
+ 'message' => __d('registrations', 'First character is "#". And input the hexadecimal numbers by six digits.'),
//'allowEmpty' => false,
//'required' => false,
),
);
- // validates時にはまだregistration_question_idの設定ができないのでチェックしないことにする
- // registration_question_idの設定は上位のRegistrationQuestionクラスで責任を持って行われるものとする
-
+ // ウィザード画面でのセットアップ中の場合はまだ親ページIDの正当性についてのチェックは行わない
+ if (! (isset($options['validate']) && $options['validate'] == RegistrationsComponent::REGISTRATION_VALIDATE_TYPE)) {
+ $this->validate = Hash::merge($this->validate, array(
+ 'registration_question_id' => array(
+ 'numeric' => array(
+ 'rule' => array('numeric'),
+ 'message' => __d('net_commons', 'Invalid request.'),
+ ),
+ ),
+ ));
+ }
$this->_checkSkip($options['isSkip'], $options['pageIndex'], $options['maxPageIndex']);
return parent::beforeValidate($options);
@@ -175,23 +179,20 @@ protected function _checkSkip($isSkip, $pageIndex, $maxPageIndex) {
if ($isSkip != RegistrationsComponent::SKIP_FLAGS_SKIP) {
return;
}
- // 項目がスキップ項目である場合
+ // 質問がスキップ質問である場合
// 未設定時はデフォルトの次ページ移動となります
if (! isset($this->data['RegistrationChoice']['skip_page_sequence'])) {
$this->data['RegistrationChoice']['skip_page_sequence'] = $pageIndex + 1;
}
- $skipPage = $this->data['RegistrationChoice']['skip_page_sequence'];
// 最後ページへの指定ではない場合
- if ($skipPage != RegistrationsComponent::SKIP_GO_TO_END) {
+ if ($this->data['RegistrationChoice']['skip_page_sequence'] != RegistrationsComponent::SKIP_GO_TO_END) {
// そのジャンプ先は現在ページから戻っていないか
- if ($skipPage <= $pageIndex) {
- $this->validationErrors['skip_page_sequence'][] =
- __d('registrations', 'Invalid skip page. Please set forward page.');
+ if ($this->data['RegistrationChoice']['skip_page_sequence'] <= $pageIndex) {
+ $this->validationErrors['skip_page_sequence'][] = __d('registrations', 'Invalid skip page. Please set forward page.');
}
// そのジャンプ先は存在するページシーケンスか
- if ($skipPage > $maxPageIndex) {
- $this->validationErrors['skip_page_sequence'][] =
- __d('registrations', 'Invalid skip page. page does not exist.');
+ if ($this->data['RegistrationChoice']['skip_page_sequence'] > $maxPageIndex) {
+ $this->validationErrors['skip_page_sequence'][] = __d('registrations', 'Invalid skip page. page does not exist.');
}
}
}
diff --git a/Model/RegistrationExport.php b/Model/RegistrationExport.php
new file mode 100644
index 0000000..ee90561
--- /dev/null
+++ b/Model/RegistrationExport.php
@@ -0,0 +1,133 @@
+
+ * @author AllCreator
+ * @link http://www.netcommons.org NetCommons Project
+ * @license http://www.netcommons.org/license.txt NetCommons License
+ */
+
+App::uses('RegistrationsAppModel', 'Registrations.Model');
+App::uses('WysIsWygDownloader', 'Registrations.Utility');
+App::uses('RegistrationsComponent', 'Registrations.Controller/Component');
+
+/**
+ * Summary for Registration Model
+ */
+class RegistrationExport extends RegistrationsAppModel {
+
+/**
+ * Use table config
+ *
+ * @var bool
+ */
+ public $useTable = 'registrations';
+
+/**
+ * use behaviors
+ *
+ * @var array
+ */
+ public $actsAs = array(
+ 'AuthorizationKeys.AuthorizationKey',
+ );
+
+/**
+ * Validation rules
+ *
+ * @var array
+ */
+ public $validate = array();
+
+/**
+ * getExportData
+ *
+ * @param string $registrationKey 登録フォームキー
+ * @return array RegistrationData for Export
+ */
+ public function getExportData($registrationKey) {
+ // 登録フォームデータをjsonにして記述した内容を含むZIPファイルを作成する
+ $zipData = array();
+
+ // バージョン情報を取得するためComposer情報を得る
+ $Plugin = ClassRegistry::init('Plugins.Plugin');
+ $composer = $Plugin->getComposer('netcommons/registrations');
+ // 最初のデータは登録フォームプラグインのバージョン
+ $zipData['version'] = $composer['version'];
+
+ // 言語数分
+ $Language = ClassRegistry::init('Languages.Language');
+ $languages = $Language->find('all', array(
+ 'recursive' => -1
+ ));
+ $Registration = ClassRegistry::init('Registrations.Registration');
+ $registrations = array();
+ foreach ($languages as $lang) {
+ // 指定の登録フォームデータを取得
+ $registration = $Registration->find('first', array(
+ 'conditions' => array(
+ 'Registration.key' => $registrationKey,
+ 'Registration.is_active' => true,
+ 'Registration.is_latest' => true,
+ 'Registration.language_id' => $lang['Language']['id']
+ ),
+ 'recursive' => 0
+ ));
+ // 指定の言語データがない場合もあることを想定
+ if (empty($registration)) {
+ continue;
+ }
+ $registration = Hash::remove($registration, 'Block');
+ $registration = Hash::remove($registration, 'TrackableCreator');
+ $registration = Hash::remove($registration, 'TrackableUpdater');
+ $Registration->clearRegistrationId($registration);
+ $registrations[] = $registration;
+ }
+ $zipData['Registrations'] = $registrations;
+ return $zipData;
+ }
+/**
+ * putToZip
+ *
+ * @param ZipDownloader $zipFile ZIPファイルオブジェクト
+ * @param array $zipData zip data
+ * @return void
+ */
+ public function putToZip($zipFile, $zipData) {
+ $this->Registration = ClassRegistry::init('Registrations.Registration');
+ $this->RegistrationPage = ClassRegistry::init('Registrations.RegistrationPage');
+ $this->RegistrationQuestion = ClassRegistry::init('Registrations.RegistrationQuestion');
+
+ $wysiswyg = new WysIsWygDownloader();
+
+ // 登録フォームデータの中でもWYSISWYGデータのものについては
+ // フォルダ別に確保(フォルダの中にZIPがある)
+ $flatRegistration = Hash::flatten($zipData);
+ foreach ($flatRegistration as $key => &$value) {
+ $model = null;
+ if (strpos($key, 'RegistrationQuestion.') !== false) {
+ $model = $this->RegistrationQuestion;
+ } elseif (strpos($key, 'RegistrationPage.') !== false) {
+ $model = $this->RegistrationPage;
+ } elseif (strpos($key, 'Registration.') !== false) {
+ $model = $this->Registration;
+ }
+ if (!$model) {
+ continue;
+ }
+ $columnName = substr($key, strrpos($key, '.') + 1);
+ if ($model->hasField($columnName)) {
+ if ($model->getColumnType($columnName) == 'text') {
+ $wysiswygZipFile = $wysiswyg->createWysIsWygZIP($model->alias . '.' . $columnName, $value);
+ $wysiswygFileName = $key . '.zip';
+ $zipFile->addFile($wysiswygZipFile, $wysiswygFileName);
+ $value = $wysiswygFileName;
+ }
+ }
+ }
+ $registration = Hash::expand($flatRegistration);
+ // jsonデータにして書き込み
+ $zipFile->addFromString(RegistrationsComponent::REGISTRATION_JSON_FILENAME, json_encode($registration));
+ }
+}
diff --git a/Model/RegistrationFrameDisplayRegistration.php b/Model/RegistrationFrameDisplayRegistration.php
new file mode 100644
index 0000000..6ecd4d1
--- /dev/null
+++ b/Model/RegistrationFrameDisplayRegistration.php
@@ -0,0 +1,227 @@
+
+ * @author AllCreator
+ * @link http://www.netcommons.org NetCommons Project
+ * @license http://www.netcommons.org/license.txt NetCommons License
+ */
+
+App::uses('RegistrationsAppModel', 'Registrations.Model');
+App::uses('RegistrationsComponent', 'Registrations.Controller/Component');
+
+/**
+ * Summary for RegistrationFrameDisplayRegistration Model
+ */
+class RegistrationFrameDisplayRegistration extends RegistrationsAppModel {
+
+/**
+ * Validation rules
+ *
+ * @var array
+ */
+ public $validate = array();
+
+ //The Associations below have been created with all possible keys, those that are not needed can be removed
+
+/**
+ * belongsTo associations
+ *
+ * @var array
+ */
+ public $belongsTo = array(
+ 'Frame' => array(
+ 'className' => 'Frames.Frame',
+ 'foreignKey' => 'frame_key',
+ 'conditions' => '',
+ 'fields' => '',
+ 'order' => ''
+ ),
+ 'Registration' => array(
+ 'className' => 'Registrations.Registration',
+ 'foreignKey' => 'registration_key',
+ 'conditions' => '',
+ 'fields' => '',
+ 'order' => ''
+ )
+ );
+
+/**
+ * Called during validation operations, before validation. Please note that custom
+ * validation rules can be defined in $validate.
+ *
+ * @param array $options Options passed from Model::save().
+ * @return bool True if validate operation should continue, false to abort
+ * @link http://book.cakephp.org/2.0/en/models/callback-methods.html#beforevalidate
+ * @see Model::save()
+ * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
+ */
+ public function beforeValidate($options = array()) {
+ $this->validate = Hash::merge($this->validate, array(
+ 'registration_key' => array(
+ 'notBlank' => array(
+ 'rule' => array('notBlank'),
+ 'message' => __d('net_commons', 'Invalid request.'),
+ 'allowEmpty' => false,
+ 'required' => true,
+ //'last' => false, // Stop validation after this rule
+ //'on' => 'create', // Limit validation to 'create' or 'update' operations
+ ),
+ ),
+ ));
+ parent::beforeValidate($options);
+
+ return true;
+ }
+
+/**
+ * validateFrameDisplayRegistration
+ *
+ * @param mix $data PostData
+ * @return bool
+ */
+ public function validateFrameDisplayRegistration($data) {
+ if ($data['RegistrationFrameSetting']['display_type'] == RegistrationsComponent::DISPLAY_TYPE_SINGLE) {
+ $saveData = Hash::extract($data, 'Single.RegistrationFrameDisplayRegistrations');
+ $this->set($saveData);
+ $ret = $this->validates();
+ } else {
+ $saveData = $data['RegistrationFrameDisplayRegistrations'];
+ $ret = $this->saveAll($saveData, array('validate' => 'only'));
+ }
+ return $ret;
+ }
+/**
+ * saveFrameDisplayRegistration
+ * this function is called when save registration
+ *
+ * @param mix $data PostData
+ * @return bool
+ */
+ public function saveFrameDisplayRegistration($data) {
+ //トランザクションは親元のRegistrationFrameSettingでやっているので不要
+ //if ($data['RegistrationFrameSetting']['display_type'] == RegistrationsComponent::DISPLAY_TYPE_SINGLE) {
+ // // このフレームに設定されている全てのレコードを消す
+ // // POSTされた登録フォームのレコードのみ作成する
+ $ret = $this->saveDisplayRegistrationForSingle($data);
+ //} else {
+ // hiddenでPOSTされたレコードについて全て処理する
+ // POSTのis_displayが0,1によってdeleteかinsertで処理する
+ //$ret = $this->saveDisplayRegistrationForList($data);
+ //}
+ return $ret;
+ }
+
+/**
+ * saveDisplayRegistrationForList
+ *
+ * @param mix $data PostData
+ * @return bool
+ */
+ public function saveDisplayRegistrationForList($data) {
+ $frameKey = Current::read('Frame.key');
+
+ foreach ($data['RegistrationFrameDisplayRegistrations'] as $index => $value) {
+ $registrationKey = $value['registration_key'];
+ $isDisplay = $data['List']['RegistrationFrameDisplayRegistrations'][$index]['is_display'];
+ $saveQs = array(
+ 'frame_key' => $frameKey,
+ 'registration_key' => $registrationKey
+ );
+ if ($isDisplay != 0) {
+ if (!$this->saveDisplayRegistration($saveQs)) {
+ return false;
+ }
+ } else {
+ if (!$this->deleteAll($saveQs, false)) {
+ return false;
+ }
+ }
+ }
+ if (!$this->updateFrameDefaultAction("''")) {
+ return false;
+ }
+ return true;
+ }
+
+/**
+ * saveDisplayRegistrationForSingle
+ *
+ * @param mix $data PostData
+ * @return bool
+ */
+ public function saveDisplayRegistrationForSingle($data) {
+ $frameKey = Current::read('Frame.key');
+ $deleteQs = array(
+ 'frame_key' => $frameKey,
+ );
+ $this->deleteAll($deleteQs, false);
+
+ $saveData = Hash::extract($data, 'Single.RegistrationFrameDisplayRegistrations');
+ $saveData['frame_key'] = $frameKey;
+ if (!$this->saveDisplayRegistration($saveData)) {
+ return false;
+ }
+ $action = "'" . 'registration_answers/view/' . Current::read('Block.id') . '/' . $saveData['registration_key'] . "'";
+ if (!$this->updateFrameDefaultAction($action)) {
+ return false;
+ }
+ return true;
+ }
+
+/**
+ * saveDisplayRegistration
+ * saveRegistrationFrameDisplayRegistration
+ *
+ * @param array $data save data
+ * @return bool
+ */
+ public function saveDisplayRegistration($data) {
+ // 該当データを検索して
+ $displayRegistration = $this->find('first', array(
+ 'conditions' => $data
+ ));
+ if (! empty($displayRegistration)) {
+ // あるならもう作らない
+ return true;
+ }
+ $this->create();
+ if (!$this->save($data)) {
+ return false;
+ }
+ // フレームのデフォルトにする
+
+ $action = "'" . 'registration_answers/view/' . Current::read('Block.id') . '/' . $data['registration_key'] . "'";
+ if (!$this->updateFrameDefaultAction($action)) {
+ return false;
+ }
+ return true;
+ }
+/**
+ * updateFrameDefaultAction
+ * update Frame default_action
+ *
+ * @param string $action default_action
+ * @return bool
+ */
+ public function updateFrameDefaultAction($action) {
+ // frameのdefault_actionを変更しておく
+ $this->loadModels([
+ 'Frame' => 'Frames.Frame',
+ ]);
+ $conditions = array(
+ 'Frame.key' => Current::read('Frame.key')
+ );
+ $frameData = array(
+ 'default_action' => $action
+ );
+ if (! $this->Frame->updateAll($frameData, $conditions)) {
+ return false;
+ }
+ return true;
+ }
+}
diff --git a/Model/RegistrationFrameSetting.php b/Model/RegistrationFrameSetting.php
new file mode 100644
index 0000000..8effedc
--- /dev/null
+++ b/Model/RegistrationFrameSetting.php
@@ -0,0 +1,222 @@
+
+ * @author AllCreator
+ * @link http://www.netcommons.org NetCommons Project
+ * @license http://www.netcommons.org/license.txt NetCommons License
+ * @copyright Copyright 2014, NetCommons Project
+ */
+
+App::uses('RegistrationsAppModel', 'Registrations.Model');
+App::uses('RegistrationsComponent', 'Registrations.Controller/Component');
+
+/**
+ * Summary for RegistrationFrameSetting Model
+ *
+ * @property RegistrationFrameDisplayRegistration RegistrationFrameDisplayRegistration
+ */
+class RegistrationFrameSetting extends RegistrationsAppModel {
+
+/**
+ * Validation rules
+ *
+ * @var array
+ */
+ public $validate = array(
+ );
+
+ //The Associations below have been created with all possible keys, those that are not needed can be removed
+
+/**
+ * belongsTo associations
+ *
+ * @var array
+ */
+ public $belongsTo = array(
+ 'Frame' => array(
+ 'className' => 'Frames.Frame',
+ 'foreignKey' => 'frame_key',
+ 'conditions' => '',
+ 'fields' => '',
+ 'order' => ''
+ )
+ );
+
+/**
+ * Called during validation operations, before validation. Please note that custom
+ * validation rules can be defined in $validate.
+ *
+ * @param array $options Options passed from Model::save().
+ * @return bool True if validate operation should continue, false to abort
+ * @link http://book.cakephp.org/2.0/en/models/callback-methods.html#beforevalidate
+ * @see Model::save()
+ * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
+ */
+ public function beforeValidate($options = array()) {
+ $this->validate = Hash::merge($this->validate, array(
+ 'frame_key' => array(
+ 'notBlank' => array(
+ 'rule' => array('notBlank'),
+ //'message' => 'Your custom message here',
+ 'allowEmpty' => false,
+ //'required' => false,
+ //'last' => false, // Stop validation after this rule
+ //'on' => 'create', // Limit validation to 'create' or 'update' operations
+ ),
+ ),
+ 'display_type' => array(
+ 'inList' => array(
+ 'rule' => array('inList', array(RegistrationsComponent::DISPLAY_TYPE_SINGLE, RegistrationsComponent::DISPLAY_TYPE_LIST)),
+ 'message' => __d('net_commons', 'Invalid request.'),
+ ),
+ ),
+ //'display_num_per_page' => array(
+ // 'inList' => array(
+ // 'rule' => array('inList', array_keys(RegistrationsComponent::getDisplayNumberOptions())),
+ // 'message' => __d('net_commons', 'Invalid request.'),
+ // ),
+ //),
+ //'sort_type' => array(
+ // 'inList' => array(
+ // 'rule' => array('inList', array_keys(RegistrationsComponent::getSortOrders())),
+ // 'message' => __d('net_commons', 'Invalid request.'),
+ // ),
+ //),
+ ));
+
+ parent::beforeValidate($options);
+
+ return true;
+ }
+
+/**
+ * getRegistrationFrameSettingConditions 指定されたframe_keyの設定要件をSQL検索用の配列で取り出す
+ *
+ * @param string $frameKey frame key
+ * @return array ... displayNum sortField sortDirection
+ */
+ public function getRegistrationFrameSettingConditions($frameKey) {
+ list(, $limit, $sort, $dir) = $this->getRegistrationFrameSetting($frameKey);
+ return array(
+ 'offset' => 0,
+ 'limit' => $limit,
+ 'order' => 'Registration.' . $sort . ' ' . $dir);
+ }
+/**
+ * getFrameSetting 指定されたframe_keyの設定要件を取り出す
+ *
+ * @param string $frameKey frame key
+ * @return array ... displayNum sortField sortDirection
+ */
+ public function getRegistrationFrameSetting($frameKey) {
+ $frameSetting = $this->find('first', array(
+ 'conditions' => array(
+ 'frame_key' => $frameKey
+ ),
+ 'recursive' => -1
+ ));
+ // 指定されたフレーム設定が存在しない場合
+ if (! $frameSetting) {
+ // とりあえずデフォルトの表示設定を返す
+ // しかし、表示対象登録フォームが設定されていないわけなので、空っぽの一覧表示となる
+ $frameSetting = $this->getDefaultFrameSetting();
+ }
+
+ $setting = $frameSetting['RegistrationFrameSetting'];
+ $displayType = $setting['display_type'];
+ $displayNum = $setting['display_num_per_page'];
+ if ($setting['sort_type'] == RegistrationsComponent::REGISTRATION_SORT_MODIFIED) {
+ $sort = 'modified';
+ $dir = 'DESC';
+ } elseif ($setting['sort_type'] == RegistrationsComponent::REGISTRATION_SORT_CREATED) {
+ $sort = 'created';
+ $dir = 'ASC';
+ } elseif ($setting['sort_type'] == RegistrationsComponent::REGISTRATION_SORT_TITLE) {
+ $sort = 'title';
+ $dir = 'ASC';
+ } elseif ($setting['sort_type'] == RegistrationsComponent::REGISTRATION_SORT_END) {
+ $sort = 'publish_end';
+ $dir = 'ASC';
+ }
+ return array($displayType, $displayNum, $sort, $dir);
+ }
+
+/**
+ * getDefaultFrameSetting
+ * return default frame setting
+ *
+ * @return array
+ */
+ public function getDefaultFrameSetting() {
+ $frame = array(
+ 'RegistrationFrameSetting' => array(
+ //'id' => '',
+ 'display_type' => RegistrationsComponent::DISPLAY_TYPE_SINGLE,
+ 'display_num_per_page' => RegistrationsComponent::REGISTRATION_DEFAULT_DISPLAY_NUM_PER_PAGE,
+ 'sort_type' => RegistrationsComponent::DISPLAY_SORT_TYPE_NEW_ARRIVALS,
+ 'frame_key' => Current::read('Frame.key'),
+ )
+ );
+ return $frame;
+ }
+
+/**
+ * saveFrameSettings
+ *
+ * @param array $data save data
+ * @return bool
+ * @throws InternalErrorException
+ */
+ public function saveFrameSettings($data) {
+ $this->loadModels([
+ 'RegistrationFrameDisplayRegistration' => 'Registrations.RegistrationFrameDisplayRegistration',
+ ]);
+
+ //トランザクションBegin
+ $this->begin();
+ try {
+ // フレーム設定のバリデート
+ $this->create();
+ $this->set($data);
+ if (! $this->validates()) {
+ return false;
+ }
+
+ // フレームに表示する登録フォーム一覧設定のバリデート
+ // 一覧表示タイプと単独表示タイプ
+ if (isset($data['RegistrationFrameDisplayRegistrations'])) {
+ $ret = $this->RegistrationFrameDisplayRegistration->validateFrameDisplayRegistration($data);
+ if ($ret === false) {
+ return false;
+ }
+ }
+ // フレーム設定の登録
+ if (! $this->save($data, false)) {
+ throw new InternalErrorException(__d('net_commons', 'Internal Server Error'));
+ }
+
+ // フレームに表示する登録フォーム一覧設定の登録
+ // 一覧表示タイプと単独表示タイプ
+ if (isset($data['RegistrationFrameDisplayRegistrations'])) {
+ $ret = $this->RegistrationFrameDisplayRegistration->saveFrameDisplayRegistration($data);
+ if ($ret === false) {
+ throw new InternalErrorException(__d('net_commons', 'Internal Server Error'));
+ }
+ }
+ //トランザクションCommit
+ $this->commit();
+ } catch (Exception $ex) {
+ //トランザクションRollback
+ $this->rollback();
+ CakeLog::error($ex);
+ throw $ex;
+ }
+
+ return true;
+ }
+}
diff --git a/Model/RegistrationPage.php b/Model/RegistrationPage.php
index 15b2aba..994e48f 100644
--- a/Model/RegistrationPage.php
+++ b/Model/RegistrationPage.php
@@ -12,6 +12,7 @@
*/
App::uses('RegistrationsAppModel', 'Registrations.Model');
+App::uses('RegistrationsComponent', 'Registrations.Controller/Component');
/**
* Summary for RegistrationPage Model
@@ -25,15 +26,6 @@ class RegistrationPage extends RegistrationsAppModel {
*/
public $actsAs = array(
'NetCommons.OriginalKey',
- 'M17n.M17n' => array(
- 'associations' => array(
- 'RegistrationQuestion' => array(
- 'class' => 'Registrations.RegistrationQuestion',
- 'foreignKey' => 'registration_page_id',
- ),
- ),
- 'afterCallback' => false,
- ),
);
/**
@@ -43,6 +35,8 @@ class RegistrationPage extends RegistrationsAppModel {
*/
public $validate = array();
+ //The Associations below have been created with all possible keys, those that are not needed can be removed
+
/**
* belongsTo associations
*
@@ -79,82 +73,6 @@ class RegistrationPage extends RegistrationsAppModel {
)
);
-/**
- * Constructor. Binds the model's database table to the object.
- *
- * @param bool|int|string|array $id Set this ID for this model on startup,
- * can also be an array of options, see above.
- * @param string $table Name of database table to use.
- * @param string $ds DataSource connection name.
- * @see Model::__construct()
- * @SuppressWarnings(PHPMD.BooleanArgumentFlag)
- */
- public function __construct($id = false, $table = null, $ds = null) {
- parent::__construct($id, $table, $ds);
-
- $this->loadModels([
- 'RegistrationQuestion' => 'Registrations.RegistrationQuestion',
- ]);
- }
-
-/**
- * Called before each find operation. Return false if you want to halt the find
- * call, otherwise return the (modified) query data.
- *
- * @param array $query Data used to execute this query, i.e. conditions, order, etc.
- * @return mixed true if the operation should continue, false if it should abort; or, modified
- * $query to continue with new $query
- * @link http://book.cakephp.org/2.0/en/models/callback-methods.html#beforefind
- */
- public function beforeFind($query) {
- //hasManyで実行されたとき、多言語の条件追加
- if (! $this->id && isset($query['conditions']['registration_id'])) {
- $registrationId = $query['conditions']['registration_id'];
- $query['conditions']['registration_id'] = $this->getRegistrationIdsForM17n($registrationId);
- $query['conditions']['OR'] = array(
- 'language_id' => Current::read('Language.id'),
- 'is_translation' => false,
- );
-
- return $query;
- }
-
- return parent::beforeFind($query);
- }
-
-/**
- * 多言語データ取得のため、当言語のregistration_idから全言語のregistration_idを取得する
- *
- * @param id $registrationId 当言語のregistration_id
- * @return array
- */
- public function getRegistrationIdsForM17n($registrationId) {
- $registration = $this->Registration->find('first', array(
- 'recursive' => -1,
- 'callbacks' => false,
- 'fields' => array('id', 'key', 'is_active', 'is_latest'),
- 'conditions' => array('id' => $registrationId),
- ));
-
- $conditions = array(
- 'key' => Hash::get($registration, 'Registration.key', '')
- );
- if (Hash::get($registration, 'Registration.is_latest')) {
- $conditions['is_latest'] = true;
- } else {
- $conditions['is_active'] = true;
- }
-
- $registrationIds = $this->Registration->find('list', array(
- 'recursive' => -1,
- 'callbacks' => false,
- 'fields' => array('id', 'id'),
- 'conditions' => $conditions,
- ));
-
- return array_values($registrationIds);
- }
-
/**
* getDefaultPage
* get default data of registration page
@@ -162,6 +80,8 @@ public function getRegistrationIdsForM17n($registrationId) {
* @return array
*/
public function getDefaultPage() {
+ $this->RegistrationQuestion = ClassRegistry::init('Registrations.RegistrationQuestion', true);
+
$page = array(
'page_title' => __d('registrations', 'First Page'),
'page_sequence' => 0,
@@ -184,28 +104,15 @@ public function getDefaultPage() {
* @return array
*/
public function getNextPage($registration, $nowPageSeq, $nowAnswers) {
- // ページ情報がない?終わりにする
- if (!isset($registration['RegistrationPage'])) {
- return false;
- }
// 次ページはデフォルトならば+1です
$nextPageSeq = $nowPageSeq + 1;
-
// 登録にスキップロジックで指定されたものがないかチェックし、行き先があるならそのページ番号を返す
foreach ($nowAnswers as $answer) {
-
- $targetQuestion = Hash::extract(
- $registration['RegistrationPage'],
- '{n}.RegistrationQuestion.{n}[key=' . $answer[0]['registration_question_key'] . ']');
-
+ $targetQuestion = Hash::extract($registration['RegistrationPage'], '{n}.RegistrationQuestion.{n}[key=' . $answer[0]['registration_question_key'] . ']');
if ($targetQuestion) {
$q = $targetQuestion[0];
- // skipロジック対象の項目ならば次ページのチェックを行う
+ // skipロジック対象の質問ならば次ページのチェックを行う
if ($q['is_skip'] == RegistrationsComponent::SKIP_FLAGS_SKIP) {
- if ($answer[0]['answer_value'] == '') {
- // スキップロジックのところで未登録とされたら無条件に次ページとする
- break;
- }
$choiceIds = explode(RegistrationsComponent::ANSWER_VALUE_DELIMITER,
trim($answer[0]['answer_value'], RegistrationsComponent::ANSWER_DELIMITER));
// スキップロジックの選択肢みつけた
@@ -221,13 +128,17 @@ public function getNextPage($registration, $nowPageSeq, $nowAnswers) {
}
}
}
+ // 次ページがもしかして存在しない(つまりエンドかも)
+ if ($nextPageSeq == RegistrationsComponent::SKIP_GO_TO_END) {
+ return false;
+ }
+ // ページ情報がない?終わりにする
+ if (!isset($registration['RegistrationPage'])) {
+ return false;
+ }
// ページ配列はページのシーケンス番号順に取り出されているので
$pages = $registration['RegistrationPage'];
$endPage = end($pages);
-
- // 指定されたページ番号が全体のページ数よりも大きな数
- // 次ページがもしかして存在しない(つまりエンドかも)もこれでフォローされる
- //if ($nextPageSeq == RegistrationsComponent::SKIP_GO_TO_END) {
if ($endPage['page_sequence'] < $nextPageSeq) {
return false;
}
@@ -241,6 +152,7 @@ public function getNextPage($registration, $nowPageSeq, $nowAnswers) {
* @return void
*/
public function setPageToRegistration(&$registration) {
+ $this->RegistrationQuestion = ClassRegistry::init('Registrations.RegistrationQuestion', true);
// ページデータが登録フォームデータの中にない状態でここが呼ばれている場合、
if (!isset($registration['RegistrationPage'])) {
$pages = $this->find('all', array(
@@ -250,8 +162,7 @@ public function setPageToRegistration(&$registration) {
'order' => array('page_sequence ASC'),
'recursive' => -1));
- $registration['RegistrationPage'] = Hash::combine($pages,
- '{n}.RegistrationPage.page_sequence', '{n}.RegistrationPage');
+ $registration['RegistrationPage'] = Hash::combine($pages, '{n}.RegistrationPage.page_sequence', '{n}.RegistrationPage');
}
$registration['Registration']['page_count'] = 0;
if (isset($registration['RegistrationPage'])) {
@@ -297,31 +208,36 @@ public function beforeValidate($options = array()) {
),
),
);
- // validates時にはまだregistration_idの設定ができないのでチェックしないことにする
- // registration_idの設定は上位のRegistrationクラスで責任を持って行われるものとする
+ // ウィザード画面でのセットアップ中の場合はまだ親登録フォームIDの正当性についてのチェックは行わない
+ if (! (isset($options['validate']) && $options['validate'] == RegistrationsComponent::REGISTRATION_VALIDATE_TYPE)) {
+ $this->validate = Hash::merge($this->validate, array(
+ 'registration_id' => array(
+ 'numeric' => array(
+ 'rule' => array('numeric'),
+ //'message' => 'Your custom message here',
+ 'allowEmpty' => false,
+ 'required' => true,
+ ),
+ ),
+ ));
+ }
parent::beforeValidate($options);
- // 付属の項目以下のvalidate
+ // 付属の質問以下のvalidate
if (! isset($this->data['RegistrationQuestion'][0])) {
- $this->validationErrors['page_sequence'][] =
- __d('registrations', 'please set at least one question.');
+ $this->validationErrors['page_sequence'][] = __d('registrations', 'please set at least one question.');
} else {
$validationErrors = array();
+ $this->RegistrationQuestion = ClassRegistry::init('Registrations.RegistrationQuestion', true);
foreach ($this->data['RegistrationQuestion'] as $qIndex => $question) {
- // 項目データバリデータ
+ // 質問データバリデータ
$this->RegistrationQuestion->create();
$this->RegistrationQuestion->set($question);
$options['questionIndex'] = $qIndex;
if (! $this->RegistrationQuestion->validates($options)) {
- $validationErrors['RegistrationQuestion'][$qIndex] =
- $this->RegistrationQuestion->validationErrors;
+ $validationErrors['RegistrationQuestion'][$qIndex] = $this->RegistrationQuestion->validationErrors;
}
-
- $data = $this->RegistrationQuestion->data['RegistrationQuestion'];
- unset($this->RegistrationQuestion->data['RegistrationQuestion']);
- $this->data['RegistrationQuestion'][$qIndex] =
- array_merge($data, $this->RegistrationQuestion->data);
}
$this->validationErrors += $validationErrors;
}
@@ -332,11 +248,10 @@ public function beforeValidate($options = array()) {
* save RegistrationPage data
*
* @param array &$registrationPages registration pages
- * @param array $block ブロック情報
* @throws InternalErrorException
* @return bool
*/
- public function saveRegistrationPage(&$registrationPages, $block) {
+ public function saveRegistrationPage(&$registrationPages) {
$this->loadModels([
'RegistrationQuestion' => 'Registrations.RegistrationQuestion',
]);
@@ -361,7 +276,7 @@ public function saveRegistrationPage(&$registrationPages, $block) {
$page = Hash::insert($page, 'RegistrationQuestion.{n}.registration_page_id', $pageId);
// もしもQuestionやChoiceのsaveがエラーになった場合は、
// QuestionやChoiceのほうでInternalExceptionErrorが発行されるのでここでは何も行わない
- $this->RegistrationQuestion->saveRegistrationQuestion($page['RegistrationQuestion'], $block);
+ $this->RegistrationQuestion->saveRegistrationQuestion($page['RegistrationQuestion']);
}
return true;
}
diff --git a/Model/RegistrationQuestion.php b/Model/RegistrationQuestion.php
index 7bf882a..7c9abce 100644
--- a/Model/RegistrationQuestion.php
+++ b/Model/RegistrationQuestion.php
@@ -12,6 +12,7 @@
*/
App::uses('RegistrationsAppModel', 'Registrations.Model');
+App::uses('RegistrationsComponent', 'Registrations.Controller/Component');
/**
* Summary for RegistrationQuestion Model
@@ -25,35 +26,6 @@ class RegistrationQuestion extends RegistrationsAppModel {
*/
public $actsAs = array(
'NetCommons.OriginalKey',
- 'Wysiwyg.Wysiwyg' => array(
- 'fields' => array('description')
- ),
- //多言語
- 'M17n.M17n' => array(
- 'commonFields' => array(
- 'question_sequence',
- 'question_type',
- 'is_require',
- 'question_type_option',
- 'is_choice_random',
- 'is_choice_horizon',
- 'is_skip',
- 'is_jump',
- 'is_range',
- 'min',
- 'max',
- 'is_result_display',
- 'result_display_type',
- ),
- 'associations' => array(
- 'RegistrationChoice' => array(
- 'class' => 'Registrations.RegistrationChoice',
- 'foreignKey' => 'registration_question_id',
- 'isM17n' => true,
- ),
- ),
- 'afterCallback' => false,
- ),
);
/**
@@ -101,78 +73,6 @@ class RegistrationQuestion extends RegistrationsAppModel {
)
);
-/**
- * Constructor. Binds the model's database table to the object.
- *
- * @param bool|int|string|array $id Set this ID for this model on startup,
- * can also be an array of options, see above.
- * @param string $table Name of database table to use.
- * @param string $ds DataSource connection name.
- * @see Model::__construct()
- * @SuppressWarnings(PHPMD.BooleanArgumentFlag)
- */
- public function __construct($id = false, $table = null, $ds = null) {
- parent::__construct($id, $table, $ds);
-
- $this->loadModels([
- 'RegistrationChoice' => 'Registrations.RegistrationChoice',
- ]);
- }
-
-/**
- * Called before each find operation. Return false if you want to halt the find
- * call, otherwise return the (modified) query data.
- *
- * @param array $query Data used to execute this query, i.e. conditions, order, etc.
- * @return mixed true if the operation should continue, false if it should abort; or, modified
- * $query to continue with new $query
- * @link http://book.cakephp.org/2.0/en/models/callback-methods.html#beforefind
- */
- public function beforeFind($query) {
- //hasManyで実行されたとき、多言語の条件追加
- if (! $this->id && isset($query['conditions']['registration_page_id'])) {
- $registrationPageId = $query['conditions']['registration_page_id'];
- $query['conditions']['registration_page_id'] =
- $this->getRegistrationPageIdsForM17n($registrationPageId);
- $query['conditions']['OR'] = array(
- 'RegistrationQuestion.language_id' => Current::read('Language.id'),
- 'RegistrationQuestion.is_translation' => false,
- );
-
- return $query;
- }
-
- return parent::beforeFind($query);
- }
-
-/**
- * 多言語データ取得のため、当言語のregistration_page_idから全言語のregistration_page_idを取得する
- *
- * @param id $registrationPageId 当言語のregistration_page_id
- * @return array
- */
- public function getRegistrationPageIdsForM17n($registrationPageId) {
- $registrationPage = $this->RegistrationPage->find('first', array(
- 'recursive' => -1,
- 'callbacks' => false,
- 'fields' => array('id', 'key', 'registration_id'),
- 'conditions' => array('id' => $registrationPageId),
- ));
-
- $registrationId = $registrationPage['RegistrationPage']['registration_id'];
- $registrationPageIds = $this->RegistrationPage->find('list', array(
- 'recursive' => -1,
- 'callbacks' => false,
- 'fields' => array('id', 'id'),
- 'conditions' => array(
- 'registration_id' => $this->RegistrationPage->getRegistrationIdsForM17n($registrationId),
- 'key' => $registrationPage['RegistrationPage']['key']
- ),
- ));
-
- return array_values($registrationPageIds);
- }
-
/**
* Called during validation operations, before validation. Please note that custom
* validation rules can be defined in $validate.
@@ -230,10 +130,7 @@ public function beforeValidate($options = array()) {
),
'is_result_display' => array(
'inList' => array(
- 'rule' => array(
- 'inList',
- $this->_getResultDisplayList($this->data['RegistrationQuestion']['question_type'])
- ),
+ 'rule' => array('inList', $this->_getResultDisplayList($this->data['RegistrationQuestion']['question_type'])),
'message' => __d('net_commons', 'Invalid request.'),
),
),
@@ -250,9 +147,9 @@ public function beforeValidate($options = array()) {
),
),
);
- // 範囲制限設定された項目の場合
+ // 範囲制限設定された質問の場合
if ($this->data['RegistrationQuestion']['is_range'] == true) {
- $this->validate = ValidateMerge::merge($this->validate, array(
+ $this->validate = Hash::merge($this->validate, array(
'min' => array(
'notBlank' => array(
'rule' => array('notBlank'),
@@ -276,25 +173,34 @@ public function beforeValidate($options = array()) {
));
}
- // validates時にはまだregistration_page_idの設定ができないのでチェックしないことにする
- // registration_page_idの設定は上位のRegistrationPageクラスで責任を持って行われるものとする
+ // ウィザード画面でのセットアップ中の場合はまだ親ページIDの正当性についてのチェックは行わない
+ if (!(isset($options['validate']) && $options['validate'] == RegistrationsComponent::REGISTRATION_VALIDATE_TYPE)) {
+ $this->validate = Hash::merge($this->validate, array(
+ 'registration_page_id' => array(
+ 'numeric' => array(
+ 'rule' => array('numeric'),
+ 'message' => __d('net_commons', 'Invalid request.'),
+ ),
+ ),
+ ));
+ }
parent::beforeValidate($options);
$isSkip = $this->data['RegistrationQuestion']['is_skip'];
// 付属の選択肢以下のvalidate
if ($this->_checkChoiceExists() && isset($this->data['RegistrationChoice'])) {
- // この項目種別に必要な選択肢データがちゃんとあるなら選択肢をバリデート
+ // この質問種別に必要な選択肢データがちゃんとあるなら選択肢をバリデート
$validationErrors = array();
+ $this->RegistrationChoice = ClassRegistry::init('Registrations.RegistrationChoice', true);
foreach ($this->data['RegistrationChoice'] as $cIndex => $choice) {
- // 項目データバリデータ
+ // 質問データバリデータ
$this->RegistrationChoice->create();
$this->RegistrationChoice->set($choice);
$options['choiceIndex'] = $cIndex;
$options['isSkip'] = $isSkip;
if (!$this->RegistrationChoice->validates($options)) {
- $validationErrors['RegistrationChoice'][$cIndex] =
- $this->RegistrationChoice->validationErrors;
+ $validationErrors['RegistrationChoice'][$cIndex] = $this->RegistrationChoice->validationErrors;
}
}
$this->validationErrors += $validationErrors;
@@ -310,6 +216,7 @@ public function beforeValidate($options = array()) {
* @return array
*/
public function getDefaultQuestion() {
+ $this->RegistrationChoice = ClassRegistry::init('Registrations.RegistrationChoice', true);
$question = array(
'question_sequence' => 0,
'question_value' => __d('registrations', 'New Question') . '1',
@@ -360,11 +267,10 @@ public function setQuestionToPage(&$registration, &$page) {
* save RegistrationQuestion data
*
* @param array &$questions registration questions
- * @param array $block ブロック情報
* @throws InternalErrorException
* @return bool
*/
- public function saveRegistrationQuestion(&$questions, $block) {
+ public function saveRegistrationQuestion(&$questions) {
$this->loadModels([
'RegistrationChoice' => 'Registrations.RegistrationChoice',
]);
@@ -374,35 +280,20 @@ public function saveRegistrationQuestion(&$questions, $block) {
// 決まり処理は上位で行われる
// ここでは行わない
- // ブロック情報の準備
- // ここで準備したブロック情報は、saveに含まれ、
- // WysiwygBehaviorのafterSaveでblock_keyが設定される
- $block = [
- 'Block' => $block
- ];
-
foreach ($questions as &$question) {
// 登録フォームは履歴を取っていくタイプのコンテンツデータなのでSave前にはID項目はカット
// (そうしないと既存レコードのUPDATEになってしまうから)
$question = Hash::remove($question, 'RegistrationQuestion.id');
- // WysiwygBehaviorのafterSaveでblock_keyを参照できるように
- // RegistrationQuestionとBlockは同一次元に配置する
- $questionForSave = [
- $this->alias => $question
- ];
- $questionForSave = array_merge($questionForSave, $block);
$this->create();
- if (! $this->save($questionForSave, false)) {
+ if (! $this->save($question, false)) {
throw new InternalErrorException(__d('net_commons', 'Internal Server Error'));
}
$questionId = $this->id;
if (isset($question['RegistrationChoice'])) {
- $question = Hash::insert(
- $question,
- 'RegistrationChoice.{n}.registration_question_id', $questionId);
+ $question = Hash::insert($question, 'RegistrationChoice.{n}.registration_question_id', $questionId);
// もしもChoiceのsaveがエラーになった場合は、
// ChoiceのほうでInternalExceptionErrorが発行されるのでここでは何も行わない
$this->RegistrationChoice->saveRegistrationChoice($question['RegistrationChoice']);
@@ -419,32 +310,25 @@ public function saveRegistrationQuestion(&$questions, $block) {
* @return bool
*/
protected function _checkChoiceExists() {
- $questionType = $this->data['RegistrationQuestion']['question_type'];
// テキストタイプ、テキストエリアタイプの時は選択肢不要
- if (RegistrationsComponent::isOnlyInputType($questionType)) {
+ if (RegistrationsComponent::isOnlyInputType($this->data['RegistrationQuestion']['question_type'])) {
return true;
}
// 上記以外の場合は最低1つは必要
if (! Hash::check($this->data, 'RegistrationChoice.{n}')) {
- $this->validationErrors['question_type'][] =
- __d('registrations', 'please set at least one choice.');
+ $this->validationErrors['question_type'][] = __d('registrations', 'please set at least one choice.');
return false;
}
// マトリクスタイプの時は行に1つ列に一つ必要
// マトリクスタイプのときは、行、カラムの両方ともに最低一つは必要
- if (RegistrationsComponent::isMatrixInputType($questionType)) {
- $rows = Hash::extract(
- $this->data['RegistrationChoice'],
- '{n}[matrix_type=' . RegistrationsComponent::MATRIX_TYPE_ROW_OR_NO_MATRIX . ']');
- $cols = Hash::extract(
- $this->data['RegistrationChoice'],
- '{n}[matrix_type=' . RegistrationsComponent::MATRIX_TYPE_COLUMN . ']');
+ if (RegistrationsComponent::isMatrixInputType($this->data['RegistrationQuestion']['question_type'])) {
+ $rows = Hash::extract($this->data['RegistrationChoice'], '{n}[matrix_type=' . RegistrationsComponent::MATRIX_TYPE_ROW_OR_NO_MATRIX . ']');
+ $cols = Hash::extract($this->data['RegistrationChoice'], '{n}[matrix_type=' . RegistrationsComponent::MATRIX_TYPE_COLUMN . ']');
if (empty($rows) || empty($cols)) {
- $this->validationErrors['question_type'][] =
- __d('registrations', 'please set at least one choice at row and column.');
+ $this->validationErrors['question_type'][] = __d('registrations', 'please set at least one choice at row and column.');
return false;
}
}
@@ -453,9 +337,9 @@ protected function _checkChoiceExists() {
/**
* _getResultDisplayList
- * 項目種別に応じて許されるisResultDisplayの設定値
+ * 質問種別に応じて許されるisResultDisplayの設定値
*
- * @param int $questionType 項目種別
+ * @param int $questionType 質問種別
* @return array
*/
protected function _getResultDisplayList($questionType) {
@@ -464,42 +348,4 @@ protected function _getResultDisplayList($questionType) {
}
return array(RegistrationsComponent::USES_USE, RegistrationsComponent::USES_NOT_USE);
}
-
-/**
- * getAliveCondition
- * 現在使用中状態であるか判断する。CleanUpプラグインで使用
- *
- * @param array $key 判断対象のデータのキー
- * @return array
- */
- public function getAliveCondition($key) {
- return array(
- 'conditions' => array(
- 'RegistrationQuestion.key' => $key,
- 'OR' => array(
- 'Registration.is_active' => true,
- 'Registration.is_latest' => true,
- ),
- ),
- 'joins' => array(
- array(
- 'table' => 'registration_pages',
- 'alias' => 'RegistrationPage',
- 'type' => 'INNER',
- 'conditions' => array(
- $this->alias . '.registration_page_id = RegistrationPage.id'
- )
- ),
- array(
- 'table' => 'registrations',
- 'alias' => 'Registration',
- 'type' => 'INNER',
- 'conditions' => array(
- 'RegistrationPage.registration_id = Registration.id'
- )
- )
- )
- );
- }
-
-}
+}
\ No newline at end of file
diff --git a/Model/RegistrationSetting.php b/Model/RegistrationSetting.php
index 090ff72..14e6c1a 100644
--- a/Model/RegistrationSetting.php
+++ b/Model/RegistrationSetting.php
@@ -10,20 +10,30 @@
* @license http://www.netcommons.org/license.txt NetCommons License
*/
-App::uses('BlockSettingBehavior', 'Blocks.Model/Behavior');
-App::uses('BlockBaseModel', 'Blocks.Model');
+App::uses('RegistrationsAppModel', 'Registrations.Model');
/**
* Summary for RegistrationBlocksSetting Model
*/
-class RegistrationSetting extends BlockBaseModel {
+class RegistrationSetting extends RegistrationsAppModel {
/**
- * Custom database table name
+ * Validation rules
*
- * @var string
+ * @var array
*/
- public $useTable = false;
+ public $validate = array(
+ 'block_id' => array(
+ 'numeric' => array(
+ 'rule' => array('numeric'),
+ //'message' => 'Your custom message here',
+ //'allowEmpty' => false,
+ //'required' => false,
+ //'last' => false, // Stop validation after this rule
+ //'on' => 'create', // Limit validation to 'create' or 'update' operations
+ ),
+ ),
+ );
/**
* use behaviors
@@ -32,38 +42,31 @@ class RegistrationSetting extends BlockBaseModel {
*/
public $actsAs = array(
'Blocks.BlockRolePermission',
- 'Blocks.BlockSetting' => array(
- BlockSettingBehavior::FIELD_USE_WORKFLOW,
- ),
);
-/**
- * Constructor. Binds the model's database table to the object.
- *
- * @param bool|int|string|array $id Set this ID for this model on startup,
- * can also be an array of options, see above.
- * @param string $table Name of database table to use.
- * @param string $ds DataSource connection name.
- * @see Model::__construct()
- * @SuppressWarnings(PHPMD.BooleanArgumentFlag)
- */
- public function __construct($id = false, $table = null, $ds = null) {
- parent::__construct($id, $table, $ds);
-
- $this->loadModels([
- 'Frame' => 'Frames.Frame',
- 'Block' => 'Blocks.Block',
- ]);
- }
-
/**
* getSetting
*
- * @return array RegistrationBlockSetting data
+ * @return mix RegistrationBlockSetting data
*/
public function getSetting() {
+ $this->Block = ClassRegistry::init('Blocks.Block', true);
$blockSetting = $this->Block->find('all', array(
'recursive' => -1,
+ 'fields' => array(
+ $this->Block->alias . '.*',
+ $this->alias . '.*',
+ ),
+ 'joins' => array(
+ array(
+ 'table' => $this->table,
+ 'alias' => $this->alias,
+ 'type' => 'LEFT',
+ 'conditions' => array(
+ $this->Block->alias . '.key' . ' = ' . $this->alias . ' .block_key',
+ ),
+ ),
+ ),
'conditions' => array(
'Block.id' => Current::read('Block.id')
),
@@ -71,9 +74,8 @@ public function getSetting() {
if (! $blockSetting) {
return $blockSetting;
}
- return Hash::merge($blockSetting[0], $this->getBlockSetting());
+ return $blockSetting[0];
}
-
/**
* Save registration settings
*
@@ -85,20 +87,6 @@ public function saveRegistrationSetting($data) {
//トランザクションBegin
$this->begin();
- // idが未設定の場合は、指定されたblock_keyを頼りに既存レコードがないか調査
- //$existRecord = $this->find('first', array(
- // 'recursive' => -1,
- // 'fields' => 'id',
- // 'conditions' => array(
- // 'block_key' => $data['RegistrationSetting']['block_key'],
- // )
- //));
- //$data = Hash::merge($existRecord, $data);
- //$data = Hash::remove($data, 'RegistrationSetting.created_user');
- //$data = Hash::remove($data, 'RegistrationSetting.created');
- //$data = Hash::remove($data, 'RegistrationSetting.modified_user');
- //$data = Hash::remove($data, 'RegistrationSetting.modified');
-
//バリデーション
$this->set($data);
if (! $this->validates()) {
@@ -107,94 +95,18 @@ public function saveRegistrationSetting($data) {
}
try {
- $this->save($data, false);
+ if (! $this->save(null, false)) {
+ throw new InternalErrorException(__d('net_commons', 'Internal Server Error'));
+ }
//トランザクションCommit
$this->commit();
} catch (Exception $ex) {
//トランザクションRollback
- $this->rollback();
- throw $ex;
- }
- return true;
- }
-
-/**
- * save block
- *
- * afterFrameSaveやsaveRegistrationから呼び出される
- *
- * @param array $frame frame data
- * @return bool
- * @throws InternalErrorException
- */
- public function saveBlock($frame) {
- // すでに結びついている場合はBlockは作らないでよい
- //var_dump(debug_backtrace());exit();
- // フレームにブロックが配置されてても新規にブロックを作成したいのでコメントアウト byRyujiAMANO
- //if (! empty($frame['Frame']['block_id'])) {
- // return true;
- //}
- //トランザクションBegin
- $this->begin();
-
- try {
- // ルームに存在するブロックを探す。登録フォームは常に新規ブロックとする
- //$block = $this->Block->find('first', array(
- // 'conditions' => array(
- // 'Block.room_id' => $frame['Frame']['room_id'],
- // 'Block.plugin_key' => $frame['Frame']['plugin_key'],
- // 'Block.language_id' => $frame['Frame']['language_id'],
- // )
- //));
- // まだない場合
- //if (empty($block)) {
- // 作成する
- $block = $this->Block->save(array(
- 'room_id' => $frame['Frame']['room_id'],
- //'language_id' => $frame['Frame']['language_id'],
- 'plugin_key' => $frame['Frame']['plugin_key'],
- ));
- if (!$block) {
- throw new InternalErrorException(__d('net_commons', 'Internal Server Error'));
- }
- Current::$current['Block'] = $block['Block'];
- //}
-
- // フレームは更新しない
- //$frame['Frame']['block_id'] = $block['Block']['id'];
- //if (!$this->Frame->save($frame)) {
- // throw new InternalErrorException(__d('net_commons', 'Internal Server Error'));
- //}
- //Current::$current['Frame']['block_id'] = $block['Block']['id'];
-
- $this->commit();
- } catch (Exception $ex) {
- //トランザクションRollback
- $this->rollback();
- CakeLog::error($ex);
- throw $ex;
+ $this->rollback($ex);
}
return true;
}
-/**
- * save setting
- *
- * afterFrameSaveやsaveQuestionnaireから呼び出される
- *
- * @return bool
- * @throws InternalErrorException
- */
- public function saveSetting() {
- // block settingはあるか
- if ($this->isExsistBlockSetting()) {
- return true;
- }
- // ないときは作る
- $blockSetting = $this->createBlockSetting();
- $ret = $this->saveRegistrationSetting($blockSetting);
- return $ret;
- }
}
diff --git a/Model/RegistrationsAppModel.php b/Model/RegistrationsAppModel.php
index 43bf00c..63a86a2 100644
--- a/Model/RegistrationsAppModel.php
+++ b/Model/RegistrationsAppModel.php
@@ -12,8 +12,6 @@
*/
App::uses('AppModel', 'Model');
-App::uses('Current', 'NetCommons.Utility');
-App::uses('RegistrationsComponent', 'Registrations.Controller/Component');
/**
* Summary for RegistrationQuestion Model
@@ -27,4 +25,20 @@ class RegistrationsAppModel extends AppModel {
*/
public $actsAs = array(
);
+
+/**
+ * Called during validation operations, before validation. Please note that custom
+ * validation rules can be defined in $validate.
+ *
+ * @param array $options Options passed from Model::save().
+ * @return bool True if validate operation should continue, false to abort
+ * @link http://book.cakephp.org/2.0/en/models/callback-methods.html#beforevalidate
+ * @see Model::save()
+ */
+ public function beforeValidate($options = array()) {
+ // この継承クラスたちがValidateロジックを走らせる前に必ずDBを切り替える
+ $this->setDataSource('master');
+ return parent::beforeValidate($options);
+ }
+
}
diff --git a/README.md b/README.md
index eb514a2..f4c2c84 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,12 @@
Registrations
==============
-[](https://github.com/NetCommons3/Registrations/actions/workflows/tests.yml)
-[](https://coveralls.io/r/NetCommons3/Registrations?branch=master)
-[](https://packagist.org/packages/netcommons/registrations)
+Registrations for NetComomns3
+
+[](https://travis-ci.org/NetCommons3/Registrations)
+[](https://coveralls.io/r/NetCommons3/Registrations?branch=master)
+
+| dependencies | status |
+| ------------- | ------ |
+| composer.json | [](https://www.versioneye.com/user/projects/57060992fcd19a005185453d) |
+| bower.json | [](https://www.versioneye.com/user/projects/5706098efcd19a00415b0501) |
\ No newline at end of file
diff --git a/Test/Case/AllRegistrationsTest.php b/Test/Case/AllRegistrationsTest.php
index 2f45fd7..19dc284 100644
--- a/Test/Case/AllRegistrationsTest.php
+++ b/Test/Case/AllRegistrationsTest.php
@@ -8,8 +8,6 @@
* @copyright Copyright 2014, NetCommons Project
*/
-App::uses('NetCommonsTestSuite', 'NetCommons.TestSuite');
-
/**
* Registrations All Test Suite
*
@@ -17,7 +15,7 @@
* @package NetCommons\Announcements\Test\Case
* @codeCoverageIgnore
*/
-class AllRegistrationsTest extends NetCommonsTestSuite {
+class AllRegistrationsTest extends CakeTestSuite {
/**
* All test suite
@@ -26,19 +24,8 @@ class AllRegistrationsTest extends NetCommonsTestSuite {
*/
public static function suite() {
$plugin = preg_replace('/^All([\w]+)Test$/', '$1', __CLASS__);
- $suite = new NetCommonsTestSuite(sprintf('All %s Plugin tests', $plugin));
+ $suite = new CakeTestSuite(sprintf('All %s Plugin tests', $plugin));
$suite->addTestDirectoryRecursive(CakePlugin::path($plugin) . 'Test' . DS . 'Case');
- // モデルだけ
- //$suite->addTestDirectoryRecursive(
- // CakePlugin::path($plugin) . 'Test' . DS . 'Case' . DS . 'Model'
- //);
- //// View
- //$suite->addTestDirectoryRecursive(
- // CakePlugin::path($plugin) . 'Test' . DS . 'Case' . DS . 'View'
- //);
- //$suite->addTestDirectoryRecursive(
- // CakePlugin::path($plugin) . 'Test' . DS . 'Case' . DS . 'Controller' . DS . 'Component'
- //);
return $suite;
}
}
diff --git a/Test/Case/Controller/Component/RegistrationOwnAnswerComponent/GetConfirmSummaryOfThisUserTest.php b/Test/Case/Controller/Component/RegistrationOwnAnswerComponent/GetConfirmSummaryOfThisUserTest.php
deleted file mode 100644
index edb2901..0000000
--- a/Test/Case/Controller/Component/RegistrationOwnAnswerComponent/GetConfirmSummaryOfThisUserTest.php
+++ /dev/null
@@ -1,152 +0,0 @@
-
- * @author Allcreator
- * @link http://www.netcommons.org NetCommons Project
- * @license http://www.netcommons.org/license.txt NetCommons License
- * @copyright Copyright 2014, NetCommons Project
- */
-
-App::uses('NetCommonsControllerTestCase', 'NetCommons.TestSuite');
-
-/**
- * RegistrationOwnAnswerComponent::getConfirmSummaryOfThisUser()のテスト
- *
- * @author Allcreator
- * @package NetCommons\Registrations\Test\Case\Controller\Component\RegistrationOwnAnswerComponent
- */
-class RegistrationOwnAnswerComponentGetConfirmSummaryOfThisUserTest
- extends NetCommonsControllerTestCase {
-
-/**
- * Fixtures
- *
- * @var array
- */
- public $fixtures = array(
- 'plugin.registrations.registration',
- 'plugin.registrations.block_setting_for_registration',
- 'plugin.registrations.registration_page',
- 'plugin.registrations.registration_question',
- 'plugin.registrations.registration_choice',
- 'plugin.registrations.registration_answer_summary',
- 'plugin.registrations.registration_answer',
- 'plugin.authorization_keys.authorization_keys',
- );
-
-/**
- * Plugin name
- *
- * @var string
- */
- public $plugin = 'registrations';
-
-/**
- * setUp method
- *
- * @return void
- */
- public function setUp() {
- parent::setUp();
-
- //テストプラグインのロード
- NetCommonsCakeTestCase::loadTestPlugin($this, 'Registrations', 'TestRegistrations');
- }
-
-/**
- * tearDown method
- *
- * @return void
- */
- public function tearDown() {
- //ログアウト
- TestAuthGeneral::logout($this);
-
- parent::tearDown();
- }
-
-/**
- * getConfirmSummaryOfThisUser()のテスト
- *
- * @return void
- */
- public function testGetConfirmSummaryOfThisUser() {
- //テストコントローラ生成
- $this->generateNc('TestRegistrations.TestRegistrationsOwnAnswerComponent');
-
- //ログイン
- TestAuthGeneral::login($this, Role::ROOM_ROLE_KEY_ROOM_ADMINISTRATOR);
-
- //テスト実行
- $this->_testGetAction(
- '/test_registrations/test_registration_own_answer_component/index',
- array('method' => 'assertNotEmpty'),
- null,
- 'view');
-
- $result = $this->controller->RegistrationsOwnAnswer->getConfirmSummaryOfThisUser(
- 'registration_12');
-
- //チェック
- $this->assertEqual($result['RegistrationAnswerSummary']['id'], 2);
-
- //ログアウト
- TestAuthGeneral::logout($this);
- }
-
-/**
- * getConfirmSummaryOfThisUser()のテスト
- *
- * @return void
- */
- public function testGetConfirmSummaryOfThisUserNoLoginNoAnswer() {
- //テストコントローラ生成
- $this->generateNc('TestRegistrations.TestRegistrationsOwnAnswerComponent');
-
- //テスト実行
- $this->_testGetAction(
- '/test_registrations/test_registration_own_answer_component/index',
- array('method' => 'assertNotEmpty'),
- null,
- 'view');
-
- $result = $this->controller->RegistrationsOwnAnswer->getConfirmSummaryOfThisUser(
- 'registration_6');
-
- //チェック
- $this->assertFalse($result);
- }
-
-/**
- * getConfirmSummaryOfThisUser()のテスト
- *
- * @return void
- */
- public function testGetConfirmSummaryOfThisUserNoLogin() {
- //テストコントローラ生成
- $this->generateNc('TestRegistrations.TestRegistrationsOwnAnswerComponent');
-
- $this->controller->Session->expects($this->any())
- ->method('read')
- ->will(
- $this->returnValueMap([
- ['Registrations.progressiveSummary.registration_12', 2]
- ]));
-
- //テスト実行
- $this->_testGetAction(
- '/test_registrations/test_registration_own_answer_component/index',
- array('method' => 'assertNotEmpty'),
- null,
- 'view');
-
- $result = $this->controller->RegistrationsOwnAnswer->getConfirmSummaryOfThisUser(
- 'registration_12');
-
- //チェック
- $this->assertEqual($result['RegistrationAnswerSummary']['id'], 2);
- }
-
-}
diff --git a/Test/Case/Controller/Component/RegistrationOwnAnswerComponent/GetOwnAnsweredKeysTest.php b/Test/Case/Controller/Component/RegistrationOwnAnswerComponent/GetOwnAnsweredKeysTest.php
deleted file mode 100644
index 565a5e7..0000000
--- a/Test/Case/Controller/Component/RegistrationOwnAnswerComponent/GetOwnAnsweredKeysTest.php
+++ /dev/null
@@ -1,134 +0,0 @@
-
- * @author Allcreator
- * @link http://www.netcommons.org NetCommons Project
- * @license http://www.netcommons.org/license.txt NetCommons License
- * @copyright Copyright 2014, NetCommons Project
- */
-
-App::uses('NetCommonsControllerTestCase', 'NetCommons.TestSuite');
-
-/**
- * RegistrationOwnAnswerComponent::getOwnAnsweredKeys()のテスト
- *
- * @author Allcreator
- * @package NetCommons\Registrations\Test\Case\Controller\Component\RegistrationOwnAnswerComponent
- */
-class RegistrationOwnAnswerComponentGetOwnAnsweredKeysTest extends NetCommonsControllerTestCase {
-
-/**
- * Fixtures
- *
- * @var array
- */
- public $fixtures = array(
- 'plugin.registrations.registration',
- 'plugin.registrations.block_setting_for_registration',
- 'plugin.registrations.registration_page',
- 'plugin.registrations.registration_question',
- 'plugin.registrations.registration_choice',
- 'plugin.registrations.registration_answer_summary',
- 'plugin.registrations.registration_answer',
- 'plugin.authorization_keys.authorization_keys',
- );
-
-/**
- * Plugin name
- *
- * @var string
- */
- public $plugin = 'registrations';
-
-/**
- * setUp method
- *
- * @return void
- */
- public function setUp() {
- parent::setUp();
-
- //テストプラグインのロード
- NetCommonsCakeTestCase::loadTestPlugin($this, 'Registrations', 'TestRegistrations');
- }
-
-/**
- * tearDown method
- *
- * @return void
- */
- public function tearDown() {
- //ログアウト
- TestAuthGeneral::logout($this);
-
- parent::tearDown();
- }
-
-/**
- * getOwnAnswerKeys()のテスト
- *
- * @return void
- */
- public function testGetOwnAnswerKeys() {
- //テストコントローラ生成
- $this->generateNc('TestRegistrations.TestRegistrationsOwnAnswerComponent');
-
- //ログイン
- TestAuthGeneral::login($this, Role::ROOM_ROLE_KEY_ROOM_ADMINISTRATOR);
-
- //テスト実行
- $this->_testGetAction(
- '/test_registrations/test_registration_own_answer_component/index',
- array('method' => 'assertNotEmpty'),
- null,
- 'view');
-
- $result = $this->controller->RegistrationsOwnAnswer->getOwnAnsweredKeys();
-
- //チェック
- $this->assertEqual($result, array(
- 'registration_20',
- 'registration_22',
- 'registration_24',
- 'registration_4',
- ));
- //ログアウト
- TestAuthGeneral::logout($this);
- }
-
-/**
- * getOwnAnswerKeys()のテスト
- *
- * @return void
- */
- public function testGetOwnAnswerKeysNoLogin() {
- //テストコントローラ生成
- $this->generateNc('TestRegistrations.TestRegistrationsOwnAnswerComponent');
-
- $blockId = Current::read('Block.id');
- $this->controller->Session->expects($this->any())
- ->method('read')
- ->will(
- $this->returnValueMap([
- ['Registrations.ownAnsweredKeys.' . $blockId,
- 'registration_99,registration_100']
- ]));
-
- //テスト実行
- $this->_testGetAction(
- '/test_registrations/test_registration_own_answer_component/index',
- array('method' => 'assertNotEmpty'),
- null,
- 'view');
-
- $result = $this->controller->RegistrationsOwnAnswer->getOwnAnsweredKeys();
-
- //チェック
- $this->assertEqual($result, array(
- 'registration_99',
- 'registration_100'
- ));
- }
-}
diff --git a/Test/Case/Controller/Component/RegistrationOwnAnswerComponent/GetProgressiveSummaryOfThisUserTest.php b/Test/Case/Controller/Component/RegistrationOwnAnswerComponent/GetProgressiveSummaryOfThisUserTest.php
deleted file mode 100644
index e6bfb7a..0000000
--- a/Test/Case/Controller/Component/RegistrationOwnAnswerComponent/GetProgressiveSummaryOfThisUserTest.php
+++ /dev/null
@@ -1,155 +0,0 @@
-
- * @author Allcreator
- * @link http://www.netcommons.org NetCommons Project
- * @license http://www.netcommons.org/license.txt NetCommons License
- * @copyright Copyright 2014, NetCommons Project
- */
-
-App::uses('NetCommonsControllerTestCase', 'NetCommons.TestSuite');
-
-/**
- * RegistrationOwnAnswerComponent::getProgressiveSummaryOfThisUser()のテスト
- *
- * @author Allcreator
- * @package NetCommons\Registrations\Test\Case\Controller\Component\RegistrationOwnAnswerComponent
- */
-class RegistrationOwnAnswerComponentGetProgressiveSummaryOfThisUserTest
- extends NetCommonsControllerTestCase {
-
-/**
- * Fixtures
- *
- * @var array
- */
- public $fixtures = array(
- 'plugin.registrations.registration',
- 'plugin.registrations.block_setting_for_registration',
- 'plugin.registrations.registration_page',
- 'plugin.registrations.registration_question',
- 'plugin.registrations.registration_choice',
- 'plugin.registrations.registration_answer_summary',
- 'plugin.registrations.registration_answer',
- 'plugin.authorization_keys.authorization_keys',
- );
-
-/**
- * Plugin name
- *
- * @var string
- */
- public $plugin = 'registrations';
-
-/**
- * setUp method
- *
- * @return void
- */
- public function setUp() {
- parent::setUp();
-
- //テストプラグインのロード
- NetCommonsCakeTestCase::loadTestPlugin($this, 'Registrations', 'TestRegistrations');
- }
-
-/**
- * tearDown method
- *
- * @return void
- */
- public function tearDown() {
- //ログアウト
- TestAuthGeneral::logout($this);
-
- parent::tearDown();
- }
-
-/**
- * getProgressiveSummaryOfThisUser()のテスト
- *
- * @return void
- */
- public function testGetProgressiveSummaryOfThisUser() {
- //テストコントローラ生成
- $this->generateNc('TestRegistrations.TestRegistrationsOwnAnswerComponent');
-
- //ログイン
- TestAuthGeneral::login($this, Role::ROOM_ROLE_KEY_EDITOR);
-
- //事前チェック
- //$this->assertEmpty($this->controller->Registrations->controller);
-
- //テスト実行
- $this->_testGetAction(
- '/test_registrations/test_registration_own_answer_component/index',
- array('method' => 'assertNotEmpty'),
- null,
- 'view');
-
- $result = $this->controller->RegistrationsOwnAnswer->getProgressiveSummaryOfThisUser(
- 'registration_6');
-
- //チェック
- $this->assertEqual($result['RegistrationAnswerSummary']['id'], 5);
-
- //ログアウト
- TestAuthGeneral::logout($this);
- }
-
-/**
- * getProgressiveSummaryOfThisUser()のテスト
- *
- * @return void
- */
- public function testGetProgressiveSummaryOfThisUserNoLoginNoAnswer() {
- //テストコントローラ生成
- $this->generateNc('TestRegistrations.TestRegistrationsOwnAnswerComponent');
-
- //テスト実行
- $this->_testGetAction(
- '/test_registrations/test_registration_own_answer_component/index',
- array('method' => 'assertNotEmpty'),
- null,
- 'view');
-
- $result = $this->controller->RegistrationsOwnAnswer->getProgressiveSummaryOfThisUser(
- 'registration_6');
-
- //チェック
- $this->assertFalse($result);
- }
-
-/**
- * getProgressiveSummaryOfThisUser()のテスト
- *
- * @return void
- */
- public function testGetProgressiveSummaryOfThisUserNoLogin() {
- //テストコントローラ生成
- $this->generateNc('TestRegistrations.TestRegistrationsOwnAnswerComponent');
-
- $this->controller->Session->expects($this->any())
- ->method('read')
- ->will(
- $this->returnValueMap([
- ['Registrations.progressiveSummary.registration_12', 12]
- ]));
-
- //テスト実行
- $this->_testGetAction(
- '/test_registrations/test_registration_own_answer_component/index',
- array('method' => 'assertNotEmpty'),
- null,
- 'view');
-
- $result = $this->controller->RegistrationsOwnAnswer->getProgressiveSummaryOfThisUser(
- 'registration_12');
-
- //チェック
- $this->assertEmpty($result);
- }
-
-}
diff --git a/Test/Case/Controller/Component/RegistrationOwnAnswerComponent/SaveOwnAnsweredKeysTest.php b/Test/Case/Controller/Component/RegistrationOwnAnswerComponent/SaveOwnAnsweredKeysTest.php
deleted file mode 100644
index 6edb160..0000000
--- a/Test/Case/Controller/Component/RegistrationOwnAnswerComponent/SaveOwnAnsweredKeysTest.php
+++ /dev/null
@@ -1,123 +0,0 @@
-
- * @author Allcreator
- * @link http://www.netcommons.org NetCommons Project
- * @license http://www.netcommons.org/license.txt NetCommons License
- * @copyright Copyright 2014, NetCommons Project
- */
-
-App::uses('NetCommonsControllerTestCase', 'NetCommons.TestSuite');
-
-/**
- * RegistrationOwnAnswerComponent::saveOwnAnsweredKeys()のテスト
- *
- * @author Allcreator
- * @package NetCommons\Registrations\Test\Case\Controller\Component\RegistrationOwnAnswerComponent
- */
-class RegistrationOwnAnswerComponentSaveOwnAnsweredKeysTest extends NetCommonsControllerTestCase {
-
-/**
- * Fixtures
- *
- * @var array
- */
- public $fixtures = array(
- 'plugin.registrations.registration',
- 'plugin.registrations.block_setting_for_registration',
- 'plugin.registrations.registration_page',
- 'plugin.registrations.registration_question',
- 'plugin.registrations.registration_choice',
- 'plugin.registrations.registration_answer_summary',
- 'plugin.registrations.registration_answer',
- 'plugin.authorization_keys.authorization_keys',
- );
-
-/**
- * Plugin name
- *
- * @var string
- */
- public $plugin = 'registrations';
-
-/**
- * setUp method
- *
- * @return void
- */
- public function setUp() {
- parent::setUp();
-
- //テストプラグインのロード
- NetCommonsCakeTestCase::loadTestPlugin($this, 'Registrations', 'TestRegistrations');
- }
-
-/**
- * tearDown method
- *
- * @return void
- */
- public function tearDown() {
- //ログアウト
- TestAuthGeneral::logout($this);
-
- parent::tearDown();
- }
-
-/**
- * saveOwnAnsweredKeys()のテスト
- *
- * @return void
- */
- public function testSaveOwnAnsweredKeys() {
- //テストコントローラ生成
- $this->generateNc('TestRegistrations.TestRegistrationsOwnAnswerComponent');
-
- //ログイン
- TestAuthGeneral::login($this, Role::ROOM_ROLE_KEY_ROOM_ADMINISTRATOR);
-
- //テスト実行
- $this->_testGetAction(
- '/test_registrations/test_registration_own_answer_component/index',
- array('method' => 'assertNotEmpty'),
- null,
- 'view');
-
- $this->controller->RegistrationsOwnAnswer->saveOwnAnsweredKeys('registration_12');
-
- //チェック
- $result = $this->controller->RegistrationsOwnAnswer->checkOwnAnsweredKeys(
- 'registration_12');
-
- $this->assertTrue($result);
-
- //ログアウト
- TestAuthGeneral::logout($this);
- }
-
-/**
- * saveOwnAnsweredKeys()のテスト
- *
- * @return void
- */
- public function testSaveOwnAnsweredKeysNoLogin() {
- //テストコントローラ生成
- $this->generateNc('TestRegistrations.TestRegistrationsOwnAnswerComponent');
-
- //テスト実行
- $this->_testGetAction(
- '/test_registrations/test_registration_own_answer_component/index',
- array('method' => 'assertNotEmpty'),
- null,
- 'view');
-
- $this->controller->RegistrationsOwnAnswer->saveOwnAnsweredKeys('registration_6');
-
- //チェック
- $result = $this->controller->RegistrationsOwnAnswer->checkOwnAnsweredKeys(
- 'registration_6');
- $this->assertTrue($result);
- }
-}
diff --git a/Test/Case/Controller/Component/RegistrationsComponent/IsOnlyInputTypeTest.php b/Test/Case/Controller/Component/RegistrationsComponent/IsOnlyInputTypeTest.php
deleted file mode 100644
index 8127f87..0000000
--- a/Test/Case/Controller/Component/RegistrationsComponent/IsOnlyInputTypeTest.php
+++ /dev/null
@@ -1,67 +0,0 @@
-
- * @author AllCreator
- * @link http://www.netcommons.org NetCommons Project
- * @license http://www.netcommons.org/license.txt NetCommons License
- * @copyright Copyright 2014, NetCommons Project
- */
-
-App::uses('NetCommonsControllerTestCase', 'NetCommons.TestSuite');
-App::uses('RegistrationsComponent', 'Registrations.Controller/Component');
-
-/**
- * RegistrationComponent::isOnlyInputType()のテスト
- *
- * @author AllCreator
- * @package NetCommons\Registration\Test\Case\Controller\Component\RegistrationComponent
- */
-class RegistrationComponentIsOnlyInputTypeTest extends NetCommonsControllerTestCase {
-
-/**
- * Fixtures
- *
- * @var array
- */
- public $fixtures = array();
-
-/**
- * Plugin name
- *
- * @var string
- */
- public $plugin = 'registrations';
-
-/**
- * isOnlyInputType()のテスト
- *
- * @param int $type チェック種別
- * @param mix $expect 期待値
- * @dataProvider dataProviderIsOnlyInputTypeType
- * @return void
- */
- public function testIsOnlyInputType($type, $expect) {
- $ret = RegistrationsComponent::isOnlyInputType($type);
- $this->assertEqual($ret, $expect);
- }
-/**
- * isOnlyInputType()のテストデータプロバイダ
- *
- * @return void
- */
- public function dataProviderIsOnlyInputTypeType() {
- $data = array(
- array(RegistrationsComponent::TYPE_SELECTION, false),
- array(RegistrationsComponent::TYPE_MULTIPLE_SELECTION, false),
- array(RegistrationsComponent::TYPE_TEXT, true),
- array(RegistrationsComponent::TYPE_TEXT_AREA, true),
- array(RegistrationsComponent::TYPE_MATRIX_SELECTION_LIST, false),
- array(RegistrationsComponent::TYPE_MATRIX_MULTIPLE, false),
- array(RegistrationsComponent::TYPE_DATE_AND_TIME, true),
- array(RegistrationsComponent::TYPE_SINGLE_SELECT_BOX, false)
- );
- return $data;
- }
-}
diff --git a/Test/Case/Controller/Component/RegistrationsComponent/IsSelectionInputTypeTest.php b/Test/Case/Controller/Component/RegistrationsComponent/IsSelectionInputTypeTest.php
deleted file mode 100644
index 0f33825..0000000
--- a/Test/Case/Controller/Component/RegistrationsComponent/IsSelectionInputTypeTest.php
+++ /dev/null
@@ -1,67 +0,0 @@
-
- * @author AllCreator
- * @link http://www.netcommons.org NetCommons Project
- * @license http://www.netcommons.org/license.txt NetCommons License
- * @copyright Copyright 2014, NetCommons Project
- */
-
-App::uses('NetCommonsControllerTestCase', 'NetCommons.TestSuite');
-App::uses('RegistrationsComponent', 'Registrations.Controller/Component');
-
-/**
- * RegistrationComponent::isSelectionInputType()のテスト
- *
- * @author AllCreator
- * @package NetCommons\Registration\Test\Case\Controller\Component\RegistrationComponent
- */
-class RegistrationComponentIsSelectionInputTypeTest extends NetCommonsControllerTestCase {
-
-/**
- * Fixtures
- *
- * @var array
- */
- public $fixtures = array();
-
-/**
- * Plugin name
- *
- * @var string
- */
- public $plugin = 'registrations';
-
-/**
- * isSelectionInputType()のテスト
- *
- * @param int $type チェック種別
- * @param mix $expect 期待値
- * @dataProvider dataProviderIsSelectionInputType
- * @return void
- */
- public function testIsSelectionInputType($type, $expect) {
- $ret = RegistrationsComponent::isSelectionInputType($type);
- $this->assertEqual($ret, $expect);
- }
-/**
- * isSelectionInputType()のテストデータプロバイダ
- *
- * @return void
- */
- public function dataProviderIsSelectionInputType() {
- $data = array(
- array(RegistrationsComponent::TYPE_SELECTION, true),
- array(RegistrationsComponent::TYPE_MULTIPLE_SELECTION, true),
- array(RegistrationsComponent::TYPE_TEXT, false),
- array(RegistrationsComponent::TYPE_TEXT_AREA, false),
- array(RegistrationsComponent::TYPE_MATRIX_SELECTION_LIST, false),
- array(RegistrationsComponent::TYPE_MATRIX_MULTIPLE, false),
- array(RegistrationsComponent::TYPE_DATE_AND_TIME, false),
- array(RegistrationsComponent::TYPE_SINGLE_SELECT_BOX, true)
- );
- return $data;
- }
-}
diff --git a/Test/Case/Controller/Component/empty b/Test/Case/Controller/Component/empty
new file mode 100644
index 0000000..e69de29
diff --git a/Test/Case/Controller/Issue923SettingModeProblemAddTest.php b/Test/Case/Controller/Issue923SettingModeProblemAddTest.php
deleted file mode 100644
index 4501fa3..0000000
--- a/Test/Case/Controller/Issue923SettingModeProblemAddTest.php
+++ /dev/null
@@ -1,148 +0,0 @@
-
- * @link http://www.netcommons.org NetCommons Project
- * @license http://www.netcommons.org/license.txt NetCommons License
- */
-
-App::uses('NetCommonsControllerTestCase', 'NetCommons.TestSuite');
-
-/**
- * Issue923SettingModeProblemAddTest
- *
- * @author Ryuji AMANO
- * @package NetCommons\Pages\Test\Case\Controller\PagesEditController
- * @codeCoverageIgnore
- * @SuppressWarnings(PHPMD.NumberOfChildren)
- */
-class Issue923SettingModeProblemAddTest extends NetCommonsControllerTestCase {
-
-/**
- * Plugin name
- *
- * @var string
- */
- public $plugin = 'registrations';
-
-/**
- * Controller name
- *
- * @var string
- */
- protected $_controller = 'registration_add';
-
-/**
- * Fixtures
- *
- * @var array
- */
- public $fixtures = array(
- 'plugin.registrations.registration',
- 'plugin.registrations.block_setting_for_registration',
- 'plugin.registrations.registration_page',
- 'plugin.registrations.registration_question',
- 'plugin.registrations.registration_choice',
- 'plugin.registrations.registration_answer_summary',
- 'plugin.registrations.registration_answer',
- 'plugin.authorization_keys.authorization_keys',
- 'plugin.workflow.workflow_comment',
- //'plugin.files.upload_file',
- );
-
-/**
- * setUp method
- *
- * @return void
- */
- public function setUp() {
- parent::setUp();
-
- //$this->Registration = ClassRegistry::init('Registrations.Registration');
- //$this->Registration->Behaviors->unload('AuthorizationKey');
-
- TestAuthGeneral::login($this);
-
- //テストプラグインのロード
- NetCommonsCakeTestCase::loadTestPlugin($this, 'Registrations', 'TestRegistrations');
- Current::isSettingMode(false);
- }
-
-/**
- * tearDown method
- *
- * @return void
- */
- public function tearDown() {
- parent::tearDown();
- }
-
-/**
- * add()アクションテスト
- *
- * @return void
- */
- public function testAdd() {
- $data = $this->__getData();
- //セッティングモードでないときは、メール設定タブは非表示
-
- $this->_controller = 'registration_add';
-
- $url = [
- 'controller' => 'registration_add',
- 'action' => 'add',
- 'block_id' => $data['Block']['id'],
- 'frame_id' => $data['Frame']['id'],
- //'key' => 'registration_2',
- ];
-
- $this->_testGetAction($url,
- [
- 'method' => 'assertNotContains', 'expected' => __d('blocks', 'Block settings')
- ], null, 'view');
-
- //セッティングモードONならブロック設定タブが表示される
- $url['q_mode'] = 'setting';
- $this->_testGetAction($url,
- [
- 'method' => 'assertContains', 'expected' => __d('blocks', 'Block settings')
- ], null, 'view');
- }
-
-/**
- * テストDataの取得
- *
- * @param string $registrationKey キー
- * @return array
- */
- private function __getData($registrationKey = null) {
- $frameId = '6';
- $blockId = '2';
- $blockKey = 'block_1';
-
- $data = array(
- 'save_' . WorkflowComponent::STATUS_IN_DRAFT => null,
- 'Frame' => array(
- 'id' => $frameId
- ),
- 'Block' => array(
- 'id' => $blockId,
- 'key' => $blockKey,
- 'language_id' => '2',
- 'room_id' => '2',
- 'plugin_key' => $this->plugin,
- ),
- 'ActionRegistrationAdd' => array(
- 'create_option' => 'create',
- 'title' => 'New Registration Title',
- ),
-
- //'WorkflowComment' => array(
- // 'comment' => 'WorkflowComment save test'
- //),
- );
- return $data;
- }
-
-}
\ No newline at end of file
diff --git a/Test/Case/Controller/Issue923SettingModeProblemEditTest.php b/Test/Case/Controller/Issue923SettingModeProblemEditTest.php
deleted file mode 100644
index 19f03a4..0000000
--- a/Test/Case/Controller/Issue923SettingModeProblemEditTest.php
+++ /dev/null
@@ -1,210 +0,0 @@
-
- * @link http://www.netcommons.org NetCommons Project
- * @license http://www.netcommons.org/license.txt NetCommons License
- */
-
-App::uses('NetCommonsControllerTestCase', 'NetCommons.TestSuite');
-
-/**
- * Issue923SettingModeProblemEditTest
- *
- * @author Ryuji AMANO
- * @package NetCommons\Pages\Test\Case\Controller\PagesEditController
- * @codeCoverageIgnore
- * @SuppressWarnings(PHPMD.NumberOfChildren)
- */
-class Issue923SettingModeProblemEditTest extends NetCommonsControllerTestCase {
-
-/**
- * Plugin name
- *
- * @var string
- */
- public $plugin = 'registrations';
-
-/**
- * Controller name
- *
- * @var string
- */
- protected $_controller = 'registration_edit';
-
-/**
- * Fixtures
- *
- * @var array
- */
- public $fixtures = array(
- 'plugin.registrations.registration',
- 'plugin.registrations.block_setting_for_registration',
- 'plugin.registrations.registration_page',
- 'plugin.registrations.registration_question',
- 'plugin.registrations.registration_choice',
- 'plugin.registrations.registration_answer_summary',
- 'plugin.registrations.registration_answer',
- 'plugin.authorization_keys.authorization_keys',
- 'plugin.workflow.workflow_comment',
- );
-
-/**
- * setUp method
- *
- * @return void
- */
- public function setUp() {
- parent::setUp();
-
- TestAuthGeneral::login($this);
-
- //テストプラグインのロード
- NetCommonsCakeTestCase::loadTestPlugin($this, 'Registrations', 'TestRegistrations');
- Current::isSettingMode(false);
- }
-
-/**
- * tearDown method
- *
- * @return void
- */
- public function tearDown() {
- parent::tearDown();
- }
-
-/**
- * edit_quuestion()アクションテスト
- *
- * @return void
- */
- public function testEditQuestion() {
- $data = $this->__getData();
- //セッティングモードでないときは、メール設定タブは非表示
-
- $url = [
- 'controller' => 'registration_edit',
- 'action' => 'edit_question',
- 'block_id' => $data['Block']['id'],
- 'frame_id' => $data['Frame']['id'],
- 'key' => 'registration_2',
- ];
- //Current::isSettingMode(false);
- $this->_testGetAction($url,
- [
- 'method' => 'assertNotContains', 'expected' => '/registrations/registration_mail_settings/'
- ], null, 'view');
-
- //セッティングモードONならメール設定タブが表示される
- //Current::isSettingMode(true);
- $url['q_mode'] = 'setting';
- $this->_testGetAction($url,
- [
- 'method' => 'assertContains', 'expected' => '/registrations/registration_mail_settings/'
- ], null, 'view');
- }
-
-/**
- * edit_quuestion()アクションテスト
- *
- * @return void
- */
- public function testEdit() {
- $data = $this->__getData();
- //セッティングモードでないときは、メール設定タブは非表示
-
- $url = [
- 'controller' => 'registration_edit',
- 'action' => 'edit',
- 'block_id' => $data['Block']['id'],
- 'frame_id' => $data['Frame']['id'],
- 'key' => 'registration_2',
- ];
- //Current::isSettingMode(false);
- $this->_testGetAction($url,
- [
- 'method' => 'assertNotContains', 'expected' => '/registrations/registration_mail_settings/'
- ], null, 'view');
-
- //セッティングモードONならメール設定タブが表示される
- //Current::isSettingMode(true);
- $url['q_mode'] = 'setting';
- $this->_testGetAction($url,
- [
- 'method' => 'assertContains', 'expected' => '/registrations/registration_mail_settings/'
- ], null, 'view');
- }
-
-/**
- * テストDataの取得
- *
- * @param string $registrationKey キー
- * @return array
- */
- private function __getData($registrationKey = null) {
- $frameId = '6';
- $blockId = '2';
- $blockKey = 'block_1';
-
- $data = array(
- 'save_' . WorkflowComponent::STATUS_IN_DRAFT => null,
- 'Frame' => array(
- 'id' => $frameId
- ),
- 'Block' => array(
- 'id' => $blockId,
- 'key' => $blockKey,
- 'language_id' => '2',
- 'room_id' => '2',
- 'plugin_key' => $this->plugin,
- ),
- 'Registration' => array(
- 'key' => $registrationKey,
- 'status' => WorkflowComponent::STATUS_IN_DRAFT,
- 'title' => 'EditTestTitle',
- 'title_icon' => 'ok.svg',
- 'sub_title' => 'EditTestSubTitle',
- 'is_total_show' => 0,
- 'answer_timing' => '0',
- 'is_key_pass_use' => 0,
- 'total_show_timing' => 0,
- ),
- 'RegistrationPage' => array(
- array(
- 'page_title' => __d('registrations', 'First Page'),
- 'page_sequence' => 0,
- 'route_number' => 0,
- 'RegistrationQuestion' => array(
- array(
- 'question_sequence' => 0,
- 'question_value' => __d('registrations', 'New Question') . '1',
- 'question_type' => RegistrationsComponent::TYPE_SELECTION,
- 'is_require' => RegistrationsComponent::USES_NOT_USE,
- 'is_skip' => RegistrationsComponent::SKIP_FLAGS_NO_SKIP,
- 'is_choice_random' => RegistrationsComponent::USES_NOT_USE,
- 'is_range' => RegistrationsComponent::USES_NOT_USE,
- 'is_result_display' => RegistrationsComponent::EXPRESSION_SHOW,
- 'result_display_type' => RegistrationsComponent::RESULT_DISPLAY_TYPE_BAR_CHART,
- 'RegistrationChoice' => array(
- array(
- 'choice_sequence' => 0,
- 'matrix_type' => RegistrationsComponent::MATRIX_TYPE_ROW_OR_NO_MATRIX,
- 'choice_label' => __d('registrations', 'new choice') . '1',
- 'other_choice_type' => RegistrationsComponent::OTHER_CHOICE_TYPE_NO_OTHER_FILED,
- 'graph_color' => '#FF0000',
- 'skip_page_sequence' => RegistrationsComponent::SKIP_GO_TO_END
- )
- )
- )
- )
- )
- ),
- //'WorkflowComment' => array(
- // 'comment' => 'WorkflowComment save test'
- //),
- );
- return $data;
- }
-
-}
\ No newline at end of file
diff --git a/Test/Case/Controller/RegistrationAddController/AddTest.php b/Test/Case/Controller/QuesetionnaireAddController/AddTest.php
similarity index 58%
rename from Test/Case/Controller/RegistrationAddController/AddTest.php
rename to Test/Case/Controller/QuesetionnaireAddController/AddTest.php
index ee9a5cb..2e44201 100644
--- a/Test/Case/Controller/RegistrationAddController/AddTest.php
+++ b/Test/Case/Controller/QuesetionnaireAddController/AddTest.php
@@ -27,7 +27,9 @@ class RegistrationAddControllerAddTest extends WorkflowControllerAddTest {
*/
public $fixtures = array(
'plugin.registrations.registration',
- 'plugin.registrations.block_setting_for_registration',
+ 'plugin.registrations.registration_setting',
+ 'plugin.registrations.registration_frame_setting',
+ 'plugin.registrations.registration_frame_display_registration',
'plugin.registrations.registration_page',
'plugin.registrations.registration_question',
'plugin.registrations.registration_choice',
@@ -56,12 +58,9 @@ class RegistrationAddControllerAddTest extends WorkflowControllerAddTest {
*/
public function setUp() {
parent::setUp();
-
$this->Registration = ClassRegistry::init('Registrations.Registration');
$this->Registration->Behaviors->unload('AuthorizationKey');
$this->ActionRegistrationAdd = ClassRegistry::init('Registrations.ActionRegistrationAdd');
-
- Current::write('Block.id', '2');
}
/**
@@ -83,7 +82,7 @@ private function __getData() {
'id' => $blockId,
'key' => $blockKey,
'language_id' => '2',
- 'room_id' => '2',
+ 'room_id' => '1',
'plugin_key' => $this->plugin,
),
'ActionRegistrationAdd' => array(
@@ -92,37 +91,6 @@ private function __getData() {
),
);
- return $data;
- }
-/**
- * テストDataの取得
- *
- * @return array
- */
- private function __getDataPastReuse() {
- $frameId = '6';
- $blockId = '2';
- $blockKey = 'block_1';
-
- $data = array(
- //'save_' . WorkflowComponent::STATUS_IN_DRAFT => null,
- 'Frame' => array(
- 'id' => $frameId
- ),
- 'Block' => array(
- 'id' => $blockId,
- 'key' => $blockKey,
- 'language_id' => '2',
- 'room_id' => '2',
- 'plugin_key' => $this->plugin,
- ),
- 'ActionRegistrationAdd' => array(
- 'create_option' => 'reuse',
- //'past_registration_id' => '32',
- 'past_registration_id' => '52',
- ),
- );
-
return $data;
}
@@ -166,49 +134,44 @@ public function dataProviderAddGetByCreatable() {
//作成権限あり
$base = 0;
- // 正しいフレームIDとブロックID
$results[0] = array(
'urlOptions' => array('frame_id' => $data['Frame']['id'], 'block_id' => $data['Block']['id']),
'assert' => array('method' => 'assertNotEmpty'),
);
- // フレームIDのhidden-inputがあるか
array_push($results, Hash::merge($results[$base], array(
'assert' => array('method' => 'assertInput', 'type' => 'input', 'name' => 'data[Frame][id]', 'value' => $data['Frame']['id']),
)));
- // ブロックIDのhidden-inputがあるか
- //array_push($results, Hash::merge($results[$base], array(
- // 'assert' => array('method' => 'assertInput', 'type' => 'input', 'name' => 'data[Block][id]', 'value' => $data['Block']['id']),
- //)));
- // 作成方法選択肢オプションがあるか
array_push($results, Hash::merge($results[$base], array(
- 'assert' => array('method' => 'assertInput', 'type' => 'input', 'name' => 'data[ActionRegistrationAdd][create_option]', 'value' => null),
+ 'assert' => array('method' => 'assertInput', 'type' => 'input', 'name' => 'data[Block][id]', 'value' => $data['Block']['id']),
+ )));
+ /*array_push($results, Hash::merge($results[$base], array(
+ 'assert' => array('method' => 'assertInput', 'type' => 'button', 'name' => 'save_' . WorkflowComponent::STATUS_IN_DRAFT, 'value' => null),
+ )));
+ array_push($results, Hash::merge($results[$base], array(
+ 'assert' => array('method' => 'assertInput', 'type' => 'button', 'name' => 'save_' . WorkflowComponent::STATUS_APPROVED, 'value' => null),
)));
- // タイトル入力テキストがあるか
array_push($results, Hash::merge($results[$base], array(
- 'assert' => array('method' => 'assertInput', 'type' => 'text', 'name' => 'data[ActionRegistrationAdd][title]', 'value' => null),
+ 'assert' => array('method' => 'assertInput', 'type' => 'input', 'name' => 'data[FaqQuestion][id]', 'value' => $data['FaqQuestion']['id']),
)));
- // 過去再利用の絞込テキスト入力とhiddenがあることを確認する
- // 本当は過去の登録フォーム一覧が表示されることも確認せねばならないが、それはAngularで展開しているのでphpunitでは確認できないため省略
array_push($results, Hash::merge($results[$base], array(
- 'assert' => array('method' => 'assertInput', 'type' => 'text', 'name' => 'data[ActionRegistrationAdd][past_search]', 'value' => null),
+ 'assert' => array('method' => 'assertInput', 'type' => 'input', 'name' => 'data[FaqQuestion][key]', 'value' => $data['FaqQuestion']['key']),
)));
array_push($results, Hash::merge($results[$base], array(
- 'assert' => array('method' => 'assertInput', 'type' => 'input', 'name' => 'data[ActionRegistrationAdd][past_registration_id]', 'value' => null),
+ 'assert' => array('method' => 'assertInput', 'type' => 'textarea', 'name' => 'data[FaqQuestion][question]', 'value' => null),
)));
- // テンプレートファイル読み込みがあるか
- //array_push($results, Hash::merge($results[$base], array(
- // 'assert' => array('method' => 'assertInput', 'type' => 'input', 'name' => 'data[ActionRegistrationAdd][template_file]', 'value' => null),
- //)));
+ array_push($results, Hash::merge($results[$base], array(
+ 'assert' => array('method' => 'assertInput', 'type' => 'textarea', 'name' => 'data[FaqQuestion][answer]', 'value' => null),
+ )));*/
- //フレームID指定なしテスト (ありえないはず。 by RyujiAMANO)
- //array_push($results, Hash::merge($results[$base], array(
- // 'urlOptions' => array('frame_id' => null, 'block_id' => $data['Block']['id']),
- // 'assert' => array('method' => 'assertNotEmpty'),
- //)));
- //array_push($results, Hash::merge($results[$base], array(
- // 'urlOptions' => array('frame_id' => null, 'block_id' => $data['Block']['id']),
- // 'assert' => array('method' => 'assertInput', 'type' => 'input', 'name' => 'data[Frame][id]', 'value' => null),
- //)));
+ //フレームID指定なしテスト
+ array_push($results, Hash::merge($results[$base], array(
+ 'urlOptions' => array('frame_id' => null, 'block_id' => $data['Block']['id']),
+ 'assert' => array('method' => 'assertNotEmpty'),
+ )));
+ array_push($results, Hash::merge($results[$base], array(
+ 'urlOptions' => array('frame_id' => null, 'block_id' => $data['Block']['id']),
+ 'assert' => array('method' => 'assertInput', 'type' => 'input', 'name' => 'data[Frame][id]', 'value' => null),
+ )));
return $results;
}
@@ -240,10 +203,6 @@ public function dataProviderAddPost() {
'data' => $data, 'role' => Role::ROOM_ROLE_KEY_GENERAL_USER,
'urlOptions' => array('frame_id' => $data['Frame']['id'], 'block_id' => $data['Block']['id']),
),
- array(
- 'data' => $this->__getDataPastReuse(), 'role' => Role::ROOM_ROLE_KEY_GENERAL_USER,
- 'urlOptions' => array('frame_id' => $data['Frame']['id'], 'block_id' => $data['Block']['id']),
- ),
//フレームID指定なしテスト
array(
'data' => $data, 'role' => Role::ROOM_ROLE_KEY_ROOM_ADMINISTRATOR,
@@ -268,17 +227,6 @@ public function dataProviderAddValidationError() {
'data' => $data,
'urlOptions' => array('frame_id' => $data['Frame']['id'], 'block_id' => $data['Block']['id']),
);
- $dataPastReuse = $this->__getDataPastReuse();
- $resultPastReuse = array(
- 'data' => $dataPastReuse,
- 'urlOptions' => array('frame_id' => $data['Frame']['id'], 'block_id' => $data['Block']['id']),
- );
- //$dataTemplate = $this->__getData();
- //$dataTemplate['ActionRegistrationAdd']['create_option'] = 'template';
- //$resultTemplate = array(
- // 'data' => $dataTemplate,
- // 'urlOptions' => array('frame_id' => $data['Frame']['id'], 'block_id' => $data['Block']['id']),
- //);
return array(
Hash::merge($result, array(
@@ -295,27 +243,6 @@ public function dataProviderAddValidationError() {
'message' => sprintf(__d('net_commons', 'Please input %s.'), __d('registrations', 'Title'))
)
)),
- Hash::merge($resultPastReuse, array(
- 'validationError' => array(
- 'field' => 'ActionRegistrationAdd.past_registration_id',
- 'value' => '',
- 'message' => sprintf(__d('registrations', 'Please select past registration.'))
- )
- )),
- Hash::merge($resultPastReuse, array(
- 'validationError' => array(
- 'field' => 'ActionRegistrationAdd.past_registration_id',
- 'value' => '9999999',
- 'message' => sprintf(__d('registrations', 'Please select past registration.'))
- )
- )),
- //Hash::merge($resultTemplate, array(
- // 'validationError' => array(
- // 'field' => 'ActionRegistrationAdd.template_file',
- // 'value' => null,
- // 'message' => sprintf(__d('registrations', 'file upload error.'))
- // )
- //)),
);
}
}
diff --git a/Test/Case/Controller/RegistrationAnswersController/PostTest.php b/Test/Case/Controller/RegistrationAnswersController/PostTest.php
deleted file mode 100644
index 7654f97..0000000
--- a/Test/Case/Controller/RegistrationAnswersController/PostTest.php
+++ /dev/null
@@ -1,365 +0,0 @@
-
- * @author AllCreator
- * @link http://www.netcommons.org NetCommons Project
- * @license http://www.netcommons.org/license.txt NetCommons License
- * @copyright Copyright 2014, NetCommons Project
- */
-
-App::uses('NetCommonsControllerTestCase', 'NetCommons.TestSuite');
-
-/**
- * RegistrationAnswersController Test Case
- *
- * @author AllCreator
- * @package NetCommons\AuthorizationKeys\Test\Case\Controller
- * @SuppressWarnings(PHPMD.LongVariable)
- */
-class RegistrationAnswersControllerPostTest extends NetCommonsControllerTestCase {
-
-/**
- * Fixtures
- *
- * @var array
- */
- public $fixtures = array(
- 'plugin.registrations.registration',
- 'plugin.registrations.block_setting_for_registration',
- 'plugin.registrations.registration_page',
- 'plugin.registrations.registration_question',
- 'plugin.registrations.registration_choice',
- 'plugin.registrations.registration_answer_summary',
- 'plugin.registrations.registration_answer',
- 'plugin.authorization_keys.authorization_keys',
- 'plugin.registrations.block4registrations',
- 'plugin.registrations.blocks_language4registrations',
- 'plugin.registrations.frame4registrations',
- 'plugin.registrations.frame_public_language4registrations',
- 'plugin.registrations.frames_language4registrations',
- );
-
-/**
- * Plugin name
- *
- * @var array
- */
- public $plugin = 'registrations';
-
-/**
- * Controller name
- *
- * @var string
- */
- protected $_controller = 'registration_answers';
-
-/**
- * setUp method
- *
- * @return void
- */
- public function setUp() {
- parent::setUp();
- $this->generateNc(Inflector::camelize($this->_controller));
- }
-
-/**
- * アクションのPOSTテスト
- * KeyAuthへPost
- *
- * @return void
- */
- public function testKeyAuthPost() {
- $controller = $this->generate('Registrations.RegistrationAnswers', array(
- 'components' => array(
- //'Auth' => array('user'),
- 'Session',
- 'Security',
- 'NetCommons.Permission',
- 'Registrations.Registrations',
- 'Registrations.RegistrationsOwnAnswer',
- 'AuthorizationKeys.AuthorizationKey'
- )
- ));
- $data = array(
- 'data' => array(
- 'Frame' => array('id' => 19),
- 'Block' => array('id' => 11),
- 'AuthorizationKeys' => array('key' => 'test')
- )
- );
- $controller->AuthorizationKey->expects($this->any())
- ->method('check')
- ->will(
- $this->returnValue(true));
-
- TestAuthGeneral::login($this, Role::ROOM_ROLE_KEY_GENERAL_USER);
-
- $this->_testPostAction('post', $data, array('action' => 'key_auth', 'frame_id' => 19, 'block_id' => 11, 'key' => 'registration_6'));
- $result = $this->headers['Location'];
-
- $this->assertTextContains('registration_6', $result);
-
- TestAuthGeneral::logout($this);
- }
-
-/**
- * アクションのPOSTテスト
- * KeyAuthへPost
- *
- * @return void
- */
- public function testKeyAuthPostNG() {
- $controller = $this->generate('Registrations.RegistrationAnswers', array(
- 'components' => array(
- //'Auth' => array('user'),
- 'Session',
- 'Security',
- 'NetCommons.Permission',
- 'Registrations.Registrations',
- 'Registrations.RegistrationsOwnAnswer',
- 'AuthorizationKeys.AuthorizationKey'
- )
- ));
- $data = array(
- 'data' => array(
- 'Frame' => array('id' => 20),
- 'Block' => array('id' => 11),
- 'AuthorizationKeys' => array('key' => 'test')
- )
- );
- $controller->AuthorizationKey->expects($this->any())
- ->method('check')
- ->will(
- $this->returnValue(false));
-
- TestAuthGeneral::login($this, Role::ROOM_ROLE_KEY_GENERAL_USER);
-
- $result = $this->_testPostAction('post', $data, array('action' => 'key_auth', 'frame_id' => 19, 'block_id' => 11, 'key' => 'registration_6'));
-
- // 認証キーcomponentをMockにしてるからエラーメッセージが入らない
- // 同じ画面を表示していることでエラー画面になっていると判断する
- $this->assertTextContains('/registrations/registration_answers/key_auth/', $result);
-
- TestAuthGeneral::logout($this);
- }
-
-/**
- * アクションのPOSTテスト
- * ImgAuthへPost
- *
- * @return void
- */
- public function testImgAuthPost() {
- $controller = $this->generate('Registrations.RegistrationAnswers', array(
- 'components' => array(
- //'Auth' => array('user'),
- 'Session',
- 'Security',
- 'NetCommons.Permission',
- 'Registrations.Registrations',
- 'Registrations.RegistrationsOwnAnswer',
- 'AuthorizationKeys.AuthorizationKey',
- 'VisualCaptcha.VisualCaptcha'
- )
- ));
- $data = array(
- 'data' => array(
- 'Frame' => array('id' => 20),
- 'Block' => array('id' => 12),
- 'VisualCaptcha' => array('test' => 'test') // Mock使うんでなんでもよい
- )
- );
- $controller->VisualCaptcha->expects($this->any())
- ->method('check')
- ->will(
- $this->returnValue(true));
-
- TestAuthGeneral::login($this, Role::ROOM_ROLE_KEY_GENERAL_USER);
-
- $this->_testPostAction('post', $data, array('action' => 'img_auth', 'frame_id' => 20, 'block_id' => 12, 'key' => 'registration_8'));
- $result = $this->headers['Location'];
-
- $this->assertTextContains('registration_8', $result);
-
- TestAuthGeneral::logout($this);
- }
-
-/**
- * アクションのPOSTテスト
- * ImgAuthへPost
- *
- * @return void
- */
- public function testImgAuthPostNG() {
- $controller = $this->generate('Registrations.RegistrationAnswers', array(
- 'components' => array(
- //'Auth' => array('user'),
- 'Session',
- 'Security',
- 'NetCommons.Permission',
- 'Registrations.Registrations',
- 'Registrations.RegistrationsOwnAnswer',
- 'AuthorizationKeys.AuthorizationKey',
- 'VisualCaptcha.VisualCaptcha'
- )
- ));
- $data = array(
- 'data' => array(
- 'Frame' => array('id' => 20),
- 'Block' => array('id' => 12),
- 'VisualCaptcha' => array('test' => 'test') // Mock使うんでなんでもよい
- )
- );
- $controller->VisualCaptcha->expects($this->any())
- ->method('check')
- ->will(
- $this->returnValue(false));
-
- TestAuthGeneral::login($this, Role::ROOM_ROLE_KEY_GENERAL_USER);
-
- $result = $this->_testPostAction('post', $data, array('action' => 'img_auth', 'frame_id' => 20, 'block_id' => 12, 'key' => 'registration_8'));
-
- // componentをMockにしてるからエラーメッセージが入らない
- // 同じ画面を表示していることでエラー画面になっていると判断する
- $this->assertTextContains('/registrations/registration_answers/img_auth/', $result);
-
- TestAuthGeneral::logout($this);
- }
-
-/**
- * アクションのPOSTテスト
- * 登録Post
- *
- * @param array $data 投入データ
- * @param int $role ロール
- * @param array $urlOptions URLオプション
- * @param array $assert テストの期待値
- * @param string|null $exception Exception
- * @param string $return testActionの実行後の結果
- * @dataProvider dataProviderAnswerPost
- * @return void
- */
- public function testAnswerPost($data, $role, $urlOptions, $assert, $exception = null, $return = 'view') {
- //ログイン
- if (isset($role)) {
- TestAuthGeneral::login($this, $role);
- }
-
- //テスト実施
- $urlOptions = Hash::merge(array('action' => 'view'), $urlOptions);
- $result = $this->_testPostAction('post', $data, $urlOptions, $exception, $return);
-
- //正常の場合、リダイレクト
- if (! $exception) {
- if ($assert == 'confirm') {
- $header = $this->controller->response->header();
- $this->assertNotEmpty($header['Location']);
- } elseif ($assert == 'err') {
- $this->assertTextContains('Question_1', $result);
- } else {
- $this->assertTextContains($assert, $result);
- }
- }
-
- //ログアウト
- if (isset($role)) {
- TestAuthGeneral::logout($this);
- }
- }
-
-/**
- * アクションのPOSTテスト
- * 登録Postデータプロバイダ
- *
- * @return void
- */
- public function dataProviderAnswerPost() {
- $data = array(
- 'data' => array(
- 'Frame' => array('id' => 6),
- 'Block' => array('id' => 2),
- 'RegistrationPage' => array('page_sequence' => 0),
- 'RegistrationAnswer' => array(
- 'registration_2' => array(
- array(
- 'answer_value' => '|choice_2:choice label1',
- 'registration_question_key' => 'qKey_1')
- ))
- )
- );
- $errData = $data;
- $errData['data']['RegistrationAnswer']['registration_2'][0]['answer_value'] = '|choice_800:nainainai';
- //$skipData = array(
- // 'data' => array(
- // 'Frame' => array('id' => 21),
- // 'Block' => array('id' => 13),
- // 'RegistrationPage' => array('page_sequence' => 0),
- // 'RegistrationAnswer' => array(
- // 'registration_4' => array(
- // array(
- // 'answer_value' => '|choice_6:choice label3',
- // 'registration_question_key' => 'qKey_3')
- // )))
- //);
- //$skipNoSelectData = $skipData;
- //$skipNoSelectData['data']['RegistrationAnswer']['registration_4'][0]['answer_value'] = '';
-
- return array(
- array(
- 'data' => $data,
- 'role' => Role::ROOM_ROLE_KEY_GENERAL_USER,
- 'urlOptions' => array('frame_id' => 6, 'block_id' => 2, 'key' => 'registration_2'),
- 'assert' => 'confirm'),
- array(
- 'data' => $errData,
- 'role' => Role::ROOM_ROLE_KEY_GENERAL_USER,
- 'urlOptions' => array('frame_id' => 6, 'block_id' => 2, 'key' => 'registration_2'),
- 'assert' => 'err'),
- //array(
- // 'data' => $skipData,
- // 'role' => Role::ROOM_ROLE_KEY_ROOM_ADMINISTRATOR,
- // 'urlOptions' => array('frame_id' => 21, 'block_id' => 13, 'key' => 'registration_4'),
- // 'assert' => 'name="data[RegistrationPage][page_sequence]" value="4"'),
- //array(
- // 'data' => $skipNoSelectData,
- // 'role' => Role::ROOM_ROLE_KEY_ROOM_ADMINISTRATOR,
- // 'urlOptions' => array('frame_id' => 21, 'block_id' => 13, 'key' => 'registration_4'),
- // 'assert' => 'name="data[RegistrationPage][page_sequence]" value="1"'),
- );
- }
-
-/**
- * アクションのPOSTテスト
- * ConfirmhへPost
- *
- * @return void
- */
- public function testConfirmPost() {
- //ログイン
- TestAuthGeneral::login($this, Role::ROOM_ROLE_KEY_ROOM_ADMINISTRATOR);
-
- $mailSettingMock = $this->getMockForModel('Mails.MailSetting', ['getMailSettingPlugin']);
- $mailSettingMock->expects($this->any())
- ->method('getMailSettingPlugin')
- ->will($this->returnValue([
- 'MailSetting' => [
- 'is_mail_send' => false,
- ]
- ]));
-
- $data = array(
- 'data' => array(
- 'Frame' => array('id' => 26),
- 'Block' => array('id' => 18),
- )
- );
- $this->_testPostAction('post', $data, array('action' => 'confirm', 'frame_id' => 26, 'block_id' => 18, 'key' => 'registration_12'));
- $result = $this->headers['Location'];
- $this->assertTextContains('thanks', $result);
- TestAuthGeneral::logout($this);
- }
-
-}
diff --git a/Test/Case/Controller/RegistrationAnswersController/ViewTest.php b/Test/Case/Controller/RegistrationAnswersController/ViewTest.php
index e2a129f..cb2ac7d 100644
--- a/Test/Case/Controller/RegistrationAnswersController/ViewTest.php
+++ b/Test/Case/Controller/RegistrationAnswersController/ViewTest.php
@@ -15,7 +15,7 @@
* RegistrationAnswerController Test Case
*
* @author Allcreator
- * @package NetCommons\Registrations\Test\Case\Controller\RegistrationAsnwerController
+ * @package NetCommons\Bbses\Test\Case\Controller\BbsArticlesController
*/
class RegistrationAnswerControllerViewTest extends WorkflowControllerViewTest {
@@ -26,18 +26,15 @@ class RegistrationAnswerControllerViewTest extends WorkflowControllerViewTest {
*/
public $fixtures = array(
'plugin.registrations.registration',
- 'plugin.registrations.block_setting_for_registration',
+ 'plugin.registrations.registration_setting',
+ 'plugin.registrations.registration_frame_setting',
+ 'plugin.registrations.registration_frame_display_registration',
'plugin.registrations.registration_page',
'plugin.registrations.registration_question',
'plugin.registrations.registration_choice',
'plugin.registrations.registration_answer_summary',
'plugin.registrations.registration_answer',
'plugin.authorization_keys.authorization_keys',
- 'plugin.registrations.block4registrations',
- 'plugin.registrations.blocks_language4registrations',
- 'plugin.registrations.frame4registrations',
- 'plugin.registrations.frame_public_language4registrations',
- 'plugin.registrations.frames_language4registrations',
);
/**
@@ -63,12 +60,6 @@ public function setUp() {
parent::setUp();
$this->Registration = ClassRegistry::init('Registrations.Registration');
$this->Registration->Behaviors->unload('AuthorizationKey');
- $this->controller->Session->expects($this->any())
- ->method('check')
- ->will(
- $this->returnValueMap([
- ['Registration.auth_ok.registration_10', true]
- ]));
}
/**
@@ -89,57 +80,23 @@ public function dataProviderView() {
//--コンテンツあり
$results[0] = array(
'urlOptions' => array('frame_id' => '6', 'block_id' => '2', 'key' => 'registration_2'),
- 'assert' => array('method' => 'assertInput', 'type' => 'button', 'name' => 'next_', 'value' => null),
+ 'assert' => array('method' => 'assertNotEmpty'),
);
+ /*
$results[1] = Hash::merge($results[0], array(
- 'assert' => array('method' => 'assertActionLink', 'linkExist' => false, 'action' => 'edit', 'url' => array('controller' => 'registration_edit')),
- ));
- //$results[2] = Hash::merge($results[0], array( // 存在しない
- // 'urlOptions' => array('key' => 'registration_999', 'block_id' => 1000),
- // 'assert' => null,
- // 'exception' => 'BadRequestException',
- //));
- $results[3] = Hash::merge($results[0], array( // 未公開
- 'urlOptions' => array('key' => 'registration_36', 'block_id' => 38),
- 'assert' => array('method' => 'assertEmpty'),
- //'exception' => 'BadRequestException',
- ));
- $results[4] = Hash::merge($results[0], array( // 非会員NG
- 'urlOptions' => array('key' => 'registration_6', 'block_id' => 11),
- 'assert' => array('method' => 'assertTextContains', 'expected' => __d('registrations', 'you will not be able to answer this registration.')),
- ));
- $results[5] = Hash::merge($results[0], array( // 未来
- 'urlOptions' => array('key' => 'registration_14', 'block_id' => 20),
- 'assert' => array('method' => 'assertTextContains', 'expected' => __d('registrations', 'you will not be able to answer this registration.')),
+ 'assert' => array('method' => 'assertActionLink', 'action' => 'edit', 'linkExist' => false, 'url' => array()),
));
- $results[6] = Hash::merge($results[0], array( // 過去
- 'urlOptions' => array('key' => 'registration_20', 'block_id' => 26),
- 'assert' => array('method' => 'assertTextContains', 'expected' => __d('registrations', 'you will not be able to answer this registration.')),
+ $results[2] = Hash::merge($results[0], array( //コメント(なし)
+ 'assert' => array('method' => 'assertActionLink', 'action' => 'reply', 'linkExist' => false, 'url' => array()),
));
-
- // test mode 画面へ
- $results[7] = array(
- 'urlOptions' => array('frame_id' => '6', 'block_id' => '2', 'action' => 'test_mode', 'key' => 'registration_2'),
- 'assert' => array('method' => 'assertTextNotContains', 'expected' => __d('registrations', 'Test Mode')),
- );
- // thanks画面 登録が終わっていない画面は見られない
- $results[8] = Hash::merge($results[0], array( // 未公開
- 'urlOptions' => array('frame_id' => '6', 'block_id' => '2', 'action' => 'thanks', 'key' => 'registration_2'),
- 'assert' => array('method' => 'assertNotEmpty'),
- 'expected' => 'BadRequestException',
- 'return' => 'json'
- ));
- // 認証キー 画面へ行こうとしてはじかれる
- $results[9] = array(
- 'urlOptions' => array('frame_id' => '6', 'block_id' => '2', 'action' => 'key_auth', 'key' => 'registration_2'),
- 'assert' => array('method' => 'assertTextNotContains', 'expected' => '/registrations/registration_answers/key_auth/'),
- );
- // 画像認証 画面へ行こうとしてはじかれる
- $results[10] = array(
- 'urlOptions' => array('frame_id' => '6', 'block_id' => '2', 'action' => 'img_auth', 'key' => 'registration_2'),
- 'assert' => array('method' => 'assertTextNotContains', 'expected' => '/registrations/registration_answers/img_auth/'),
+ //--コンテンツなし
+ $results[3] = array(
+ 'urlOptions' => array('frame_id' => '14', 'block_id' => null, 'key' => null),
+ 'assert' => array('method' => 'assertEquals', 'expected' => 'emptyRender'),
+ 'exception' => null, 'return' => 'viewFile'
);
- // 繰り返しなしのテストは非会員では厳しいので省略
+ */
+
return $results;
}
@@ -158,56 +115,80 @@ public function dataProviderViewByCreatable() {
$results = array();
//作成権限のみ(一般が書いた記事&一度公開している)
$results[0] = array(
- 'urlOptions' => array('frame_id' => '24', 'block_id' => '16', 'key' =>
- 'registration_10'),
- 'assert' => array('method' => 'assertInput', 'type' => 'button', 'name' => 'next_', 'value' => null),
+ 'urlOptions' => array('frame_id' => '6', 'block_id' => '2', 'key' => 'registration_10'),
+ 'assert' => array('method' => 'assertNotEmpty'),
);
- // 自分が書いた&未公開
- $results[1] = Hash::merge($results[0], array(
- 'urlOptions' => array('block_id' => '2', 'frame_id' => '48', 'key' =>
- 'registration_38'),
- 'assert' => array('method' => 'assertInput', 'type' => 'button', 'name' => 'next_', 'value' => null),
- ));
- // 人が書いた&未公開
- $results[2] = Hash::merge($results[0], array( // 未公開
- 'urlOptions' => array('block_id' => '38', 'frame_id' => '46', 'key' =>
- 'registration_36'),
- 'assert' => array('method' => 'assertEmpty'),
- //'expected' => 'BadRequestException',
+ /*
+ $results[1] = Hash::merge($results[0], array( //(承認済み記事は編集不可)
+ 'assert' => array('method' => 'assertActionLink', 'action' => 'edit', 'linkExist' => false, 'url' => array()),
));
- // 非会員NG みれる
- $results[4] = Hash::merge($results[0], array( // 非会員NG
- 'urlOptions' => array('block_id' => '11', 'frame_id' => '19', 'key' =>
- 'registration_6'),
- 'assert' => array('method' => 'assertInput', 'type' => 'button', 'name' => 'next_', 'value' => null),
+ //作成権限のみ(一般が書いた質問&公開前)
+ $results[2] = array(
+ 'urlOptions' => array('frame_id' => '6', 'block_id' => '2', 'key' => 'bbs_article_4'),
+ 'assert' => array('method' => 'assertNotEmpty'),
+ );
+ $results[3] = Hash::merge($results[2], array(
+ 'assert' => array('method' => 'assertActionLink', 'action' => 'edit', 'linkExist' => true, 'url' => array()),
));
- // 人が書いた未来
- $results[5] = Hash::merge($results[0], array( // 未来
- 'urlOptions' => array('block_id' => '20', 'frame_id' => '28', 'key' =>
- 'registration_14'),
- 'assert' => array('method' => 'assertTextContains', 'expected' => __d('registrations', 'you will not be able to answer this registration.')),
+ //作成権限のみ(他人が書いた質問&公開中)(root_idとparent_idが異なる)
+ $results[4] = array(
+ 'urlOptions' => array('frame_id' => '6', 'block_id' => '2', 'key' => 'bbs_article_9'),
+ 'assert' => array('method' => 'assertNotEmpty'),
+ );
+ $results[5] = Hash::merge($results[4], array(
+ 'assert' => array('method' => 'assertActionLink', 'action' => 'edit', 'linkExist' => false, 'url' => array()),
));
- // 自分が書いた未来
- $results[6] = Hash::merge($results[0], array( // 未来
- 'urlOptions' => array('block_id' => '24', 'frame_id' => '32', 'key' =>
- 'registration_18'),
- 'assert' => array('method' => 'assertInput', 'type' => 'button', 'name' => 'next_', 'value' => null),
+ $results[6] = Hash::merge($results[4], array(
+ 'assert' => array('method' => 'assertActionLink', 'action' => 'reply', 'linkExist' => false, 'url' => array()),
));
- // 繰り返し登録NGで未登録
- $results[7] = Hash::merge($results[0], array(
- 'urlOptions' => array('block_id' => '18', 'frame_id' => '26', 'key' =>
- 'registration_12'),
- 'assert' => array('method' => 'assertInput', 'type' => 'button', 'name' => 'next_', 'value' => null),
+
+ //作成権限のみ(他人が書いた質問&公開中)(root_idとparent_idが同一)
+ $results[7] = array(
+ 'urlOptions' => array('frame_id' => '6', 'block_id' => '2', 'key' => 'bbs_article_8'),
+ 'assert' => array('method' => 'assertNotEmpty'),
+ );
+ $results[8] = Hash::merge($results[7], array(
+ 'assert' => array('method' => 'assertActionLink', 'action' => 'edit', 'linkExist' => false, 'url' => array()),
));
- // 登録してないのに確認画面は見られない
- $results[8] = Hash::merge($results[0], array(
- 'urlOptions' => array('block_id' => '18', 'frame_id' => '26', 'action' => 'confirm', 'key' => 'registration_12'),
+ //--(子記事に'parent_id'あり)
+ $results[9] = array(
+ 'urlOptions' => array('frame_id' => '6', 'block_id' => '2', 'key' => 'bbs_article_7'),
'assert' => array('method' => 'assertNotEmpty'),
- 'expected' => 'BadRequestException',
- 'return' => 'json'
+ );
+ $results[10] = Hash::merge($results[9], array(
+ 'assert' => array('method' => 'assertActionLink', 'action' => 'edit', 'linkExist' => false, 'url' => array()),
));
- // 人が書いた過去 省略
- // 自分が書いた過去 省略
+ //作成権限のみ(他人が書いた質問&公開前)
+ $results[11] = array(
+ 'urlOptions' => array('frame_id' => '6', 'block_id' => '2', 'key' => 'bbs_article_5'),
+ 'assert' => null,
+ 'exception' => 'BadRequestException',
+ );
+ //--コンテンツなし
+ $results[12] = array(
+ 'urlOptions' => array('frame_id' => '14', 'block_id' => null, 'key' => null),
+ 'assert' => array('method' => 'assertEquals', 'expected' => 'emptyRender'),
+ 'exception' => null, 'return' => 'viewFile'
+ );
+ //--パラメータ不正(keyに該当する質問が存在しない)
+ $results[13] = array(
+ 'urlOptions' => array('frame_id' => '6', 'block_id' => '2', 'key' => 'bbs_article_99'),
+ 'assert' => null,
+ 'exception' => 'BadRequestException',
+ );
+ //--BBSなし
+ $results[14] = array(
+ 'urlOptions' => array('frame_id' => '6', 'block_id' => '2', 'key' => 'bbs_xx'),
+ 'assert' => 'null',
+ 'exception' => 'BadRequestException',
+ );
+ $results[15] = array(
+ 'urlOptions' => array('frame_id' => '6', 'block_id' => '2', 'key' => 'bbs_xx'),
+ 'assert' => 'null',
+ 'exception' => 'BadRequestException',
+ 'return' => 'json'
+ );
+ */
return $results;
}
@@ -228,33 +209,142 @@ public function dataProviderViewByEditable() {
//編集権限あり(chef_userが書いた記事一度も公開していない)
//--コンテンツあり
$results[0] = array(
- 'urlOptions' => array('frame_id' => '58', 'block_id' => '50', 'key' =>
- 'registration_48'),
+ 'urlOptions' => array('frame_id' => '6', 'block_id' => '2', 'key' => 'registration_48'),
'assert' => array('method' => 'assertNotEmpty'),
);
- // 繰り返しNGで登録ずみ
+ /*
+ //チェック
+ //--編集ボタン
$results[1] = Hash::merge($results[0], array(
- 'urlOptions' => array('frame_id' => '26', 'block_id' => '18', 'key' =>
- 'registration_12'),
- 'assert' => array('method' => 'assertTextContains', 'expected' => __d('registrations', 'you will not be able to answer this registration.')),
+ 'assert' => array('method' => 'assertActionLink', 'action' => 'edit', 'linkExist' => true, 'url' => array()),
));
-
- $results[2] = Hash::merge($results[0], array( //画像認証
- 'urlOptions' => array('frame_id' => '20', 'block_id' => '12', 'key' =>
- 'registration_8'),
- 'assert' => array('method' => 'assertInput', 'type' => 'button', 'name' => 'next_', 'value' => null),
+ //--コメントボタン
+ $results[2] = Hash::merge($results[0], array(
+ 'assert' => array('method' => 'assertActionLink', 'action' => 'reply', 'linkExist' => false, 'url' => array()),
+ ));
+ //編集権限あり(chef_userが書いた記事公開)
+ //--コンテンツあり
+ $results[3] = array(
+ 'urlOptions' => array('frame_id' => '6', 'block_id' => '2', 'key' => 'bbs_article_6'),
+ 'assert' => array('method' => 'assertNotEmpty'),
+ );
+ //チェック
+ //--編集ボタン
+ $results[4] = Hash::merge($results[3], array( //なし(公開すると編集不可)
+ 'assert' => array('method' => 'assertActionLink', 'action' => 'edit', 'linkExist' => false, 'url' => array()),
+ ));
+ //--コメントボタン
+ $results[5] = Hash::merge($results[3], array(
+ 'assert' => array('method' => 'assertActionLink', 'action' => 'reply', 'linkExist' => true, 'url' => array()),
+ ));
+ //--コンテンツなし
+ $results[6] = array(
+ 'urlOptions' => array('frame_id' => '14', 'block_id' => null, 'key' => null),
+ 'assert' => array('method' => 'assertEquals', 'expected' => 'emptyRender'),
+ 'exception' => null, 'return' => 'viewFile'
+ );
+ //フレームID指定なしテスト
+ $results[7] = array(
+ 'urlOptions' => array('frame_id' => null, 'block_id' => '2', 'key' => 'bbs_article_3'),
+ 'assert' => array('method' => 'assertNotEmpty'),
+ );
+ $results[8] = Hash::merge($results[3], array(
+ 'assert' => array('method' => 'assertActionLink', 'action' => 'edit', 'linkExist' => false, 'url' => array()),
));
- // 登録が終わっている登録フォームは見られる
- //$results[3] = array(
- // 'urlOptions' => array('frame_id' => '26', 'block_id' => '18', 'action' => 'thanks', 'key' => 'registration_12'),
- // 'assert' => array(
- // 'method' => 'assertActionLink',
- // 'linkExist' => true,
- // 'action' => 'view', 'url' => array('frame_id' => '26', 'block_id' => '18', 'controller' => 'registration_answer_summaries', 'key' => 'registration_12')),
- //);
+ //根記事が取得できない
+ $results[9] = array(
+ 'urlOptions' => array('frame_id' => null, 'block_id' => '2', 'key' => 'bbs_article_10'),
+ 'assert' => 'null',
+ 'exception' => 'BadRequestException',
+ );
+ $results[10] = array(
+ 'urlOptions' => array('frame_id' => null, 'block_id' => '2', 'key' => 'bbs_article_10'),
+ 'assert' => 'null',
+ 'exception' => 'BadRequestException',
+ 'return' => 'json'
+ );
+ //親記事が取得できない
+ $results[11] = array(
+ 'urlOptions' => array('frame_id' => null, 'block_id' => '2', 'key' => 'bbs_article_11'),
+ 'assert' => 'null',
+ 'exception' => 'BadRequestException',
+ );
+ $results[12] = array(
+ 'urlOptions' => array('frame_id' => null, 'block_id' => '2', 'key' => 'bbs_article_11'),
+ 'assert' => 'null',
+ 'exception' => 'BadRequestException',
+ 'return' => 'json'
+ );
+ */
+
return $results;
}
+/**
+ * viewアクションのテスト
+ *
+ * @param array $urlOptions URLオプション
+ * @param array $assert テストの期待値
+ * @param string|null $exception Exception
+ * @param string $return testActionの実行後の結果
+ * @dataProvider dataProviderViewError
+ * @return void
+ */
+ /*
+ public function testViewError($urlOptions, $assert, $exception = null, $return = 'view') {
+ //Exception
+ ClassRegistry::removeObject('WorkflowBehavior');
+ $workflowBehaviorMock = $this->getMock('WorkflowBehavior', ['canReadWorkflowContent']);
+ ClassRegistry::addObject('WorkflowBehavior', $workflowBehaviorMock);
+ $this->Registration->Behaviors->unload('Workflow');
+ $this->Registration->Behaviors->load('Workflow', $this->Registration->actsAs['Workflow.Workflow']);
+
+ $workflowBehaviorMock
+ ->expects($this->once())
+ ->method('canReadWorkflowContent')
+ ->will($this->returnValue(false));
+
+ //テスト実施
+ $url = Hash::merge(array(
+ 'plugin' => $this->plugin,
+ 'controller' => $this->_controller,
+ 'action' => 'view',
+ ), $urlOptions);
+
+ $this->_testGetAction($url, $assert, $exception, $return);
+ }
+ */
+/**
+ * viewアクション用DataProvider
+ *
+ * #### 戻り値
+ * - urlOptions: URLオプション
+ * - assert: テストの期待値
+ * - exception: Exception
+ * - return: testActionの実行後の結果
+ *
+ * @return array
+ */
+ /*
+ public function dataProviderViewError() {
+ $results = array();
+
+ // 参照不可のテスト
+ $results[0] = array(
+ 'urlOptions' => array('frame_id' => '6', 'block_id' => '2', 'key' => 'registration_40'),
+ 'assert' => null,
+ 'exception' => 'BadRequestException',
+ );
+ $results[1] = array(
+ 'urlOptions' => array('frame_id' => '6', 'block_id' => '2', 'key' => 'bbs_article_10'),
+ 'assert' => null,
+ 'exception' => 'BadRequestException',
+ 'return' => 'json'
+ );
+ return $results;
+ }
+ */
+
/**
* viewアクション(編集ボタンの確認)
*
@@ -276,7 +366,7 @@ public function testEditGetByPublishable($urlOptions, $assert, $exception = null
}
/**
- * viewアクション 編集長は何でも見ることができるので
+ * viewアクション(コメントボタンの確認)用DataProvider
*
* #### 戻り値
* - urlOptions: URLオプション
@@ -292,63 +382,39 @@ public function dataProviderViewGetByPublishable() {
'urlOptions' => array('frame_id' => '6', 'block_id' => '2', 'key' => 'registration_2'),
'assert' => null
);
- $results[1] = array(
- 'urlOptions' => array('frame_id' => '6', 'block_id' => '2', 'action' => 'test_mode', 'key' => 'registration_2'),
- 'assert' => array('method' => 'assertTextContains', 'expected' => __d('registrations', 'This registration is being temporarily stored . You can registration test before performed in this page . If you want to modify or change the registration , you will be able to edit by pressing the [ Edit question ] button in the upper-right corner .')),
+ /*
+ //チェック
+ //--編集ボタン
+ $results[1] = Hash::merge($results[0], array( //あり
+ 'assert' => array('method' => 'assertActionLink', 'action' => 'edit', 'linkExist' => true, 'url' => array()),
+ ));
+ //--コメントボタン
+ $results[2] = Hash::merge($results[0], array( //あり
+ 'assert' => array('method' => 'assertActionLink', 'action' => 'reply', 'linkExist' => true, 'url' => array()),
+ ));
+
+ //公開前の記事
+ $results[3] = array(
+ 'urlOptions' => array('frame_id' => '6', 'block_id' => '2', 'key' => 'bbs_article_4'),
+ 'assert' => null
);
- // 確認前までの状態になっていたらconfirm登録フォームは見られる
- $results[2] = array(
- 'urlOptions' => array('frame_id' => '26', 'block_id' => '18', 'action' => 'confirm', 'key' => 'registration_12'),
- 'assert' => array('method' => 'assertInput', 'type' => 'submit', 'name' => 'confirm_registration', 'value' => null),
+ //チェック
+ //--編集ボタン
+ $results[4] = Hash::merge($results[3], array(
+ 'assert' => array('method' => 'assertActionLink', 'action' => 'edit', 'linkExist' => true, 'url' => array()),
+ ));
+ //--コメントボタン
+ $results[5] = Hash::merge($results[3], array( //なし
+ 'assert' => array('method' => 'assertActionLink', 'action' => 'reply', 'linkExist' => false, 'url' => array()),
+ ));
+ //--未承認のコメント(承認ボタン)
+ $results[6] = array(
+ 'urlOptions' => array('frame_id' => '6', 'block_id' => '2', 'key' => 'bbs_article_13'),
+ 'assert' => array('method' => 'assertInput', 'type' => 'button', 'name' => 'save_' . WorkflowComponent::STATUS_PUBLISHED, 'value' => null),
);
- // shuffl
- //$results[3] = array(
- // 'urlOptions' => array('frame_id' => '6', 'block_id' => '2', 'key' => 'registration_4'),
- // 'assert' => array('method' => 'assertTextContains', 'expected' => __d('registrations', 'This registration is being temporarily stored . You can registration test before performed in this page . If you want to modify or change the registration , you will be able to edit by pressing the [ Edit question ] button in the upper-right corner .')),
- //);
+ */
+
return $results;
}
-/**
- * viewアクション シャッフルされた選択肢を取り出すためだけの試験
- *
- * - return: testActionの実行後の結果
- *
- * @return array
- */
- //public function testGetShuffle() {
- // $controller = $this->generate('Registrations.RegistrationAnswers', array(
- // 'components' => array(
- // 'Auth' => array('user'),
- // 'Session',
- // 'Security',
- // 'NetCommons.Permission',
- // 'Registrations.Registrations',
- // 'Registrations.RegistrationsOwnAnswer',
- // 'AuthorizationKeys.AuthorizationKey',
- // 'VisualCaptcha.VisualCaptcha'
- // )
- // ));
- // //テスト実施
- // $controller->Session->expects($this->any())
- // ->method('check')
- // ->will($this->returnValue(true));
- //
- // $url = array(
- // 'plugin' => $this->plugin,
- // 'controller' => $this->_controller,
- // 'action' => 'view',
- // 'frame_id' => 6,
- // 'block_id' => 2,
- // 'key' => 'registration_4'
- // );
- // $assert = array('method' => 'assertTextContains', 'expected' => __d('registrations', 'This registration is being temporarily stored . You can registration test before performed in this page . If you want to modify or change the registration , you will be able to edit by pressing the [ Edit question ] button in the upper-right corner .'));
- //
- // //ログイン
- // TestAuthGeneral::login($this, Role::ROOM_ROLE_KEY_ROOM_ADMINISTRATOR);
- // $this->_testGetAction($url, $assert, null, 'view');
- // //ログアウト
- // TestAuthGeneral::logout($this);
- //}
-
}
diff --git a/Test/Case/Controller/RegistrationBlockRolePermissionsController/EditTest.php b/Test/Case/Controller/RegistrationBlockRolePermissionsController/EditTest.php
deleted file mode 100644
index d54063d..0000000
--- a/Test/Case/Controller/RegistrationBlockRolePermissionsController/EditTest.php
+++ /dev/null
@@ -1,131 +0,0 @@
-
- * @author Allcreator
- * @link http://www.netcommons.org NetCommons Project
- * @license http://www.netcommons.org/license.txt NetCommons License
- * @copyright Copyright 2014, NetCommons Project
- */
-App::uses('RegistrationBlockRolePermissionsController', 'Registrations.Controller');
-App::uses('BlockRolePermissionsControllerEditTest', 'Blocks.TestSuite');
-
-/**
- * BlockRolePermissionsController Test Case
- *
- * @author Allcreator
- * @package NetCommons\Registrations\Test\Case\Controller
- */
-class RegistrationBlockRolePermissionsControllerEditTest extends BlockRolePermissionsControllerEditTest {
-
-/**
- * Fixtures
- *
- * @var array
- */
- public $fixtures = array(
- 'plugin.registrations.registration',
- 'plugin.registrations.block_setting_for_registration',
- 'plugin.registrations.registration_page',
- 'plugin.registrations.registration_question',
- 'plugin.registrations.registration_choice',
- 'plugin.registrations.registration_answer_summary',
- 'plugin.registrations.registration_answer',
- 'plugin.authorization_keys.authorization_keys',
- 'plugin.workflow.workflow_comment',
- );
-
-/**
- * Plugin name
- *
- * @var array
- */
- public $plugin = 'registrations';
-
-/**
- * Controller name
- *
- * @var string
- */
- protected $_controller = 'registration_block_role_permissions';
-
-/**
- * テストDataの取得
- *
- * @param bool $isPost POSTかどうか
- * @return array
- */
- private function __getData($isPost) {
- if ($isPost) {
- $data = array(
- 'RegistrationSetting' => array(
- 'id' => 2,
- 'block_key' => 'block_2',
- 'use_workflow' => '1',
- 'approval_type' => '1',
- )
- );
- } else {
- $data = array(
- 'RegistrationSetting' => array(
- 'use_workflow',
- 'approval_type',
- )
- );
- }
- return $data;
- }
-
-/**
- * edit()アクションDataProvider
- *
- * ### 戻り値
- * - approvalFields コンテンツ承認の利用有無のフィールド
- * - exception Exception
- * - return testActionの実行後の結果
- *
- * @return void
- */
- public function dataProviderEditGet() {
- return array(
- array('approvalFields' => $this->__getData(false))
- );
- }
-
-/**
- * edit()アクションDataProvider
- *
- * ### 戻り値
- * - data POSTデータ
- * - exception Exception
- * - return testActionの実行後の結果
- *
- * @return void
- */
- public function dataProviderEditPost() {
- return array(
- array('data' => $this->__getData(true))
- );
- }
-
-/**
- * editアクションのPOSTテスト(Saveエラー)
- *
- * @param array $data POSTデータ
- * @param string|null $exception Exception
- * @param string $return testActionの実行後の結果
- * @dataProvider dataProviderEditPost
- * @return void
- */
- public function testEditPostSaveError($data, $exception = null, $return = 'view') {
- $data['BlockRolePermission']['content_creatable'][Role::ROOM_ROLE_KEY_GENERAL_USER]['roles_room_id'] = 'aaaa';
-
- //テスト実施
- $exception = false;
- $result = $this->testEditPost($data, false, $return);
-
- $approvalFields = $this->__getData(false);
- $this->_assertEditGetPermission($approvalFields, $result);
- }
-}
diff --git a/Test/Case/Controller/RegistrationBlocksController/DownloadTest.php b/Test/Case/Controller/RegistrationBlocksController/DownloadTest.php
deleted file mode 100644
index 6c573b4..0000000
--- a/Test/Case/Controller/RegistrationBlocksController/DownloadTest.php
+++ /dev/null
@@ -1,260 +0,0 @@
-
- * @author AllCreator
- * @link http://www.netcommons.org NetCommons Project
- * @license http://www.netcommons.org/license.txt NetCommons License
- * @copyright Copyright 2014, NetCommons Project
- */
-
-App::uses('NetCommonsControllerTestCase', 'NetCommons.TestSuite');
-App::uses('RegistrationsComponent', 'Registrations.Controller/Component');
-
-/**
- * RegistrationBlocksController Test Case
- *
- * @author AllCreator
- * @package NetCommons\Qustionnaires\Test\Case\Controller\RegistrationBlocksController
- */
-class RegistrationBlocksControllerDownloadTest extends NetCommonsControllerTestCase {
-
-/**
- * Plugin name
- *
- * @var array
- */
- public $plugin = 'registrations';
-
-/**
- * Controller name
- *
- * @var string
- */
- protected $_controller = 'registration_blocks';
-
-/**
- * Fixtures
- *
- * @var array
- */
- public $fixtures = array(
- 'plugin.registrations.registration',
- 'plugin.registrations.block_setting_for_registration',
- 'plugin.registrations.registration_page',
- 'plugin.registrations.registration_question',
- 'plugin.registrations.registration_choice',
- 'plugin.registrations.registration_answer_summary',
- 'plugin.registrations.registration_answer',
- 'plugin.authorization_keys.authorization_keys',
- 'plugin.registrations.block4registrations',
- 'plugin.registrations.blocks_language4registrations',
- 'plugin.registrations.frame4registrations',
- 'plugin.registrations.frame_public_language4registrations',
- 'plugin.registrations.frames_language4registrations',
- );
-
-/**
- * Edit controller name
- *
- * @var string
- */
- protected $_editController = 'registration_blocks';
-
-/**
- * setUp method
- *
- * @return void
- */
- public function setUp() {
- parent::setUp();
-
- //テストプラグインのロード
- NetCommonsCakeTestCase::loadTestPlugin($this, 'Registrations', 'TestRegistrations');
- NetCommonsCakeTestCase::loadTestPlugin($this, 'Registrations', 'TestFiles');
-
- //テストコントローラ生成
- $this->generateNc('TestRegistrations.TestRegistrationBlocks', array('components' => array(
- 'Flash' => array('set')
- )));
-
- //ログイン
- TestAuthGeneral::login($this);
- }
-
-/**
- * tearDown method
- *
- * @return void
- */
- public function tearDown() {
- //ログアウト
- TestAuthGeneral::logout($this);
-
- parent::tearDown();
- }
-
-/**
- * download()のテスト
- *
- * @return void
- */
- public function testDownload() {
- //テスト実施
- $frameId = '6';
- $blockId = '2';
- $url = array(
- 'plugin' => 'test_registrations',
- 'controller' => 'test_registration_blocks',
- 'action' => 'download',
- 'block_id' => $blockId,
- 'key' => 'registration_2',
- 'frame_id' => $frameId
- );
- $this->_testPostAction('post', array(
- 'AuthorizationKey' => array(
- 'authorization_key' => 'ABC'
- )
- ),
- $url);
- //チェック
- $this->assertTextEquals('registration_2.zip', $this->controller->returnValue[0]);
- $this->assertTextEquals('registration_2.csv', $this->controller->returnValue[1]);
- $this->assertTextEquals('ABC', $this->controller->returnValue[2]);
- }
-
-/**
- * download()のgetテスト
- *
- * @return void
- */
- //public function testIndexNoneFrameBlock() {
- // //テスト実施
- // // フレーム、ブロック指定なし
- // $url = array(
- // 'plugin' => 'test_registrations',
- // 'controller' => 'test_registration_blocks',
- // 'action' => 'download',
- // 'key' => 'registration_2',
- // );
- //
- // $this->_testPostAction('post', array(
- // 'AuthorizationKey' => array(
- // 'authorization_key' => 'ABC'
- // )
- // ), $url, 'InternalErrorException');
- //}
-
-/**
- * download()の不正登録フォーム指定テスト
- *
- * 一度も発行されたことのない登録フォームはCSVを入手できない
- * 存在しない登録フォーム
- *
- * @return void
- */
- public function testNoPublish() {
- $frameId = '6';
- $blockId = '2';
- $url = array(
- 'plugin' => 'test_registrations',
- 'controller' => 'test_registration_blocks',
- 'action' => 'download',
- 'block_id' => $blockId,
- 'key' => 'registration_4',
- 'frame_id' => $frameId
- );
- $this->controller->Flash->expects($this->once())
- ->method('set')
- ->with(__d('registrations', 'Designation of the registration does not exist.'));
- $result = $this->_testPostAction('post', array(
- 'AuthorizationKey' => array(
- 'authorization_key' => 'ABC'
- )
- ), $url);
- //$flash = CakeSession::read('Message.flash');
- $this->assertEmpty($result);
- }
-/**
- * download()の圧縮パスワードなし指定テスト
- *
- * @return void
- */
- public function testNoPassword() {
- $frameId = '6';
- $blockId = '2';
- $url = array(
- 'plugin' => 'test_registrations',
- 'controller' => 'test_registration_blocks',
- 'action' => 'download',
- 'block_id' => $blockId,
- 'key' => 'registration_2',
- 'frame_id' => $frameId
- );
- $this->controller->Flash->expects($this->once())
- ->method('set')
- ->with(__d('registrations', 'Setting of password is required always to download answers.'));
- $result = $this->_testPostAction('post', array(
- 'AuthorizationKey' => array(
- 'authorization_key' => ''
- )
- ), $url);
- $this->assertEmpty($result);
- }
-/**
- * download()のファイル作成異常テスト
- *
- * @return void
- */
- public function testException() {
- $mock = $this->getMockForModel('Registrations.RegistrationAnswerSummaryCsv', array('getAnswerSummaryCsv'));
- $mock->expects($this->once())
- ->method('getAnswerSummaryCsv')
- ->will($this->throwException(new Exception));
- $frameId = '6';
- $blockId = '2';
- $url = array(
- 'plugin' => 'test_registrations',
- 'controller' => 'test_registration_blocks',
- 'action' => 'download',
- 'block_id' => $blockId,
- 'key' => 'registration_2',
- 'frame_id' => $frameId
- );
- $this->controller->Flash->expects($this->once())
- ->method('set')
- ->with(__d('registrations', 'download error'));
- $this->_testPostAction('post', array(
- 'AuthorizationKey' => array(
- 'authorization_key' => 'ABC'
- )
- ), $url);
- }
-
-/**
- * download()の大量試験テスト
- *
- * @return void
- */
- public function testDownloadBigData() {
- $frameId = '26';
- $blockId = '18';
- $url = array(
- 'plugin' => 'test_registrations',
- 'controller' => 'test_registration_blocks',
- 'action' => 'download',
- 'block_id' => $blockId,
- 'key' => 'registration_12',
- 'frame_id' => $frameId
- );
- $this->_testPostAction('post', array(
- 'AuthorizationKey' => array(
- 'authorization_key' => 'ABC'
- ),
- 'Block' => [
- 'id' => $blockId,
- ]), $url);
- $this->assertEqual(count($this->controller->returnValue[3]), 3); // header line + 2 records
- }
-}
diff --git a/Test/Case/Controller/RegistrationBlocksController/IndexTest.php b/Test/Case/Controller/RegistrationBlocksController/IndexTest.php
index db9b233..457e7be 100644
--- a/Test/Case/Controller/RegistrationBlocksController/IndexTest.php
+++ b/Test/Case/Controller/RegistrationBlocksController/IndexTest.php
@@ -40,16 +40,13 @@ class RegistrationBlocksControllerIndexTest extends BlocksControllerTest {
*/
public $fixtures = array(
'plugin.registrations.registration',
- 'plugin.registrations.block_setting_for_registration',
+ 'plugin.registrations.registration_setting',
+ 'plugin.registrations.registration_frame_setting',
+ 'plugin.registrations.registration_frame_display_registration',
'plugin.registrations.registration_page',
'plugin.registrations.registration_question',
'plugin.registrations.registration_choice',
'plugin.registrations.registration_answer_summary',
- 'plugin.registrations.block4registrations',
- 'plugin.registrations.blocks_language4registrations',
- 'plugin.registrations.frame4registrations',
- 'plugin.registrations.frame_public_language4registrations',
- 'plugin.registrations.frames_language4registrations',
);
/**
@@ -66,7 +63,6 @@ class RegistrationBlocksControllerIndexTest extends BlocksControllerTest {
*/
public function setUp() {
parent::setUp();
-
$this->Registration = ClassRegistry::init('Registrations.Registration');
$this->Registration->Behaviors->unload('AuthorizationKey');
}
@@ -88,7 +84,7 @@ public function testIndex() {
'plugin' => $this->plugin,
'controller' => $this->_controller,
'action' => 'index',
- 'frame_id' => $frameId,
+ 'frame_id' => $frameId
);
$result = $this->_testNcAction($url, array('method' => 'get'));
@@ -98,7 +94,6 @@ public function testIndex() {
$addLink['controller'] = 'registration_add';
$addLink['action'] = 'add';
$addLink['block_id'] = $blockId;
- $addLink['q_mode'] = 'setting';
$this->assertRegExp(
'//', $result
);
@@ -109,8 +104,7 @@ public function testIndex() {
$editLink['controller'] = 'registration_edit';
$editLink['action'] = 'edit_question';
$editLink['block_id'] = $blockId;
- $editLink['key'] = 'registration_2';
- $editLink['q_mode'] = 'setting';
+ $editLink['key'] = 'registration_4';
$this->assertRegExp(
'//', $result
);
@@ -168,7 +162,6 @@ public function testIndexPaginator($page, $isFirst, $isLast) {
'controller' => $this->_controller,
'action' => 'index',
'frame_id' => $frameId,
- 'limit' => 10,
);
if (! $isFirst) {
$url[] = 'page:' . $page;
@@ -214,4 +207,4 @@ public function dataProviderPaginator() {
return $data;
}
-}
+}
\ No newline at end of file
diff --git a/Test/Case/Controller/RegistrationEditController/CancelTest.php b/Test/Case/Controller/RegistrationEditController/CancelTest.php
deleted file mode 100644
index 136dac1..0000000
--- a/Test/Case/Controller/RegistrationEditController/CancelTest.php
+++ /dev/null
@@ -1,72 +0,0 @@
-
- * @author AllCreator
- * @link http://www.netcommons.org NetCommons Project
- * @license http://www.netcommons.org/license.txt NetCommons License
- * @copyright Copyright 2014, NetCommons Project
- */
-
-App::uses('NetCommonsControllerTestCase', 'NetCommons.TestSuite');
-
-/**
- * RegistrationEditController Test Case
- *
- * @author AllCreator
- * @package NetCommons\Registrations\Test\Case\Controller
- * @SuppressWarnings(PHPMD.LongVariable)
- */
-class RegistrationEditControllerCancelTest extends NetCommonsControllerTestCase {
-
-/**
- * Fixtures
- *
- * @var array
- */
- public $fixtures = array(
- 'plugin.registrations.registration',
- 'plugin.registrations.block_setting_for_registration',
- 'plugin.registrations.registration_page',
- 'plugin.registrations.registration_question',
- 'plugin.registrations.registration_choice',
- 'plugin.registrations.registration_answer_summary',
- 'plugin.registrations.registration_answer',
- 'plugin.authorization_keys.authorization_keys',
- 'plugin.workflow.workflow_comment',
- );
-
-/**
- * Plugin name
- *
- * @var array
- */
- public $plugin = 'registrations';
-
-/**
- * Controller name
- *
- * @var string
- */
- protected $_controller = 'registration_edit';
-
-/**
- * testCancel
- *
- * @return void
- */
- public function testCancel() {
- //テスト実施
- $urlOptions = array(
- 'action' => 'cancel', 'block_id' => 2, 'frame_id' => 6
- );
- $url = Hash::merge(array(
- 'plugin' => $this->plugin,
- 'controller' => $this->_controller,
- ), $urlOptions);
- $this->_testNcAction($url, array('method' => 'get'), null, 'view');
- $result = $this->headers['Location'];
- $this->assertNotEmpty($result);
- }
-}
\ No newline at end of file
diff --git a/Test/Case/Controller/RegistrationEditController/DeleteTest.php b/Test/Case/Controller/RegistrationEditController/DeleteTest.php
deleted file mode 100644
index 0d68fb5..0000000
--- a/Test/Case/Controller/RegistrationEditController/DeleteTest.php
+++ /dev/null
@@ -1,284 +0,0 @@
-
- * @author Allcreator
- * @link http://www.netcommons.org NetCommons Project
- * @license http://www.netcommons.org/license.txt NetCommons License
- * @copyright Copyright 2014, NetCommons Project
- */
-
-App::uses('WorkflowControllerDeleteTest', 'Workflow.TestSuite');
-App::uses('RegistrationsComponent', 'Registrations.Controller/Component');
-
-/**
- * RegistrationEditController Test Case
- *
- * @author Allcreator
- * @package NetCommons\Registrations\Test\Case\Controller\RegistrationEditController
- */
-class RegistrationEditControllerDeleteTest extends WorkflowControllerDeleteTest {
-
-/**
- * Fixtures
- *
- * @var array
- */
- public $fixtures = array(
- 'plugin.registrations.registration',
- 'plugin.registrations.block_setting_for_registration',
- 'plugin.registrations.registration_page',
- 'plugin.registrations.registration_question',
- 'plugin.registrations.registration_choice',
- 'plugin.registrations.registration_answer_summary',
- 'plugin.registrations.registration_answer',
- 'plugin.authorization_keys.authorization_keys',
- 'plugin.workflow.workflow_comment',
- );
-
-/**
- * Plugin name
- *
- * @var array
- */
- public $plugin = 'registrations';
-
-/**
- * Controller name
- *
- * @var string
- */
- protected $_controller = 'registration_edit';
-
-/**
- * setUp method
- *
- * @return void
- */
- public function setUp() {
- parent::setUp();
- $this->Registration = ClassRegistry::init('Registrations.Registration');
- $this->Registration->Behaviors->unload('AuthorizationKey');
-
- $this->controller->Session->expects($this->any())
- ->method('check')
- ->will($this->returnValueMap([['Registrations.registrationEdit.' . 'testSession', true]]));
- $this->controller->Session->expects($this->any())
- ->method('read')
- ->will($this->returnValueMap([['Registrations.registrationEdit.' . 'testSession', $this->__getData()]]));
- }
-
-/**
- * テストDataの取得
- *
- * @param string $registrationKey 項目ID
- * @return array
- */
- private function __getData($registrationKey = 'registration_2') {
- $frameId = '6';
- $blockId = '2';
- $blockKey = 'block_1';
- $data = array(
- 'save_' . WorkflowComponent::STATUS_IN_DRAFT => null,
- 'Frame' => array(
- 'id' => $frameId
- ),
- 'Block' => array(
- 'id' => $blockId,
- 'key' => $blockKey,
- 'language_id' => '2',
- 'room_id' => '2',
- 'plugin_key' => $this->plugin,
- ),
- 'Registration' => array(
- 'key' => $registrationKey,
- 'status' => WorkflowComponent::STATUS_IN_DRAFT,
- 'title' => 'EditTestTitle',
- 'sub_title' => 'EditTestSubTitle',
- 'is_total_show' => 0,
- 'answer_timing' => '0',
- 'is_key_pass_use' => 0,
- 'total_show_timing' => 0,
- ),
- 'RegistrationPage' => array(
- array(
- 'page_title' => __d('registrations', 'First Page'),
- 'page_sequence' => 0,
- 'route_number' => 0,
- 'RegistrationQuestion' => array(
- array(
- 'question_sequence' => 0,
- 'question_value' => __d('registrations', 'New Question') . '1',
- 'question_type' => RegistrationsComponent::TYPE_SELECTION,
- 'is_require' => RegistrationsComponent::USES_NOT_USE,
- 'is_skip' => RegistrationsComponent::SKIP_FLAGS_NO_SKIP,
- 'is_choice_random' => RegistrationsComponent::USES_NOT_USE,
- 'is_range' => RegistrationsComponent::USES_NOT_USE,
- 'is_result_display' => RegistrationsComponent::EXPRESSION_SHOW,
- 'result_display_type' => RegistrationsComponent::RESULT_DISPLAY_TYPE_BAR_CHART,
- 'RegistrationChoice' => array(
- array(
- 'choice_sequence' => 0,
- 'matrix_type' => RegistrationsComponent::MATRIX_TYPE_ROW_OR_NO_MATRIX,
- 'choice_label' => __d('registrations', 'new choice') . '1',
- 'other_choice_type' => RegistrationsComponent::OTHER_CHOICE_TYPE_NO_OTHER_FILED,
- 'graph_color' => '#FF0000',
- 'skip_page_sequence' => RegistrationsComponent::SKIP_GO_TO_END
- )
- )
- )
- )
- )
- ),
- 'WorkflowComment' => array(
- 'comment' => 'WorkflowComment save test'
- ),
- );
- return $data;
- }
-
-/**
- * deleteアクションのGETテスト用DataProvider
- *
- * ### 戻り値
- * - role: ロール
- * - urlOptions: URLオプション
- * - assert: テストの期待値
- * - exception: Exception
- * - return: testActionの実行後の結果
- *
- * @return array
- */
- public function dataProviderDeleteGet() {
- $data = $this->__getData();
- $results = array();
-
- // 管理者がかいて未公開データを
- // 未ログインの人が取り出そうと
- $results[0] = array('role' => null,
- 'urlOptions' => array('frame_id' => $data['Frame']['id'], 'block_id' => $data['Block']['id'], 'key' => 'registration_42'),
- 'assert' => null, 'exception' => 'ForbiddenException'
- );
- // 一般がかいて未公開データを
- // 未ログインの人が取り出そうと
- array_push($results, Hash::merge($results[0], array(
- 'role' => Role::ROOM_ROLE_KEY_GENERAL_USER,
- 'urlOptions' => array('frame_id' => $data['Frame']['id'], 'block_id' => $data['Block']['id'], 'key' => 'registration_38'),
- 'assert' => null, 'exception' => 'BadRequestException'
- )));
- // 管理者がかいて公開データを
- // 編集者が取り出そうと
- array_push($results, Hash::merge($results[0], array(
- 'role' => Role::ROOM_ROLE_KEY_EDITOR,
- 'assert' => null, 'exception' => 'BadRequestException'
- )));
- array_push($results, Hash::merge($results[0], array(
- 'role' => Role::ROOM_ROLE_KEY_ROOM_ADMINISTRATOR,
- 'assert' => null, 'exception' => 'BadRequestException'
- )));
- array_push($results, Hash::merge($results[0], array(
- 'role' => Role::ROOM_ROLE_KEY_ROOM_ADMINISTRATOR,
- 'assert' => null, 'exception' => 'BadRequestException', 'return' => 'json'
- )));
-
- return $results;
- }
-
-/**
- * deleteアクションのPOSTテスト用DataProvider
- *
- * ### 戻り値
- * - data: 登録データ
- * - role: ロール
- * - urlOptions: URLオプション
- * - exception: Exception
- * - return: testActionの実行後の結果
- *
- * @return array
- */
- public function dataProviderDeletePost() {
- $data = $this->__getData();
-
- return array(
- //ログインなし
- array(
- 'data' => $data, 'role' => null,
- 'urlOptions' => array('frame_id' => $data['Frame']['id'], 'block_id' => $data['Block']['id'], 'key' => $data['Registration']['key']),
- 'exception' => 'ForbiddenException'
- ),
- //作成権限のみ
- //--他人の記事
- array(
- 'data' => $data, 'role' => Role::ROOM_ROLE_KEY_GENERAL_USER,
- 'urlOptions' => array('frame_id' => $data['Frame']['id'], 'block_id' => $data['Block']['id'], 'key' => $data['Registration']['key']),
- 'exception' => 'BadRequestException'
- ),
- array(
- 'data' => $data, 'role' => Role::ROOM_ROLE_KEY_GENERAL_USER,
- 'urlOptions' => array('frame_id' => $data['Frame']['id'], 'block_id' => $data['Block']['id'], 'key' => $data['Registration']['key']),
- 'exception' => 'BadRequestException', 'return' => 'json'
- ),
- //--自分の記事&一度も公開されていない
- array(
- 'data' => $this->__getData('registration_38'), 'role' => Role::ROOM_ROLE_KEY_GENERAL_USER,
- 'urlOptions' => array('frame_id' => $data['Frame']['id'], 'block_id' => $data['Block']['id'], 'key' => 'registration_38'),
- ),
- //--自分の記事&一度公開している
- array(
- 'data' => $this->__getData('registration_12'), 'role' => Role::ROOM_ROLE_KEY_GENERAL_USER,
- 'urlOptions' => array('frame_id' => $data['Frame']['id'], 'block_id' => $data['Block']['id'], 'key' => 'registration_12'),
- 'exception' => 'BadRequestException'
- ),
- //編集権限あり
- //--公開していない
- array(
- 'data' => $this->__getData('registration_36'), 'role' => Role::ROOM_ROLE_KEY_EDITOR,
- 'urlOptions' => array('frame_id' => $data['Frame']['id'], 'block_id' => $data['Block']['id'], 'key' => 'registration_36'),
- ),
- //--公開している
- array(
- 'data' => $this->__getData('registration_6'), 'role' => Role::ROOM_ROLE_KEY_EDITOR,
- 'urlOptions' => array('frame_id' => $data['Frame']['id'], 'block_id' => $data['Block']['id'], 'key' => 'registration_6'),
- 'exception' => 'BadRequestException'
- ),
- //公開権限あり
- //フレームID指定なしテスト
- array(
- 'data' => $data, 'role' => Role::ROOM_ROLE_KEY_ROOM_ADMINISTRATOR,
- 'urlOptions' => array('frame_id' => null, 'block_id' => $data['Block']['id'], 'key' => $data['Registration']['key']),
- ),
- );
- }
-
-/**
- * deleteアクションのExceptionErrorテスト用DataProvider
- *
- * ### 戻り値
- * - mockModel: Mockのモデル
- * - mockMethod: Mockのメソッド
- * - data: 登録データ
- * - urlOptions: URLオプション
- * - exception: Exception
- * - return: testActionの実行後の結果
- *
- * @return array
- */
- public function dataProviderDeleteExceptionError() {
- $data = $this->__getData();
-
- return array(
- array(
- 'mockModel' => 'Registrations.Registration', 'mockMethod' => 'deleteRegistration', 'data' => $data,
- 'urlOptions' => array('frame_id' => $data['Frame']['id'], 'block_id' => $data['Block']['id'], 'key' => $data['Registration']['key']),
- 'exception' => 'BadRequestException'
- ),
- array(
- 'mockModel' => 'Registrations.Registration', 'mockMethod' => 'deleteRegistration', 'data' => $data,
- 'urlOptions' => array('frame_id' => $data['Frame']['id'], 'block_id' => $data['Block']['id'], 'key' => $data['Registration']['key']),
- 'exception' => 'BadRequestException', 'return' => 'json'
- ),
- );
- }
-
-}
diff --git a/Test/Case/Controller/RegistrationEditController/EditQuestionTest.php b/Test/Case/Controller/RegistrationEditController/EditQuestionTest.php
deleted file mode 100644
index ce404e6..0000000
--- a/Test/Case/Controller/RegistrationEditController/EditQuestionTest.php
+++ /dev/null
@@ -1,492 +0,0 @@
-
- * @author Allcreator
- * @link http://www.netcommons.org NetCommons Project
- * @license http://www.netcommons.org/license.txt NetCommons License
- * @copyright Copyright 2014, NetCommons Project
- */
-
-App::uses('WorkflowControllerEditTest', 'Workflow.TestSuite');
-App::uses('RegistrationsComponent', 'Registrations.Controller/Component');
-
-/**
- * RegistrationEditController Test Case
- *
- * @author Allcreator
- * @package NetCommons\Registrations\Test\Case\Controller\RegistrationEditController
- */
-class RegistrationEditControllerEditQuestionTest extends WorkflowControllerEditTest {
-
-/**
- * Fixtures
- *
- * @var array
- */
- public $fixtures = array(
- 'plugin.registrations.registration',
- 'plugin.registrations.block_setting_for_registration',
- 'plugin.registrations.registration_page',
- 'plugin.registrations.registration_question',
- 'plugin.registrations.registration_choice',
- 'plugin.registrations.registration_answer_summary',
- 'plugin.registrations.registration_answer',
- 'plugin.authorization_keys.authorization_keys',
- );
-
-/**
- * Plugin name
- *
- * @var array
- */
- public $plugin = 'registrations';
-
-/**
- * Controller name
- *
- * @var string
- */
- protected $_controller = 'registration_edit';
-
-/**
- * test Action name
- *
- * @var string
- */
- protected $_myAction = 'edit_question';
-
-/**
- * setUp method
- *
- * @return void
- */
- public function setUp() {
- parent::setUp();
- $this->Registration = ClassRegistry::init('Registrations.Registration');
- $this->Registration->Behaviors->unload('AuthorizationKey');
-
- $this->controller->Session->expects($this->any())
- ->method('check')
- ->will($this->returnValueMap([['Registrations.registrationEdit.' . 'testSession', true]]));
- $this->controller->Session->expects($this->any())
- ->method('read')
- ->will($this->returnValueMap([['Registrations.registrationEdit.' . 'testSession', $this->__getData()]]));
- }
-
-/**
- * テストDataの取得
- *
- * @param string $registrationKey キー
- * @return array
- */
- private function __getData($registrationKey = null) {
- $frameId = '6';
- $blockId = '2';
- $blockKey = 'block_1';
-
- $data = array(
- 'save_' . WorkflowComponent::STATUS_IN_DRAFT => null,
- 'Frame' => array(
- 'id' => $frameId
- ),
- 'Block' => array(
- 'id' => $blockId,
- 'key' => $blockKey,
- 'language_id' => '2',
- 'room_id' => '2',
- 'plugin_key' => $this->plugin,
- ),
- 'Registration' => array(
- 'key' => $registrationKey,
- 'status' => WorkflowComponent::STATUS_IN_DRAFT,
- 'title' => 'EditTestTitle',
- 'title_icon' => 'ok.svg',
- 'sub_title' => 'EditTestSubTitle',
- 'is_total_show' => 0,
- 'answer_timing' => '0',
- 'is_key_pass_use' => 0,
- 'total_show_timing' => 0,
- ),
- 'RegistrationPage' => array(
- array(
- 'page_title' => __d('registrations', 'First Page'),
- 'page_sequence' => 0,
- 'route_number' => 0,
- 'RegistrationQuestion' => array(
- array(
- 'question_sequence' => 0,
- 'question_value' => __d('registrations', 'New Question') . '1',
- 'question_type' => RegistrationsComponent::TYPE_SELECTION,
- 'is_require' => RegistrationsComponent::USES_NOT_USE,
- 'is_skip' => RegistrationsComponent::SKIP_FLAGS_NO_SKIP,
- 'is_choice_random' => RegistrationsComponent::USES_NOT_USE,
- 'is_range' => RegistrationsComponent::USES_NOT_USE,
- 'is_result_display' => RegistrationsComponent::EXPRESSION_SHOW,
- 'result_display_type' => RegistrationsComponent::RESULT_DISPLAY_TYPE_BAR_CHART,
- 'RegistrationChoice' => array(
- array(
- 'choice_sequence' => 0,
- 'matrix_type' => RegistrationsComponent::MATRIX_TYPE_ROW_OR_NO_MATRIX,
- 'choice_label' => __d('registrations', 'new choice') . '1',
- 'other_choice_type' => RegistrationsComponent::OTHER_CHOICE_TYPE_NO_OTHER_FILED,
- 'graph_color' => '#FF0000',
- 'skip_page_sequence' => RegistrationsComponent::SKIP_GO_TO_END
- )
- )
- )
- )
- )
- ),
- //'WorkflowComment' => array(
- // 'comment' => 'WorkflowComment save test'
- //),
- );
- return $data;
- }
-
-/**
- * editアクションのGETテスト(ログインなし)用DataProvider
- *
- * ### 戻り値
- * - urlOptions: URLオプション
- * - assert: テストの期待値
- * - exception: Exception
- * - return: testActionの実行後の結果
- *
- * @return array
- */
- public function dataProviderEditGet() {
- $data = $this->__getData();
-
- $results = array();
-
- //ログインなし
- $results[0] = array(
- 'urlOptions' => array('frame_id' => $data['Frame']['id'], 'block_id' => $data['Block']['id'], 'action' => $this->_myAction, 'key' => 'registration_42'),
- 'assert' => null, 'exception' => 'ForbiddenException'
- );
- return $results;
- }
-
-/**
- * editアクションのGETテスト(作成権限のみ)用DataProvider
- *
- * ### 戻り値
- * - urlOptions: URLオプション
- * - assert: テストの期待値
- * - exception: Exception
- * - return: testActionの実行後の結果
- *
- * @return array
- */
- public function dataProviderEditGetByCreatable() {
- $data = $this->__getData();
-
- $results = array();
-
- //作成権限のみ
- //--他人の記事の編集
- $results[0] = array(
- 'urlOptions' => array('frame_id' => $data['Frame']['id'], 'block_id' => $data['Block']['id'], 'action' => $this->_myAction, 'key' => 'registration_42'),
- 'assert' => null,
- 'exception' => 'BadRequestException'
- );
- //--自分の記事の編集(一度も公開していない)
- $results[1] = array(
- 'urlOptions' => array('frame_id' => $data['Frame']['id'], 'block_id' => $data['Block']['id'], 'action' => $this->_myAction, 'key' => 'registration_44'),
- 'assert' => array('method' => 'assertNotEmpty'),
- );
- //--自分の記事の編集(一度も公開していない)=編集用「項目追加」ボタンがあるはず
- $results[2] = array(
- 'urlOptions' => array('frame_id' => $data['Frame']['id'], 'block_id' => $data['Block']['id'], 'action' => $this->_myAction, 'key' => 'registration_44'),
- 'assert' => array('method' => 'assertContains', 'expected' => __d('registrations', 'Add Question')),
- );
- // 存在してない登録フォームを指定
- $results[3] = array(
- 'urlOptions' => array('frame_id' => $data['Frame']['id'], 'block_id' => $data['Block']['id'], 'action' => $this->_myAction, 'key' => 'registration_99999'),
- 'assert' => null, 'exception' => 'BadRequestException', 'return' => 'json'
- );
- //新規作成
- $results[4] = array(
- 'urlOptions' => array('frame_id' => $data['Frame']['id'], 'block_id' => $data['Block']['id'], 'action' => $this->_myAction, 's_id' => 'testSession'),
- 'assert' => array('method' => 'assertNotEmpty'),
- );
- //--自分の記事の編集(公開すみ)
- $results[5] = array(
- 'urlOptions' => array('frame_id' => $data['Frame']['id'], 'block_id' => $data['Block']['id'], 'action' => $this->_myAction, 'key' => 'registration_51'),
- 'assert' => array('method' => 'assertNotEmpty'),
- );
- //--自分の記事の編集(公開すみ)=追加ボタンがない→登録フォームでは公開後も編集可能なので追加ボタンはある
- //$results[6] = array(
- // 'urlOptions' => array('frame_id' => $data['Frame']['id'], 'block_id' => $data['Block']['id'], 'action' => $this->_myAction, 'key' => 'registration_18'),
- // 'assert' => array('method' => 'assertNotContains', 'expected' => __d('registrations', 'Add Question')),
- //);
- return $results;
- }
-
-/**
- * editアクションのGETテスト(編集権限、公開権限なし)用DataProvider
- *
- * ### 戻り値
- * - urlOptions: URLオプション
- * - assert: テストの期待値
- * - exception: Exception
- * - return: testActionの実行後の結果
- *
- * @return array
- */
- public function dataProviderEditGetByEditable() {
- $data = $this->__getData();
- $base = 0;
- $results = array();
-
- //編集権限あり
- //--コンテンツあり 自分の記事(編集できるコンテンツ
- $results[0] = array(
- 'urlOptions' => array('frame_id' => $data['Frame']['id'], 'block_id' => $data['Block']['id'], 'action' => $this->_myAction, 'key' => 'registration_42'),
- 'assert' => array('method' => 'assertNotEmpty'),
- );
- /* 本来はここで表示ページの要素の妥当性をチェックするのだと思われるが
- * 登録フォームはAngularでページ要素を展開しているため、NetCommons通常テスト確認メソッドが使えない
- * ごく一部に限って確認を行うことにする
- */
-
- // ページタブ,ページ追加リンク,項目追加ボタン,項目LI、項目種別選択,項目削除ボタン, 選択肢追加ボタン, 選択肢削除ボタン、キャンセルボタン、次へボタンの存在の確認
- array_push($results, Hash::merge($results[$base], array(
- 'assert' => array('method' => 'assertInput', 'type' => 'input', 'name' => 'data[RegistrationPage][{{pageIndex}}][page_sequence]', 'value' => null),
- )));
- array_push($results, Hash::merge($results[$base], array(
- 'assert' => array('method' => 'assertInput', 'type' => 'input', 'name' => 'data[RegistrationPage][{{pageIndex}}][key]', 'value' => null),
- )));
- array_push($results, Hash::merge($results[$base], array(
- 'assert' => array('method' => 'assertInput', 'type' => 'input', 'name' => 'data[RegistrationPage][{{pageIndex}}][RegistrationQuestion][{{qIndex}}][question_sequence]', 'value' => null),
- )));
- array_push($results, Hash::merge($results[$base], array(
- 'assert' => array('method' => 'assertInput', 'type' => 'input', 'name' => 'data[RegistrationPage][{{pageIndex}}][RegistrationQuestion][{{qIndex}}][key]', 'value' => null),
- )));
- array_push($results, Hash::merge($results[$base], array(
- 'assert' => array('method' => 'assertInput', 'type' => 'input', 'name' => 'data[RegistrationPage][{{pageIndex}}][RegistrationQuestion][{{qIndex}}][is_result_display]', 'value' => null),
- )));
- array_push($results, Hash::merge($results[$base], array(
- 'assert' => array('method' => 'assertInput', 'type' => 'input', 'name' => 'data[RegistrationPage][{{pageIndex}}][RegistrationQuestion][{{qIndex}}][result_display_type]', 'value' => null),
- )));
- array_push($results, Hash::merge($results[$base], array(
- 'assert' => array('method' => 'assertInput', 'type' => 'input', 'name' => 'data[RegistrationPage][{{pageIndex}}][RegistrationQuestion][{{qIndex}}][is_require]', 'value' => null),
- )));
- array_push($results, Hash::merge($results[$base], array(
- 'assert' => array('method' => 'assertInput', 'type' => 'input', 'name' => 'data[RegistrationPage][{{pageIndex}}][RegistrationQuestion][{{qIndex}}][question_value]', 'value' => null),
- )));
- array_push($results, Hash::merge($results[$base], array(
- 'assert' => array('method' => 'assertInput', 'type' => 'select', 'name' => 'data[RegistrationPage][{{pageIndex}}][RegistrationQuestion][{{qIndex}}][question_type]', 'value' => null),
- )));
- array_push($results, Hash::merge($results[$base], array(
- 'assert' => array('method' => 'assertInput', 'type' => 'textarea', 'name' => 'data[RegistrationPage][{{pageIndex}}][RegistrationQuestion][{{qIndex}}][description]', 'value' => null),
- )));
- array_push($results, Hash::merge($results[$base], array(
- 'assert' => array('method' => 'assertInput', 'type' => 'input', 'name' => 'data[RegistrationPage][{{pageIndex}}][RegistrationQuestion][{{qIndex}}][is_choice_random]', 'value' => null),
- )));
- array_push($results, Hash::merge($results[$base], array(
- 'assert' => array('method' => 'assertInput', 'type' => 'input', 'name' => 'data[RegistrationPage][{{pageIndex}}][RegistrationQuestion][{{qIndex}}][is_skip]', 'value' => null),
- )));
- array_push($results, Hash::merge($results[$base], array(
- 'assert' => array('method' => 'assertInput', 'type' => 'input', 'name' => 'data[RegistrationPage][{{pageIndex}}][RegistrationQuestion][{{qIndex}}][RegistrationChoice][{{choice.choiceSequence}}][choice_label]', 'value' => null),
- )));
- array_push($results, Hash::merge($results[$base], array(
- 'assert' => array('method' => 'assertInput', 'type' => 'input', 'name' => 'data[RegistrationPage][{{pageIndex}}][RegistrationQuestion][{{qIndex}}][RegistrationChoice][{{choice.choiceSequence}}][choice_value]', 'value' => null),
- )));
- array_push($results, Hash::merge($results[$base], array(
- 'assert' => array('method' => 'assertInput', 'type' => 'input', 'name' => 'data[RegistrationPage][{{pageIndex}}][RegistrationQuestion][{{qIndex}}][RegistrationChoice][{{choice.choiceSequence}}][matrix_type]', 'value' => null),
- )));
- array_push($results, Hash::merge($results[$base], array(
- 'assert' => array('method' => 'assertInput', 'type' => 'input', 'name' => 'data[RegistrationPage][{{pageIndex}}][RegistrationQuestion][{{qIndex}}][RegistrationChoice][{{choice.choiceSequence}}][other_choice_type]', 'value' => null),
- )));
- array_push($results, Hash::merge($results[$base], array(
- 'assert' => array('method' => 'assertInput', 'type' => 'input', 'name' => 'data[RegistrationPage][{{pageIndex}}][RegistrationQuestion][{{qIndex}}][RegistrationChoice][{{choice.choiceSequence}}][key]', 'value' => null),
- )));
- array_push($results, Hash::merge($results[$base], array(
- 'assert' => array('method' => 'assertInput', 'type' => 'input', 'name' => 'data[RegistrationPage][{{pageIndex}}][RegistrationQuestion][{{qIndex}}][RegistrationChoice][{{choice.choiceSequence}}][graph_color]', 'value' => null),
- )));
- array_push($results, Hash::merge($results[$base], array(
- 'assert' => array('method' => 'assertInput', 'type' => 'input', 'name' => 'data[Frame][id]', 'value' => $data['Frame']['id']),
- )));
- array_push($results, Hash::merge($results[$base], array(
- 'assert' => array('method' => 'assertInput', 'type' => 'input', 'name' => 'data[Block][id]', 'value' => $data['Block']['id']),
- )));
- //--コンテンツなし...編集対象データを指定せずに編集画面へ行くと不正リクエストエラー
- $results[count($results)] = array(
- 'urlOptions' => array('frame_id' => '14', 'block_id' => null, 'action' => $this->_myAction, 'key' => null),
- 'assert' => null,
- 'exception' => 'BadRequestException'
- );
-
- return $results;
- }
-
-/**
- * editアクションのGETテスト(公開権限あり)用DataProvider
- *
- * ### 戻り値
- * - urlOptions: URLオプション
- * - assert: テストの期待値
- * - exception: Exception
- * - return: testActionの実行後の結果
- *
- * @return array
- */
- public function dataProviderEditGetByPublishable() {
- $data = $this->__getData();
- $results = array();
-
- //フレームID指定なしテスト
- $results[0] = array(
- 'urlOptions' => array('frame_id' => null, 'block_id' => $data['Block']['id'], 'action' => $this->_myAction, 'key' => 'registration_2'),
- 'assert' => array('method' => 'assertNotEmpty'),
- );
- //フレームID指定なしでも画面の内容がちゃんと表示されていることを確認している
- array_push($results, Hash::merge($results[0], array(
- 'urlOptions' => array('frame_id' => null, 'block_id' => $data['Block']['id'], 'action' => $this->_myAction, 'key' => 'registration_2'),
- 'assert' => [
- array('method' => 'assertInput', 'type' => 'input', 'name' => 'data[Frame][id]', 'value' => null),
- // セッティングモードのときは、メール設定が表示されてること
- array('method' => 'assertContains', 'expected' => '/registrations/registration_mail_settings/'),
- ]
- )));
- // いったん公開して、その後の一時保存データに対して編集している
- // その場合でも項目変更は不可能だ→登録フォームでは編集
- //array_push($results, Hash::merge($results[0], array(
- // 'urlOptions' => array('frame_id' => null, 'block_id' => $data['Block']['id'], 'action' => $this->_myAction, 'key' => 'registration_2'),
- // 'assert' => array('method' => 'assertNotContains', 'expected' => __d('registrations', 'Add Question')),
- //)));
-
- return $results;
- }
-
-/**
- * editアクションのPOSTテスト用DataProvider
- *
- * ### 戻り値
- * - data: 登録データ
- * - role: ロール
- * - urlOptions: URLオプション
- * - exception: Exception
- * - return: testActionの実行後の結果
- *
- * @return array
- */
- public function dataProviderEditPost() {
- $data = $this->__getData();
- return array(
- //ログインなし
- array(
- 'data' => $data, 'role' => null,
- 'urlOptions' => array('frame_id' => $data['Frame']['id'], 'block_id' => $data['Block']['id'], 'action' => $this->_myAction, 'key' => 'registration_44'),
- 'exception' => 'ForbiddenException'
- ),
- //作成権限のみ
- //--他人の記事
- array(
- 'data' => $data, 'role' => Role::ROOM_ROLE_KEY_GENERAL_USER,
- 'urlOptions' => array('frame_id' => $data['Frame']['id'], 'block_id' => $data['Block']['id'], 'key' => 'registration_40'),
- 'exception' => 'BadRequestException'
- ),
- array(
- 'data' => $data, 'role' => Role::ROOM_ROLE_KEY_EDITOR,
- 'urlOptions' => array('frame_id' => $data['Frame']['id'], 'block_id' => $data['Block']['id'], 'key' => 'registration_40'),
- 'exception' => 'BadRequestException', 'return' => 'json'
- ),
- //--自分の記事(一度も公開していない)
- array(
- 'data' => $this->__getData('registration_44'), 'role' => Role::ROOM_ROLE_KEY_GENERAL_USER,
- 'urlOptions' => array('frame_id' => $data['Frame']['id'], 'block_id' => $data['Block']['id'], 'action' => $this->_myAction, 's_id' => 'testSession'),
- ),
- //--自分の記事(公開)
- array(
- 'data' => $this->__getData('registration_12'), 'role' => Role::ROOM_ROLE_KEY_GENERAL_USER,
- 'urlOptions' => array('frame_id' => $data['Frame']['id'], 'block_id' => $data['Block']['id'], 'action' => $this->_myAction, 's_id' => 'testSession'),
- ),
- //編集権限あり
- //--新規作成
- array(
- 'data' => $data, 'role' => Role::ROOM_ROLE_KEY_EDITOR,
- 'urlOptions' => array('frame_id' => $data['Frame']['id'], 'block_id' => $data['Block']['id'], 'action' => $this->_myAction, 's_id' => 'testSession'),
- ),
- //フレームID指定なし 新規作成テスト
- array(
- 'data' => $data, 'role' => Role::ROOM_ROLE_KEY_ROOM_ADMINISTRATOR,
- 'urlOptions' => array('frame_id' => null, 'block_id' => $data['Block']['id'], 'action' => $this->_myAction, 's_id' => 'testSession'),
- ),
- //--自分の記事(公開)
- array(
- 'data' => $this->__getData('registration_4'), 'role' => Role::ROOM_ROLE_KEY_ROOM_ADMINISTRATOR,
- 'urlOptions' => array('frame_id' => $data['Frame']['id'], 'block_id' => $data['Block']['id'], 'action' => $this->_myAction, 's_id' => 'testSession'),
- ),
- );
- }
-
-/**
- * editアクションのValidationErrorテスト用DataProvider
- *
- * ### 戻り値
- * - data: 登録データ
- * - urlOptions: URLオプション
- * - validationError: バリデーションエラー
- *
- * @return array
- */
- public function dataProviderEditValidationError() {
- $data = $this->__getData();
-
- $result = array(
- 'data' => $data,
- 'urlOptions' => array('frame_id' => $data['Frame']['id'], 'block_id' => $data['Block']['id'], 'action' => $this->_myAction, 's_id' => 'testSession'),
- );
-
- return array(
- Hash::merge($result, array(
- 'validationError' => array(
- 'field' => 'RegistrationPage.0.RegistrationQuestion.0.is_require',
- 'value' => 'aa',
- 'message' => 'question.errorMessages.isRequire',
- )
- )),
- Hash::merge($result, array(
- 'validationError' => array(
- 'field' => 'RegistrationPage.0.RegistrationQuestion.0.question_value',
- 'value' => '',
- 'message' => 'question.errorMessages.questionValue',
- //'message' => __d('registrations', 'Please input question text.') Angularで展開するためエラーメッセージ実体がphpunitの試験段階だとわからない
- )
- )),
- Hash::merge($result, array(
- 'validationError' => array(
- 'field' => 'RegistrationPage.0.RegistrationQuestion.0.question_type',
- 'value' => 'aa',
- 'message' => 'question.errorMessages.questionType',
- )
- )),
- //Hash::merge($result, array(
- // 'validationError' => array(
- // 'field' => 'RegistrationPage.0.RegistrationQuestion.0.is_choice_random',
- // 'value' => 'aa',
- // 'message' => 'question.errorMessages.isChoiceRandom',
- // )
- //)),
- //Hash::merge($result, array(
- // 'validationError' => array(
- // 'field' => 'RegistrationPage.0.RegistrationQuestion.0.is_skip',
- // 'value' => 'aa',
- // 'message' => 'question.errorMessages.isSkip',
- // )
- //)),
- Hash::merge($result, array(
- 'validationError' => array(
- 'field' => 'RegistrationPage.0.RegistrationQuestion.0.RegistrationChoice.0.choice_label',
- 'value' => '',
- 'message' => 'choice.errorMessages.choiceLabel',
- )
- )),
- );
- }
-}
\ No newline at end of file
diff --git a/Test/Case/Controller/RegistrationEditController/EditTest.php b/Test/Case/Controller/RegistrationEditController/EditTest.php
deleted file mode 100644
index f5d3d05..0000000
--- a/Test/Case/Controller/RegistrationEditController/EditTest.php
+++ /dev/null
@@ -1,508 +0,0 @@
-
- * @author Allcreator
- * @link http://www.netcommons.org NetCommons Project
- * @license http://www.netcommons.org/license.txt NetCommons License
- * @copyright Copyright 2014, NetCommons Project
- */
-
-App::uses('WorkflowControllerEditTest', 'Workflow.TestSuite');
-App::uses('RegistrationsComponent', 'Registrations.Controller/Component');
-
-/**
- * RegistrationEditController Test Case
- *
- * @author Allcreator
- * @package NetCommons\Registrations\Test\Case\Controller\RegistrationEditController
- */
-class RegistrationEditControllerEditTest extends WorkflowControllerEditTest {
-
-/**
- * Fixtures
- *
- * @var array
- */
- public $fixtures = array(
- 'plugin.registrations.registration',
- 'plugin.registrations.block_setting_for_registration',
- 'plugin.registrations.registration_page',
- 'plugin.registrations.registration_question',
- 'plugin.registrations.registration_choice',
- 'plugin.registrations.registration_answer_summary',
- 'plugin.registrations.registration_answer',
- 'plugin.authorization_keys.authorization_keys',
- 'plugin.workflow.workflow_comment',
- );
-
-/**
- * Plugin name
- *
- * @var array
- */
- public $plugin = 'registrations';
-
-/**
- * Controller name
- *
- * @var string
- */
- protected $_controller = 'registration_edit';
-
-/**
- * test Action name
- *
- * @var string
- */
- protected $_myAction = 'edit';
-
-/**
- * setUp method
- *
- * @return void
- */
- public function setUp() {
- parent::setUp();
- $this->Registration = ClassRegistry::init('Registrations.Registration');
- $this->Registration->Behaviors->unload('AuthorizationKey');
-
- $this->controller->Session->expects($this->any())
- ->method('check')
- ->will($this->returnValueMap([['Registrations.registrationEdit.' . 'testSession', true]]));
- $this->controller->Session->expects($this->any())
- ->method('read')
- ->will($this->returnValueMap([['Registrations.registrationEdit.' . 'testSession', $this->__getData()]]));
- }
-
-/**
- * テストDataの取得
- *
- * @param string $registrationKey キー
- * @param array $override デフォルト値を上書きする値
- * @return array
- */
- private function __getData($registrationKey = null, $override = []) {
- $frameId = '6';
- $blockId = '2';
- $blockKey = 'block_1';
-
- $data = array(
- 'save_' . WorkflowComponent::STATUS_IN_DRAFT => null,
- 'Frame' => array(
- 'id' => $frameId
- ),
- 'Block' => array(
- 'id' => $blockId,
- 'key' => $blockKey,
- 'language_id' => '2',
- 'room_id' => '2',
- 'plugin_key' => $this->plugin,
- ),
- 'Registration' => array(
- 'key' => $registrationKey,
- 'status' => WorkflowComponent::STATUS_IN_DRAFT,
- 'title' => 'EditTestTitle',
- 'sub_title' => 'EditTestSubTitle',
- 'is_total_show' => 0,
- 'answer_timing' => '0',
- 'answer_start_period' => '2016-08-01 00:00:00',
- 'answer_end_period' => '2017-08-01 00:00:00',
- //'is_no_member_allow' => 0,
- 'is_key_pass_use' => 0,
- 'total_show_timing' => 0,
- 'total_show_start_period' => '',
- ),
- 'RegistrationPage' => array(
- array(
- 'page_title' => __d('registrations', 'First Page'),
- 'page_sequence' => 0,
- 'route_number' => 0,
- 'RegistrationQuestion' => array(
- array(
- 'question_sequence' => 0,
- 'question_value' => __d('registrations', 'New Question') . '1',
- 'question_type' => RegistrationsComponent::TYPE_SELECTION,
- 'is_require' => RegistrationsComponent::USES_NOT_USE,
- 'is_skip' => RegistrationsComponent::SKIP_FLAGS_NO_SKIP,
- 'is_choice_random' => RegistrationsComponent::USES_NOT_USE,
- 'is_range' => RegistrationsComponent::USES_NOT_USE,
- 'is_result_display' => RegistrationsComponent::EXPRESSION_SHOW,
- 'result_display_type' => RegistrationsComponent::RESULT_DISPLAY_TYPE_BAR_CHART,
- 'RegistrationChoice' => array(
- array(
- 'choice_sequence' => 0,
- 'matrix_type' => RegistrationsComponent::MATRIX_TYPE_ROW_OR_NO_MATRIX,
- 'choice_label' => __d('registrations', 'new choice') . '1',
- 'other_choice_type' => RegistrationsComponent::OTHER_CHOICE_TYPE_NO_OTHER_FILED,
- 'graph_color' => '#FF0000',
- 'skip_page_sequence' => RegistrationsComponent::SKIP_GO_TO_END
- )
- )
- )
- )
- )
- ),
- 'WorkflowComment' => array(
- 'comment' => 'WorkflowComment save test'
- ),
- );
- $data = Hash::merge($data, $override);
- return $data;
- }
-
-/**
- * editアクションのGETテスト(ログインなし)用DataProvider
- *
- * ### 戻り値
- * - urlOptions: URLオプション
- * - assert: テストの期待値
- * - exception: Exception
- * - return: testActionの実行後の結果
- *
- * @return array
- */
- public function dataProviderEditGet() {
- $data = $this->__getData();
-
- $results = array();
-
- //ログインなし
- $results[0] = array(
- 'urlOptions' => array('frame_id' => $data['Frame']['id'], 'block_id' => $data['Block']['id'], 'action' => $this->_myAction, 'key' => 'registration_42'),
- 'assert' => null, 'exception' => 'ForbiddenException'
- );
- return $results;
- }
-
-/**
- * editアクションのGETテスト(作成権限のみ)用DataProvider
- *
- * ### 戻り値
- * - urlOptions: URLオプション
- * - assert: テストの期待値
- * - exception: Exception
- * - return: testActionの実行後の結果
- *
- * @return array
- */
- public function dataProviderEditGetByCreatable() {
- $data = $this->__getData();
-
- $results = array();
-
- //作成権限のみ
- //--他人の記事の編集
- $results[0] = array(
- 'urlOptions' => array('frame_id' => $data['Frame']['id'], 'block_id' => $data['Block']['id'], 'action' => $this->_myAction, 'key' => 'registration_42'),
- 'assert' => null,
- 'exception' => 'BadRequestException'
- );
- //--自分の記事の編集(一度も公開していない)
- $results[1] = array(
- 'urlOptions' => array('frame_id' => $data['Frame']['id'], 'block_id' => $data['Block']['id'], 'action' => $this->_myAction, 'key' => 'registration_44'),
- 'assert' => array('method' => 'assertNotEmpty'),
- );
- // 存在してない登録フォームを指定
- $results[2] = array(
- 'urlOptions' => array('frame_id' => $data['Frame']['id'], 'block_id' => $data['Block']['id'], 'action' => $this->_myAction, 'key' => 'registration_99999'),
- 'assert' => null, 'exception' => 'BadRequestException', 'return' => 'json'
- );
- //新規作成
- $results[3] = array(
- 'urlOptions' => array('frame_id' => $data['Frame']['id'], 'block_id' => $data['Block']['id'], 'action' => $this->_myAction, 's_id' => 'testSession'),
- 'assert' => array('method' => 'assertNotEmpty'),
- );
- //--自分の記事の編集(公開すみ)
- $results[4] = array(
- 'urlOptions' => array('frame_id' => $data['Frame']['id'], 'block_id' => $data['Block']['id'], 'action' => $this->_myAction, 'key' => 'registration_51'),
- 'assert' => array('method' => 'assertNotEmpty'),
- );
- //--自分の記事の編集(一度も公開していない)
- $results[1] = array(
- 'urlOptions' => array('frame_id' => $data['Frame']['id'], 'block_id' => $data['Block']['id'], 'action' => $this->_myAction, 'key' => 'registration_44'),
- 'assert' => array('method' => 'assertInput', 'type' => 'input', 'name' => '_method', 'value' => 'DELETE'),
- );
- return $results;
- }
-
-/**
- * editアクションのGETテスト(編集権限、公開権限なし)用DataProvider
- *
- * ### 戻り値
- * - urlOptions: URLオプション
- * - assert: テストの期待値
- * - exception: Exception
- * - return: testActionの実行後の結果
- *
- * @return array
- */
- public function dataProviderEditGetByEditable() {
- $data = $this->__getData();
- $base = 0;
- $results = array();
-
- //編集権限あり
- //--コンテンツあり 自分の記事(編集できるコンテンツ
- $results[0] = array(
- 'urlOptions' => array('frame_id' => $data['Frame']['id'], 'block_id' => $data['Block']['id'], 'action' => $this->_myAction, 'key' => 'registration_42'),
- 'assert' => array('method' => 'assertNotEmpty'),
- );
- /* 本来はここで表示ページの要素の妥当性をチェックするのだと思われるが
- * 登録フォームはAngularでページ要素を展開しているため、NetCommons通常テスト確認メソッドが使えない
- * ごく一部に限って確認を行うことにする
- */
-
- // ページタブ,ページ追加リンク,項目追加ボタン,項目LI、項目種別選択,項目削除ボタン, 選択肢追加ボタン, 選択肢削除ボタン、キャンセルボタン、次へボタンの存在の確認
- array_push($results, Hash::merge($results[$base], array(
- 'assert' => array('method' => 'assertInput', 'type' => 'input', 'name' => 'data[Registration][title]', 'value' => null),
- )));
- //array_push($results, Hash::merge($results[$base], array(
- // 'assert' => array('method' => 'assertInput', 'type' => 'input', 'name' => 'data[Registration][answer_timing]', 'value' => null),
- //)));
- //array_push($results, Hash::merge($results[$base], array(
- // 'assert' => array('method' => 'assertInput', 'type' => 'input', 'name' => 'data[Registration][total_show_timing]', 'value' => null),
- //)));
- //array_push($results, Hash::merge($results[$base], array(
- // 'assert' => array('method' => 'assertInput', 'type' => 'input', 'name' => 'data[Registration][is_no_member_allow]', 'value' => null),
- //)));
- array_push($results, Hash::merge($results[$base], array(
- 'assert' => array('method' => 'assertInput', 'type' => 'input', 'name' => 'data[Registration][is_key_pass_use]', 'value' => null),
- )));
- array_push($results, Hash::merge($results[$base], array(
- 'assert' => array('method' => 'assertInput', 'type' => 'input', 'name' => 'data[Registration][is_image_authentication]', 'value' => null),
- )));
- //array_push($results, Hash::merge($results[$base], array(
- // 'assert' => array('method' => 'assertInput', 'type' => 'input', 'name' => 'data[Registration][is_repeat_allow]', 'value' => null),
- //)));
- //array_push($results, Hash::merge($results[$base], array(
- // 'assert' => array('method' => 'assertInput', 'type' => 'input', 'name' => 'data[Registration][is_anonymity]', 'value' => null),
- //)));
- array_push($results, Hash::merge($results[$base], array(
- 'assert' => array('method' => 'assertInput', 'type' => 'textarea', 'name' => 'data[Registration][thanks_content]', 'value' => null),
- )));
- array_push($results, Hash::merge($results[$base], array(
- 'assert' => array('method' => 'assertInput', 'type' => 'button', 'name' => 'save_' . WorkflowComponent::STATUS_IN_DRAFT, 'value' => null),
- )));
- array_push($results, Hash::merge($results[$base], array(
- 'assert' => array('method' => 'assertInput', 'type' => 'button', 'name' => 'save_' . WorkflowComponent::STATUS_APPROVAL_WAITING, 'value' => null),
- )));
-
- //--コンテンツなし...編集対象データを指定せずに編集画面へ行くと不正リクエストエラー
- $results[count($results)] = array(
- 'urlOptions' => array('frame_id' => '14', 'block_id' => null, 'action' => $this->_myAction, 'key' => null),
- 'assert' => null,
- 'exception' => 'BadRequestException'
- );
-
- return $results;
- }
-
-/**
- * editアクションのGETテスト(公開権限あり)用DataProvider
- *
- * ### 戻り値
- * - urlOptions: URLオプション
- * - assert: テストの期待値
- * - exception: Exception
- * - return: testActionの実行後の結果
- *
- * @return array
- */
- public function dataProviderEditGetByPublishable() {
- $data = $this->__getData();
- $results = array();
-
- //フレームID指定なしテスト
- $results[0] = array(
- 'urlOptions' => array('frame_id' => null, 'block_id' => $data['Block']['id'], 'action' => $this->_myAction, 'key' => 'registration_2'),
- 'assert' => array('method' => 'assertNotEmpty'),
- );
- //フレームID指定なしでも画面の内容がちゃんと表示されていることを確認している
- array_push($results, Hash::merge($results[0], array(
- 'urlOptions' => array('frame_id' => null, 'block_id' => $data['Block']['id'], 'action' => $this->_myAction, 'key' => 'registration_2'),
- 'assert' => array('method' => 'assertInput', 'type' => 'input', 'name' => 'data[Frame][id]', 'value' => null),
- )));
- // いったん公開して、その後の一時保存データに対して編集している
- array_push($results, Hash::merge($results[0], array(
- 'urlOptions' => array('frame_id' => null, 'block_id' => $data['Block']['id'], 'action' => $this->_myAction, 'key' => 'registration_2'),
- 'assert' => array('method' => 'assertInput', 'type' => 'input', 'name' => '_method', 'value' => 'DELETE'),
- )));
-
- return $results;
- }
-
-/**
- * editアクションのPOSTテスト用DataProvider
- *
- * ### 戻り値
- * - data: 登録データ
- * - role: ロール
- * - urlOptions: URLオプション
- * - exception: Exception
- * - return: testActionの実行後の結果
- *
- * @return array
- */
- public function dataProviderEditPost() {
- $data = $this->__getData();
- return array(
- //ログインなし
- array(
- 'data' => $data, 'role' => null,
- 'urlOptions' => array('frame_id' => $data['Frame']['id'], 'block_id' => $data['Block']['id'], 'action' => $this->_myAction, 'key' => 'registration_44'),
- 'exception' => 'ForbiddenException'
- ),
- //作成権限のみ
- //--他人の記事
- array(
- 'data' => $data, 'role' => Role::ROOM_ROLE_KEY_GENERAL_USER,
- 'urlOptions' => array('frame_id' => $data['Frame']['id'], 'block_id' => $data['Block']['id'], 'key' => 'registration_40'),
- 'exception' => 'BadRequestException'
- ),
- array(
- 'data' => $data, 'role' => Role::ROOM_ROLE_KEY_EDITOR,
- 'urlOptions' => array('frame_id' => $data['Frame']['id'], 'block_id' => $data['Block']['id'], 'key' => 'registration_40'),
- 'exception' => 'BadRequestException', 'return' => 'json'
- ),
- // --自分の記事(一度も公開していない)
- array(
- //'data' => $this->__getData('registration_44'), 'role' => Role::ROOM_ROLE_KEY_GENERAL_USER,
- 'data' => $this->__getData('registration_44', ['Registration' => ['modified_user' => '4']]), 'role' => Role::ROOM_ROLE_KEY_GENERAL_USER,
- 'urlOptions' => array('frame_id' => $data['Frame']['id'], 'block_id' => $data['Block']['id'], 'action' => $this->_myAction, 's_id' => 'testSession'),
- ),
- //--自分の記事(公開)
- array(
- 'data' => $this->__getData('registration_12', ['Registration' => ['modified_user' => '4']]), 'role' => Role::ROOM_ROLE_KEY_GENERAL_USER,
- 'urlOptions' => array('frame_id' => $data['Frame']['id'], 'block_id' => $data['Block']['id'], 'action' => $this->_myAction, 's_id' => 'testSession'),
- ),
- //編集権限あり
- //--新規作成
- array(
- 'data' => Hash::merge($data, ['Registration' => ['created_user' => '4', 'modified_user' => '4']]), 'role' => Role::ROOM_ROLE_KEY_EDITOR,
- 'urlOptions' => array('frame_id' => $data['Frame']['id'], 'block_id' => $data['Block']['id'], 'action' => $this->_myAction, 's_id' => 'testSession'),
- ),
- //フレームID指定なし 新規作成テスト
- array(
- 'data' => Hash::merge($data, ['Registration' => ['created_user' => '4', 'modified_user' => '4']]), 'role' => Role::ROOM_ROLE_KEY_ROOM_ADMINISTRATOR,
- 'urlOptions' => array('frame_id' => null, 'block_id' => $data['Block']['id'], 'action' => $this->_myAction, 's_id' => 'testSession'),
- ),
- //--自分の記事(公開)
- array(
- 'data' => $this->__getData('registration_4', ['Registration' => ['modified_user' => '4']]), 'role' => Role::ROOM_ROLE_KEY_ROOM_ADMINISTRATOR,
- 'urlOptions' => array('frame_id' => $data['Frame']['id'], 'block_id' => $data['Block']['id'], 'action' => $this->_myAction, 's_id' => 'testSession'),
- ),
- );
- }
-
-/**
- * editアクションのValidationErrorテスト用DataProvider
- *
- * ### 戻り値
- * - data: 登録データ
- * - urlOptions: URLオプション
- * - validationError: バリデーションエラー
- *
- * @return array
- */
- public function dataProviderEditValidationError() {
- $data = $this->__getData();
- $dataPeriodOn = Hash::merge($data, array('Registration' => array('answer_timing' => '1')));
- //$dataPeriodOn2 = Hash::merge($data, array('Registration' => array('total_show_timing' => '1')));
-
- $result = array(
- 'data' => $data,
- 'urlOptions' => array('frame_id' => $data['Frame']['id'], 'block_id' => $data['Block']['id'], 'action' => $this->_myAction, 's_id' => 'testSession'),
- );
- $resultPeriodOn = array(
- 'data' => $dataPeriodOn,
- 'urlOptions' => array('frame_id' => $data['Frame']['id'], 'block_id' => $data['Block']['id'], 'action' => $this->_myAction, 's_id' => 'testSession'),
- );
- //$resultPeriodOn2 = array(
- // 'data' => $dataPeriodOn2,
- // 'urlOptions' => array('frame_id' => $data['Frame']['id'], 'block_id' => $data['Block']['id'], 'action' => $this->_myAction, 's_id' => 'testSession'),
- //);
-
- return array(
- Hash::merge($result, array(
- 'validationError' => array(
- 'field' => 'Registration.title',
- 'value' => '',
- 'message' => sprintf(__d('net_commons', 'Please input %s.'), __d('registrations', 'Title')),
- )
- )),
- //Hash::merge($result, array(
- // 'validationError' => array(
- // 'field' => 'Registration.answer_timing',
- // 'value' => 'aa',
- // 'message' => __d('net_commons', 'Invalid request.'),
- // )
- //)),
- Hash::merge($resultPeriodOn, array(
- 'validationError' => array(
- 'field' => 'Registration.answer_start_period',
- 'value' => '2019-08-01 00:00:00',
- 'message' => __d('registrations', 'start period must be smaller than end period'),
- )
- )),
- Hash::merge($resultPeriodOn, array(
- 'validationError' => array(
- 'field' => 'Registration.answer_end_period',
- 'value' => '2015-08-01 00:00:00',
- 'message' => __d('registrations', 'start period must be smaller than end period'),
- )
- )),
- //Hash::merge($result, array(
- // 'validationError' => array(
- // 'field' => 'Registration.total_show_timing',
- // 'value' => 'aa',
- // 'message' => __d('net_commons', 'Invalid request.'),
- // )
- //)),
- //5
- //Hash::merge($resultPeriodOn2, array(
- // 'validationError' => array(
- // 'field' => 'Registration.total_show_start_period',
- // 'value' => '',
- // 'message' => __d('registrations', 'if you set the period, please set time.'),
- // )
- //)),
- //Hash::merge($result, array(
- // 'validationError' => array(
- // 'field' => 'Registration.is_no_member_allow',
- // 'value' => 'aa',
- // 'message' => __d('net_commons', 'Invalid request.'),
- // )
- //)),
- //Hash::merge($result, array(
- // 'validationError' => array(
- // 'field' => 'Registration.is_anonymity',
- // 'value' => 'aa',
- // 'message' => __d('net_commons', 'Invalid request.'),
- // )
- //)),
- Hash::merge($result, array(
- 'validationError' => array(
- 'field' => 'Registration.is_key_pass_use',
- 'value' => 'aa',
- 'message' => __d('net_commons', 'Invalid request.'),
- )
- )),
- //Hash::merge($result, array(
- // 'validationError' => array(
- // 'field' => 'Registration.is_repeat_allow',
- // 'value' => 'aa',
- // 'message' => __d('net_commons', 'Invalid request.'),
- // )
- //)),
- Hash::merge($result, array(
- 'validationError' => array(
- 'field' => 'Registration.is_image_authentication',
- 'value' => 'aa',
- 'message' => __d('net_commons', 'Invalid request.'),
- )
- )),
- );
- }
-}
\ No newline at end of file
diff --git a/Test/Case/Controller/RegistrationMailSettingCntroller/EditTest.php b/Test/Case/Controller/RegistrationMailSettingCntroller/EditTest.php
deleted file mode 100644
index 0e7718a..0000000
--- a/Test/Case/Controller/RegistrationMailSettingCntroller/EditTest.php
+++ /dev/null
@@ -1,90 +0,0 @@
-
- * @author Mitsuru Mutaguchi
- * @author AllCreator
- * @link http://www.netcommons.org NetCommons Project
- * @license http://www.netcommons.org/license.txt NetCommons License
- * @copyright Copyright 2014, NetCommons Project
- */
-
-App::uses('NetCommonsControllerTestCase', 'NetCommons.TestSuite');
-
-/**
- * RegistrationMailSettingsController::edit()のテスト
- *
- * @author Mitsuru Mutaguchi
- * @author AllCreator
- * @package NetCommons\Registrations\Test\Case\Controller\RegistrationMailSettingsController
- */
-class RegistrationMailSettingsControllerEditTest extends NetCommonsControllerTestCase {
-
-/**
- * Fixtures
- *
- * @var array
- */
- public $fixtures = array(
- 'plugin.mails.mail_setting',
- 'plugin.mails.mail_setting_fixed_phrase',
- );
-
-/**
- * Plugin name
- *
- * @var string
- */
- public $plugin = 'registrations';
-
-/**
- * Controller name
- *
- * @var string
- */
- protected $_controller = 'registration_mail_settings';
-
-/**
- * setUp method
- *
- * @return void
- */
- public function setUp() {
- parent::setUp();
-
- //ログイン
- TestAuthGeneral::login($this);
- }
-
-/**
- * tearDown method
- *
- * @return void
- */
- public function tearDown() {
- //ログアウト
- TestAuthGeneral::logout($this);
-
- parent::tearDown();
- }
-
-/**
- * edit()アクションのGetリクエストテスト
- *
- * @return void
- */
- public function testEditGet() {
- //テストデータ
- $frameId = '6';
- $blockId = '2';
-
- //テスト実行
- $this->_testGetAction(array('action' => 'edit', 'block_id' => $blockId, 'frame_id' => $frameId),
- array('method' => 'assertNotEmpty'), null, 'view');
-
- //チェック
- $this->assertInput('form', null, 'registrations/registration_mail_settings/edit/' . $blockId, $this->view);
- }
-
-}
diff --git a/Test/Case/Controller/RegistrationsController/IndexTest.php b/Test/Case/Controller/RegistrationsController/IndexTest.php
index 5f61506..97c6781 100644
--- a/Test/Case/Controller/RegistrationsController/IndexTest.php
+++ b/Test/Case/Controller/RegistrationsController/IndexTest.php
@@ -27,7 +27,9 @@ class RegistrationsControllerIndexTest extends WorkflowControllerIndexTest {
*/
public $fixtures = array(
'plugin.registrations.registration',
- 'plugin.registrations.block_setting_for_registration',
+ 'plugin.registrations.registration_setting',
+ 'plugin.registrations.registration_frame_setting',
+ 'plugin.registrations.registration_frame_display_registration',
'plugin.registrations.registration_page',
'plugin.registrations.registration_question',
'plugin.registrations.registration_choice',
@@ -100,7 +102,51 @@ public function dataProviderIndex() {
//ソート、表示件数指定なし
$results[0] = array(
'urlOptions' => array('frame_id' => $data['Frame']['id']),
- 'assert' => array('method' => 'assertNull'),
+ 'assert' => array('method' => 'assertNotEmpty'),
+ );
+ // ログイン無しでテストモードは0になる 画面には"no registration"のテキストが現れていること
+ $results[1] = array(
+ 'urlOptions' => array('frame_id' => $data['Frame']['id'], 'answer_status' => 'test'),
+ 'assert' => array('method' => 'assertContains', 'expected' => __d('registrations', 'no registration')),
+ );
+ // ログイン無しで未登録は全て出てくる 画面には何らかの表示が現れていること
+ $results[2] = array(
+ 'urlOptions' => array('frame_id' => $data['Frame']['id'], 'answer_status' => 'unanswered'),
+ 'assert' => array('method' => 'assertNotEmpty'),
+ );
+ // ログイン無しで登録済は0になる 画面には"no registration"のテキストが現れていること
+ $results[3] = array(
+ 'urlOptions' => array('frame_id' => $data['Frame']['id'], 'answer_status' => 'answered'),
+ 'assert' => array('method' => 'assertContains', 'expected' => __d('registrations', 'no registration')),
+ );
+ // 表示件数を増やすことでFixtureデータをすべて表示させる
+ // そのうえで試験を行う
+ // 未ログインでも公開中なら見える
+ $results[4] = array(
+ 'urlOptions' => array('frame_id' => $data['Frame']['id'], 'block_id' => $data['Block']['id'], 'action' => 'index', 'limit' => 50),
+ 'assert' => array('method' => 'assertActionLink', 'action' => 'view', 'linkExist' => true, 'url' => array('controller' => 'registration_answers', 'key' => 'registration_2', 'limit' => null)),
+ );
+ // 未ログインの場合は一時保存が見えない
+ $results[5] = array(
+ 'urlOptions' => array('frame_id' => $data['Frame']['id'], 'block_id' => $data['Block']['id'], 'action' => 'index', 'limit' => 50),
+ 'assert' => array('method' => 'assertActionLink', 'action' => 'view', 'linkExist' => false, 'url' => array('controller' => 'registration_answers', 'key' => 'registration_42', 'limit' => null)),
+ );
+ // 未ログインの場合は未来公開が見えない
+ $results[6] = array(
+ 'urlOptions' => array('frame_id' => $data['Frame']['id'], 'block_id' => $data['Block']['id'], 'action' => 'index', 'limit' => 50),
+ 'assert' => array('method' => 'assertActionLink', 'action' => 'view', 'linkExist' => false, 'url' => array('controller' => 'registration_answers', 'key' => 'registration_18', 'limit' => null)),
+ );
+ // 未ログインの場合は過去公開は見えない。。。Workflowの共通処理に任せることになるので編集権限なければ出ない
+ $results[7] = array(
+ 'urlOptions' => array('frame_id' => $data['Frame']['id'], 'block_id' => $data['Block']['id'], 'action' => 'index', 'limit' => 50),
+ 'assert' => array('method' => 'assertActionLink', 'action' => 'view', 'linkExist' => false, 'url' => array('controller' => 'registration_answers', 'key' => 'registration_24', 'limit' => null)),
+ );
+
+ //チェック
+ //--追加ボタンチェック(なし)
+ $results[8] = array(
+ 'urlOptions' => array('frame_id' => $data['Frame']['id'], 'block_id' => $data['Block']['id']),
+ 'assert' => array('method' => 'assertActionLink', 'action' => 'add', 'linkExist' => false, 'url' => array('controller' => 'registration_add')),
);
return $results;
@@ -138,6 +184,36 @@ public function dataProviderIndexByEditable() {
'urlOptions' => array('frame_id' => '14', 'block_id' => null),
'assert' => array('method' => 'assertContains', 'expected' => __d('registrations', 'no registration'))
)));
+ //記事なしテスト
+ array_push($results, Hash::merge($results[$base], array(
+ 'urlOptions' => array('frame_id' => null, 'block_id' => '6'),
+ 'assert' => array('method' => 'assertContains', 'expected' => __d('registrations', 'no registration'))
+ )));
+ //フレームID指定なしテスト
+ array_push($results, Hash::merge($results[$base], array(
+ 'urlOptions' => array('frame_id' => null, 'block_id' => $data['Block']['id']),
+ )));
+ // 公開中なら見える
+ array_push($results, Hash::merge($results[$base], array(
+ 'urlOptions' => array('action' => 'index', 'limit' => 50),
+ 'assert' => array('method' => 'assertActionLink', 'action' => 'view', 'linkExist' => true, 'url' => array('controller' => 'registration_answers', 'key' => 'registration_4', 'limit' => null))
+ )));
+ // 一時保存も見える
+ array_push($results, Hash::merge($results[$base], array(
+ 'urlOptions' => array('action' => 'index', 'limit' => 50),
+ 'assert' => array('method' => 'assertActionLink', 'action' => 'test_mode', 'linkExist' => true, 'url' => array('controller' => 'registration_answers', 'key' => 'registration_42', 'limit' => null))
+ )));
+ // 未来も見える
+ array_push($results, Hash::merge($results[$base], array(
+ 'urlOptions' => array('action' => 'index', 'limit' => 50),
+ 'assert' => array('method' => 'assertActionLink', 'action' => 'view', 'linkExist' => true, 'url' => array('controller' => 'registration_answers', 'key' => 'registration_18', 'limit' => null))
+ )));
+ // 過去も見える
+ array_push($results, Hash::merge($results[$base], array(
+ 'urlOptions' => array('action' => 'index', 'limit' => 50),
+ 'assert' => array('method' => 'assertActionLink', 'action' => 'view', 'linkExist' => true, 'url' => array('controller' => 'registration_answers', 'key' => 'registration_24', 'limit' => null))
+ )));
+
return $results;
}
@@ -173,9 +249,172 @@ public function dataProviderIndexByCreatable() {
'urlOptions' => array('frame_id' => null, 'block_id' => $data['Block']['id']),
'assert' => array('method' => 'assertNotEmpty'),
)));
+ // 公開中なら見える
+ array_push($results, Hash::merge($results[$base], array(
+ 'urlOptions' => array('action' => 'index', 'limit' => 50),
+ 'assert' => array('method' => 'assertActionLink', 'action' => 'view', 'linkExist' => true, 'url' => array('controller' => 'registration_answers', 'key' => 'registration_4', 'limit' => null))
+ )));
+ // 自分のなら承認待ちも見える
+ array_push($results, Hash::merge($results[$base], array(
+ 'urlOptions' => array('action' => 'index', 'limit' => 50),
+ 'assert' => array('method' => 'assertActionLink', 'action' => 'test_mode', 'linkExist' => true, 'url' => array('controller' => 'registration_answers', 'key' => 'registration_28', 'limit' => null))
+ )));
+ // 自分のなら差し戻しも見える
+ array_push($results, Hash::merge($results[$base], array(
+ 'urlOptions' => array('action' => 'index', 'limit' => 50),
+ 'assert' => array('method' => 'assertActionLink', 'action' => 'test_mode', 'linkExist' => true, 'url' => array('controller' => 'registration_answers', 'key' => 'registration_10', 'limit' => null))
+ )));
+ // 自分のなら一時保存も見える
+ array_push($results, Hash::merge($results[$base], array(
+ 'urlOptions' => array('action' => 'index', 'limit' => 50),
+ 'assert' => array('method' => 'assertActionLink', 'action' => 'test_mode', 'linkExist' => true, 'url' => array('controller' => 'registration_answers', 'key' => 'registration_38', 'limit' => null))
+ )));
+ // 自分のなら未来も見える
+ array_push($results, Hash::merge($results[$base], array(
+ 'urlOptions' => array('action' => 'index', 'limit' => 50),
+ 'assert' => array('method' => 'assertActionLink', 'action' => 'view', 'linkExist' => true, 'url' => array('controller' => 'registration_answers', 'key' => 'registration_18', 'limit' => null))
+ )));
+ // 自分のなら過去も見える
+ array_push($results, Hash::merge($results[$base], array(
+ 'urlOptions' => array('action' => 'index', 'limit' => 50),
+ 'assert' => array('method' => 'assertActionLink', 'action' => 'view', 'linkExist' => true, 'url' => array('controller' => 'registration_answers', 'key' => 'registration_24', 'limit' => null))
+ )));
+
+ // 他人の承認待ちも見えない
+ array_push($results, Hash::merge($results[$base], array(
+ 'urlOptions' => array('action' => 'index', 'limit' => 50),
+ 'assert' => array('method' => 'assertActionLink', 'action' => 'test_mode', 'linkExist' => false, 'url' => array('controller' => 'registration_answers', 'key' => 'registration_26', 'limit' => null))
+ )));
+ // 他人の差し戻しも見えない
+ array_push($results, Hash::merge($results[$base], array(
+ 'urlOptions' => array('action' => 'index', 'limit' => 50),
+ 'assert' => array('method' => 'assertActionLink', 'action' => 'test_mode', 'linkExist' => false, 'url' => array('controller' => 'registration_answers', 'key' => 'registration_30', 'limit' => null))
+ )));
+ // 他人の一時保存も見えない
+ array_push($results, Hash::merge($results[$base], array(
+ 'urlOptions' => array('action' => 'index', 'limit' => 50),
+ 'assert' => array('method' => 'assertActionLink', 'action' => 'test_mode', 'linkExist' => false, 'url' => array('controller' => 'registration_answers', 'key' => 'registration_36', 'limit' => null))
+ )));
+ // 他人の未来も見えない
+ array_push($results, Hash::merge($results[$base], array(
+ 'urlOptions' => array('action' => 'index', 'limit' => 50),
+ 'assert' => array('method' => 'assertActionLink', 'action' => 'view', 'linkExist' => false, 'url' => array('controller' => 'registration_answers', 'key' => 'registration_16', 'limit' => null))
+ )));
+ // 他人の過去も見えない
+ array_push($results, Hash::merge($results[$base], array(
+ 'urlOptions' => array('action' => 'index', 'limit' => 50),
+ 'assert' => array('method' => 'assertActionLink', 'action' => 'view', 'linkExist' => false, 'url' => array('controller' => 'registration_answers', 'key' => 'registration_22', 'limit' => null))
+ )));
+
return $results;
}
+/**
+ * ページネーションDataProvider
+ *
+ * ### 戻り値
+ * - page: ページ番号
+ * - isFirst: 最初のページかどうか
+ * - isLast: 最後のページかどうか
+ *
+ * @return array
+ */
+ public function dataProviderPaginator() {
+ //$page, $isFirst, $isLast
+ $data = array(
+ array(1, true, false),
+ array(3, false, false),
+ array(23, false, true),
+ );
+ return $data;
+ }
+
+/**
+ * index()のページネーションテスト
+ *
+ * @param int $page ページ番号
+ * @param bool $isFirst 最初のページかどうか
+ * @param bool $isLast 最後のページかどうか
+ * @dataProvider dataProviderPaginator
+ * @return void
+ */
+ public function testIndexPaginator($page, $isFirst, $isLast) {
+ TestAuthGeneral::login($this);
+
+ //テスト実施
+ $frameId = '6';
+ $blockId = '2';
+ $url = array(
+ 'plugin' => $this->plugin,
+ 'controller' => $this->_controller,
+ 'action' => 'index',
+ $blockId,
+ 'frame_id' => $frameId,
+ 'limit' => '1',
+ );
+ if (! $isFirst) {
+ $url['page'] = $page;
+ }
+ $result = $this->_testNcAction($url, array('method' => 'get'));
+
+ //チェック
+ $this->assertRegExp(
+ '/' . preg_quote('