28require
'../main.inc.php';
29require_once DOL_DOCUMENT_ROOT.
'/recruitment/class/recruitmentjobposition.class.php';
30require_once DOL_DOCUMENT_ROOT.
'/recruitment/class/recruitmentcandidature.class.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
34$langs->loadLangs(array(
"recruitment",
"boxes"));
36$action =
GETPOST(
'action',
'aZ09');
41$socid =
GETPOST(
'socid',
'int');
42if (isset($user->socid) && $user->socid > 0) {
44 $socid = $user->socid;
53restrictedArea($user,
'recruitment', 0,
'recruitment_recruitmentjobposition',
'recruitmentjobposition',
'',
'rowid');
72llxHeader(
"", $langs->trans(
"RecruitmentArea"));
74print
load_fiche_titre($langs->trans(
"RecruitmentArea"),
'',
'object_recruitmentjobposition');
76print
'<div class="fichecenter"><div class="fichethirdleft">';
83if ($conf->use_javascript_ajax) {
84 $sql =
"SELECT COUNT(t.rowid) as nb, status";
85 $sql .=
" FROM ".MAIN_DB_PREFIX.
"recruitment_recruitmentjobposition as t";
86 $sql .=
" GROUP BY t.status";
87 $sql .=
" ORDER BY t.status ASC";
88 $resql = $db->query($sql);
91 $num = $db->num_rows($resql);
95 $dataseries = array();
96 $colorseries = array();
99 include DOL_DOCUMENT_ROOT.
'/theme/'.$conf->theme.
'/theme_vars.inc.php';
102 $obj = $db->fetch_object($resql);
104 $vals[$obj->status] = $obj->nb;
106 $totalnb += $obj->nb;
112 print
'<div class="div-table-responsive-no-min">';
113 print
'<table class="noborder nohover centpercent">';
114 print
'<tr class="liste_titre"><th colspan="2">'.$langs->trans(
"Statistics").
' - '.$langs->trans(
"JobPositions").
'</th></tr>'.
"\n";
115 $listofstatus = array(0, 1, 3, 9);
116 foreach ($listofstatus as $status) {
117 $dataseries[] = array(
dol_html_entity_decode($staticrecruitmentjobposition->LibStatut($status, 1), ENT_QUOTES | ENT_HTML5), (isset($vals[$status]) ? (
int) $vals[$status] : 0));
119 $colorseries[$status] =
'-'.$badgeStatus0;
122 $colorseries[$status] = $badgeStatus4;
125 $colorseries[$status] = $badgeStatus6;
128 $colorseries[$status] = $badgeStatus9;
131 if (empty($conf->use_javascript_ajax)) {
132 print
'<tr class="oddeven">';
133 print
'<td>'.$staticrecruitmentjobposition->LibStatut($status, 0).
'</td>';
134 print
'<td class="right"><a href="list.php?statut='.$status.
'">'.(isset($vals[$status]) ? $vals[$status] : 0).
'</a></td>';
138 if ($conf->use_javascript_ajax) {
139 print
'<tr><td class="center" colspan="2">';
141 include_once DOL_DOCUMENT_ROOT.
'/core/class/dolgraph.class.php';
143 $dolgraph->SetData($dataseries);
144 $dolgraph->SetDataColor(array_values($colorseries));
145 $dolgraph->setShowLegend(2);
146 $dolgraph->setShowPercent(1);
147 $dolgraph->SetType(array(
'pie'));
148 $dolgraph->SetHeight(
'200');
149 $dolgraph->draw(
'idgraphstatus');
150 print $dolgraph->show($totalnb ? 0 : 1);
162 $sql =
"SELECT COUNT(t.rowid) as nb, status";
163 $sql .=
" FROM ".MAIN_DB_PREFIX.
"recruitment_recruitmentcandidature as t";
164 $sql .=
" GROUP BY t.status";
165 $sql .=
" ORDER BY t.status ASC";
166 $resql = $db->query($sql);
169 $num = $db->num_rows($resql);
173 $dataseries = array();
174 $colorseries = array();
177 include DOL_DOCUMENT_ROOT.
'/theme/'.$conf->theme.
'/theme_vars.inc.php';
180 $obj = $db->fetch_object($resql);
182 $vals[$obj->status] = $obj->nb;
184 $totalnb += $obj->nb;
190 print
'<div class="div-table-responsive-no-min">';
191 print
'<table class="noborder nohover centpercent">';
192 print
'<tr class="liste_titre"><th colspan="2">'.$langs->trans(
"Statistics").
' - '.$langs->trans(
"RecruitmentCandidatures").
'</th></tr>'.
"\n";
193 $listofstatus = array(0, 1, 3, 5, 8, 9);
194 foreach ($listofstatus as $status) {
195 $dataseries[] = array(
dol_html_entity_decode($staticrecruitmentcandidature->LibStatut($status, 1), ENT_QUOTES | ENT_HTML5), (isset($vals[$status]) ? (
int) $vals[$status] : 0));
196 if ($status == RecruitmentCandidature::STATUS_DRAFT) {
197 $colorseries[$status] =
'-'.$badgeStatus0;
199 if ($status == RecruitmentCandidature::STATUS_VALIDATED) {
200 $colorseries[$status] = $badgeStatus1;
202 if ($status == RecruitmentCandidature::STATUS_CONTRACT_PROPOSED) {
203 $colorseries[$status] = $badgeStatus4;
205 if ($status == RecruitmentCandidature::STATUS_CONTRACT_SIGNED) {
206 $colorseries[$status] = $badgeStatus5;
208 if ($status == RecruitmentCandidature::STATUS_REFUSED) {
209 $colorseries[$status] = $badgeStatus9;
211 if ($status == RecruitmentCandidature::STATUS_CANCELED) {
212 $colorseries[$status] = $badgeStatus9;
215 if (empty($conf->use_javascript_ajax)) {
216 print
'<tr class="oddeven">';
217 print
'<td>'.$staticrecruitmentcandidature->LibStatut($status, 0).
'</td>';
218 print
'<td class="right"><a href="list.php?statut='.$status.
'">'.(isset($vals[$status]) ? $vals[$status] : 0).
'</a></td>';
222 if ($conf->use_javascript_ajax) {
223 print
'<tr><td class="center" colspan="2">';
225 include_once DOL_DOCUMENT_ROOT.
'/core/class/dolgraph.class.php';
227 $dolgraph->SetData($dataseries);
228 $dolgraph->SetDataColor(array_values($colorseries));
229 $dolgraph->setShowLegend(2);
230 $dolgraph->setShowPercent(1);
231 $dolgraph->SetType(array(
'pie'));
232 $dolgraph->SetHeight(
'200');
233 $dolgraph->draw(
'idgraphstatuscandidature');
234 print $dolgraph->show($totalnb ? 0 : 1);
329print
'</div><div class="fichetwothirdright">';
332$NBMAX = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT;
333$max = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT;
336if (isModEnabled(
'recruitment') && $user->hasRight(
'recruitment',
'recruitmentjobposition',
'read')) {
337 $sql =
"SELECT s.rowid, s.ref, s.label, s.date_creation, s.tms, s.status, COUNT(rc.rowid) as nbapplications";
338 $sql .=
" FROM ".MAIN_DB_PREFIX.
"recruitment_recruitmentjobposition as s";
339 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"recruitment_recruitmentcandidature as rc ON rc.fk_recruitmentjobposition = s.rowid";
340 if (isModEnabled(
'societe') && empty($user->rights->societe->client->voir) && !$socid) {
341 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
343 $sql .=
" WHERE s.entity IN (".getEntity($staticrecruitmentjobposition->element).
")";
344 if (isModEnabled(
'societe') && empty($user->rights->societe->client->voir) && !$socid) {
345 $sql .=
" AND s.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
348 $sql .=
" AND s.fk_soc = $socid";
350 $sql .=
" GROUP BY s.rowid, s.ref, s.label, s.date_creation, s.tms, s.status";
351 $sql .= $db->order(
's.tms',
'DESC');
352 $sql .= $db->plimit($max, 0);
354 $resql = $db->query($sql);
356 $num = $db->num_rows($resql);
359 print
'<div class="div-table-responsive-no-min">';
360 print
'<table class="noborder centpercent">';
361 print
'<tr class="liste_titre">';
362 print
'<th colspan="2">';
363 print $langs->trans(
"BoxTitleLatestModifiedJobPositions", $max);
365 print
'<th class="right">';
366 print $langs->trans(
"Applications");
368 print
'<th class="right" colspan="2"><a href="'.DOL_URL_ROOT.
'/recruitment/recruitmentjobposition_list.php?sortfield=t.tms&sortorder=DESC">'.$langs->trans(
"FullList").
'</th>';
372 $objp = $db->fetch_object($resql);
373 $staticrecruitmentjobposition->id = $objp->rowid;
374 $staticrecruitmentjobposition->ref = $objp->ref;
375 $staticrecruitmentjobposition->label = $objp->label;
376 $staticrecruitmentjobposition->status = $objp->status;
377 $staticrecruitmentjobposition->date_creation = $objp->date_creation;
379 print
'<tr class="oddeven">';
380 print
'<td class="nowrap">'.$staticrecruitmentjobposition->getNomUrl(1,
'').
'</td>';
381 print
'<td class="right nowrap">';
383 print
'<td class="right">';
384 print $objp->nbapplications;
386 print
'<td class="right nowrap">'.dol_print_date($db->jdate($objp->tms),
'day').
"</td>";
387 print
'<td class="right nowrap" width="16">';
388 print $staticrecruitmentjobposition->getLibStatut(3);
396 print
'<tr class="oddeven"><td colspan="4" class="opacitymedium">'.$langs->trans(
"None").
'</td></tr>';
407if (isModEnabled(
'recruitment') && $user->hasRight(
'recruitment',
'recruitmentjobposition',
'read')) {
408 $sql =
"SELECT rc.rowid, rc.ref, rc.email, rc.lastname, rc.firstname, rc.date_creation, rc.tms, rc.status";
409 $sql .=
" FROM ".MAIN_DB_PREFIX.
"recruitment_recruitmentcandidature as rc";
410 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"recruitment_recruitmentjobposition as s ON rc.fk_recruitmentjobposition = s.rowid";
411 if (isModEnabled(
'societe') && empty($user->rights->societe->client->voir) && !$socid) {
412 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
414 $sql .=
" WHERE rc.entity IN (".getEntity($staticrecruitmentjobposition->element).
")";
415 if (isModEnabled(
'societe') && empty($user->rights->societe->client->voir) && !$socid) {
416 $sql .=
" AND s.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
419 $sql .=
" AND s.fk_soc = $socid";
421 $sql .= $db->order(
'rc.tms',
'DESC');
422 $sql .= $db->plimit($max, 0);
424 $resql = $db->query($sql);
426 $num = $db->num_rows($resql);
429 print
'<div class="div-table-responsive-no-min">';
430 print
'<table class="noborder centpercent">';
431 print
'<tr class="liste_titre">';
432 print
'<th colspan="2">';
433 print $langs->trans(
"BoxTitleLatestModifiedCandidatures", $max);
435 print
'<th class="right" colspan="2"><a href="'.DOL_URL_ROOT.
'/recruitment/recruitmentcandidature_list.php?sortfield=t.tms&sortorder=DESC">'.$langs->trans(
"FullList").
'</th>';
439 $objp = $db->fetch_object($resql);
440 $staticrecruitmentcandidature->id = $objp->rowid;
441 $staticrecruitmentcandidature->ref = $objp->ref;
442 $staticrecruitmentcandidature->email = $objp->email;
443 $staticrecruitmentcandidature->status = $objp->status;
444 $staticrecruitmentcandidature->date_creation = $objp->date_creation;
445 $staticrecruitmentcandidature->firstname = $objp->firstname;
446 $staticrecruitmentcandidature->lastname = $objp->lastname;
448 print
'<tr class="oddeven">';
449 print
'<td class="nowrap">'.$staticrecruitmentcandidature->getNomUrl(1,
'').
'</td>';
450 print
'<td class="right nowrap">';
452 print
'<td class="right nowrap">'.dol_print_date($db->jdate($objp->tms),
'day').
"</td>";
453 print
'<td class="right nowrap" width="16">';
454 print $staticrecruitmentcandidature->getLibStatut(3);
462 print
'<tr class="oddeven"><td colspan="4" class="opacitymedium">'.$langs->trans(
"None").
'</td></tr>';
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class for RecruitmentCandidature.
Class for RecruitmentJobPosition.
const STATUS_VALIDATED
Validated.
const STATUS_RECRUITED
Recruited.
const STATUS_CANCELED
Canceled.
const STATUS_DRAFT
Draft status.
dol_html_entity_decode($a, $b, $c='UTF-8', $keepsomeentities=0)
Replace html_entity_decode functions to manage errors.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_now($mode='auto')
Return date for now.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.