-
Notifications
You must be signed in to change notification settings - Fork 252
/
getPipelineJobOrder.php
executable file
·334 lines (306 loc) · 17.9 KB
/
getPipelineJobOrder.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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
<?php
/*
* CATS
* AJAX Job Order Pipeline HTML Interface
*
* Copyright (C) 2005 - 2007 Cognizo Technologies, Inc.
*
*
* The contents of this file are subject to the CATS Public License
* Version 1.1a (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.catsone.com/.
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
* License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is "CATS Standard Edition".
*
* The Initial Developer of the Original Code is Cognizo Technologies, Inc.
* Portions created by the Initial Developer are Copyright (C) 2005 - 2007
* (or from the year in which this file was created to the year 2007) by
* Cognizo Technologies, Inc. All Rights Reserved.
*
*
* $Id: getPipelineJobOrder.php 3814 2007-12-06 17:54:28Z brian $
*/
include_once(LEGACY_ROOT . '/lib/Pipelines.php');
include_once(LEGACY_ROOT . '/lib/TemplateUtility.php');
include_once(LEGACY_ROOT . '/lib/StringUtility.php');
include_once(LEGACY_ROOT . '/lib/CATSUtility.php');
include_once(LEGACY_ROOT . '/lib/Hooks.php');
include_once(LEGACY_ROOT . '/lib/JobOrders.php');
$interface = new SecureAJAXInterface();
if (!isset($_REQUEST['joborderID']) ||
!isset($_REQUEST['page']) ||
!isset($_REQUEST['entriesPerPage']) ||
!isset($_REQUEST['sortBy']) ||
!isset($_REQUEST['sortDirection']))
{
$interface->outputXMLErrorPage(-1, 'Invalid input.');
die();
}
$siteID = $interface->getSiteID();
$jobOrderID = trim(htmlspecialchars($_REQUEST['joborderID']));
$page = trim(htmlspecialchars($_REQUEST['page']));
$entriesPerPage = trim(htmlspecialchars($_REQUEST['entriesPerPage']));
$sortBy = trim(htmlspecialchars($_REQUEST['sortBy']));
$sortDirection = trim(htmlspecialchars($_REQUEST['sortDirection']));
$indexFile = trim(htmlspecialchars($_REQUEST['indexFile']));
$isPopup = $_REQUEST['isPopup'] == 1 ? true : false;
$_SESSION['CATS']->setPipelineEntriesPerPage($entriesPerPage);
$jobOrders = new JobOrders($siteID);
$jobOrdersData = $jobOrders->get($jobOrderID);
/* Get an array of the pipeline data. */
$pipelines = new Pipelines($siteID);
$pipelinesRS = $pipelines->getJobOrderPipeline($jobOrderID);
/* Format pipeline data. */
foreach ($pipelinesRS as $rowIndex => $row)
{
if ($row['submitted'] == '1')
{
$pipelinesRS[$rowIndex]['highlightStyle'] = 'jobLinkSubmitted';
}
else if($row['isHotCandidate'] == '1')
{
$pipelinesRS[$rowIndex]['highlightStyle'] = 'jobLinkHot';
}
else
{
$pipelinesRS[$rowIndex]['highlightStyle'] = 'jobLinkCold';
}
$pipelinesRS[$rowIndex]['addedByAbbrName'] = StringUtility::makeInitialName(
$pipelinesRS[$rowIndex]['addedByFirstName'],
$pipelinesRS[$rowIndex]['addedByLastName'],
LAST_NAME_MAXLEN
);
if ($row['attachmentPresent'] == 1)
{
$pipelinesRS[$rowIndex]['iconTag'] = '<img src="images/paperclip.gif" alt="" width="16" height="16" />';
}
else
{
$pipelinesRS[$rowIndex]['iconTag'] = '<img src="images/mru/blank.gif" alt="" width="16" height="16" />';
}
if ($row['isDuplicateCandidate'] == 1)
{
$pipelinesRS[$rowIndex]['iconTag'] .= '<img src="images/wf_error.gif" alt="" width="16" height="16" title="Duplicate Candidate"/>';
}
if($pipelinesRS[$rowIndex]['iconTag'] == '')
{
$pipelinesRS[$rowIndex]['iconTag'] .= ' ';
}
$pipelinesRS[$rowIndex]['ratingLine'] = TemplateUtility::getRatingObject(
$pipelinesRS[$rowIndex]['ratingValue'],
$pipelinesRS[$rowIndex]['candidateJobOrderID'],
$_SESSION['CATS']->getCookie()
);
}
/* Sort the data. */
if ($sortBy !== '' && $sortBy !== 'undefined')
{
$sorting = array();
foreach ($pipelinesRS as $p)
{
$sorting[] = $p[$sortBy];
}
if ($sortBy == 'ratingValue')
{
array_multisort($sorting, $sortDirection == 'desc' ? SORT_DESC : SORT_ASC , SORT_NUMERIC, $pipelinesRS);
}
else
{
array_multisort($sorting, $sortDirection == 'desc' ? SORT_DESC : SORT_ASC , SORT_STRING, $pipelinesRS);
}
}
$minEntry = $entriesPerPage * $page;
$maxEntry = $minEntry + $entriesPerPage;
if ($maxEntry > count($pipelinesRS))
{
$maxEntry = count($pipelinesRS);
}
function printSortLink($field, $delimiter = "'", $changeDirection = true)
{
global $sortBy, $sortDirection;
echo $delimiter, $field, $delimiter, ', ';
if ($changeDirection)
{
if ($sortBy == $field)
{
if ($sortDirection == 'desc' || $sortDirection == '')
{
echo $delimiter, 'asc', $delimiter;
}
else
{
echo $delimiter, 'desc', $delimiter;
}
}
else
{
echo $delimiter, 'asc', $delimiter;
}
}
else
{
if ($sortDirection == 'desc' || $sortDirection == '')
{
echo $delimiter, 'desc', $delimiter;
}
else
{
echo $delimiter, 'asc', $delimiter;
}
}
}
if (!eval(Hooks::get('JO_AJAX_GET_PIPELINE'))) return;
?>
<?php echo(TemplateUtility::getRatingsArrayJS()); ?>
<script type="text/javascript">
PipelineJobOrder_setLimitDefaultVars('<?php echo($sortBy); ?>', '<?php echo($sortDirection); ?>');
var s = '';
s += 'Showing entries <?php echo($minEntry + 1); ?> through <?php echo($maxEntry); ?> of <?php echo(count($pipelinesRS)) ?>: ';
<?php if ($minEntry != 0): ?>
s += ' <a href="javascript:void(0);" onclick="PipelineJobOrder_populate(<?php echo($jobOrderID); ?>, <?php echo($page - 1); ?>, <?php echo($entriesPerPage); ?>, <?php printSortLink($sortBy, "\'", false); ?>, <?php if ($isPopup) echo(1); else echo(0); ?>, \'ajaxPipelineTable\', \'<?php echo($_SESSION['CATS']->getCookie()); ?>\', \'ajaxPipelineTableIndicator\', \'<?php echo($indexFile); ?>\');">< Previous Page</a>';
<?php endif; ?>
<?php if ($maxEntry < count($pipelinesRS)): ?>
s += ' <a href="javascript:void(0);" onclick="PipelineJobOrder_populate(<?php echo($jobOrderID); ?>, <?php echo($page + 1); ?>, <?php echo($entriesPerPage); ?>, <?php printSortLink($sortBy, "\'", false); ?>, <?php if ($isPopup) echo(1); else echo(0); ?>, \'ajaxPipelineTable\', \'<?php echo($_SESSION['CATS']->getCookie()); ?>\', \'ajaxPipelineTableIndicator\', \'<?php echo($indexFile); ?>\');">Next Page ></a>';
<?php endif; ?>
<?php if (count($pipelinesRS) <= 15): ?>
document.getElementById('ajaxPipelineControl').style.display='none';
<?php endif; ?>
document.getElementById('ajaxPipelineNavigation').innerHTML = s;
</script>
<table class="notsortable" id="pipelineTable" width="100%">
<tr>
<th></th>
<th></th>
<th align="left" width="32" nowrap="nowrap"></th>
<th align="left" width="62" nowrap="nowrap">
<a href="javascript:void(0);" onclick="PipelineJobOrder_populate(<?php echo($jobOrderID); ?>, <?php echo($page); ?>, <?php echo($entriesPerPage); ?>, <?php printSortLink('ratingValue'); ?>, <?php if ($isPopup) echo(1); else echo(0); ?>, 'ajaxPipelineTable', '<?php echo($_SESSION['CATS']->getCookie()); ?>', 'ajaxPipelineTableIndicator', '<?php echo($indexFile); ?>');">
Match
</a>
</th>
<th align="left" width="80" nowrap="nowrap">
<a href="javascript:void(0);" onclick="PipelineJobOrder_populate(<?php echo($jobOrderID); ?>, <?php echo($page); ?>, <?php echo($entriesPerPage); ?>, <?php printSortLink('firstName'); ?>, <?php if ($isPopup) echo(1); else echo(0); ?>, 'ajaxPipelineTable', '<?php echo($_SESSION['CATS']->getCookie()); ?>', 'ajaxPipelineTableIndicator', '<?php echo($indexFile); ?>');">
First Name
</a>
</th>
<th align="left" width="100" nowrap="nowrap">
<a href="javascript:void(0);" onclick="PipelineJobOrder_populate(<?php echo($jobOrderID); ?>, <?php echo($page); ?>, <?php echo($entriesPerPage); ?>, <?php printSortLink('lastName'); ?>, <?php if ($isPopup) echo(1); else echo(0); ?>, 'ajaxPipelineTable', '<?php echo($_SESSION['CATS']->getCookie()); ?>', 'ajaxPipelineTableIndicator', '<?php echo($indexFile); ?>');">
Last Name
</a>
</th>
<th align="left" width="40" nowrap="nowrap">
<a href="javascript:void(0);" onclick="PipelineJobOrder_populate(<?php echo($jobOrderID); ?>, <?php echo($page); ?>, <?php echo($entriesPerPage); ?>, <?php printSortLink('state'); ?>, <?php if ($isPopup) echo(1); else echo(0); ?>, 'ajaxPipelineTable', '<?php echo($_SESSION['CATS']->getCookie()); ?>', 'ajaxPipelineTableIndicator', '<?php echo($indexFile); ?>');">
Loc
</a>
</th>
<th align="left" width="60" nowrap="nowrap">
<a href="javascript:void(0);" onclick="PipelineJobOrder_populate(<?php echo($jobOrderID); ?>, <?php echo($page); ?>, <?php echo($entriesPerPage); ?>, <?php printSortLink('dateCreatedInt'); ?>, <?php if ($isPopup) echo(1); else echo(0); ?>, 'ajaxPipelineTable', '<?php echo($_SESSION['CATS']->getCookie()); ?>', 'ajaxPipelineTableIndicator', '<?php echo($indexFile); ?>');">
Added
</a>
</th>
<th align="left" width="70" nowrap="nowrap">
<a href="javascript:void(0);" onclick="PipelineJobOrder_populate(<?php echo($jobOrderID); ?>, <?php echo($page); ?>, <?php echo($entriesPerPage); ?>, <?php printSortLink('addedByAbbrName'); ?>, <?php if ($isPopup) echo(1); else echo(0); ?>, 'ajaxPipelineTable', '<?php echo($_SESSION['CATS']->getCookie()); ?>', 'ajaxPipelineTableIndicator', '<?php echo($indexFile); ?>');">
Entered By
</a>
</th>
<th align="left" width="65" nowrap="nowrap">
<a href="javascript:void(0);" onclick="PipelineJobOrder_populate(<?php echo($jobOrderID); ?>, <?php echo($page); ?>, <?php echo($entriesPerPage); ?>, <?php printSortLink('status'); ?>, <?php if ($isPopup) echo(1); else echo(0); ?>, 'ajaxPipelineTable', '<?php echo($_SESSION['CATS']->getCookie()); ?>', 'ajaxPipelineTableIndicator', '<?php echo($indexFile); ?>');">
Status
</a>
</th>
<th align="left" nowrap="nowrap">
<a href="javascript:void(0);" onclick="PipelineJobOrder_populate(<?php echo($jobOrderID); ?>, <?php echo($page); ?>, <?php echo($entriesPerPage); ?>, <?php printSortLink('lastActivity'); ?>, <?php if ($isPopup) echo(1); else echo(0); ?>, 'ajaxPipelineTable', '<?php echo($_SESSION['CATS']->getCookie()); ?>', 'ajaxPipelineTableIndicator', '<?php echo($indexFile); ?>');">
Last Activity
</a>
</th>
<?php if (!$isPopup): ?>
<th align="center">Action</th>
<?php endif; ?>
</tr>
<?php for ($i = $minEntry; $i < $maxEntry; $i++): ?>
<?php $pipelinesData = $pipelinesRS[$i]; $rowNumber = $i - $minEntry; ?>
<tr class="<?php TemplateUtility::printAlternatingRowClass($rowNumber); ?>" id="pipelineRow<?php echo($rowNumber); ?>">
<td>
<input type="checkbox" id="checked_<?php echo($pipelinesData['candidateID']); ?>" name="checked" value="<?php echo($pipelinesData['candidateID']); ?>"/>
</td>
<td valign="top">
<span id="pipelineEntryOpen<?php echo($rowNumber); ?>">
<a href="javascript:void(0);" onclick="document.getElementById('pipelineDetails<?php echo($rowNumber); ?>').style.display = ''; document.getElementById('pipelineEntryClose<?php echo($rowNumber); ?>').style.display = ''; document.getElementById('pipelineEntryOpen<?php echo($rowNumber); ?>').style.display = 'none'; PipelineDetails_populate(<?php echo($pipelinesData['candidateJobOrderID']); ?>, 'pipelineEntryInner<?php echo($rowNumber); ?>', '<?php echo($_SESSION['CATS']->getCookie()); ?>');">
<img src="images/arrow_next.png" alt="" border="0" title="Show History" />
</a>
</span>
<span id="pipelineEntryClose<?php echo($rowNumber); ?>" style="display: none;">
<a href="javascript:void(0);" onclick="document.getElementById('pipelineDetails<?php echo($rowNumber); ?>').style.display = 'none'; document.getElementById('pipelineEntryClose<?php echo($rowNumber); ?>').style.display = 'none'; document.getElementById('pipelineEntryOpen<?php echo($rowNumber); ?>').style.display = '';">
<img src="images/arrow_down.png" alt="" border="0" title="Hide History"/>
</a>
</span>
</td>
<td valign="top">
<?php echo($pipelinesData['iconTag']); ?>
</td>
<td valign="top">
<?php echo($pipelinesData['ratingLine']); ?>
</td>
<td valign="top">
<a href="<?php echo($indexFile); ?>?m=candidates&a=show&candidateID=<?php echo($pipelinesData['candidateID']); ?>" class="<?php echo($pipelinesData['highlightStyle']); ?>">
<?php echo(htmlspecialchars($pipelinesData['firstName'])); ?>
</a>
</td>
<td valign="top">
<a href="<?php echo($indexFile); ?>?m=candidates&a=show&candidateID=<?php echo($pipelinesData['candidateID']); ?>" class="<?php echo($pipelinesData['highlightStyle']); ?>">
<?php echo(htmlspecialchars($pipelinesData['lastName'])); ?>
</a>
</td>
<td valign="top" nowrap="nowrap"><?php echo(htmlspecialchars($pipelinesData['state'])); ?></td>
<td valign="top" nowrap="nowrap"><?php echo(htmlspecialchars($pipelinesData['dateCreated'])); ?></td>
<td valign="top" nowrap="nowrap"><?php echo(htmlspecialchars($pipelinesData['addedByAbbrName'])); ?></td>
<td valign="top" nowrap="nowrap"><?php echo(htmlspecialchars($pipelinesData['status'])); ?></td>
<td valign="top"><?php echo($pipelinesData['lastActivity']); ?></td>
<?php if (!$isPopup): ?>
<td align="center" nowrap="nowrap">
<?php if ($_SESSION['CATS']->getAccessLevel('pipelines.screening') >= ACCESS_LEVEL_EDIT && !$_SESSION['CATS']->hasUserCategory('sourcer')): ?>
<?php if ($pipelinesData['ratingValue'] < 0): ?>
<a href="#" id="screenLink<?php echo($pipelinesData['candidateJobOrderID']); ?>" onclick="moImageValue<?php echo($pipelinesData['candidateJobOrderID']); ?> = 0; setRating(<?php echo($pipelinesData['candidateJobOrderID']); ?>, 0, 'moImage<?php echo($pipelinesData['candidateJobOrderID']); ?>', '<?php echo($_SESSION['CATS']->getCookie()); ?> '); return false;" >
<img id="screenImage<?php echo($pipelinesData['candidateJobOrderID']); ?>" src="images/actions/screen.gif" width="16" height="16" class="absmiddle" alt="" border="0" title="Mark as Screened"/>
</a>
<?php else: ?>
<img src="images/actions/blank.gif" width="16" height="16" class="absmiddle" alt="" style="border: none;" />
<?php endif; ?>
<?php endif; ?>
<?php if (!isset($frozen)): ?>
<?php if ($_SESSION['CATS']->getAccessLevel('pipelines.addActivityChangeStatus') >= ACCESS_LEVEL_EDIT): ?>
<a href="#" onclick="showPopWin('<?php echo($indexFile); ?>?m=joborders&a=addActivityChangeStatus&jobOrderID=<?php echo($jobOrderID); ?>&candidateID=<?php echo($pipelinesData['candidateID']); ?>', 600, 550, null); return false;">
<img src="images/actions/edit.gif" width="16" height="16" class="absmiddle" alt="" style="border: none;" title="Log an Activity / Change Status" />
</a>
<?php endif; ?>
<?php if ($_SESSION['CATS']->getAccessLevel('pipelines.removeFromPipeline') >= ACCESS_LEVEL_DELETE): ?>
<a href="<?php echo($indexFile); ?>?m=joborders&a=removeFromPipeline&jobOrderID=<?php echo($jobOrderID); ?>&candidateID=<?php echo($pipelinesData['candidateID']); ?>" onclick="javascript:return confirm('Remove <?php echo(str_replace('\'', '\\\'', htmlspecialchars($pipelinesData['firstName']))); ?> <?php echo(str_replace('\'', '\\\'', htmlspecialchars($pipelinesData['lastName']))); ?> from the pipeline?')">
<img src="images/actions/delete.gif" width="16" height="16" class="absmiddle" alt="remove" style="border: none;" title="Remove from Job Order" />
</a>
<?php endif; ?>
<?php endif; ?>
</td>
<?php endif; ?>
</tr>
<tr class="<?php TemplateUtility::printAlternatingRowClass($rowNumber); ?>" id="pipelineDetails<?php echo($rowNumber); ?>" style="display:none;">
<td colspan="11">
<center>
<table width="98%" border=1 class="detailsOutside" style="margin:5px;">
<tr>
<td align="left" style="padding: 6px 6px 6px 6px; background-color: white; clear: both;">
<div style="overflow: auto; height: 200px;" id="pipelineEntryInner<?php echo($rowNumber); ?>">
<img src="images/indicator.gif" alt="" /> Loading pipeline details...
</div>
</td>
</tr>
</table>
</center>
</td>
</tr>
<?php endfor; ?>
</table>