Search for Jobs
 <?php
                    wp_parse_str($_SERVER['QUERY_STRING'], $fakeGET);
                    $searched = false;
                    $search = array();
                    if (! empty($fakeGET['freetext'])) {
                        $search['freetext'] = $fakeGET['freetext'];
                    } else {
                        $search['freetext'] = 'empty';
                    }
                    if (! empty($fakeGET['location'])) {
                        $search['location'] = $fakeGET['location'];
                    }
                    if (! empty($fakeGET['category'])) {
                        $searched = true;
                        if ($fakeGET['category'] != 'all') {
                            $search['category'] = $fakeGET['category'];
                        }
                    }
                    if (! empty($fakeGET['jobtype'])) {
                        $searched = true;
                        if ($fakeGET['jobtype'] != 'all') {
                            $search['jobtype'] = $fakeGET['jobtype'];
                        }
                    }
                    if (class_exists('BullHorn_Factory')) {
                        $bullHorn = BullHorn_Factory::Get();
                        $api = $bullHorn->get_api();
                        $searched = $searched || ! empty($search) || ! empty($_GET["searched"]);
                        $bullHornSearchResult = ( bool ) get_query_var('bullhorn_search_result');
                        $paged = (get_query_var('paged') ? get_query_var('paged') : 1);
                        if ($searched) {
                            $api->cookies->SetKVP($search, 'search_');
                        } elseif ($bullHornSearchResult) {
                            $kvp = $api->cookies->GetKVP('search_');
                            if (! empty($kvp)) {
                                foreach ($kvp as $key => $value) {
                                    $search[$key] = $value;
                                }
                            }
                            $paged = (get_query_var('bullhorn_search_result_page') ? get_query_var('bullhorn_search_result_page') : 1);
                        }
                        if (! empty($fakeGET["results-page"])) {
                            $paged = ( int ) $fakeGET["results-page"];
                        }
                        $searched = $searched || ! empty($search) || ! empty($_GET["searched"]);
                    }
                    if (class_exists('BullHorn_Factory')) {
                        ?>
                        <?php
                        $testPostParent = 28;
                        if ($post->post_parent) {
                            /*$children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0");*/
                            $children = wp_list_pages("title_li=&child_of=" . $testPostParent . "&echo=0");
                        } else {         /* $children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0"); */
                            $children = wp_list_pages("title_li=&child_of=" . $testPostParent . "&echo=0");
                        }
                         ?>
                        <div id="container">
                        <section id="content" role="main">
                            <div class="page type-page status-publish hentry">
                                <h1 class="entry-title"><?php _e('Looking for a Job?', BULLHORN_TEXT_DOMAIN); ?></h1>
                                <div class="entry-content">
                                    <?php
                                    $searchQueryArray = array();
                                    $searchTerms = '';
                                    foreach (array(
                                        'searched',
                                        'freetext',
                                        'location',
                                        'category',
                                        'jobtype',
                                    ) as $key) {
                                        if (isset($fakeGET[$key])) {
                                            $searchQueryArray[$key] = $fakeGET[$key];
                                            $searchTerms .= "&" . $key . "=" . $fakeGET[$key];
                                        }
                                    }
                                    ?>
                                    <?php
                                    if ($searched) {
                                        ?>
                                        <p><?php _e('Showing results', BULLHORN_TEXT_DOMAIN); ?></p>
                                        <?php
                                    } else {
                                        ?>
                                        <p><?php _e('Are you looking for a job?', BULLHORN_TEXT_DOMAIN); ?></p>
                                        <?php
                                    }
                                    $limit = (isset($_GET['limit'])) ? $_GET['limit'] : 25;
                                    $page = (isset($_GET['pages'])) ? $_GET['pages'] : 1;
                                    $offset = ceil(($page - 1) * $limit);
                                    $numItems = $api->getJobsForPagination(0, 10, $search, BullHorn_SearchConditions::ALL);
                                    // echo "Number of Results: ".$numItems;
                                    $numPages = ceil($numItems / $limit);
                                    $links = 7;
                                    $last = ceil($numItems / $limit);
                                    $start = (($page - $links) > 0) ? $page - $links : 1;
                                    $end = (($page + $links) < $last) ? $page + $links : $last;
                                    $paginationHtml = "<div id='bullhorn-pagination'>";
                                        if ($start > 1) {
                                            $paginationHtml .= '<a href="?limit=' . $limit . '&pages=1' . $searchTerms . '" class="bullhorn-pagination-entry bullhorn-pagination-active">1</a>';
                                            $paginationHtml .= '<span>...</span>';
                                        }
                                        for ($i = $start; $i <= $end; $i ++) {
                                            // $class = ( $this->_page == $i ) ? "active" : "";
                                            $paginationHtml .= '<a href="?limit=' . $limit . '&pages=' . $i . $searchTerms . '" class="bullhorn-pagination-entry">' . $i . '</a>';
                                        }
                                        if ($end < $last) {
                                            $paginationHtml .= '<span>...</span>';
                                            $paginationHtml .= '<a href="?limit=' . $limit . '&pages=' . $last . $searchTerms . '" class="bullhorn-pagination-entry">' . $last . '</a>';
                                        }
                                    $paginationHtml .= '</div>';
                                    echo $paginationHtml;
                                    if ($searched) {
                                        $results = $api->GetSearchResult($search, BullHorn_SearchConditions::ALL, $offset);
                                        $results->SetRootURL('/job-search/results/', $searchQueryArray);
                                    } else {
                                        $results = $api->GetLatestJobs(20, false, $offset);
                                        $results->SetRootURL('/job-search/?', $searchQueryArray);
                                    }
                                    ?>
                                    <table id="bullhorn-search-results">
                                        <thead>
                                            <tr>
                                                <th><?php _e('Job title', BULLHORN_TEXT_DOMAIN); ?></th>
                                                <th><?php _e('Specialty', BULLHORN_TEXT_DOMAIN); ?></th>
                                                <th><?php _e('Location', BULLHORN_TEXT_DOMAIN); ?></th>
                                                <th><?php _e('Job type', BULLHORN_TEXT_DOMAIN); ?></th>
                                                <!--th><?php _e('Salary/rate', BULLHORN_TEXT_DOMAIN); ?></th-->
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <?php
                                            foreach ($results as $job) {
                                                ?>
                                                <tr>
                                                <td>
                                                    <a href="<?php echo $job->GetURL(); ?>"><?php echo $job->title; ?></a>
                                                </td>
                                                <td><?php echo implode(', ', $job->categories); ?></td>
                                                <td><?php echo $job->address->city; ?> <?php echo $job->address->state; ?>
                                                </td>
                                                <td><?php
                                                    $whatjobtype = $job->GetEmploymentType();
                                                    if ($whatjobtype == 'Contract') {
                                                        $whatjobtype = 'Locum Tenens';
                                                    }
                                                    if ($whatjobtype == 'Direct Hire') {
                                                        $whatjobtype = 'Permanent';
                                                    }
                                                    echo $whatjobtype;
                                                ?></td>
                                                <!--td><?php /* php echo $job->GetSalaryRate(); */ ?></td-->
                                                </tr>
                                                <?php
                                            }
                                            ?>
                                        </tbody>
                                    </table>
                                    <?php
                                    ?>
                                    <?php
                                    echo $paginationHtml;
                                    ?>
                                </div>
                            </div>
                        </section>
                        <?php
                    } ?>
                    </div>
                    </div>
(800) 444-8479