Esempio n. 1
0
    print '<input type="submit" class="button" value="'.$langs->trans("Cancel").'" name="cancel">';
    print '</td></tr>';

    print '</table>';

    print '</form>';
}


if ($_GET["id"] > 0 && ! preg_match('/^add/i',$_GET["action"]))
{
    /*
     * Fact bookmark mode or visually edition
     */
    $bookmark=new Bookmark($db);
    $bookmark->fetch($_GET["id"]);


    dol_fiche_head($head, $hselected, $langs->trans("Bookmark"),0,'bookmark');

    if ($_GET["action"] == 'edit')
    {
    	print '<form name="edit" method="POST" action="'.$_SERVER["PHP_SELF"].'" enctype="multipart/form-data">';
    	print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
    	print '<input type="hidden" name="action" value="update">';
    	print '<input type="hidden" name="id" value="'.$bookmark->id.'">';
    	print '<input type="hidden" name="urlsource" value="'.DOL_URL_ROOT.'/bookmarks/fiche.php?id='.$bookmark->id.'">';
    }

    print '<table class="border" width="100%">';
Esempio n. 2
0
if ($action == 'add' || $action == 'addproduct' || $action == 'update') {
    if ($action == 'update') {
        $invertedaction = 'edit';
    } else {
        $invertedaction = 'create';
    }
    $error = 0;
    if (GETPOST("cancel")) {
        if (empty($backtopage)) {
            $backtopage = GETPOST("urlsource") ? GETPOST("urlsource") : (!empty($url) ? $url : DOL_URL_ROOT . '/bookmarks/list.php');
        }
        header("Location: " . $backtopage);
        exit;
    }
    if ($action == 'update') {
        $bookmark->fetch($_POST["id"]);
    }
    // Check if null because user not admin can't set an user and send empty value here.
    if (!empty($userid)) {
        $bookmark->fk_user = $userid;
    }
    $bookmark->title = $title;
    $bookmark->url = $url;
    $bookmark->target = $target;
    $bookmark->position = $position;
    if (!$title) {
        $error++;
        setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->trans("BookmarkTitle")), null, 'errors');
    }
    if (!$url) {
        $error++;
    print '<input class="flat" name="position" size="5" value="' . (isset($_POST["position"]) ? $_POST["position"] : $bookmark->position) . '">';
    print '</td><td class="hideonsmartphone">&nbsp;</td></tr>';
    print '</table><br>';
    print '<div align="center">';
    print '<input type="submit" class="button" value="' . $langs->trans("CreateBookmark") . '" name="create"> &nbsp; ';
    print '<input type="submit" class="button" value="' . $langs->trans("Cancel") . '" name="cancel">';
    print '</div>';
    print '</form>';
    dol_fiche_end();
}
if ($id > 0 && !preg_match('/^add/i', $action)) {
    /*
     * Fact bookmark mode or visually edition
     */
    $bookmark = new Bookmark($db);
    $bookmark->fetch($id);
    dol_fiche_head($head, $hselected, $langs->trans("Bookmark"), 0, 'bookmark');
    if ($action == 'edit') {
        print '<form name="edit" method="POST" action="' . $_SERVER["PHP_SELF"] . '" enctype="multipart/form-data">';
        print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
        print '<input type="hidden" name="action" value="update">';
        print '<input type="hidden" name="id" value="' . $bookmark->id . '">';
        print '<input type="hidden" name="urlsource" value="' . DOL_URL_ROOT . '/bookmarks/fiche.php?id=' . $bookmark->id . '">';
        print '<input type="hidden" name="backtopage" value="' . $backtopage . '">';
    }
    print '<table class="border" width="100%">';
    print '<tr><td width="25%">' . $langs->trans("Ref") . '</td><td>' . $bookmark->ref . '</td></tr>';
    print '<tr><td>' . $langs->trans("BookmarkTitle") . '</td><td>';
    if ($action == 'edit') {
        print '<input class="flat" name="title" size="30" value="' . (isset($_POST["title"]) ? $_POST["title"] : $bookmark->title) . '">';
    } else {