- took out the .doc specification
authorharris wong <hwong@ocad.ca>
Fri, 6 Aug 2010 21:02:46 +0000 (21:02 -0000)
committerharris wong <hwong@ocad.ca>
Fri, 6 Aug 2010 21:02:46 +0000 (21:02 -0000)
- minor tweaks of display
- subscription message fixed and updated (now has a link and proper message)
- listing will now display up to 10 job post per page.
- updating description is now allowed by both admin and employer

16 files changed:
mods/job_board/admin/edit_employer.php
mods/job_board/documentation/spec.doc [deleted file]
mods/job_board/employer/home.php
mods/job_board/employer/profile.php
mods/job_board/include/classes/Employer.class.php
mods/job_board/include/classes/Job.class.php
mods/job_board/include/constants.inc.php
mods/job_board/include/html/admin/jb_edit_employer.tmpl.php
mods/job_board/include/html/admin/jb_employers.tmpl.php
mods/job_board/include/html/admin/jb_index.tmpl.php
mods/job_board/include/html/employer/jb_employer_header.tmpl.php
mods/job_board/include/html/employer/jb_home.tmpl.php
mods/job_board/include/html/employer/jb_profile.tmpl.php
mods/job_board/include/html/jb_index.tmpl.php
mods/job_board/index.php
mods/job_board/module.sql

