?
Path : /home/admin/public_html/old/promice/components/com_jsjobs/views/resume/ |
Current File : /home/admin/public_html/old/promice/components/com_jsjobs/views/resume/view.html.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: views/resume/view.html.php ^ * Description: HTML view class for applications ^ * History: NONE ^ */ defined('_JEXEC') or die('Restricted access'); jimport('joomla.application.component.view'); class JSJobsViewResume extends JView { function display($tpl = null) { global $mainframe, $sorton, $sortorder, $option; $user =& JFactory::getUser(); $uid=$user->id; $itemid = JRequest::getVar('Itemid'); if (($_GET['layout']== 'jobapply') || ($_GET['layout']== 'myappliedjobs') || ($_GET['layout']== 'formemp')) { if ($user->guest) { // redirect user if not login $mainframe->redirect('index.php?option=com_user&view=login'); } } $model = &$this->getModel(); if($option == '') $option='com_jsjobs'; $limit = $mainframe->getUserStateFromRequest( 'global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int' ); $limitstart = $mainframe->getUserStateFromRequest( $option.'.limitstart', 'limitstart', 0, 'int' ); $filename = 'components/com_jsjobs/configuration.php'; $viewtype = 'html'; $params = & $mainframe->getPageParameters('com_jsjobs'); $id = & $this->get('Id'); // get configurations $config = Array(); if($_SESSION['jsjobconfig']) $config = $_SESSION['jsjobconfig']; //$config = Array(); if (sizeof($config) == 0){ $results = $model->getConfig(); if ($results){ //not empty foreach ($results as $result){ $config[$result->configname] = $result->configvalue; } $_SESSION['jsjobconfig'] = $config; } } $themevalue = $config['theme']; if ($themevalue != 'templatetheme.css'){ $theme['title'] = 'jppagetitle'; $theme['heading'] = 'pageheadline'; $theme['sectionheading'] = 'sectionheadline'; $theme['sortlinks'] = 'sortlnks'; $theme['odd'] = 'odd'; $theme['even'] = 'even'; }else{ $theme['title'] = 'componentheading'; $theme['heading'] = 'contentheading'; $theme['sectionheading'] = 'sectiontableheader'; $theme['sortlinks'] = 'sectiontableheader'; $theme['odd'] = 'sectiontableentry1'; $theme['even'] = 'sectiontableentry2'; } // get user allow $cur_user_allow = Array(); if (isset($_SESSION['cur_user_allow'])) $cur_user_allow = $_SESSION['cur_user_allow']; if (sizeof($cur_user_allow) != 0){ if ($cur_user_allow[0] != $uid) { // user change $cur_user_allow = Array(); } } if (sizeof($cur_user_allow) == 0){ if ($user->guest) { //$result = $model->getDefaultUserAllow(); $cur_user_allow[0] = "$uid"; $cur_user_allow[1] = $config['defaultempallow']; $cur_user_allow[2] = $config['defaultjoballow']; }else{ $result = $model->getCurUserAllow($uid); //if (sizeof($result) == 0){ //empty if (!$result){ //empty $result = $model->storeUserAllow($uid); $result = $model->getCurUserAllow($uid); } $cur_user_allow[0] = "$uid"; $cur_user_allow[1] = "$result->empallow"; $cur_user_allow[2] = "$result->joballow"; } $_SESSION['cur_user_allow'] = $cur_user_allow; } if ($cur_user_allow[2] == 1) { // Job Allow $link = 'index.php?option=com_jsjobs&c=jsjobs&view=jobposting&layout=formjob&Itemid='.$itemid; $link = "<a href='$link' class='joblnks'>".JText::_('JP_NEW_JOB_POSTING')."</a>"; $joblinks[] = $link; $link = 'index.php?option=com_jsjobs&c=jsjobs&view=jobposting&layout=myjobs&uid='.$uid.'&Itemid='.$itemid; $link = " <a href='$link' class='joblnks'>".JText::_('JP_MY_JOBS')."</a>"; $joblinks[] = $link; $link = 'index.php?option=com_jsjobs&c=jsjobs&view=jobposting&layout=alljobsappliedapplications&uid='.$uid.'&Itemid='.$itemid; $link = " <a href='$link' class='joblnks'>".JText::_('JP_MY_JOBS_APPLIED_APPLICATIONS')."</a>"; $joblinks[] = $link; } if ($cur_user_allow[1] == 1) { // Emp Allow $link = 'index.php?option=com_jsjobs&c=jsjobs&view=resume&layout=jobcat&uid='.$uid.'&Itemid='.$itemid; $link = "<a href='$link' class='emplnks'>".JText::_('JP_JOB_CATEGORIES')."</a>"; $emplinks[] = $link; $link = 'index.php?option=com_jsjobs&c=jsjobs&view=resume&layout=jobsearch&Itemid='.$itemid; $link = " <a href='$link' class='emplnks'>".JText::_('JP_SEARCH_JOB')."</a>"; $emplinks[] = $link; $link = 'index.php?option=com_jsjobs&c=jsjobs&view=resume&layout=myappliedjobs&uid='.$uid.'&Itemid='.$itemid; $link = " <a href='$link' class='emplnks'>".JText::_('JP_MY_APPLIED_JOBS')."</a>"; $emplinks[] = $link; $link = 'index.php?option=com_jsjobs&c=jsjobs&view=resume&layout=empview&vea=2&Itemid='.$itemid; $link = " <a href='$link' class='emplnks'>".JText::_('JP_EMP_APP_FORM')."</a>"; $emplinks['empapp'] = $link; } $id = & $this->get('Id'); if($_GET['layout']== 'jobcat') //job cat $application = $model->getJobcat(); elseif($_GET['layout']== 'listjobs'){ // list jobs if (isset($_GET['sortby'])) $sort = $_GET['sortby']; if (isset($sort)){ if ($sort == '') {$sort='createddesc';} }else {$sort='createddesc';} $sortby = $this->getJobListOrdering($sort); //$limit = $_POST['limit']; if ($limit != '') { $_SESSION['limit']=$limit; }else if ($limit == '') {$limit=$_SESSION['limit']; } //$limitstart = $_GET['limitstart']; $catid = $_GET['jobcat']; $result = $model->getJobsbyCategory($catid,$sortby,$limit,$limitstart); $options = $this->get('Options'); $application = $result[0]; $totalresults = $result[1]; $sortlinks = $this->getJobListSorting($sort); $sortlinks['sorton'] = $sorton; $sortlinks['sortorder'] = $sortorder; $this->assignRef('totalresults', $totalresults); $this->assignRef('limit', $limit); $this->assignRef('limitstart', $limitstart); $this->assignRef('sortlinks', $sortlinks); }elseif($_GET['layout']== 'jobsearch'){ // job search $searchoptions = $model->getSearchOptions(); $this->assignRef('searchoptions', $searchoptions); }elseif($_GET['layout']== 'jobsearchresults'){ // job search results if (isset($_GET['sortby'])) $sort = $_GET['sortby']; if (isset($sort)){ if ($sort == '') {$sort='createddesc';} }else {$sort='createddesc';} $sortby = $this->getJobListOrdering($sort); //$limit = $_POST['limit']; if ($limit != '') { $_SESSION['limit']=$limit; }else if ($limit == '') {$limit=$_SESSION['limit']; } // $limitstart = $_GET['limitstart']; if ($_POST['isjobsearch'] == '1'){ $_SESSION['jobsearch_title'] = $_POST['title']; $_SESSION['jobsearch_jobcategory'] = $_POST['jobcategory']; $_SESSION['jobsearch_jobtype'] = $_POST['jobtype']; $_SESSION['jobsearch_jobstatus'] = $_POST['jobstatus']; if(isset($_POST['jobsalaryrange'])) $_SESSION['jobsearch_jobsalaryrange'] = $_POST['jobsalaryrange']; $_SESSION['jobsearch_heighestfinisheducation'] = $_POST['heighestfinisheducation']; $_SESSION['jobsearch_company'] = $_POST['company']; $_SESSION['jobsearch_country'] = $_POST['country']; $_SESSION['jobsearch_state'] = $_POST['state']; $_SESSION['jobsearch_county'] = $_POST['county']; $_SESSION['jobsearch_city'] = $_POST['city']; $_SESSION['jobsearch_zipcode'] = $_POST['zipcode']; } $title = $_SESSION['jobsearch_title']; $jobcategory = $_SESSION['jobsearch_jobcategory']; $jobtype = $_SESSION['jobsearch_jobtype']; $jobstatus = $_SESSION['jobsearch_jobstatus']; $jobsalaryrange = $_SESSION['jobsearch_jobsalaryrange']; $education = $_SESSION['jobsearch_heighestfinisheducation']; $company = $_SESSION['jobsearch_company']; $country = $_SESSION['jobsearch_country']; $state = $_SESSION['jobsearch_state']; $county = $_SESSION['jobsearch_county']; $city = $_SESSION['jobsearch_city']; $zipcode = $_SESSION['jobsearch_zipcode']; $result = $model->getJobSearch($title,$jobcategory,$jobtype,$jobstatus,$jobsalaryrange,$education ,$company,$country,$state,$county,$city,$zipcode,$sortby,$limit,$limitstart); $options = $this->get('Options'); $sortlinks = $this->getJobListSorting($sort); $sortlinks['sorton'] = $sorton; $sortlinks['sortorder'] = $sortorder; $application = $result[0]; $totalresults = $result[1]; $this->assignRef('totalresults', $totalresults); $this->assignRef('limit', $limit); $this->assignRef('limitstart', $limitstart); $this->assignRef('sortlinks', $sortlinks); }elseif($_GET['layout']== 'jobapply'){ // job apply $jobid = $_GET['jobid']; $application = $model->getJob($jobid); $myapplication = $model->getMyApplication($uid); $this->assignRef('myapplication', $myapplication); }elseif($_GET['layout']== 'myappliedjobs'){ //my applied jobs if (isset($_GET['sortby'])) $sort = $_GET['sortby']; if (isset($sort)){ if ($sort == '') {$sort='createddesc';} }else {$sort='createddesc';} $sortby = $this->getJobListOrdering($sort); //$limit = $_POST['limit']; if ($limit != '') { $_SESSION['limit']=$limit; }else if ($limit == '') {$limit=$_SESSION['limit']; } // $limitstart = $_GET['limitstart']; $result = $model->getMyAppliedJobs($uid,$sortby,$limit,$limitstart); $application = $result[0]; $totalresults = $result[1]; $sortlinks = $this->getJobListSorting($sort); $sortlinks['sorton'] = $sorton; $sortlinks['sortorder'] = $sortorder; $this->assignRef('totalresults', $totalresults); $this->assignRef('limit', $limit); $this->assignRef('limitstart', $limitstart); $this->assignRef('sortlinks', $sortlinks); }elseif($_GET['layout']== 'formemp'){ // form emp $application = $model->getEmpApplicationbyuid($uid); $empoptions = $this->get('EmpOptions'); $this->assignRef('empoptions', $empoptions); JHTML::_('behavior.formvalidation'); }elseif($_GET['layout']== 'empview'){ // emp view if (isset($_GET['id'])) $empid = $_GET['id']; else $empid = ''; if ($empid != ''){ $application = $model->getEmpApplicationbyid($empid); }else{ $application = $model->getEmpApplicationbyuserid($uid); } }elseif(($_GET['layout']== 'resumedownload') || ($_GET['layout']== 'resumeview')){ // resume view & download $empid = $_GET['rq']; $application = $model->getEmpApplicationbyid($empid); } $this->assignRef('application', $application); $this->assignRef('config', $config); $this->assignRef('theme', $theme); // $options = $this->get('Options'); $this->assignRef('options', $options); $this->assignRef('params', $params); $this->assignRef('viewtype', $viewtype); $this->assignRef('joblinks', $joblinks); $this->assignRef('emplinks', $emplinks); $this->assignRef('uid', $uid); $this->assignRef('id', $id); $this->assignRef('Itemid', $itemid); $this->assignRef('pdflink', $pdflink); $this->assignRef('printlink', $printlink); parent :: display($tpl); } function getJobListSorting( $sort ) { $sortlinks['title'] = $this->getSortArg("title",$sort); $sortlinks['category'] = $this->getSortArg("category",$sort); $sortlinks['jobtype'] = $this->getSortArg("jobtype",$sort); $sortlinks['jobstatus'] = $this->getSortArg("jobstatus",$sort); $sortlinks['company'] = $this->getSortArg("company",$sort); $sortlinks['salaryrange'] = $this->getSortArg("salaryrange",$sort); $sortlinks['country'] = $this->getSortArg("country",$sort); $sortlinks['created'] = $this->getSortArg("created",$sort); $sortlinks['apply_date'] = $this->getSortArg("apply_date",$sort); return $sortlinks; } function getEmpListSorting( $sort ) { $sortlinks['name'] = $this->getSortArg("name",$sort); $sortlinks['category'] = $this->getSortArg("category",$sort); $sortlinks['jobtype'] = $this->getSortArg("jobtype",$sort); $sortlinks['jobsalaryrange'] = $this->getSortArg("jobsalaryrange",$sort); $sortlinks['apply_date'] = $this->getSortArg("apply_date",$sort); $sortlinks['email'] = $this->getSortArg("email",$sort); return $sortlinks; } function getJobListOrdering( $sort ) { global $sorton, $sortorder; switch ( $sort ) { case "titledesc": $ordering = "job.title DESC"; $sorton = "title"; $sortorder="DESC"; break; case "titleasc": $ordering = "job.title ASC"; $sorton = "title"; $sortorder="ASC"; break; case "categorydesc": $ordering = "cat.cat_title DESC"; $sorton = "category"; $sortorder="DESC"; break; case "categoryasc": $ordering = "cat.cat_title ASC"; $sorton = "category"; $sortorder="ASC"; break; case "jobtypedesc": $ordering = "job.jobtype DESC"; $sorton = "jobtype"; $sortorder="DESC"; break; case "jobtypeasc": $ordering = "job.jobtype ASC"; $sorton = "jobtype"; $sortorder="ASC"; break; case "jobstatusdesc": $ordering = "job.jobstatus DESC"; $sorton = "jobstatus"; $sortorder="DESC"; break; case "jobstatusasc": $ordering = "job.jobstatus ASC"; $sorton = "jobstatus"; $sortorder="ASC"; break; case "companydesc": $ordering = "job.company DESC"; $sorton = "company"; $sortorder="DESC"; break; case "companyasc": $ordering = "job.company ASC"; $sorton = "company"; $sortorder="ASC"; break; case "salaryrangedesc": $ordering = "salary.rangeend DESC"; $sorton = "salaryrange"; $sortorder="DESC"; break; case "salaryrangeasc": $ordering = "salary.rangestart ASC"; $sorton = "salaryrange"; $sortorder="ASC"; break; case "countrydesc": $ordering = "country.name DESC"; $sorton = "country"; $sortorder="DESC"; break; case "countryasc": $ordering = "country.name ASC"; $sorton = "country"; $sortorder="ASC"; break; case "createddesc": $ordering = "job.created DESC"; $sorton = "created"; $sortorder="DESC"; break; case "createdasc": $ordering = "job.created ASC"; $sorton = "created"; $sortorder="ASC"; break; case "apply_datedesc": $ordering = "apply.apply_date DESC"; $sorton = "apply_date"; $sortorder="DESC"; break; case "apply_dateasc": $ordering = "apply.apply_date ASC"; $sorton = "apply_date"; $sortorder="ASC"; break; default: $ordering = "job.id DESC"; } return $ordering; } function getEmpListOrdering( $sort ) { global $sorton, $sortorder; switch ( $sort ) { case "namedesc": $ordering = "app.first_name DESC"; $sorton = "name"; $sortorder="DESC"; break; case "nameasc": $ordering = "app.first_name ASC"; $sorton = "name"; $sortorder="ASC"; break; case "categorydesc": $ordering = "cat.cat_title DESC"; $sorton = "category"; $sortorder="DESC"; break; case "categoryasc": $ordering = "cat.cat_title ASC"; $sorton = "category"; $sortorder="ASC"; break; case "jobtypedesc": $ordering = "app.jobtype DESC"; $sorton = "jobtype"; $sortorder="DESC"; break; case "jobtypeasc": $ordering = "app.jobtype ASC"; $sorton = "jobtype"; $sortorder="ASC"; break; case "jobsalaryrangedesc": $ordering = "salary.rangestart DESC"; $sorton = "jobsalaryrange"; $sortorder="DESC"; break; case "jobsalaryrangeasc": $ordering = "salary.rangestart ASC"; $sorton = "jobsalaryrange"; $sortorder="ASC"; break; case "apply_datedesc": $ordering = "apply.apply_date DESC"; $sorton = "apply_date"; $sortorder="DESC"; break; case "apply_dateasc": $ordering = "apply.apply_date ASC"; $sorton = "apply_date"; $sortorder="ASC"; break; case "emaildesc": $ordering = "app.email_address DESC"; $sorton = "email"; $sortorder="DESC"; break; case "emailasc": $ordering = "app.email_address ASC"; $sorton = "email"; $sortorder="ASC"; break; default: $ordering = "job.id DESC"; } return $ordering; } function getSortArg( $type, $sort ) { $mat = array(); if ( preg_match( "/(\w+)(asc|desc)/i", $sort, $mat ) ) { if ( $type == $mat[1] ) { return ( $mat[2] == "asc" ) ? "{$type}desc" : "{$type}asc"; } else { return $type . $mat[2]; } } return "iddesc"; } } ?>