-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.php
executable file
·189 lines (172 loc) · 7.89 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
<?php
/*
Plugin Name: Job Board
Plugin URI: http://www.osclass.org/
Description: Job Board
Version: 1.4.3
Author: OSClass
Author URI: http://www.osclass.org/
Short Name: jobboard_plugin
Plugin update URI: job-board
*/
define('JOBBOARD_PATH', dirname(__FILE__) . '/');
define('JOBBOARD_VIEWS', JOBBOARD_PATH . 'views/');
require_once(JOBBOARD_PATH . 'model/ModelJB.php');
require_once(JOBBOARD_PATH . 'model/ModelKQ.php');
require_once(JOBBOARD_PATH . 'model/ModelLogJB.php');
require_once(JOBBOARD_PATH . 'model/ApplicantEmails.php');
require_once(JOBBOARD_PATH . 'helpers.php');
require_once(JOBBOARD_PATH . 'class/Stream.class.php');
require_once(JOBBOARD_PATH . 'class/JobboardInstallUpdate.php');
require_once(JOBBOARD_PATH . 'class/JobboardContact.php');
require_once(JOBBOARD_PATH . 'class/JobboardListingActions.php');
require_once(JOBBOARD_PATH . 'class/JobboardEnqueue.php');
// init classes
$jb_contact = new JobboardContact();
$jb_listing_actions = new JobboardListingActions();
$jb_enqueue = new JobboardEnqueue();
if( OC_ADMIN ) {
require_once(JOBBOARD_PATH . 'class/JobboardNotices.class.php');
require_once(JOBBOARD_PATH . 'class/ShareJobOffer.class.php');
require_once(JOBBOARD_PATH . 'class/JobboardManageListings.php');
require_once(JOBBOARD_PATH . 'class/JobboardAdminMenu.php');
require_once(JOBBOARD_PATH . 'class/JobboardCustomTitles.php');
require_once(JOBBOARD_PATH . 'class/JobboardCustomHelp.php');
require_once(JOBBOARD_PATH . 'class/JobboardFooter.class.php');
// init oc-admin classes
$jb_manage_listings = new JobboardManageListings();
$jb_admin_menu = new JobboardAdminMenu();
$jb_custom_title = new JobboardCustomTitles();
$jb_help = new JobboardCustomHelp();
}
/*
* Install - Uninstall - Update plugin ----------------------------------------
*/
osc_register_plugin(osc_plugin_path(__FILE__), array( new JobboardInstallUpdate(), 'job_call_after_install') );
osc_add_hook(osc_plugin_path(__FILE__)."_uninstall", array( new JobboardInstallUpdate(), 'job_call_after_uninstall') );
osc_add_hook('init', array(new JobboardInstallUpdate(), 'jobboard_update_version') );
/* -- install - uninstall - update hooks -- */
/*
* Register js and css scripts ------------------------------------------------
*/
osc_register_script('jquery-rating', osc_plugin_url(__FILE__) . 'assets/lib/rating/jquery.rating.js', 'jquery');
osc_register_script('jquery-metadata', osc_plugin_url(__FILE__) . 'assets/lib/rating/jquery.MetaData.js', 'jquery');
osc_register_script('jobboard-people', osc_plugin_url(__FILE__) . 'assets/js/people.js', array('jquery', 'jquery-validate','jquery-ui'));
osc_register_script('jobboard-killer-form', osc_plugin_url(__FILE__) . 'assets/js/killerForm.js', 'jquery');
osc_register_script('jobboard-manage-killer-form', osc_plugin_url(__FILE__) . 'assets/js/manageKillerForm.js', 'jquery');
osc_register_script('jobboard-people-detail', osc_plugin_url(__FILE__) . 'assets/js/people_detail.js', 'jquery');
osc_register_script('jobboard-dashboard', osc_plugin_url(__FILE__) . 'assets/js/dashboard.js', array('jquery', 'hopscotch'));
osc_register_script('jobboard-apply-linkedin', osc_plugin_url(__FILE__) . 'assets/js/bridgeApplyLinkedin.js', array('jquery'));
osc_register_script('jobboard-show-flashmessage', osc_plugin_url(__FILE__) . 'assets/js/jobboardShowFlashmessage.js', array('jquery'));
osc_register_script('jobboard-init-tinymce', osc_plugin_url(__FILE__) . 'assets/js/init_tinymce.js', array('jquery', 'tiny_mce'));
osc_register_script('jobboard-items', osc_plugin_url(__FILE__) . 'assets/js/items.js', array('jquery'));
osc_register_script('jobboard-item-add', osc_plugin_url(__FILE__) . 'assets/js/item_add.js', array('jquery'));
osc_register_script('jobboard-items', osc_plugin_url(__FILE__) . 'assets/js/items.js', array('jquery'));
osc_register_script('jobboard-admin-page', osc_plugin_url(__FILE__) . 'assets/js/jb_admin.js', 'jquery');
osc_register_script('hopscotch', osc_plugin_url(__FILE__) . 'assets/lib/hopscotch/js/hopscotch-0.1.min.js', array('jquery'));
osc_register_script('tabs', osc_plugin_url(__FILE__) . 'assets/js/tab.js', array('jquery'));
/* -- Register js and css scripts -- */
/*
* ajax binding
*/
require_once(JOBBOARD_PATH . 'class/JobboardAjax.php');
/*
* NO SE EJECUTA !
*/
function jobboard_admin_admin_item_select() {
if(Params::getParam('page')=='items' && Params::getParam('action')=='') { ?>
<script type="text/javascript">
$(document).ready(function(){
$("#bulk_actions option").each(function(){
switch(this.value) {
case 'activate_all':
case 'deactivate_all':
case 'premium_all':
case 'depremium_all':
case 'spam_all':
case 'despam_all':
$(this).remove();
break;
}
});
});
</script>
<?php }
}
osc_add_hook('admin_header','jobboard_admin_item_select');
// ------------------------------
/**
* Unread applicants,
* displatLength on manage applicants
*
*
* @todo to be improved
*/
function jobboard_post_actions() {
switch(urldecode(Params::getParam('file'))) {
case('jobboard/people.php'):
switch(Params::getParam('jb_action')) {
case('unread'):
ModelJB::newInstance()->changeUnread(Params::getParam('applicantID'));
header('Location: ' . osc_admin_render_plugin_url("jobboard/people.php")); exit;
break;
}
// set default iDisplayLength
if( Params::getParam('iDisplayLength') != '' ) {
Cookie::newInstance()->push('applicants_iDisplayLength', Params::getParam('iDisplayLength'));
Cookie::newInstance()->set();
} else {
// set a default value if it's set in the cookie
if( Cookie::newInstance()->get_value('applicants_iDisplayLength') != '' ) {
Params::setParam('iDisplayLength', Cookie::newInstance()->get_value('applicants_iDisplayLength'));
} else {
Params::setParam('iDisplayLength', 10);
}
}
break;
}
}
osc_add_hook('init_admin', 'jobboard_post_actions');
// -----------------------------------------------------------------------------
/**
* Apply with linkedin - document.domain
*
* ONLY UNDER SUBDOMAIN.osclass.com
*/
// get subdomain - linkedin related - osclass.com/apply/
$url = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
$parsedUrl = parse_url($url);
$host = explode('.', $parsedUrl['host']);
$a2 = array_pop($host);
$a1 = array_pop($host);
$subdomain = $a1.".".$a2;
if( $subdomain == 'osclass.com') {
osc_add_hook('init', 'jobboard_set_domain_linkedin');
}
function jobboard_set_domain_linkedin() {
osc_enqueue_script('jobboard-apply-linkedin');
}
// -----------------------------------------------------------------------------
/*
* Corporateboard hook theme
*/
function applicant_admin_menu_current($class) {
if( urldecode(Params::getParam('file')) === 'jobboard/people_detail.php' ) {
return 'current';
}
return $class;
}
osc_add_filter('current_admin_menu_corporateboard', 'applicant_admin_menu_current');
osc_add_hook('add_admin_toolbar_menus', 'osc_admin_toolbar_new_feature');
function osc_admin_toolbar_new_feature() {
$feature = (int) osc_get_preference('new_feature_add_applicant', 'jobboard_plugin');
if( $feature === 0 ) {
AdminToolbar::newInstance()->add_menu( array(
'id' => 'new_features',
'title' => __('Add your applicants manually <sup>new</sup>', 'jobboard'),
'href' => osc_admin_render_plugin_url('jobboard/people.php'),
'meta' => array('class' => 'new-features')
) );
}
}
// End of file