29require
'../main.inc.php';
30require_once DOL_DOCUMENT_ROOT.
'/recruitment/class/recruitmentjobposition.class.php';
31require_once DOL_DOCUMENT_ROOT.
'/recruitment/class/recruitmentcandidature.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
43$langs->loadLangs(array(
"recruitment",
"boxes"));
45$action =
GETPOST(
'action',
'aZ09');
52if (!empty($user->socid) && $user->socid > 0) {
54 $socid = $user->socid;
63restrictedArea($user,
'recruitment', 0,
'recruitment_recruitmentjobposition',
'recruitmentjobposition',
'',
'rowid');
82llxHeader(
"", $langs->trans(
"RecruitmentArea"));
84print
load_fiche_titre($langs->trans(
"RecruitmentArea"),
'',
'object_recruitmentjobposition');
86print
'<div class="fichecenter"><div class="fichethirdleft">';
93if (
$conf->use_javascript_ajax) {
94 $sql =
"SELECT COUNT(t.rowid) as nb, status";
95 $sql .=
" FROM ".MAIN_DB_PREFIX.
"recruitment_recruitmentjobposition as t";
96 $sql .=
" GROUP BY t.status";
97 $sql .=
" ORDER BY t.status ASC";
98 $resql = $db->query($sql);
101 $num = $db->num_rows($resql);
105 $dataseries = array();
106 $colorseries = array();
109 include DOL_DOCUMENT_ROOT.
'/theme/'.
$conf->theme.
'/theme_vars.inc.php';
112 $obj = $db->fetch_object($resql);
114 $vals[$obj->status] = $obj->nb;
116 $totalnb += $obj->nb;
122 print
'<div class="div-table-responsive-no-min">';
123 print
'<table class="noborder nohover centpercent">';
124 print
'<tr class="liste_titre"><th colspan="2">'.$langs->trans(
"Statistics").
' - '.$langs->trans(
"JobPositions").
'</th></tr>'.
"\n";
125 $listofstatus = array(0, 1, 3, 9);
126 foreach ($listofstatus as $status) {
127 $dataseries[] = array(
dol_html_entity_decode($staticrecruitmentjobposition->LibStatut($status, 1), ENT_QUOTES | ENT_HTML5), (isset($vals[$status]) ? (
int) $vals[$status] : 0));
129 $colorseries[$status] =
'-'.$badgeStatus0;
132 $colorseries[$status] = $badgeStatus4;
135 $colorseries[$status] = $badgeStatus6;
138 $colorseries[$status] = $badgeStatus9;
141 if (empty(
$conf->use_javascript_ajax)) {
142 print
'<tr class="oddeven">';
143 print
'<td>'.$staticrecruitmentjobposition->LibStatut($status, 0).
'</td>';
144 print
'<td class="right"><a href="list.php?statut='.$status.
'">'.(isset($vals[$status]) ? $vals[$status] : 0).
'</a></td>';
148 if (
$conf->use_javascript_ajax) {
149 print
'<tr><td class="center" colspan="2">';
151 include_once DOL_DOCUMENT_ROOT.
'/core/class/dolgraph.class.php';
153 $dolgraph->SetData($dataseries);
154 $dolgraph->SetDataColor(array_values($colorseries));
155 $dolgraph->setShowLegend(2);
156 $dolgraph->setShowPercent(1);
157 $dolgraph->SetType(array(
'pie'));
158 $dolgraph->SetHeight(
'200');
159 $dolgraph->draw(
'idgraphstatus');
160 print $dolgraph->show($totalnb ? 0 : 1);
172 $sql =
"SELECT COUNT(t.rowid) as nb, status";
173 $sql .=
" FROM ".MAIN_DB_PREFIX.
"recruitment_recruitmentcandidature as t";
174 $sql .=
" GROUP BY t.status";
175 $sql .=
" ORDER BY t.status ASC";
176 $resql = $db->query($sql);
179 $num = $db->num_rows($resql);
183 $dataseries = array();
184 $colorseries = array();
187 include DOL_DOCUMENT_ROOT.
'/theme/'.
$conf->theme.
'/theme_vars.inc.php';
190 $obj = $db->fetch_object($resql);
192 $vals[$obj->status] = $obj->nb;
194 $totalnb += $obj->nb;
200 print
'<div class="div-table-responsive-no-min">';
201 print
'<table class="noborder nohover centpercent">';
202 print
'<tr class="liste_titre"><th colspan="2">'.$langs->trans(
"Statistics").
' - '.$langs->trans(
"RecruitmentCandidatures").
'</th></tr>'.
"\n";
203 $listofstatus = array(0, 1, 3, 5, 8, 9);
204 foreach ($listofstatus as $status) {
205 $dataseries[] = array(
dol_html_entity_decode($staticrecruitmentcandidature->LibStatut($status, 1), ENT_QUOTES | ENT_HTML5), (isset($vals[$status]) ? (
int) $vals[$status] : 0));
206 if ($status == RecruitmentCandidature::STATUS_DRAFT) {
207 $colorseries[$status] =
'-'.$badgeStatus0;
209 if ($status == RecruitmentCandidature::STATUS_VALIDATED) {
210 $colorseries[$status] = $badgeStatus1;
212 if ($status == RecruitmentCandidature::STATUS_CONTRACT_PROPOSED) {
213 $colorseries[$status] = $badgeStatus4;
215 if ($status == RecruitmentCandidature::STATUS_CONTRACT_SIGNED) {
216 $colorseries[$status] = $badgeStatus5;
218 if ($status == RecruitmentCandidature::STATUS_REFUSED) {
219 $colorseries[$status] = $badgeStatus9;
221 if ($status == RecruitmentCandidature::STATUS_CANCELED) {
222 $colorseries[$status] = $badgeStatus9;
225 if (empty(
$conf->use_javascript_ajax)) {
226 print
'<tr class="oddeven">';
227 print
'<td>'.$staticrecruitmentcandidature->LibStatut($status, 0).
'</td>';
228 print
'<td class="right"><a href="list.php?statut='.$status.
'">'.(isset($vals[$status]) ? $vals[$status] : 0).
'</a></td>';
232 if (
$conf->use_javascript_ajax) {
233 print
'<tr><td class="center" colspan="2">';
235 include_once DOL_DOCUMENT_ROOT.
'/core/class/dolgraph.class.php';
237 $dolgraph->SetData($dataseries);
238 $dolgraph->SetDataColor(array_values($colorseries));
239 $dolgraph->setShowLegend(2);
240 $dolgraph->setShowPercent(1);
241 $dolgraph->SetType(array(
'pie'));
242 $dolgraph->SetHeight(
'200');
243 $dolgraph->draw(
'idgraphstatuscandidature');
244 print $dolgraph->show($totalnb ? 0 : 1);
339print
'</div><div class="fichetwothirdright">';
343if (isModEnabled(
'recruitment') && $user->hasRight(
'recruitment',
'recruitmentjobposition',
'read')) {
344 $sql =
"SELECT s.rowid, s.ref, s.label, s.date_creation, s.tms, s.status, COUNT(rc.rowid) as nbapplications";
345 $sql .=
" FROM ".MAIN_DB_PREFIX.
"recruitment_recruitmentjobposition as s";
346 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"recruitment_recruitmentcandidature as rc ON rc.fk_recruitmentjobposition = s.rowid";
347 if (isModEnabled(
'societe') && !$user->hasRight(
'societe',
'client',
'voir') && !$socid) {
348 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
350 $sql .=
" WHERE s.entity IN (".getEntity($staticrecruitmentjobposition->element).
")";
351 if (isModEnabled(
'societe') && !$user->hasRight(
'societe',
'client',
'voir') && !$socid) {
352 $sql .=
" AND s.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
355 $sql .=
" AND s.fk_soc = $socid";
357 $sql .=
" GROUP BY s.rowid, s.ref, s.label, s.date_creation, s.tms, s.status";
358 $sql .= $db->order(
's.tms',
'DESC');
359 $sql .= $db->plimit($max, 0);
361 $resql = $db->query($sql);
363 $num = $db->num_rows($resql);
366 print
'<div class="div-table-responsive-no-min">';
367 print
'<table class="noborder centpercent">';
368 print
'<tr class="liste_titre">';
369 print
'<th colspan="2">';
370 print $langs->trans(
"BoxTitleLatestModifiedJobPositions", $max);
372 print
'<th class="right">';
373 print $langs->trans(
"Applications");
375 print
'<th class="right" colspan="2"><a href="'.DOL_URL_ROOT.
'/recruitment/recruitmentjobposition_list.php?sortfield=t.tms&sortorder=DESC">'.$langs->trans(
"FullList").
'</th>';
379 $objp = $db->fetch_object($resql);
380 $staticrecruitmentjobposition->id = $objp->rowid;
381 $staticrecruitmentjobposition->ref = $objp->ref;
382 $staticrecruitmentjobposition->label = $objp->label;
383 $staticrecruitmentjobposition->status = $objp->status;
384 $staticrecruitmentjobposition->date_creation = $objp->date_creation;
386 print
'<tr class="oddeven">';
387 print
'<td class="nowrap">'.$staticrecruitmentjobposition->getNomUrl(1,
'').
'</td>';
388 print
'<td class="right nowrap">';
390 print
'<td class="right">';
391 print $objp->nbapplications;
393 print
'<td class="right nowrap">'.dol_print_date($db->jdate($objp->tms),
'day').
"</td>";
394 print
'<td class="right nowrap" width="16">';
395 print $staticrecruitmentjobposition->getLibStatut(3);
403 print
'<tr class="oddeven"><td colspan="4"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
414if (isModEnabled(
'recruitment') && $user->hasRight(
'recruitment',
'recruitmentjobposition',
'read')) {
415 $sql =
"SELECT rc.rowid, rc.ref, rc.email, rc.lastname, rc.firstname, rc.date_creation, rc.tms, rc.status";
416 $sql .=
" FROM ".MAIN_DB_PREFIX.
"recruitment_recruitmentcandidature as rc";
417 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"recruitment_recruitmentjobposition as s ON rc.fk_recruitmentjobposition = s.rowid";
418 if (isModEnabled(
'societe') && !$user->hasRight(
'societe',
'client',
'voir') && !$socid) {
419 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
421 $sql .=
" WHERE rc.entity IN (".getEntity($staticrecruitmentjobposition->element).
")";
422 if (isModEnabled(
'societe') && !$user->hasRight(
'societe',
'client',
'voir') && !$socid) {
423 $sql .=
" AND s.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
426 $sql .=
" AND s.fk_soc = $socid";
428 $sql .= $db->order(
'rc.tms',
'DESC');
429 $sql .= $db->plimit($max, 0);
431 $resql = $db->query($sql);
433 $num = $db->num_rows($resql);
436 print
'<div class="div-table-responsive-no-min">';
437 print
'<table class="noborder centpercent">';
438 print
'<tr class="liste_titre">';
439 print
'<th colspan="2">';
440 print $langs->trans(
"BoxTitleLatestModifiedCandidatures", $max);
442 print
'<th class="right" colspan="2"><a href="'.DOL_URL_ROOT.
'/recruitment/recruitmentcandidature_list.php?sortfield=t.tms&sortorder=DESC">'.$langs->trans(
"FullList").
'</th>';
446 $objp = $db->fetch_object($resql);
447 $staticrecruitmentcandidature->id = $objp->rowid;
448 $staticrecruitmentcandidature->ref = $objp->ref;
449 $staticrecruitmentcandidature->email = $objp->email;
450 $staticrecruitmentcandidature->status = $objp->status;
451 $staticrecruitmentcandidature->date_creation = $objp->date_creation;
452 $staticrecruitmentcandidature->firstname = $objp->firstname;
453 $staticrecruitmentcandidature->lastname = $objp->lastname;
455 print
'<tr class="oddeven">';
456 print
'<td class="nowrap">'.$staticrecruitmentcandidature->getNomUrl(1,
'').
'</td>';
457 print
'<td class="right nowrap">';
459 print
'<td class="right nowrap">'.dol_print_date($db->jdate($objp->tms),
'day').
"</td>";
460 print
'<td class="right nowrap" width="16">';
461 print $staticrecruitmentcandidature->getLibStatut(3);
469 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.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
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.