當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。