function process_form()
 {
     $reset = optional_param('reset', '', PARAM_TEXT);
     if ($reset) {
         lightboxgallery_image_thumbnail($this->gallery->course, $this->gallery, $this->image);
     } else {
         $move = required_param('move', PARAM_INT);
         $offset = optional_param('offset', 20, PARAM_INT);
         switch ($move) {
             case 1:
                 lightboxgallery_image_thumbnail($this->gallery->course, $this->gallery, $this->image, 0, -$offset);
                 break;
             case 2:
                 lightboxgallery_image_thumbnail($this->gallery->course, $this->gallery, $this->image, 0, $offset);
                 break;
             case 3:
                 lightboxgallery_image_thumbnail($this->gallery->course, $this->gallery, $this->image, -$offset, 0);
                 break;
             case 4:
                 lightboxgallery_image_thumbnail($this->gallery->course, $this->gallery, $this->image, $offset, 0);
                 break;
         }
     }
 }
                         $messages[] = $newfile;
                     }
                 } else {
                     $messages[] = $newfile;
                 }
             }
         } else {
             $messages[] = get_string('zipnonewfiles', 'lightboxgallery');
         }
     } else {
         $messages[] = get_string('errorunzippingfiles', 'error');
     }
 } else {
     if (lightboxgallery_allowed_filetype($filename)) {
         $uploadedimage = new lightboxgallery_edit_image($folder . '/' . $filename);
         $thumb = lightboxgallery_image_thumbnail($course->id, $gallery, $filename, true) . '<br />' . $filename;
         $messages[] = get_string('imageuploaded', 'lightboxgallery', $filename);
         if (isset($formdata->caption) && trim($formdata->caption) != '') {
             lightboxgallery_set_image_caption($gallery->id, $filename, $formdata->caption);
             $messages[] = get_string('edit_caption', 'lightboxgallery') . ': ' . s($formdata->caption, true);
         }
         $resizeoption = 0;
         if (in_array($gallery->autoresize, array(AUTO_RESIZE_UPLOAD, AUTO_RESIZE_BOTH))) {
             $resizeoption = $gallery->resize;
         } else {
             if (isset($formdata->resize)) {
                 $resizeoption = $formdata->resize;
             }
         }
         if ($resizeoption > 0) {
             $resizeoptions = lightboxgallery_resize_options();
if (!file_exists($editinstance->imagepath)) {
    error(get_string('errornofile', 'lightboxgallery'), $galleryurl);
}
if ($editinstance->processing() && confirm_sesskey()) {
    add_to_log($course->id, 'lightboxgallery', 'editimage', 'view.php?id=' . $cm->id, $tab . ' ' . $image, $cm->id, $USER->id);
    $editinstance->process_form();
    redirect($CFG->wwwroot . '/mod/lightboxgallery/imageedit.php?id=' . $gallery->id . '&amp;image=' . $image . '&amp;tab=' . $tab);
}
$table = new object();
$table->width = '*';
if ($editinstance->showthumb) {
    $textlib = textlib_get_instance();
    $imagelabel = $textlib->strlen($image) > MAX_IMAGE_LABEL ? $textlib->substr($image, 0, MAX_IMAGE_LABEL) . '...' : $image;
    $table->align = array('center', 'center');
    $table->size = array('*', '*');
    $table->data[] = array(lightboxgallery_image_thumbnail($course->id, $gallery, $image) . '<br /><span title="' . $image . '">' . $imagelabel . '</span>', $editinstance->output());
} else {
    $table->align = array('center');
    $table->size = array('*');
    $table->data[] = array($editinstance->output());
}
print_table($table);
$dataroot = $CFG->dataroot . '/' . $course->id . '/' . $gallery->folder;
if ($dirimages = lightboxgallery_directory_images($dataroot)) {
    sort($dirimages);
    $options = array();
    foreach ($dirimages as $dirimage) {
        $options[$dirimage] = $dirimage;
    }
    $index = array_search($image, $dirimages);
    echo '<table align="center" class="menubar">
        $imagelocal = $dataroot . '/' . $image;
        $imagelabel = $textlib->strlen($image) > MAX_IMAGE_LABEL ? $textlib->substr($image, 0, MAX_IMAGE_LABEL) . '...' : $image;
        if ($edittypes) {
            $imageextra = '<form action="' . $CFG->wwwroot . '/mod/lightboxgallery/imageedit.php" method="get">' . '<input type="hidden" name="id" value="' . $gallery->id . '" />' . '<input type="hidden" name="image" value="' . $image . '" />' . '<input type="hidden" name="page" value="' . $page . '" />' . '<select name="tab" class="lightbox-edit-select" onchange="submit();">' . '<option>' . get_string('choose') . '...</option>';
            foreach ($edittypes as $editoption => $editdisplay) {
                $imageextra .= '<option value="' . $editoption . '">' . $editdisplay . '</option>';
            }
            $imageextra .= '</select></form>';
        } else {
            if ($gallery->extinfo) {
                $iobj = lightboxgallery_image_info($imagelocal);
                $imageextra = sprintf('<br />%s<br />%s, %dx%d', $iobj->modified, $iobj->filesize, $iobj->imagesize[0], $iobj->imagesize[1]);
            }
        }
        $imagetitle = isset($captions[$image]) ? $captions[$image] : $image;
        echo '<div class="lightboxgalleryimage" style="float:right;padding:7px;"><a href="' . $imageurl . '" rel="lightbox[' . $gallery->name . ']" title="' . $imagetitle . '">' . lightboxgallery_image_thumbnail($course->id, $gallery, $image) . '</a><br />' . $imagelabel . $imageextra . '</div>';
    }
} else {
    print_string('errornoimages', 'lightboxgallery');
}
print_simple_box_end();
if ($gallery->perpage) {
    print_paging_bar(count($allimages), $page, $gallery->perpage, $CFG->wwwroot . '/mod/lightboxgallery/view.php?id=' . $cm->id . '&amp;' . ($editing ? 'editing=1&amp;' : ''));
}
$showtags = !in_array('tag', explode(',', get_config('lightboxgallery', 'disabledplugins')));
if (!$editing && $showtags) {
    $sql = 'SELECT description
                FROM ' . $CFG->prefix . 'lightboxgallery_image_meta
                WHERE gallery = ' . $gallery->id . '
                AND metatype = \'tag\'
                GROUP BY description
        $imagelabel = lightboxgallery_resize_label($image);
        if ($edittypes) {
            $imageextra = '<form action="' . $CFG->wwwroot . '/mod/lightboxgallery/imageedit.php" method="get">' . '<fieldset class="invisiblefieldset">' . '<input type="hidden" name="id" value="' . $gallery->id . '" />' . '<input type="hidden" name="image" value="' . $image . '" />' . '<input type="hidden" name="page" value="' . $page . '" />' . '<select name="tab" class="lightbox-edit-select" onchange="submit();">' . '<option>' . get_string('choose') . '...</option>';
            foreach ($edittypes as $editoption => $editdisplay) {
                $imageextra .= '<option value="' . $editoption . '">' . $editdisplay . '</option>';
            }
            $imageextra .= '</select></fieldset></form>';
        } else {
            if ($gallery->extinfo) {
                $iobj = lightboxgallery_image_info($imagelocal);
                $imageextra = sprintf('<br />%s<br />%s, %dx%d', $iobj->modified, $iobj->filesize, $iobj->imagesize[0], $iobj->imagesize[1]);
            }
        }
        $imagetitle = isset($captions[$image]) ? $captions[$image] : $image;
        echo '<div class="thumb">
                    <div class="image"><a class="overlay" href="' . $imageurl . '?rnd=' . rand(0, 1000) . '" rel="lightbox[gallery-' . $gallery->id . ']" title="' . $imagetitle . '">' . lightboxgallery_image_thumbnail($course->id, $gallery, $image) . '</a></div>
                    ' . $imagelabel . $imageextra . '
                  </div>';
    }
} else {
    print_string('errornoimages', 'lightboxgallery');
}
print_simple_box_end();
if ($gallery->perpage) {
    print_paging_bar(count($allimages), $page, $gallery->perpage, $CFG->wwwroot . '/mod/lightboxgallery/view.php?id=' . $cm->id . '&amp;' . ($editing ? 'editing=1&amp;' : ''));
}
$showtags = !in_array('tag', explode(',', get_config('lightboxgallery', 'disabledplugins')));
if (!$editing && $showtags) {
    $sql = 'SELECT description
                FROM ' . $CFG->prefix . 'lightboxgallery_image_meta
                WHERE gallery = ' . $gallery->id . '
        $imagelabel = $textlib->strlen($image) > MAX_IMAGE_LABEL ? $textlib->substr($image, 0, MAX_IMAGE_LABEL) . '...' : $image;
        if ($edittypes) {
            $imageextra = '<form action="' . $CFG->wwwroot . '/mod/lightboxgallery/imageedit.php" method="get">' . '<input type="hidden" name="id" value="' . $gallery->id . '" />' . '<input type="hidden" name="image" value="' . $image . '" />' . '<input type="hidden" name="page" value="' . $page . '" />' . '<select name="tab" class="lightbox-edit-select" onchange="submit();">' . '<option>' . get_string('choose') . '...</option>';
            foreach ($edittypes as $editoption => $editdisplay) {
                $imageextra .= '<option value="' . $editoption . '">' . $editdisplay . '</option>';
            }
            $imageextra .= '</select></form>';
        } else {
            if ($gallery->extinfo) {
                $iobj = lightboxgallery_image_info($imagelocal);
                $imageextra = sprintf('<br />%s<br />%s, %dx%d', $iobj->modified, $iobj->filesize, $iobj->imagesize[0], $iobj->imagesize[1]);
            }
        }
        $imagetitle = isset($captions[$image]) ? $captions[$image] : $image;
        //echo('<div class="lightboxgalleryimage"><a href="'.$imageurl.'" rel="lightbox['.$gallery->name.']" title="'.$imagetitle.'">'.lightboxgallery_image_thumbnail($course->id, $gallery, $image).'</a><br />'.$imagelabel.$imageextra.'</div>');
        echo '<div class="lightboxgalleryimage"><a href="' . $imageurl . '" rel="lightbox[' . $gallery->name . ']" title="' . $imagetitle . '">' . lightboxgallery_image_thumbnail($course->id, $gallery, $image) . '</a><br />' . $imagetitle . '<br />';
        //
        // Unremark the following code to enable Edit this image button that uses a remote Pixlr.com image editing service
        //
        //echo "<input type=\"button\" name=\"pixlreditor\" title=\"$stredit\" value=\"$stredit\" id=\"pixlreditor\" class=\"linkz buttonz\" ";
        //echo "onclick=\"return window.open('http://www.pixlr.com/editor/?image={$CFG->wwwroot}/sendfile.php/{$course->id}/{$gallery->folder}/{$image}', 'pixlreditor', 'width=1024,height=768,menubar=0,location=0,scrollbars,resizable', 'yes');\" />";
        echo "{$imageextra}</div>";
        // i removed the filenames .$imagelabel.$imageextra.
    }
} else {
    if (empty($action)) {
        print_string('errornoimages', 'lightboxgallery');
    }
}
print_simple_box_end();
if ($gallery->perpage) {
Example #7
0
 $currentgallery = 0;
 foreach ($images as $image) {
     if ($currentgallery != $image->lid) {
         if ($currentgallery > 0) {
             print_simple_box_end();
         }
         $gallery = get_record('lightboxgallery', 'id', $image->lid);
         $dataroot = $CFG->dataroot . '/' . $gallery->course . '/' . $gallery->folder;
         $webroot = lightboxgallery_get_image_url($gallery->id);
         $currentgallery = $gallery->id;
         print_heading('<a href="' . $CFG->wwwroot . '/mod/lightboxgallery/view.php?l=' . $gallery->id . '">' . $gallery->name . '</a>');
         print_simple_box_start('center');
     }
     $imagelabel = lightboxgallery_resize_label($image->image);
     echo '<div class="thumb">
                 <div class="image"><a class="overlay" href="' . $webroot . '/' . $image->image . '" rel="lightbox[search-result]" title="' . ($image->metatype == 'caption' ? s($image->description) : $image->image) . '">' . lightboxgallery_image_thumbnail($gallery->course, $gallery, $image->image) . '</a></div>
                 ' . $imagelabel . '
               </div>';
     $imagesdisplay[] = "'{$image->lid}{$image->image}'";
 }
 print_simple_box_end();
 if (count($imagesdisplay) > 0) {
     $sql = 'SELECT description
                 FROM ' . $CFG->prefix . 'lightboxgallery_image_meta
                 WHERE CONCAT(gallery, image) IN (' . implode(',', $imagesdisplay) . ')
                 AND description != \'' . $search . '\'
                 AND metatype = \'tag\'
                 GROUP BY description
                 ORDER BY COUNT(description) DESC, description ASC';
     if ($tags = get_records_sql($sql, 0, 10)) {
         lightboxgallery_print_tags(get_string('tagsrelated', 'lightboxgallery'), $tags, $course->id, $l);