* Table Name
*/
- $this->table = GLM_MEMBERS_BUY_SELL_PLUGIN_DB_PREFIX . 'buy_sell';
+ $this->table = GLM_MEMBERS_BUY_SELL_PLUGIN_DB_PREFIX . 'items';
// -- Conditions Table
//CREATE TABLE {prefix}conditions (
// Database table prefixes - change if using add-on tables
global $wpdb;
-define('GLM_MEMBERS_BUY_SELL_PLUGIN_DB_PREFIX', $wpdb->prefix.'glm_membersBuySell');
+define('GLM_MEMBERS_BUY_SELL_PLUGIN_DB_PREFIX', $wpdb->prefix.'glm_membersBuySell_');
define('GLM_MEMBERS_BUY_SELL_PLUGIN_ACTIVE_DB_OPTION', 'glmMembersBuySellDbVersion');
// Determine which system we're running on - If not provided, assume PRODUCTION
<?php
/**
* Gaslight Media Members Database
- * Job Postings
+ * Buy Sell
*
* PHP version 5.5
*
*/
public $config;
/**
- * Job ID
+ * item ID
*
- * @var $job ID
+ * @var $item ID
* @access public
*/
- public $job_id = false;
+ public $item_id = false;
/*
* Constructor
$success_message = "";
- $haveJob = false;
+ $haveItem = false;
$option = false;
- $job = false;
- $job_data = false;
- $jobUpdated = false;
- $jobUpdateError = false;
- $jobAdded = false;
- $jobAddError = false;
+ $item = false;
+ $item_data = false;
+ $itemUpdated = false;
+ $itemUpdateError = false;
+ $itemAdded = false;
+ $itemAddError = false;
$view_file = 'index';
$lockedToMember = false;
$isModerated = false;
$this->fields['admin_phone']['required'] = true;
// Check for Member Menu Use
- } elseif (defined('GLM_JOB_MEMBER_MENU')) {
+ } elseif (defined('GLM_item_MEMBER_MENU')) {
// Try to get member ID
$memberID = (isset($_REQUEST['member']) ? $_REQUEST['member'] : 0);
$option = $_REQUEST['option'];
}
- // get the Job id for use in the edit, add and delete options
+ // get the item id for use in the edit, add and delete options
// Get obit ID if supplied
- if (isset($_REQUEST['job'])) {
+ if (isset($_REQUEST['item'])) {
// Make sure it's numeric
- $this->job_id= ($_REQUEST['job'] - 0);
+ $this->item_id= ($_REQUEST['item'] - 0);
- if ($this->job_id <= 0) {
- $this->job_id = false;
+ if ($this->item_id <= 0) {
+ $this->item_id = false;
}
}
- $job_data = $this->getList($where);
+ $item_data = $this->getList($where);
// echo '<pre>', print_r($this->getList()), '</pre>';
// echo '<pre>', print_r($_REQUEST), '</pre>';
switch ($option) {
case 'add':
- $job = $this->newEntry();
+ $item = $this->newEntry();
$view_file = 'edit';
break;
case 'insert':
- $job = $this->insertEntry();
- $this->job_id = $job['fieldData']['id'];
+ $item = $this->insertEntry();
+ $this->item_id = $item['fieldData']['id'];
- if ($job['status']) {
- $haveJob = true;
- $jobAdded = true;
+ if ($item['status']) {
+ $haveItem = true;
+ $itemAdded = true;
// Update created timestamp and name slug for URLs
- //$this->updateSlug($this->JobID);
+ //$this->updateSlug($this->itemID);
// Get this again so we have the created date
- $job = $this->editEntry($this->job_id);
+ $item = $this->editEntry($this->item_id);
$option = 'edit';
- $jobAdded = true;
+ $itemAdded = true;
} else {
$option = 'add';
- $jobAddError = true;
+ $itemAddError = true;
}
$view_file = 'edit';
break;
case 'edit':
- $job = $this->editEntry($this->job_id);
+ $item = $this->editEntry($this->item_id);
- // If we have a good Job
- if ($job['status']) {
- $haveJob = true;
+ // If we have a good item
+ if ($item['status']) {
+ $haveItem = true;
}
$view_file = 'edit';
break;
case 'update':
- // Try to update this Job
- $job = $this->updateEntry($this->job_id);
+ // Try to update this item
+ $item = $this->updateEntry($this->item_id);
// Check if that was successful
- if ($job['status']) {
- $jobUpdated = true;
+ if ($item['status']) {
+ $itemUpdated = true;
- $job = $this->editEntry($this->job_id);
+ $item = $this->editEntry($this->item_id);
} else {
- $jobUpdateError = true;
+ $itemUpdateError = true;
}
- $haveJob = true;
+ $haveItem = true;
$view_file = 'edit';
break;
case 'delete':
- $job = $this->deleteEntry($this->job_id,true);
+ $item = $this->deleteEntry($this->item_id,true);
- if ($job) {
- $jobDeleted = true;
+ if ($item) {
+ $itemDeleted = true;
} else {
- $jobDeleteError = true;
+ $itemDeleteError = true;
}
$view_file = "list";
- $job_data = $this->getList();
+ $item_data = $this->getList();
break;
default:
- $job_data = $this->getList($where);
+ $item_data = $this->getList($where);
$view_file = 'list';
break;
}
// echo '<pre>', print_r($this->getList()), '</pre>';
// Compile template data
$templateData = array(
- 'jobData' => $job_data,
+ 'itemData' => $item_data,
'memberList' => $member_list,
'lockedToMember' => $lockedToMember,
'haveMember' => $haveMember,
'memberID' => $memberID,
- 'jobID' => $this->job_id,
- 'haveJob' => $haveJob,
- 'jobUpdated' => $jobUpdated,
- 'jobUpdateError' => $jobUpdateError,
- 'jobAdded' => $jobAdded,
- 'jobAddError' => $jobAddError,
+ 'itemID' => $this->item_id,
+ 'haveItem' => $haveItem,
+ 'itemUpdated' => $itemUpdated,
+ 'itemUpdateError' => $itemUpdateError,
+ 'itemAdded' => $itemAdded,
+ 'itemAddError' => $itemAddError,
'option' => $option,
- 'job' => $job,
+ 'item' => $item,
'assetsUrl' => GLM_MEMBERS_BUY_SELL_PLUGIN_URL . 'assets/',
);
-- all queries must be separated by a line with four dashes
-- Conditions Table
-CREATE TABLE {prefix}buy_sell (
+CREATE TABLE {prefix}items (
id INT NOT NULL AUTO_INCREMENT,
topic int NULL ,
title TEXT NULL ,
----
-- Job Titles default entries in table
-INSERT INTO {prefix}buy_sell (
+INSERT INTO {prefix}items (
id,title,descr,topic,contact_email,contact_name,contact_phone,post_date,visible,
terms,location,item_expiration,image_3,post,image_1,
company,member,image_2
-) VALUES ( 1, 1,"DESCRIPTION",'SALARY', 'EMAIL LOCATION', 'CONTACT NAME', '453-3443', NOW(), true,
-'facility operations', 'REQUIREMENTS', 'JOB LOCATION', 30, 'JOB DURATION', 'DEADLINE', 'POSITION AVAILABLE',
-'COMPANY', 1, 'JOB BENEFITS'
+) VALUES ( 1, "TITLE", "DESCR", 1, "CONTACT_EMAIL", "CONTACT_NAME", "CONTACT_PHONE", NOW(), true, "TERMS", "LOCATION", 60, "IMAGE_3", "POST",
+"IMAGE_1", "COMPANY", 1, "IMAGE_2"
);
\ No newline at end of file
--- /dev/null
+<?php
+/**
+ * Gaslight Media Members Database
+ * GLM Members Buy Sell DB Versions
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmMembersDatabase
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @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 BUY SELL 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!
+ **********************************************************************/
+
+
+$glmMembersBuySellDbVersions = array(
+ '0.0.1' => array('version' => '0.0.1', 'tables' => 1, 'date' => '09/15/2017'),
+);
+{include file='admin/header.html'}
+{if $haveMember}
+<input type="hidden" name="member" value="{$memberID}">
+{if !$lockedToMember}
+<input type="hidden" name="glm_action" value="buySell">
+{/if}
+<input type="hidden" name="option" value="list">
+{/if}
+ {if $itemData}
+ <div class="admin-new-job">
+ <a class="admin-new-job-link" href="{$thisUrl}?page={$thisPage}&glm_action=index&option=add">New item</a>
+ </div>
+ <div class="admin-job-list-header glm-row">
+ <div class="job-title-list-header glm-small-12 glm-medium-4 glm-large-3 glm-columns no-padding">Topic</div>
+ <div class="job-company-list-header glm-small-12 glm-medium-4 glm-large-3 glm-columns no-padding">Forsale Item</div>
+ <div class="job-date-list-header glm-small-12 glm-medium-4 glm-large-3 glm-columns no-padding">Item Post Date</div>
+ <div class="job-date-list-header glm-small-12 glm-medium-4 glm-large-3 glm-columns no-padding">Post For</div>
+ </div>
+ {foreach $itemData as $item=>$data}
+ <div class='glm-row admin-job-list-row'>
+ <div class="glm-small-12 glm-columns admin-job-list">
+ <div class="glm-row admin-job-data">
+ <div class="job-title-list glm-small-12 glm-large-3 glm-columns no-padding">{$data.topic.name}</div>
+ <div class="job-company-list glm-small-12 glm-large-3 glm-columns no-padding">{$data.title}</div>
+ <div class="job-date-list glm-small-12 glm-large-3 glm-columns no-padding">{$data.post_date.timestamp|date_format:"%Y-%m-%d"}</div>
+ <div class="job-date-list glm-small-12 glm-large-3 glm-columns no-padding">{$data.item_expiration.name}</div>
+ </div>
+ </div>
+ <div class="glm-small-12 glm-columns admin-job-list">
+ <a href="{$thisUrl}?page={$thisPage}&glm_action=index&option=edit&job={$data.id}">Edit</a>
+ <a href="{$thisUrl}?page={$thisPage}&glm_action=index&option=delete&job={$data.id}">Delete</a>
+ </div>
+ </div>
+ {/foreach}
+ <script>
+ jQuery(document).ready(function($) {
+
+ });
+ </script>
+ {else if}
+ <div class="no-item-data"> No Items</div>
+ {/if}
+{include file='admin/footer.html'}
\ No newline at end of file
--- /dev/null
+<div class="wrap">
+ <h2>Items</h2>
+ <h2 class="nav-tab-wrapper">
+ <a href="{$thisUrl}?page={$thisPage}&glm_action=index" class="nav-tab{if $thisAction==index} nav-tab-active{/if}">Dashboard</a>
+ </h2>
+ <div id="glm-admin-content-container">
+
+