Пример #1
0
 private function onSearch()
 {
     $wildCardCompanyName = '';
     $wildCardKeyTechnologies = '';
     /* Bail out to prevent an error if the GET string doesn't even contain
      * a field named 'wildCardString' at all.
      */
     if (!isset($_GET['wildCardString'])) {
         $this->listByView('No wild card string specified.');
         return;
     }
     $query = trim($_GET['wildCardString']);
     /* Set up sorting. */
     if ($this->isRequiredIDValid('page', $_GET)) {
         $currentPage = $_GET['page'];
     } else {
         $currentPage = 1;
     }
     $searchPager = new SearchPager(CANDIDATES_PER_PAGE, $currentPage, $this->_siteID, $_GET);
     if ($searchPager->isSortByValid('sortBy', $_GET)) {
         $sortBy = $_GET['sortBy'];
     } else {
         $sortBy = 'name';
     }
     if ($searchPager->isSortDirectionValid('sortDirection', $_GET)) {
         $sortDirection = $_GET['sortDirection'];
     } else {
         $sortDirection = 'ASC';
     }
     $baseURL = CATSUtility::getFilteredGET(array('sortBy', 'sortDirection', 'page'), '&');
     $searchPager->setSortByParameters($baseURL, $sortBy, $sortDirection);
     if (!eval(Hooks::get('CLIENTS_ON_SEARCH_PRE'))) {
         return;
     }
     /* Get our current searching mode. */
     $mode = $this->getTrimmedInput('mode', $_GET);
     /* Execute the search. */
     $search = new SearchCompanies($this->_siteID);
     switch ($mode) {
         case 'searchByName':
             $wildCardCompanyName = $query;
             $rs = $search->byName($query, $sortBy, $sortDirection);
             break;
         case 'searchByKeyTechnologies':
             $wildCardKeyTechnologies = $query;
             $rs = $search->byKeyTechnologies($query, $sortBy, $sortDirection);
             break;
         default:
             $this->listByView('Invalid search mode.');
             return;
             break;
     }
     foreach ($rs as $rowIndex => $row) {
         if ($row['isHot'] == 1) {
             $rs[$rowIndex]['linkClass'] = 'jobLinkHot';
         } else {
             $rs[$rowIndex]['linkClass'] = 'jobLinkCold';
         }
         if (!empty($row['ownerFirstName'])) {
             $rs[$rowIndex]['ownerAbbrName'] = StringUtility::makeInitialName($row['ownerFirstName'], $row['ownerLastName'], false, LAST_NAME_MAXLEN);
         } else {
             $rs[$rowIndex]['ownerAbbrName'] = 'None';
         }
     }
     $companyIDs = implode(',', ResultSetUtility::getColumnValues($rs, 'companyID'));
     $exportForm = ExportUtility::getForm(DATA_ITEM_COMPANY, $companyIDs, 40, 15);
     /* Save the search. */
     $savedSearches = new SavedSearches($this->_siteID);
     $savedSearches->add(DATA_ITEM_COMPANY, $query, $_SERVER['REQUEST_URI'], false);
     $savedSearchRS = $savedSearches->get(DATA_ITEM_COMPANY);
     $query = urlencode(htmlspecialchars($query));
     if (!eval(Hooks::get('CLIENTS_ON_SEARCH_POST'))) {
         return;
     }
     $this->_template->assign('savedSearchRS', $savedSearchRS);
     $this->_template->assign('active', $this);
     $this->_template->assign('subActive', 'Search Companies');
     $this->_template->assign('exportForm', $exportForm);
     $this->_template->assign('pager', $searchPager);
     $this->_template->assign('rs', $rs);
     $this->_template->assign('isResultsMode', true);
     $this->_template->assign('wildCardCompanyName', $wildCardCompanyName);
     $this->_template->assign('wildCardString', $query);
     $this->_template->assign('wildCardKeyTechnologies', $wildCardKeyTechnologies);
     $this->_template->assign('mode', $mode);
     $this->_template->display('./modules/companies/Search.tpl');
 }
