?
Path : /home/admin/public_html/old/promice/components/com_jsjobs/controllers/ |
Current File : /home/admin/public_html/old/promice/components/com_jsjobs/controllers/jsjobs.php |
<?php /** + Created by: Ahmad Bilal * Company: Al-Barr Technologies + Contact: www.al-barr.com , info@al-barr.com * Created on: Jan 11, 2009 ^ + Project: Job Posting and Employment Application * File Name: controllers/jsjobs.php ^ * Description: Controller class for application data ^ * History: NONE ^ */ defined('_JEXEC') or die('Restricted access'); jimport('joomla.application.component.controller'); class JSJobsControllerJsjobs extends JController { function __construct() { $user =& JFactory::getUser(); if ($user->guest) { // redirect user if not login $link = 'index.php?option=com_user'; $this->setRedirect($link); } parent :: __construct(); } function jobapply() { global $mainframe; $model = $this->getModel('jsjobs', 'JSJobsModel'); $session = &JFactory::getSession(); $uid = &JRequest::getString('uid','none'); $params = & $mainframe->getPageParameters('com_jsjobs'); $Itemid = JRequest::getVar('Itemid'); $return_value = $model->jobapply(); if ($return_value == 1) { $msg = JText :: _('APPLICATION_APPLIED'); $link = 'index.php?option=com_jsjobs&c=jsjobs&view=resume&layout=myappliedjobs&uid='.$uid.'&Itemid='.$Itemid; }else if ($return_value == 3){ $msg = JText :: _('JP_ALREADY_APPLY_JOB'); $link = 'index.php?option=com_jsjobs&c=jsjobs&view=resume&layout=myappliedjobs&Itemid='.$Itemid; }else{ $msg = JText :: _('ERROR_APPLING_APPLICATION'); $link = 'index.php?option=com_jsjobs&c=jsjobs&view=resume&layout=myappliedjobs&uid='.$uid.'&Itemid='.$Itemid; } ///final redirect $this->setRedirect($link, $msg); } function savejob() //save job { global $mainframe; $model = $this->getModel('jsjobs', 'JSJobsModel'); $session = &JFactory::getSession(); $uid = &JRequest::getString('uid','none'); $params = & $mainframe->getPageParameters('com_jsjobs'); $Itemid = JRequest::getVar('Itemid'); $return_value = $model->storejob(); if ($return_value == 1) { $msg = JText :: _('JOB_SAVED'); $link = 'index.php?option=com_jsjobs&c=jsjobs&view=jobposting&layout=myjobs&uid='.$uid.'&Itemid='.$Itemid; }else if ($return_value == 2){ $msg = JText :: _('JP_FILL_REQ_FIELDS'); $link = 'index.php?option=com_jsjobs&c=jsjobs&view=jobposting&layout=formjob&Itemid='.$Itemid; }else{ $msg = JText :: _('ERROR_SAVING_JOB'); $link = 'index.php?option=com_jsjobs&c=jsjobs&view=jobposting&layout=myjobs&uid='.$uid.'&Itemid='.$Itemid; } // final redirect $this->setRedirect($link, $msg); } function saveempapp() { global $mainframe; $model = $this->getModel('jsjobs', 'JSJobsModel'); $session = &JFactory::getSession(); $uid = &JRequest::getString('uid','none'); $params = & $mainframe->getPageParameters('com_jsjobs'); $Itemid = JRequest::getVar('Itemid'); $return_value = $model->storeEmpApp(); if ($return_value == 1) { $msg = JText :: _('EMP_APP_SAVED'); $link = 'index.php?option=com_jsjobs&c=jsjobs&view=resume&layout=jobcat&uid='.$uid.'&Itemid='.$Itemid; }else if ($return_value == 2){ $msg = JText :: _('JP_FILL_REQ_FIELDS'); $link = 'index.php?option=com_jsjobs&c=jsjobs&view=resume&layout=formemp&Itemid='.$Itemid; }else if ($return_value == 6){ // file type mismatch $msg = JText :: _('JP_FILE_TYPE_ERROR'); $link = 'index.php?option=com_jsjobs&c=jsjobs&view=resume&layout=formemp&Itemid='.$Itemid; }else{ $msg = JText :: _('ERROR_SAVING_EMP_APP'); $link = 'index.php?option=com_jsjobs&c=jsjobs&view=resume&layout=jobcat&uid='.$uid.'&Itemid='.$Itemid; } // final redirect $this->setRedirect($link, $msg); } function listaddressdata() { global $mainframe; $data=JRequest::getVar( 'data'); $val=JRequest::getVar( 'val'); $model = $this->getModel('jsjobs', 'JSJobsModel'); $returnvalue = $model->listAddressData($data, $val); echo $returnvalue; $mainframe->close(); } function listsearchaddressdata() { global $mainframe; $data=JRequest::getVar( 'data'); $val=JRequest::getVar( 'val'); $model = $this->getModel('jsjobs', 'JSJobsModel'); $returnvalue = $model->listSearchAddressData($data, $val); echo $returnvalue; $mainframe->close(); } function listempaddressdata() { global $mainframe; $name=JRequest::getVar( 'name'); $myname=JRequest::getVar( 'myname'); $nextname=JRequest::getVar( 'nextname'); $data=JRequest::getVar( 'data'); $val=JRequest::getVar( 'val'); $model = $this->getModel('jsjobs', 'JSJobsModel'); $returnvalue = $model->listEmpAddressData($name, $myname, $nextname, $data, $val); echo $returnvalue; $mainframe->close(); } function display() { $document = & JFactory :: getDocument(); $viewName = JRequest :: getVar('view', 'resume'); $layoutName = JRequest :: getVar('layout', 'jobcat'); $viewType = $document->getType(); $model = $this->getModel('jsjobs', 'JSJobsModel'); $view = & $this->getView($viewName, $viewType); if (!JError :: isError($model)) { $view->setModel($model, true); } $view->setLayout($layoutName); $view->display(); } } ?>