Created
October 3, 2016 18:11
-
-
Save techgirlgeek/41f280740c7f5a09288606adf5814ab8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Defines a new dashboard page | |
*/ | |
function davita_pages_menu(){ | |
$items['job-finder'] = array( | |
'title' => 'Job Finder', | |
'type' => MENU_NORMAL_ITEM, | |
'access arguments' => array('access content'), | |
'page callback' => '_job_finder', | |
); | |
return $items; | |
} | |
/* | |
* Job Listing Page, creates HTML for both step 1 and step 2 | |
*/ | |
function _job_finder(){ | |
/** | |
* This is a pretty hack-ish way of doing this, but on short notice this is the best option rather than | |
* just creating a new admin form for this one specific type of page which breaks all other ux and will | |
* make it a one-off static solution and can diverge from homepage. The trade off for this is an additional http request for these pages | |
* | |
* The reason we can't just grab from a node/url is because metatag generation is done in the metatag module in the rendering | |
* not before so we don't have access to that generation without ripping through the whole metatag module (which we don't have time for) | |
*/ | |
global $base_url; | |
$request = drupal_http_request($base_url); | |
$dom = new DOMDocument(); | |
$dom->loadHTML($request->data); | |
/*drupal_add_http_header('Access-Control-Allow-Origin', "*"); | |
drupal_add_http_header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE');*/ | |
foreach($dom->getElementsByTagName('meta') AS $curTag) { | |
$tmpTag = array( | |
'#type' => 'html_tag', | |
'#tag' => 'meta', | |
'#attributes' => array( | |
'content' => $curTag->getAttribute('content'), | |
'name' => $curTag->getAttribute('name'), | |
'property' => $curTag->getAttribute('property') | |
) | |
); | |
drupal_add_html_head($tmpTag, !empty($tmpTag['#attributes']['name']) ? $tmpTag['#attributes']['name'] : $tmpTag['#attributes']['property'] ); | |
} | |
$print = ''; | |
$step = 1; | |
if(!empty($_GET['step']) && $_GET['step'] == 2){ | |
$step = 2; | |
} | |
$blocks_to_render = array( | |
'block'=>'2'//job listing | |
,'webform' => 'client-block-1'//referral form | |
); | |
$print .= '<div class="davita_body"><div class="job_finder_body_wrapper"> | |
<div class="portal_return_link lato-regular"><a href="'.base_path().'">< Back to Referral Homepage</a></div>'; | |
$print .= '<div class="job_finder_title lato-regular">Please select a position from the list below for your referral to be matched to</div>'; | |
foreach($blocks_to_render as $module=>$block){ | |
$print_block = block_load($module, $block); | |
$print_block = _block_render_blocks(array($print_block)); | |
$block_array = _block_get_renderable_array($print_block); | |
$block_html = drupal_render($block_array); | |
//$print .= '<h2>'.$block_item->subject.'</h2>'; | |
if($block == 'client-block-1'){ | |
//Only display referral form if step is empty | |
if($step == 1){ | |
$print .= '<div class="form_arrow"></div><div class="webform-client-form-wrapper" id="referral" style="display:none">'.$block_html.'</div>'; | |
} | |
}else{ | |
$print .= $block_html; | |
//if on step 2, add these buttons | |
if($step == 2 && $block == '2'){ | |
$print .= '<div class="job-listing-submit-container">'; | |
#$print .= '<a class="referral-submit job-listing-submit">Submit Job Referral for the Selected Posting</a>'; | |
$print .= '<a class="referral-submit job-listing-submit click_btn orange_btn btns left">Submit My Referral for This Position</a>'; | |
//$print .= '<br />'; | |
$print .= '<a class="referral-submit job-listing-submit cant-find click_btn orange_btn btns large left">I Don\'t See the Job, Please Send to the Recruiter</a>'; | |
$print .= '<div class="clear"></div></div>'; | |
$print .= _get_popup(); | |
}else{ | |
$print .= '<a class="job-listing-submit form-toggle click_btn orange_btn btns large">Submit My Referral for This Position</a>'; | |
} | |
} | |
} | |
$print .= ' | |
</div> | |
</div>'; | |
drupal_add_http_header('Content-Type', 'application/json'); | |
return $print; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Defines a new dashboard page | |
*/ | |
function davita_pages_menu(){ | |
$items['job-finder'] = array( | |
'title' => 'Job Finder', | |
'type' => MENU_NORMAL_ITEM, | |
'access arguments' => array('access content'), | |
'page callback' => '_job_finder', | |
); | |
return $items; | |
} | |
/* | |
* Job Listing Page, creates HTML for both step 1 and step 2 | |
*/ | |
function _job_finder(){ | |
/** | |
* This is a pretty hack-ish way of doing this, but on short notice this is the best option rather than | |
* just creating a new admin form for this one specific type of page which breaks all other ux and will | |
* make it a one-off static solution and can diverge from homepage. The trade off for this is an additional http request for these pages | |
* | |
* The reason we can't just grab from a node/url is because metatag generation is done in the metatag module in the rendering | |
* not before so we don't have access to that generation without ripping through the whole metatag module (which we don't have time for) | |
*/ | |
global $base_url; | |
$request = drupal_http_request($base_url); | |
$dom = new DOMDocument(); | |
$dom->loadHTML($request->data); | |
/*drupal_add_http_header('Access-Control-Allow-Origin', "*"); | |
drupal_add_http_header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE');*/ | |
foreach($dom->getElementsByTagName('meta') AS $curTag) { | |
$tmpTag = array( | |
'#type' => 'html_tag', | |
'#tag' => 'meta', | |
'#attributes' => array( | |
'content' => $curTag->getAttribute('content'), | |
'name' => $curTag->getAttribute('name'), | |
'property' => $curTag->getAttribute('property') | |
) | |
); | |
drupal_add_html_head($tmpTag, !empty($tmpTag['#attributes']['name']) ? $tmpTag['#attributes']['name'] : $tmpTag['#attributes']['property'] ); | |
} | |
$print = ''; | |
$step = 1; | |
if(!empty($_GET['step']) && $_GET['step'] == 2){ | |
$step = 2; | |
} | |
$blocks_to_render = array( | |
'block'=>'2'//job listing | |
,'webform' => 'client-block-1'//referral form | |
); | |
$print .= '<div class="davita_body"><div class="job_finder_body_wrapper"> | |
<div class="portal_return_link lato-regular"><a href="'.base_path().'">< Back to Referral Homepage</a></div>'; | |
$print .= '<div class="job_finder_title lato-regular">Please select a position from the list below for your referral to be matched to</div>'; | |
foreach($blocks_to_render as $module=>$block){ | |
$print_block = block_load($module, $block); | |
$print_block = _block_render_blocks(array($print_block)); | |
$block_array = _block_get_renderable_array($print_block); | |
$block_html = drupal_render($block_array); | |
//$print .= '<h2>'.$block_item->subject.'</h2>'; | |
if($block == 'client-block-1'){ | |
//Only display referral form if step is empty | |
if($step == 1){ | |
$print .= '<div class="form_arrow"></div><div class="webform-client-form-wrapper" id="referral" style="display:none">'.$block_html.'</div>'; | |
} | |
}else{ | |
$print .= $block_html; | |
//if on step 2, add these buttons | |
if($step == 2 && $block == '2'){ | |
$print .= '<div class="job-listing-submit-container">'; | |
#$print .= '<a class="referral-submit job-listing-submit">Submit Job Referral for the Selected Posting</a>'; | |
$print .= '<a class="referral-submit job-listing-submit click_btn orange_btn btns left">Submit My Referral for This Position</a>'; | |
//$print .= '<br />'; | |
$print .= '<a class="referral-submit job-listing-submit cant-find click_btn orange_btn btns large left">I Don\'t See the Job, Please Send to the Recruiter</a>'; | |
$print .= '<div class="clear"></div></div>'; | |
$print .= _get_popup(); | |
}else{ | |
$print .= '<a class="job-listing-submit form-toggle click_btn orange_btn btns large">Submit My Referral for This Position</a>'; | |
} | |
} | |
} | |
$print .= ' | |
</div> | |
</div>'; | |
drupal_add_http_header('Content-Type', 'application/json'); | |
return $print; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment