Esempio n. 1
0
 private function deleteVocabs()
 {
     $result = db_query("SELECT vid FROM {vocabulary}");
     while ($vid = db_fetch_array($result)) {
         taxonomy_del_vocabulary($vid['vid']);
     }
 }
function lms_clean_up_subject_structure($subject_type_name, $subject_display_name) {

  // 1. Clean up contnet types
  $course_type_machine_name = $subject_type_name. COURSE_SUBFIX; // machine name of course content type for the subject
  node_type_delete($course_type_machine_name);
  print "<h2>Content Type [$course_type_machine_name] has been deleted</h1>";

  $capability_type_machine_name = $subject_type_name. CAPABILITY_SUBFIX; // machine name of course content type for the subject
  node_type_delete($capability_type_machine_name);
  print "<h2>Content Type [capability_type_machine_name] has been deleted</h1>";

  $task_type_machine_name = $subject_type_name. TASK_SUBFIX; // machine name of course content type for the subject
  node_type_delete($task_type_machine_name);
  print "<h2>Content Type [$task_type_machine_name] has been deleted</h1>";

  // 2. clean up vocabulary
  $course_vocab_display_name = $subject_display_name . t(' course vocabulary'); //dsiplayname of course content type
  $capability_vocab_display_name = $subject_display_name . t(' capability vocabulary'); //dsiplayname of course content type
  $task_vocab_display_name = $subject_display_name . t(' task vocabulary'); //dsiplayname of course content type

  $vocabs = taxonomy_get_vocabularies();

  foreach ($vocabs as $vid => $vocab){
    if ($vocab->name == $course_vocab_display_name || $vocab->name == $capability_vocab_display_name || $vocab->name == $task_vocab_display_name) {
      taxonomy_del_vocabulary($vid);
      print "<h2>Vocabulary [$vocab->name] has been deleted</h1>";
    }
  }

}