From 0559467f1709080681aa184df6386a57a2adff43 Mon Sep 17 00:00:00 2001
From: RyujiAMANO
Date: Fri, 13 Jan 2017 22:26:45 +0900
Subject: [PATCH 1/7] bake plugin
---
Config/Schema/empty | 0
Console/Command/Task/empty | 0
Console/Templates/empty | 0
Controller/Component/empty | 0
Controller/ReservationsAppController.php | 7 +++++++
Lib/empty | 0
Locale/eng/LC_MESSAGES/empty | 0
Model/Behavior/empty | 0
Model/Datasource/empty | 0
Model/ReservationsAppModel.php | 7 +++++++
Test/Case/Controller/Component/empty | 0
Test/Case/Lib/empty | 0
Test/Case/Model/Behavior/empty | 0
Test/Case/Model/Datasource/empty | 0
Test/Case/View/Helper/empty | 0
Test/Fixture/empty | 0
View/Elements/empty | 0
View/Helper/empty | 0
View/Layouts/empty | 0
webroot/css/empty | 0
webroot/img/empty | 0
webroot/js/empty | 0
22 files changed, 14 insertions(+)
create mode 100644 Config/Schema/empty
create mode 100644 Console/Command/Task/empty
create mode 100644 Console/Templates/empty
create mode 100644 Controller/Component/empty
create mode 100644 Controller/ReservationsAppController.php
create mode 100644 Lib/empty
create mode 100644 Locale/eng/LC_MESSAGES/empty
create mode 100644 Model/Behavior/empty
create mode 100644 Model/Datasource/empty
create mode 100644 Model/ReservationsAppModel.php
create mode 100644 Test/Case/Controller/Component/empty
create mode 100644 Test/Case/Lib/empty
create mode 100644 Test/Case/Model/Behavior/empty
create mode 100644 Test/Case/Model/Datasource/empty
create mode 100644 Test/Case/View/Helper/empty
create mode 100644 Test/Fixture/empty
create mode 100644 View/Elements/empty
create mode 100644 View/Helper/empty
create mode 100644 View/Layouts/empty
create mode 100644 webroot/css/empty
create mode 100644 webroot/img/empty
create mode 100644 webroot/js/empty
diff --git a/Config/Schema/empty b/Config/Schema/empty
new file mode 100644
index 0000000..e69de29
diff --git a/Console/Command/Task/empty b/Console/Command/Task/empty
new file mode 100644
index 0000000..e69de29
diff --git a/Console/Templates/empty b/Console/Templates/empty
new file mode 100644
index 0000000..e69de29
diff --git a/Controller/Component/empty b/Controller/Component/empty
new file mode 100644
index 0000000..e69de29
diff --git a/Controller/ReservationsAppController.php b/Controller/ReservationsAppController.php
new file mode 100644
index 0000000..7c46955
--- /dev/null
+++ b/Controller/ReservationsAppController.php
@@ -0,0 +1,7 @@
+
Date: Thu, 2 Feb 2017 17:43:05 +0900
Subject: [PATCH 2/7] =?UTF-8?q?=E3=83=97=E3=83=A9=E3=82=B0=E3=82=A4?=
=?UTF-8?q?=E3=83=B3=E9=85=8D=E7=BD=AE=E7=94=A8=E3=83=9E=E3=82=A4=E3=82=B0?=
=?UTF-8?q?=E3=83=AC=E3=83=BC=E3=82=B7=E3=83=A7=E3=83=B3=E8=BF=BD=E5=8A=A0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Config/Migration/001_plugin_records.php | 139 ++++++++++++++++++++++++
1 file changed, 139 insertions(+)
create mode 100644 Config/Migration/001_plugin_records.php
diff --git a/Config/Migration/001_plugin_records.php b/Config/Migration/001_plugin_records.php
new file mode 100644
index 0000000..983b8b4
--- /dev/null
+++ b/Config/Migration/001_plugin_records.php
@@ -0,0 +1,139 @@
+
+ * @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');
+App::uses('Space', 'Rooms.Model');
+
+/**
+ * Add plugin migration
+ *
+ * @package NetCommons\PluginManager\Config\Migration
+ */
+class PluginRecords extends NetCommonsMigration {
+
+/**
+ * Migration description
+ *
+ * @var string
+ */
+ public $description = 'plugin_records';
+
+/**
+ * Actions to be performed
+ *
+ * @var array $migration
+ */
+ public $migration = array(
+ 'up' => array(),
+ 'down' => array(),
+ );
+
+/**
+ * plugin data
+ *
+ * @var array $migration
+ */
+ public $records = array(
+ 'Plugin' => array(
+ //日本語
+ array(
+ 'language_id' => '2',
+ 'is_origin' => true,
+ 'is_translation' => true,
+ 'key' => 'reservations',
+ 'namespace' => 'netcommons/reservations',
+ 'default_action' => 'reservations/index',
+ 'default_setting_action' => 'reservation_frame_settings/edit',
+ 'name' => '施設予約',
+ 'type' => 1,
+ 'display_topics' => 1,
+ 'display_search' => 1,
+ ),
+ //英語
+ array(
+ 'language_id' => '1',
+ 'is_origin' => false,
+ 'is_translation' => true,
+ 'key' => 'reservations',
+ 'namespace' => 'netcommons/reservations',
+ 'default_action' => 'reservations/index',
+ 'default_setting_action' => 'reservation_frame_settings/edit',
+ 'name' => 'RESERVATION',
+ 'type' => 1,
+ 'display_topics' => 1,
+ 'display_search' => 1,
+ ),
+ ),
+ 'PluginsRole' => array(
+ array(
+ 'role_key' => 'room_administrator',
+ 'plugin_key' => 'reservations'
+ ),
+ ),
+ //PluginsRoomは、beforeでセットする
+ );
+
+/**
+ * Before migration callback
+ *
+ * @param string $direction Direction of migration process (up or down)
+ * @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;
+ }
+
+/**
+ * After migration callback
+ *
+ * @param string $direction Direction of migration process (up or down)
+ * @return bool Should process continue
+ */
+ public function after($direction) {
+ $this->loadModels([
+ 'Plugin' => 'PluginManager.Plugin',
+ ]);
+
+ if ($direction === 'down') {
+ $this->Plugin->uninstallPlugin($this->records['Plugin'][0]['key']);
+ return true;
+ }
+
+ foreach ($this->records as $model => $records) {
+ if (!$this->updateRecords($model, $records)) {
+ return false;
+ }
+ }
+ return true;
+ }
+}
From 0f25e9b61ee1c6f4eb5f14a164d06f69fe67a3a5 Mon Sep 17 00:00:00 2001
From: RyujiAMANO
Date: Thu, 2 Feb 2017 17:43:34 +0900
Subject: [PATCH 3/7] =?UTF-8?q?=E6=9C=88=E9=96=93=E3=82=AB=E3=83=AC?=
=?UTF-8?q?=E3=83=B3=E3=83=80=E3=82=92Calendars=E3=83=97=E3=83=A9=E3=82=B0?=
=?UTF-8?q?=E3=82=A4=E3=83=B3=E3=81=AE=E3=83=98=E3=83=AB=E3=83=91=E7=AD=89?=
=?UTF-8?q?=E3=82=92=E5=88=A9=E7=94=A8=E3=81=97=E3=81=A6=E8=A1=A8=E7=A4=BA?=
=?UTF-8?q?=E3=81=99=E3=82=8B=E3=81=A8=E3=81=93=E3=82=8D=E3=81=BE=E3=81=A7?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Controller/ReservationsController.php | 67 +++++++++++++++++++
.../Controller/ReservationsControllerTest.php | 33 +++++++++
View/Reservations/index.ctp | 54 +++++++++++++++
3 files changed, 154 insertions(+)
create mode 100644 Controller/ReservationsController.php
create mode 100644 Test/Case/Controller/ReservationsControllerTest.php
create mode 100644 View/Reservations/index.ctp
diff --git a/Controller/ReservationsController.php b/Controller/ReservationsController.php
new file mode 100644
index 0000000..d806468
--- /dev/null
+++ b/Controller/ReservationsController.php
@@ -0,0 +1,67 @@
+
+* @author Your Name
+* @link http://www.netcommons.org NetCommons Project
+* @license http://www.netcommons.org/license.txt NetCommons License
+* @copyright Copyright 2014, NetCommons Project
+ */
+class ReservationsController extends ReservationsAppController {
+
+ public $helpers = [
+ 'Calendars.CalendarTurnCalendar',
+ 'Calendars.CalendarMonthly',
+ ];
+
+ public $components = [
+ 'Calendars.Calendars'
+ ];
+
+ public function index() {
+ $frameId = Current::read('Frame.id');
+ $languageId = Current::read('Language.id');
+
+ $vars['mInfo'] = [
+ 'yearOfPrevMonth' => 2017,
+ 'prevMonth' => 1,
+ 'daysInPrevMonth' => 31,
+ 'yearOfNextMonth' => 2017,
+ 'nextMonth' => 3,
+ 'daysInNextMonth' => 31,
+ 'year' => 2017,
+ 'month' => 2,
+ 'wdayOf1stDay' => 3,
+ 'daysInMonth' => 28,
+ 'wdayOfLastDay' => 2,
+ 'numOfWeek' => 5,
+ ];
+ $vars['year'] = 2017;
+ $vars['month'] = 2;
+ $vars['day'] = 1;
+ $vars['style'] = [];
+ $vars['today'] = [
+ 'year' => 2017,
+ 'month' => 02,
+ 'day' => 01,
+ 'hour' => 17,
+ 'min' => 28,
+ 'sec' => 36,
+ ];
+ $vars['plans'] = [];
+
+ App::uses('CalendarPermissiveRooms', 'Calendars.Utility');
+ $perm['roomInfos'] =[];
+ CalendarPermissiveRooms::setRoomPermRoles($perm);
+
+ $vars['holidays'] = [];
+ $this->set('frameId', $frameId);
+ $this->set('languageId', $languageId);
+ $this->set('vars', $vars);
+ }
+}
diff --git a/Test/Case/Controller/ReservationsControllerTest.php b/Test/Case/Controller/ReservationsControllerTest.php
new file mode 100644
index 0000000..996e505
--- /dev/null
+++ b/Test/Case/Controller/ReservationsControllerTest.php
@@ -0,0 +1,33 @@
+
+* @author Your Name
+* @link http://www.netcommons.org NetCommons Project
+* @license http://www.netcommons.org/license.txt NetCommons License
+* @copyright Copyright 2014, NetCommons Project
+ */
+
+App::uses('ReservationsController', 'Reservations.Controller');
+
+/**
+ * Summary for ReservationsController Test Case
+ */
+class ReservationsControllerTest extends ControllerTestCase {
+
+/**
+ * Fixtures
+ *
+ * @var array
+ */
+ public $fixtures = array(
+ 'plugin.reservations.reservation',
+ 'plugin.reservations.language',
+ 'plugin.reservations.user',
+ 'plugin.reservations.role',
+ 'plugin.reservations.user_role_setting',
+ 'plugin.reservations.users_language'
+ );
+
+}
diff --git a/View/Reservations/index.ctp b/View/Reservations/index.ctp
new file mode 100644
index 0000000..031e2ed
--- /dev/null
+++ b/View/Reservations/index.ctp
@@ -0,0 +1,54 @@
+
+
+
+ * @author Allcreator
+ * @link http://www.netcommons.org NetCommons Project
+ * @license http://www.netcommons.org/license.txt NetCommons License
+ * @copyright Copyright 2014, NetCommons Project
+ */
+echo $this->element('Calendars.scripts');
+?>
+
+ element('Calendars.Calendars/calendar_tabs', array('active' => 'lmonthly', 'frameId' => $frameId, 'languageId' => $languageId));
+ ?>
+ CalendarTurnCalendar->getTurnCalendarOperationsWrap('month', 'top', $vars); ?>
+
+
+
+
+
+ | |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+ CalendarMonthly->makeLargeMonthyBodyHtml($vars); ?>
+ CalendarMonthly->getLineData() ?>
+
+
+
+
+
+
+ CalendarTurnCalendar->getTurnCalendarOperationsWrap('month', 'bottom', $vars); ?>
+
+ CalendarLegend->getCalendarLegend($vars);
+ ?>
+
+ CalendarUrl->getBackFirstButton($vars); ?>
+
+
From fee325771fcad8c9b2efeadecc6e1dcc91f48d86 Mon Sep 17 00:00:00 2001
From: RyujiAMANO
Date: Sun, 19 Feb 2017 00:36:54 +0900
Subject: [PATCH 4/7] Bake Reservation model
---
Model/Reservation.php | 276 ++++++++++++++++++++++++++++
Test/Case/Model/ReservationTest.php | 57 ++++++
Test/Fixture/ReservationFixture.php | 96 ++++++++++
3 files changed, 429 insertions(+)
create mode 100644 Model/Reservation.php
create mode 100644 Test/Case/Model/ReservationTest.php
create mode 100644 Test/Fixture/ReservationFixture.php
diff --git a/Model/Reservation.php b/Model/Reservation.php
new file mode 100644
index 0000000..d95e38a
--- /dev/null
+++ b/Model/Reservation.php
@@ -0,0 +1,276 @@
+
+* @author Your Name
+* @link http://www.netcommons.org NetCommons Project
+* @license http://www.netcommons.org/license.txt NetCommons License
+* @copyright Copyright 2014, NetCommons Project
+ */
+
+App::uses('ReservationsAppModel', 'Reservations.Model');
+
+/**
+ * Summary for Reservation Model
+ */
+class Reservation extends ReservationsAppModel {
+
+/**
+ * Use database config
+ *
+ * @var string
+ */
+ public $useDbConfig = 'master';
+
+/**
+ * Validation rules
+ *
+ * @var array
+ */
+ public $validate = array(
+ '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
+ ),
+ ),
+ 'room_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
+ ),
+ ),
+ 'language_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
+ ),
+ ),
+ 'is_origin' => array(
+ 'boolean' => array(
+ 'rule' => array('boolean'),
+ //'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
+ ),
+ ),
+ 'is_translation' => array(
+ 'boolean' => array(
+ 'rule' => array('boolean'),
+ //'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
+ ),
+ ),
+ 'is_original_copy' => array(
+ 'boolean' => array(
+ 'rule' => array('boolean'),
+ //'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
+ ),
+ ),
+ 'location_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
+ ),
+ ),
+ 'calendar_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
+ ),
+ ),
+ 'title' => 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
+ ),
+ ),
+ 'title_icon' => 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
+ ),
+ ),
+ 'start_date' => 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
+ ),
+ ),
+ 'start_time' => 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
+ ),
+ ),
+ 'dtstart' => 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
+ ),
+ ),
+ 'end_date' => 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
+ ),
+ ),
+ 'end_time' => 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
+ ),
+ ),
+ 'dtend' => 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
+ ),
+ ),
+ 'timezone_offset' => 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
+ ),
+ ),
+ 'status' => 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
+ ),
+ ),
+ 'is_active' => array(
+ 'boolean' => array(
+ 'rule' => array('boolean'),
+ //'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
+ ),
+ ),
+ 'is_latest' => array(
+ 'boolean' => array(
+ 'rule' => array('boolean'),
+ //'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
+ ),
+ ),
+ );
+
+ //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(
+ 'Room' => array(
+ 'className' => 'Room',
+ 'foreignKey' => 'room_id',
+ 'conditions' => '',
+ 'fields' => '',
+ 'order' => ''
+ ),
+ 'Language' => array(
+ 'className' => 'Language',
+ 'foreignKey' => 'language_id',
+ 'conditions' => '',
+ 'fields' => '',
+ 'order' => ''
+ ),
+ 'Location' => array(
+ 'className' => 'Location',
+ 'foreignKey' => 'location_id',
+ 'conditions' => '',
+ 'fields' => '',
+ 'order' => ''
+ ),
+ 'Calendar' => array(
+ 'className' => 'Calendar',
+ 'foreignKey' => 'calendar_id',
+ 'conditions' => '',
+ 'fields' => '',
+ 'order' => ''
+ )
+ );
+}
diff --git a/Test/Case/Model/ReservationTest.php b/Test/Case/Model/ReservationTest.php
new file mode 100644
index 0000000..561c649
--- /dev/null
+++ b/Test/Case/Model/ReservationTest.php
@@ -0,0 +1,57 @@
+
+* @author Your Name
+* @link http://www.netcommons.org NetCommons Project
+* @license http://www.netcommons.org/license.txt NetCommons License
+* @copyright Copyright 2014, NetCommons Project
+ */
+
+App::uses('Reservation', 'Reservations.Model');
+
+/**
+ * Summary for Reservation Test Case
+ */
+class ReservationTest extends CakeTestCase {
+
+/**
+ * Fixtures
+ *
+ * @var array
+ */
+ public $fixtures = array(
+ 'plugin.reservations.reservation',
+ 'plugin.reservations.room',
+ 'plugin.reservations.user',
+ 'plugin.reservations.role',
+ 'plugin.reservations.user_role_setting',
+ 'plugin.reservations.users_language',
+ 'plugin.reservations.language',
+ 'plugin.reservations.location',
+ 'plugin.reservations.calendar'
+ );
+
+/**
+ * setUp method
+ *
+ * @return void
+ */
+ public function setUp() {
+ parent::setUp();
+ $this->Reservation = ClassRegistry::init('Reservations.Reservation');
+ }
+
+/**
+ * tearDown method
+ *
+ * @return void
+ */
+ public function tearDown() {
+ unset($this->Reservation);
+
+ parent::tearDown();
+ }
+
+}
diff --git a/Test/Fixture/ReservationFixture.php b/Test/Fixture/ReservationFixture.php
new file mode 100644
index 0000000..4c23211
--- /dev/null
+++ b/Test/Fixture/ReservationFixture.php
@@ -0,0 +1,96 @@
+
+* @author Your Name
+* @link http://www.netcommons.org NetCommons Project
+* @license http://www.netcommons.org/license.txt NetCommons License
+* @copyright Copyright 2014, NetCommons Project
+ */
+
+/**
+ * Summary for ReservationFixture
+ */
+class ReservationFixture extends CakeTestFixture {
+
+/**
+ * Fields
+ *
+ * @var array
+ */
+ public $fields = array(
+ 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => true, 'key' => 'primary'),
+ 'key' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => 'イベントKey', 'charset' => 'utf8'),
+ 'room_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'index', 'comment' => 'ルームID'),
+ 'language_id' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => 6, 'unsigned' => false, 'comment' => '言語ID'),
+ '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' => 'オリジナルのコピー。言語を新たに追加したときに使用する'),
+ 'location_id' => array('type' => 'integer', 'null' => false, 'default' => '0', 'unsigned' => true, 'key' => 'index'),
+ 'calendar_id' => array('type' => 'integer', 'null' => false, 'default' => '0', 'unsigned' => true),
+ 'title' => array('type' => 'string', 'null' => false, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
+ 'title_icon' => array('type' => 'string', 'null' => false, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
+ 'is_allday' => array('type' => 'boolean', 'null' => true, 'default' => '1', 'comment' => '終日かどうか | 0:終日ではない | 1:終日'),
+ 'start_date' => array('type' => 'string', 'null' => false, 'default' => null, 'length' => 8, 'collate' => 'utf8_general_ci', 'comment' => '開始日 (YYYYMMDD形式)', 'charset' => 'utf8'),
+ 'start_time' => array('type' => 'string', 'null' => false, 'default' => null, 'length' => 6, 'collate' => 'utf8_general_ci', 'comment' => '開始時刻 (hhmmss形式)', 'charset' => 'utf8'),
+ 'dtstart' => array('type' => 'string', 'null' => false, 'default' => null, 'length' => 14, 'key' => 'index', 'collate' => 'utf8_general_ci', 'comment' => '開始日時 (YYYYMMDDhhmmss) iCalendarのDTDSTARTからTとZを外したもの', 'charset' => 'utf8'),
+ 'end_date' => array('type' => 'string', 'null' => false, 'default' => null, 'length' => 8, 'collate' => 'utf8_general_ci', 'comment' => '終了日 (YYYYMMDD形式)', 'charset' => 'utf8'),
+ 'end_time' => array('type' => 'string', 'null' => false, 'default' => null, 'length' => 6, 'collate' => 'utf8_general_ci', 'comment' => '終了時刻 (hhmmss形式)', 'charset' => 'utf8'),
+ 'dtend' => array('type' => 'string', 'null' => false, 'default' => null, 'length' => 14, 'collate' => 'utf8_general_ci', 'comment' => '終了日時 (YYYYMMDDhhmmss形式) iCalendarのDTENDからTとZをはずしたもの', 'charset' => 'utf8'),
+ 'timezone_offset' => array('type' => 'float', 'null' => false, 'default' => '0.0', 'length' => '3,1', 'unsigned' => false, 'comment' => 'タイムゾーンオフセット-12.0~+12.0'),
+ 'description' => array('type' => 'text', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => '詳細', 'charset' => 'utf8'),
+ 'status' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 4, 'unsigned' => false, 'comment' => '公開状況 1:公開中>、2:公 開申請中、3:下書き中、4:差し戻し'),
+ 'is_active' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'comment' => 'アクティブなコンテンツかどうか 0:アクティブでない 1:アクティブ'),
+ 'is_latest' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'comment' => '最新コンテンツかどうか 0:最新でない 1:最新'),
+ 'created_user' => array('type' => 'integer', 'null' => true, 'default' => '0', 'unsigned' => false, 'comment' => '作成者'),
+ 'created' => array('type' => 'datetime', 'null' => true, 'default' => null, 'comment' => '作成日時'),
+ 'modified_user' => array('type' => 'integer', 'null' => true, 'default' => '0', 'unsigned' => false, 'comment' => '更新者'),
+ 'modified' => array('type' => 'datetime', 'null' => true, 'default' => null, 'comment' => '更新日時'),
+ 'indexes' => array(
+ 'PRIMARY' => array('column' => 'id', 'unique' => 1),
+ 'location_id' => array('column' => array('location_id', 'dtstart'), 'unique' => 0),
+ 'room_id' => array('column' => array('room_id', 'location_id'), 'unique' => 0),
+ 'dt' => array('column' => array('dtstart', 'dtend'), 'unique' => 0)
+ ),
+ 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB')
+ );
+
+/**
+ * Records
+ *
+ * @var array
+ */
+ public $records = array(
+ array(
+ 'id' => 1,
+ 'key' => 'Lorem ipsum dolor sit amet',
+ 'room_id' => 1,
+ 'language_id' => 1,
+ 'is_origin' => 1,
+ 'is_translation' => 1,
+ 'is_original_copy' => 1,
+ 'location_id' => 1,
+ 'calendar_id' => 1,
+ 'title' => 'Lorem ipsum dolor sit amet',
+ 'title_icon' => 'Lorem ipsum dolor sit amet',
+ 'is_allday' => 1,
+ 'start_date' => 'Lorem ',
+ 'start_time' => 'Lore',
+ 'dtstart' => 'Lorem ipsum ',
+ 'end_date' => 'Lorem ',
+ 'end_time' => 'Lore',
+ 'dtend' => 'Lorem ipsum ',
+ 'timezone_offset' => 1,
+ 'description' => 'Lorem ipsum dolor sit amet, aliquet feugiat. Convallis morbi fringilla gravida, phasellus feugiat dapibus velit nunc, pulvinar eget sollicitudin venenatis cum nullam, vivamus ut a sed, mollitia lectus. Nulla vestibulum massa neque ut et, id hendrerit sit, feugiat in taciti enim proin nibh, tempor dignissim, rhoncus duis vestibulum nunc mattis convallis.',
+ 'status' => 1,
+ 'is_active' => 1,
+ 'is_latest' => 1,
+ 'created_user' => 1,
+ 'created' => '2017-02-18 15:36:26',
+ 'modified_user' => 1,
+ 'modified' => '2017-02-18 15:36:26'
+ ),
+ );
+
+}
From 905b9e43d22290260a171e25836d086a138a9d5c Mon Sep 17 00:00:00 2001
From: RyujiAMANO
Date: Sun, 19 Feb 2017 00:37:42 +0900
Subject: [PATCH 5/7] bake reservations controller
---
Controller/ReservationsController.php | 57 ++-----------------
.../Controller/ReservationsControllerTest.php | 4 +-
2 files changed, 8 insertions(+), 53 deletions(-)
diff --git a/Controller/ReservationsController.php b/Controller/ReservationsController.php
index d806468..1ec2269 100644
--- a/Controller/ReservationsController.php
+++ b/Controller/ReservationsController.php
@@ -1,7 +1,5 @@
2017,
- 'prevMonth' => 1,
- 'daysInPrevMonth' => 31,
- 'yearOfNextMonth' => 2017,
- 'nextMonth' => 3,
- 'daysInNextMonth' => 31,
- 'year' => 2017,
- 'month' => 2,
- 'wdayOf1stDay' => 3,
- 'daysInMonth' => 28,
- 'wdayOfLastDay' => 2,
- 'numOfWeek' => 5,
- ];
- $vars['year'] = 2017;
- $vars['month'] = 2;
- $vars['day'] = 1;
- $vars['style'] = [];
- $vars['today'] = [
- 'year' => 2017,
- 'month' => 02,
- 'day' => 01,
- 'hour' => 17,
- 'min' => 28,
- 'sec' => 36,
- ];
- $vars['plans'] = [];
-
- App::uses('CalendarPermissiveRooms', 'Calendars.Utility');
- $perm['roomInfos'] =[];
- CalendarPermissiveRooms::setRoomPermRoles($perm);
+/**
+ * Scaffold
+ *
+ * @var mixed
+ */
+ public $scaffold;
- $vars['holidays'] = [];
- $this->set('frameId', $frameId);
- $this->set('languageId', $languageId);
- $this->set('vars', $vars);
- }
}
diff --git a/Test/Case/Controller/ReservationsControllerTest.php b/Test/Case/Controller/ReservationsControllerTest.php
index 996e505..92eac80 100644
--- a/Test/Case/Controller/ReservationsControllerTest.php
+++ b/Test/Case/Controller/ReservationsControllerTest.php
@@ -23,11 +23,11 @@ class ReservationsControllerTest extends ControllerTestCase {
*/
public $fixtures = array(
'plugin.reservations.reservation',
- 'plugin.reservations.language',
'plugin.reservations.user',
'plugin.reservations.role',
'plugin.reservations.user_role_setting',
- 'plugin.reservations.users_language'
+ 'plugin.reservations.users_language',
+ 'plugin.reservations.language'
);
}
From dbd3497e580a9e11ff33a27435d4fea01f969bff Mon Sep 17 00:00:00 2001
From: RyujiAMANO
Date: Sun, 19 Feb 2017 00:38:33 +0900
Subject: [PATCH 6/7] Revert "bake reservations controller"
This reverts commit 905b9e43d22290260a171e25836d086a138a9d5c.
---
Controller/ReservationsController.php | 57 +++++++++++++++++--
.../Controller/ReservationsControllerTest.php | 4 +-
2 files changed, 53 insertions(+), 8 deletions(-)
diff --git a/Controller/ReservationsController.php b/Controller/ReservationsController.php
index 1ec2269..d806468 100644
--- a/Controller/ReservationsController.php
+++ b/Controller/ReservationsController.php
@@ -1,5 +1,7 @@
2017,
+ 'prevMonth' => 1,
+ 'daysInPrevMonth' => 31,
+ 'yearOfNextMonth' => 2017,
+ 'nextMonth' => 3,
+ 'daysInNextMonth' => 31,
+ 'year' => 2017,
+ 'month' => 2,
+ 'wdayOf1stDay' => 3,
+ 'daysInMonth' => 28,
+ 'wdayOfLastDay' => 2,
+ 'numOfWeek' => 5,
+ ];
+ $vars['year'] = 2017;
+ $vars['month'] = 2;
+ $vars['day'] = 1;
+ $vars['style'] = [];
+ $vars['today'] = [
+ 'year' => 2017,
+ 'month' => 02,
+ 'day' => 01,
+ 'hour' => 17,
+ 'min' => 28,
+ 'sec' => 36,
+ ];
+ $vars['plans'] = [];
+
+ App::uses('CalendarPermissiveRooms', 'Calendars.Utility');
+ $perm['roomInfos'] =[];
+ CalendarPermissiveRooms::setRoomPermRoles($perm);
+ $vars['holidays'] = [];
+ $this->set('frameId', $frameId);
+ $this->set('languageId', $languageId);
+ $this->set('vars', $vars);
+ }
}
diff --git a/Test/Case/Controller/ReservationsControllerTest.php b/Test/Case/Controller/ReservationsControllerTest.php
index 92eac80..996e505 100644
--- a/Test/Case/Controller/ReservationsControllerTest.php
+++ b/Test/Case/Controller/ReservationsControllerTest.php
@@ -23,11 +23,11 @@ class ReservationsControllerTest extends ControllerTestCase {
*/
public $fixtures = array(
'plugin.reservations.reservation',
+ 'plugin.reservations.language',
'plugin.reservations.user',
'plugin.reservations.role',
'plugin.reservations.user_role_setting',
- 'plugin.reservations.users_language',
- 'plugin.reservations.language'
+ 'plugin.reservations.users_language'
);
}
From a0a47812d375154c4b770b0cd8a93114c9ad5b85 Mon Sep 17 00:00:00 2001
From: RyujiAMANO
Date: Fri, 24 Feb 2017 23:57:48 +0900
Subject: [PATCH 7/7] =?UTF-8?q?=E4=BD=9C=E6=A5=AD=E4=B8=AD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Config/routes.php | 44 ++++++++
Controller/ReservationsController.php | 119 ++++++++++++++++++---
View/Reservations/form.ctp | 143 ++++++++++++++++++++++++++
View/Reservations/index.ctp | 15 +++
4 files changed, 307 insertions(+), 14 deletions(-)
create mode 100644 Config/routes.php
create mode 100644 View/Reservations/form.ctp
diff --git a/Config/routes.php b/Config/routes.php
new file mode 100644
index 0000000..2079879
--- /dev/null
+++ b/Config/routes.php
@@ -0,0 +1,44 @@
+
+ * @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' => 'reservations',
+);
+$options = array(
+ 'key' => '[a-zA-Z0-9_]+', //_は、UnitTestで使用するため
+);
+if (Current::isSettingMode()) {
+ Router::connect(
+ '/' . Current::SETTING_MODE_WORD .
+ '/' . $params['plugin'] . '/:controller/:action/:key',
+ $params,
+ $options
+ );
+ Router::connect(
+ '/' . Current::SETTING_MODE_WORD .
+ '/' . $params['plugin'] . '/:controller/:action/',
+ $params,
+ $options
+ );
+}
+
+Router::connect(
+ '/' . $params['plugin'] . '/:controller/:action',
+ $params,
+ $options
+);
+Router::connect(
+ '/' . $params['plugin'] . '/:controller/:action/:key',
+ $params,
+ $options
+);
diff --git a/Controller/ReservationsController.php b/Controller/ReservationsController.php
index d806468..480cd4e 100644
--- a/Controller/ReservationsController.php
+++ b/Controller/ReservationsController.php
@@ -1,45 +1,90 @@
+ * @link http://www.netcommons.org NetCommons Project
+ * @license http://www.netcommons.org/license.txt NetCommons License
+ */
+
App::uses('ReservationsAppController', 'Reservations.Controller');
App::uses('CalendarTime', 'Calendars.Utility');
/**
* Reservations Controller
*
- *
-* @author Noriko Arai
-* @author Your Name
-* @link http://www.netcommons.org NetCommons Project
-* @license http://www.netcommons.org/license.txt NetCommons License
-* @copyright Copyright 2014, NetCommons Project
+ * @author Noriko Arai
+ * @author Ryuji AMANO
+ * @link http://www.netcommons.org NetCommons Project
+ * @license http://www.netcommons.org/license.txt NetCommons License
+ * @copyright Copyright 2014, NetCommons Project
*/
class ReservationsController extends ReservationsAppController {
+/**
+ * @var array use models
+ */
+ public $uses = array(
+ 'Reservations.Reservation',
+ //'Categories.Category',
+ //'Workflow.WorkflowComment',
+ );
+
+/**
+ * @var array helpers
+ */
public $helpers = [
'Calendars.CalendarTurnCalendar',
'Calendars.CalendarMonthly',
+
+ 'NetCommons.BackTo',
+ 'NetCommons.NetCommonsForm',
+ 'Workflow.Workflow',
+ 'NetCommons.NetCommonsTime',
+ 'NetCommons.TitleIcon',
+
];
+/**
+ * @var array components
+ */
public $components = [
- 'Calendars.Calendars'
+ 'Calendars.Calendars',
+ 'NetCommons.Permission' => array(
+ //アクセスの権限
+ 'allow' => array(
+ 'add,edit,delete' => 'content_creatable',
+ ),
+ ),
+ 'Workflow.Workflow',
+
+ 'Categories.Categories',
+ 'NetCommons.NetCommonsTime',
];
+/**
+ * 月間カレンダ
+ *
+ * @return void
+ */
public function index() {
$frameId = Current::read('Frame.id');
$languageId = Current::read('Language.id');
+ // TODO パラメータ設定
$vars['mInfo'] = [
'yearOfPrevMonth' => 2017,
'prevMonth' => 1,
- 'daysInPrevMonth' => 31,
- 'yearOfNextMonth' => 2017,
+ 'daysInPrevMonth' => 31,
+ 'yearOfNextMonth' => 2017,
'nextMonth' => 3,
- 'daysInNextMonth' => 31,
+ 'daysInNextMonth' => 31,
'year' => 2017,
'month' => 2,
- 'wdayOf1stDay' => 3,
- 'daysInMonth' => 28,
- 'wdayOfLastDay' => 2,
- 'numOfWeek' => 5,
+ 'wdayOf1stDay' => 3,
+ 'daysInMonth' => 28,
+ 'wdayOfLastDay' => 2,
+ 'numOfWeek' => 5,
];
$vars['year'] = 2017;
$vars['month'] = 2;
@@ -64,4 +109,50 @@ public function index() {
$this->set('languageId', $languageId);
$this->set('vars', $vars);
}
+
+/**
+ * add method
+ *
+ * @return void
+ */
+ public function add() {
+ $this->set('isEdit', false);
+ //$this->_prepare();
+
+ $reservation = $this->Reservation->create();
+ $this->set('reservation', $reservation);
+
+ if ($this->request->is('post')) {
+ $this->Reservation->create();
+ $this->request->data['Reservation']['blog_key'] =
+ $this->_blogSetting['BlogSetting']['blog_key'];
+
+ // set status
+ $status = $this->Workflow->parseStatus();
+ $this->request->data['Reservation']['status'] = $status;
+
+ // set block_id
+ $this->request->data['Reservation']['block_id'] = Current::read('Block.id');
+ // set language_id
+ $this->request->data['Reservation']['language_id'] = Current::read('Language.id');
+ if (($result = $this->Reservation->saveEntry($this->request->data))) {
+ $url = NetCommonsUrl::actionUrl(
+ array(
+ 'controller' => 'blog_entries',
+ 'action' => 'view',
+ 'block_id' => Current::read('Block.id'),
+ 'frame_id' => Current::read('Frame.id'),
+ 'key' => $result['Reservation']['key'])
+ );
+ return $this->redirect($url);
+ }
+
+ $this->NetCommons->handleValidationError($this->Reservation->validationErrors);
+
+ } else {
+ $this->request->data = $reservation;
+ }
+
+ $this->render('form');
+ }
}
diff --git a/View/Reservations/form.ctp b/View/Reservations/form.ctp
new file mode 100644
index 0000000..30ffcda
--- /dev/null
+++ b/View/Reservations/form.ctp
@@ -0,0 +1,143 @@
+NetCommonsHtml->script([
+ '/blogs/js/blogs.js',
+ '/blogs/js/blogs_entry_edit.js',
+]); ?>
+NetCommonsTime->toUserDatetimeArray($this->request->data, array('BlogEntry.publish_start'))
+);
+?>
+
+
+
+
+
+ NetCommonsForm->create(
+ 'BlogEntry',
+ array(
+ 'inputDefaults' => array(
+ 'div' => 'form-group',
+ 'class' => 'form-control',
+ 'error' => false,
+ ),
+ 'div' => 'form-control',
+ 'novalidate' => true
+ )
+ );
+ ?>
+ NetCommonsForm->hidden('key'); ?>
+ NetCommonsForm->hidden('Frame.id', array(
+ 'value' => Current::read('Frame.id'),
+ )); ?>
+ NetCommonsForm->hidden('Block.id', array(
+ 'value' => Current::read('Block.id'),
+ )); ?>
+
+
+
+
+
+
+ Workflow->inputComment('BlogEntry.status'); ?>
+
+
+
+ Workflow->buttons('BlogEntry.status'); ?>
+
+ NetCommonsForm->end() ?>
+
+
+
+
+
+
+
+ Workflow->comments(); ?>
+
+
+
+
+
+
diff --git a/View/Reservations/index.ctp b/View/Reservations/index.ctp
index 031e2ed..8df88d8 100644
--- a/View/Reservations/index.ctp
+++ b/View/Reservations/index.ctp
@@ -13,6 +13,21 @@
*/
echo $this->element('Calendars.scripts');
?>
+
+
+ 'blog_entries_edit',
+ 'action' => 'add',
+ 'frame_id' => Current::read('Frame.id')
+ );
+ echo $this->Button->addLink('',
+ $addUrl,
+ array('tooltip' => __d('reservations', '予約')));
+ ?>
+
+
+
element('Calendars.Calendars/calendar_tabs', array('active' => 'lmonthly', 'frameId' => $frameId, 'languageId' => $languageId));