How to add the pricing plan to another page on your site in WebJobs
Thursday, April 17th, 2008
Problem: The dynamic list of prices for posting jobs is only viewable to employers who are logged in.
Solution:
In your new page in engine/pages/new_page.php , make sure the following is included near the top:
require_once ’smartway/lib/table.lib’;
Then add the following two classes, which originate in the engine/pages/employer_home.php file:
class employer_job_plans_table_renderer extends sql_table_renderer{
function employer_job_plans_table_renderer(){
$application =& application();
parent::sql_table_renderer();
$this->table_class = ’seeker_search_res_wide’;
$this->header_class = $this->footer_class = ’seeker_search_ends_wide’;
$this->row_1_class = ’seeker_search_row1_wide’;
$this->row_2_class = ’seeker_search_row2_wide’;
$this->header_navbar_class = ‘narrow_navbar_top’;
$this->footer_navbar_class = ‘narrow_navbar_bottom’;
}function handle_duration($f){
$application =& application();
return $f[’duration’] .’ ‘.$application->text(’days’);
}
function handle_quantity($f){
$application =& application();
return $f[’quantity’];
}function handle_price($f){
$application =& application();
if(ceil($f[’price’])==0){
return $application->text(’Free’);
}
else{
return $application->config(’currency_symbol’) . util_funcs::number_format($f[’price’], 2);
}
}
function handle_type($f){
$application =& application();
return $application->text($f[’type’]);
}
function handle_controls($row)
{
$application =& application();
$text = $application->text();
$service = $application->input(’service’);
$PHP_SELF = $application->server(’PHP_SELF’);if($row[’type’]==’job_postings’){
if(ceil($row[’price’]) != 0){
$output = ” <a href=’$PHP_SELF?page=post_single_job1&job_post_type={$row[’name’]}’>\n{$text[’purchase’]}</a> \n ” ;
}
else{ // User is getting a free plan
$output = ” <a href=’$PHP_SELF?page=employer_home&action=free_plan&plan_id={$row[’id’]}’>\n{$text[’purchase’]}</a> \n ” ;
}
}
else{ // Resume View
if(ceil($row[’price’])!=0){
$output = ” <a href=’$PHP_SELF?page=resume_searches&searches_type={$row[’name’]}’>\n {$text[’purchase’]}</a> \n ” ;
}
else{ // User is getting a free plan
$output = ” <a href=’$PHP_SELF?page=employer_home&action=free_plan&plan_id={$row[’id’]}’>\n{$text[’purchase’]}</a> \n ” ;
}
}
return $output;
} // handle_controls
} // employer_job_plans_table_rendererclass employer_combo_plans_table_renderer extends sql_table_renderer{
function employer_combo_plans_table_renderer(){
$application =& application();
parent::sql_table_renderer();
$this->table_class = ’seeker_search_res_wide’;
$this->header_class = $this->footer_class = ’seeker_search_ends_wide’;
$this->row_1_class = ’seeker_search_row1_wide’;
$this->row_2_class = ’seeker_search_row2_wide’;
$this->header_navbar_class = ‘narrow_navbar_top’;
$this->footer_navbar_class = ‘narrow_navbar_bottom’;
}function handle_price($f){
$application =& application();
if(ceil($f[’price’])==0){
return $application->text(’Free’);
}
else{
return $application->config(’currency_symbol’) . util_funcs::number_format($f[’price’], 2);
}
}function handle_posting_plan($f){
return $f[’posting_plan_name’];
}function handle_resume_plan($f){
return $f[’resume_plan_name’];
}function handle_name($f){
return $f[’name’];
}function handle_controls($row)
{
$application =& application();
$text = $application->text();
$service = $application->input(’service’);
$PHP_SELF = $application->server(’PHP_SELF’);if(ceil($row[’price’])!=0){
return ” <a href=’$PHP_SELF?page=combo_package&plan_id={$row[’id’]}’>\n {$text[’purchase’]}</a> \n ” ;
}
else{ // User is getting a free plan
return ” <a href=’$PHP_SELF?page=employer_home&action=free_combo&plan_id={$row[’id’]}’>\n{$text[’purchase’]}</a> \n ” ;
}
} // handle_controls
} // class employer_combo_plans_table_renderer