当前位置: 首页>>代码示例>>PHP>>正文


PHP Images::delete方法代码示例

本文整理汇总了PHP中Images::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Images::delete方法的具体用法?PHP Images::delete怎么用?PHP Images::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Images的用法示例。


在下文中一共展示了Images::delete方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: deleteAction

 /** 
  * Confirm if image should be deleted and delete image
  *
  * @return void
  */
 function deleteAction()
 {
     $id = (int) $this->_request->getParam('id', 0);
     $image_class = new Images();
     if ($this->_request->isPost()) {
         $image = $image_class->fetchRow('id = ' . $id);
         $album_id = $image->album_id;
         // decerement viewer_order on all the images that have a higher
         // viewer_order than the deleted image
         $select = $image_class->select();
         $select->where('album_id = ' . $image->album_id)->where('viewer_order > ' . $image->viewer_order);
         $statement = $select->__toString();
         $this->logger->info($statement);
         $images = $image_class->fetchAll($select);
         foreach ($images as $image) {
             $image->viewer_order--;
             $this->logger->info("image {$image->id} now has index of {$image->viewer_order}");
             $image->save();
         }
         $del = $this->_request->getPost('confirm');
         if ($del == 'Confirm' && $id > 0) {
             $image_class->delete('id=' . $id);
         }
         if ($this->_request->getParam('from', 0) == 'viewImage' && $del != 'Confirm') {
             $this->_redirect('/image/view/id/' . $id);
         } else {
             $this->_redirect('/album/view/id/' . $album_id);
         }
     } else {
         if ($id > 0) {
             $this->view->title = 'Confirm Deletion';
             $image = $image_class->fetchRow('id=' . $id);
             $this->view->image_title = $image->title;
             $form = new ImageDeleteForm();
             $form->confirm->setLabel('Confirm');
             $form->cancel->setLabel('Cancel');
             $this->view->form = $form;
             $form->populate($image->toArray());
         }
     }
 }
开发者ID:ngroesz,项目名称:Photoplate,代码行数:46,代码来源:ImageController.php

示例2: delete_for_anchor

 /**
  * delete all images for a given anchor
  *
  * @param the anchor to check
  *
  * @see shared/anchors.php
  */
 public static function delete_for_anchor($anchor)
 {
     global $context;
     // seek all records attached to this anchor
     $query = "SELECT id FROM " . SQL::table_name('images') . " AS images " . " WHERE images.anchor LIKE '" . SQL::escape($anchor) . "'";
     if (!($result = SQL::query($query))) {
         return;
     }
     // delete silently all matching images
     while ($row = SQL::fetch($result)) {
         Images::delete($row['id']);
     }
 }
开发者ID:rair,项目名称:yacs,代码行数:20,代码来源:images.php

