diff options
author | Jayaram R Pai | 2014-07-14 12:51:34 +0530 |
---|---|---|
committer | Jayaram R Pai | 2014-07-14 12:51:34 +0530 |
commit | a0bacba1747274771a4901ecdba4e646c433ad62 (patch) | |
tree | 1d47fc15d7badc74576795a1de4b9d48761659f7 | |
parent | 24927e8afce92ba61241b54eefd6e6eb0fcf5ad7 (diff) | |
download | job_portal-a0bacba1747274771a4901ecdba4e646c433ad62.tar.gz job_portal-a0bacba1747274771a4901ecdba4e646c433ad62.tar.bz2 job_portal-a0bacba1747274771a4901ecdba4e646c433ad62.zip |
added page to view applications
-rw-r--r-- | job_portal.module | 95 |
1 files changed, 93 insertions, 2 deletions
diff --git a/job_portal.module b/job_portal.module index 2e3debd..afdd43e 100644 --- a/job_portal.module +++ b/job_portal.module @@ -18,7 +18,13 @@ ); $items["jobs/apply"] = array( "title" => "FOSSEE Job Portal - Application Form", - "page callback" => "job_portal_appplication_page", + "page callback" => "job_portal_application_page", + "access arguments" => array("access job_portal"), + "type" => MENU_CALLBACK, + ); + $items["jobs/view-applications"] = array( + "title" => "FOSSEE Job Portal - View Applications", + "page callback" => "job_portal_view_application_page", "access arguments" => array("access job_portal"), "type" => MENU_CALLBACK, ); @@ -186,7 +192,7 @@ return $output; } - function job_portal_appplication_page() { + function job_portal_application_page() { $output = array( "application_form" => array( "#prefix" => "<div id='job-application'>", @@ -197,6 +203,69 @@ return $output; } + function job_portal_view_application_page($position_id=0) { + $markup = ""; + if($position_id) { + $result = db_select("job_portal_applications") + ->fields("job_portal_applications") + ->condition("position_id", $position_id) + ->execute()->fetchAll(); + $headers = array( + "#", "Name", "Time", "Download" + ); + $rows = array(); + $i = 1; + foreach($result as $row) { + $item = array( + $i, + $row->name, + $row->time, + l("{$row->resume}", "uploads/resumes/{$row->id}/{$row->resume}") + ); + array_push($rows, $item); + $i++; + } + $job = db_select("job_portal_positions") + ->fields("job_portal_positions") + ->condition("id", $position_id) + ->execute()->fetchObject(); + $markup .= l("<< Back to the list of open positions", "jobs/view-applications"); + $markup .= "<h5><u>{$job->position} ({$job->specialization}) - List of applications</u></h5>"; + $markup .= bootstrap_table($headers, $rows); + } else { + /* List all the job positions. + * Change the condition later based on end date. + */ + $result = db_select("job_portal_positions") + ->fields("job_portal_positions") + ->condition("status", 1) + ->execute()->fetchAll(); + $headers = array( + "#", "Position", "Time", "Action", + ); + $rows = array(); + foreach($result as $row) { + $item = array( + $row->id, + $row->position, + $row->time, + l("View applications", "jobs/view-applications/{$row->id}") + ); + array_push($rows, $item); + } + $markup .= "<h5><u>List of job openings</u></h5>"; + $markup .= bootstrap_table($headers, $rows); + } + $output = array( + "positions_list" => array( + "#prefix" => "<div id='positions-list'>", + "#markup" => $markup, + "#suffix" => "</div>", + ), + ); + return $output; + } + /* helper functions */ function collapser($title="", $content="", $description="") { return " @@ -255,4 +324,26 @@ return $result; } } + + function bootstrap_table($headers, $rows) { + $thead = ""; + $tbody = ""; + foreach($headers as $header) { + $thead .= "<th>{$header}</th>"; + } + foreach($rows as $row) { + $tbody .= "<tr>"; + foreach($row as $data) { + $tbody .= "<td>{$data}</td>"; + } + $tbody .= "</tr>"; + } + $table = " + <table class='table table-bordered table-hover'> + <thead>{$thead}</thead> + <tbody>{$tbody}</tbody> + </table> + "; + return $table; + } ?> |