Not signed in (Sign In)
Welcome Guest!
Want to take part in these discussions? If you have an account, sign in now.
If you don't have an account, apply for one now.
  1.  
    Alright, first off, THANK YOU!!! I love the job board, and it works great. I have a quick question that someone might hopefully be able to answer. I want to add a "Expires In" and "Salary" field to the posting section of the job board. Now, ive already modified the source code a little so that the public cant post jobs unless they know the url. But, I need to know now how to implement these two fields. I have both of them showing up on the post page. But I cant get the values to get into the database. The database has a row created for them too. My goal with the expires field, is to enter the number of days I want the posting to appear for, and then have the system automatically disable it after that period. I found the post on how to do this with a basic 30 day period, so that wont be that hard. But i need to get an idea why it isnt loading the value of expires into the database. Im assuming its in the page_write.php file, and ive tried adding things here and there, but nothing. Thanks again. If you want the code i currently have, or the URL of the job board, let me know. Thanks in advance.
    • CommentAuthorfilip
    • CommentTimeJan 29th 2008
     

    Hi, betterofficer,
    I’ll give you some general pointers:

    1. page_write.php
    In the $data array (around line 88 and then again at around 147) add the 2 new pairs (key => value). The value should be a variable with the same name as the html field’s name property.

    2. _includes/class.Job.php
    public function Create… add in the sql query the new fields.
    You might also want to do that in public function Edit.

    Let me know how it works!

  2.  
    Thanks for the reply. Here is the code for the $data array. I alreay had the 'expires' field there. Yet, in the database, it isnt inserting the value.

    $data = array('company' => $company,
    'url' => $url,
    'title' => $title,
    'city_id' => $city_id,
    'category_id' => $category_id,
    'type_id' => $type_id,
    'description' => $description,
    'location_outside_ro_where' => $location_outside_ro_where,
    'expires' => $expires,
    'apply' => '',
    'poster_email' => $poster_email,
    'apply_online' => $apply_online);
    $id = $job->Create($data);




    And then my class.job.php i had expires in these places:
    class Job
    {
    var $mId = false;
    var $mTypeId = false;
    var $mCategoryId = false;
    var $mTitle = false;
    var $mDescription = false;
    var $mCompany = false;
    var $mLocation = false;
    var $mUrl = false;
    var $mApply = false;
    var $mCreatedOn = false;
    var $mIsTemp = false;
    var $mIsActive = false;
    var $mViewsCount = false;
    var $mAuth = false;
    var $mCityId = false;
    var $mLocationOutsideRo = false;
    var $mExpires = false;
    var $mPosterEmail = false;
    var $mUrlTitle = false;
    var $mApplyOnline = false;
    var $mCategoryName = false;
    var $mClosedOn = false;
    var $mDaysOld = false;

    And...........
    $sanitizer = new Sanitizer;
    $sql = 'SELECT a.type_id AS type_id, a.category_id AS category_id, a.title AS title, a.description AS description,
    a.company AS company, a.url AS url, a.apply AS apply,
    DATE_FORMAT(a.created_on, \'%d-%m-%Y\') AS created_on, a.created_on AS mysql_date,
    a.is_temp AS is_temp, a.is_active AS is_active,
    a.views_count AS views_count, a.auth AS auth, a.city_id AS city_id, a.outside_location AS outside_location,
    a.expires AS expires,
    a.poster_email AS poster_email, a.apply_online AS apply_online, b.name AS category_name,
    DATE_ADD(created_on, INTERVAL 30 DAY) AS closed_on, DATEDIFF(NOW(), created_on) AS days_old
    FROM jobs a, categories b
    WHERE a.category_id = b.id AND a.id = ' . $job_id;

    And...........
    $this->mCityId = $row['city_id'];
    $this->mMySqlDate = $row['mysql_date'];
    $this->mLocationOutsideRo = $row['outside_location'];
    $this->mExpires = $row['expires'];
    $this->mPosterEmail = $row['poster_email'];
    $this->mUrlTitle = $sanitizer->sanitize_title_with_dashes($this->mTitle . ' at ' . $this->mCompany);
    $this->mApplyOnline = $row['apply_online'];


    So it sounds like i already did what you asked there. So I dont get why this isnt working. Any more suggestions?

    This is my table for the database:
    --
    -- Table structure for table `jobs`
    --

    CREATE TABLE IF NOT EXISTS `jobs` (
    `id` int(10) unsigned NOT NULL auto_increment,
    `type_id` int(11) NOT NULL,
    `category_id` int(11) NOT NULL,
    `title` varchar(100) default '',
    `description` text,
    `company` varchar(150) default '',
    `city_id` int(11) NOT NULL,
    `url` varchar(150) default NULL,
    `apply` varchar(200) default '',
    `created_on` timestamp NOT NULL default '0000-00-00 00:00:00',
    `is_temp` tinyint(4) NOT NULL,
    `is_active` tinyint(4) NOT NULL,
    `views_count` int(11) NOT NULL,
    `auth` varchar(32) NOT NULL,
    `outside_location` varchar(150) NOT NULL,
    `poster_email` varchar(100) NOT NULL,
    `apply_online` tinyint(4) NOT NULL,
    `expires` tinyint(3) NOT NULL,
    PRIMARY KEY (`id`),
    KEY `type_id` (`type_id`),
    KEY `category_id` (`category_id`)
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;

    --
    -- Dumping data for table `jobs`
    --


    Thanks again in advance.
  3.  
    Any ideas guys? Im trying to get this implemented as soon as I can as its a big part of the website i have. I thought I had it right, but i guess not.
    • CommentAuthordaelan
    • CommentTimeFeb 14th 2008
     
    I'm having a similar issue.

    I've followed all the same steps and the data isnt going into the database.
  4.  
    I managed to get the salary fields working - but have hit one snag.

    1. page_write.php
    In the $data array (around line 88 and then again at around 147) add the 2 new pairs (key => value). The value should be a variable with the same name as the html field’s name property.

    2. Create a new field "salary" at the end of the jobs table using phpmyadmin

    3. _includes/class.Job.php

    Add in the text

    var $mCategoryName = false;
    var $mClosedOn = false;
    var $mDaysOld = false;
    var $mSalary = false;

    -----
    and also
    ----

    $sql = 'SELECT a.type_id AS type_id, a.category_id AS category_id, a.title AS title, a.description AS description,
    a.company AS company, a.url AS url, a.apply AS apply,
    DATE_FORMAT(a.created_on, \'%d-%m-%Y\') AS created_on, a.created_on AS mysql_date,
    a.is_temp AS is_temp, a.is_active AS is_active,
    a.views_count AS views_count, a.auth AS auth, a.city_id AS city_id, a.outside_location AS outside_location, a.salary AS salary,
    a.poster_email AS poster_email, a.apply_online AS apply_online, b.name AS category_name,
    DATE_ADD(created_on, INTERVAL 30 DAY) AS closed_on, DATEDIFF(NOW(), created_on) AS days_old
    FROM jobs a, categories b
    WHERE a.category_id = b.id AND a.id = ' . $job_id;

    -----
    and also

    ---
    $this->mUrlTitle = $sanitizer->sanitize_title_with_dashes($this->mTitle . ' at ' . $this->mCompany);
    $this->mApplyOnline = $row['apply_online'];
    $this->mDaysOld = $row['days_old'];
    $this->mSalary = $row['salary'];
    -----
    and also

    ---

    'location_outside_ro' => $this->mLocationOutsideRo,
    'poster_email' => $this->mPosterEmail,
    'apply_online' => $this->mApplyOnline,
    'check_poster_email' => $this->CheckPosterEmail(),
    'salary' => $this->mSalary,
    'days_old' => $this->mDaysOld);

    -----
    and also
    -----

    'apply' => stripslashes($this->mApply),
    'city_id' => $this->mCityId,
    'mysql_date' => $this->mMySqlDate,
    'location_outside_ro' => $this->mLocationOutsideRo,
    'salary' => $this->mSalary,
    'days_old' => $this->mDaysOld);
    return $job;

    ---
    and also

    ---


    'mysql_date' => $this->mMySqlDate,
    'location_outside_ro' => $this->mLocationOutsideRo,
    'days_old' => $this->mDaysOld,
    'salary' => $this->mSalary,
    'is_active' => $this->mIsActive);
    ---

    and also

    --- $sql = 'INSERT INTO jobs (type_id, category_id, title, description, company, city_id, url, apply, created_on, is_temp, is_active,
    views_count, auth, outside_location, poster_email, apply_online, salary)
    VALUES (' . $params['type_id'] . ',
    ' . $params['category_id'] . ',
    "' . $params['title'] . '",
    "' . $params['description'] . '",
    "' . $params['company'] . '",
    ' . $params['city_id'] . ',
    "' . $params['url'] . '",
    "' . $params['apply'] . '",
    NOW(), 1, 0, 0, "' . $this->GenerateAuthCode() . '",
    "' . $params['location_outside_ro_where'] . '",
    "' . $params['poster_email'] . '",
    ' . $params['apply_online'] . ',
    "' . $params['salary'] . '"
    )';
    ----

    This seems to work fine on the category pages, but not on the home page where I seem to get the following area

    Notice: Undefined property: Job::$mMySqlDate in /home/default/helper4.co.uk/user/htdocs/01test/jobs/_includes/class.Job.php on line 118

    Fatal error: Call to a member function fetch_assoc() on a non-object in /home/default/helper4.co.uk/user/htdocs/01test/jobs/_includes/class.Job.php on line 923

    I can get it to work by using the URL www.yoursite.co.uk/jobs/jobs but not www.yoursite.co.uk/jobs/jobs

    4. Change publish-write.tpl
    To add in a field to be able to input the salary details using something like
    <input type="text" name="salary" id="salary" size="50" maxlength="100" value="{$job.salary}"/>

    5. Change job-details.tpl
    To be able to see the salary details using the {$job.salary} command

    Anyone have any idea of how to solve the landing page errors.
    • CommentAuthorcade
    • CommentTimeMar 12th 2008
     
    where's the field to include the expires field in html
    • CommentAuthorcocopapa
    • CommentTimeMay 17th 2008
     

    Any updates on how to add the expire and salary field succefully? Would be really appreciated, perhaps somebody could post his working solution here, so we could learn from it. Thanks in advance.

    • CommentAuthortrdunsworth
    • CommentTimeJun 10th 2008 edited
     
    I thought I had it working, but sadly, it broke on me too. I had to back everything out in order to get back to normal functionality.