Exemplo n.º 1
0
 public static function deleteWithDependency($groupId, $surveyId)
 {
     $questionIds = QuestionGroup::getQuestionIdsInGroup($groupId);
     Question::deleteAllById($questionIds);
     Assessment::model()->deleteAllByAttributes(array('sid' => $surveyId, 'gid' => $groupId));
     return QuestionGroup::model()->deleteAllByAttributes(array('sid' => $surveyId, 'gid' => $groupId));
 }
 public static function deleteWithDependency($groupId, $surveyId)
 {
     // Abort if the survey is active
     $surveyIsActive = Survey::model()->findByPk($surveyId)->active !== 'N';
     if ($surveyIsActive) {
         Yii::app()->user->setFlash('error', gt("Can't delete question group when the survey is active"));
         return null;
     }
     $questionIds = QuestionGroup::getQuestionIdsInGroup($groupId);
     Question::deleteAllById($questionIds);
     Assessment::model()->deleteAllByAttributes(array('sid' => $surveyId, 'gid' => $groupId));
     return QuestionGroup::model()->deleteAllByAttributes(array('sid' => $surveyId, 'gid' => $groupId));
 }