Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • brentwilliams2 Friend
    #192218

    (This is a fix for version 1.0.4)

    JA Job Board allows employers to delete jobs in the front end, not just unpublish them. This means that the job just disappears completely off the site, and creates holes of data. Not ideal at all, but there is no fix quite yet. In the meantime, I have done a pretty pitiful adjustment to at least remove the delete functionality, and have them email us to unpublish the job. Open views/jajobs/tmpl/jaview.php.

    Find the following code:

    <img title="<?php echo JText::_('DELETE_JOB'); ?>" src="<?php echo JURI::base().'components/com_jajobboard/images/icon_delete.gif' ?>" alt="<?php echo JText::_('DELETE_JOB'); ?>" />  
    <a class="btn-function" href="javascript:submitbutton_view('remove',<?php echo $item->id; ?>);" onclick="return confirm('<?php echo JText::_('DO_YOU_WANT_TO_DELETE_THIS_JOB', TRUE).'?';?>')">
    <span style="vertical-align: top !important;"><?php echo JText::_('DELETE_JOB'); ?></span>
    </a>  

    Replace with this code:

    <?php
    if($item->status=='Approved'){
    ?>
    <img title="<?php echo JText::_('DELETE_JOB'); ?>" src="<?php echo JURI::base().'components/com_jajobboard/images/icon_delete.gif' ?>" alt="<?php echo JText::_('DELETE_JOB'); ?>" />  
    <a class="btn-function" href="mailto:youremail@yourdomain.com&subject=Please unpublish job #<?php echo $item->id; ?>">
    <span style="vertical-align: top !important;">Unpublish</span>
    </a>  
    <?php } ?>

    This makes it so the employer emails you with the job number in the email. It also does not show the option if the job is already disapproved. Like I said, this is not a good solution, but it is better than jobs disappearing because the employer deleted them.

    Also, I recommend adding this code at the end of the table rows earlier in the document. This tells the employer the status of the job, so they know if it is enabled, unpublished, or expired.

    <?php if ($item->user_id == $user->id && $item->user_id!=0) :?>
    <tr class="sectiontableentry2">
    <td width="20%" class="jajb-title">
    Job Status:
    </td>
    <td width="80%">
    <?php if($item->status=='Approved'){
    echo '<span style="color:green">Published</span>';
    }
    if($item->status=='Expired'){
    echo '<span style="color:red">Expired</span>';
    }
    if($item->status=='Non-Approved'){
    echo '<span style="color:red">Unpublished</span>';
    }
    ?>
    </td>
    </tr>
    <?php endif; ?>

    brentwilliams2 Friend
    #512373

    This fix is deprecated! Her0 shared a true fix here: http://www.joomlart.com/forums/topic/adding-unpublish-function-to-front-end-employer/#post-512285

    After Her0’s fix, and the technical aspects of the issue are done, I thought it might help to work on the user-experience aspect. With the base fix Her0 mentioned, it was still a bit confusing as to whether someone was approving a job or dis-approving it. Plus, “publishing” and “unpublishing” are probably clearer was to say this. Lastly, the “X” image showed regardless of what state it was, so I made some changes to views/jajobs/tmpl/jaview.php:

    <?php if($item->status=='Approved'){?>
    <img title="<?php echo JText::_('DELETE_JOB'); ?>" src="<?php echo JURI::base().'components/com_jajobboard/images/icon_delete.gif' ?>" alt="<?php echo JText::_('DELETE_JOB'); ?>" />  
    <?php } ?>
    <?php if($item->status=='Non-Approved'){?>
    <img title="Publish Job" src="<?php echo JURI::base().'components/com_jajobboard/images/Check-16x16.png' ?>" alt="Publish Job" />  
    <?php } ?>
    <a class="btn-function" href="javascript:submitbutton_view('<?php echo (trim(strtolower($item->status))=="approved") ? "non-approved" : "approved"?>',<?php echo $item->id; ?>);" >
    <span style="vertical-align: top !important;"><?php echo (trim(strtolower($item->status))=="approved") ? "Unpublish Job" : "Publish Job" ?></span>
    </a>  

    For the above change, you need to replace the previous delete section entirely, including the image. This will then use clear terms like “Unpublish Job” with an “X” next to it, and “Publish Job” with a green checkmark next to it.

    I also wanted to make the system messages more clear when it redirected, so I edited controllers/jajobs.php. Find “function approved()” and replace the entire function with this:

    function approved()
    {
    $option = JBCOMNAME;
    //Brent added the $succ_msg in the if/else statement, and referenced it below. Also added itemid on redirects
    if ($this->getTask() == 'approved') {
    $status = 'Approved';
    $succ_msg = "You have successfully published this job";
    } else {
    $status = 'Non-Approved';
    $succ_msg = "You have successfully unpublished this job";
    }

    $model = $this->getModel('jajobs');

    if (!$model->approved($status)) {
    return $this->setRedirect(JRoute::_("index.php?option=".JBCOMNAME."&view=jajobs&Itemid=79", false), JText::_($model->getError(true)), 'error');
    }

    $this->setRedirect(JRoute::_("index.php?option=".JBCOMNAME."&view=jajobs&Itemid=79", false), $succ_msg);
    }

    This change not only gives a clearer message on what happened, but I also added the Itemid so the the redirect link would be SEF link friendly. Make sure to change the Itemid number with the primary menu number for your jobs installation.

Viewing 2 posts - 1 through 2 (of 2 total)

This topic contains 2 replies, has 1 voice, and was last updated by  brentwilliams2 10 years, 7 months ago.

We moved to new unified forum. Please post all new support queries in our New Forum