Example #1
0
<button type="button" class="btn btn-primary" onClick="popupFormSubmit(\'index.php?m=a&g=core&p=admin_users&a=delete\',$(\'form#popupForm\').serialize());">
Supprimer
</button>
		';
        break;
    case 'delete':
        if (isset($_GET['id'])) {
            $id = $_GET['id'];
        } elseif (isset($_POST['id'])) {
            $id = $_POST['id'];
        } else {
            // TODO ERROR
        }
        $userM = new userManager();
        $userM->delete($id);
        // TODO confirmation
        echo 'L\'utilisateur vient d\'ĂȘtre supprimĂ©!';
        echo '<script type="text/javascript">dataTable.ajax.reload();</script>';
        break;
        // Display the table content
    // Display the table content
    case 'jsonList':
        $dataArray['data'] = array();
        $q0 = get_link()->prepare("SELECT id AS ID,mail AS MAIL, name AS DISPLAYNAME, avatar AS AVATAR FROM " . get_ini('BDD_PREFIX') . "core_users WHERE deleted_date=0 ORDER BY name ASC");
        $q0->execute();
        while ($r0 = $q0->fetch(PDO::FETCH_OBJ)) {
            list($avatarWidth, $avatarHeight) = getNewSizePicture($r0->AVATAR, "48", "48");
            array_push($dataArray['data'], array("ID" => $r0->ID, "MAIL" => $r0->MAIL, "DISPLAYNAME" => $r0->DISPLAYNAME, "AVATAR" => '<img src="' . $r0->AVATAR . '" width="' . $avatarWidth . '" height="' . $avatarHeight . '">', "ACTION" => '<a href="#" data-toggle="modal" data-target="#popup" onClick="insertLoader(\'#popupContent\');setPopupTitle(\'Modifier un utilisateur\');$(\'#popupContent\').load(\'index.php?m=a&g=core&p=admin_users&a=update_form&id=' . $r0->ID . '\');"><span class="iconastic-edit-write"> Modifier </span></a> <a href="#" data-toggle="modal" data-target="#popup" onClick="insertLoader(\'#popupContent\');setPopupTitle(\'Supprimer un utilisateur\');$(\'#popupContent\').load(\'index.php?m=a&g=core&p=admin_users&a=delete_form&id=' . $r0->ID . '\');"><span class="iconastic-minus-line"> Supprimer</span></a>'));
        }
        $q0->closeCursor();