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


PHP xPDOSimpleObject::remove方法代码示例

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


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

示例1: remove

 /**
  * Overrides xPDOObject::remove to fire modX-specific events
  *
  * {@inheritDoc}
  */
 public function remove(array $ancestors = array())
 {
     if ($this->xpdo instanceof modX) {
         $this->xpdo->invokeEvent('OnUserGroupBeforeRemove', array('usergroup' => &$this, 'ancestors' => $ancestors));
     }
     $removed = parent::remove($ancestors);
     // delete ACLs for this group
     $targets = explode(',', $this->xpdo->getOption('principal_targets', null, 'modAccessContext,modAccessResourceGroup,modAccessCategory'));
     array_walk($targets, 'trim');
     foreach ($targets as $target) {
         $fields = $this->xpdo->getFields($target);
         if (array_key_exists('principal_class', $fields) && array_key_exists('principal', $fields)) {
             $tablename = $this->xpdo->getTableName($target);
             $principal_class_field = $this->xpdo->escape('principal_class');
             $principal_field = $this->xpdo->escape('principal');
             if (!empty($tablename)) {
                 $this->xpdo->query("DELETE FROM {$tablename} WHERE {$principal_class_field} = 'modUserGroup' AND {$principal_field} = {$this->_fields['id']}");
             }
         }
     }
     if ($this->xpdo instanceof modX) {
         $this->xpdo->invokeEvent('OnUserGroupRemove', array('usergroup' => &$this, 'ancestors' => $ancestors));
     }
     return $removed;
 }
开发者ID:adamwintle,项目名称:flexibility5,代码行数:30,代码来源:modusergroup.class.php

示例2: remove

 /** {@inheritdoc} */
 public function remove(array $ancestors = array())
 {
     $id = $this->get('id');
     $table = $this->xpdo->getTableName('msDeliveryMember');
     $sql = "DELETE FROM {$table} WHERE `delivery_id` = '{$id}';";
     $this->xpdo->exec($sql);
     return parent::remove();
 }
开发者ID:volkovnd,项目名称:miniShop2,代码行数:9,代码来源:msdelivery.class.php

示例3: remove

 public function remove(array $ancestors = array())
 {
     $removed = parent::remove($ancestors);
     if ($removed && !$this->getOption(xPDO::OPT_SETUP)) {
         $this->xpdo->call('modExtensionPackage', 'clearCache', array(&$this->xpdo));
     }
     return $removed;
 }
开发者ID:raadhuis,项目名称:modx-basic,代码行数:8,代码来源:modextensionpackage.class.php

示例4: remove

 /**
  * {@inheritdoc}
  *
  */
 public function remove(array $ancestors = array())
 {
     $id = $this->get('id');
     $sql = 'DELETE FROM ' . $this->xpdo->getTableName('msProductOption') . ' WHERE `product_id` = ' . $id . ';';
     $stmt = $this->xpdo->prepare($sql);
     $stmt->execute();
     $stmt->closeCursor();
     return parent::remove();
 }
开发者ID:volkovnd,项目名称:miniShop2,代码行数:13,代码来源:msproductdata.class.php

示例5: remove

 public function remove(array $ancestors = array())
 {
     $remove = parent::remove($ancestors);
     /** @var msdCouponGroup $group */
     if ($group = $this->getOne('Group')) {
         $group->updateCounters();
     }
     return $remove;
 }
开发者ID:bendasvadim,项目名称:msDiscount,代码行数:9,代码来源:msdcoupon.class.php

示例6: remove

 /**
  * Overrides the xPDOObject::remove method to remove the physical file for
  * the attachment
  *
  * @param array $ancestors
  * @return boolean
  */
 public function remove(array $ancestors = array())
 {
     $filename = $this->get('filename');
     if (!empty($filename)) {
         $filename = $this->getPath();
         if (!@unlink($filename)) {
             $this->xpdo->log(xPDO::LOG_LEVEL_ERROR, '[Discuss] An error occurred while trying to remove the attachment file at: ' . $filename);
         }
     }
     return parent::remove($ancestors);
 }
开发者ID:oneismore,项目名称:Discuss,代码行数:18,代码来源:dispostattachment.class.php

示例7: remove

 /**
  * @param array $ancestors
  * @return bool
  */
 public function remove(array $ancestors = array())
 {
     if ($this->xpdo instanceof modX) {
         $this->xpdo->invokeEvent('MlmSystemOnLogBeforeRemove', array('log' => &$this, 'ancestors' => $ancestors));
     }
     $removed = parent::remove($ancestors);
     if ($this->xpdo instanceof modX) {
         $this->xpdo->invokeEvent('MlmSystemOnLogRemove', array('log' => &$this, 'ancestors' => $ancestors));
     }
     return $removed;
 }
开发者ID:vgrish,项目名称:mlmsystem,代码行数:15,代码来源:mlmsystemlog.class.php