index a84c8c0..410c9f4 100644 (file)
@@ -37,6 +37,7 @@ if ($_POST['submit']){
        $email = $_POST['jb_employer_email'];
        $email2 = $_POST['jb_employer_email2'];
        $website = $_POST['jb_employer_website'];
+    $description = $_POST['jb_employer_description'];
        $approval_state = $_POST['jb_employer_approval_state'];
 
        //check if email has been changed.  If it's been changed, check the 2 emails.
@@ -68,7 +69,7 @@ if ($_POST['submit']){
        //set approval state
        $employer->setApprovalState($approval_state);
 
-       if ($employer->updateProfile($name, $company, $email, $website)){
+       if ($employer->updateProfile($name, $company, $email, $website, $description)){
                $msg->addFeedback('JB_PROFILE_UPDATED');
        } else {
                $msg->addError('DB_NOT_UPDATED');
@@ -82,6 +83,7 @@ $savant->assign('name', $employer->getName());
 $savant->assign('company', $employer->getCompany());
 $savant->assign('email', $employer->getEmail());
 $savant->assign('website', $employer->getWebsite());
+$savant->assign('description', $employer->getDescription());
 $savant->assign('approval_state', $employer->getApprovalState());
 $savant->display('admin/jb_edit_employer.tmpl.php');
 include(AT_INCLUDE_PATH.'footer.inc.php'); 
diff --git a/mods/job_board/documentation/spec.doc b/mods/job_board/documentation/spec.doc
deleted file mode 100644 (file)
index 0a5fd32..0000000
Binary files a/mods/job_board/documentation/spec.doc and /dev/null differ
index 9c603a9..4304872 100644 (file)
@@ -51,8 +51,8 @@ if ($_GET['order']==''){
 }
 
 include(AT_INCLUDE_PATH.'header.inc.php');
-$savant->display('employer/jb_employer_header.tmpl.php');
 echo '<div class="pageinator_box">';
+$savant->display('employer/jb_employer_header.tmpl.php');
 print_paginator($page, sizeof($all_job_posts), $page_string, AT_JB_ROWS_PER_PAGE);
 echo '</div>';
 $savant->assign('job_obj', $job);
index a0f9879..9e0b580 100644 (file)
@@ -35,6 +35,7 @@ if ($_POST['submit']){
        $email = $_POST['jb_employer_email'];
        $email2 = $_POST['jb_employer_email2'];
        $website = $_POST['jb_employer_website'];
+    $description = $_POST['jb_employer_description'];
 
        //check if email has been changed.  If it's been changed, check the 2 emails.
        if ($email!=$employer->getEmail()){
@@ -62,7 +63,7 @@ if ($_POST['submit']){
            $employer->updatePassword($pass);
        } 
 
-       if ($employer->updateProfile($name, $company, $email, $website)){
+       if ($employer->updateProfile($name, $company, $email, $website, $description)){
                $msg->addFeedback('JB_PROFILE_UPDATED');
        } else {
                $msg->addFeedback('DB_NOT_UPDATED');
@@ -78,6 +79,7 @@ $savant->assign('name', $employer->getName());
 $savant->assign('company', $employer->getCompany());
 $savant->assign('email', $employer->getEmail());
 $savant->assign('website', $employer->getWebsite());
+$savant->assign('description', $employer->getDescription());
 $savant->display('employer/jb_profile.tmpl.php');
 include(AT_INCLUDE_PATH.'footer.inc.php'); 
 ?>
index 2302fce..cb235ad 100644 (file)
@@ -55,23 +55,23 @@ class Employer{
     }
 
        function getName(){
-               return htmlentities_utf8($this->name);
+               return $this->name;
        }
        
        function getEmail(){
-               return htmlentities_utf8($this->email);
+               return $this->email;
        }
 
        function getCompany(){
-               return htmlentities_utf8($this->company);
+               return $this->company;
        }
        
        function getDescription(){
-           return htmlentities_utf8($this->description);
+           return $this->description;
     }
 
        function getWebsite(){
-               return htmlentities_utf8($this->website);
+               return $this->website;
        }
        
        function getLastLogin(){
@@ -105,16 +105,18 @@ class Employer{
         * @param       string          company's name
         * @param       string          employer's email
         * @param       string          employer's website.
+     * @param   string      employer's description
         * @return      null
         */
-        function updateProfile($name, $company, $email, $website){
+        function updateProfile($name, $company, $email, $website, $description){
                global $addslashes, $db;
                $name = $addslashes($name);
                $company = $addslashes($company);
                $email = $addslashes($email);
                $website = $addslashes($website);
+        $description = $addslashes($description);
                
-               $sql = 'UPDATE '.TABLE_PREFIX."jb_employers SET employer_name='$name', company='$company', email='$email', website='$website' WHERE id=".$this->id;
+               $sql = 'UPDATE '.TABLE_PREFIX."jb_employers SET employer_name='$name', company='$company', email='$email', website='$website', description='$description' WHERE id=".$this->id;
                $result = mysql_query($sql, $db);
                if ($result){
                        return true;
index 3f3e215..b01efa2 100644 (file)
@@ -36,11 +36,15 @@ class Job{
         */
        function addJob($title, $description, $categories, $is_public, $closing_date){
                require(AT_INCLUDE_PATH . 'classes/phpmailer/atutormailer.class.php');
-               global $addslashes, $db, $msg, $_config;
+               global $addslashes, $db, $msg, $_config, $_base_href;
                
                if($_SESSION['jb_employer_id']<1){
                    $msg->addError();   //authentication error
                    exit;
+        } else {
+            include(AT_JB_INCLUDE.'Employer.class.php');
+            $employer = new Employer($_SESSION['jb_employer_id']);
+            $employer_id = $employer->getId();
         }
 
                $title = $addslashes($title);
@@ -48,7 +52,7 @@ class Job{
                $is_public = (isset($is_public))?1:0;
                $closing_date = $addslashes($closing_date);
                $approval_state = ($_config['jb_posting_approval']==1)?AT_JB_POSTING_STATUS_UNCONFIRMED:AT_JB_POSTING_STATUS_CONFIRMED; 
-               $sql = 'INSERT INTO '.TABLE_PREFIX."jb_postings (employer_id, title, description, is_public, closing_date, created_date, revised_date, approval_state) VALUES ($_SESSION[jb_employer_id], '$title', '$description', $is_public, '$closing_date', NOW(), NOW(), $approval_state)";
+               $sql = 'INSERT INTO '.TABLE_PREFIX."jb_postings (employer_id, title, description, is_public, closing_date, created_date, revised_date, approval_state) VALUES ($employer_id, '$title', '$description', $is_public, '$closing_date', NOW(), NOW(), $approval_state)";
                $result = mysql_query($sql, $db);
                $posting_id = mysql_insert_id();
 
@@ -57,18 +61,19 @@ class Job{
                        foreach($categories as $id => $category){
                                $category = intval($category);
                                $sql = 'INSERT INTO '.TABLE_PREFIX."jb_posting_categories (posting_id, category_id) VALUES ($posting_id, $category)";
-                               mysql_query($sql, $db);
+                               mysql_query($sql, $db);                
 
                                //send out notification if the person is subscribed to the category.
                                $sql = 'SELECT m.member_id, m.email FROM '.TABLE_PREFIX.'jb_category_subscribes cs LEFT JOIN '.TABLE_PREFIX."members m ON cs.member_id=m.member_id WHERE category_id=$category";
                                $result = mysql_query($sql, $db);
+                $post_link = $_base_href . AT_JB_BASENAME . 'view_post.php?jid='.$posting_id;
                                if($result){
                                        while($row = mysql_fetch_assoc($result)){
                                                $mail = new ATutorMailer;
                                                $mail->AddAddress($row['email'], get_display_name($row['member_id']));
-                                               $body = _AT('jb_subscription_msg', $this->getCategoryNameById($category), $title);
-                                               $body .= "\n----------------------------------------------\n";
-                                               $body .= _AT('posted_by').": ".get_display_name($row['member_id'])."\n";
+                                               $body = _AT('jb_subscription_msg', $title, $this->getCategoryNameById($category), $post_link);
+                                               $body .= "\n\n";
+                                               $body .= _AT('jb_posted_by').": ".htmlentities_utf8($employer->getCompany())."\n";
                                                $mail->FromName = $_config['site_name'];
                                                $mail->From     = $_config['contact_email'];
                                                $mail->Subject = _AT('jb_subscription_mail_subject');
index 83545b9..995e0c4 100644 (file)
@@ -17,7 +17,7 @@ define('AT_JB_BASENAME',      'mods/job_board/');
 define('AT_JB_BASE',           AT_INCLUDE_PATH.'../mods/job_board/');
 define('AT_JB_INCLUDE',                AT_JB_BASE.'include/');
 
-define('AT_JB_ROWS_PER_PAGE',          5);     //row per page constant, default is 50 (same as output.inc.php)
+define('AT_JB_ROWS_PER_PAGE',          10);    //row per page constant, default is 50 (same as output.inc.php)
 
 
 //Employer Statuses
index f36eb92..b7a3e57 100644 (file)
@@ -69,6 +69,11 @@ function encrypt_password() {
                        <input type="text" name="jb_employer_website" id="jb_employer_website" value="<?php echo htmlentities_utf8($this->website); ?>"/>
                </div>
 
+<div class="row">
+                       <label for="jb_employer_description"><?php echo _AT('jb_company_description'); ?></label><br/>
+                       <textarea id="jb_employer_description" name="jb_employer_description" ><?php echo htmlentities_utf8($this->description); ?></textarea>
+               </div>
+
                <div class="row">
                <input type="hidden" name="jb_employer_password_hidden" value="" />
                <input class="hidden" name="jb_employer_password_error" />
index 432f1b6..5f2a224 100644 (file)
     <?php if(!empty($this->employers)): ?>
     <?php foreach($this->employers as $employer): ?>
     <tr>
-        <td><?php echo $employer->getUsername(); ?></td>
-        <td><?php echo $employer->getName(); ?></td>
-        <td><?php echo $employer->getEmail(); ?></td>
-        <td><?php echo $employer->getCompany(); ?></td>
-        <td><?php echo $employer->getDescription(); ?></td>
-        <td><?php echo $employer->getWebsite(); ?></td>
-        <td><?php echo $employer->getLastLogin(); ?></td>
+        <td><?php echo htmlentities_utf8($employer->getUsername()); ?></td>
+        <td><?php echo htmlentities_utf8($employer->getName()); ?></td>
+        <td><?php echo htmlentities_utf8($employer->getEmail()); ?></td>
+        <td><?php echo htmlentities_utf8($employer->getCompany()); ?></td>
+        <td><?php echo htmlentities_utf8($employer->getDescription()); ?></td>
+        <td><?php echo htmlentities_utf8($employer->getWebsite()); ?></td>
+        <td><?php echo htmlentities_utf8($employer->getLastLogin()); ?></td>
         <?php 
                        switch($employer->getApprovalState()){
                                case AT_JB_STATUS_UNCONFIRMED:
index 8dd1cda..9e42956 100644 (file)
@@ -20,7 +20,7 @@
                        <td><a href="<?php echo AT_JB_BASENAME.'admin/view_post.php?jid='.$row['id'];?>" title="<?php echo $row['title']; ?>"><?php echo $row['title']; ?></a></td>
                        <td><?php 
                                        $employer = new Employer($row['employer_id']);
-                                       echo $employer->getCompany(); 
+                                       echo htmlentities_utf8($employer->getCompany());
                                ?>
                        </td>
                        <td>                            
index 6479b4b..f8ac067 100644 (file)
@@ -7,3 +7,4 @@
        <a href="<?php echo AT_JB_BASENAME;?>employer/registration.php"><?php echo _AT('jb_employer_registration');?></a>
        <?php endif; ?>
 </div>
+<div style="clear:both;"></div>
index 335d5d5..a868e09 100644 (file)
@@ -19,7 +19,7 @@
                        <td><a href="<?php echo AT_JB_BASENAME.'employer/view_post.php?jid='.$row['id'];?>" title="<?php echo $row['title']; ?>"><?php echo $row['title']; ?></a></td>
                        <td><?php 
                                                $employer = new Employer($row['employer_id']);
-                                               echo $employer->getCompany(); 
+                                               echo htmlentities_utf8($employer->getCompany()); 
                                        ?>
                        </td>
                        <td>                            
index 6abc6fa..2577e2a 100644 (file)
@@ -59,6 +59,11 @@ function encrypt_password() {
                        <input type="text" name="jb_employer_website" id="jb_employer_website" value="<?php echo htmlentities_utf8($this->website); ?>"/>
                </div>
 
+        <div class="row">
+                       <label for="jb_employer_description"><?php echo _AT('jb_company_description'); ?></label><br/>
+                       <textarea id="jb_employer_description" name="jb_employer_description" ><?php echo htmlentities_utf8($this->description); ?></textarea>
+               </div>
+
                <div class="row">
                <input type="hidden" name="jb_employer_password_hidden" value="" />
                <input class="hidden" name="jb_employer_password_error" />
index 42f3dd0..4579fcd 100644 (file)
@@ -3,12 +3,6 @@ if ($search_string!=''){
        $search_string = SEP.$search_string;
 }
 ?>
-<?php if(isset($_SESSION['member_id']) && $_SESSION['member_id'] >0): ?>
-<div>
-       <a href="<?php echo AT_JB_BASENAME.'subscribe.php'; ?>"><?php echo _AT('jb_subscribe'); ?></a>
-</div>
-<?php endif; ?>
-
 <div>
        <table class="data static" summary="" rules="rows">
                <thead>
@@ -35,7 +29,7 @@ if ($search_string!=''){
                                <td><a href="<?php echo AT_JB_BASENAME.'view_post.php?jid='.$row['id'];?>" title="<?php echo $row['title']; ?>"><?php echo $row['title']; ?></a></td>
                                <td><?php 
                                                $employer = new Employer($row['employer_id']);
-                                               echo $employer->getCompany(); 
+                                               echo htmlentities_utf8($employer->getCompany());
                                        ?>
                                </td>
                                <td>
index d60e07b..7f0ef5e 100644 (file)
@@ -104,8 +104,15 @@ include(AT_INCLUDE_PATH.'header.inc.php');?>
 </form>
 <div style="clear:both;"></div>
 <div>
-<?php
-print_paginator($page, sizeof($all_job_posts), $search_string.SEP.$page_string, AT_JB_ROWS_PER_PAGE);
+<div class="pageinator_box">
+<?php if(isset($_SESSION['member_id']) && $_SESSION['member_id'] >0): ?>
+<div style="clear:left;">
+       <a href="<?php echo AT_JB_BASENAME.'subscribe.php'; ?>"><?php echo _AT('jb_subscribe'); ?></a>
+</div>
+<?php endif; ?>
+<?php print_paginator($page, sizeof($all_job_posts), $search_string.SEP.$page_string, AT_JB_ROWS_PER_PAGE); ?>
+</div>
+<?php 
 $savant->assign('job_posts', $current_job_posts);
 $savant->assign('bookmark_posts', $bookmark_posts);
 $savant->assign('job_obj', $job);
index 47ade29..e27bde1 100644 (file)
@@ -83,6 +83,7 @@ INSERT INTO `language_text` VALUES ('en', '_module','jb_archive','Archive',NOW()
 INSERT INTO `language_text` VALUES ('en', '_module','jb_company_description','Company Description',NOW(),'');
 INSERT INTO `language_text` VALUES ('en', '_module','jb_post_description','Description',NOW(),'');
 INSERT INTO `language_text` VALUES ('en', '_module','jb_post_description_note','Description should include Job Overview, Responsibilities, Qualifications, Contact Information',NOW(),'');
+INSERT INTO `language_text` VALUES ('en', '_module','jb_posted_by','Job posted by:',NOW(),'');
 INSERT INTO `language_text` VALUES ('en', '_module','jb_closing_date','Closing Date',NOW(),'');
 INSERT INTO `language_text` VALUES ('en', '_module','jb_login','Employer sign-in',NOW(),'');
 INSERT INTO `language_text` VALUES ('en', '_module','jb_logout','Employer sign-out',NOW(),'');
@@ -106,7 +107,6 @@ INSERT INTO `language_text` VALUES ('en', '_module','jb_website','Website',NOW()
 INSERT INTO `language_text` VALUES ('en', '_module','jb_confirmed','Confirmed',NOW(),'');
 INSERT INTO `language_text` VALUES ('en', '_module','jb_unconfirmed','Unconfirmed',NOW(),'');
 INSERT INTO `language_text` VALUES ('en', '_module','jb_approval_state','Approval State',NOW(),'');
-
 INSERT INTO `language_text` VALUES ('en', '_module','jb_approval_state_confirmed','Approved',NOW(),'');
 INSERT INTO `language_text` VALUES ('en', '_module','jb_approval_state_unconfirmed','Disapproved',NOW(),'');
 INSERT INTO `language_text` VALUES ('en', '_module','jb_required_posting_approval','New posting requires approval',NOW(),'');
@@ -119,7 +119,7 @@ INSERT INTO `language_text` VALUES ('en', '_module','jb_email_confirmation_subje
 INSERT INTO `language_text` VALUES ('en', '_module','jb_email_confirmation_message','You have registered for a job board account on %1s.  Please finish the registration process by confirming your email address by using the following link: %2s.',NOW(),'');
 INSERT INTO `language_text` VALUES ('en', '_module','jb_add_to_cart','Bookmark this post',NOW(),'');
 INSERT INTO `language_text` VALUES ('en', '_module','jb_remove_from_cart','Remove this bookmark',NOW(),'');
-INSERT INTO `language_text` VALUES ('en', '_module','jb_subscription_msg','Hi, a new job post titled %2s has been added to the ATutor Job Board %1s category.',NOW(),'');
+INSERT INTO `language_text` VALUES ('en', '_module','jb_subscription_msg','Hi, \n\nA new job post titled %2s has been added to the ATutor Job Board %1s category.  The job post can be found at the following link, %3s.',NOW(),'');
 INSERT INTO `language_text` VALUES ('en', '_module','jb_subscription_mail_subject','New Job Post in ATutor',NOW(),'');
 INSERT INTO `language_text` VALUES ('en', '_module','jb_any_categories','Any categories',NOW(),'');
 INSERT INTO `language_text` VALUES ('en', '_module','jb_view_job_post','View a job post',NOW(),'');