From 2ba4fe9996eaafd8c98aa93b28062e7b0a861695 Mon Sep 17 00:00:00 2001 From: prashant Date: Thu, 18 Aug 2016 15:15:17 +0530 Subject: formated the code --- job_portal.module | 1210 ++++++++++++++++++++++++++------------------------ job_portal.module~ | 740 ++++++++++++++++++++++++++++++ js/main.js | 48 +- js/main.js~ | 26 ++ js/smooth_scroll.js | 47 +- js/smooth_scroll.js~ | 25 ++ 6 files changed, 1458 insertions(+), 638 deletions(-) create mode 100755 job_portal.module~ create mode 100755 js/main.js~ create mode 100755 js/smooth_scroll.js~ diff --git a/job_portal.module b/job_portal.module index f24b72a..edad87d 100755 --- a/job_portal.module +++ b/job_portal.module @@ -1,231 +1,239 @@ array( - "title" => t("Access Job Portal"), - "description" => t("Allows users to view job postings.") - ), - "manage job_portal" => array( - "title" => t("Manage Job Portal"), - "description" => t("Allows users to manage job postings.") - ), - "manage download_application" => array( - "title" => t("Manage Download Portal"), - "description" => t("Allows users to download job applications.") - ) - ); + $items = array(); + $items["jobs"] = array( + "title" => "FOSSEE Job Portal", + "page callback" => "job_portal_page", + "access arguments" => array( + "access job_portal" + ), + "type" => MENU_CALLBACK + ); + $items["jobs/apply"] = array( + "title" => "FOSSEE Job Portal - Application Form", + "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( + "manage job_portal" + ), + "type" => MENU_CALLBACK + ); + $items["jobs/view-applications-if32ggxV747"] = array( + "title" => "FOSSEE Job Portal - View Applications", + "page callback" => "job_portal_view_application_page", + "access arguments" => array( + "access job_portal" + ), + "type" => MENU_CALLBACK + ); + $items["jobs/downloads_applications"] = array( + "title" => "Application Download", + "description" => "Applications Download", + "page callback" => "job_portal_downloads_applications_page", + "access arguments" => array( + "access job_portal" + ), + "type" => MENU_CALLBACK + ); + $items["jobs/downloads_all_applications"] = array( + "title" => "Application Download", + "description" => "Applications Download", + "page callback" => "job_portal_downloads_all_applications_page", + "access arguments" => array( + "access job_portal" + ), + "type" => MENU_CALLBACK + ); + $items["jobs/downloads_all_applications_spreadsheet"] = array( + "title" => "Application Download", + "description" => "Applications Data Download", + "page callback" => "job_portal_downloads_all_applications_spreadsheet_page", + "access arguments" => array( + "access job_portal" + ), + "type" => MENU_CALLBACK + ); + $items["jobs/downloads_all_applications_doc"] = array( + "title" => "Application Download", + "description" => "Applications Data Download", + "page callback" => "job_portal_downloads_all_applications_document_page", + "access arguments" => array( + "access job_portal" + ), + "type" => MENU_CALLBACK + ); + $items["jobs/ajax"] = array( + "title" => "Ajax callbacks", + "page callback" => "job_portal_ajax", + "access arguments" => array( + "access job_portal" + ), + "type" => MENU_CALLBACK + ); + return $items; } - -function job_portal_menu() +/* hook permission */ +function job_portal_permission() { - $items = array(); - $items["jobs"] = array( - "title" => "FOSSEE Job Portal", - "page callback" => "job_portal_page", - "access arguments" => array( - "access job_portal" - ), - "type" => MENU_CALLBACK - ); - $items["jobs/apply"] = array( - "title" => "FOSSEE Job Portal - Application Form", - "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( - "manage job_portal" - ), - "type" => MENU_CALLBACK - ); - $items["jobs/view-applications-if32ggxV747"] = array( - "title" => "FOSSEE Job Portal - View Applications", - "page callback" => "job_portal_view_application_page", - "access arguments" => array( - "access job_portal" - ), - "type" => MENU_CALLBACK - ); - $items["jobs/downloads_applications"] = array( - "title" => "Application Download", - "description" => "Applications Download", - "page callback" => "job_portal_downloads_applications_page", - "access arguments" => array( - "access job_portal" - ), - "type" => MENU_CALLBACK - ); - $items["jobs/downloads_all_applications"] = array( - "title" => "Application Download", - "description" => "Applications Download", - "page callback" => "job_portal_downloads_all_applications_page", - "access arguments" => array( - "access job_portal" - ), - "type" => MENU_CALLBACK - ); - $items["jobs/downloads_all_applications_spreadsheet"] = array( - "title" => "Application Download", - "description" => "Applications Data Download", - "page callback" => "job_portal_downloads_all_applications_spreadsheet_page", - "access arguments" => array( - "access job_portal" - ), - "type" => MENU_CALLBACK - ); - $items["jobs/downloads_all_applications_doc"] = array( - "title" => "Application Download", - "description" => "Applications Data Download", - "page callback" => "job_portal_downloads_all_applications_document_page", - "access arguments" => array( - "access job_portal" - ), - "type" => MENU_CALLBACK - ); - $items["jobs/ajax"] = array( - "title" => "Ajax callbacks", - "page callback" => "job_portal_ajax", - "access arguments" => array( - "access job_portal" - ), - "type" => MENU_CALLBACK - ); - return $items; + return array( + "access job_portal" => array( + "title" => t("Access Job Portal"), + "description" => t("Allows users to view job postings.") + ), + "manage job_portal" => array( + "title" => t("Manage Job Portal"), + "description" => t("Allows users to manage job postings.") + ), + "manage download_application" => array( + "title" => t("Manage Download Portal"), + "description" => t("Allows users to download job applications.") + ) + ); } - +/* job portal application form */ function job_portal_application_form($form, &$form_state, $position_id = 0) { - $form = array(); - $form["wrapper"] = array( - "#type" => "fieldset", - "#title" => t("Application form"), - "#collapsible" => TRUE - ); - $form["wrapper"]["position"] = array( - "#type" => "select", - "#title" => t("Job Position"), - "#description" => t("Select the position for which you are applying."), - "#options" => get_jobs_available("options"), - "#empty_option" => t("--- Select a position ---"), - "#default_value" => $position_id, - '#attributes' => array( - 'disabled' => 'disabled' - ), - "#required" => TRUE - ); - $form["wrapper"]["name"] = array( - "#type" => "textfield", - "#title" => t("Name"), - "#description" => t("Please enter your full name."), - "#required" => TRUE, - "#attributes" => array( - 'style' => 'text-transform:uppercase' - ) - ); - $form["wrapper"]["contact"] = array( - "#type" => "textfield", - "#title" => t("Contact Number"), - "#description" => t("Please enter your contact number."), - "#required" => TRUE - ); - $form["wrapper"]["email"] = array( - "#type" => "textfield", - "#title" => t("Email"), - "#description" => t("Please enter your e-mail id."), - "#required" => TRUE - ); - $form["wrapper"]["resume"] = array( - "#type" => "file", - "#title" => t("Resume" . required_star()), - "#description" => t("Please upload your resume [pdf].") - ); - $form["wrapper"]["submit"] = array( - "#type" => "submit", - "#value" => "Submit Application" - ); - return $form; + $form = array(); + $form["wrapper"] = array( + "#type" => "fieldset", + "#title" => t("Application form"), + "#collapsible" => TRUE + ); + $form["wrapper"]["position"] = array( + "#type" => "select", + "#title" => t("Job Position"), + "#description" => t("Select the position for which you are applying."), + "#options" => get_jobs_available("options"), + "#empty_option" => t("--- Select a position ---"), + "#default_value" => $position_id, + '#attributes' => array( + 'disabled' => 'disabled' + ), + "#required" => TRUE + ); + $form["wrapper"]["name"] = array( + "#type" => "textfield", + "#title" => t("Name"), + "#description" => t("Please enter your full name."), + "#required" => TRUE, + "#attributes" => array( + 'style' => 'text-transform:uppercase' + ) + ); + $form["wrapper"]["contact"] = array( + "#type" => "textfield", + "#title" => t("Contact Number"), + "#description" => t("Please enter your contact number."), + "#required" => TRUE + ); + $form["wrapper"]["email"] = array( + "#type" => "textfield", + "#title" => t("Email"), + "#description" => t("Please enter your e-mail id."), + "#required" => TRUE + ); + $form["wrapper"]["resume"] = array( + "#type" => "file", + "#title" => t("Resume" . required_star()), + "#description" => t("Please upload your resume [pdf].") + ); + $form["wrapper"]["submit"] = array( + "#type" => "submit", + "#value" => "Submit Application" + ); + return $form; } - +/* job portal application form validate */ function job_portal_application_form_validate($form, &$form_state) { - $file = file_save_upload('resume', array( - // Validate extensions. - 'file_validate_extensions' => array( - 'pdf' - ) - )); - // If the file passed validation: - if ($file) { - // Move the file into the Drupal file system. - if ($file = file_move($file, 'public://')) { - // Save the file for use in the submit handler. - $form_state['storage']['resume'] = $file; - } //$file = file_move($file, 'public://') - else { - form_set_error('resume', t("Failed to write the uploaded file to the site's file folder.")); - } - } //$file - else { - form_set_error('resume', t('No file was uploaded.')); + $file = file_save_upload('resume', array( + // Validate extensions. + 'file_validate_extensions' => array( + 'pdf' + ) + )); + // If the file passed validation: + if ($file) + { + // Move the file into the Drupal file system. + if ($file = file_move($file, 'public://')) + { + // Save the file for use in the submit handler. + $form_state['storage']['resume'] = $file; + } //$file = file_move($file, 'public://') + else + { + form_set_error('resume', t("Failed to write the uploaded file to the site's file folder.")); } - /* validating email field */ - if (!valid_email_address($form_state["values"]["email"])) { - form_set_error('email', t('Please enter an valid email address.')); - } //!valid_email_address($form_state["values"]["email"]) + } //$file + else + { + form_set_error('resume', t('No file was uploaded.')); + } + /* validating email field */ + if (!valid_email_address($form_state["values"]["email"])) + { + form_set_error('email', t('Please enter an valid email address.')); + } //!valid_email_address($form_state["values"]["email"]) } - +/* job portal application form validate */ function job_portal_application_form_submit($form, &$form_state) { - $v = $form_state["values"]; - $resume = $form_state["storage"]["resume"]; - $display = 1; - $dt = new DateTime(); - $current_date = $dt->format("Y-m-d H:i:s"); - $query = " + $v = $form_state["values"]; + $resume = $form_state["storage"]["resume"]; + $display = 1; + $dt = new DateTime(); + $current_date = $dt->format("Y-m-d H:i:s"); + $query = " INSERT INTO job_portal_applications (name, contact, email, resume, position_id, date, display) VALUES (:name, :contact, :email, :resume, :position_id, :current_date, :display) "; - $args = array( - ":name" => $v["name"], - ":contact" => $v["contact"], - ":email" => $v["email"], - ":resume" => $resume->filename, - ":position_id" => $v["position"], - ":current_date" => $current_date, - ":display" => $display - ); - /* storing the row id in $result */ - $result = db_query($query, $args, array( - 'return' => Database::RETURN_INSERT_ID - )); - /* moving the file to uploads/resumes */ - $base_path = $_SERVER['DOCUMENT_ROOT'] . base_path(); - $uploads_dir = $base_path . "uploads/resumes"; - if (!file_exists($uploads_dir . "/{$result}/")) { - mkdir($uploads_dir . "/{$result}/", 0755, TRUE); - } //!file_exists($uploads_dir . "/{$result}/") - file_unmanaged_move($resume->uri, $uploads_dir . "/{$result}/{$resume->filename}"); - $emails = db_select("job_portal_positions")->fields("job_portal_positions", array( - "notify" - ))->condition("id", $v["position"])->execute()->fetchObject(); - $emails = $emails->notify; - $position = get_jobs_available("options"); - $position = $position[$v["position"]]; - /* preparing to send mail to the recruiters */ - $from = "jobs[ at ]fossee [ dot ] in"; - $to = "jobs[ at ]fossee [ dot ] in"; - $cc = $emails; - $bcc = "prashantsinalkar[ at ] gmail [ dot ] com"; - $subject = "Job Application - {$position}"; - $message = " + $args = array( + ":name" => $v["name"], + ":contact" => $v["contact"], + ":email" => $v["email"], + ":resume" => $resume->filename, + ":position_id" => $v["position"], + ":current_date" => $current_date, + ":display" => $display + ); + /* storing the row id in $result */ + $result = db_query($query, $args, array( + 'return' => Database::RETURN_INSERT_ID + )); + /* moving the file to uploads/resumes */ + $base_path = $_SERVER['DOCUMENT_ROOT'] . base_path(); + $uploads_dir = $base_path . "uploads/resumes"; + if (!file_exists($uploads_dir . "/{$result}/")) + { + mkdir($uploads_dir . "/{$result}/", 0755, TRUE); + } //!file_exists($uploads_dir . "/{$result}/") + file_unmanaged_move($resume->uri, $uploads_dir . "/{$result}/{$resume->filename}"); + $emails = db_select("job_portal_positions")->fields("job_portal_positions", array( + "notify" + ))->condition("id", $v["position"])->execute()->fetchObject(); + $emails = $emails->notify; + $position = get_jobs_available("options"); + $position = $position[$v["position"]]; + /* preparing to send mail to the recruiters */ + $from = "jobs@fossee.in"; + $to = "jobs@fossee.in"; + $cc = $emails; + $bcc = "prashantsinalkar@gmail.com"; + $subject = "Job Application - {$position}"; + $message = "

{$v['name']} has applied for the post of {$position}.

@@ -235,22 +243,22 @@ function job_portal_application_form_submit($form, &$form_state)

Please check the resume attached to this mail.

"; - $file = $uploads_dir . "/{$result}/" . $resume->filename; - $mail_status = send_mail_attachment($from, $to, $cc, $bcc, $subject, $message, $file); - if (!$mail_status) { - drupal_set_message("An error occurred while sending mail.", "error"); - } //!$mail_status - else { - drupal_set_message("We have received your application. Thank you!", "status"); - } - - /* cleaning up temporary storage */ - file_delete($resume); - unset($form["storage"]["resume"]); - - /* sending notification to the applicant */ - $subject = "Application received for {$position}"; - $message = " + $file = $uploads_dir . "/{$result}/" . $resume->filename; + $mail_status = send_mail_attachment($from, $to, $cc, $bcc, $subject, $message, $file); + if (!$mail_status) + { + drupal_set_message("An error occurred while sending mail.", "error"); + } //!$mail_status + else + { + drupal_set_message("We have received your application. Thank you!", "status"); + } + /* cleaning up temporary storage */ + file_delete($resume); + unset($form["storage"]["resume"]); + /* sending notification to the applicant */ + $subject = "Application received for {$position}"; + $message = " Dear {$v['name']}, We have received your application for the post of {$position}. @@ -259,20 +267,19 @@ We will get back to you shortly. Regards, FOSSEE Team "; - send_mail("jobs[ at ]fossee [ dot ]in", $v["email"], $subject, $message); + send_mail("jobs@fossee.in", $v["email"], $subject, $message); } - +/* job portal page */ function job_portal_page() { - - $output = ""; - $quick_links = ""; - $i = 1; - - $result = get_jobs_available(); - foreach ($result as $row) { - $collapser_header = "#{$i} - {$row->project} - Job Details"; - $collapser_content = " + $output = ""; + $quick_links = ""; + $i = 1; + $result = get_jobs_available(); + foreach ($result as $row) + { + $collapser_header = "#{$i} - {$row->project} - Job Details"; + $collapser_content = " Position: {$row->position}
Specialization: {$row->specialization}
Salary: {$row->salary}
@@ -281,328 +288,346 @@ function job_portal_page() Job Responsibilities: {$row->responsibilities} Location: {$row->location}

"; - $collapser_content .= "
"; - $collapser_content .= l(" Apply Now", "jobs/apply/{$row->id}", array( - "attributes" => array( - "class" => "btn btn-success btn-large" - ), - "html" => TRUE - )); - $collapser_content .= "
"; - $output .= collapser($collapser_header, $collapser_content, "", $i); - $quick_links .= "{$i}
"; - $i++; - } //$result as $row - $output .= "


If your interest is to work on any other FOSS such as Python, OpenFOAM, Osdag, Sandhi, OpenModelica, FreeEDA, Scilab, SBHS, DWSIM, FOSSEE-Netbook, etc, you may email your resumes to jobs[at]fossee[dot]in

The email subject should contain:

"; - $output = array( - "quick_links" => array( - "#prefix" => "" - ), - "job_description" => array( - "#prefix" => "
", - "#markup" => $output, - "#suffix" => "
" - ) - ); - - return $output; + $collapser_content .= "
"; + $collapser_content .= l(" Apply Now", "jobs/apply/{$row->id}", array( + "attributes" => array( + "class" => "btn btn-success btn-large" + ), + "html" => TRUE + )); + $collapser_content .= "
"; + $output .= collapser($collapser_header, $collapser_content, "", $i); + $quick_links .= "{$i}
"; + $i++; + } //$result as $row + $output .= "


If your interest is to work on any other FOSS such as Python, OpenFOAM, Osdag, Sandhi, OpenModelica, eSim, Scilab, SBHS, DWSIM, FOSSEE-Netbook, etc, you may email your resumes to jobs[at]fossee[dot]in

The email subject should contain:

+

+

Semester Internships

+ +FOSSEE group at IIT Bombay aims to improve the quality of education with the use of open source software tools such as Scilab, Python, eSim, and Sandhi amongst others. +

+We have semester internships available with the following groups- +

+

    +
  1. Scilab Signal Processing & DSP toolbox
  2. +
  3. Scilab Computer Vision toolbox
  4. +
  5. Scilab Image Processing toolbox
  6. +
  7. Scilab Communication Systems toolbox
  8. +
  9. IoT with RaspberryPi and Arduino
  10. +
+

+We invite coders/testers from any background to participate and contribute to this project as part of FOSSEE semester internship. To know more about the internship requirements, please read- https://goo.gl/OuHa2H. If you have any doubts, please email toolbox[at]scilab[dot]in. +

+"; + $output = array( + "quick_links" => array( + "#prefix" => "" + ), + "job_description" => array( + "#prefix" => "
", + "#markup" => $output, + "#suffix" => "
" + ) + ); + return $output; } - function job_portal_application_page($position_id = 0) { - $application_form = ""; - $form_job = drupal_get_form("job_portal_application_form", $position_id); - $job_form = drupal_get_form("job_portal_application_form"); - if ($position_id) { - $application_form = drupal_render($form_job); - } //$position_id - else { - $application_form = drupal_render($job); - } - $output = array( - "application_form" => array( - "#prefix" => "
", - "#markup" => $application_form, - "#suffix" => "
" - ) - ); - return $output; + $application_form = ""; + $form_job = drupal_get_form("job_portal_application_form", $position_id); + $job_form = drupal_get_form("job_portal_application_form"); + if ($position_id) + { + $application_form = drupal_render($form_job); + } //$position_id + else + { + $application_form = drupal_render($job); + } + $output = array( + "application_form" => array( + "#prefix" => "
", + "#markup" => $application_form, + "#suffix" => "
" + ) + ); + return $output; } - function job_portal_view_application_page($position_id = 0) { - $markup = ""; - if (array_key_exists("saved", $_GET)) { - drupal_set_message("Selections saved successfully.", "success"); - } //array_key_exists("saved", $_GET) - if ($position_id) { - $result = db_select("job_portal_applications")->fields("job_portal_applications")->condition("position_id", $position_id)->condition("display", 1)->execute()->fetchAll(); - $headers = array( - "#", - "Name", - "Email", - "Date", - "Download", - "Select" - ); - $rows = array(); - $i = 1; - foreach ($result as $row) { - $item = array( - $i, - $row->name, - $row->email, - $row->date, - l(str_replace('.', '_', str_replace(' ', '_', strtolower("{$row->id}_{$row->name}"))) . '.pdf', "uploads/resumes/{$row->id}/{$row->resume}", array( - "attributes" => array( - "target" => "_blank" - ) - )) - ); - - if ($row->selected) { - $check = ""; - } //$row->selected - else { - $check = ""; - } - array_push($item, $check); - - - array_push($rows, $item); - $i++; - } //$result as $row - - $job = db_select("job_portal_positions")->fields("job_portal_positions")->condition("id", $position_id)->condition("display", 1)->execute()->fetchObject(); - $markup .= l("<< Back to the list of open positions", "jobs/view-applications-if32ggxV747"); - $markup .= "
"; - $markup .= l("Download all applications", "jobs/downloads_all_applications/{$position_id}"); - $markup .= "
"; - $markup .= l("Download selected applications", "jobs/downloads_selected_applications/{$position_id}", array( - "attributes" => array( - "id" => "d_app" - ) - )); - $markup .= "
"; - $markup .= l("Download applications data in document", "jobs/downloads_all_applications_doc/{$position_id}", array( - "attributes" => array( - "id" => "d_aaps" - ) - )); - $markup .= "
"; - $markup .= l("Download applications data in spreadsheet", "jobs/downloads_all_applications_spreadsheet/{$position_id}", array( - "attributes" => array( - "id" => "d_aaps" - ) - )); - $markup .= "
"; - $markup .= "
{$job->position} ({$job->specialization}) - List of applications
"; - $markup .= bootstrap_table($headers, $rows); - $markup .= l("Save Selections", "jobs/view-applications-if32ggxV747/", array( - "query" => array( - "saved" => "true" - ), - "attributes" => array( - "class" => "btn btn-primary" - ) - )); - } //$position_id - 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", 0, '<>')->condition("display", 1)->execute()->fetchAll(); - $headers = array( - "#", - "Position", - "Time", - "Action" - ); - $rows = array(); - $i = 1; - foreach ($result as $row) { - $item = array( - $i, - "{$row->position} [ {$row->project} ]", - $row->time, - l("View applications", "jobs/view-applications-if32ggxV747/{$row->id}") - ); - array_push($rows, $item); - $i++; - } //$result as $row - $markup .= "
List of job openings
"; - $markup .= bootstrap_table($headers, $rows); - } - $output = array( - "positions_list" => array( - "#prefix" => "
", - "#markup" => $markup, - "#suffix" => "
" - ) + $markup = ""; + if (array_key_exists("saved", $_GET)) + { + drupal_set_message("Selections saved successfully.", "success"); + } //array_key_exists("saved", $_GET) + if ($position_id) + { + $result = db_select("job_portal_applications")->fields("job_portal_applications")->condition("position_id", $position_id)->condition("display", 1)->execute()->fetchAll(); + $headers = array( + "#", + "Name", + "Email", + "Date", + "Download", + "Select" + ); + $rows = array(); + $i = 1; + foreach ($result as $row) + { + $item = array( + $i, + $row->name, + $row->email, + $row->date, + l(str_replace('.', '_', str_replace(' ', '_', strtolower("{$row->id}_{$row->name}"))) . '.pdf', "uploads/resumes/{$row->id}/{$row->resume}", array( + "attributes" => array( + "target" => "_blank" + ) + )) + ); + if ($row->selected) + { + $check = ""; + } //$row->selected + else + { + $check = ""; + } + array_push($item, $check); + array_push($rows, $item); + $i++; + } //$result as $row + $job = db_select("job_portal_positions")->fields("job_portal_positions")->condition("id", $position_id)->condition("display", 1)->execute()->fetchObject(); + $markup .= l("<< Back to the list of open positions", "jobs/view-applications-if32ggxV747"); + $markup .= "
"; + $markup .= l("Download all applications", "jobs/downloads_all_applications/{$position_id}"); + $markup .= "
"; + $markup .= l("Download selected applications", "jobs/downloads_selected_applications/{$position_id}", array( + "attributes" => array( + "id" => "d_app" + ) + )); + $markup .= "
"; + $markup .= l("Download applications data in document", "jobs/downloads_all_applications_doc/{$position_id}", array( + "attributes" => array( + "id" => "d_aaps" + ) + )); + $markup .= "
"; + $markup .= l("Download applications data in spreadsheet", "jobs/downloads_all_applications_spreadsheet/{$position_id}", array( + "attributes" => array( + "id" => "d_aaps" + ) + )); + $markup .= "
"; + $markup .= "
{$job->position} ({$job->specialization}) - List of applications
"; + $markup .= bootstrap_table($headers, $rows); + $markup .= l("Save Selections", "jobs/view-applications-if32ggxV747/", array( + "query" => array( + "saved" => "true" + ), + "attributes" => array( + "class" => "btn btn-primary" + ) + )); + } //$position_id + 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", 0, '<>')->condition("display", 1)->execute()->fetchAll(); + $headers = array( + "#", + "Position", + "Time", + "Action" ); - return $output; + $rows = array(); + $i = 1; + foreach ($result as $row) + { + $item = array( + $i, + "{$row->position} [ {$row->project} ]", + $row->time, + l("View applications", "jobs/view-applications-if32ggxV747/{$row->id}") + ); + array_push($rows, $item); + $i++; + } //$result as $row + $markup .= "
List of job openings
"; + $markup .= bootstrap_table($headers, $rows); + } + $output = array( + "positions_list" => array( + "#prefix" => "
", + "#markup" => $markup, + "#suffix" => "
" + ) + ); + return $output; } - +/* job portal application download page */ function job_portal_downloads_applications_page($position_id) { - - if ($position_id) { - $result = db_select("job_portal_applications")->fields("job_portal_applications")->condition("position_id", $position_id)->condition("selected", 1)->condition("display", 1)->execute()->fetchAll(); - - $i = 1; - $rows = array(); - $dt = new DateTime(); - $current_date = $dt->format("Y-m-d"); - foreach ($result as $row) { - $job = db_select("job_portal_positions")->fields("job_portal_positions")->condition("id", $position_id)->execute()->fetchObject(); - $base_path = $_SERVER['DOCUMENT_ROOT'] . base_path(); - $downloads_dir = "uploads/resumes/{$row->id}/{$row->resume}"; - $files = $downloads_dir; - $zipname = str_replace(' ', '_', strtolower($job->project . '_' . $job->position . '_' . $current_date . '.zip')); - $zip = new ZipArchive; - $zip->open($zipname, ZipArchive::CREATE); - $zip->addFile($files, str_replace('.', '_', str_replace(' ', '_', strtolower("{$row->id} {$row->name}"))) . ".pdf"); - $zip->close(); - $i++; - } //$result as $row - $base_path = $_SERVER['DOCUMENT_ROOT'] . base_path(); - $zipname = str_replace(' ', '_', strtolower($job->project . '_' . $job->position . '_' . $current_date . '.zip')); - - header('Content-Type: application/zip'); - header('Content-disposition: attachment; filename= "' . str_replace(' ', '_', strtolower($job->project . '_' . $job->position . '_' . $current_date . '.zip'))); - header('Content-Length: ' . filesize($zipname)); - readfile($zipname); - unlink($zipname); - } //$position_id + if ($position_id) + { + $result = db_select("job_portal_applications")->fields("job_portal_applications")->condition("position_id", $position_id)->condition("selected", 1)->condition("display", 1)->execute()->fetchAll(); + $i = 1; + $rows = array(); + $dt = new DateTime(); + $current_date = $dt->format("Y-m-d"); + foreach ($result as $row) + { + $job = db_select("job_portal_positions")->fields("job_portal_positions")->condition("id", $position_id)->execute()->fetchObject(); + $base_path = $_SERVER['DOCUMENT_ROOT'] . base_path(); + $downloads_dir = "uploads/resumes/{$row->id}/{$row->resume}"; + $files = $downloads_dir; + $zipname = str_replace(' ', '_', strtolower($job->project . '_' . $job->position . '_' . $current_date . '.zip')); + $zip = new ZipArchive; + $zip->open($zipname, ZipArchive::CREATE); + $zip->addFile($files, str_replace('.', '_', str_replace(' ', '_', strtolower("{$row->id} {$row->name}"))) . ".pdf"); + $zip->close(); + $i++; + } //$result as $row + $base_path = $_SERVER['DOCUMENT_ROOT'] . base_path(); + $zipname = str_replace(' ', '_', strtolower($job->project . '_' . $job->position . '_' . $current_date . '.zip')); + header('Content-Type: application/zip'); + header('Content-disposition: attachment; filename= "' . str_replace(' ', '_', strtolower($job->project . '_' . $job->position . '_' . $current_date . '.zip'))); + header('Content-Length: ' . filesize($zipname)); + readfile($zipname); + unlink($zipname); + } //$position_id } - +/* job portal application download all page */ function job_portal_downloads_all_applications_page($position_id) { - - if ($position_id) { - $result = db_select("job_portal_applications")->fields("job_portal_applications")->condition("position_id", $position_id)->condition("display", 1)->execute()->fetchAll(); - $i = 1; - $rows = array(); - $dt = new DateTime(); - $current_date = $dt->format("Y-m-d"); - foreach ($result as $row) { - $job = db_select("job_portal_positions")->fields("job_portal_positions")->condition("id", $position_id)->execute()->fetchObject(); - - $base_path = $_SERVER['DOCUMENT_ROOT'] . base_path(); - $downloads_dir = "uploads/resumes/{$row->id}/{$row->resume}"; - $files = $downloads_dir; - $zipname = str_replace(' ', '_', strtolower($job->project . '_' . $job->position . '_' . $current_date . '.zip')); - $zip = new ZipArchive; - $zip->open($zipname, ZipArchive::CREATE); - $zip->addFile($files, str_replace('.', '_', str_replace(' ', '_', strtolower("{$row->id} {$row->name}"))) . ".pdf"); - $zip->close(); - $i++; - } //$result as $row - - $base_path = $_SERVER['DOCUMENT_ROOT'] . base_path(); - $zipname = str_replace(' ', '_', strtolower($job->project . '_' . $job->position . '_' . $current_date . '.zip')); - - header('Content-Type: application/zip'); - header('Content-disposition: attachment; filename= "' . str_replace(' ', '_', strtolower($job->project . '_' . $job->position . '_' . $current_date . '.zip'))); - header('Content-Length: ' . filesize($zipname)); - readfile($zipname); - unlink($zipname); - } //$position_id + if ($position_id) + { + $result = db_select("job_portal_applications")->fields("job_portal_applications")->condition("position_id", $position_id)->condition("display", 1)->execute()->fetchAll(); + $i = 1; + $rows = array(); + $dt = new DateTime(); + $current_date = $dt->format("Y-m-d"); + foreach ($result as $row) + { + $job = db_select("job_portal_positions")->fields("job_portal_positions")->condition("id", $position_id)->execute()->fetchObject(); + $base_path = $_SERVER['DOCUMENT_ROOT'] . base_path(); + $downloads_dir = "uploads/resumes/{$row->id}/{$row->resume}"; + $files = $downloads_dir; + $zipname = str_replace(' ', '_', strtolower($job->project . '_' . $job->position . '_' . $current_date . '.zip')); + $zip = new ZipArchive; + $zip->open($zipname, ZipArchive::CREATE); + $zip->addFile($files, str_replace('.', '_', str_replace(' ', '_', strtolower("{$row->id} {$row->name}"))) . ".pdf"); + $zip->close(); + $i++; + } //$result as $row + $base_path = $_SERVER['DOCUMENT_ROOT'] . base_path(); + $zipname = str_replace(' ', '_', strtolower($job->project . '_' . $job->position . '_' . $current_date . '.zip')); + header('Content-Type: application/zip'); + header('Content-disposition: attachment; filename= "' . str_replace(' ', '_', strtolower($job->project . '_' . $job->position . '_' . $current_date . '.zip'))); + header('Content-Length: ' . filesize($zipname)); + readfile($zipname); + unlink($zipname); + } //$position_id } - // Download application data in spreadsheet // function job_portal_downloads_all_applications_spreadsheet_page($position_id) { - $dt = new DateTime(); - $current_date = $dt->format("Y-m-d"); - $job = db_select("job_portal_positions")->fields("job_portal_positions")->condition("id", $position_id)->execute()->fetchObject(); - header("Content-Type: application/vnd.ms-excel"); - header("Content-disposition: attachment; filename=" . str_replace(' ', '_', strtolower($job->project . '_' . $job->position . '_' . $current_date . ".xls"))); - echo $job->project . "\t" . $job->position . "\t" . ' ' . "\t" . ' ' . "\t" . ' ' . "\n"; - - echo 'Sr No' . "\t" . 'Name' . "\t" . 'Phone' . "\t" . 'Email' . "\t" . 'Application Date' . "\n"; - - - if ($position_id) { - $result = db_select("job_portal_applications")->fields("job_portal_applications")->condition("position_id", $position_id)->condition("display", 1)->execute()->fetchAll(); - $i = 1; - foreach ($result as $row) { - echo $i . "\t" . ucfirst(strtolower($row->name)) . "\t" . $row->contact . "\t" . $row->email . "\t" . $row->date . "\n"; - - $i++; - } //$result as $row - } //$position_id + $dt = new DateTime(); + $current_date = $dt->format("Y-m-d"); + $job = db_select("job_portal_positions")->fields("job_portal_positions")->condition("id", $position_id)->execute()->fetchObject(); + header("Content-Type: application/vnd.ms-excel"); + header("Content-disposition: attachment; filename=" . str_replace(' ', '_', strtolower($job->project . '_' . $job->position . '_' . $current_date . ".xls"))); + echo $job->project . "\t" . $job->position . "\t" . ' ' . "\t" . ' ' . "\t" . ' ' . "\n"; + echo 'Sr No' . "\t" . 'Name' . "\t" . 'Phone' . "\t" . 'Email' . "\t" . 'Application Date' . "\n"; + if ($position_id) + { + $result = db_select("job_portal_applications")->fields("job_portal_applications")->condition("position_id", $position_id)->condition("display", 1)->execute()->fetchAll(); + $i = 1; + foreach ($result as $row) + { + echo $i . "\t" . ucfirst(strtolower($row->name)) . "\t" . $row->contact . "\t" . $row->email . "\t" . $row->date . "\n"; + $i++; + } //$result as $row + } //$position_id } // Download application data in document // function job_portal_downloads_all_applications_document_page($position_id) { - $dt = new DateTime(); - $current_date = $dt->format("Y-m-d"); - $job = db_select("job_portal_positions")->fields("job_portal_positions")->condition("id", $position_id)->execute()->fetchObject(); - header("Content-Type: application/vnd.ms-word"); - header("Content-disposition: attachment; filename=" . str_replace(' ', '_', strtolower($job->project . '_' . $job->position . '_' . $current_date . ".doc"))); - // echo $job->project . "\t" . $job->position . "\t" . ' ' . "\t" . ' ' . "\t" . ' ' . "\n"; - - echo ''; - // echo ''; - //echo 'Sr No' . "\t" . 'Name' . "\t" . 'Phone' . "\t" . 'Email'. "\t" . 'Application Date' . "\n"; - if ($position_id) { - $result = db_select("job_portal_applications")->fields("job_portal_applications")->condition("position_id", $position_id)->condition("display", 1)->execute()->fetchAll(); - $i = 1; - foreach ($result as $row) { - //$app_date = date("d/m/Y", strtotime($row->date)); - echo ''; - $i++; - } //$result as $row - echo '
Advt date: ' . $job->time . '
Position: ' . $job->position . '
Specialization: ' . $job->position . '
Salary: ' . $job->salary . '
Qualification: ' . $job->qualification . '
Skills: ' . $job->skills . '
Job Responsibilities: ' . $job->skills . '
Location: ' . $job->location . '
Sr NoNamePhoneEmailApplication Date
Sr NoNamePhoneEmailApplication Date
' . $i . '' . ucfirst(strtolower($row->name)) . '' . $row->contact . '' . $row->email . '' . $row->date . '
'; - } //$position_id + $dt = new DateTime(); + $current_date = $dt->format("Y-m-d"); + $job = db_select("job_portal_positions")->fields("job_portal_positions")->condition("id", $position_id)->execute()->fetchObject(); + header("Content-Type: application/vnd.ms-word"); + header("Content-disposition: attachment; filename=" . str_replace(' ', '_', strtolower($job->project . '_' . $job->position . '_' . $current_date . ".doc"))); + // echo $job->project . "\t" . $job->position . "\t" . ' ' . "\t" . ' ' . "\t" . ' ' . "\n"; + echo ''; + // echo ''; + //echo 'Sr No' . "\t" . 'Name' . "\t" . 'Phone' . "\t" . 'Email'. "\t" . 'Application Date' . "\n"; + if ($position_id) + { + $result = db_select("job_portal_applications")->fields("job_portal_applications")->condition("position_id", $position_id)->condition("display", 1)->execute()->fetchAll(); + $i = 1; + foreach ($result as $row) + { + //$app_date = date("d/m/Y", strtotime($row->date)); + echo ''; + $i++; + } //$result as $row + echo '
Advt date: ' . $job->time . '
Position: ' . $job->position . '
Specialization: ' . $job->position . '
Salary: ' . $job->salary . '
Qualification: ' . $job->qualification . '
Skills: ' . $job->skills . '
Job Responsibilities: ' . $job->skills . '
Location: ' . $job->location . '
Sr NoNamePhoneEmailApplication Date
Sr NoNamePhoneEmailApplication Date
' . $i . '' . ucfirst(strtolower($row->name)) . '' . $row->contact . '' . $row->email . '' . $row->date . '
'; + } //$position_id } - +/* job portal ajax fuction */ function job_portal_ajax($item = "", $key = "") { - $data = ""; - if ($item == "shortlist") { - $query = " + $data = ""; + if ($item == "shortlist") + { + $query = " UPDATE job_portal_applications SET selected = !selected WHERE id = :aid "; - $args = array( - ":aid" => $key - ); - db_query($query, $args); - $data = "updated"; - } //$item == "shortlist" - echo $data; - exit(); + $args = array( + ":aid" => $key + ); + db_query($query, $args); + $data = "updated"; + } //$item == "shortlist" + echo $data; + exit(); } - +/* job portal init fuction */ function job_portal_init() { - drupal_add_js("misc/form.js"); - drupal_add_js("misc/collapse.js"); - drupal_add_js(drupal_get_path("module", "job_portal") . '/js/main.js', array( - 'group' => JS_THEME, - 'weight' => 20, - 'every_page' => TRUE, - 'cache' => TRUE, - 'scope' => 'header' - )); - drupal_add_js(drupal_get_path('module', 'job_portal') . '/js/smooth_scroll.js', array( - 'group' => JS_THEME, - 'weight' => 20, - 'every_page' => TRUE, - 'cache' => TRUE, - 'scope' => 'header' - )); + drupal_add_js("misc/form.js"); + drupal_add_js("misc/collapse.js"); + drupal_add_js(drupal_get_path("module", "job_portal") . '/js/main.js', array( + 'group' => JS_THEME, + 'weight' => 20, + 'every_page' => TRUE, + 'cache' => TRUE, + 'scope' => 'header' + )); + /* drupal_add_js( + drupal_get_path('module', 'job_portal') . '/js/smooth_scroll.js', + array( + 'group' => JS_THEME, + 'weight' => 20, + 'every_page' => TRUE, + 'cache' => TRUE, + 'scope' => 'header', + ) + );*/ } - /* helper functions */ function collapser($title = "", $content = "", $description = "", $key = "") { - return " + return "
@@ -617,92 +642,99 @@ function collapser($title = "", $content = "", $description = "", $key = "")
"; } - +/* job portal required * in red function */ function required_star() { - return " *"; + return " *"; } - +/* job portal send mail attachment function */ function send_mail_attachment($from, $to, $cc, $bcc, $subject, $message, $file) { - // $file should include path and filename - $filename = basename($file); - $file_size = filesize($file); - $content = chunk_split(base64_encode(file_get_contents($file))); - $uid = md5(uniqid(time())); - $from = str_replace(array( - "\r", - "\n" - ), '', $from); // to prevent email injection - $header = "From: " . $from . "\r\n" . "Cc: " . $cc . "\r\n" . "Bcc: " . $bcc . "\r\n" . "MIME-Version: 1.0\r\n" . "Content-Type: multipart/mixed; boundary=\"" . $uid . "\"\r\n\r\n" . "This is a multi-part message in MIME format.\r\n" . "--" . $uid . "\r\n" . "Content-type: text/html; charset=UTF-8; format=flowed\r\n" . "Content-Transfer-Encoding: 7bit\r\n\r\n" . $message . "\r\n\r\n" . "--" . $uid . "\r\n" . "Content-Type: application/octet-stream; name=\"" . $filename . "\"\r\n" . "Content-Transfer-Encoding: base64\r\n" . "Content-Disposition: attachment; filename=\"" . $filename . "\"\r\n\r\n" . $content . "\r\n\r\n" . "--" . $uid . "--"; - return mail($to, $subject, "", $header); + // $file should include path and filename + $filename = basename($file); + $file_size = filesize($file); + $content = chunk_split(base64_encode(file_get_contents($file))); + $uid = md5(uniqid(time())); + $from = str_replace(array( + "\r", + "\n" + ), '', $from); // to prevent email injection + $header = "From: " . $from . "\r\n" . "Cc: " . $cc . "\r\n" . "Bcc: " . $bcc . "\r\n" . "MIME-Version: 1.0\r\n" . "Content-Type: multipart/mixed; boundary=\"" . $uid . "\"\r\n\r\n" . "This is a multi-part message in MIME format.\r\n" . "--" . $uid . "\r\n" . "Content-type: text/html; charset=UTF-8; format=flowed\r\n" . "Content-Transfer-Encoding: 7bit\r\n\r\n" . $message . "\r\n\r\n" . "--" . $uid . "\r\n" . "Content-Type: application/octet-stream; name=\"" . $filename . "\"\r\n" . "Content-Transfer-Encoding: base64\r\n" . "Content-Disposition: attachment; filename=\"" . $filename . "\"\r\n\r\n" . $content . "\r\n\r\n" . "--" . $uid . "--"; + return mail($to, $subject, "", $header); } - +/* job portal send get job availabe function */ function get_jobs_available($key = "") { - $result = db_select("job_portal_positions")->fields("job_portal_positions")->condition("status", 1)->orderBy("display_order", "ASC")->execute()->fetchAll(); - if ($key == "options") { - $options = array(); - foreach ($result as $row) { - $options[$row->id] = "{$row->position} ({$row->specialization})"; - } //$result as $row - return $options; - } //$key == "options" - else { - return $result; - } + $result = db_select("job_portal_positions")->fields("job_portal_positions")->condition("status", 1)->orderBy("display_order", "ASC")->execute()->fetchAll(); + if ($key == "options") + { + $options = array(); + foreach ($result as $row) + { + $options[$row->id] = "{$row->position} ({$row->specialization})"; + } //$result as $row + return $options; + } //$key == "options" + else + { + return $result; + } } - +/* job portal bootstrap table function */ function bootstrap_table($headers, $rows) { - $thead = ""; - $tbody = ""; - foreach ($headers as $header) { - $thead .= "{$header}"; - } //$headers as $header - foreach ($rows as $row) { - $tbody .= ""; - foreach ($row as $data) { - $tbody .= "{$data}"; - } //$row as $data - $tbody .= ""; - } //$rows as $row - $table = " + $thead = ""; + $tbody = ""; + foreach ($headers as $header) + { + $thead .= "{$header}"; + } //$headers as $header + foreach ($rows as $row) + { + $tbody .= ""; + foreach ($row as $data) + { + $tbody .= "{$data}"; + } //$row as $data + $tbody .= ""; + } //$rows as $row + $table = " {$thead}{$tbody}
"; - return $table; + return $table; } - /** * Simple wrapper function for drupal_mail() to avoid extraneous code. */ function send_mail($from, $to, $subject, $message) { - $my_module = 'job_portal'; - $my_mail_token = microtime(); - $message = array( - 'id' => $my_module . '_' . $my_mail_token, - 'to' => $to, - 'subject' => $subject, - 'body' => array( - $message - ), - 'headers' => array( - 'From' => $from, - 'Sender' => $from, - 'Return-Path' => $from, - 'Bcc' => 'prashantsinalkar[ at ] gmail [ dot ] com' - ) - ); - $system = drupal_mail_system($my_module, $my_mail_token); - $message = $system->format($message); - if ($system->mail($message)) { - return TRUE; - } //$system->mail($message) - else { - return FALSE; - } + $my_module = 'job_portal'; + $my_mail_token = microtime(); + $message = array( + 'id' => $my_module . '_' . $my_mail_token, + 'to' => $to, + 'subject' => $subject, + 'body' => array( + $message + ), + 'headers' => array( + 'From' => $from, + 'Sender' => $from, + 'Return-Path' => $from, + 'Bcc' => 'prashantsinalkar@gmail.com' + ) + ); + $system = drupal_mail_system($my_module, $my_mail_token); + $message = $system->format($message); + if ($system->mail($message)) + { + return TRUE; + } //$system->mail($message) + else + { + return FALSE; + } } diff --git a/job_portal.module~ b/job_portal.module~ new file mode 100755 index 0000000..cd92865 --- /dev/null +++ b/job_portal.module~ @@ -0,0 +1,740 @@ + "FOSSEE Job Portal", + "page callback" => "job_portal_page", + "access arguments" => array( + "access job_portal" + ), + "type" => MENU_CALLBACK + ); + $items["jobs/apply"] = array( + "title" => "FOSSEE Job Portal - Application Form", + "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( + "manage job_portal" + ), + "type" => MENU_CALLBACK + ); + $items["jobs/view-applications-if32ggxV747"] = array( + "title" => "FOSSEE Job Portal - View Applications", + "page callback" => "job_portal_view_application_page", + "access arguments" => array( + "access job_portal" + ), + "type" => MENU_CALLBACK + ); + $items["jobs/downloads_applications"] = array( + "title" => "Application Download", + "description" => "Applications Download", + "page callback" => "job_portal_downloads_applications_page", + "access arguments" => array( + "access job_portal" + ), + "type" => MENU_CALLBACK + ); + $items["jobs/downloads_all_applications"] = array( + "title" => "Application Download", + "description" => "Applications Download", + "page callback" => "job_portal_downloads_all_applications_page", + "access arguments" => array( + "access job_portal" + ), + "type" => MENU_CALLBACK + ); + $items["jobs/downloads_all_applications_spreadsheet"] = array( + "title" => "Application Download", + "description" => "Applications Data Download", + "page callback" => "job_portal_downloads_all_applications_spreadsheet_page", + "access arguments" => array( + "access job_portal" + ), + "type" => MENU_CALLBACK + ); + $items["jobs/downloads_all_applications_doc"] = array( + "title" => "Application Download", + "description" => "Applications Data Download", + "page callback" => "job_portal_downloads_all_applications_document_page", + "access arguments" => array( + "access job_portal" + ), + "type" => MENU_CALLBACK + ); + $items["jobs/ajax"] = array( + "title" => "Ajax callbacks", + "page callback" => "job_portal_ajax", + "access arguments" => array( + "access job_portal" + ), + "type" => MENU_CALLBACK + ); + return $items; +} +/* hook permission */ +function job_portal_permission() +{ + return array( + "access job_portal" => array( + "title" => t("Access Job Portal"), + "description" => t("Allows users to view job postings.") + ), + "manage job_portal" => array( + "title" => t("Manage Job Portal"), + "description" => t("Allows users to manage job postings.") + ), + "manage download_application" => array( + "title" => t("Manage Download Portal"), + "description" => t("Allows users to download job applications.") + ) + ); +} +/* job portal application form */ +function job_portal_application_form($form, &$form_state, $position_id = 0) +{ + $form = array(); + $form["wrapper"] = array( + "#type" => "fieldset", + "#title" => t("Application form"), + "#collapsible" => TRUE + ); + $form["wrapper"]["position"] = array( + "#type" => "select", + "#title" => t("Job Position"), + "#description" => t("Select the position for which you are applying."), + "#options" => get_jobs_available("options"), + "#empty_option" => t("--- Select a position ---"), + "#default_value" => $position_id, + '#attributes' => array( + 'disabled' => 'disabled' + ), + "#required" => TRUE + ); + $form["wrapper"]["name"] = array( + "#type" => "textfield", + "#title" => t("Name"), + "#description" => t("Please enter your full name."), + "#required" => TRUE, + "#attributes" => array( + 'style' => 'text-transform:uppercase' + ) + ); + $form["wrapper"]["contact"] = array( + "#type" => "textfield", + "#title" => t("Contact Number"), + "#description" => t("Please enter your contact number."), + "#required" => TRUE + ); + $form["wrapper"]["email"] = array( + "#type" => "textfield", + "#title" => t("Email"), + "#description" => t("Please enter your e-mail id."), + "#required" => TRUE + ); + $form["wrapper"]["resume"] = array( + "#type" => "file", + "#title" => t("Resume" . required_star()), + "#description" => t("Please upload your resume [pdf].") + ); + $form["wrapper"]["submit"] = array( + "#type" => "submit", + "#value" => "Submit Application" + ); + return $form; +} +/* job portal application form validate */ +function job_portal_application_form_validate($form, &$form_state) +{ + $file = file_save_upload('resume', array( + // Validate extensions. + 'file_validate_extensions' => array( + 'pdf' + ) + )); + // If the file passed validation: + if ($file) + { + // Move the file into the Drupal file system. + if ($file = file_move($file, 'public://')) + { + // Save the file for use in the submit handler. + $form_state['storage']['resume'] = $file; + } //$file = file_move($file, 'public://') + else + { + form_set_error('resume', t("Failed to write the uploaded file to the site's file folder.")); + } + } //$file + else + { + form_set_error('resume', t('No file was uploaded.')); + } + /* validating email field */ + if (!valid_email_address($form_state["values"]["email"])) + { + form_set_error('email', t('Please enter an valid email address.')); + } //!valid_email_address($form_state["values"]["email"]) +} +/* job portal application form validate */ +function job_portal_application_form_submit($form, &$form_state) +{ + $v = $form_state["values"]; + $resume = $form_state["storage"]["resume"]; + $display = 1; + $dt = new DateTime(); + $current_date = $dt->format("Y-m-d H:i:s"); + $query = " + INSERT INTO job_portal_applications + (name, contact, email, resume, position_id, date, display) + VALUES + (:name, :contact, :email, :resume, :position_id, :current_date, :display) + "; + $args = array( + ":name" => $v["name"], + ":contact" => $v["contact"], + ":email" => $v["email"], + ":resume" => $resume->filename, + ":position_id" => $v["position"], + ":current_date" => $current_date, + ":display" => $display + ); + /* storing the row id in $result */ + $result = db_query($query, $args, array( + 'return' => Database::RETURN_INSERT_ID + )); + /* moving the file to uploads/resumes */ + $base_path = $_SERVER['DOCUMENT_ROOT'] . base_path(); + $uploads_dir = $base_path . "uploads/resumes"; + if (!file_exists($uploads_dir . "/{$result}/")) + { + mkdir($uploads_dir . "/{$result}/", 0755, TRUE); + } //!file_exists($uploads_dir . "/{$result}/") + file_unmanaged_move($resume->uri, $uploads_dir . "/{$result}/{$resume->filename}"); + $emails = db_select("job_portal_positions")->fields("job_portal_positions", array( + "notify" + ))->condition("id", $v["position"])->execute()->fetchObject(); + $emails = $emails->notify; + $position = get_jobs_available("options"); + $position = $position[$v["position"]]; + /* preparing to send mail to the recruiters */ + $from = "jobs@fossee.in"; + $to = "jobs@fossee.in"; + $cc = $emails; + $bcc = "prashantsinalkar@gmail.com"; + $subject = "Job Application - {$position}"; + $message = " +

{$v['name']} has applied for + the post of {$position}.

+ + + + +
Name{$v['name']}
Contact{$v['contact']}
Email{$v['email']}
+

Please check the resume attached to this mail.

+ "; + $file = $uploads_dir . "/{$result}/" . $resume->filename; + $mail_status = send_mail_attachment($from, $to, $cc, $bcc, $subject, $message, $file); + if (!$mail_status) + { + drupal_set_message("An error occurred while sending mail.", "error"); + } //!$mail_status + else + { + drupal_set_message("We have received your application. Thank you!", "status"); + } + /* cleaning up temporary storage */ + file_delete($resume); + unset($form["storage"]["resume"]); + /* sending notification to the applicant */ + $subject = "Application received for {$position}"; + $message = " +Dear {$v['name']}, + +We have received your application for the post of {$position}. +We will get back to you shortly. + +Regards, +FOSSEE Team + "; + send_mail("jobs@fossee.in", $v["email"], $subject, $message); +} +/* job portal page */ +function job_portal_page() +{ + $output = ""; + $quick_links = ""; + $i = 1; + $result = get_jobs_available(); + foreach ($result as $row) + { + $collapser_header = "#{$i} - {$row->project} - Job Details"; + $collapser_content = " + Position: {$row->position}
+ Specialization: {$row->specialization}
+ Salary: {$row->salary}
+ Qualification: {$row->qualification} + Skills: {$row->skills} + Job Responsibilities: {$row->responsibilities} + Location: {$row->location}

+ "; + $collapser_content .= "
"; + $collapser_content .= l(" Apply Now", "jobs/apply/{$row->id}", array( + "attributes" => array( + "class" => "btn btn-success btn-large" + ), + "html" => TRUE + )); + $collapser_content .= "
"; + $output .= collapser($collapser_header, $collapser_content, "", $i); + $quick_links .= "
{$i}
"; + $i++; + } //$result as $row + $output .= "


If your interest is to work on any other FOSS such as Python, OpenFOAM, Osdag, Sandhi, OpenModelica, eSim, Scilab, SBHS, DWSIM, FOSSEE-Netbook, etc, you may email your resumes to jobs[at]fossee[dot]in

The email subject should contain:

+

+

Semester Internships

+ +FOSSEE group at IIT Bombay aims to improve the quality of education with the use of open source software tools such as Scilab, Python, eSim, and Sandhi amongst others. +

+We have semester internships available with the following groups- +

+

    +
  1. Scilab Signal Processing & DSP toolbox
  2. +
  3. Scilab Computer Vision toolbox
  4. +
  5. Scilab Image Processing toolbox
  6. +
  7. Scilab Communication Systems toolbox
  8. +
  9. IoT with RaspberryPi and Arduino
  10. +
+

+We invite coders/testers from any background to participate and contribute to this project as part of FOSSEE semester internship. To know more about the internship requirements, please read- https://goo.gl/OuHa2H. If you have any doubts, please email toolbox[at]scilab[dot]in. +

+"; + $output = array( + "quick_links" => array( + "#prefix" => "" + ), + "job_description" => array( + "#prefix" => "
", + "#markup" => $output, + "#suffix" => "
" + ) + ); + return $output; +} +function job_portal_application_page($position_id = 0) +{ + $application_form = ""; + $form_job = drupal_get_form("job_portal_application_form", $position_id); + $job_form = drupal_get_form("job_portal_application_form"); + if ($position_id) + { + $application_form = drupal_render($form_job); + } //$position_id + else + { + $application_form = drupal_render($job); + } + $output = array( + "application_form" => array( + "#prefix" => "
", + "#markup" => $application_form, + "#suffix" => "
" + ) + ); + return $output; +} +function job_portal_view_application_page($position_id = 0) +{ + $markup = ""; + if (array_key_exists("saved", $_GET)) + { + drupal_set_message("Selections saved successfully.", "success"); + } //array_key_exists("saved", $_GET) + if ($position_id) + { + $result = db_select("job_portal_applications")->fields("job_portal_applications")->condition("position_id", $position_id)->condition("display", 1)->execute()->fetchAll(); + $headers = array( + "#", + "Name", + "Email", + "Date", + "Download", + "Select" + ); + $rows = array(); + $i = 1; + foreach ($result as $row) + { + $item = array( + $i, + $row->name, + $row->email, + $row->date, + l(str_replace('.', '_', str_replace(' ', '_', strtolower("{$row->id}_{$row->name}"))) . '.pdf', "uploads/resumes/{$row->id}/{$row->resume}", array( + "attributes" => array( + "target" => "_blank" + ) + )) + ); + if ($row->selected) + { + $check = ""; + } //$row->selected + else + { + $check = ""; + } + array_push($item, $check); + array_push($rows, $item); + $i++; + } //$result as $row + $job = db_select("job_portal_positions")->fields("job_portal_positions")->condition("id", $position_id)->condition("display", 1)->execute()->fetchObject(); + $markup .= l("<< Back to the list of open positions", "jobs/view-applications-if32ggxV747"); + $markup .= "
"; + $markup .= l("Download all applications", "jobs/downloads_all_applications/{$position_id}"); + $markup .= "
"; + $markup .= l("Download selected applications", "jobs/downloads_selected_applications/{$position_id}", array( + "attributes" => array( + "id" => "d_app" + ) + )); + $markup .= "
"; + $markup .= l("Download applications data in document", "jobs/downloads_all_applications_doc/{$position_id}", array( + "attributes" => array( + "id" => "d_aaps" + ) + )); + $markup .= "
"; + $markup .= l("Download applications data in spreadsheet", "jobs/downloads_all_applications_spreadsheet/{$position_id}", array( + "attributes" => array( + "id" => "d_aaps" + ) + )); + $markup .= "
"; + $markup .= "
{$job->position} ({$job->specialization}) - List of applications
"; + $markup .= bootstrap_table($headers, $rows); + $markup .= l("Save Selections", "jobs/view-applications-if32ggxV747/", array( + "query" => array( + "saved" => "true" + ), + "attributes" => array( + "class" => "btn btn-primary" + ) + )); + } //$position_id + 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", 0, '<>')->condition("display", 1)->execute()->fetchAll(); + $headers = array( + "#", + "Position", + "Time", + "Action" + ); + $rows = array(); + $i = 1; + foreach ($result as $row) + { + $item = array( + $i, + "{$row->position} [ {$row->project} ]", + $row->time, + l("View applications", "jobs/view-applications-if32ggxV747/{$row->id}") + ); + array_push($rows, $item); + $i++; + } //$result as $row + $markup .= "
List of job openings
"; + $markup .= bootstrap_table($headers, $rows); + } + $output = array( + "positions_list" => array( + "#prefix" => "
", + "#markup" => $markup, + "#suffix" => "
" + ) + ); + return $output; +} +/* job portal application download page */ +function job_portal_downloads_applications_page($position_id) +{ + if ($position_id) + { + $result = db_select("job_portal_applications")->fields("job_portal_applications")->condition("position_id", $position_id)->condition("selected", 1)->condition("display", 1)->execute()->fetchAll(); + $i = 1; + $rows = array(); + $dt = new DateTime(); + $current_date = $dt->format("Y-m-d"); + foreach ($result as $row) + { + $job = db_select("job_portal_positions")->fields("job_portal_positions")->condition("id", $position_id)->execute()->fetchObject(); + $base_path = $_SERVER['DOCUMENT_ROOT'] . base_path(); + $downloads_dir = "uploads/resumes/{$row->id}/{$row->resume}"; + $files = $downloads_dir; + $zipname = str_replace(' ', '_', strtolower($job->project . '_' . $job->position . '_' . $current_date . '.zip')); + $zip = new ZipArchive; + $zip->open($zipname, ZipArchive::CREATE); + $zip->addFile($files, str_replace('.', '_', str_replace(' ', '_', strtolower("{$row->id} {$row->name}"))) . ".pdf"); + $zip->close(); + $i++; + } //$result as $row + $base_path = $_SERVER['DOCUMENT_ROOT'] . base_path(); + $zipname = str_replace(' ', '_', strtolower($job->project . '_' . $job->position . '_' . $current_date . '.zip')); + header('Content-Type: application/zip'); + header('Content-disposition: attachment; filename= "' . str_replace(' ', '_', strtolower($job->project . '_' . $job->position . '_' . $current_date . '.zip'))); + header('Content-Length: ' . filesize($zipname)); + readfile($zipname); + unlink($zipname); + } //$position_id +} +/* job portal application download all page */ +function job_portal_downloads_all_applications_page($position_id) +{ + if ($position_id) + { + $result = db_select("job_portal_applications")->fields("job_portal_applications")->condition("position_id", $position_id)->condition("display", 1)->execute()->fetchAll(); + $i = 1; + $rows = array(); + $dt = new DateTime(); + $current_date = $dt->format("Y-m-d"); + foreach ($result as $row) + { + $job = db_select("job_portal_positions")->fields("job_portal_positions")->condition("id", $position_id)->execute()->fetchObject(); + $base_path = $_SERVER['DOCUMENT_ROOT'] . base_path(); + $downloads_dir = "uploads/resumes/{$row->id}/{$row->resume}"; + $files = $downloads_dir; + $zipname = str_replace(' ', '_', strtolower($job->project . '_' . $job->position . '_' . $current_date . '.zip')); + $zip = new ZipArchive; + $zip->open($zipname, ZipArchive::CREATE); + $zip->addFile($files, str_replace('.', '_', str_replace(' ', '_', strtolower("{$row->id} {$row->name}"))) . ".pdf"); + $zip->close(); + $i++; + } //$result as $row + $base_path = $_SERVER['DOCUMENT_ROOT'] . base_path(); + $zipname = str_replace(' ', '_', strtolower($job->project . '_' . $job->position . '_' . $current_date . '.zip')); + header('Content-Type: application/zip'); + header('Content-disposition: attachment; filename= "' . str_replace(' ', '_', strtolower($job->project . '_' . $job->position . '_' . $current_date . '.zip'))); + header('Content-Length: ' . filesize($zipname)); + readfile($zipname); + unlink($zipname); + } //$position_id +} +// Download application data in spreadsheet // +function job_portal_downloads_all_applications_spreadsheet_page($position_id) +{ + $dt = new DateTime(); + $current_date = $dt->format("Y-m-d"); + $job = db_select("job_portal_positions")->fields("job_portal_positions")->condition("id", $position_id)->execute()->fetchObject(); + header("Content-Type: application/vnd.ms-excel"); + header("Content-disposition: attachment; filename=" . str_replace(' ', '_', strtolower($job->project . '_' . $job->position . '_' . $current_date . ".xls"))); + echo $job->project . "\t" . $job->position . "\t" . ' ' . "\t" . ' ' . "\t" . ' ' . "\n"; + echo 'Sr No' . "\t" . 'Name' . "\t" . 'Phone' . "\t" . 'Email' . "\t" . 'Application Date' . "\n"; + if ($position_id) + { + $result = db_select("job_portal_applications")->fields("job_portal_applications")->condition("position_id", $position_id)->condition("display", 1)->execute()->fetchAll(); + $i = 1; + foreach ($result as $row) + { + echo $i . "\t" . ucfirst(strtolower($row->name)) . "\t" . $row->contact . "\t" . $row->email . "\t" . $row->date . "\n"; + $i++; + } //$result as $row + } //$position_id +} +// Download application data in document // +function job_portal_downloads_all_applications_document_page($position_id) +{ + $dt = new DateTime(); + $current_date = $dt->format("Y-m-d"); + $job = db_select("job_portal_positions")->fields("job_portal_positions")->condition("id", $position_id)->execute()->fetchObject(); + header("Content-Type: application/vnd.ms-word"); + header("Content-disposition: attachment; filename=" . str_replace(' ', '_', strtolower($job->project . '_' . $job->position . '_' . $current_date . ".doc"))); + // echo $job->project . "\t" . $job->position . "\t" . ' ' . "\t" . ' ' . "\t" . ' ' . "\n"; + echo ''; + // echo ''; + //echo 'Sr No' . "\t" . 'Name' . "\t" . 'Phone' . "\t" . 'Email'. "\t" . 'Application Date' . "\n"; + if ($position_id) + { + $result = db_select("job_portal_applications")->fields("job_portal_applications")->condition("position_id", $position_id)->condition("display", 1)->execute()->fetchAll(); + $i = 1; + foreach ($result as $row) + { + //$app_date = date("d/m/Y", strtotime($row->date)); + echo ''; + $i++; + } //$result as $row + echo '
Advt date: ' . $job->time . '
Position: ' . $job->position . '
Specialization: ' . $job->position . '
Salary: ' . $job->salary . '
Qualification: ' . $job->qualification . '
Skills: ' . $job->skills . '
Job Responsibilities: ' . $job->skills . '
Location: ' . $job->location . '
Sr NoNamePhoneEmailApplication Date
Sr NoNamePhoneEmailApplication Date
' . $i . '' . ucfirst(strtolower($row->name)) . '' . $row->contact . '' . $row->email . '' . $row->date . '
'; + } //$position_id +} +/* job portal ajax fuction */ +function job_portal_ajax($item = "", $key = "") +{ + $data = ""; + if ($item == "shortlist") + { + $query = " + UPDATE job_portal_applications + SET selected = !selected + WHERE id = :aid + "; + $args = array( + ":aid" => $key + ); + db_query($query, $args); + $data = "updated"; + } //$item == "shortlist" + echo $data; + exit(); +} +/* job portal init fuction */ +function job_portal_init() +{ + drupal_add_js("misc/form.js"); + drupal_add_js("misc/collapse.js"); + drupal_add_js(drupal_get_path("module", "job_portal") . '/js/main.js', array( + 'group' => JS_THEME, + 'weight' => 20, + 'every_page' => TRUE, + 'cache' => TRUE, + 'scope' => 'header' + )); + /* drupal_add_js( + drupal_get_path('module', 'job_portal') . '/js/smooth_scroll.js', + array( + 'group' => JS_THEME, + 'weight' => 20, + 'every_page' => TRUE, + 'cache' => TRUE, + 'scope' => 'header', + ) + );*/ +} +/* helper functions */ +function collapser($title = "", $content = "", $description = "", $key = "") +{ + return " +
+ + + {$title} + + + +
+
{$description}
+ {$content} +
+
+ "; +} +/* job portal required * in red function */ +function required_star() +{ + return " *"; +} +/* job portal send mail attachment function */ +function send_mail_attachment($from, $to, $cc, $bcc, $subject, $message, $file) +{ + // $file should include path and filename + $filename = basename($file); + $file_size = filesize($file); + $content = chunk_split(base64_encode(file_get_contents($file))); + $uid = md5(uniqid(time())); + $from = str_replace(array( + "\r", + "\n" + ), '', $from); // to prevent email injection + $header = "From: " . $from . "\r\n" . "Cc: " . $cc . "\r\n" . "Bcc: " . $bcc . "\r\n" . "MIME-Version: 1.0\r\n" . "Content-Type: multipart/mixed; boundary=\"" . $uid . "\"\r\n\r\n" . "This is a multi-part message in MIME format.\r\n" . "--" . $uid . "\r\n" . "Content-type: text/html; charset=UTF-8; format=flowed\r\n" . "Content-Transfer-Encoding: 7bit\r\n\r\n" . $message . "\r\n\r\n" . "--" . $uid . "\r\n" . "Content-Type: application/octet-stream; name=\"" . $filename . "\"\r\n" . "Content-Transfer-Encoding: base64\r\n" . "Content-Disposition: attachment; filename=\"" . $filename . "\"\r\n\r\n" . $content . "\r\n\r\n" . "--" . $uid . "--"; + return mail($to, $subject, "", $header); +} +/* job portal send get job availabe function */ +function get_jobs_available($key = "") +{ + $result = db_select("job_portal_positions")->fields("job_portal_positions")->condition("status", 1)->orderBy("display_order", "ASC")->execute()->fetchAll(); + if ($key == "options") + { + $options = array(); + foreach ($result as $row) + { + $options[$row->id] = "{$row->position} ({$row->specialization})"; + } //$result as $row + return $options; + } //$key == "options" + else + { + return $result; + } +} +/* job portal bootstrap table function */ +function bootstrap_table($headers, $rows) +{ + $thead = ""; + $tbody = ""; + foreach ($headers as $header) + { + $thead .= "{$header}"; + } //$headers as $header + foreach ($rows as $row) + { + $tbody .= ""; + foreach ($row as $data) + { + $tbody .= "{$data}"; + } //$row as $data + $tbody .= ""; + } //$rows as $row + $table = " + + {$thead} + {$tbody} +
+ "; + return $table; +} +/** + * Simple wrapper function for drupal_mail() to avoid extraneous code. + */ +function send_mail($from, $to, $subject, $message) +{ + $my_module = 'job_portal'; + $my_mail_token = microtime(); + $message = array( + 'id' => $my_module . '_' . $my_mail_token, + 'to' => $to, + 'subject' => $subject, + 'body' => array( + $message + ), + 'headers' => array( + 'From' => $from, + 'Sender' => $from, + 'Return-Path' => $from, + 'Bcc' => 'prashantsinalkar@gmail.com' + ) + ); + $system = drupal_mail_system($my_module, $my_mail_token); + $message = $system->format($message); + if ($system->mail($message)) + { + return TRUE; + } //$system->mail($message) + else + { + return FALSE; + } +} + diff --git a/js/main.js b/js/main.js index 1f1610d..6e653b0 100755 --- a/js/main.js +++ b/js/main.js @@ -1,27 +1,25 @@ (function ($) { -$(document).ready(function() { - var basePath = Drupal.settings.basePath; - var modPath = basePath + "jobs/"; - - $shortlist = $(".shortlist"); - $shortlist.click(function (e) { - $(".sync-msg").remove(); - $(this).after("Saving..."); - $.ajax({ - url: modPath + "ajax/shortlist/" + $(this).data("aid"), - success: function() { - $(".sync-msg").remove(); - console.log("success"); - } - }); - }); - - $(this).on('click','#d_app',function (e){ - if($shortlist.prop("checked") == false){ - alert("Please select atleast one resume for download"); - e.preventDefault(); - } - console.log('####'); - }); -}); + $(document).ready(function() { + var basePath = Drupal.settings.basePath; + var modPath = basePath + "jobs/"; + $shortlist = $(".shortlist"); + $shortlist.click(function (e) { + $(".sync-msg").remove(); + $(this).after("Saving..."); + $.ajax({ + url: modPath + "ajax/shortlist/" + $(this).data("aid"), + success: function() { + $(".sync-msg").remove(); + console.log("success"); + } + }); + }); + $(this).on('click','#d_app',function (e){ + if($shortlist.prop("checked") == false){ + alert("Please select atleast one resume for download"); + e.preventDefault(); + } + console.log('####'); + }); + }); })(jQuery); diff --git a/js/main.js~ b/js/main.js~ new file mode 100755 index 0000000..18168e7 --- /dev/null +++ b/js/main.js~ @@ -0,0 +1,26 @@ +(function ($) { + $(document).ready(function() { + var basePath = Drupal.settings.basePath; + var modPath = basePath + "jobs/"; + $shortlist = $(".shortlist"); + $shortlist.click(function (e) { + $(".sync-msg").remove(); + $(this).after("Saving..."); + $.ajax({ + url: modPath + "ajax/shortlist/" + $(this).data("aid"), + success: function() { + $(".sync-msg").remove(); + console.log("success"); + } + }); + }); + $(this).on('click','#d_app',function (e){ + if($shortlist.prop("checked") == false){ + alert("Please select atleast one resume for download"); + e.preventDefault(); + } + console.log('####'); + }); + }); +})(jQuery); + diff --git a/js/smooth_scroll.js b/js/smooth_scroll.js index d16dc1a..10e9145 100755 --- a/js/smooth_scroll.js +++ b/js/smooth_scroll.js @@ -1,26 +1,25 @@ (function($) { - $(document).ready(function() { - $('a[href*=#]:not([href=#])').click(function() { - if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') - || location.hostname == this.hostname) { - - var target = $(this.hash); - target = target.length ? target : $('[name=' + this.hash.slice(1) +']'); - if (target.length) { - $('html,body').animate({ - scrollTop: target.offset().top - }, 1000); - return false; - } - } - }); - $(".quick").click(function() { - $(".quick").removeClass("badge-success"); - $(this).addClass("badge-success"); - setTimeout(function() { - $(".quick").removeClass("badge-success"); - }, 4000); - }); - $('.quick').tooltip(); - }); + $(document).ready(function() { + $('a[href*=#]:not([href=#])').click(function() { + if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') + || location.hostname == this.hostname) { + var target = $(this.hash); + target = target.length ? target : $('[name=' + this.hash.slice(1) +']'); + if (target.length) { + $('html,body').animate({ + scrollTop: target.offset().top + }, 1000); + return false; + } + } + }); + $(".quick").click(function() { + $(".quick").removeClass("badge-success"); + $(this).addClass("badge-success"); + setTimeout(function() { + $(".quick").removeClass("badge-success"); + }, 4000); + }); + //$('.quick').tooltip(); + }); })(jQuery); diff --git a/js/smooth_scroll.js~ b/js/smooth_scroll.js~ new file mode 100755 index 0000000..10e9145 --- /dev/null +++ b/js/smooth_scroll.js~ @@ -0,0 +1,25 @@ +(function($) { + $(document).ready(function() { + $('a[href*=#]:not([href=#])').click(function() { + if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') + || location.hostname == this.hostname) { + var target = $(this.hash); + target = target.length ? target : $('[name=' + this.hash.slice(1) +']'); + if (target.length) { + $('html,body').animate({ + scrollTop: target.offset().top + }, 1000); + return false; + } + } + }); + $(".quick").click(function() { + $(".quick").removeClass("badge-success"); + $(this).addClass("badge-success"); + setTimeout(function() { + $(".quick").removeClass("badge-success"); + }, 4000); + }); + //$('.quick').tooltip(); + }); +})(jQuery); -- cgit