From ff297ced6c193bf15abdb44360cbb77fe1bf9d2f Mon Sep 17 00:00:00 2001 From: Anthony Talarico Date: Fri, 8 Sep 2017 08:30:18 -0400 Subject: [PATCH] re doing the plugin, committing new batch of files redooing the plugin after the master branch was not showing up --- activate.php | 153 ++++++++ assets/calIcon.png | Bin 0 -> 1397 bytes assets/readme.txt | 2 + classes/data/dataJobs.php | 334 ++++++++++++++++++ classes/readme.txt | 3 + config/plugin.ini | 8 + css/admin.css | 21 ++ css/readme.txt | 1 + deactivate.php | 61 ++++ defines.php | 64 ++++ index.php | 229 ++++++++++++ js/readme.txt | 1 + lib/readme.txt | 3 + misc/documentation/AddAnAdminTab.txt | 15 + misc/documentation/CreateNewAddOn.txt | 49 +++ models/admin/jobs/index.php | 225 ++++++++++++ models/admin/jobs/list.php | 8 + models/admin/readme.txt | 5 + models/front/jobs/list.php | 154 ++++++++ models/front/readme.txt | 7 + readme.txt | 27 ++ setup/adminHooks.php | 44 +++ setup/adminMenus.php | 59 ++++ setup/adminTabs.php | 35 ++ .../create_database_V0.0.1.sql | 52 +++ setup/databaseScripts/dbVersions.php | 38 ++ .../databaseScripts/drop_database_V0.0.1.sql | 1 + .../update_database_V0.0.1.sql | 1 + setup/frontHooks.php | 27 ++ setup/hooksHelp.html | 16 + setup/permissions.php | 53 +++ setup/rolesAndCapabilities.php | 19 + setup/shortcodes.php | 104 ++++++ setup/validActions.php | 74 ++++ uninstall.php | 27 ++ views/admin/header.html | 8 + views/admin/jobs/edit.html | 149 ++++++++ views/admin/jobs/index.html | 38 ++ views/admin/readme.txt | 5 + views/front/jobs/list.html | 16 + views/front/readme.txt | 7 + 41 files changed, 2143 insertions(+) create mode 100644 activate.php create mode 100644 assets/calIcon.png create mode 100644 assets/readme.txt create mode 100644 classes/data/dataJobs.php create mode 100644 classes/readme.txt create mode 100644 config/plugin.ini create mode 100644 css/admin.css create mode 100644 css/readme.txt create mode 100644 deactivate.php create mode 100644 defines.php create mode 100644 index.php create mode 100644 js/readme.txt create mode 100644 lib/readme.txt create mode 100644 misc/documentation/AddAnAdminTab.txt create mode 100644 misc/documentation/CreateNewAddOn.txt create mode 100644 models/admin/jobs/index.php create mode 100644 models/admin/jobs/list.php create mode 100644 models/admin/readme.txt create mode 100644 models/front/jobs/list.php create mode 100644 models/front/readme.txt create mode 100644 readme.txt create mode 100644 setup/adminHooks.php create mode 100644 setup/adminMenus.php create mode 100644 setup/adminTabs.php create mode 100644 setup/databaseScripts/create_database_V0.0.1.sql create mode 100644 setup/databaseScripts/dbVersions.php create mode 100644 setup/databaseScripts/drop_database_V0.0.1.sql create mode 100644 setup/databaseScripts/update_database_V0.0.1.sql create mode 100644 setup/frontHooks.php create mode 100644 setup/hooksHelp.html create mode 100644 setup/permissions.php create mode 100644 setup/rolesAndCapabilities.php create mode 100644 setup/shortcodes.php create mode 100644 setup/validActions.php create mode 100644 uninstall.php create mode 100644 views/admin/header.html create mode 100644 views/admin/jobs/edit.html create mode 100644 views/admin/jobs/index.html create mode 100644 views/admin/readme.txt create mode 100644 views/front/jobs/list.html create mode 100644 views/front/readme.txt diff --git a/activate.php b/activate.php new file mode 100644 index 0000000..14018f1 --- /dev/null +++ b/activate.php @@ -0,0 +1,153 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @release activate.php,v 1.0 2014/10/31 19:31:47 cscott Exp $ + * @link http://dev.gaslightmedia.com/ + */ + +// Check that we're being called by WordPress. +if (!defined('ABSPATH')) { + die("Please do not call this code directly!"); +} + +/* + * This class performs all necessary additional work when this + * plugin is activated. + * + * Currently the only actions are to add role capability to display and modify + * prototypes. + */ +class glmMembersjobsPluginActivate +{ + + /** + * WordPress Database Object + * + * @var $wpdb + * @access public + */ + public $wpdb; + /** + * Plugin Configuration Data + * + * @var $config + * @access public + */ + public $config; + + /* + * Constructor + * + * Note that the $noDatabaseCheck is used to access the database versions + * without triggering a database check. + * + * Performs all the work for this model + */ + public function __construct ($wpdb, $config) + { + + // Make sure the current user has this capability + if (! current_user_can('activate_plugins')) { + $this->addNotice("Interesting, you don't have permission to activate plugins."); + die(); + } + + // Save WordPress Database object + $this->wpdb = $wpdb; + + // Save plugin configuration object + $this->config = $config; + + // Set current plugin version + update_option('glmMembersjobsPluginVersion', GLM_MEMBERS_JOBS_PLUGIN_VERSION); + + // Set Roles and Capabilities for this plugin + require_once GLM_MEMBERS_JOBS_PLUGIN_SETUP_PATH.'/rolesAndCapabilities.php'; + } + + /* + * Add a capability to all current roles + * + * @param string $capability Name of capability to add + * @param array $default Whether capability should be on by default + * array( + * 'author' => false, + * 'contributor' => false, + * 'editor' => false, + * 'subscriber' => false + * ) + * + * @return void + * @access private + */ + private function addRoleCapability($capability, $default) + { + // Get list of role objects + $roleObjects = $GLOBALS['wp_roles']->role_objects; + + // Get list of roles we can edit + $roles = get_editable_roles(); + + // For each role object + foreach ($roleObjects as $key => $role) { + + // Check if the role exists in list of editable roles and + // the capability does not exist + if (isset($roles[$key]) && ! isset($role->capabilities[$capability])) { + + // Check if a default value has been specified in the $default array + $enabled = false; + if (isset($default[$role->name])) { + + // It has, so use that + $enabled = $default[$role->name]; + + } + + // Add the role + $role->add_cap($capability, $enabled); + + } + } + } + + + /* + * Delete a capability from all current roles + * + * @param string $capability Name of capability to add + * + * @return void + * @access private + */ + private function deleteRoleCapability($capability) + { + // Get list of role objects + $roleObjects = $GLOBALS['wp_roles']->role_objects; + + // Get list of roles we can edit + $roles = get_editable_roles(); + + // For each role object + foreach ($roleObjects as $key => $role) { + + if ( isset($role->capabilities[$capability])) { + $role->remove_cap($capability); + } + + } + + } + + + +} diff --git a/assets/calIcon.png b/assets/calIcon.png new file mode 100644 index 0000000000000000000000000000000000000000..d50b0fc2b8161118463a0db82d336513b27c77ff GIT binary patch literal 1397 zcmbVMZA=?w9KTxHVpm?KTb0e1<4PthT(5V%>&uM-rPr=aD8teWwk)Q1*QfM^-j%y! zEo6z{TiBcn^9@amf?#}&LtNq(qnm~-TlT^1!^}daF4YkCNkL68S;Q+)^aI%kFS&c3 z=l}eE|M&kL@9fxLVcuniAgCe|W@6gsKFk!OG>FZRtAtiDRBUf zWY}I118j0=;0kDhAbnnl_ozM5cAA$mcD9JI=QCN24M9yU`7F!#0Tt#zuORx6U%$A3 zz(Uf8bW>4BG#dbEAv`RDuHlY2KitQAlSoT5+?1y^1sR~Sa6Z#7DsNl=Y2;lL@(;l*$V>cDB-K@$#m<3TiQ zaxz87n9znT?c_t!s+y%SESJmKb56S?_hPu$>%|-dMi8imK$Rg;W%H=0*h(50pzyMg zRRu|eiyB!@8dQCV=IMF}nQSz=saRAt5~ZaK%d=Sww>z**rWn^6T2W)*UpKZyEAgQ$ zz+ym=24!BWN6J=}m-KAK58{lAARIxQqP#dBbom1=+#hf=E{~UC{B3xN z8xa+i6?ssyEoinkxXfL-bU+5ID#>w4>MwOcXIfGvB`sy)Kwz!vaD9~J1+ge>C>Clx zZU)H0QIHJDQU+ejG%al5g`4$o98a-mk|QaUBmjwe2+oaq0Kv1sk@E0P64~G<|8E8{ z%_*$dF8^ttl1S^x;&yWww8Q2&0a2SFSsRvcerDp82(Usjg=ed#m-s*1+ z1zWg~8)>G$DgU!T!l!2Dewxq^ShtaP(z@2lQ)P$7$AU4-*!7W>vg*~^MD=CMHux*U z{F&JZr#~~>a7p*~fjO}BsZyLF-z55>N-_uyx(W*G7-a)FY^URK&q082r0sFmE+f8$cn#1#k zR@;#7uwb6MRc;+v*iU>PyJm$KgZE89+#uY1;-FOs-2N#2?kH9LV_D&WaN+II8z!r1 z((>#PW$9~TSG@B4O}4e`s`+X + * @license http://www.gaslightmedia.com Gaslightmedia + * @release SVN: $Id: dataConditions.php,v 1.0 2011/01/25 19:31:47 cscott Exp $ + */ + +/********************************************************************** + * NOTE: THIS IS A Job Postings FILE - DO NOT USE UNMODIFIED + * + * Please change all references to conditions, Conditions, or CONDITIONS to a name + * appropriate for your new Add-On. + * + * Data fields in this file are conditions only. + * + * Remove this message before using this file in production! + **********************************************************************/ + +/** + * GlmDatajobs class + * + * PHP version 5 + * + * @category Data + * @package GLM Member DB + * @author Chuck Scott + * @license http://www.gaslightmedia.com Gaslightmedia + * @release SVN: $Id: dataMembers.php,v 1.0 2011/01/25 19:31:47 cscott + * Exp $ + */ +class GlmDatajobs extends GlmDataAbstract +{ + + /** + * WordPress Database Object + * + * @var $wpdb + * @access public + */ + public $wpdb; + /** + * Plugin Configuration Data + * + * @var $config + * @access public + */ + public $config; + /** + * Data Table Name + * + * @var $table + * @access public + */ + public $table; + /** + * Field definitions + * + * 'type' is type of field as defined by the application + * text Regular text field + * pointer Pointer to an entry in another table + * 'filters' is the filter name for a particular filter ID in PHP filter + * functions + * See PHP filter_id() + * + * 'use' is when to use the field + * l = List + * g = Get + * n = New + * i = Insert + * e = Edit + * u = Update + * d = Delete + * a = All + * + * @var $ini + * @access public + */ + public $fields = false; + + /** + * Constructor + * + * @param object $d database connection + * @param array $config Configuration array + * @param bool $limitedEdit Flag to say indicate limited edit requested + * + * @return void + * @access public + */ + public function __construct($wpdb, $config, $limitedEdit = false) + { + + // If this class is not being extended along with existing $wpdb and $config + if (!$this->wpdb) { + + // Save WordPress Database object + $this->wpdb = $wpdb; + + // Save plugin configuration object + $this->config = $config; + + } + + /* + * Table Name + */ + + $this->table = GLM_MEMBERS_JOBS_PLUGIN_DB_PREFIX . 'reports'; + + // -- Conditions Table + //CREATE TABLE {prefix}conditions ( + // id INT NOT NULL AUTO_INCREMENT, + // name TEXT NOT NULL, + // descr_short TEXT NULL, + // descr TEXT NULL, + // last_update DATE NULL, + // PRIMARY KEY (id) + //); + + /* + * Table Data Fields + */ + + $this->fields = array ( + + 'id' => array ( + 'field' => 'id', + 'type' => 'integer', + 'view_only' => true, + 'use' => 'a' + ), + 'report_active' => array ( + 'field' => 'report_active', + 'type' => 'checkbox', + 'default' => false, + 'use' => 'a' + ), + 'report_date' => array ( + 'field' => 'report_date', + 'type' => 'date', + 'default' => false, + 'use' => 'a' + ), + 'report_notes' => array ( + 'field' => 'report_notes', + 'type' => 'text', + 'required' => true, + 'use' => 'a' + ), + 'big_bay_cond' => array ( + 'field' => 'big_bay_cond', + 'type' => 'text', + 'required' => true, + 'use' => 'a' + ), + 'big_bay_name' => array ( + 'field' => 'big_bay_name', + 'type' => 'text', + 'required' => true, + 'use' => 'a' + ), + 'big_bay_groom' => array ( + 'field' => 'big_bay_groom', + 'type' => 'date', + 'required' => true, + 'use' => 'a' + ), + 'big_bay_base' => array ( + 'field' => 'big_bay_base', + 'type' => 'text', + 'required' => true, + 'use' => 'a' + ), + 'big_bay_notes' => array ( + 'field' => 'big_bay_notes', + 'type' => 'text', + 'required' => true, + 'use' => 'a' + ), + 'alston_name' => array ( + 'field' => 'alston_name', + 'type' => 'text', + 'required' => true, + 'use' => 'a' + ), + 'alston_cond' => array ( + 'field' => 'alston_cond', + 'type' => 'text', + 'required' => true, + 'use' => 'a' + ), + 'alston_groom' => array ( + 'field' => 'alston_groom', + 'type' => 'date', + 'required' => true, + 'use' => 'a' + ), + 'alston_base' => array ( + 'field' => 'alston_base', + 'type' => 'text', + 'required' => true, + 'use' => 'a' + ), + 'alston_notes' => array ( + 'field' => 'alston_notes', + 'type' => 'text', + 'required' => true, + 'use' => 'a' + ), + 'nestoria_cond' => array ( + 'field' => 'nestoria_cond', + 'type' => 'text', + 'required' => true, + 'use' => 'a' + ), + 'nestoria_name' => array ( + 'field' => 'nestoria_groom', + 'type' => 'date', + 'required' => true, + 'use' => 'a' + ), + + 'nestoria_groom' => array ( + 'field' => 'nestoria_groom', + 'type' => 'date', + 'required' => true, + 'use' => 'a' + ), + 'nestoria_base' => array ( + 'field' => 'nestoria_base', + 'type' => 'text', + 'required' => true, + 'use' => 'a' + ), + 'nestoria_notes' => array ( + 'field' => 'nestoria_notes', + 'type' => 'text', + 'required' => true, + 'use' => 'a' + ), + 'chassell_cond' => array ( + 'field' => 'chassell_cond', + 'type' => 'text', + 'required' => true, + 'use' => 'a' + ), + 'chassell_name' => array ( + 'field' => 'chassell_name', + 'type' => 'text', + 'required' => true, + 'use' => 'a' + ), + 'chassell_groom' => array ( + 'field' => 'chassell_groom', + 'type' => 'date', + 'required' => true, + 'use' => 'a' + ), + 'chassell_base' => array ( + 'field' => 'chassell_base', + 'type' => 'text', + 'required' => true, + 'use' => 'a' + ), + 'chassell_notes' => array ( + 'field' => 'chassell_notes', + 'type' => 'text', + 'required' => true, + 'use' => 'a' + ), + 'pinery_name' => array ( + 'field' => 'pinery_name', + 'type' => 'text', + 'required' => true, + 'use' => 'a' + ), + + 'pinery_base' => array ( + 'field' => 'pinery_base', + 'type' => 'text', + 'required' => true, + 'use' => 'a' + ), + 'pinery_notes' => array ( + 'field' => 'pinery_notes', + 'type' => 'text', + 'required' => true, + 'use' => 'a' + ), + 'pinery_groom' => array ( + 'field' => 'pinery_groom', + 'type' => 'date', + 'required' => true, + 'use' => 'a' + ), + 'report_blurb' => array ( + 'field' => 'report_blurb', + 'type' => 'text', + 'required' => true, + 'use' => 'a' + ), + + ); + } + + /* + * Entry Post Processing Call-Back Method + * + * Perform post-processing for all result entries. + * + * In this case we're using it to append an array of category + * data to each row result and also sort by name. + * + * @param array $r Array of field result data for a single entry + * @param string $a Action being performed (l, i, g, ...) + * + * @return object Class object + * + */ + public function entryPostProcessing($r, $a) + { + return $r; + } + +} + +?> \ No newline at end of file diff --git a/classes/readme.txt b/classes/readme.txt new file mode 100644 index 0000000..fa5f44e --- /dev/null +++ b/classes/readme.txt @@ -0,0 +1,3 @@ +General class libraries developed specifically for this add-on should be placed in this directory. + +The lib directory should be considered instead for any standard class libraries not specifically developed for this add-on. \ No newline at end of file diff --git a/config/plugin.ini b/config/plugin.ini new file mode 100644 index 0000000..9222f7e --- /dev/null +++ b/config/plugin.ini @@ -0,0 +1,8 @@ +; +; Main Configuration File +; {descrName} +; +; Place any static configuration parameters here. +; + +[common] diff --git a/css/admin.css b/css/admin.css new file mode 100644 index 0000000..d272dc7 --- /dev/null +++ b/css/admin.css @@ -0,0 +1,21 @@ +#report-tabs{ + opacity: 0; + max-width: 725px; +} +.trail-notes{ + height: 100px; +} +.condition-label,.trail-label{ + margin-bottom: 5px; +} +.ui-datepicker-trigger{ + margin-left: 5px; + position: absolute; +} +.ui-tabs-panel .groom-date,.ui-tabs-panel .snow-base,.trail-conditions{ + margin-bottom: 20px; +} +.trail-name{ + margin-bottom: 20px; + +} diff --git a/css/readme.txt b/css/readme.txt new file mode 100644 index 0000000..954cc9c --- /dev/null +++ b/css/readme.txt @@ -0,0 +1 @@ +Add admin.css and/or front.css to this directory to have those registered automatically. \ No newline at end of file diff --git a/deactivate.php b/deactivate.php new file mode 100644 index 0000000..b7f20e8 --- /dev/null +++ b/deactivate.php @@ -0,0 +1,61 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @release admin.php,v 1.0 2014/10/31 19:31:47 cscott Exp $ + * @link http://dev.gaslightmedia.com/ + */ + +// Check that we're being called by WordPress. +if (!defined('ABSPATH')) { + die("Please do not call this code directly!"); +} + +/* + * This class performs all necessary additional work when this + * plugin is deactivated. + */ +class glmMembersjobsPluginDeactivate +{ + + /** + * WordPress Database Object + * + * @var $wpdb + * @access public + */ + public $wpdb; + /** + * Plugin Configuration Data + * + * @var $config + * @access public + */ + public $config; + + /* + * Constructor + * + * Performs all the work for this model + */ + public function __construct ($wpdb, $config) + { + + // Save WordPress Database object + $this->wpdb = $wpdb; + + // Save plugin configuration object + $this->config = $config; + + // Delete our version from WordPress Options + delete_option('glmMembersjobsPluginVersion'); + } + +} diff --git a/defines.php b/defines.php new file mode 100644 index 0000000..37d8e2e --- /dev/null +++ b/defines.php @@ -0,0 +1,64 @@ +prefix.'glm_membersjobs_'); +define('GLM_MEMBERS_JOBS_PLUGIN_ACTIVE_DB_OPTION', 'glmMembersjobsDbVersion'); + +// Determine which system we're running on - If not provided, assume PRODUCTION +$host = getenv('GLM_HOST_ID'); +if (trim($host) == '') { + $host = 'PRODUCTION'; +} +define('GLM_MEMBERS_JOBS_PLUGIN_HOST', $host); + +// Determine current http/https protocol +$pageProtocol = 'http'; +if (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == '443') { + $pageProtocol = 'https'; +} +define('GLM_MEMBERS_JOBS_PLUGIN_HTTP_PROTOCOL', $pageProtocol); + +// Get various pieces of the URL +$urlParts = parse_url(get_bloginfo('url')); +$pageUri = explode('?', $_SERVER['REQUEST_URI']); // Bust this up to access URL path and script name only + +$WPUploadDir = wp_upload_dir(); + +/* + * Create a copy of the plugin slug that can be used as a variable prefix used to keep + * global instances from clashing with instances in other plugins. + */ +$vprefix = str_replace('-', '_', GLM_MEMBERS_JOBS_PLUGIN_SLUG); +define('GLM_MEMBERS_JOBS_PLUGIN_PREFIX', $vprefix.'_'); + +// URLs +define('GLM_MEMBERS_JOBS_SITE_BASE_URL', home_url('/') ); +define('GLM_MEMBERS_JOBS_PLUGIN_URL', plugin_dir_url(__FILE__)); +define('GLM_MEMBERS_JOBS_PLUGIN_ADMIN_URL', admin_url('admin.php')); +define('GLM_MEMBERS_JOBS_PLUGIN_BASE_URL', WP_PLUGIN_URL.'/'.GLM_MEMBERS_JOBS_PLUGIN_SLUG); +define('GLM_MEMBERS_JOBS_PLUGIN_CURRENT_URL', $urlParts['scheme'].'://'.$urlParts['host'].$pageUri[0]); + +// Directories +define('GLM_MEMBERS_JOBS_PLUGIN_PATH', dirname(__FILE__)); +define('GLM_MEMBERS_JOBS_PLUGIN_SETUP_PATH', GLM_MEMBERS_JOBS_PLUGIN_PATH.'/setup'); +define('GLM_MEMBERS_JOBS_PLUGIN_DB_SCRIPTS', GLM_MEMBERS_JOBS_PLUGIN_SETUP_PATH.'/databaseScripts'); +define('GLM_MEMBERS_JOBS_PLUGIN_CLASS_PATH', GLM_MEMBERS_JOBS_PLUGIN_PATH.'/classes'); +define('GLM_MEMBERS_JOBS_PLUGIN_CONFIG_PATH', GLM_MEMBERS_JOBS_PLUGIN_PATH.'/config'); + +// Parameters related to the Main GLM Member DB plugin - Depending on what's going on these may already defined by the main plugin +$pluginsPath = str_replace(GLM_MEMBERS_JOBS_PLUGIN_SLUG, '', GLM_MEMBERS_JOBS_PLUGIN_PATH); +define('GLM_MEMBERS_JOBS_MAIN_PLUGIN_PATH', $pluginsPath.'/glm-member-db'); +define('GLM_MEMBERS_JOBS_PLUGIN_LIB_PATH', GLM_MEMBERS_JOBS_MAIN_PLUGIN_PATH.'/lib'); + diff --git a/index.php b/index.php new file mode 100644 index 0000000..0d80aa2 --- /dev/null +++ b/index.php @@ -0,0 +1,229 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @version 0.0.1 + */ + +/* + * Plugin and Database Versions + * + * Note that the database version matches the version of the last + * plugin version where there was a change in the database. + * + * Updates to checkDatabase() in glmPluginSupport.php must be + * made together with the DB_VERSION below. ONLY bump the DB + * version when there's a change in the database!! Use the + * version nunmber of that release for the DB version. + * + * We check the plugin version stored in the WordPress option below + * so that we're sure the other add-ons see an up to date + * version from this plugin. + */ +define('GLM_MEMBERS_JOBS_PLUGIN_VERSION', '0.0.1'); +define('GLM_MEMBERS_JOBS_PLUGIN_DB_VERSION', '0.0.1'); + +// This is the minimum version of the GLM Members DB plugin require for this plugin. +define('GLM_MEMBERS_JOBS_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION', '2.8.0'); + +// Check if plugin version is not current in WordPress option and if needed updated it +if (GLM_MEMBERS_JOBS_PLUGIN_VERSION != get_option('glmMembersjobsPluginVersion')) { + update_option('glmMembersjobsPluginVersion', GLM_MEMBERS_JOBS_PLUGIN_VERSION); +} + +/* + * Copyright 2014 Charles Scott (email : cscott@gaslightmedia.com) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License, version 2, as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +// Check that we're being called by WordPress. +if (!defined('ABSPATH')) { + die("Please do not call this code directly!"); +} + +/* +* Some initial setup and tests +*/ + +$startupNotices = ''; + +// Get standard defined parameters +require_once 'defines.php'; + +// Required to be able to get user capabilities when being called as a filter from the main plugin +require_once ABSPATH . 'wp-includes/pluggable.php'; + +// Include defines to tell if a plugin is active +include_once ABSPATH . 'wp-admin/includes/plugin.php'; + +/* + * Do some preliminary sanity checks + */ + +// Check if database version should be defined and it isn't - This would be a plugin/add-on setup issue +if (is_file(GLM_MEMBERS_JOBS_PLUGIN_PATH.'/setup/databaseScripts/dbVersions.php') && !defined('GLM_MEMBERS_JOBS_PLUGIN_DB_VERSION')) { + die('You have database scripts but have not defined a current database version at the top of index.php for this plugin/add-on!'); +} + +/* + * Check installation, activation, and version of main Member DB plugin + */ + +// Check for main plugin and that it's active +function glmMembersjobsPluginRequired() { + echo ' +
+