示例8: remove

 /**
  * Overrides xPDOObject::remove to fire modX-specific events
  *
  * {@inheritDoc}
  */
 public function remove(array $ancestors = array())
 {
     if ($this->xpdo instanceof modX) {
         $this->xpdo->invokeEvent('OnUserGroupBeforeRemove', array('usergroup' => &$this, 'ancestors' => $ancestors));
     }
     $removed = parent::remove($ancestors);
     if ($this->xpdo instanceof modX) {
         $this->xpdo->invokeEvent('OnUserGroupRemove', array('usergroup' => &$this, 'ancestors' => $ancestors));
     }
     return $removed;
 }
开发者ID:JoeBlow,项目名称:revolution,代码行数:16,代码来源:modusergroup.class.php

示例9: remove

 public function remove(array $ancestors = array())
 {
     $c = $this->xpdo->newQuery('galItem');
     $c->innerJoin('galAlbumItem', 'AlbumItems');
     $c->where(array('AlbumItems.album' => $this->get('id')));
     $items = $this->xpdo->getCollection('galItem', $c);
     $removed = parent::remove($ancestors);
     if ($removed) {
         foreach ($items as $item) {
             $count = $this->xpdo->getCount('galAlbumItem', array('item' => $item->get('id'), 'album:!=' => $this->get('id')));
             if ($count <= 0) {
                 $item->remove();
             }
         }
     }
     return $removed;
 }
开发者ID:hansek,项目名称:Gallery,代码行数:17,代码来源:galalbum.class.php

示例10: remove

 /**
  * Override xPDOObject::remove() to revert to the default dashboard any user groups using this Dashboard
  *
  * @see xPDOObject::remove()
  * @param array $ancestors
  * @return boolean
  */
 public function remove(array $ancestors = array())
 {
     $dashboardId = $this->get('id');
     $removed = parent::remove($ancestors);
     if ($removed) {
         $defaultDashboard = modDashboard::getDefaultDashboard($this->xpdo);
         if (empty($defaultDashboard)) {
             /** @var modDashboard $defaultDashboard */
             $defaultDashboard = $this->xpdo->newObject('modDashboard');
             $defaultDashboard->set('id', 0);
         }
         $userGroups = $this->xpdo->getCollection('modUserGroup', array('dashboard' => $dashboardId));
         /** @var modUserGroup $userGroup */
         foreach ($userGroups as $userGroup) {
             $userGroup->set('dashboard', $defaultDashboard->get('id'));
             $userGroup->save();
         }
     }
     return $removed;
 }
开发者ID:e-gob,项目名称:apps.gob.cl,代码行数:27,代码来源:moddashboard.class.php

示例11: remove

 public function remove(array $ancestors = array())
 {
     $ok = parent::remove($ancestors);
     if ($ok) {
         if ($thread = $this->Thread) {
             switch ($this->vote_direction) {
                 case '1':
                     $thread->positive_votes = $thread->positive_votes - 1;
                     break;
                 case '-1':
                     $thread->negative_votes = $thread->negative_votes - 1;
                     break;
                 default:
                     $thread->neutral_votes = $thread->neutral_votes - 1;
             }
             $thread->rating = $thread->rating - $this->vote_value;
             $thread->save();
         }
     }
     return $ok;
 }
开发者ID:bendasvadim,项目名称:NewsModxBox,代码行数:21,代码来源:societyvote.class.php

示例12: remove

    /**
     * Overrides xPDOObject::remove to fire modX-specific events.
     *
     * {@inheritDoc}
     */
    public function remove(array $ancestors = array()) {
        if ($this->xpdo instanceof modX) {
            $this->xpdo->invokeEvent('OnPropertySetBeforeRemove',array(
                'propertySet' => &$this,
                'ancestors' => $ancestors,
            ));
        }

        $removed = parent :: remove($ancestors);

        if ($removed && $this->xpdo instanceof modX) {
            $this->xpdo->invokeEvent('OnPropertySetRemove',array(
                'propertySet' => &$this,
                'ancestors' => $ancestors,
            ));
        }
        return $removed;
    }
开发者ID:raf3600,项目名称:revolution,代码行数:23,代码来源:modpropertyset.class.php

示例13: remove

 /**
  * @param array $ancestors
  *
  * @return bool
  */
 public function remove(array $ancestors = array())
 {
     $filename = $this->get('path') . $this->get('file');
     if ($this->prepareSource()) {
         $this->mediaSource->removeObject($filename);
         if (!empty($this->mediaSource->errors['file'])) {
             $this->xpdo->log(xPDO::LOG_LEVEL_ERROR, '[Uploadify] Could not remove file at "' . $filename . '": ' . $this->mediaSource->errors['file']);
         }
     }
     $children = $this->xpdo->getIterator('uFile', array('parent' => $this->get('id')));
     /** @var uFile $child */
     foreach ($children as $child) {
         $child->remove();
     }
     return parent::remove($ancestors);
 }
开发者ID:bendasvadim,项目名称:modx-uploadify,代码行数:21,代码来源:ufile.class.php

