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');
43if (isset($user->socid) && $user->socid > 0) {
45 $socid = $user->socid;
54restrictedArea($user,
'recruitment', 0,
'recruitment_recruitmentjobposition',
'recruitmentjobposition',
'',
'rowid');
73llxHeader(
"", $langs->trans(
"RecruitmentArea"));
75print
load_fiche_titre($langs->trans(
"RecruitmentArea"),
'',
'object_recruitmentjobposition');
77print
'<div class="fichecenter"><div class="fichethirdleft">';
84if ($conf->use_javascript_ajax) {
85 $sql =
"SELECT COUNT(t.rowid) as nb, status";
86 $sql .=
" FROM ".MAIN_DB_PREFIX.
"recruitment_recruitmentjobposition as t";
87 $sql .=
" GROUP BY t.status";
88 $sql .=
" ORDER BY t.status ASC";
89 $resql = $db->query($sql);
92 $num = $db->num_rows($resql);
96 $dataseries = array();
97 $colorseries = array();
100 include DOL_DOCUMENT_ROOT.
'/theme/'.$conf->theme.
'/theme_vars.inc.php';
103 $obj = $db->fetch_object($resql);
105 $vals[$obj->status] = $obj->nb;
107 $totalnb += $obj->nb;
113 print
'<div class="div-table-responsive-no-min">';
114 print
'<table class="noborder nohover centpercent">';
115 print
'<tr class="liste_titre"><th colspan="2">'.$langs->trans(
"Statistics").
' - '.$langs->trans(
"JobPositions").
'</th></tr>'.
"\n";
116 $listofstatus = array(0, 1, 3, 9);
117 foreach ($listofstatus as $status) {
118 $dataseries[] = array(
dol_html_entity_decode($staticrecruitmentjobposition->LibStatut($status, 1), ENT_QUOTES | ENT_HTML5), (isset($vals[$status]) ? (
int) $vals[$status] : 0));
120 $colorseries[$status] =
'-'.$badgeStatus0;
123 $colorseries[$status] = $badgeStatus4;
126 $colorseries[$status] = $badgeStatus6;
129 $colorseries[$status] = $badgeStatus9;
132 if (empty($conf->use_javascript_ajax)) {
133 print
'<tr class="oddeven">';
134 print
'<td>'.$staticrecruitmentjobposition->LibStatut($status, 0).
'</td>';
135 print
'<td class="right"><a href="list.php?statut='.$status.
'">'.(isset($vals[$status]) ? $vals[$status] : 0).
'</a></td>';
139 if ($conf->use_javascript_ajax) {
140 print
'<tr><td class="center" colspan="2">';
142 include_once DOL_DOCUMENT_ROOT.
'/core/class/dolgraph.class.php';
144 $dolgraph->SetData($dataseries);
145 $dolgraph->SetDataColor(array_values($colorseries));
146 $dolgraph->setShowLegend(2);
147 $dolgraph->setShowPercent(1);
148 $dolgraph->SetType(array(
'pie'));
149 $dolgraph->SetHeight(
'200');
150 $dolgraph->draw(
'idgraphstatus');
151 print $dolgraph->show($totalnb ? 0 : 1);
163 $sql =
"SELECT COUNT(t.rowid) as nb, status";
164 $sql .=
" FROM ".MAIN_DB_PREFIX.
"recruitment_recruitmentcandidature as t";
165 $sql .=
" GROUP BY t.status";
166 $sql .=
" ORDER BY t.status ASC";
167 $resql = $db->query($sql);
170 $num = $db->num_rows($resql);
174 $dataseries = array();
175 $colorseries = array();
178 include DOL_DOCUMENT_ROOT.
'/theme/'.$conf->theme.
'/theme_vars.inc.php';
181 $obj = $db->fetch_object($resql);
183 $vals[$obj->status] = $obj->nb;
185 $totalnb += $obj->nb;
191 print
'<div class="div-table-responsive-no-min">';
192 print
'<table class="noborder nohover centpercent">';
193 print
'<tr class="liste_titre"><th colspan="2">'.$langs->trans(
"Statistics").
' - '.$langs->trans(
"RecruitmentCandidatures").
'</th></tr>'.
"\n";
194 $listofstatus = array(0, 1, 3, 5, 8, 9);
195 foreach ($listofstatus as $status) {
196 $dataseries[] = array(
dol_html_entity_decode($staticrecruitmentcandidature->LibStatut($status, 1), ENT_QUOTES | ENT_HTML5), (isset($vals[$status]) ? (
int) $vals[$status] : 0));
197 if ($status == RecruitmentCandidature::STATUS_DRAFT) {
198 $colorseries[$status] =
'-'.$badgeStatus0;
200 if ($status == RecruitmentCandidature::STATUS_VALIDATED) {
201 $colorseries[$status] = $badgeStatus1;
203 if ($status == RecruitmentCandidature::STATUS_CONTRACT_PROPOSED) {
204 $colorseries[$status] = $badgeStatus4;
206 if ($status == RecruitmentCandidature::STATUS_CONTRACT_SIGNED) {
207 $colorseries[$status] = $badgeStatus5;
209 if ($status == RecruitmentCandidature::STATUS_REFUSED) {
210 $colorseries[$status] = $badgeStatus9;
212 if ($status == RecruitmentCandidature::STATUS_CANCELED) {
213 $colorseries[$status] = $badgeStatus9;
216 if (empty($conf->use_javascript_ajax)) {
217 print
'<tr class="oddeven">';
218 print
'<td>'.$staticrecruitmentcandidature->LibStatut($status, 0).
'</td>';
219 print
'<td class="right"><a href="list.php?statut='.$status.
'">'.(isset($vals[$status]) ? $vals[$status] : 0).
'</a></td>';
223 if ($conf->use_javascript_ajax) {
224 print
'<tr><td class="center" colspan="2">';
226 include_once DOL_DOCUMENT_ROOT.
'/core/class/dolgraph.class.php';
228 $dolgraph->SetData($dataseries);
229 $dolgraph->SetDataColor(array_values($colorseries));
230 $dolgraph->setShowLegend(2);
231 $dolgraph->setShowPercent(1);
232 $dolgraph->SetType(array(
'pie'));
233 $dolgraph->SetHeight(
'200');
234 $dolgraph->draw(
'idgraphstatuscandidature');
235 print $dolgraph->show($totalnb ? 0 : 1);
330print
'</div><div class="fichetwothirdright">';
334if (isModEnabled(
'recruitment') && $user->hasRight(
'recruitment',
'recruitmentjobposition',
'read')) {
335 $sql =
"SELECT s.rowid, s.ref, s.label, s.date_creation, s.tms, s.status, COUNT(rc.rowid) as nbapplications";
336 $sql .=
" FROM ".MAIN_DB_PREFIX.
"recruitment_recruitmentjobposition as s";
337 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"recruitment_recruitmentcandidature as rc ON rc.fk_recruitmentjobposition = s.rowid";
338 if (isModEnabled(
'societe') && !$user->hasRight(
'societe',
'client',
'voir') && !$socid) {
339 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
341 $sql .=
" WHERE s.entity IN (".getEntity($staticrecruitmentjobposition->element).
")";
342 if (isModEnabled(
'societe') && !$user->hasRight(
'societe',
'client',
'voir') && !$socid) {
343 $sql .=
" AND s.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
346 $sql .=
" AND s.fk_soc = $socid";
348 $sql .=
" GROUP BY s.rowid, s.ref, s.label, s.date_creation, s.tms, s.status";
349 $sql .= $db->order(
's.tms',
'DESC');
350 $sql .= $db->plimit($max, 0);
352 $resql = $db->query($sql);
354 $num = $db->num_rows($resql);
357 print
'<div class="div-table-responsive-no-min">';
358 print
'<table class="noborder centpercent">';
359 print
'<tr class="liste_titre">';
360 print
'<th colspan="2">';
361 print $langs->trans(
"BoxTitleLatestModifiedJobPositions", $max);
363 print
'<th class="right">';
364 print $langs->trans(
"Applications");
366 print
'<th class="right" colspan="2"><a href="'.DOL_URL_ROOT.
'/recruitment/recruitmentjobposition_list.php?sortfield=t.tms&sortorder=DESC">'.$langs->trans(
"FullList").
'</th>';
370 $objp = $db->fetch_object($resql);
371 $staticrecruitmentjobposition->id = $objp->rowid;
372 $staticrecruitmentjobposition->ref = $objp->ref;
373 $staticrecruitmentjobposition->label = $objp->label;
374 $staticrecruitmentjobposition->status = $objp->status;
375 $staticrecruitmentjobposition->date_creation = $objp->date_creation;
377 print
'<tr class="oddeven">';
378 print
'<td class="nowrap">'.$staticrecruitmentjobposition->getNomUrl(1,
'').
'</td>';
379 print
'<td class="right nowrap">';
381 print
'<td class="right">';
382 print $objp->nbapplications;
384 print
'<td class="right nowrap">'.dol_print_date($db->jdate($objp->tms),
'day').
"</td>";
385 print
'<td class="right nowrap" width="16">';
386 print $staticrecruitmentjobposition->getLibStatut(3);
394 print
'<tr class="oddeven"><td colspan="4"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
405if (isModEnabled(
'recruitment') && $user->hasRight(
'recruitment',
'recruitmentjobposition',
'read')) {
406 $sql =
"SELECT rc.rowid, rc.ref, rc.email, rc.lastname, rc.firstname, rc.date_creation, rc.tms, rc.status";
407 $sql .=
" FROM ".MAIN_DB_PREFIX.
"recruitment_recruitmentcandidature as rc";
408 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"recruitment_recruitmentjobposition as s ON rc.fk_recruitmentjobposition = s.rowid";
409 if (isModEnabled(
'societe') && !$user->hasRight(
'societe',
'client',
'voir') && !$socid) {
410 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
412 $sql .=
" WHERE rc.entity IN (".getEntity($staticrecruitmentjobposition->element).
")";
413 if (isModEnabled(
'societe') && !$user->hasRight(
'societe',
'client',
'voir') && !$socid) {
414 $sql .=
" AND s.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
417 $sql .=
" AND s.fk_soc = $socid";
419 $sql .= $db->order(
'rc.tms',
'DESC');
420 $sql .= $db->plimit($max, 0);
422 $resql = $db->query($sql);
424 $num = $db->num_rows($resql);
427 print
'<div class="div-table-responsive-no-min">';
428 print
'<table class="noborder centpercent">';
429 print
'<tr class="liste_titre">';
430 print
'<th colspan="2">';
431 print $langs->trans(
"BoxTitleLatestModifiedCandidatures", $max);
433 print
'<th class="right" colspan="2"><a href="'.DOL_URL_ROOT.
'/recruitment/recruitmentcandidature_list.php?sortfield=t.tms&sortorder=DESC">'.$langs->trans(
"FullList").
'</th>';
437 $objp = $db->fetch_object($resql);
438 $staticrecruitmentcandidature->id = $objp->rowid;
439 $staticrecruitmentcandidature->ref = $objp->ref;
440 $staticrecruitmentcandidature->email = $objp->email;
441 $staticrecruitmentcandidature->status = $objp->status;
442 $staticrecruitmentcandidature->date_creation = $objp->date_creation;
443 $staticrecruitmentcandidature->firstname = $objp->firstname;
444 $staticrecruitmentcandidature->lastname = $objp->lastname;
446 print
'<tr class="oddeven">';
447 print
'<td class="nowrap">'.$staticrecruitmentcandidature->getNomUrl(1,
'').
'</td>';
448 print
'<td class="right nowrap">';
450 print
'<td class="right nowrap">'.dol_print_date($db->jdate($objp->tms),
'day').
"</td>";
451 print
'<td class="right nowrap" width="16">';
452 print $staticrecruitmentcandidature->getLibStatut(3);
460 print
'<tr class="oddeven"><td colspan="4"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
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($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
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.