示例3: deleteAction

 public function deleteAction()
 {
     // web page title
     $this->view->title = "Suppression d'une galerie";
     //if ($this->view->aclIsAllowed('gallery','manage',true)){
     // variables
     $this->view->assign('isXmlHttpRequest', $this->_isXmlHttpRequest);
     $this->view->assign('success', false);
     $pageID = (int) $this->_getParam('pageID');
     $blockID = (int) $this->_getParam('blockID');
     $galleryID = (int) $this->_getParam('galleryID');
     if ($blockID != '') {
         $return = "/gallery/index/list/blockID/{$blockID}/pageID/{$pageID}";
     } elseif ($this->_categoryID) {
         $return = "/gallery/index/list/catID/{$this->_categoryID}";
     } else {
         $return = "/gallery/index/list/";
     }
     $this->view->return = $this->view->baseUrl() . $return;
     $galleryObject = new GalleryObject();
     $galleryDataIndex = $galleryObject->populate($galleryID, $this->_defaultEditLanguage);
     if (!$galleryDataIndex) {
         if ($this->_request->isPost()) {
             $this->view->assign('success', true);
         }
         $this->view->assign('deleted', true);
         $this->view->assign('galleryID', $galleryID);
     } else {
         $this->view->assign('deleted', false);
         $this->view->gallery = $galleryDataIndex;
         if ($this->_request->isPost()) {
             $formData = $this->_request->getPost();
             if ($galleryDataIndex) {
                 $gallerySelect = new GalleriesIndex();
                 $select = $gallerySelect->select()->where('GI_GalleryID = ?', $galleryID);
                 $galleryData = $gallerySelect->fetchAll($select);
                 foreach ($galleryData as $gallery) {
                     $indexData['moduleID'] = $this->_moduleID;
                     $indexData['contentID'] = $galleryID;
                     $indexData['languageID'] = $gallery['GI_LanguageID'];
                     $indexData['action'] = 'delete';
                     Cible_FunctionsIndexation::indexation($indexData);
                     $imageSelect = new GalleriesImages();
                     $select = $imageSelect->select()->setIntegrityCheck(false)->from('Galleries_Images')->where('GI_GalleryID = ?', $galleryID)->join('ImagesIndex', 'II_ImageID = GI_ImageID')->where('II_LanguageID = ?', $gallery['GI_LanguageID']);
                     $imageData = $imageSelect->fetchAll($select)->toArray();
                     $cpt = count($imageData);
                     for ($i = 0; $i < $cpt; $i++) {
                         $indexData['moduleID'] = $this->_moduleID;
                         $indexData['contentID'] = $imageData[$i]['II_ImageID'];
                         $indexData['languageID'] = $imageData[$i]['II_LanguageID'];
                         $indexData['action'] = 'delete';
                         Cible_FunctionsIndexation::indexation($indexData);
                     }
                 }
                 //delete all images associated with the gallery
                 $galleryImagesSelect = new GalleriesImages();
                 $select = $galleryImagesSelect->select()->where('GI_GalleryID = ?', $galleryID);
                 $galleryImagesData = $galleryImagesSelect->fetchAll($select);
                 foreach ($galleryImagesData as $galleryImages) {
                     $imageDelete = new Images();
                     $where = "I_ID = " . $galleryImages['GI_ImageID'];
                     $imageDelete->delete($where);
                     $imageIndexDelete = new ImagesIndex();
                     $where = "II_ImageID = " . $galleryImages['GI_ImageID'];
                     $imageIndexDelete->delete($where);
                 }
                 $galleryImagesDelete = new GalleriesImages();
                 $where = "GI_GalleryID = " . $galleryID;
                 $galleryImagesDelete->delete($where);
                 $galleryObject->delete($galleryID);
                 /*
                  //delete the gallery
                  $galleryDelete = new Galleries();
                  $where = 'G_ID = ' .  $galleryID;
                  $galleryDelete->delete($where);
                 
                  $galleryIndexDelete = new GalleriesIndex();
                  $where = 'GI_GalleryID = ' .  $galleryID;
                  $galleryIndexDelete->delete($where);
                 */
                 //delete the gallery folder
                 Cible_FunctionsGeneral::delFolder("../../{$this->_config->document_root}/data/images/gallery/" . $galleryID);
                 if (!$this->_isXmlHttpRequest) {
                     if ($blockID != '') {
                         $this->_redirect("/gallery/index/list/blockID/{$blockID}/pageID/{$pageID}");
                     } elseif ($this->_categoryID) {
                         $this->_redirect("/gallery/index/list/catID/{$this->_categoryID}");
                     } else {
                         $this->_redirect("/gallery/index/list/");
                     }
                 } else {
                     $buttonAction = $formData['buttonAction'];
                     $this->view->assign('success', true);
                     $this->view->assign('buttonAction', $buttonAction);
                     $this->view->assign('galleryID', $galleryID);
                     $this->view->assign('deleted', true);
                 }
             }
         }
     }
//.........这里部分代码省略.........
开发者ID:anunay,项目名称:stentors,代码行数:101,代码来源:IndexController.php

示例4: elseif

global $render_overlaid;
// not found
if (!isset($item['id'])) {
    include '../error.php';
    // permission denied
} elseif (!$permitted) {
    Safe::header('Status: 401 Unauthorized', TRUE, 401);
    Logger::error(i18n::s('You are not allowed to perform this operation.'));
    // deletion is confirmed
} elseif (isset($_REQUEST['confirm']) && $_REQUEST['confirm'] == 'yes') {
    // touch the related anchor before actual deletion, since the image has to be accessible at that time
    if (is_object($anchor)) {
        $anchor->touch('image:delete', $item['id']);
    }
    // if no error, back to the anchor or to the index page
    if (Images::delete($item['id'])) {
        Images::clear($item);
        if (isset($_REQUEST['strait'])) {
            $output['success'] = true;
            // provide a new field if required
            if (isset($_REQUEST['newfield'])) {
                $indice = $_REQUEST['newfield'] ? $_REQUEST['newfield'] : '';
                $output['replace'] = Skin::build_input_file('upload' . $indice);
            }
        } elseif (isset($_REQUEST['follow_up'])) {
            Safe::redirect($_REQUEST['follow_up']);
        } elseif (is_object($anchor)) {
            Safe::redirect($anchor->get_url());
        } else {
            Safe::redirect($context['url_to_home'] . $context['url_to_root'] . 'images/');
        }
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:delete.php


注:本文中的Images::delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。