示例14: remove

 /**
  * Overrides xPDOObject::remove to handle closure tables, post counts, fix
  * the forum activity and user profile counts.
  *
  * @param array $ancestors
  * @param boolean $doBoardMoveChecks
  * @param boolean $moveToSpam
  * @return boolean
  */
 public function remove(array $ancestors = array(), $doBoardMoveChecks = false, $moveToSpam = false)
 {
     $removed = false;
     $moved = false;
     $canRemove = $this->xpdo->invokeEvent('OnDiscussPostBeforeRemove', array('post' => &$this, 'doBoardMoveChecks' => $doBoardMoveChecks, 'moveToSpam' => $moveToSpam));
     if (!empty($canRemove)) {
         return false;
     }
     /** @var disUser $author */
     $author = $this->getOne('Author');
     /** @var disThread $thread */
     $thread = $this->xpdo->getObject('disThread', array('id' => $this->get('thread')));
     /** @var disBoard $board */
     $board = $this->xpdo->getObject('disBoard', array('id' => $this->get('board')));
     $isPrivateMessage = !$thread || $thread->get('private');
     /* first check to see if moving to spam/trash */
     if (!empty($doBoardMoveChecks) && !$isPrivateMessage && !empty($board)) {
         $isModerator = $board->isModerator($this->xpdo->discuss->user->get('id'));
         $isAdmin = $this->xpdo->discuss->user->isAdmin();
         if ($isAdmin || $isModerator || $this->xpdo->discuss->user->get('id') == $this->get('author')) {
             /* move to spambox/recyclebin */
             $spamBoard = $this->xpdo->getOption('discuss.spam_bucket_board', null, false);
             if ($moveToSpam && !empty($spamBoard) && $this->get('board') != $spamBoard) {
                 $removed = $this->move($spamBoard);
                 $moved = true;
             } else {
                 $trashBoard = $this->xpdo->getOption('discuss.recycle_bin_board', null, false);
                 if (!empty($trashBoard) && $this->get('board') != $trashBoard) {
                     $removed = $this->move($trashBoard);
                     $moved = true;
                 }
             }
         }
     }
     if (!$removed) {
         $removed = parent::remove($ancestors);
     }
     if ($removed) {
         $parent = $this->get('parent');
         if (empty($parent)) {
             /* get oldest post and make it the new root post for the thread */
             $c = $this->xpdo->newQuery('disPost');
             $c->where(array('id:!=' => $this->get('id'), 'board' => $this->get('board'), 'thread' => $this->get('thread')));
             $c->sortby($this->xpdo->escape('createdon'), 'ASC');
             $c->limit(1);
             /* @var disPost $oldestPost */
             $oldestPost = $this->xpdo->getObject('disPost', $c);
             if ($oldestPost) {
                 $oldestPost->set('parent', 0);
                 if ($oldestPost->save()) {
                     $parent = $oldestPost->get('id');
                     $thread->set('post_first', $oldestPost->get('id'));
                     $thread->save();
                 }
             }
         }
         /* fix child posts' parent */
         foreach ($this->getMany('Children') as $child) {
             /* @var disPost $child */
             $child->set('parent', $parent);
             $child->save();
         }
         /* decrease profile posts */
         if ($author && !$isPrivateMessage) {
             $author->set('posts', $author->get('posts') - 1);
             $author->save();
         }
         /* fix board last post */
         if ($board && !$isPrivateMessage) {
             $c = $this->xpdo->newQuery('disPost');
             $c->where(array('id:!=' => $this->get('id'), 'board' => $board->get('id')));
             $c->sortby('createdon', 'DESC');
             $c->limit(1);
             /** @var disPost $latestPost */
             $latestPost = $this->xpdo->getObject('disPost', $c);
             if ($latestPost) {
                 $board->set('last_post', $latestPost->get('id'));
             } else {
                 $board->set('last_post', 0);
             }
             /* fix board total post/replies/topics counts */
             $board->set('total_posts', $board->get('total_posts') - 1);
             if ($parent == 0) {
                 $board->set('num_topics', $board->get('num_topics') - 1);
             } else {
                 $board->set('num_replies', $board->get('num_replies') - 1);
             }
             $board->save();
         }
         /* fix thread posts/data */
         if ($thread) {
//.........这里部分代码省略.........
开发者ID:oneismore,项目名称:Discuss,代码行数:101,代码来源:dispost.class.php

示例15: remove

 public function remove(array $ancestors = array())
 {
     $filename = $this->get('filename');
     if (!empty($filename)) {
         $filename = $this->xpdo->call('galAlbum', 'getFilesPath', array(&$this->xpdo)) . $filename;
         $filename = str_ireplace(MODX_BASE_PATH, '', $filename);
         $ms = $this->getMediaSource();
         if (!@$ms->removeObject($filename)) {
             $this->xpdo->log(xPDO::LOG_LEVEL_ERROR, '[Gallery] An error occurred while trying to remove the attachment file at: ' . $filename);
         }
     }
     return parent::remove($ancestors);
 }
开发者ID:Piterden,项目名称:modx_testfloor,代码行数:13,代码来源:galitem.class.php


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