/**
  * Update the cards from the glossary
  * delete all cards
  * 
  * @param integer $a_obj_id
  * @param integer $a_glossary_ref_id
  */
 public function updateCardsFromGlossary()
 {
     // get all term_ids from the glossaries involved
     $all_terms = array();
     if ($this->getGlossaryRefId()) {
         $glossary = ilObjectFactory::getInstanceByRefId($this->getGlossaryRefId());
         $glo_ids = $glossary->getAllGlossaryIds();
         if (!is_array($glo_ids)) {
             $glo_ids = array($glo_ids);
         }
         foreach ($glo_ids as $glo_id) {
             $terms = ilGlossaryTerm::getTermsOfGlossary($glo_id);
             $all_terms = array_merge($all_terms, $terms);
         }
     }
     // delete all cards without terms
     $found_terms = array();
     foreach ($this->cards as $card_id => $card) {
         if (!in_array($card->getTermId(), $all_terms)) {
             $card->delete();
             unset($this->cards[$card_id]);
         } else {
             $found_terms[] = $card->getTermId();
         }
     }
     // add new cards for new terms
     $missing_terms = array_diff($all_terms, $found_terms);
     $this->plugin->includeClass('class.ilFlashcard.php');
     foreach ($missing_terms as $term_id) {
         $card = new ilFlashCard();
         $card->setObjId($this->getId());
         $card->setTermId($term_id);
         $card->save();
         $this->cards[$card->getCardId()] = $card;
     }
     // cleanup the trainings
     $this->plugin->includeClass('class.ilFlashcardUsage.php');
     ilFlashcardUsage::_cleanup($this);
 }