Пример #2
0
 private function onSearch()
 {
     /* Bail out to prevent an error if the GET string doesn't even contain
      * a field named 'wildCardString' at all.
      */
     if (!isset($_GET['wildCardString'])) {
         $this->listByView('No wild card string specified.');
         return;
     }
     $query = trim($_GET['wildCardString']);
     /* Initialize stored wildcard strings to safe default values. */
     $resumeWildCardString = '';
     $keySkillsWildCardString = '';
     $phoneNumberWildCardString = '';
     $fullNameWildCardString = '';
     /* Set up sorting. */
     if ($this->isRequiredIDValid('page', $_GET)) {
         $currentPage = $_GET['page'];
     } else {
         $currentPage = 1;
     }
     $searchPager = new SearchPager(CANDIDATES_PER_PAGE, $currentPage, $this->_siteID);
     if ($searchPager->isSortByValid('sortBy', $_GET)) {
         $sortBy = $_GET['sortBy'];
     } else {
         $sortBy = 'lastName';
     }
     if ($searchPager->isSortDirectionValid('sortDirection', $_GET)) {
         $sortDirection = $_GET['sortDirection'];
     } else {
         $sortDirection = 'ASC';
     }
     $baseURL = CATSUtility::getFilteredGET(array('sortBy', 'sortDirection', 'page'), '&');
     $searchPager->setSortByParameters($baseURL, $sortBy, $sortDirection);
     $candidates = new Candidates($this->_siteID);
     /* Get our current searching mode. */
     $mode = $this->getTrimmedInput('mode', $_GET);
     /* Execute the search. */
     $search = new SearchCandidates($this->_siteID);
     switch ($mode) {
         case 'searchByFullName':
             $rs = $search->byFullName($query, $sortBy, $sortDirection);
             foreach ($rs as $rowIndex => $row) {
                 if (!empty($row['ownerFirstName'])) {
                     $rs[$rowIndex]['ownerAbbrName'] = StringUtility::makeInitialName($row['ownerFirstName'], $row['ownerLastName'], false, LAST_NAME_MAXLEN);
                 } else {
                     $rs[$rowIndex]['ownerAbbrName'] = 'None';
                 }
                 $rsResume = $candidates->getResumes($row['candidateID']);
                 if (isset($rsResume[0])) {
                     $rs[$rowIndex]['resumeID'] = $rsResume[0]['attachmentID'];
                 }
             }
             $isResumeMode = false;
             $fullNameWildCardString = $query;
             break;
         case 'searchByKeySkills':
             $rs = $search->byKeySkills($query, $sortBy, $sortDirection);
             foreach ($rs as $rowIndex => $row) {
                 if (!empty($row['ownerFirstName'])) {
                     $rs[$rowIndex]['ownerAbbrName'] = StringUtility::makeInitialName($row['ownerFirstName'], $row['ownerLastName'], false, LAST_NAME_MAXLEN);
                 } else {
                     $rs[$rowIndex]['ownerAbbrName'] = 'None';
                 }
                 $rsResume = $candidates->getResumes($row['candidateID']);
                 if (isset($rsResume[0])) {
                     $rs[$rowIndex]['resumeID'] = $rsResume[0]['attachmentID'];
                 }
             }
             $isResumeMode = false;
             $keySkillsWildCardString = $query;
             break;
         case 'searchByResume':
             $searchPager = new SearchByResumePager(20, $currentPage, $this->_siteID, $query, $sortBy, $sortDirection);
             $baseURL = 'm=candidates&a=search&getback=getback&mode=searchByResume&wildCardString=' . urlencode($query) . '&searchByResume=Search';
             $searchPager->setSortByParameters($baseURL, $sortBy, $sortDirection);
             $rs = $searchPager->getPage();
             $currentPage = $searchPager->getCurrentPage();
             $totalPages = $searchPager->getTotalPages();
             $pageStart = $searchPager->getThisPageStartRow() + 1;
             if ($searchPager->getThisPageStartRow() + 20 <= $searchPager->getTotalRows()) {
                 $pageEnd = $searchPager->getThisPageStartRow() + 20;
             } else {
                 $pageEnd = $searchPager->getTotalRows();
             }
             foreach ($rs as $rowIndex => $row) {
                 $rs[$rowIndex]['excerpt'] = SearchUtility::searchExcerpt($query, $row['text']);
                 if (!empty($row['ownerFirstName'])) {
                     $rs[$rowIndex]['ownerAbbrName'] = StringUtility::makeInitialName($row['ownerFirstName'], $row['ownerLastName'], false, LAST_NAME_MAXLEN);
                 } else {
                     $rs[$rowIndex]['ownerAbbrName'] = 'None';
                 }
             }
             $isResumeMode = true;
             $this->_template->assign('active', $this);
             $this->_template->assign('currentPage', $currentPage);
             $this->_template->assign('pageStart', $pageStart);
             $this->_template->assign('totalResults', $searchPager->getTotalRows());
             $this->_template->assign('pageEnd', $pageEnd);
             $this->_template->assign('totalPages', $totalPages);
             $resumeWildCardString = $query;
             break;
         case 'phoneNumber':
             $rs = $search->byPhone($query, $sortBy, $sortDirection);
             foreach ($rs as $rowIndex => $row) {
                 if (!empty($row['ownerFirstName'])) {
                     $rs[$rowIndex]['ownerAbbrName'] = StringUtility::makeInitialName($row['ownerFirstName'], $row['ownerLastName'], false, LAST_NAME_MAXLEN);
                 } else {
                     $rs[$rowIndex]['ownerAbbrName'] = 'None';
                 }
                 $rsResume = $candidates->getResumes($row['candidateID']);
                 if (isset($rsResume[0])) {
                     $rs[$rowIndex]['resumeID'] = $rsResume[0]['attachmentID'];
                 }
             }
             $isResumeMode = false;
             $phoneNumberWildCardString = $query;
             break;
         default:
             $this->listByView('Invalid search mode.');
             return;
             break;
     }
     $candidateIDs = implode(',', ResultSetUtility::getColumnValues($rs, 'candidateID'));
     $exportForm = ExportUtility::getForm(DATA_ITEM_CANDIDATE, $candidateIDs, 32, 9);
     if (!eval(Hooks::get('CANDIDATE_ON_SEARCH'))) {
         return;
     }
     /* Save the search. */
     $savedSearches = new SavedSearches($this->_siteID);
     $savedSearches->add(DATA_ITEM_CANDIDATE, $query, $_SERVER['REQUEST_URI'], false);
     $savedSearchRS = $savedSearches->get(DATA_ITEM_CANDIDATE);
     $this->_template->assign('savedSearchRS', $savedSearchRS);
     $this->_template->assign('exportForm', $exportForm);
     $this->_template->assign('active', $this);
     $this->_template->assign('rs', $rs);
     $this->_template->assign('pager', $searchPager);
     $this->_template->assign('isResultsMode', true);
     $this->_template->assign('isResumeMode', $isResumeMode);
     $this->_template->assign('wildCardString', $query);
     $this->_template->assign('resumeWildCardString', $resumeWildCardString);
     $this->_template->assign('keySkillsWildCardString', $keySkillsWildCardString);
     $this->_template->assign('fullNameWildCardString', $fullNameWildCardString);
     $this->_template->assign('phoneNumberWildCardString', $phoneNumberWildCardString);
     $this->_template->assign('mode', $mode);
     $this->_template->display('./modules/candidates/Search.tpl');
 }
