コード例 #1
0
 function process_form()
 {
     $caption = required_param('caption', PARAM_TEXT);
     $remove = optional_param('remove', '', PARAM_TEXT);
     if ($remove) {
         delete_records('lightboxgallery_image_meta', 'metatype', 'caption', 'gallery', $this->gallery->id, 'image', $this->image);
     } else {
         lightboxgallery_set_image_caption($this->gallery->id, $this->image, $caption);
     }
 }
コード例 #2
0
                     $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();
             list($width, $height) = explode('x', $resizeoptions[$resizeoption]);
             if ($uploadedimage->resize($width, $height)) {
                 $messages[] = get_string('imageresized', 'lightboxgallery', $resizeoptions[$resizeoption]);