Ejemplo n.º 1
0
 function searchCvProfiles()
 {
     if ($this->_user_cred['search_cvs'] == 0) {
         return $this->setRedirect(JRoute::_('index.php?option=com_jobboard&view=admin&Itemid=' . $this->_itemid), JText::_('COM_JOBBOARD_ENTNOAUTH'), 'error');
     }
     $app =& JFactory::getApplication();
     $job_title = JString::trim(JRequest::getString('job_title', ''));
     $skills = JString::trim(JRequest::getString('skills', ''));
     $qualification = JString::trim(JRequest::getString('qualification', ''));
     $ed_level = $app->getUserStateFromRequest('com_jobboard.cvsearch.ed_level', 'ed_level', 0, 'int');
     if (JRequest::getInt('f_reset', 0) == 1) {
         $job_title = $skills = $qualification = '';
         $ed_level = 0;
     }
     $app->setUserstate("com_jobboard.cvsearch.job_title", $job_title, 'string');
     $app->setUserstate("com_jobboard.cvsearch.skills", $skills, 'string');
     $app->setUserstate("com_jobboard.cvsearch.qualification", $qualification, 'string');
     $app->setUserstate("com_jobboard.cvsearch.ed_level", $ed_level, 'int');
     $query_present = $job_title != '' || $skills != '' || $qualification != '' ? 1 : 0;
     if ($query_present == 1) {
         JRequest::checkToken() or jexit(JText::_('Invalid Token'));
     }
     $app->setUserstate("com_jobboard.cvsearch.search_private", $this->_user_cred['search_private_cvs'], 'int');
     $layout_style = $this->_umodel->getLayoutConfig();
     $view =& $this->getView('admin', 'html');
     $view->setLayout('admin');
     $view->assign('ed_level', $ed_level);
     if ($query_present == 1) {
         $title_filter = $skill_filter = $qual_filter = array();
         $app->setUserstate("com_jobboard.cvsearch.uid", $this->_uid, 'int');
         $view->assign('uid', $this->_uid);
         $app->setUserstate("com_jobboard.cvsearch.use_location", $this->_glb_cfg->use_location, 'int');
         $cv_model =& $this->getModel('Admcvlist');
         $data = $cv_model->getData();
         if (count($data) > 0) {
             require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'helpers' . DS . 'jobboard_find.php';
             $new_arr = array();
             $quals_arr = array();
             $prof_ids = array();
             $usr_model =& $this->getModel('User');
             foreach ($data as $prof) {
                 $profile_pic = JobBoardHelper::checkProfilePicStatus($prof->user_id, &$usr_model);
                 $prof->img = array('is_profile_pic' => $profile_pic['is_profile_pic'], 'imgthumb' => $profile_pic['urithumb']);
                 if ($this->_glb_cfg->use_location == 1) {
                     $prof->location = JobBoardFindHelper::getUsrLoc($prof->user_id);
                 }
                 $new_arr[] = $prof;
                 $prof_ids[] = $prof->id;
                 if ($prof->highest_qual > 0) {
                     $quals_arr[] = $prof->highest_qual;
                 }
             }
             $data = $new_arr;
             unset($new_arr);
             $ed_levels = JobBoardFindHelper::getEdlvls();
             /*if($job_title == '') {
                  $title_filter = array_values($cv_model->getTitlesByProfileId($prof_ids));
               } else {*/
             $title_filter = $app->getUserState('com_jobboard.cvsearch.title_filter', array(), 'array');
             // }
             if ($skills == '') {
                 $skill_filter = array_values($cv_model->getSkillsByProfileId($prof_ids));
             } else {
                 $skill_filter = $app->getUserState('com_jobboard.cvsearch.skill_filter', array(), 'array');
             }
             if ($qualification == '') {
                 $qual_filter = array_values($cv_model->getQualsByProfileId($prof_ids));
             } else {
                 $qual_filter = $app->getUserState('com_jobboard.cvsearch.qual_filter', array(), 'array');
             }
             $view->assignRef('title_filter', $title_filter);
             $view->assignRef('skill_filter', $skill_filter);
             $view->assignRef('qual_filter', $qual_filter);
             $view->assignRef('ed_levels', $ed_levels);
             $view->assignRef('ed_matches', $quals_arr);
             $view->assign('use_location', $this->_glb_cfg->use_location);
             $view->setModel($cv_model, true);
             unset($title_filter, $skill_filter, $qual_filter, $prof_ids);
         }
     } else {
         $data = array();
     }
     $view->assign('context', 'cvsrch');
     $view->job_title = $view->escape($job_title);
     $view->skills = $view->escape($skills);
     $view->qualification = $view->escape($qualification);
     $view->assignRef('data', $data);
     $view->assign('query_present', $query_present);
     $view->assign('layout_style', $layout_style);
     $view->assignRef('user_auth', $this->_user_cred);
     $view->assign('itemid', $this->_itemid);
     $view->display();
 }