Пример #3
0
    public function onSearch()
    {
        $query_jobTitle = '';
        $query_companyName = '';

        /* Bail out to prevent an error if the GET string doesn't even contain
         * a field named 'wildCardString' at all.
         */
        if (!isset($_GET['wildCardString']))
        {
            $this->listByView('No wild card string specified.');
            return;
        }

        $query = trim($_GET['wildCardString']);

        /* Set up sorting. */
        if ($this->isRequiredIDValid('page', $_GET))
        {
            $currentPage = $_GET['page'];
        }
        else
        {
            $currentPage = 1;
        }

        $searchPager = new SearchPager(
            CANDIDATES_PER_PAGE, $currentPage, $this->_siteID, $_GET
        );

        if ($searchPager->isSortByValid('sortBy', $_GET))
        {
            $sortBy = $_GET['sortBy'];
        }
        else
        {
            $sortBy = 'title';
        }

        if ($searchPager->isSortDirectionValid('sortDirection', $_GET))
        {
            $sortDirection = $_GET['sortDirection'];
        }
        else
        {
            $sortDirection = 'ASC';
        }

        $baseURL = CATSUtility::getFilteredGET(
            array('sortBy', 'sortDirection', 'page'), '&'
        );
        $searchPager->setSortByParameters($baseURL, $sortBy, $sortDirection);

        /* Get our current searching mode. */
        $mode = $this->getTrimmedInput('mode', $_GET);

        /* Execute the search. */
        $search = new SearchJobOrders($this->_siteID);
        switch ($mode)
        {
            case 'searchByJobTitle':
                $query_jobTitle = $query;
                $rs = $search->byTitle($query, $sortBy, $sortDirection, false);
                break;

            case 'searchByCompanyName':
                $query_companyName = $query;
                $rs = $search->byCompanyName($query, $sortBy, $sortDirection, false);
                break;

            default:
                $this->listByView('Invalid search mode.');
                return;
                break;
        }

        foreach ($rs as $rowIndex => $row)
        {
            /* Convert '00-00-00' dates to empty strings. */
            $rs[$rowIndex]['startDate'] = DateUtility::fixZeroDate(
                $row['startDate']
            );

            if ($row['isHot'] == 1)
            {
                $rs[$rowIndex]['linkClass'] = 'jobLinkHot';
            }
            else
            {
                $rs[$rowIndex]['linkClass'] = 'jobLinkCold';
            }

            $rs[$rowIndex]['recruiterAbbrName'] = StringUtility::makeInitialName(
                $row['recruiterFirstName'],
                $row['recruiterLastName'],
                false,
                LAST_NAME_MAXLEN
            );

            $rs[$rowIndex]['ownerAbbrName'] = StringUtility::makeInitialName(
                $row['ownerFirstName'],
                $row['ownerLastName'],
                false,
                LAST_NAME_MAXLEN
            );
        }

        /* Save the search. */
        $savedSearches = new SavedSearches($this->_siteID);
        $savedSearches->add(
            DATA_ITEM_JOBORDER,
            $query,
            $_SERVER['REQUEST_URI'],
            false
        );

        $savedSearchRS = $savedSearches->get(DATA_ITEM_JOBORDER);

        $query = urlencode(htmlspecialchars($query));

        $jobOderIDs = implode(',', ResultSetUtility::getColumnValues($rs, 'jobOrderID'));
        $exportForm = ExportUtility::getForm(
            DATA_ITEM_JOBORDER, $jobOderIDs, 29, 5
        );

        $this->_template->assign('active', $this);
        $this->_template->assign('subActive', 'Search Job Orders');
        $this->_template->assign('pager', $searchPager);
        $this->_template->assign('exportForm', $exportForm);

        $this->_template->assign('wildCardString', $query);
        $this->_template->assign('wildCardString_jobTitle', $query_jobTitle);
        $this->_template->assign('wildCardString_companyName', $query_companyName);
        $this->_template->assign('savedSearchRS', $savedSearchRS);
        $this->_template->assign('rs', $rs);
        $this->_template->assign('isResultsMode', true);
        $this->_template->assign('mode', $mode);

        if (!eval(Hooks::get('JO_ON_SEARCH'))) return;

        $this->_template->display('./modules/joborders/Search.php');
    }
