Beispiel #1
0
function projectDispatch($op)
{
    switch ($op) {
        case "project":
            project();
            break;
        case "addprj":
            addprj();
            break;
        case "addprj_now":
            if (!isset($_POST["undo"])) {
                addprj_now();
            } else {
                project();
            }
            break;
        case "showprj":
            show_prj();
            break;
        case "manprjadmin":
            manprjadmin();
            break;
        case "update_admins":
            update_admins();
            break;
        case "prjadditem":
            if (isset($_POST["undo"])) {
                Util::jump_to("index.php?modname=project&op=showprj&id=" . $_GET["id"]);
            } else {
                if ($_GET["type"] == "news") {
                    edit_news("new");
                }
                if ($_GET["type"] == "todo") {
                    edit_todo("new");
                }
                if ($_GET["type"] == "task") {
                    edit_tasks("new");
                }
                if ($_GET["type"] == "file") {
                    edit_files("new");
                }
            }
            break;
        case "prjedititem":
            if (isset($_POST["undo"])) {
                Util::jump_to("index.php?modname=project&op=showprj&id=" . $_GET["id"]);
            } else {
                if ($_GET["type"] == "news") {
                    edit_news();
                }
                if ($_GET["type"] == "todo") {
                    edit_todo();
                }
                if ($_GET["type"] == "task") {
                    edit_tasks();
                }
                if ($_GET["type"] == "file") {
                    edit_files();
                }
            }
            break;
        case "prjdelitem":
            del_item();
            break;
        case "prjsendmsg":
            send_msg();
            break;
        case "prjreadmsg":
            read_msg();
            break;
        case "modprj":
            if ($_GET["id"] == 0) {
                sel_prj("modprj");
            } else {
                if (!isset($_POST["undo"])) {
                    mod_prj($_GET["id"]);
                } else {
                    project();
                }
            }
            break;
        case "delprj":
            if ($_GET["id"] == 0) {
                sel_prj("delprj");
            } else {
                del_prj();
            }
            break;
        case "prjreaditem":
            read_item();
            break;
        case "editprogtot":
            edit_progtot();
            break;
        case "download":
            require_once _base_ . '/lib/lib.download.php';
            $id = importVar('id', true, 0);
            $type = importVar('type');
            $can_view = checkPerm('view', true);
            switch ($type) {
                case "file":
                    $query = sql_query("SELECT * FROM " . $GLOBALS["prefix_lms"] . "_prj_msg WHERE pid='{$id}' {$filter} ORDER BY {$oby} {$ord}, id DESC;");
                    list($pid, $fname, $ftitle) = sql_fetch_row(sql_query("\r\n\t\t\t\t\tSELECT pid, fname, ftitle\r\n\t\t\t\t\tFROM " . $GLOBALS["prefix_lms"] . "_prj_files\r\n\t\t\t\t\tWHERE id = '{$id}'"));
                    $myprj = user_projects(Docebo::user()->getIdSt());
                    if ($can_view && in_array($pid, $myprj)) {
                        $expFileName = explode('.', $fname);
                        $totPart = count($expFileName) - 1;
                        sendFile(_FPATH_INTERNAL, $fname, $expFileName[$totPart], $ftitle);
                    } else {
                        die('You can\'t access');
                    }
                    break;
            }
            break;
    }
}
function update_todo($description, $status, $todoId)
{
    return edit_todo($description, $status, $todoId);
}