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


PHP BlockInstance::delete_artefact方法代码示例

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


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

示例1: delete

 /** 
  * This function provides basic delete functionality.  It gets rid of the
  * artefact's row in the artefact table, and the tables that reference the
  * artefact table.  It also recursively deletes child artefacts.
  *
  * If your artefact has additional data in another table, you should
  * override this function, but you MUST call parent::delete() after you
  * have done your own thing.
  */
 public function delete()
 {
     if (empty($this->id)) {
         $this->dirty = false;
         return;
     }
     db_begin();
     // Call delete() on children (if there are any)
     if ($children = $this->get_children_instances()) {
         foreach ($children as $child) {
             $child->delete();
         }
     }
     artefact_watchlist_notification($this->id);
     // Delete any references to this artefact from non-artefact places.
     delete_records_select('artefact_parent_cache', 'artefact = ? OR parent = ?', array($this->id, $this->id));
     // Make sure that the artefact is removed from any view blockinstances that have it
     if ($records = get_column('view_artefact', 'block', 'artefact', $this->id)) {
         foreach ($records as $blockid) {
             require_once get_config('docroot') . 'blocktype/lib.php';
             $bi = new BlockInstance($blockid);
             $bi->delete_artefact($this->id);
         }
     }
     delete_records('view_artefact', 'artefact', $this->id);
     delete_records('artefact_feedback', 'artefact', $this->id);
     delete_records('artefact_tag', 'artefact', $this->id);
     delete_records('artefact_access_role', 'artefact', $this->id);
     delete_records('artefact_access_usr', 'artefact', $this->id);
     if ($this->can_be_logged()) {
         $this->log('deleted');
     }
     // Delete the record itself.
     delete_records('artefact', 'id', $this->id);
     handle_event('deleteartefact', $this);
     // Set flags.
     $this->dirty = false;
     $this->parentdirty = true;
     $this->deleted = true;
     db_commit();
 }
开发者ID:Br3nda,项目名称:mahara,代码行数:50,代码来源:lib.php


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