Add candidate and employer templates, application form, and new password functionality

- Created 'dla-kandydata.php' template for candidates with job offers and registration options.
- Developed 'dla-pracodawcy.php' template for employers detailing how Globelus works and registration for new employers.
- Implemented 'advert-apply.php' for job applications, including form validation and file upload for CVs.
- Added 'new-password.php' for users to set a new password with validation for password strength and matching.
This commit is contained in:
2025-05-24 11:51:42 +02:00
parent 4fdd906b81
commit 905c0f0d89
59 changed files with 1987 additions and 791 deletions

View File

@@ -230,16 +230,16 @@ class GlobelusAdverts
}
$mdb -> insert( 'globelus_adverts_answers', [
'advert_id' => $advert_id,
'user_id' => $user_id ? $user_id : null,
'name' => $name,
'surname' => $surname,
'email' => $email,
'phone' => $phone,
'text' => $text,
'cv' => $cv,
'cv_extension' => $extension
] );
'advert_id' => $advert_id,
'user_id' => $user_id ? $user_id : null,
'name' => $name,
'surname' => $surname,
'email' => $email,
'phone' => $phone,
'text' => $text,
'cv' => $cv,
'cv_extension' => $extension
] );
if ( $answer_id = $mdb -> id() )
{
@@ -265,8 +265,6 @@ class GlobelusAdverts
if ( $globelus_settings['maile-wysylanie'] )
\S::send_email( self::advert_email( $advert_id ), $lang['aplikacja-na-stanowisko'] . ' ' . $advert_title, $text );
\S::set_alert_prompt( 'Informacja', $lang['aplikacja-na-ogloszenie-zostala-wyslana'] );
if ( !$user_id )
{
\S::set_session( 'advert_answer_name', $name );
@@ -600,7 +598,7 @@ class GlobelusAdverts
{
global $mdb;
return $mdb -> query( 'SELECT '
. 'ga.id, title, ga.user_id, category_id, ga.country_id, ga.city, ga.region, text, contact_person, email, ga.phone, contact_person2, email2, ga.phone2, gfd.clauses, '
. 'ga.id, title, ga.user_id, category_id, ga.country_id, ga.city, ga.region, text, contact_person, email, ga.phone, gfd.clauses, '
. 'gac.name AS category_name, gc.name AS country_name, gfd.firm_name_profile, date_add, salary, work_type, without_language, '
. 'without_experience, for_couples, from_now, accommodation, accommodation_cost, overtime, overtime_quantity, travel_refund, outside_ue, without_driving_license, ga.old, ga.visible, id_voivodeship, aplication_link, id_position '
. 'FROM '

View File

@@ -7,7 +7,7 @@ class GlobelusCron
global $mdb;
// usuń starych proponowanych kandydatów
$mdb -> delete( 'globelus_proposed_candidates', [ 'date_add[<=]' => date( 'Y-m-d', strtotime( '-30 days', time() ) ) ] );
$mdb -> delete( 'globelus_proposed_candidates', [ 'date_add[<=]' => date( 'Y-m-d', strtotime( '-60 days', time() ) ) ] );
// pobierz wszystkie aktywne ogłoszenia z przypisanymi kandydatami i przypisanem krajem
$adverts = $mdb -> query( 'SELECT ga.id, id_position, country_id, title FROM globelus_adverts AS ga WHERE visible = 1 AND id_position IS NOT NULL AND country_id IS NOT NULL AND ( ga.proposed_candidates_date IS NULL OR ga.proposed_candidates_date <= \'' . date( 'Y-m-d H:i:s', strtotime( '-1 days', time() ) ) . '\' ) ORDER BY proposed_candidates_date ASC, id ASC LIMIT 10' ) -> fetchAll( \PDO::FETCH_ASSOC );

View File

@@ -215,6 +215,11 @@ class GlobelusFirms
return $file_name = 'files/img_header/' . $img_header_hash[0] . '/' . $img_header_hash[1] . '/' . $img_header_hash;
}
static public function img_top_url( $user_id ) {
$img_top_hash = \front\factory\GlobelusFirms::img_header_hash( $user_id );
return $file_name = 'files/img_header/' . $img_top_hash[0] . '/' . $img_top_hash[1] . '/' . $img_top_hash;
}
public static function img_bottom_url($user_id)
{
$img_bottom_hash = \front\factory\GlobelusFirms::img_bottom_hash($user_id);
@@ -657,7 +662,7 @@ class GlobelusFirms
]);
}
public static function advert_refresh($advert_id, $user_id)
public static function advert_refresh( $advert_id, $user_id )
{
global $mdb, $globelus_settings;
@@ -943,7 +948,7 @@ class GlobelusFirms
$highlight = $mdb->get('globelus_adverts', 'highlight', ['AND' => ['user_id' => $user_id, 'id' => $advert_id]]);
$main_page = $mdb->get('globelus_adverts', 'main_page', ['AND' => ['user_id' => $user_id, 'id' => $advert_id]]);
if ($globelus_settings['maile-wysylanie'])
if ( $globelus_settings['maile-wysylanie'] )
{
$text = $settings['newsletter_header'];
$text .= \front\factory\Newsletter::get_template('#potwierdzenie-dodania-ogloszenia');
@@ -972,9 +977,9 @@ class GlobelusFirms
'msg' => '<p>Ogłoszenie <b>' . \front\factory\GlobelusAdverts::advert_title($advert_id) . '<\/b> jest już widoczne.</p>'
];
if ($mdb->update('globelus_adverts', ['visible' => 1, 'mail_expired' => 0, 'old' => 0 ], ['AND' => ['user_id' => $user_id, 'id' => $advert_id]]))
if ( $mdb -> update('globelus_adverts', ['visible' => 1, 'mail_expired' => 0 ], ['AND' => ['user_id' => $user_id, 'id' => $advert_id]]))
{
if (\front\factory\GlobelusFirms::adverts_count($user_id) > $globelus_settings['limit-ogloszen'] and \front\factory\GlobelusFirms::get_firm_points($user_id) >= $globelus_settings['pkt-dodanie-ogloszenia-powyzej-limitu'])
if ( \front\factory\GlobelusFirms::adverts_count($user_id) > $globelus_settings['limit-ogloszen'] and \front\factory\GlobelusFirms::get_firm_points($user_id) >= $globelus_settings['pkt-dodanie-ogloszenia-powyzej-limitu'] )
{
$mdb->update('globelus_users', ['points[-]' => $globelus_settings['pkt-dodanie-ogloszenia-powyzej-limitu']], ['id' => $user_id]);
$mdb->insert('globelus_points_history', [
@@ -984,6 +989,11 @@ class GlobelusFirms
]);
}
if ( $mdb -> get( 'globelus_adverts', 'old', [ 'id' => $advert_id ] ) )
{
$mdb->update('globelus_adverts', [ 'old' => 0, 'active_to' => date( 'Y-m-d', strtotime('+' . $globelus_settings['ogloszenie-ilosc-dni-waznosci'] . ' days', time())), 'date_add' => date( 'Y-m-d H:i:s' ) ], [ 'id' => $advert_id ]);
}
return [
'result' => true,
'msg' => '<p>Ogłoszenie <b>' . \front\factory\GlobelusAdverts::advert_title($advert_id) . '<\/b> zostało opublikowane.</p>'
@@ -1044,9 +1054,6 @@ class GlobelusFirms
'contact_person' => $values['contact_person'],
'email' => $values['email'],
'phone' => $values['phone'],
'contact_person2' => $values['contact_person2'],
'email2' => $values['email2'],
'phone2' => $values['phone2'],
'highlight' => 0,
'main_page' => 0,
'active_to' => $globelus_settings['ogloszenie-ilosc-dni-waznosci'] ? date('Y-m-d', strtotime('+' . $globelus_settings['ogloszenie-ilosc-dni-waznosci'] . ' days', time())) : date('Y-m-d', strtotime('+180 days', time())),
@@ -1084,9 +1091,6 @@ class GlobelusFirms
'contact_person' => $values['contact_person'],
'email' => $values['email'],
'phone' => $values['phone'],
'contact_person2' => $values['contact_person2'],
'email2' => $values['email2'],
'phone2' => $values['phone2'],
'salary' => trim(strip_tags($values['salary'])) ? trim(strip_tags($values['salary'])) : null,
'work_type' => $values['work_type'],
'without_language' => $values['without_language'],
@@ -1108,7 +1112,7 @@ class GlobelusFirms
]
]);
if ($mdb->get('globelus_adverts', 'old', ['AND' => ['id' => $values['advert_id'], 'user_id' => $values['user_id']]]))
if ( $mdb ->get('globelus_adverts', 'old', ['AND' => ['id' => $values['advert_id'], 'user_id' => $values['user_id']]]))
{
$mdb->update('globelus_adverts', [
'old' => 0,

View File

@@ -2,6 +2,41 @@
namespace front\factory;
class GlobelusUser
{
static public function email_user_exists( $email )
{
global $mdb;
return $mdb -> count( 'globelus_users', [ 'email' => $email ] );
}
static public function save_new_password( $hash, $password, $password_retype ) {
global $mdb, $lang;
if ( !$hash )
return false;
if ( $password != $password_retype )
return false;
if ( strlen( $password ) < 6 )
return false;
$email = \front\factory\GlobelusUser::get_email_by_hash( $hash );
if ( !$email )
return false;
$register_date = \front\factory\GlobelusUser::get_register_date_by_hash( $hash );
if ( !$register_date )
return false;
$password = md5( $register_date . $password );
if ( $mdb -> update( 'globelus_users', [ 'password' => $password, 'password_recovery' => 0 ], [ 'hash' => $hash ] ) )
return true;
return false;
}
public static function resend_activation_mail( $hash )
{
global $mdb, $settings, $lang;
@@ -117,6 +152,12 @@ class GlobelusUser
return $mdb -> get( 'globelus_users', 'email', [ 'hash' => $hash ] );
}
static public function get_register_date_by_hash( $hash )
{
global $mdb;
return $mdb -> get( 'globelus_users', 'register_date', [ 'hash' => $hash ] );
}
public static function get_hash( $user_id )
{
global $mdb;