Example #1
0
            $listlo .= "</tr><tbody>";
        }
        $listlo .= "</table>";
        $lo_output .= $listlo;
    }
    else {
        $lo_output .= "<p>There has been no learning outcomes yet</p>";
    }
}
else if ($action == 'editlo') {
    if(isset($_POST['txtname']) || isset($_POST['txtdesc'])) {
        $loUpdate['name'] = $_POST['txtname'];
        $loUpdate['description'] = $_POST['txtdesc'];
        $loUpdate['id'] = $_POST['txtid'];
		$loUpdate['status'] = 1;
        if (!UpdateLO($loUpdate)) {
            $lo_output = 'error occurred';
        }
    }
    if (isset($_GET['id'])) {
        $item_id = $_GET['id'];
    
        $query = "select * from ".db_table_name("cdio3_learningoutcomes")." where id='".db_quote($item_id)."' and status=1";
        $result = db_execute_assoc($query) or safe_die($connect->ErrorMsg());
        
        if ($result->RecordCount() > 0) {
            $row = $result->FetchRow();
            
            $lo_output .= "<div class='header'>Edit Learning Outcomes</div>
            <div class='tab-page'>
            <center>
Example #2
0
{
    if($action == "edit_lo_item") {
        $itemid = returnglobal('itemid');
        $saved = returnglobal('saved');
        
        if (!isset($itemid)) {
            $popupoutput .= "Item not found";
        }
        else {
            //if submit button is hitted
            if (isset($saved) && $saved=="true") {
                $item['name'] = $_POST['txtItemName'];
                $item['id'] = $itemid;
                $item['description'] = $_POST['txtDesc'];
                $item['status'] = '1';
                if (UpdateLO($item))
                    $popupoutput .= "<script type=\"text/javascript\">\n<!--\n alert(\"".$clang->gT("Item has been updated!","js")."\")
                        window.opener.location.reload(); window.close();\n //-->\n</script>\n";
                else 
                    $popupoutput .= "<script type=\"text/javascript\">\n<!--\n alert(\"".$clang->gT("Item updating fail!","js")."\")\n //-->\n</script>\n";
            }
            
            //display the form
            $popupoutput .= genEditLoItemForm($itemid);
        }        
    }
    else if ($action == 'new_lo_item') {
        $root_id = returnglobal('root_id');
        $saved = returnglobal('saved');
        
        //if item exist