The '.GLM_MEMBERS_JOBS_PLUGIN_NAME.' add-on requires the base GLM Member DB plugin to be installed and active!

+

The '.GLM_MEMBERS_JOBS_PLUGIN_NAME.' plugin has been de-activated.

+
+ '; +} +$plugin_name = 'glm-member-db/index.php'; +$is_active = is_plugin_active($plugin_name); +if ($is_active != '1') { + add_action( 'admin_notices', 'glmMembersjobsPluginRequired' ); + deactivate_plugins('/'.GLM_MEMBERS_JOBS_PLUGIN_SLUG.'/index.php'); +} + +// Check for Minimum DB version for main Member DB +function glmMembersjobsMinVerRequired() { + echo ' +
+

The '.GLM_MEMBERS_JOBS_PLUGIN_NAME.' requires that the main GLM Member DB plugin version be no older than ' + .GLM_MEMBERS_JOBS_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION.'!
+ '.GLM_MEMBERS_JOBS_MIN_VERSION_NOTE.'

+

The '.GLM_MEMBERS_JOBS_PLUGIN_NAME.' plugin has been de-activated.

+
+ '; +} +$glmMembersDatabasePluginVersion = get_option('glmMembersDatabasePluginVersion'); +if (version_compare($glmMembersDatabasePluginVersion, GLM_MEMBERS_JOBS_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION) < 0) { + define('GLM_MEMBERS_JOBS_MIN_VERSION_NOTE', "Members DB: $glmMembersDatabasePluginVersion, Job Postings Requires: ".GLM_MEMBERS_JOBS_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION); + add_action( 'admin_notices', 'glmMembersjobsMinVerRequired'); + deactivate_plugins('/'.GLM_MEMBERS_JOBS_PLUGIN_SLUG.'/'.GLM_MEMBERS_JOBS_PLUGIN_SLUG.'.php'); +} + +/* + * Register this add-on with the main GLM Member DB plugin and get information on all add-ons loaded. + */ +require_once GLM_MEMBERS_JOBS_PLUGIN_SETUP_PATH.'/validActions.php'; +require_once GLM_MEMBERS_JOBS_PLUGIN_SETUP_PATH.'/shortcodes.php'; +if (is_file(GLM_MEMBERS_JOBS_PLUGIN_DB_SCRIPTS.'/dbVersions.php')) { + require_once GLM_MEMBERS_JOBS_PLUGIN_DB_SCRIPTS.'/dbVersions.php'; +} + +// Load Add-On Management Settings data +/* None - Need to figure out a smooth way to do this. +$glmMembersjobsManagementSettings = $wpdb->get_row( "SELECT * FROM ".GLM_MEMBERS_JOBS_PLUGIN_DB_PREFIX."management WHERE id = 1", ARRAY_A ); +unset($glmMembersjobsManagementSettings['id']); +*/ + +function glmMembersjobsRegisterAddOn($addOns) { + + // Add this add-on to the add-ons array + $addOns[GLM_MEMBERS_JOBS_PLUGIN_SLUG] = array( + 'dir' => GLM_MEMBERS_JOBS_PLUGIN_PATH, + 'name' => GLM_MEMBERS_JOBS_PLUGIN_NAME, + 'short_name' => GLM_MEMBERS_JOBS_PLUGIN_SHORT_NAME, + 'slug' => GLM_MEMBERS_JOBS_PLUGIN_SLUG, + 'actions' => $GLOBALS['glmMembersjobsAddOnValidActions'], + 'config' => array( + ), + 'shortcodes' => $GLOBALS['glmMembersjobsShortcodes'], + 'shortcodesDescription' => $GLOBALS['glmMembersjobsShortcodesDescription'] + ); + + // If we have database tables for this plugin/addon, provide that data also + if (isset($GLOBALS['glmMembersjobsDbVersions'])) { + $addOns[GLM_MEMBERS_JOBS_PLUGIN_SLUG]['database'] = array( + 'dbPrefix' => GLM_MEMBERS_JOBS_PLUGIN_DB_PREFIX, + 'dbCurrentVersion' => GLM_MEMBERS_JOBS_PLUGIN_DB_VERSION, + 'dbActiveVersionOption' => GLM_MEMBERS_JOBS_PLUGIN_ACTIVE_DB_OPTION, + 'dbScriptPath' => GLM_MEMBERS_JOBS_PLUGIN_DB_SCRIPTS, + 'dbVersions' => $GLOBALS['glmMembersjobsDbVersions'] + ); + } else { + $addOns[GLM_MEMBERS_JOBS_PLUGIN_SLUG]['database'] = false; + } + + // Return the array with our data added + return $addOns; +} +add_filter('glm-member-db-register-addon','glmMembersjobsRegisterAddOn', 10, 1); + +/* + * Plugin Update Support - uses Gaslight Media update server + */ +/* Not functional yet - Need to resolve JavaScript conflicts with this feature in other plugins +require GLM_MEMBERS_JOBS_PLUGIN_LIB_PATH.'/opentools-update-checker/opentools-update-checker.php'; +${GLM_MEMBERS_JOBS_PLUGIN_PREFIX."updateChecker"} = new OpenToolsPluginUpdateChecker( + 'http://www.gaslightmedia.com/update_server/?action=get_metadata&slug='.GLM_MEMBERS_JOBS_PLUGIN_SLUG, + __FILE__, + GLM_MEMBERS_JOBS_PLUGIN_SLUG +); + +${GLM_MEMBERS_JOBS_PLUGIN_PREFIX."updateChecker"}->declareCredentials(array( + 'license_key' => __('License Key:') +)); +*/ + +/* + * + * Activate and Deactivate hooks + * + */ + + // Activate + function glmMembersjobsPluginActivate () + { + global $wpdb, $config; + require_once GLM_MEMBERS_JOBS_PLUGIN_PATH . '/activate.php'; + new glmMembersjobsPluginActivate($wpdb, $config); + } + register_activation_hook(__FILE__, 'glmMembersjobsPluginActivate'); + + // Deactivate + function glmMembersjobsPluginDeactivate () + { + global $wpdb, $config; + require_once GLM_MEMBERS_JOBS_PLUGIN_PATH . '/deactivate.php'; + $x = new glmMembersjobsPluginDeactivate($wpdb, $config); + return false; + } + register_deactivation_hook(__FILE__, 'glmMembersjobsPluginDeactivate'); + +/* + * Hooks for testing capabilities provided by this add-on + */ +require_once GLM_MEMBERS_JOBS_PLUGIN_SETUP_PATH.'/permissions.php'; + diff --git a/js/readme.txt b/js/readme.txt new file mode 100644 index 0000000..f642355 --- /dev/null +++ b/js/readme.txt @@ -0,0 +1 @@ +Add admin.js and/or front.js to this directory to have those registered automatically. \ No newline at end of file diff --git a/lib/readme.txt b/lib/readme.txt new file mode 100644 index 0000000..8373066 --- /dev/null +++ b/lib/readme.txt @@ -0,0 +1,3 @@ +Standard class libraries not specifically developed for this add-on should be placed here. + +The classes directory should be considered instead for class libraries developed specifically for this add-on. diff --git a/misc/documentation/AddAnAdminTab.txt b/misc/documentation/AddAnAdminTab.txt new file mode 100644 index 0000000..c697b47 --- /dev/null +++ b/misc/documentation/AddAnAdminTab.txt @@ -0,0 +1,15 @@ +Add an admin tab + +* Add a new section in setup/adminTabs.php + +* Add a model file - models/admin/{menu}/{action}.php + +* Add a view file - views/admin/{menu}/{action}.html + +* Add action to setup/validActions.php + +* If needed add a database table to the create_database_V...sql file + and update name to current database version, add an + update_database_V....sql file, and/or update dbVersions.php + +* If required add a data definition for any new tables diff --git a/misc/documentation/CreateNewAddOn.txt b/misc/documentation/CreateNewAddOn.txt new file mode 100644 index 0000000..b93235f --- /dev/null +++ b/misc/documentation/CreateNewAddOn.txt @@ -0,0 +1,49 @@ +Procedure to create a new GLM Members add-on plugin +---------------------------------------------------- + +* Checkout glm-member-db-sample and rename directory to glm-member-db-{add-on name} + +* From a bash prompt, run "SETUP_SCRIPT" + +* Create new repository named WP-Plugins/glm-member-db-{name of add-on}.git + +* If there are any databases associated with this add-on, setup the database scripts and + data under the "setup/databaseScripts" directory. If there are no database tables + with this add-on, remove all but the "readme.txt" file from that directory. + NOTE: No "update_database..." files should be there for a new add-on with new tables. + NOTE: There should be only one entry in the "dbVersions.php" file. + +* Carefully review "defines.php" file and update as needed. + +* Do a quick review of the readme.txt file and update as desired. + +* TEST - At this point the add-on should install and activate but not do anything. + - If there are any database tables, make sure they were created and are correct. + - Go to "Members" -> "Management" -> "Add-Ons" and make sure the add-on was + properly registered with the main plugin and that any database data is shown. + +* Adding menus + - Update "setup/adminMenus.php" and add menu section as described there. + - Add an entry in the validActions.php file. Pay attention to how slug name is + constructed ("glm-members-admin-{page}-{action}"). + - If needed add a database table to the create_database_V...sql file + Also add a "classes/data/data{Table}.php file + - Add a model file as "models/admin/{page}/{action}.php + - Add any desired view file as "views/admin/{page}/{action}.html + Note that additional possible view files should be named as... + "views/admin/{page}/{action}{Name}.html + - Test that when add-on is activated that the menu shows and is functional. + +* Adding tabs + - Update "setup/admin/Tabs.php" and add new tab filter as described there. + - Add an entry in the validActions.php file. Pay attention to how slug name is + constructed ("glm-members-admin-{page}-{action}"). + - If needed add a database table to the create_database_V...sql file + Also add a "classes/data/data{Table}.php file + - Add a model file as "models/admin/{page}/{action}.php + - Add any desired view file as "views/admin/{page}/{action}.html + Note that additional possible view files should be named as... + "views/admin/{page}/{action}{Name}.html + - Test that when add-on is activated that the tab shows and is functional. + + * \ No newline at end of file diff --git a/models/admin/jobs/index.php b/models/admin/jobs/index.php new file mode 100644 index 0000000..d0861b6 --- /dev/null +++ b/models/admin/jobs/index.php @@ -0,0 +1,225 @@ + + * @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_JOBS_PLUGIN_CLASS_PATH.'/data/dataJobs.php'; + +class GlmMembersAdmin_jobs_index extends GlmDatajobs +{ + + /** + * WordPress Database Object + * + * @var $wpdb + * @access public + */ + public $wpdb; + /** + * Plugin Configuration Data + * + * @var $config + * @access public + */ + public $config; + /** + * Report ID + * + * @var $report ID + * @access public + */ + public $report_id = 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) + { + if( ! wp_script_is( 'jquery-ui', 'enqueued' ) ){ + wp_enqueue_script('jquery-ui-datepicker', false, array('jquery'), false, true); + wp_enqueue_style('jquery-style', '//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css'); + wp_enqueue_script("jquery-ui-tabs"); + } + $success_message = ""; + $haveReport = false; + $option = false; + $report = false; + $reportUpdated = false; + $reportUpdateError = false; + $reportAdded = false; + $reportAddError = false; + + + if (isset($_REQUEST['option']) && trim($_REQUEST['option']) != '') { + $option = $_REQUEST['option']; + } + + // get the report id for use in the edit, add and delete options + $this->report_id = ( isset( $_REQUEST['report'] ) ? filter_var( $_REQUEST['report'], FILTER_SANITIZE_STRING) : ''); + + $trail_data = $this->getList(); + + switch ($option) { + + case 'add': + + $report = $this->newEntry(); + $view_file = 'edit'; + + break; + + case 'insert': + + $report = $this->insertEntry(); +// echo '
', print_r($report), '
'; + $this->report_id = $report['fieldData']['id']; + + if ($report['status']) { + $haveReport = true; + $reportAdded = true; + + // Update created timestamp and name slug for URLs + //$this->updateSlug($this->reportID); + + // Get this again so we have the created date + $report = $this->editEntry($this->report_id); + + $option = 'edit'; + $reportAdded = true; + + } else { + $option = 'add'; + $reportAddError = true; + } + + $view_file = 'edit'; + + break; + + case 'edit': + + + + $report = $this->editEntry($this->report_id); + + // If we have a good report + if ($report['status']) { + $haveReport = true; + } + + $view_file = 'edit'; + break; + + case 'update': + + // Try to update this report + $report = $this->updateEntry($this->report_id); + + // Check if that was successful + if ($report['status']) { + $reportUpdated = true; + + $report = $this->editEntry($this->report_id); + } else { + $reportUpdateError = true; + } + + $haveReport = true; + $view_file = 'edit'; + + break; + + case 'delete': + echo "delte"; + $report = $this->deleteEntry($this->report_id,true); + + if ($report) { + $reportDeleted = true; + } else { + $reportDeleteError = true; + } + $view_file = "index"; + $trail_data = $this->getList(); + break; + default: + $trail_data = $this->getList(); + $view_file = 'index'; + break; + } + + // Compile template data + $templateData = array( + 'trailData' => $trail_data, + 'haveReport' => $haveReport, + 'reportUpdated' => $reportUpdated, + 'reportUpdateError' => $reportUpdateError, + 'reportAdded' => $reportAdded, + 'reportAddError' => $reportAddError, + 'option' => $option, + 'report' => $report, + 'assetsUrl' => GLM_MEMBERS_JOBS_PLUGIN_URL . 'assets/', + + ); + + // Return status, any suggested view, and any data to controller + return array( + 'status' => true, + 'modelRedirect' => false, + 'view' => 'admin/jobs/'.$view_file.'.html', + 'data' => $templateData + ); + } +} diff --git a/models/admin/jobs/list.php b/models/admin/jobs/list.php new file mode 100644 index 0000000..3ac00fa --- /dev/null +++ b/models/admin/jobs/list.php @@ -0,0 +1,8 @@ + + * @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_JOBS_PLUGIN_CLASS_PATH.'/data/dataJobs.php'; + +class GlmMembersFront_jobs_list extends GlmDatajobs +{ + + /** + * 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_message = ""; + $option = false; + if (isset($_REQUEST['option']) && trim($_REQUEST['option']) != '') { + $option = $_REQUEST['option']; + } + + // separate the main report info and the individual details + $trail_data = $this->getList(); + foreach($trail_data as $id=>$record){ + foreach($record as $key=>$value){ + if(strpos($key, "report") !== false){ + $JOBS['trail_report'][$id]['report_info'][$key] = $value; + } else { + $JOBS['trail_report'][$id]['trail_info'][$key] = $value; + } + } + } +// echo '
', print_r($JOBS), '
'; + $view_file = 'list'; + switch ($option) { + + case "edit": + $view_file = 'edit'; + + break; + + default: + + break; + } + + + + // Compile template data + $templateData = array( + 'trailData' => $JOBS + ); + + // Return status, any suggested view, and any data to controller + return array( + 'status' => true, + 'modelRedirect' => false, + 'view' => 'front/jobs/'.$view_file.'.html', + 'data' => $templateData + ); + + } + +} diff --git a/models/front/readme.txt b/models/front/readme.txt new file mode 100644 index 0000000..4c54852 --- /dev/null +++ b/models/front/readme.txt @@ -0,0 +1,7 @@ +The front controller executes models under this directory. + +Typically you should add a directory here that matches the category of actions that will take place. + +Under that directory place the model for the various actions. + +Actions under this directory would normally be called due to processing of a shortcode. \ No newline at end of file diff --git a/readme.txt b/readme.txt new file mode 100644 index 0000000..09b2e69 --- /dev/null +++ b/readme.txt @@ -0,0 +1,27 @@ +=== GLM Members Database Job Postings === +Contributors: cscott@gaslightmedia.com +Donate link: http://www.gaslightmedia.com +Tags: Gaslight Media,Plugin,Job Postings +Requires at least: 3.0.1 +Tested up to: 3.4 +Stable tag: 4.3 +License: GPLv2 or later +License URI: http://www.gnu.org/licenses/gpl-2.0.html + +This is the GLM Members Database Job Postings. + +== Description == + +The GLM Members Database Job Postings is an add-on to the Gaslight Media Members Database, +which is required to install and run this plugin + +== Installation == + +This section describes how to install the plugin and get it working. + +e.g. + +1. Upload `plugin-name.php` to the `/wp-content/plugins/` directory +1. Activate the plugin through the 'Plugins' menu in WordPress + + diff --git a/setup/adminHooks.php b/setup/adminHooks.php new file mode 100644 index 0000000..025d011 --- /dev/null +++ b/setup/adminHooks.php @@ -0,0 +1,44 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @release adminHooks.php,v 1.0 2014/10/31 19:31:47 cscott Exp $ + * @link http://dev.gaslightmedia.com/ + */ + +/* + * Place Misc Hooks and Filters here. If this file exists, it will be included + * by the add-on main plugin script. + * + * Note that filter and hook callback functions must be included in-line as shown below... + * + * add_filter( 'filter_title', function( $parameter ) { + * // Function code + * }); + * + * Also note that parameters will be in the context of the main admin controller constructor. + */ + +// Add content to member detail page +add_filter('glm-member-db-admin-management-hooksHelp', function($content) { + + // Read in this plugin/addon hook help file + $fname = GLM_MEMBERS_JOBS_PLUGIN_PATH.'/setup/hooksHelp.html'; + if (is_file($fname)) { + $hooksHelp = file_get_contents($fname); + if ($hooksHelp != false) { + $content .= $hooksHelp; + } + } + return $content; + }, + 10, + 2 +); diff --git a/setup/adminMenus.php b/setup/adminMenus.php new file mode 100644 index 0000000..fb5cee9 --- /dev/null +++ b/setup/adminMenus.php @@ -0,0 +1,59 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @release admin.php,v 1.0 2014/10/31 19:31:47 cscott Exp $ + * @link http://dev.gaslightmedia.com/ + */ + +/* + * Added menus or sub-menus examples + * + * // Add a main menu item + * add_menu_page( + * 'GLM Sample', // Page Title + * 'GLM Sample', // Menu Title + * 'glm-members-members', // Capability + * 'glm-members-admin-menu-glm-sample', // Menu Slug + * function() {$this->controller('sample');}, // Called function - typically controller() with the menu name + * false, // Icon URL + * '92' // Menu Position + * ); + * + * // Add a sub-menu item + * add_submenu_page( + * 'glm-members-admin-menu-sample', // Parent slug + * 'Sample', // Page title + * 'Sample', // Menu Title + * 'glm_members_edit', // Capability required + * 'glm-members-admin-menu-sample', // Menu slug + * function() {$this->controller('sample');} + * ); + * + * If creating a main menu item with add_menu_page(), please document + * that structure here. + * + * NOTE: The menu slug is the link for the page. It is also parsed by + * the controller and used to find the model to load. The + * "glm-members-admin-menu-" portion should not change, the last + * segment is the model directory name. By default the "index.php" file + * in that directory is executed. If the URL includes a "glm_action" + * parameter, then the model file called is in the same directory but + * is named the same as the "glm_action" parameter. + * + */ +add_submenu_page( + 'glm-members-admin-menu-members', + 'Job Postings', + 'Job Postings', + 'edit_posts', + 'glm-members-admin-menu-jobs-index', + function(){$this->controller('jobs');} +); diff --git a/setup/adminTabs.php b/setup/adminTabs.php new file mode 100644 index 0000000..0d6de9b --- /dev/null +++ b/setup/adminTabs.php @@ -0,0 +1,35 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @release admin.php,v 1.0 2014/10/31 19:31:47 cscott Exp $ + * @link http://dev.gaslightmedia.com/ + */ + +/* + * To add a new tab to an existing Member DB page use a block + * like this and replace the {} parameters. + * + * add_filter('glm-member-db-add-tab-for-{menu name}', + * function($addOnTabs) { + * $newTabs = array( + * array( + * 'text' => '{text for display on tab}', + * 'menu' => '{menu name}', + * 'action' => '{action to perform}' + * ) + * ); + * $addOnTabs = array_merge($addOnTabs, $newTabs); + * return $addOnTabs; + * } + * ); + * + */ + diff --git a/setup/databaseScripts/create_database_V0.0.1.sql b/setup/databaseScripts/create_database_V0.0.1.sql new file mode 100644 index 0000000..b5f9b39 --- /dev/null +++ b/setup/databaseScripts/create_database_V0.0.1.sql @@ -0,0 +1,52 @@ +-- Gaslight Media Members Database - Job Postings +-- File Created: 12/02/15 15:27:15 +-- Database Version: 0.0.2 +-- Database Creation Script +-- +-- This file is called to create a new set of tables for this +-- add-on for the most receint database version for this add-on. +-- +-- There should only be one such file in this directory +-- +-- To permit each query below to be executed separately, +-- all queries must be separated by a line with four dashes + +-- Conditions Table +CREATE TABLE {prefix}reports ( + id INT NOT NULL AUTO_INCREMENT, + report_active BOOL NOT NULL, + report_date DATE NOT NULL, + report_notes TEXT NOT NULL, + big_bay_name TEXT NOT NULL, + big_bay_cond TEXT NOT NULL, + big_bay_groom DATE NOT NULL, + big_bay_base TINYTEXT NOT NULL, + big_bay_notes TEXT NOT NULL, + alston_cond TEXT NOT NULL, + alston_name TEXT NOT NULL, + alston_groom DATE NOT NULL, + alston_base TINYTEXT NOT NULL, + alston_notes TEXT NOT NULL, + nestoria_name TEXT NOT NULL, + nestoria_cond TEXT NOT NULL, + nestoria_groom DATE NOT NULL, + nestoria_base TINYTEXT NOT NULL, + nestoria_notes TEXT NOT NULL, + chassell_name TEXT NOT NULL, + chassell_cond TEXT NOT NULL, + chassell_groom DATE NOT NULL, + chassell_base TINYTEXT NOT NULL, + chassell_notes TEXT NOT NULL, + pinery_name TEXT NOT NULL, + pinery_groom DATE NOT NULL, + pinery_base TINYTEXT NOT NULL, + pinery_notes TEXT NOT NULL, + report_blurb TEXT NOT NULL, + PRIMARY KEY (id) +); + +---- + +-- Job Postings default entries in table +INSERT INTO {prefix}reports ( id,report_date,report_notes,big_bay_name,big_bay_cond,big_bay_groom,big_bay_base,big_bay_notes,alston_name,alston_cond,alston_groom,alston_base,alston_notes,nestoria_name,nestoria_cond,nestoria_groom,nestoria_base,nestoria_notes,chassell_name,chassell_cond,chassell_groom,chassell_base,chassell_notes,pinery_name,pinery_groom,pinery_base,pinery_notes,report_blurb) VALUES +(1,NOW(),'Trail Notes','Big Bay Trail','Fair',NOW(),'8"-12"','Notes','Alston Trail','Fair',NOW(),'8"-12"','Notes','Nestoria Trail','Fair',NOW(),'8"-12"','Notes','Chassell Trail','Fair',NOW(),'8"-12"','Notes','Pinery Trail',NOW(),'8"-12"','Notes','Grooming'); \ No newline at end of file diff --git a/setup/databaseScripts/dbVersions.php b/setup/databaseScripts/dbVersions.php new file mode 100644 index 0000000..2fbb0bf --- /dev/null +++ b/setup/databaseScripts/dbVersions.php @@ -0,0 +1,38 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @release dbVersions.php,v 1.0 2014/10/31 19:31:47 cscott Exp $ + * @link http://dev.gaslightmedia.com/ + */ + + +/********************************************************************** + * NOTE: THIS IS A Job Postings FILE - DO NOT USE UNMODIFIED + * + * Please change all references to conditions, Conditions, or CONDITIONS to a name + * appropriate for your new Add-On. + * + * This file lists all versions of the database tables for this add-on. + * The last entry in the array below should be for the most recent + * version and should match the "create_database_V..." file in this + * directory. + * + * NOTE: When first creating a new add-on with database tables, there + * should only be one line in the array below and there should be no + * "update_database..." files in this directory. + * + * Remove this message before using this file in production! + **********************************************************************/ + + +$glmMembersjobsDbVersions = array( + '0.0.1' => array('version' => '0.0.1', 'tables' => 1, 'date' => '09/08/2017'), +); diff --git a/setup/databaseScripts/drop_database_V0.0.1.sql b/setup/databaseScripts/drop_database_V0.0.1.sql new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/setup/databaseScripts/drop_database_V0.0.1.sql @@ -0,0 +1 @@ + diff --git a/setup/databaseScripts/update_database_V0.0.1.sql b/setup/databaseScripts/update_database_V0.0.1.sql new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/setup/databaseScripts/update_database_V0.0.1.sql @@ -0,0 +1 @@ + diff --git a/setup/frontHooks.php b/setup/frontHooks.php new file mode 100644 index 0000000..6272ebd --- /dev/null +++ b/setup/frontHooks.php @@ -0,0 +1,27 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @release frontHooks.php,v 1.0 2014/10/31 19:31:47 cscott Exp $ + * @link http://dev.gaslightmedia.com/ + */ + +/* + * Place Misc Hooks and Filters here. If this file exists, it will be included + * by the add-on main plugin script. + * + * Note that filter and hook callback functions must be included in-line as shown below... + * + * add_filter( 'filter_title', function( $parameter ) { + * // Function code + * }); + * + * *** Also note that parameters will be in the context of the main front controller constructor. *** + */ diff --git a/setup/hooksHelp.html b/setup/hooksHelp.html new file mode 100644 index 0000000..bbe0e75 --- /dev/null +++ b/setup/hooksHelp.html @@ -0,0 +1,16 @@ + \ No newline at end of file diff --git a/setup/permissions.php b/setup/permissions.php new file mode 100644 index 0000000..68554ec --- /dev/null +++ b/setup/permissions.php @@ -0,0 +1,53 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @release permissions.php,v 1.0 2014/10/31 19:31:47 cscott Exp $ + * @link http://dev.gaslightmedia.com/ + */ + + +/* + * Below are permission checks for various specific things in this add-on and + * elsewhere in the Member DB main plugin and add-ons. + * + * Each location where a permission might be required has an apply_filters() + * hook with a tag name that includes the plugin or add-on name, the menu, + * the action, and a name for the specific thing that needs permissions. + * + * This can be included in code or in a Smarty template used in these plugins. + * For example, to check permissions for the main Members menu and it's "index" + * action to see if a member search is permitted, the template includes the + * following code... + * + * {if $membersList && apply_filters('glm_members_permit_admin_members_index_member_search', true)} + * --- some template output --- + * {/if} + * + * In the case above, it's also checking to see if the members list even exists + * before checking the permissions. The default value of "true" in the hook ensures + * that the permission is granted if nothing has linked into the hook to say otherwise. + * + * Note that each add_filter() below first checks if the permission has already + * been retracted by prior hook. This requires all that are attached to the hook + * to permit the action. + * + * Of course any of these may test more than one capability if that's desired. + * + * Since we have capabilities that only exist if a particular add-on (such as Contacts) + * has been loaded and activated, it can be helpful to be able to test for a capability + * for the current user and permit some action if that capability doesn't exist. The + * main plugin therefore provides the following globally accessible function that will + * return true if the capability doesn't exist, otherwise it respects the capability. + * + * glmMembersUserCan('glm_members_edit_any_member', $permit); + * + * $permit is a boolean set before this function call for passing on permissions. +*/ diff --git a/setup/rolesAndCapabilities.php b/setup/rolesAndCapabilities.php new file mode 100644 index 0000000..5a8bd2a --- /dev/null +++ b/setup/rolesAndCapabilities.php @@ -0,0 +1,19 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @release rolesAndPermissions.php,v 1.0 2014/10/31 19:31:47 cscott Exp $ + * @link http://dev.gaslightmedia.com/ + */ + +/** + * NOTE: This file is only included in the activate.php process. + * It is not regularly used during operation. + */ diff --git a/setup/shortcodes.php b/setup/shortcodes.php new file mode 100644 index 0000000..706f5a7 --- /dev/null +++ b/setup/shortcodes.php @@ -0,0 +1,104 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @release shortcodes.php,v 1.0 2014/10/31 19:31:47 cscott Exp $ + * @link http://dev.gaslightmedia.com/ + */ + +/* + * Array of short-code + * + * This array lists all of the short-codes available from the main + * member plugin and all add-ons that provide short-code features. + * + * This array is merged with the data from any registered add-ons + * providing short-code features. The plugin providing the short-code + * is designated in the 'plugin' elemeent. + * + * A shortcode is unique to a particular plugin. To provide additional + * data and features to a short-code, an add-on should use filters + * provided by the short-code to insert data into the template array, + * to insert additional format into the template, or to insert + * text directly into the completed template output. + * + * The "attributes" array is a list of available attributes for this + * shortcode and their default values. If a database table is provided, + * then the value for each attribute is a table column where we get + * the default value. If no table is provided, then the value for + * each attribute is the actual default value for that attribute. + * In the case that the data is taken from the database table, the + * "id" for the table entry where the data is stored is assumed to + * be 1. + * + * Note that if the value for a particular attribute is false, then + * it is not read from the database even if the table is specified + * but might be supplied at run-time as an attribute in the short-code. + * All attributes that might be specified in the shortcode must be + * listed in the 'attributes' array below. If an attribute is not + * specified here, it can't be read from the short-code. + * + * The following is an explanation of this array. + * + * array( + * '{shortcode-slug}' => array( + * 'plugin' => '{plugin (add-on) slug}', // Identifies which plugin is providing the short-code + * 'menu' => '{menu name}', // Menu name in this context is simply where to find the action + * 'action' => '{shortcode action name}', // Action used to execute this shortcode + * 'table' => '{table prefix}{table name}', // Database table where default attribute values are stored + * 'attributes' => array( // An array of all shortcode attributes (options) + * '{attr name}' => '{field name}', // Available attribute names and the database field names with the default value + * .... + * ), + * ... additional short-codes + * ) + * + * Shortcode descriptions sample + * + * ShortcodeAttributeDescription + * + * [glm-members-sample-shortcode] + *   + * + * Displays something related to this add-on. + * + * + * + *   + * type="{types}" + * + * The "type" attribute is used to select the type of data to be displayed. + * Below is a list of available list types. + *

