From 1dc3b43b5df4cb3590589b7d01ffb86cfe344d3c Mon Sep 17 00:00:00 2001 From: "kitatsuji.yuto" Date: Fri, 30 Sep 2016 11:38:09 +0900 Subject: [PATCH 1/2] =?UTF-8?q?ToDo=E3=81=AE=E4=B8=80=E8=A6=A7=E3=81=AE?= =?UTF-8?q?=E5=8F=96=E5=BE=97=E3=82=BF=E3=82=A4=E3=83=9F=E3=83=B3=E3=82=B0?= =?UTF-8?q?=E3=82=92=E8=A6=8B=E7=9B=B4=E3=81=97=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Controller/TaskContentsController.php | 9 ++++++--- Model/TaskContent.php | 10 ++++++++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/Controller/TaskContentsController.php b/Controller/TaskContentsController.php index bad4869..f074f33 100644 --- a/Controller/TaskContentsController.php +++ b/Controller/TaskContentsController.php @@ -192,8 +192,9 @@ private function __list($conditions) { $params = array(); $afterOrder = array( 'TaskContent.task_end_date' => 'asc', - 'TaskContent.title' => 'asc', 'TaskContent.priority' => 'desc', + 'TaskContent.progress_rate' => 'desc', + 'TaskContent.title' => 'asc', 'TaskContent.modified' => 'desc' ); @@ -239,9 +240,11 @@ private function __list($conditions) { $params = $this->__setTaskChargeContents($params, $userParam); // ToDo一覧を取得 - $taskContents = $this->TaskContent->getTaskContentList($params, $order); + $results = $this->TaskContent->getTaskContentList($params, $order); + $taskContents = Hash::extract($results, 'tasks'); + // 期限間近のToDo一覧を取得 - $deadLineTasks = Hash::extract($taskContents, '{n}.TaskContents.{n}[isDeadLine=' . true . ']'); + $deadLineTasks = Hash::extract($results, 'deadLineTasks'); // 期限間近のToDo一覧 $this->set('deadLineTasks', $deadLineTasks); diff --git a/Model/TaskContent.php b/Model/TaskContent.php index ebeb48a..1bdbc41 100644 --- a/Model/TaskContent.php +++ b/Model/TaskContent.php @@ -325,6 +325,7 @@ protected function _getValidateTaskDate($validate = array()) { * @return array */ public function getTaskContentList($params = array(), $order = array()) { + $results = array(); $conditions = $this->getConditions(Current::read('Block.id'), $params); $taskContents = $this->find('all', @@ -366,6 +367,8 @@ public function getTaskContentList($params = array(), $order = array()) { $isDeadLine = $this->isDeadLine($taskContent['TaskContent']['date_color']); $addedTaskContents[] = array_merge($taskContent, array('isDeadLine' => $isDeadLine)); } + // 期限間近・期限切れの一覧を取得 + $deadLineTasks = Hash::extract($addedTaskContents, '{n}[isDeadLine=' . true . ']'); // カテゴリIDがキーのコンテンツ連想配列を生成 $sortedTaskContents = Hash::combine( @@ -394,7 +397,7 @@ public function getTaskContentList($params = array(), $order = array()) { )); $categoryRates = Hash::combine($categoryData, '{n}.TaskContent.category_id', '{n}.TaskContent'); - $results = array(); + $resultArr = array(); foreach ($categories as $category) { $result = array(); if (isset($sortedTaskContents[$category['id']])) { @@ -408,10 +411,13 @@ public function getTaskContentList($params = array(), $order = array()) { $result['Category'] = $category; $result['Category']['category_priority'] = $categoryPriority; - $results[] = $result; + $resultArr[] = $result; } } + $results['deadLineTasks'] = $deadLineTasks; + $results['tasks'] = $resultArr; + return $results; } From 13c2ea64197fb8725d8a880c7cce4f874b4de1c9 Mon Sep 17 00:00:00 2001 From: kitatsuji Date: Tue, 1 Aug 2017 10:48:36 +0900 Subject: [PATCH 2/2] =?UTF-8?q?Travis=E3=82=A8=E3=83=A9=E3=83=BC=E5=AF=BE?= =?UTF-8?q?=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Controller/TaskContentEditController.php | 6 ++- Model/TaskContent.php | 12 ++--- .../CalendarEventContentForTaskFixture.php | 51 ++++++++++-------- Test/Fixture/CalendarEventForTaskFixture.php | 50 +++++++++-------- .../CalendarEventShareUserForTaskFixture.php | 53 +++++++++--------- Test/Fixture/CalendarForTaskFixture.php | 54 ++++++++++--------- .../CalendarFrameSettingForTaskFixture.php | 41 +++++++------- ...arFrameSettingSelectRoomForTaskFixture.php | 41 ++++++-------- Test/Fixture/CalendarRruleForTaskFixture.php | 40 ++++++-------- Test/Fixture/RoomsLanguageForTaskFixture.php | 12 ++--- .../TaskContentEdit/task_period_edit_form.ctp | 32 +++++------ 11 files changed, 197 insertions(+), 195 deletions(-) diff --git a/Controller/TaskContentEditController.php b/Controller/TaskContentEditController.php index f357dfb..59308b0 100644 --- a/Controller/TaskContentEditController.php +++ b/Controller/TaskContentEditController.php @@ -152,7 +152,8 @@ public function edit() { return $this->throwBadRequest(); } - $calendarKey = $taskContent['TaskContent']['calendar_key']; //ADD カレンダ連携キーの取り出し + //ADD カレンダ連携キーの取り出し + $calendarKey = $taskContent['TaskContent']['calendar_key']; $taskContent['TaskContent']['use_calendar'] = ($calendarKey == "") ? 0 : 1; if (! $this->request->data) { $this->request->data = $taskContent; @@ -173,7 +174,8 @@ public function edit() { $this->_taskSetting['TaskSetting']['task_key']; $this->request->data['TaskContent']['key'] = $key; - $this->request->data['TaskContent']['calendar_key'] = $calendarKey; //ADD カレンダー連携キー転写 + //ADD カレンダー連携キー転写 + $this->request->data['TaskContent']['calendar_key'] = $calendarKey; // set status $status = $this->Workflow->parseStatus(); diff --git a/Model/TaskContent.php b/Model/TaskContent.php index 09f4552..cddf5f8 100644 --- a/Model/TaskContent.php +++ b/Model/TaskContent.php @@ -652,11 +652,11 @@ public function saveContent($data) { //カレンダー連携ここから ADD $cmd = 'del'; if ($data['TaskContent']['is_date_set']) { - $cmd =($data['TaskContent']['use_calendar']) ? 'save' : 'del'; + $cmd = ($data['TaskContent']['use_calendar']) ? 'save' : 'del'; } - if ($cmd==='save') { + if ($cmd === 'save') { //実施期間設定あり&&カレンダー登録する - $this->loadModels([ + $this->loadModels([ 'CalendarActionPlan' => 'Calendars.CalendarActionPlan', ]); @@ -718,7 +718,7 @@ public function saveContent($data) { 'isDelRepeat' => false, //tasksはfalse固定 )); $delCalendarKey = $this->CalendarDeleteActionPlan->deletePlanForLink($data); -// if ($data['TaskContent']['calendar_key'] == $delCalendarKey) { + //if ($data['TaskContent']['calendar_key'] == $delCalendarKey) { //削除が成功したので、calenar_keyをクリアし、use_calendarをOFFにして、 //TaskContentにsave(update)しておく。 $data['TaskContent']['calendar_key'] = ''; @@ -728,7 +728,7 @@ public function saveContent($data) { throw new InternalErrorException(__d('net_commons', 'Internal Server Error')); } $data['TaskContent'] = $savedData['TaskContent']; -// } + //} $this->CalendarDeleteActionPlan->Behaviors->unload('Calendars.CalendarLink'); } else { //calendar_keyが記録されていないので、なにもしない @@ -861,7 +861,7 @@ public function deleteContentByKey($key) { } //カレンダー連携ここから ADD - $this->loadModels([ + $this->loadModels([ 'CalendarDeleteActionPlan' => 'Calendars.CalendarDeleteActionPlan', ]); //削除用settings指定 diff --git a/Test/Fixture/CalendarEventContentForTaskFixture.php b/Test/Fixture/CalendarEventContentForTaskFixture.php index b17400c..1158840 100644 --- a/Test/Fixture/CalendarEventContentForTaskFixture.php +++ b/Test/Fixture/CalendarEventContentForTaskFixture.php @@ -1,12 +1,6 @@ - * @author AllCreator - * @link http://www.netcommons.org NetCommons Project - * @license http://www.netcommons.org/license.txt NetCommons License - * @copyright Copyright 2014, NetCommons Project + * CalendarEventContentForTaskFixture */ App::uses('CalendarEventContentFixture', 'Calendars.Test/Fixture'); @@ -15,27 +9,28 @@ * Summary for CalendarEventContentFixture */ class CalendarEventContentForTaskFixture extends CalendarEventContentFixture { - /** - * Plugin key - * - * @var string - */ + +/** + * Plugin key + * + * @var string + */ public $pluginKey = 'calendars'; - /** - * Model name - * - * @var string - */ +/** + * Model name + * + * @var string + */ public $name = 'CalendarEventContents'; - /** - * Full Table Name - * - * @var string - */ +/** + * Full Table Name + * + * @var string + */ public $table = 'calendar_event_contents'; - + /** * Records * @@ -54,4 +49,14 @@ class CalendarEventContentForTaskFixture extends CalendarEventContentFixture { ), ); +/** + * Initialize the fixture. + * + * @return void + */ + public function init() { + require_once App::pluginPath('Calendars') . 'Config' . DS . 'Schema' . DS . 'schema.php'; + $this->fields = (new CalendarsSchema())->tables[Inflector::tableize($this->name)]; + parent::init(); + } } diff --git a/Test/Fixture/CalendarEventForTaskFixture.php b/Test/Fixture/CalendarEventForTaskFixture.php index e921c31..b07eeed 100644 --- a/Test/Fixture/CalendarEventForTaskFixture.php +++ b/Test/Fixture/CalendarEventForTaskFixture.php @@ -1,12 +1,6 @@ - * @author AllCreator - * @link http://www.netcommons.org NetCommons Project - * @license http://www.netcommons.org/license.txt NetCommons License - * @copyright Copyright 2014, NetCommons Project + * CalendarEventForTaskFixture */ App::uses('CalendarEventFixture', 'Calendars.Test/Fixture'); @@ -16,27 +10,27 @@ */ class CalendarEventForTaskFixture extends CalendarEventFixture { - /** - * Plugin key - * - * @var string - */ +/** + * Plugin key + * + * @var string + */ public $pluginKey = 'calendars'; - /** - * Model name - * - * @var string - */ +/** + * Model name + * + * @var string + */ public $name = 'CalendarEvents'; - /** - * Full Table Name - * - * @var string - */ +/** + * Full Table Name + * + * @var string + */ public $table = 'calendar_events'; - + /** * Records * @@ -944,4 +938,14 @@ class CalendarEventForTaskFixture extends CalendarEventFixture { ), ); +/** + * Initialize the fixture. + * + * @return void + */ + public function init() { + require_once App::pluginPath('Calendars') . 'Config' . DS . 'Schema' . DS . 'schema.php'; + $this->fields = (new CalendarsSchema())->tables[Inflector::tableize($this->name)]; + parent::init(); + } } diff --git a/Test/Fixture/CalendarEventShareUserForTaskFixture.php b/Test/Fixture/CalendarEventShareUserForTaskFixture.php index 6746d76..b0100d5 100644 --- a/Test/Fixture/CalendarEventShareUserForTaskFixture.php +++ b/Test/Fixture/CalendarEventShareUserForTaskFixture.php @@ -1,42 +1,36 @@ - * @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('CalendarEventShareUserFixture', 'Calendars.Test/Fixture'); +App::uses('CalendarEventShareUserForTaskFixture', 'Calendars.Test/Fixture'); /** * Summary for CalendarEventShareUserFixture */ class CalendarEventShareUserForTaskFixture extends CalendarEventShareUserFixture { - /** - * Plugin key - * - * @var string - */ +/** + * Plugin key + * + * @var string + */ public $pluginKey = 'calendars'; - /** - * Model name - * - * @var string - */ +/** + * Model name + * + * @var string + */ public $name = 'CalendarEventShareUsers'; - /** - * Full Table Name - * - * @var string - */ +/** + * Full Table Name + * + * @var string + */ public $table = 'calendar_event_share_users'; - + /** * Records * @@ -55,11 +49,22 @@ class CalendarEventShareUserForTaskFixture extends CalendarEventShareUserFixture array( 'id' => 2, 'calendar_event_id' => 27, - 'share_user' => 3, //編集長と共有 + 'share_user' => 3, 'created_user' => 1, 'created' => '2016-03-24 07:09:58', 'modified_user' => 1, 'modified' => '2016-03-24 07:09:58' ), ); + +/** + * Initialize the fixture. + * + * @return void + */ + public function init() { + require_once App::pluginPath('Calendars') . 'Config' . DS . 'Schema' . DS . 'schema.php'; + $this->fields = (new CalendarsSchema())->tables[Inflector::tableize($this->name)]; + parent::init(); + } } diff --git a/Test/Fixture/CalendarForTaskFixture.php b/Test/Fixture/CalendarForTaskFixture.php index d8ae2b1..18ab022 100644 --- a/Test/Fixture/CalendarForTaskFixture.php +++ b/Test/Fixture/CalendarForTaskFixture.php @@ -1,41 +1,36 @@ - * @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('CalendarFixture', 'Calendars.Test/Fixture'); +App::uses('CalendarForTaskFixture', 'Calendars.Test/Fixture'); /** * Summary for CalendarFixture */ class CalendarForTaskFixture extends CalendarFixture { - /** - * Plugin key - * - * @var string - */ + +/** + * Plugin key + * + * @var string + */ public $pluginKey = 'calendars'; - /** - * Model name - * - * @var string - */ +/** + * Model name + * + * @var string + */ public $name = 'Calendars'; - /** - * Full Table Name - * - * @var string - */ +/** + * Full Table Name + * + * @var string + */ public $table = 'calendars'; - + /** * Records * @@ -45,7 +40,6 @@ class CalendarForTaskFixture extends CalendarFixture { array( 'id' => 1, 'block_key' => 'block_1', - //'use_workflow' => 1, 'created_user' => 1, 'created' => '2016-03-24 07:10:30', 'modified_user' => 1, @@ -54,11 +48,21 @@ class CalendarForTaskFixture extends CalendarFixture { array( 'id' => 2, 'block_key' => 'block_1', - //'use_workflow' => 1, 'created_user' => 1, 'created' => '2016-03-24 07:10:30', 'modified_user' => 1, 'modified' => '2016-03-24 07:10:30' ), ); + +/** + * Initialize the fixture. + * + * @return void + */ + public function init() { + require_once App::pluginPath('Calendars') . 'Config' . DS . 'Schema' . DS . 'schema.php'; + $this->fields = (new CalendarsSchema())->tables[Inflector::tableize($this->name)]; + parent::init(); + } } diff --git a/Test/Fixture/CalendarFrameSettingForTaskFixture.php b/Test/Fixture/CalendarFrameSettingForTaskFixture.php index dfa43b9..da95600 100644 --- a/Test/Fixture/CalendarFrameSettingForTaskFixture.php +++ b/Test/Fixture/CalendarFrameSettingForTaskFixture.php @@ -1,41 +1,36 @@ - * @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('CalendarFrameSettingFixture', 'Calendars.Test/Fixture'); +App::uses('CalendarFrameSettingForTaskFixture', 'Calendars.Test/Fixture'); /** * Summary for CalendarFrameSettingFixture */ class CalendarFrameSettingForTaskFixture extends CalendarFrameSettingFixture { - /** - * Plugin key - * - * @var string - */ + +/** + * Plugin key + * + * @var string + */ public $pluginKey = 'calendars'; - /** - * Model name - * - * @var string - */ +/** + * Model name + * + * @var string + */ public $name = 'CalendarFrameSettings'; - /** - * Full Table Name - * - * @var string - */ +/** + * Full Table Name + * + * @var string + */ public $table = 'calendar_frame_settings'; - + /** * Records * diff --git a/Test/Fixture/CalendarFrameSettingSelectRoomForTaskFixture.php b/Test/Fixture/CalendarFrameSettingSelectRoomForTaskFixture.php index eaa6b15..8d4912d 100644 --- a/Test/Fixture/CalendarFrameSettingSelectRoomForTaskFixture.php +++ b/Test/Fixture/CalendarFrameSettingSelectRoomForTaskFixture.php @@ -1,42 +1,36 @@ - * @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('CalendarFrameSettingSelectRoomFixture', 'Calendars.Test/Fixture'); +App::uses('CalendarFrameSettingSelectRoomForTaskFixture', 'Calendars.Test/Fixture'); /** * Summary for CalendarFrameSettingSelectRoomFixture */ class CalendarFrameSettingSelectRoomForTaskFixture extends CalendarFrameSettingSelectRoomFixture { - /** - * Plugin key - * - * @var string - */ +/** + * Plugin key + * + * @var string + */ public $pluginKey = 'calendars'; - /** - * Model name - * - * @var string - */ +/** + * Model name + * + * @var string + */ public $name = 'CalendarFrameSettingSelectRooms'; - /** - * Full Table Name - * - * @var string - */ +/** + * Full Table Name + * + * @var string + */ public $table = 'calendar_frame_setting_select_rooms'; - + /** * Records * @@ -91,5 +85,4 @@ public function init() { $this->fields = (new CalendarsSchema())->tables[Inflector::tableize($this->name)]; parent::init(); } - } \ No newline at end of file diff --git a/Test/Fixture/CalendarRruleForTaskFixture.php b/Test/Fixture/CalendarRruleForTaskFixture.php index 8c0f3ce..dc4e630 100644 --- a/Test/Fixture/CalendarRruleForTaskFixture.php +++ b/Test/Fixture/CalendarRruleForTaskFixture.php @@ -1,42 +1,36 @@ - * @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('CalendarRruleFixture', 'Calendars.Test/Fixture'); +App::uses('CalendarRruleForTaskFixture', 'Calendars.Test/Fixture'); /** * Summary for CalendarRruleFixture */ class CalendarRruleForTaskFixture extends CalendarRruleFixture { - /** - * Plugin key - * - * @var string - */ +/** + * Plugin key + * + * @var string + */ public $pluginKey = 'calendars'; - /** - * Model name - * - * @var string - */ +/** + * Model name + * + * @var string + */ public $name = 'CalendarRrules'; - /** - * Full Table Name - * - * @var string - */ +/** + * Full Table Name + * + * @var string + */ public $table = 'calendar_rrules'; - + /** * Records * diff --git a/Test/Fixture/RoomsLanguageForTaskFixture.php b/Test/Fixture/RoomsLanguageForTaskFixture.php index 8161cda..3ba69bb 100644 --- a/Test/Fixture/RoomsLanguageForTaskFixture.php +++ b/Test/Fixture/RoomsLanguageForTaskFixture.php @@ -19,13 +19,13 @@ */ class RoomsLanguageForTaskFixture extends RoomsLanguageFixture { - /** - * Plugin key - * - * @var string - */ +/** + * Plugin key + * + * @var string + */ public $pluginKey = 'tasks'; - + /** * Model name * diff --git a/View/Elements/TaskContentEdit/task_period_edit_form.ctp b/View/Elements/TaskContentEdit/task_period_edit_form.ctp index bc9ee61..37154cb 100644 --- a/View/Elements/TaskContentEdit/task_period_edit_form.ctp +++ b/View/Elements/TaskContentEdit/task_period_edit_form.ctp @@ -86,22 +86,22 @@ NetCommonsForm->checkbox('TaskContent.use_calendar', array( - 'class' => 'text-left pull-left', - )); - ?> - NetCommonsForm->label( - 'TaskContent.use_calendar', - __d('tasks', 'Use calendar') - ); - ?> - NetCommonsForm->error('TaskContent.use_calendar'); + //カレンダー連携登録チェックボックス + echo $this->NetCommonsForm->checkbox('TaskContent.use_calendar', array( + 'class' => 'text-left pull-left', + )); + ?> + NetCommonsForm->label( + 'TaskContent.use_calendar', + __d('tasks', 'Use calendar') + ); + ?> + NetCommonsForm->error('TaskContent.use_calendar'); //ADD - ?> + ?>