Пример #4
0
    public function onSearch($objSearchDS=null)
    {
        /* Bail out to prevent an error if the GET string doesn't even contain
         * a field named 'wildCardString' at all.
         */
        $arrInput=$_GET;
        if(!is_null($objSearchDS))
        {
            $arrInput=$objSearchDS->getAsArray();
        }
        if (!isset($arrInput['wildCardString']))
        {
            $this->listByView('No wild card string specified.');
            return;
        }

        $query = trim($arrInput['wildCardString']);

        /* Initialize stored wildcard strings to safe default values. */
        $resumeWildCardString      = '';
        $keySkillsWildCardString   = '';
        $phoneNumberWildCardString = '';
        $fullNameWildCardString    = '';

        /* Set up sorting. */
        if ($this->isRequiredIDValid('page', $arrInput))
        {
            $currentPage = $arrInput['page'];
        }
        else
        {
            $currentPage = 1;
        }

        $searchPager = new SearchPager(
            CANDIDATES_PER_PAGE, $currentPage, $this->_siteID
        );

        if ($searchPager->isSortByValid('sortBy', $arrInput))
        {
            $sortBy = $arrInput['sortBy'];
        }
        else
        {
            $sortBy = 'lastName';
        }

        if ($searchPager->isSortDirectionValid('sortDirection', $arrInput))
        {
            $sortDirection = $arrInput['sortDirection'];
        }
        else
        {
            $sortDirection = 'ASC';
        }
        
        $_siteID = $_SESSION['CATS']->getSiteID();;
        $_db = DatabaseConnection::getInstance();
        $sql="Select * from settings where setting='filtergrouping' and site_id='{$_siteID}'";
        $arrData=$_db->getAssoc($sql);
        $isFilterGrouping=false;
        if(isset($arrData["value"]) && $arrData["value"]>0)
        {
            $isFilterGrouping=true;
        }

        $baseURL = CATSUtility::getFilteredGET(
            array('sortBy', 'sortDirection', 'page'), '&amp;'
        );
        $searchPager->setSortByParameters($baseURL, $sortBy, $sortDirection);

        $candidates = new Candidates($this->_siteID);

        /* Get our current searching mode. */
        $mode = $this->getTrimmedInput('mode', $arrInput);

        /* Execute the search. */
        $search = new SearchCandidates($this->_siteID);
        switch ($mode)
        {
            case 'searchByFullName':
                $rs = $search->byFullName($query, $sortBy, $sortDirection);

                foreach ($rs as $rowIndex => $row)
                {
                    if (!empty($row['ownerFirstName']))
                    {
                        $rs[$rowIndex]['ownerAbbrName'] = StringUtility::makeInitialName(
                            $row['ownerFirstName'],
                            $row['ownerLastName'],
                            false,
                            LAST_NAME_MAXLEN
                        );
                    }
                    else
                    {
                        $rs[$rowIndex]['ownerAbbrName'] = 'None';
                    }

                    $rsResume = $candidates->getResumes($row['candidateID']);
                    if (isset($rsResume[0]))
                    {
                        $rs[$rowIndex]['resumeID'] = $rsResume[0]['attachmentID'];
                    }
                }

                $isResumeMode = false;

                $fullNameWildCardString = $query;
                break;

            case 'searchByKeySkills':
                $rs = $search->byKeySkills($query, $sortBy, $sortDirection);

                foreach ($rs as $rowIndex => $row)
                {
                    if (!empty($row['ownerFirstName']))
                    {
                        $rs[$rowIndex]['ownerAbbrName'] = StringUtility::makeInitialName(
                            $row['ownerFirstName'],
                            $row['ownerLastName'],
                            false,
                            LAST_NAME_MAXLEN
                        );
                    }
                    else
                    {
                        $rs[$rowIndex]['ownerAbbrName'] = 'None';
                    }

                    $rsResume = $candidates->getResumes($row['candidateID']);
                    if (isset($rsResume[0]))
                    {
                        $rs[$rowIndex]['resumeID'] = $rsResume[0]['attachmentID'];
                    }
                }

                $isResumeMode = false;

                $keySkillsWildCardString = $query;

                break;

            case 'searchByResume':
                $searchPager = new SearchByResumePager(
                    20,
                    $currentPage,
                    $this->_siteID,
                    $query,
                    $sortBy,
                    $sortDirection
                );

                $baseURL = 'm=candidates&amp;a=search&amp;getback=getback&amp;mode=searchByResume&amp;wildCardString='
                    . urlencode($query)
                    . '&amp;searchByResume=Search';
                if(isset($_REQUEST["fldfilter"]))
                foreach($_REQUEST["fldfilter"] as $ind=>$filter)
                {
                    $condition=$_REQUEST["condition"][$ind];
                    $data=$_REQUEST["data"][$ind];
                    $boolean=$_REQUEST["boolean"][$ind];
                    $baseURL=$baseURL."&fldfilter[{$ind}]={$filter}&condition[{$ind}]={$condition}";
                    $baseURL=$baseURL."&data[{$ind}]={$data}&boolean[{$ind}]={$boolean}";
                    if($isFilterGrouping)
                    {
                        $group=$_REQUEST["group"][$ind];
                        $baseURL=$baseURL."&group[{$ind}]={$group}";
                    }
                }
                $searchPager->setSortByParameters(
                    $baseURL, $sortBy, $sortDirection
                );

                $rs = $searchPager->getPage();

                $currentPage = $searchPager->getCurrentPage();
                $totalPages  = $searchPager->getTotalPages();

                $pageStart = $searchPager->getThisPageStartRow() + 1;

                if (($searchPager->getThisPageStartRow() + 20) <= $searchPager->getTotalRows())
                {
                    $pageEnd = $searchPager->getThisPageStartRow() + 20;
                }
                else
                {
                    $pageEnd = $searchPager->getTotalRows();
                }
                
                foreach ($rs as $rowIndex => $row)
                {
                    $rs[$rowIndex]['excerpt'] = SearchUtility::searchExcerpt(
                        $query, $row['text']
                    );

                    if (!empty($row['ownerFirstName']))
                    {
                        $rs[$rowIndex]['ownerAbbrName'] = StringUtility::makeInitialName(
                            $row['ownerFirstName'],
                            $row['ownerLastName'],
                            false,
                            LAST_NAME_MAXLEN
                        );
                    }
                    else
                    {
                        $rs[$rowIndex]['ownerAbbrName'] = 'None';
                    }
                }
                
                $isResumeMode = true;
                
                $this->_template->assign('active', $this);
                $this->_template->assign('currentPage', $currentPage);
                $this->_template->assign('pageStart', $pageStart);
                $this->_template->assign('totalResults', $searchPager->getTotalRows());
                $this->_template->assign('pageEnd', $pageEnd);
                $this->_template->assign('totalPages', $totalPages);

                $resumeWildCardString = $query;
                break;

            case 'phoneNumber':
                $rs = $search->byPhone($query, $sortBy, $sortDirection);

                foreach ($rs as $rowIndex => $row)
                {
                    if (!empty($row['ownerFirstName']))
                    {
                        $rs[$rowIndex]['ownerAbbrName'] = StringUtility::makeInitialName(
                            $row['ownerFirstName'],
                            $row['ownerLastName'],
                            false,
                            LAST_NAME_MAXLEN
                        );
                    }
                    else
                    {
                        $rs[$rowIndex]['ownerAbbrName'] = 'None';
                    }

                    $rsResume = $candidates->getResumes($row['candidateID']);
                    if (isset($rsResume[0]))
                    {
                        $rs[$rowIndex]['resumeID'] = $rsResume[0]['attachmentID'];
                    }
                }

                $isResumeMode = false;

                $phoneNumberWildCardString = $query;
                break;

            default:
                $this->listByView('Invalid search mode.');
                return;
                break;
        }
        /**
         * if request comes from program return the id else process display
         */
        if(!is_null($objSearchDS))
        {
            return ResultSetUtility::getColumnValues($rs, 'candidateID');
        }
        $candidateIDs = implode(',', ResultSetUtility::getColumnValues($rs, 'candidateID'));
        
        $exportForm = ExportUtility::getForm(
            DATA_ITEM_CANDIDATE, $candidateIDs, 32, 9
        );

        if (!eval(Hooks::get('CANDIDATE_ON_SEARCH'))) return;

        /* Save the search. */
        $savedSearches = new SavedSearches($this->_siteID);
        $savedSearches->add(
            DATA_ITEM_CANDIDATE,
            $query,
            $_SERVER['REQUEST_URI'],
            false
        );
        $savedSearchRS = $savedSearches->get(DATA_ITEM_CANDIDATE);

        $this->_template->assign('savedSearchRS', $savedSearchRS);
        $this->_template->assign('exportForm', $exportForm);
        $this->_template->assign('active', $this);
        $this->_template->assign('rs', $rs);
        $this->_template->assign('pager', $searchPager);
        $this->_template->assign('isResultsMode', true);
        $this->_template->assign('isResumeMode', $isResumeMode);
        $this->_template->assign('wildCardString', $query);
        $this->_template->assign('resumeWildCardString', $resumeWildCardString);
        $this->_template->assign('keySkillsWildCardString', $keySkillsWildCardString);
        $this->_template->assign('fullNameWildCardString', $fullNameWildCardString);
        $this->_template->assign('phoneNumberWildCardString', $phoneNumberWildCardString);
        $this->_template->assign('mode', $mode);
        $this->_template->display('./modules/candidates/Search.php');
    }