+ * + * + * + * + *
List Types
oneType One
twoType Two
+ *

+ * + * + */ + +$glmMembersjobsShortcodes = array( + 'glm-jobs' => array( + 'plugin' => GLM_MEMBERS_JOBS_PLUGIN_SLUG, + 'menu' => 'jobs', + 'action' => 'list', + 'table' => false, + 'attributes' => array( + 'id' => true, + 'member_only' => true + ) + ), +); + +$glmMembersjobsShortcodesDescription = ''; + diff --git a/setup/validActions.php b/setup/validActions.php new file mode 100644 index 0000000..fba7242 --- /dev/null +++ b/setup/validActions.php @@ -0,0 +1,74 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @release admin.php,v 1.0 2014/10/31 19:31:47 cscott Exp $ + * @link http://dev.gaslightmedia.com/ + */ + +/* + * Array of valid menu items and actions. + * + * The higher level elements are valid menu items. These correlate to + * actual menu or sub menu items that are hooks back to this controller + * class. + * + * The lower level items below each menu item are actions that may be specified + * by a "glmMembersAction" form field. + * + * The string after the action is the slug of the plugin where the model/view + * is to perform that action. + * + * This array is integrated into the valid actions array in the main GLM Member + * DB plugin when this plugin registers itself. + * + * EXAMPLE + * + * $glmMembersjobsAddOnValidActions = array( + * 'adminActions' => array( + * 'members' => array( + * 'sample' => GLM_MEMBERS_JOBS_PLUGIN_SLUG, + * ), + * 'sample' => array( + * 'index' => GLM_MEMBERS_JOBS_PLUGIN_SLUG, + * 'more' => GLM_MEMBERS_JOBS_PLUGIN_SLUG, + * ), + * 'info' => array( + * 'index' => GLM_MEMBERS_JOBS_PLUGIN_SLUG + * ) + * ), + * 'frontActions' => array( + * 'sample' => array( + * 'list' => GLM_MEMBERS_JOBS_PLUGIN_SLUG, + * 'detail' => GLM_MEMBERS_JOBS_PLUGIN_SLUG + * ) + * ) + * ); + * + * + * + * + */ + +$glmMembersjobsAddOnValidActions = array( + 'adminActions' => array( + 'jobs' => array( + 'index' => GLM_MEMBERS_JOBS_PLUGIN_SLUG, + 'list' => GLM_MEMBERS_JOBS_PLUGIN_SLUG, + ), + ), + 'frontActions' => array( + 'jobs' => array( + 'list' => GLM_MEMBERS_JOBS_PLUGIN_SLUG + ), + ) +); + +?> \ No newline at end of file diff --git a/uninstall.php b/uninstall.php new file mode 100644 index 0000000..c8f5528 --- /dev/null +++ b/uninstall.php @@ -0,0 +1,27 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @release admin.php,v 1.0 2014/10/31 19:31:47 cscott Exp $ + * @link http://dev.gaslightmedia.com/ + */ + +// Check that we're being called by WordPress. +if (!defined('ABSPATH')) { + die("Please do not call this code directly!"); +} + +//if uninstall not called from WordPress exit +if (!defined('WP_UNINSTALL_PLUGIN')) { + die("Sorry, uninstall must be called by WordPress!"); +} diff --git a/views/admin/header.html b/views/admin/header.html new file mode 100644 index 0000000..4318c03 --- /dev/null +++ b/views/admin/header.html @@ -0,0 +1,8 @@ +
+

