當前位置: 首頁>>代碼示例>>PHP>>正文


PHP enrol_plugin::delete_instance方法代碼示例

本文整理匯總了PHP中enrol_plugin::delete_instance方法的典型用法代碼示例。如果您正苦於以下問題:PHP enrol_plugin::delete_instance方法的具體用法?PHP enrol_plugin::delete_instance怎麽用?PHP enrol_plugin::delete_instance使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在enrol_plugin的用法示例。


在下文中一共展示了enrol_plugin::delete_instance方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: delete_instance

 /**
  * Intercepts the instance deletion call and gives some
  * custom instructions before resuming the parent function
  */
 public function delete_instance($instance)
 {
     global $DB;
     if ($this->get_config('removegroups')) {
         require_once "../group/lib.php";
         $groups = $DB->get_records_sql("SELECT * FROM {groups} WHERE " . $DB->sql_like('idnumber', ':idnumber'), array('idnumber' => "autoenrol|{$instance->id}|%"));
         foreach ($groups as $group) {
             groups_delete_group($group);
         }
     }
     parent::delete_instance($instance);
 }
開發者ID:bystrikondica,項目名稱:actnow,代碼行數:16,代碼來源:lib.php

示例2: delete_instance

 /**
  * Delete plugin specific information.
  *
  * @param stdClass $instance
  * @return void
  */
 public function delete_instance($instance)
 {
     global $DB;
     // Get the tool associated with this instance.
     $tool = $DB->get_record('enrol_lti_tools', array('enrolid' => $instance->id), 'id', MUST_EXIST);
     // Delete any users associated with this tool.
     $DB->delete_records('enrol_lti_users', array('toolid' => $tool->id));
     // Delete the lti tool record.
     $DB->delete_records('enrol_lti_tools', array('id' => $tool->id));
     // Time for the parent to do it's thang, yeow.
     parent::delete_instance($instance);
 }
開發者ID:evltuma,項目名稱:moodle,代碼行數:18,代碼來源:lib.php

示例3: delete_instance

 /**
  * Delete plugin specific information.
  *
  * @param stdClass $instance
  * @return void
  */
 public function delete_instance($instance)
 {
     global $DB;
     // Get the tool associated with this instance.
     $tool = $DB->get_record('enrol_lti_tools', array('enrolid' => $instance->id), 'id', MUST_EXIST);
     // Delete any users associated with this tool.
     $DB->delete_records('enrol_lti_users', array('toolid' => $tool->id));
     // Get tool and consumer mappings.
     $rsmapping = $DB->get_recordset('enrol_lti_tool_consumer_map', array('toolid' => $tool->id));
     // Delete consumers that are linked to this tool and their related data.
     $dataconnector = new data_connector();
     foreach ($rsmapping as $mapping) {
         $consumer = new ToolConsumer(null, $dataconnector);
         $consumer->setRecordId($mapping->consumerid);
         $dataconnector->deleteToolConsumer($consumer);
     }
     $rsmapping->close();
     // Delete mapping records.
     $DB->delete_records('enrol_lti_tool_consumer_map', array('toolid' => $tool->id));
     // Delete the lti tool record.
     $DB->delete_records('enrol_lti_tools', array('id' => $tool->id));
     // Time for the parent to do it's thang, yeow.
     parent::delete_instance($instance);
 }
開發者ID:dg711,項目名稱:moodle,代碼行數:30,代碼來源:lib.php


注:本文中的enrol_plugin::delete_instance方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。