Ejemplo n.º 2
0
 function _buildQuery()
 {
     $app = JFactory::getApplication();
     if (empty($this->_data)) {
         $db =& $this->getDBO();
         $job_title = $app->getUserState('com_jobboard.cvsearch.job_title', '', 'string');
         $skills = $app->getUserState('com_jobboard.cvsearch.skills', '', 'string');
         $qualification = $app->getUserState('com_jobboard.cvsearch.qualification', '', 'string');
         $search_private = $app->getUserState("com_jobboard.cvsearch.search_private", 0, 'int');
         $use_location = $app->getUserState("com_jobboard.cvsearch.use_location", 0, 'int');
         $ed_level = $app->getUserState('com_jobboard.cvsearch.ed_level', 0, 'int');
         $profiles = $job_title_arr = $skills_arr = $qualification_arr = array();
         if ($job_title != '') {
             $job_title_arr = $this->_getProfilesByTitle($job_title);
             $job_title_arr = !empty($job_title_arr) ? $job_title_arr : array();
             $profiles = array_merge($profiles, $job_title_arr);
         }
         if ($skills != '') {
             $skills_arr = $this->_getProfilesBySkills($skills);
             $skills_arr = !empty($skills_arr) ? $skills_arr : array();
             if ($job_title != '') {
                 $duplicates = array_intersect($profiles, $skills_arr);
                 if (!empty($duplicates)) {
                     $skills_arr = JobBoardFindHelper::removeDuplicates($skills_arr, $duplicates);
                 }
             }
             $profiles = array_merge($profiles, $skills_arr);
         }
         if ($qualification != '') {
             $qualification_arr = $this->_getProfilesByQual($qualification);
             $qualification_arr = !empty($qualification_arr) ? $qualification_arr : array();
             if ($job_title != '' || $skills != '') {
                 $duplicates = array_intersect($profiles, $qualification_arr);
                 if (!empty($duplicates)) {
                     $qualification_arr = JobBoardFindHelper::removeDuplicates($qualification_arr, $duplicates);
                 }
             }
             $profiles = array_merge($profiles, $qualification_arr);
         }
         if (empty($this->_uid)) {
             $this->_uid = $app->getUserstate("com_jobboard.cvsearch.uid", 0, 'int');
         }
         $where = ' WHERE c.' . JobBoardDbHelper::dbNameQuote('user_id') . ' <> ' . $this->_uid . ' ';
         $s_where = array();
         foreach ($profiles as $profile) {
             $s_where[] = " c." . JobBoardDbHelper::dbNameQuote('id') . " = '{$profile}'";
         }
         if (!empty($s_where)) {
             $where .= ' AND (' . implode(' OR ', $s_where) . ')';
         } else {
             //$where .= ' AND c.`id` = 0 ';
         }
         if ($search_private == 1) {
             $where .= ' AND c.' . JobBoardDbHelper::dbNameQuote('is_private') . ' >= 0 ';
         } else {
             $where .= ' AND c.' . JobBoardDbHelper::dbNameQuote('is_private') . ' = 0 ';
         }
         if ($ed_level > 0) {
             $where .= ' AND c.' . JobBoardDbHelper::dbNameQuote('highest_qual') . ' = ' . $ed_level . ' ';
         }
         $orderby = ' ORDER BY ' . JobBoardDbHelper::dbNameQuote('modified_date') . ' DESC';
         $sql = 'SELECT c.' . JobBoardDbHelper::dbNameQuote('id') . ', c.' . JobBoardDbHelper::dbNameQuote('user_id') . ', c.' . JobBoardDbHelper::dbNameQuote('profile_name') . ', c.' . JobBoardDbHelper::dbNameQuote('created_date') . ', c.' . JobBoardDbHelper::dbNameQuote('modified_date') . ', c.' . JobBoardDbHelper::dbNameQuote('avail_date') . ', c.' . JobBoardDbHelper::dbNameQuote('is_linkedin') . ', c.' . JobBoardDbHelper::dbNameQuote('is_private') . ', c.' . JobBoardDbHelper::dbNameQuote('highest_qual') . ', c.' . JobBoardDbHelper::dbNameQuote('hits') . '
                        ,u.' . JobBoardDbHelper::dbNameQuote('name') . '
                       FROM ' . JobBoardDbHelper::dbNameQuote('#__jobboard_cvprofiles') . ' AS c
                     INNER JOIN ' . JobBoardDbHelper::dbNameQuote('#__users') . ' AS u
                       ON(u.' . JobBoardDbHelper::dbNameQuote('id') . ' = c.' . JobBoardDbHelper::dbNameQuote('user_id') . ')';
         // echo $sql.$where.$orderby; // die;
         return $sql . $where . $orderby;
     }
 }
Ejemplo n.º 3
0
</li>
                  <?php 
        } else {
            ?>
                    <?php 
            $filter_count = 0;
            ?>
                    <?php 
            foreach ($this->qual_filter as $filter) {
                ?>
                      <?php 
                if ($filter_count < 10) {
                    ?>
                          <li>
                              <?php 
                    $is_query_phrase = JobBoardFindHelper::hasQ($this->qualification);
                    ?>
                              <?php 
                    if (strtolower(htmlspecialchars($filter[0])) == strtolower($this->qualification) || $is_query_phrase) {
                        ?>
                                <span><?php 
                        echo $filter[0];
                        ?>
</span>
                                <?php 
                        if ($is_query_phrase) {
                            ?>
                                  <a class="qualification close" href="#"><!--  --></a>
                                <?php 
                        }
                        ?>