Пример #1
0
 /**
  * Implementation of delete
  *
  * @see QuizQuestion#delete($only_this_version)
  */
 public function delete($only_this_version = FALSE)
 {
     if ($only_this_version) {
         db_delete('quiz_long_answer_user_answers')->condition('question_nid', $this->node->nid)->condition('question_vid', $this->node->vid)->execute();
         db_delete('quiz_long_answer_node_properties')->condition('nid', $this->node->nid)->condition('vid', $this->node->vid)->execute();
     } else {
         db_delete('quiz_long_answer_node_properties')->condition('nid', $this->node->nid)->execute();
         db_delete('quiz_long_answer_user_answers')->condition('question_nid', $this->node->nid)->execute();
     }
     parent::delete($only_this_version);
 }
Пример #2
0
 function hapus_ul($args)
 {
     list($id) = $args;
     if (!isset($id) || $id < 1) {
         die('no proper id');
     }
     $ul = new QuizUlangan();
     $ul->getByID($id);
     if ($ul->ulangan_creator_id == Account::getMyID() && !$ul->ulangan_aktif) {
         $ul->delete($id);
         //$ul->ulangan_aktif = 0;
         //$ul->save();
         $q = new QuizQuestion();
         $arr = $q->getWhere("q_ulangan_id = '{$id}'");
         foreach ($arr as $qq) {
             $q->delete($qq->qid);
             $a = new QuizAnswer();
             $arr2 = $a->getWhere("answer_qid = '{$qq->qid}'");
             foreach ($arr2 as $aa) {
                 $a->delete($aa->answer_id);
             }
         }
     }
 }