From: Laury GvR Date: Thu, 13 Sep 2018 17:22:04 +0000 (-0400) Subject: Implement front-end list view & model X-Git-Tag: v1.0.0^2~17 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/index.cgi?a=commitdiff_plain;h=b0330463873ca320abad1625a09c057119187697;p=WP-Plugins%2Fglm-member-db-staff.git Implement front-end list view & model Added list shortcode, model & view, and basic styles for the list. --- diff --git a/css/front.css b/css/front.css new file mode 100644 index 0000000..cf9ae57 --- /dev/null +++ b/css/front.css @@ -0,0 +1,28 @@ +.glm-staff-block-wrapper { + float: left; + padding: 10px; + width: 33%; +} +.glm-staff-name { + font-weight: bold; +} +@media (min-width: 641px) and (max-width: 1024px) { + .glm-staff-block-wrapper { + float: left; + padding: 10px; + width: 50%; + } +} +@media (max-width: 640px) { + .glm-staff-block-wrapper { + float: left; + padding: 10px; + width: 50%; + } +} +.glm-staff-block { + /* border: 1px solid grey; */ + /* box-shadow: 1px 1px 1px 1px grey; */ + text-align: center; + width: 100%; +} \ No newline at end of file diff --git a/models/front/staff/list.php b/models/front/staff/list.php new file mode 100644 index 0000000..1db55bc --- /dev/null +++ b/models/front/staff/list.php @@ -0,0 +1,148 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @release index.php,v 1.0 2014/10/31 19:31:47 cscott Exp $ + * @link http://dev.gaslightmedia.com/ + */ + +// Load Contacts data abstract +require_once GLM_MEMBERS_STAFF_PLUGIN_CLASS_PATH.'/data/dataStaff.php'; + +class GlmMembersFront_staff_list extends GlmDatastaff +{ + + /** + * WordPress Database Object + * + * @var $wpdb + * @access public + */ + public $wpdb; + /** + * Plugin Configuration Data + * + * @var $config + * @access public + */ + public $config; + /** + * Contact Info + * + * @var $contactInfo + * @access public + */ + public $contactInfo = false; + /** + * Member ID + * + * @var $memberID + * @access public + */ + public $memberID = false; + /** + * Contact ID + * + * @var $contactID + * @access public + */ + public $contactID = false; + + + /* + * Constructor + * + * This contructor performs the work for this model. This model returns + * an array containing the following. + * + * 'status' + * + * True if successfull and false if there was a fatal failure. + * + * 'view' + * + * A suggested view name that the contoller should use instead of the + * default view for this model or false to indicate that the default view + * should be used. + * + * 'data' + * + * Data that the model is returning for use in merging with the view to + * produce output. + * + * @wpdb object WordPress database object + * + * @return array Array containing status, suggested view, and any data + */ + public function __construct ($wpdb, $config) + { + + // Save WordPress Database object + $this->wpdb = $wpdb; + + // Save plugin configuration object + $this->config = $config; + + /* + * Run constructor for the Contacts data class + * + * Note, the third parameter is a flag that indicates to the Contacts + * data class that it should flag a group of fields as 'view_only'. + */ + parent::__construct(false, false, true); + + + } + + public function modelAction($actionData = false) + { + $success_load = false; + $success_message = ""; + $option = false; + $view_file = 'list'; + + if (isset($_REQUEST['option']) && trim($_REQUEST['option']) != '') { + $option = $_REQUEST['option']; + } + + $staff_data = $this->getList(); + + switch ($option) { + + case "list": + $view_file = 'list'; + + break; + + default: + + break; + } + $success_load = "Yes"; + + + + // Compile template data + $templateData = array( + 'staffData' => $staff_data, + 'successLoad' => $success_load + ); + + // Return status, any suggested view, and any data to controller + return array( + 'status' => true, + 'modelRedirect' => false, + 'view' => 'front/staff/'.$view_file.'.html', + 'data' => $templateData + ); + + } + +} diff --git a/setup/shortcodes.php b/setup/shortcodes.php index 8344e1f..7721cd1 100644 --- a/setup/shortcodes.php +++ b/setup/shortcodes.php @@ -87,6 +87,18 @@ * */ + +$glmMembersEventsShortcodes = array( + 'glm-members-staff-list' => array( + 'plugin' => GLM_MEMBERS_EVENTS_PLUGIN_SLUG, + 'menu' => 'staff', + 'action' => 'list', + 'table' => false, + 'attributes' => array( + ) + ), +); + $glmMembersStaffShortcodes = array( ); diff --git a/setup/validActions.php b/setup/validActions.php index ebf06b7..30a3f92 100644 --- a/setup/validActions.php +++ b/setup/validActions.php @@ -65,6 +65,10 @@ $glmMembersStaffAddOnValidActions = array( ), ), 'frontActions' => array( + 'staff' => array( + 'list' => GLM_MEMBERS_STAFF_PLUGIN_SLUG, + //'detail' => GLM_MEMBERS_STAFF_PLUGIN_SLUG, + ) ) ); diff --git a/views/front/staff/list.html b/views/front/staff/list.html new file mode 100644 index 0000000..ce4776b --- /dev/null +++ b/views/front/staff/list.html @@ -0,0 +1,40 @@ +
+ {if $staffData} + + {foreach $staffData as $staffKey => $staffVal} +
+
+
+ + {$staffVal.fname} + + + {$staffVal.lname} + +
+ +
+ + {$staffVal.extension} + + + {$staffVal.building} + + + {$staffVal.department} + +
+ + + {$staffVal.email} + + +
+
+ {/foreach} +
+ {else} + Sorry, no staff members found. + {/if} + + \ No newline at end of file