'updated' => array (
'field' => 'updated',
'type' => 'datetime',
- 'use' => 'a'
+ 'use' => 'lge'
),
'visible' => array (
'field' => 'visible',
'type' => 'text',
'use' => 'a'
),
+ 'repost' => array (
+ 'field' => 'repost',
+ 'type' => 'checkbox',
+ 'use' => 'a'
+ ),
'deadline' => array (
'field' => 'deadline',
'type' => 'text',
{
return $r;
}
+/**
+ * Update timestamps for created, updated, approved
+ *
+ * @param string $field Field to update
+ * @param integer $id ID of For Sale Item
+ *
+ * @return void
+ */
+ public function updateTimestamp($field = false, $id = false,$item = false,$updated = false){
+
+ if (!in_array($field, array('created', 'updated', 'approved')) || !$id) {
+ return false;
+ }
+ if($item){
+ if( $item['fieldData']['repost']['value'] == 1){
+ $sql = "
+ UPDATE ".$this->table."
+ SET $field = now()
+ WHERE id = $id
+ ;";
+ $this->wpdb->query($sql);
+ }else if($item['fieldData']['repost']['value'] == 0 && $updated == NULL){
+ $sql = "
+ UPDATE ".$this->table."
+ SET updated = post_date
+ WHERE id = $id AND updated IS NULL
+ ;";
+ $this->wpdb->query($sql);
+ }
+ }
+ }
+ /**
+ * Checks if Item should be re-posted
+ *
+ * @param string $field Field to update
+ * @param integer $id ID of For Sale Item
+ *
+ * @return void
+ */
+ public function getUpdatedTime($id = false){
+ // echo '<pre>', print_r($item, true), '</pre>';
+ $sql = "SELECT updated FROM ".$this->table." WHERE id = $id;";
+ $updated = $this->wpdb->get_var($sql);
+ return $updated;
+ }
}
?>
\ No newline at end of file
$this->checkNewJobTitles();
$job = $this->insertEntry();
$this->job_id = $job['fieldData']['id'];
+ $updated = $this->getUpdatedTime($this->job_id);
if ($job['status']) {
$haveJob = true;
$job_titles = $job_titles->getList();
// Get this again so we have the created date
$job = $this->editEntry($this->job_id);
+ $this->updateTimestamp('updated', $this->job_id,$job,$updated);
// $job = $this->addNewTitle($job);
$option = 'edit';
break;
case 'update':
-
+ $updated = $this->getUpdatedTime($this->job_id);
// Try to update this Job
$job = $this->updateEntry($this->job_id);
$this->checkNewJobTitles();
}
$job_titles = $job_titles->getList();
$job_data = $this->getList($where);
+ $this->updateTimestamp('updated', $this->job_id,$job,$updated);
$haveJob = true;
$view_file = 'edit';
'duration'=>$value['duration'],
'benefits'=>$value['bentext'],
'post_date'=>$value['ds'],
+ 'updated'=>$value['ds'],
'requirements'=>$value['requirements'],
'member'=>$value['member'],
'position_available'=>$value['position_available'],
'%s',
'%s',
'%s',
+ '%s',
'%d',
'%s',
'%s',
if (isset($_REQUEST['option']) && trim($_REQUEST['option']) != '') {
$option = $_REQUEST['option'];
}
- $where .= "CURDATE() <= DATE_ADD(post_date, INTERVAL job_expiration DAY) ";
+ $where .= "CURDATE() <= DATE_ADD(updated, INTERVAL job_expiration DAY) AND visible = true ";
if (isset($_REQUEST['job_titles']) && $_REQUEST['job_titles'] !== '') {
// Make sure it's numeric
$job_title_id = ($_REQUEST['job_titles'] - 0);
} else {
$job_data = $this->getList($where);
}
-
$view_file = 'list';
// Compile template data
contact_name TINYTEXT NULL ,
contact_phone TINYTEXT NULL ,
post_date DATETIME NULL DEFAULT NOW(),
- updated DATETIME NULL DEFAULT NOW(),
+ updated DATETIME NULL,
visible BOOL NULL,
facility_operation TEXT NULL,
requirements TEXT NULL,
duration TINYTEXT NULL ,
deadline TINYTEXT NULL ,
company TINYTEXT NULL ,
+ repost TINYTEXT NULL ,
position_available TINYTEXT NULL ,
member INT NULL,
PRIMARY KEY (id)
<h2 class="nav-tab-wrapper" style="margin-bottom: 1em;">
<a id="glm-Job-descr" data-show-table="glm-table-descr" class="glm-Job-tab nav-tab nav-tab-active">Job Postings</a>
</h2>
+ <!-- RE-POST -->
+ <div class="glm-item-row glm-row">
+ <div class="glm-small-12 glm-medium-2 glm-columns admin-item-label">
+ Re-Post <br> (restart expiration interval)
+ </div>
+ <div class="glm-small-12 glm-medium-5 glm-columns admin-item-input">
+ <input id="item-repost" data-id="item-repost" type="checkbox" name="repost" class="repost-checkbox">
+ </div>
+ </div>
<!-- JOB TITLE -->
<div class="glm-job-row glm-row">
<div class="glm-small-12 glm-medium-2 glm-columns admin-job-label">
{if $data.member} {$data.member} {else} {/if}
</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"}
+ {$data.updated.timestamp|date_format:"%Y-%m-%d"}
</div>
</div>
</div>
<span>Company: </span>{$value.company}
</div>
<div class="job-date-list glm-small-12 glm-columns no-padding">
- <span>Posted: </span>{$value.post_date.timestamp|date_format:"%Y-%m-%d"}
+ <span>Posted: </span>{$value.updated.timestamp|date_format:"%Y-%m-%d"}
</div>
<a href="{$siteBaseUrl}job-detail/?job={$value.id}">Full Job Description</a>
</div>