Job Postings

+ +
+ + diff --git a/views/admin/jobs/edit.html b/views/admin/jobs/edit.html new file mode 100644 index 0000000..4795973 --- /dev/null +++ b/views/admin/jobs/edit.html @@ -0,0 +1,149 @@ +{include file='admin/header.html'} + +{if ($option == 'add' || $haveReport)} + + Return to Reports List + + {if $option == 'edit' || $option == 'update'} + Delete this Report +

Edit Job Postings + {else} +

Add New Job Postings + {/if} +     + {if $reportUpdated}Obit Updated{/if} + {if $reportUpdateError}Obit Update Error{/if} + {if $reportAdded}Obit Added{/if} + {if $reportAddError}Obit Add Error{/if} +

+ + {if $reportUpdateError || $reportAddError} +

NOTICE: Your report has not yet been submitted.
Please select the tabs indicating a problem, correct the indicated fields and resubmit.

+ {else} + {/if} + +
+ + + {if $haveReport} + + + {else} + + {/if} + + + + + + + + + + + + + + + + + + + + +
Report Active: + + {if $report.fieldFail.report_active}

{$report.fieldFail.report_active}

{/if}
+
Report Date: + + {if $report.fieldFail.report_date.date}

{$report.fieldFail.report_date.date}

{/if}
+
Report Blurb: + + {if $report.fieldFail.report_blurb}

