--- /dev/null
+<?php
+namespace Glm\Employment\Controller;
+defined('ABSPATH') or die();
+
+class AdminController
+{
+ const TABLE_NAME = 'emp_app';
+ const DB_OPTION = 'glm_emp_db_version';
+ const DB_VERSION = '1.2';
+
+ public function initalizeActivationHooks()
+ {
+ \register_activation_hook(
+ 'glm-employment/glm-employment.php',
+ array($this, 'installApplication')
+ );
+ \register_activation_hook(
+ 'glm-employment/glm-employment.php',
+ array($this, 'initializeData')
+ );
+ \add_action('plugins_loaded', array($this, 'pluginUpdateDbCheck'));
+ }
+
+ public function installApplication()
+ {
+ global $wpdb;
+
+ $tableName = $wpdb->prefix . SELF::TABLE_NAME;
+
+ $charset_collate = '';
+
+ if (!empty($wpdb->charset)) {
+ $charset_collate .= "DEFAULT CHARACTER SET {$wpdb->charset}";
+ }
+
+ if (!empty($wpdb->collate)) {
+ $charset_collate .= " COLLATE {$wpdb->collate}";
+ }
+
+ $sql = "CREATE TABLE {$tableName} (
+ id mediumint (9) NOT NULL AUTO_INCREMENT,
+ time datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
+ name text NOT NULL,
+ description text,
+ qualifications text,
+ benefits text,
+ primary_shift text,
+ comments text,
+ expire_date datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
+ pay_grade text,
+ job_code text,
+ status text,
+ active bool DEFAULT 0,
+ hr_contact text,
+ hr_phone text,
+ hr_email text,
+ UNIQUE KEY id (id)
+ ) $charset_collate;";
+
+ require_once ABSPATH . 'wp-admin/includes/upgrade.php';
+ \dbDelta($sql);
+
+ \add_option(SELF::DB_OPTION, SELF::DB_VERSION);
+ }
+
+ public function initializeData()
+ {
+ global $wpdb;
+
+ $tableName = $wpdb->prefix . SELF::TABLE_NAME;
+
+ $testData = array(
+ 'time' => \current_time('mysql'),
+ 'name' => 'Test 1',
+ 'expire_date' => '2015-02-12 00:00:00'
+ );
+ $wpdb->insert(
+ $tableName,
+ $testData
+ );
+ }
+
+ public function pluginUpdateDbCheck()
+ {
+ if (\get_option(SELF::DB_OPTION) != SELF::DB_VERSION) {
+ $this->installApplication();
+ }
+ \update_option(SELF::DB_OPTION, SELF::DB_VERSION);
+ }
+
+}
--- /dev/null
+<?php
+/**
+ * Plugin Name: Gaslight Media Employment
+ * Description: Online Employment Application for Gaslight Media Clients.
+ * Version: 1.0
+ * Author: Steve Sutton
+ * Author URI: http://www.gaslightmedia.com
+ * License: All right reserved
+ */
+namespace Glm\Employment;
+use Glm\Employment as Emp;
+
+defined('ABSPATH') or die();
+
+require_once 'controllers/admin.php';
+use Glm\Employment\Controller as Controller;
+
+class Setup
+{
+ public function __construct()
+ {
+ $adminController = new Controller\AdminController();
+ $adminController->initalizeActivationHooks();
+ }
+}
+
+$employmentApp = new Emp\Setup();
--- /dev/null
+Gaslight Media Online Employment Application
+ Class setup for MVC
+
+Models:
+ job.php = job posting
+ application.php = user submitted application form
+
+
+Views:
+ Admin
+ index.php
+ listJobs.php
+ editJob.php
+ listApplications.php
+ viewApplication.php
+ printApplication.php
+
+ Front
+ index.php
+ listJobs.php
+ viewJob.php
+ applyOnline.php
+
+
+Controllers:
+ pluginController.php
+ Used to setup the actions and hooks for the plugin to function in admin or the front.
+
+ adminController.php = for the admin side
+ activate-plugin.php
+ should have an init function for creating the database tables
+ upgrade-plugin.php
+ should have functions for upgrading the database versions
+
+ frontController.php = for front end
+
+