initial commit develop
authorSteve Sutton <steve@gaslightmedia.com>
Mon, 18 Jan 2016 17:23:28 +0000 (12:23 -0500)
committerSteve Sutton <steve@gaslightmedia.com>
Mon, 18 Jan 2016 17:23:28 +0000 (12:23 -0500)
.gitignore [new file with mode: 0644]
index.php [new file with mode: 0644]
tmp/wordPress.tpl [new file with mode: 0644]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..4015fd7
--- /dev/null
@@ -0,0 +1 @@
+tmp_c
diff --git a/index.php b/index.php
new file mode 100644 (file)
index 0000000..72c3d04
--- /dev/null
+++ b/index.php
@@ -0,0 +1,130 @@
+<?php
+require '../setup.phtml';
+require '../../CommonApps/Smarty/3.1/Smarty.class.php';
+require_once '../Toolkit/Database.php';
+$smarty = new Smarty();
+$smarty->setTemplateDir('./tmp/');
+$smarty->setCompileDir('./tmp_c/');
+$smarty->setConfigDir('./configs/');
+$smarty->setCacheDir('./cache/');
+
+$dbh = Toolkit_Database::getInstance();
+
+$sql = "
+SELECT *
+  FROM employment
+ORDER BY employment_id";
+
+$stmt = $dbh->query($sql);
+
+$getCategorySql = "
+  SELECT emp_cat_name
+    FROM emp_cat
+   WHERE emp_cat_id = :emp_cat_id";
+$getCategory = $dbh->prepare($getCategorySql);
+
+$getDepartmentSql = "
+  SELECT department_name
+    FROM department
+   WHERE department_id = :department_id";
+$getDepartment = $dbh->prepare($getDepartmentSql);
+
+$getTitleSql = "
+  SELECT title_name
+    FROM title
+   WHERE title_id = :title_id";
+$getTitle = $dbh->prepare($getTitleSql);
+
+$getEduSql = "
+  SELECT edu_req_name
+    FROM edu_req
+   WHERE edu_req_id = :edu_req_id";
+$getEdu = $dbh->prepare($getEduSql);
+
+$getLicSql = "
+  SELECT lic_req_name
+    FROM lic_req
+   WHERE lic_req_id = :lic_req_id";
+$getLic = $dbh->prepare($getLicSql);
+$data = array();
+
+function nicename($name) {
+    $name = str_replace('\'"', '', $name);
+    $name = str_replace(' ', '-', $name);
+    return strtolower($name);
+}
+
+while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
+    $prDate = mktime();
+    $row['pubDate'] = date('r', $prDate);
+    $row['pr_date'] = date('Y-m-d H:i:s', $prDate);
+    if ($row['status'] == '1') {
+        $row['status'] = 'Full Time';
+    } else if ($row['status'] == 2) {
+        $row['status'] = 'Part Time';
+    }
+    $getTitle->bindParam(':title_id', $row['title_id'], PDO::PARAM_INT);
+    $getTitle->execute();
+    $row['title'] = $getTitle->fetchColumn();
+    $row['ping_name'] = nicename($row['title']);
+    
+    // for the description
+    $description = '';
+    if ($row['edu_req_id']) {
+        $getEdu->bindParam(':edu_req_id', $row['edu_req_id'], PDO::PARAM_INT);
+        $getEdu->execute();
+        $description .= '<p><b>Education Requirement:</b> ' . $getEdu->fetchColumn().'</p>';
+    }
+    if ($row['lic_req_id']) {
+        $getLic->bindParam(':lic_req_id', $row['lic_req_id'], PDO::PARAM_INT);
+        $getLic->execute();
+        $description .= '<p><b>License/Certifications:</b> ' . $getLic->fetchColumn().'</p>';
+    }
+    if ($row['comments']) {
+        $description .= '<p><b>Comments:</b> ' . $row['comments'];
+    }
+    if ($row['qualifications']) {
+        $description .= '<p><b>Primary Purpose:</b> ' . $row['qualifications'].'</p>';
+    }
+    if ($row['benefits']) {
+        $description .= '<p><b>Essential Responsibilities:</b> ' . $row['benefits'].'</p>';
+    }
+    if ($row['add_job_resp']) {
+        $description .= '<p><b>Additional Job Responsibilities:</b> ' . $row['add_job_resp'].'</p>';
+    }
+    if ($row['description']) {
+        $description .= '<p><b>General Information:</b> ' . $row['description'].'</p>';
+    }
+    $row['description'] = $description;
+    $data[$row['employment_id']] = $row;
+    // getting category
+    $getCategory->bindParam(':emp_cat_id', $row['emp_cat_id'], PDO::PARAM_INT);
+    $getCategory->execute();
+    $categories = $getCategory->fetchAll(PDO::FETCH_ASSOC);
+    $data[$row['employment_id']]['categories'] = array();
+    $data[$row['employment_id']]['start_date'] = mktime();
+    $data[$row['employment_id']]['expire_date'] = strtotime($row['expire_date']);
+    foreach ($categories as $category) {
+        $data[$row['employment_id']]['categories'][] = array(
+            'nicename' => nicename($category['emp_cat_name']),
+            'name'     => $category['emp_cat_name']
+        );
+    }
+    //getting department
+    $getDepartment->bindParam(':department_id', $row['department_id'], PDO::PARAM_INT);
+    $getDepartment->execute();
+    $department = $getDepartment->fetchAll(PDO::FETCH_ASSOC);
+    $data[$row['employment_id']]['departments'] = array();
+    foreach ($department as $department) {
+        $data[$row['employment_id']]['departments'][] = array(
+            'nicename' => nicename($department['department_name']),
+            'name'     => $department['department_name']
+        );
+    }
+}
+$smarty->assign('created_date', date('Y-m-d H:i'));
+$smarty->assign('exportTitle', 'Emmet County Government');
+$smarty->assign('siteUrl', 'www.emmetcounty.org');
+$smarty->assign('data', $data);
+$smarty->display('wordPress.tpl');
+
diff --git a/tmp/wordPress.tpl b/tmp/wordPress.tpl
new file mode 100644 (file)
index 0000000..37b57c6
--- /dev/null
@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!-- This is a WordPress eXtended RSS file generated by WordPress as an export of your site. -->
+<!-- It contains information about your site's posts, pages, comments, categories, and other content. -->
+<!-- You may use this file to transfer that content from one site to another. -->
+<!-- This file is not intended to serve as a complete backup of your site. -->
+
+<!-- To import this information into a WordPress site follow these steps: -->
+<!-- 1. Log in to that site as an administrator. -->
+<!-- 2. Go to Tools: Import in the WordPress admin panel. -->
+<!-- 3. Install the "WordPress" importer from the list. -->
+<!-- 4. Activate & Run Importer. -->
+<!-- 5. Upload this file using the form provided on that page. -->
+<!-- 6. You will first be asked to map the authors in this export file to users -->
+<!--    on the site. For each author, you may choose to map to an -->
+<!--    existing user on the site or to create a new user. -->
+<!-- 7. WordPress will then import each of the posts, pages, comments, categories, etc. -->
+<!--    contained in this file into your site. -->
+
+<!-- generator="WordPress/4.3.1" created="{$created_date}" -->
+<rss version="2.0"
+       xmlns:excerpt="http://wordpress.org/export/1.2/excerpt/"
+       xmlns:content="http://purl.org/rss/1.0/modules/content/"
+       xmlns:wfw="http://wellformedweb.org/CommentAPI/"
+       xmlns:dc="http://purl.org/dc/elements/1.1/"
+       xmlns:wp="http://wordpress.org/export/1.2/"
+>
+
+<channel>
+       <title>{$exportTitle}</title>
+       <link>http://{$siteUrl}</link>
+       <description></description>
+       <pubDate>{$pubDate}</pubDate>
+       <language>en-US</language>
+       <wp:wxr_version>1.2</wp:wxr_version>
+       <wp:base_site_url>http://{$siteUrl}</wp:base_site_url>
+       <wp:base_blog_url>http://{$siteUrl}</wp:base_blog_url>
+
+       <wp:author><wp:author_id>1</wp:author_id><wp:author_login>Steve</wp:author_login><wp:author_email>steve@gaslightmedia.com</wp:author_email><wp:author_display_name><![CDATA[Steve]]></wp:author_display_name><wp:author_first_name><![CDATA[]]></wp:author_first_name><wp:author_last_name><![CDATA[]]></wp:author_last_name></wp:author>
+
+
+       <generator>http://wordpress.org/?v=4.3.1</generator>
+    {foreach $data as $row}
+       <item>
+               <title>{$row.title}</title>
+               <link>http://{$siteUrl}/{$row.ping_name}/</link>
+               <pubDate>{$row.pubDate}</pubDate>
+               <dc:creator><![CDATA[Steve]]></dc:creator>
+               <guid isPermaLink="false">http://{$siteUrl}/?p={$row.employment_id}</guid>
+               <description><![CDATA[]]></description>
+               <content:encoded><![CDATA[{$row.description}]]></content:encoded>
+               <excerpt:encoded><![CDATA[]]></excerpt:encoded>
+               <wp:post_id>{$row.id}</wp:post_id>
+               <wp:post_date>{$row.pr_date}</wp:post_date>
+               <wp:post_date_gmt>{$row.pr_date}</wp:post_date_gmt>
+               <wp:comment_status>closed</wp:comment_status>
+               <wp:ping_status>open</wp:ping_status>
+               <wp:post_name>{$row.ping_name}</wp:post_name>
+               <wp:status>publish</wp:status>
+               <wp:post_parent>0</wp:post_parent>
+               <wp:menu_order>0</wp:menu_order>
+               <wp:post_type>emmet_jobs</wp:post_type>
+               <wp:post_password></wp:post_password>
+               <wp:is_sticky>0</wp:is_sticky>
+                {foreach $row.categories as $category}
+<category domain="emmet_jobscategory" nicename="{$category.nicename}"><![CDATA[{$category.name}]]></category>
+                {/foreach}
+                {foreach $row.departments as $department}
+<category domain="emmet_jobsdepartment" nicename="{$department.nicename}"><![CDATA[{$department.name}]]></category>
+                {/foreach}
+                <wp:postmeta>
+                       <wp:meta_key>_edit_last</wp:meta_key>
+                       <wp:meta_value><![CDATA[3]]></wp:meta_value>
+               </wp:postmeta>
+               <wp:postmeta>
+                       <wp:meta_key>emmet_jobs_startdate</wp:meta_key>
+                       <wp:meta_value><![CDATA[{$row.start_date}]]></wp:meta_value>
+               </wp:postmeta>
+               <wp:postmeta>
+                       <wp:meta_key>emmet_jobs_enddate</wp:meta_key>
+                       <wp:meta_value><![CDATA[{$row.expire_date}]]></wp:meta_value>
+               </wp:postmeta>
+               <wp:postmeta>
+                       <wp:meta_key>emmet_jobs_status</wp:meta_key>
+                       <wp:meta_value><![CDATA[{$row.status}]]></wp:meta_value>
+               </wp:postmeta>
+               <wp:postmeta>
+                       <wp:meta_key>emmet_jobs_pay_grade</wp:meta_key>
+                       <wp:meta_value><![CDATA[{$row.pay_grade}]]></wp:meta_value>
+               </wp:postmeta>
+               <wp:postmeta>
+                       <wp:meta_key>emmet_jobs_shift</wp:meta_key>
+                       <wp:meta_value><![CDATA[{$row.primary_shift}]]></wp:meta_value>
+               </wp:postmeta>
+               <wp:postmeta>
+                       <wp:meta_key>emmet_jobs_contact</wp:meta_key>
+                       <wp:meta_value><![CDATA[{$row.hr_contact}]]></wp:meta_value>
+               </wp:postmeta>
+                <wp:postmeta>
+                       <wp:meta_key>emmet_jobs_phone</wp:meta_key>
+                       <wp:meta_value><![CDATA[{$row.hr_phone}]]></wp:meta_value>
+               </wp:postmeta>
+               <wp:postmeta>
+                       <wp:meta_key>emmet_jobs_email</wp:meta_key>
+                       <wp:meta_value><![CDATA[{$row.hr_email}]]></wp:meta_value>
+               </wp:postmeta>
+               <wp:postmeta>
+                       <wp:meta_key>emmet_jobs_comments</wp:meta_key>
+                       <wp:meta_value><![CDATA[]]></wp:meta_value>
+               </wp:postmeta>
+               <wp:postmeta>
+                       <wp:meta_key>emmet_jobs_code</wp:meta_key>
+                       <wp:meta_value><![CDATA[{$row.job_code}]]></wp:meta_value>
+               </wp:postmeta>
+       </item>
+    {/foreach}
+</channel>
+</rss>