Example #1
0
        die;
    }
}
require_once 'edit_form.php';
$blogeditform = new blog_edit_form(null, compact('existing', 'sitecontext'));
if ($blogeditform->is_cancelled()) {
    redirect($returnurl);
} else {
    if ($blogeditform->no_submit_button_pressed()) {
        no_submit_button_actions($blogeditform, $sitecontext);
    } else {
        if ($fromform = $blogeditform->get_data()) {
            //save stuff in db
            switch ($action) {
                case 'add':
                    do_add($fromform, $blogeditform);
                    break;
                case 'edit':
                    if (!$existing) {
                        error('Incorrect blog post id');
                    }
                    do_edit($fromform, $blogeditform);
                    break;
                default:
                    error('Unknown action!');
            }
            redirect($returnurl);
        }
    }
}
// gui setup
Example #2
0
 public function add()
 {
     if ($this->require_role('admin')) {
         do_add(FALSE, null);
     }
 }
Example #3
0
<?php

/*
 * Admin/Edit_File.php
 * LHS Math Club Website
 */
require_once '../.lib/functions.php';
restrict_access('A');
if (isset($_GET['Delete'])) {
    do_delete();
} else {
    if (isset($_POST['do_add_file'])) {
        do_add();
    } else {
        if (isset($_POST['do_edit_file'])) {
            do_edit();
        } else {
            if (isset($_GET['Add'])) {
                show_add_page('');
            } else {
                if (isset($_GET['Up'])) {
                    do_up();
                } else {
                    if (isset($_GET['Down'])) {
                        do_down();
                    } else {
                        show_edit_page('');
                    }
                }
            }
        }
    //$existing->fullpath     = $checked_file->fullpath;
    $existing->filename = $checked_file->filename;
    $existing->assignmentid = $assignmentid;
}
$exteditform = new block_exabis_eportfolio_item_edit_form(null, array('existing' => $existing, 'type' => 'file', 'action' => 'edit'));
if ($exteditform->is_cancelled()) {
    redirect($returnurl);
} else {
    if ($exteditform->no_submit_button_pressed()) {
        die("nosubmitbutton");
        //no_submit_button_actions($exteditform, $sitecontext);
    } else {
        if ($fromform = $exteditform->get_data()) {
            switch ($action) {
                case 'add':
                    do_add($fromform, $exteditform, $returnurl, $courseid, $checked_file);
                    break;
                case 'edit':
                    if (!$existing) {
                        print_error("wrongfileid", "block_exabis_eportfolio");
                    }
                    do_edit($fromform, $exteditform, $returnurl, $courseid);
                    break;
                default:
                    print_error("unknownaction", "block_exabis_eportfolio");
            }
            redirect($returnurl);
        }
    }
}
$strAction = "";