From: Steve Sutton Date: Wed, 9 Mar 2016 19:44:01 +0000 (-0500) Subject: refactoring and style changes for output X-Git-Tag: v1.0.0^2~176 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=332b9edf3b34bb919560ab187700779e92532844;p=WP-Plugins%2Fglm-member-db-events.git refactoring and style changes for output Re factor the models update style classes for forms --- diff --git a/models/front/events/baseAction.php b/models/front/events/baseAction.php new file mode 100644 index 0000000..c9985bd --- /dev/null +++ b/models/front/events/baseAction.php @@ -0,0 +1,79 @@ + + * @license PHP Version 3.0 {@link http://www.php.net/license/3_0.txt} + */ +abstract class GlmMembersFront_events_baseAction extends GlmDataEvents +{ + public $wpdb; + public $config; + + /** + * __construct + * + * @param mixed $wpdb The main Word Press DB Object + * @param mixed $config The main Config + * + * @access public + * @return void + */ + public function __construct($wpdb, $config) + { + $this->wpdb = $wpdb; + $this->config = $config; + + parent::__construct(false, false); + } + + public function getCategories() + { + include GLM_MEMBERS_EVENTS_PLUGIN_PATH. '/models/front/events/testCategoryData.php'; + return $categories; + } + + public function getModelEventsData($categoryId = null) + { + include GLM_MEMBERS_EVENTS_PLUGIN_PATH. '/models/front/events/testEventsData.php'; + if ($categoryId) { + return array_filter($events, function($data) use($categoryId) { + return ($data['category'] == $categoryId) ? 1 : 0; + }); + } + return $events; + } + + public function getModelEventData($eventId) + { + $events = $this->getModelEventsData(); + return array_filter($events, function($data) use($eventId) { + return $data['id'] == $eventId; + }); + } + + /** + * modelAction + * + * @param bool $actionData Action Data passed to the modelAction + * + * @access public + * @return void + */ + abstract public function modelAction($actionData = false); + +} diff --git a/models/front/events/detail.php b/models/front/events/detail.php index f87aa25..7b284fb 100644 --- a/models/front/events/detail.php +++ b/models/front/events/detail.php @@ -7,6 +7,7 @@ */ require_once GLM_MEMBERS_EVENTS_PLUGIN_CLASS_PATH . '/data/dataEvents.php'; +require_once GLM_MEMBERS_EVENTS_PLUGIN_PATH . '/models/front/events/baseAction.php'; /** * GLmMembersFront_event_detail @@ -18,50 +19,8 @@ require_once GLM_MEMBERS_EVENTS_PLUGIN_CLASS_PATH . '/data/dataEvents.php'; * @author Steve Sutton * @license PHP Version 3.0 {@link http://www.php.net/license/3_0.txt} */ -class GLmMembersFront_events_detail extends GlmDataEvents +class GLmMembersFront_events_detail extends GlmMembersFront_events_baseAction { - public $wpdb; - public $config; - - /** - * __construct - * - * @param mixed $wpdb The main Word Press DB Object - * @param mixed $config The main Config - * - * @access public - * @return void - */ - public function __construct($wpdb, $config) - { - $this->wpdb = $wpdb; - $this->config = $config; - - parent::__construct(false, false); - } - - private function getModelEventData($eventId) - { - $events = $this->getModelEventsData(); - return array_filter($events, function($data) use($eventId) { - return $data['id'] == $eventId; - }); - } - private function getCategories() - { - include GLM_MEMBERS_EVENTS_PLUGIN_PATH. '/models/front/events/testCategoryData.php'; - return $categories; - } - private function getModelEventsData($categoryId = null) - { - include GLM_MEMBERS_EVENTS_PLUGIN_PATH. '/models/front/events/testEventsData.php'; - if ($categoryId) { - return array_filter($events, function($data) use($categoryId) { - return ($data['category'] == $categoryId) ? 1 : 0; - }); - } - return $events; - } /** * modelAction * diff --git a/models/front/events/list.php b/models/front/events/list.php index 0aca1d9..067ef72 100644 --- a/models/front/events/list.php +++ b/models/front/events/list.php @@ -8,6 +8,7 @@ */ require_once GLM_MEMBERS_EVENTS_PLUGIN_CLASS_PATH . '/data/dataEvents.php'; +require_once GLM_MEMBERS_EVENTS_PLUGIN_PATH . '/models/front/events/baseAction.php'; /** * GlmMembersFront_events_list @@ -19,58 +20,8 @@ require_once GLM_MEMBERS_EVENTS_PLUGIN_CLASS_PATH . '/data/dataEvents.php'; * @author Steve Sutton * @license PHP Version 3.0 {@link http://www.php.net/license/3_0.txt} */ -class GlmMembersFront_events_list extends GlmDataEvents +class GlmMembersFront_events_list extends GlmMembersFront_events_baseAction { - public $wpdb; - public $config; - - /** - * __construct - * - * @param mixed $wpdb The main Word Press DB Object - * @param mixed $config The main Config - * - * @access public - * @return void - */ - public function __construct($wpdb, $config) - { - $this->wpdb = $wpdb; - $this->config = $config; - - parent::__construct(false, false); - } - - private function getCategories() - { - include GLM_MEMBERS_EVENTS_PLUGIN_PATH. '/models/front/events/testCategoryData.php'; - return $categories; - } - - private function getModelEventsData($categoryId = null) - { - include GLM_MEMBERS_EVENTS_PLUGIN_PATH. '/models/front/events/testEventsData.php'; - if ($categoryId) { - return array_filter($events, function($data) use($categoryId) { - return ($data['category'] == $categoryId) ? 1 : 0; - }); - } - return $events; - } - - private function getModelEventData() - { - return array( - 'id' => 14, - 'slug' => '?eventId=14', - 'title' => 'Project Snowstorm: Snowy Owls in Michigan', - 'starting' => '03/01/2016', - 'ending' => '03/01/2016', - 'description' => '

Test event description text here!

', - 'category' => 7 - ); - } - /** * modelAction * diff --git a/views/front/events/shortCuts.html b/views/front/events/shortCuts.html index c06fbef..04f9842 100644 --- a/views/front/events/shortCuts.html +++ b/views/front/events/shortCuts.html @@ -1,9 +1,9 @@