echo '<input type="hidden" name="galleryid" value="' . $gallery->module->id . '" />' . "\n";
        $tbl = new stdClass();
        $tbl->head = array("", $strname, $strdescription, $strmodified, $strcreatedby);
        $tbl->width = "100%";
        $tbl->cellpadding = "5";
        $tbl->align = array("right", "left", "left", "center", "center");
        $tbl->wrap = array("", "nowrap", "", "nowrap", "nowrap");
        $tbl->data = array();
        if ($categories = get_records("imagegallery_categories", "galleryid", $gallery->module->id)) {
            foreach ($categories as $category) {
                $row = array();
                $row[] = '<input type="checkbox" name="catid[]" value="' . $category->id . '" />';
                $row[] = $category->id != $gallery->module->defaultcategory ? s($category->name) : '<strong><em>' . s($category->name) . '</em></strong>';
                $row[] = s($category->description);
                $row[] = userdate($category->timemodified, "%x %X");
                $row[] = $gallery->get_user_fullname($category->userid);
                array_push($tbl->data, $row);
            }
        }
        print_table($tbl);
        echo '<table border="0" align="center">';
        echo '<tr><td>';
        echo '<input type="submit" name="add" value="' . get_string('add') . '" />' . "\n";
        echo '</td><td>';
        echo '<input type="submit" name="edit" value="' . get_string('edit') . '" />' . "\n";
        echo '</td><td>';
        echo '<input type="submit" name="delete" value="' . get_string('deleteselected') . '" />' . "\n";
        echo '</td></tr>';
        echo '</table>';
        echo '</form>';
}
     $strconfirmdelete = get_string('confirmimagedelete', 'imagegallery');
     $strdeleteimages = get_string('deleteimages', 'imagegallery');
     print_simple_box_start("center");
     $tbl = new stdClass();
     $tbl->head = array("&nbsp;", get_string('image', 'imagegallery'), get_string('username'));
     $tbl->align = array("right", "left", "left");
     $tbl->width = "100%";
     $tbl->data = array();
     if (!empty($images)) {
         print_heading($strconfirmdelete, 'center', 4);
         foreach ($images as $image) {
             $row = array();
             $row[] = '<input type="checkbox" name="image[]" value="' . $image->id . '" checked="checked" />';
             $popupurl = '/mod/imagegallery/image.php?id=' . $image->id;
             $row[] = link_to_popup_window($popupurl, "image", s($image->name), 400, 500, s($image->name), 'none', true);
             $row[] = $gallery->get_user_fullname($image->userid);
             array_push($tbl->data, $row);
         }
         echo '<form method="post" action="delete.php">' . "\n";
         echo '<input type="hidden" name="id" value="' . s($gallery->cm->id) . '" />' . "\n";
         echo '<input type="hidden" name="sesskey" value="' . s($USER->sesskey) . '" />' . "\n";
         echo '<input type="hidden" name="catid" value="' . s($catid) . '" />' . "\n";
         echo '<input type="hidden" name="action" value="remove" />' . "\n";
         print_table($tbl);
         echo '<div style="text-align: center">';
         echo '<input type="submit" value="' . get_string('ok') . '" />' . "\n";
         echo '<input type="button" name="cancel" value="' . get_string('cancel') . '" onclick="javascript:void(history.back())"  />' . "\n";
         echo '</div></form>';
     }
     print_simple_box_end();
 } else {