if ( isset($this->questiondisplay->options->questions) && is_array($this->questiondisplay->options->questions) ) {
$countsubquestions =0;
foreach($this->questiondisplay->options->questions as $subquestion){
- if ($subquestion != ''){
+ if (!empty($subquestion)){
$countsubquestions++;
}
}
if (isset($question->id) and $question->id and $question->qtype and $question->questiontext) {
foreach ($question->options->questions as $key => $wrapped) {
- if($wrapped != ''){
+ if(!empty($wrapped)){
// The old way of restoring the definitions is kept to gradually
// update all multianswer questions
if (empty($wrapped->questiontext)) {
}
$sequence = array();
foreach($question->options->questions as $wrapped) {
- if (!is_null($wrapped)){
+ if (!empty($wrapped)){
// if we still have some old wrapped question ids, reuse the next of them
if (is_array($oldwrappedquestions) && $oldwrappedquestion = array_shift($oldwrappedquestions)) {
global $QTYPES;
$responses = array();
foreach($question->options->questions as $key => $wrapped) {
- if (!is_null($wrapped)){
+ if (!empty($wrapped)){
if ($correct = $QTYPES[$wrapped->qtype]->get_correct_responses($wrapped, $state)) {
$responses[$key] = $correct[''];
} else {
global $QTYPES;
$responses = array();
foreach($question->options->questions as $key => $wrapped) {
- if (!is_null($wrapped)){
+ if (!empty($wrapped)){
if ($correct = $QTYPES[$wrapped->qtype]->get_possible_responses($wrapped)) {
$responses += $correct;
} else {
global $QTYPES;
$details = array();
foreach($question->options->questions as $key => $wrapped) {
- if (!is_null($wrapped)){
+ if (!empty($wrapped)){
$stateforquestion = clone($state);
$stateforquestion->responses[''] = $state->responses[$key];
$details = array_merge($details, $QTYPES[$wrapped->qtype]->get_actual_response_details($wrapped, $stateforquestion));
$teststate = clone($state);
$state->raw_grade = 0;
foreach($question->options->questions as $key => $wrapped) {
- if (!is_null($wrapped)){
+ if (!empty($wrapped)){
if(isset($state->responses[$key])){
$state->responses[$key] = $state->responses[$key];
}else {