{$report.fieldFail.report_blurb}

{/if}
+
Report Notes: + + {if $report.fieldFail.report_notes}

{$report.fieldFail.report_notes}

{/if}
+
+
+ + {include file='admin/jobs/parts/bigBay.html'} + {include file='admin/jobs/parts/alston.html'} + {include file='admin/jobs/parts/nestoria.html'} + {include file='admin/jobs/parts/chassell.html'} + {include file='admin/jobs/parts/pinery.html'} +
+ +
+ +{else} + +

Sorry, no report found or permission not granted.

+ +{/if} + + + +
+
+

Cancel

+

+
+
+

WARNING:

+

+ Clicking the "Delete this Obit" button above will + delete all of the data and images associated with this report. + +

+

+ + Once deleted, this information will no longer be available and cannot be retrieved! + If you are unsure that you want to completely remove this data, consider changing the status + of this report to "Archived" instead. + +

+
+
+ + + +{include file='admin/footer.html'} diff --git a/views/admin/jobs/index.html b/views/admin/jobs/index.html new file mode 100644 index 0000000..a82dad3 --- /dev/null +++ b/views/admin/jobs/index.html @@ -0,0 +1,38 @@ +{include file='admin/header.html'} + + + + + + + + +
 
New Report
+ {if $trailData} + + + + + + + + {foreach $trailData as $record=>$data} + + + + + + + {/foreach} +
Report DateReport BlurbReport Notes
{$data.report_date.date}{$data.report_blurb}{$data.report_notes}EditDelete
+ + + {else if} +
No Trail Information
+ {/if} +{include file='admin/footer.html'} + diff --git a/views/admin/readme.txt b/views/admin/readme.txt new file mode 100644 index 0000000..5a9d7ea --- /dev/null +++ b/views/admin/readme.txt @@ -0,0 +1,5 @@ +The admin controller uses views (templates) under this directory to generate final output. + +Typically you should add a directory here that matches the page where the view is used. + +Under that directory place the view (template) for the various actions. \ No newline at end of file diff --git a/views/front/jobs/list.html b/views/front/jobs/list.html new file mode 100644 index 0000000..c14262f --- /dev/null +++ b/views/front/jobs/list.html @@ -0,0 +1,16 @@ +{foreach $trailData as $key=>$value} + {foreach $value as $id=>$trail} +
+
+ Report Date: {$trail.report_info.report_date.date|date_format:"%B %e, %Y"} +
+
+ {include file='front/jobs/parts/bigBay.html'} + {include file='front/jobs/parts/alston.html'} + {include file='front/jobs/parts/nestoria.html'} + {include file='front/jobs/parts/chassell.html'} + {include file='front/jobs/parts/pinery.html'} +
+
+ {/foreach} +{/foreach} \ No newline at end of file diff --git a/views/front/readme.txt b/views/front/readme.txt new file mode 100644 index 0000000..1138d90 --- /dev/null +++ b/views/front/readme.txt @@ -0,0 +1,7 @@ +The front controller uses views (templates) under this directory to generate final output. + +Typically you should add a directory here that matches the category of actions that will use these views. + +Under that directory place the view (template) for the various actions. + +Views under this directory would normally be called due to processing of a shortcode. \ No newline at end of file -- 2.17.1