diff --git a/Parser/classes/AbstractComposite.php b/Parser/classes/AbstractComposite.php index 9fcc7e305bee9ec7c373fd7f88cd25498dd5dbfa..3151b4fbda4bd23ee15566fc06a89c0a9529139c 100644 --- a/Parser/classes/AbstractComposite.php +++ b/Parser/classes/AbstractComposite.php @@ -33,9 +33,12 @@ abstract class AbstractComposite implements CompositeInterface { public function describe() { $description = ""; - if(\count($this->nodes) > 0) $description .= "(" . $this->nodes[0]->describe(); - $description .= $this->getDescription(); - if(\count($this->nodes) > 0) $description .= $this->nodes[1]->describe() . ") "; + if(is_array($this->nodes)) + { + if(\count($this->nodes) > 0) $description .= "(" . $this->nodes[0]->describe(); + $description .= $this->getDescription(); + if(\count($this->nodes) > 0) $description .= $this->nodes[1]->describe() . ") "; + } return $description; } } diff --git a/Parser/classes/CompositeBuilder.php b/Parser/classes/CompositeBuilder.php index 699d944b396cfc3d2d1e8e7c99ecb28d6e6ae2a3..16fd7f0e9a5a6a7925bc2262ad454f46993e0da7 100644 --- a/Parser/classes/CompositeBuilder.php +++ b/Parser/classes/CompositeBuilder.php @@ -39,12 +39,18 @@ class CompositeBuilder { { $nodes['nodes'][$key] = $this->create($child); } - + + $counted_nodes = 0; + if(is_array($nodes['nodes'])) + { + $counted_nodes = count($nodes['nodes']); + } + foreach($this->operators as $next_operator) { do{ $index = -1; - for($i = 0; $i < count($nodes['nodes']); $i++) + for($i = 0; $i < $counted_nodes; $i++) { if(!is_object($nodes['nodes'][$i]) && $nodes['nodes'][$i]['type'] == 'operator' && $nodes['nodes'][$i]['value'] == $next_operator) { diff --git a/Parser/classes/CompositeEvaluator.php b/Parser/classes/CompositeEvaluator.php index 76b862f5295eaea5d5c487bc4e5c6bf834811582..4b3e8af283c908093074063d1c5ec451bfc7432d 100644 --- a/Parser/classes/CompositeEvaluator.php +++ b/Parser/classes/CompositeEvaluator.php @@ -36,7 +36,7 @@ class CompositeEvaluator { */ public function evaluate(AbstractComposite $composite) { - if(count($composite->nodes) > 0) + if(is_array($composite->nodes) && count($composite->nodes) > 0) { $composite->nodes[0] = $this->evaluate($composite->nodes[0]); $composite->nodes[1] = $this->evaluate($composite->nodes[1]); diff --git a/Parser/classes/CompositeValidator.php b/Parser/classes/CompositeValidator.php index 5e2734a5f1a8ab53eb61370be4f2305ff7861b7f..349d6690dedfbf1c34f613107ab9e79e98456f96 100644 --- a/Parser/classes/CompositeValidator.php +++ b/Parser/classes/CompositeValidator.php @@ -53,7 +53,7 @@ class CompositeValidator public function validate(AbstractComposite $composite) { - if(count($composite->nodes) > 0) + if(is_array($composite->nodes) && count($composite->nodes) > 0) { $this->validate($composite->nodes[0]); $this->validate($composite->nodes[1]); diff --git a/README.md b/README.md index 72616e1b3123c67a498cbe27f71636bd4715d2dc..9242bd510f62bf711c89e84682ea58d2c570d968 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # ILIAS QuestionSetPool -* For ILIAS versions: 5.3.0 - 5.3.999 +* For ILIAS versions: 5.3.0 - 5.4.999 ## Installation Instructions 1. Create the plugin path: diff --git a/classes/class.ilObjQuestionSetPool.php b/classes/class.ilObjQuestionSetPool.php index 0bbd7919635032bc6bcd6c54af15d097e81bee68..ff85dba403dcf45e8a777e27059d315a462bb501 100644 --- a/classes/class.ilObjQuestionSetPool.php +++ b/classes/class.ilObjQuestionSetPool.php @@ -407,7 +407,7 @@ class ilObjQuestionSetPool extends ilObjectPlugin implements ilPluginModelInterf global $DIC; $ilDB = $DIC->database(); - if(count($obj_ids) == 1) + if(is_array($obj_ids) && count($obj_ids) == 1) { $in = ' id = ' . $ilDB->quote(current($obj_ids), 'integer') . ' '; } diff --git a/classes/class.ilObjQuestionSetPoolGUI.php b/classes/class.ilObjQuestionSetPoolGUI.php index 223318ca960ad7dfd5ba3aa0b900c0d5aab1b4fd..76abbb24208c34617c3b601a854c547c3aebf12b 100755 --- a/classes/class.ilObjQuestionSetPoolGUI.php +++ b/classes/class.ilObjQuestionSetPoolGUI.php @@ -258,7 +258,7 @@ class ilObjQuestionSetPoolGUI extends ilObjectPluginGUI implements ilDesktopItem ilQuestionSetPoolImporter::SINGLE_IMPORT_NO_POOL => $this->lng->txt('assessment_no_pool') ); - if (count($questionpools)) + if (is_array($questionpools) && count($questionpools)) { foreach ($questionpools as $key => $value) { diff --git a/classes/class.ilQuestionSetPoolExporter.php b/classes/class.ilQuestionSetPoolExporter.php index 35092695397a175105bc57db90d6b8cb634f79ba..96b8313249742891b1b2899e9ed2fd2eafe7a6d5 100755 --- a/classes/class.ilQuestionSetPoolExporter.php +++ b/classes/class.ilQuestionSetPoolExporter.php @@ -278,7 +278,7 @@ class ilQuestionSetPoolExporter extends ilXmlExporter $this->questions[$question['question_id']] = $question['question_id']; } $this->xml_writer->xmlEndTag('Questions'); - if(count($this->questions) > 0) + if(is_array($this->questions) && count($this->questions) > 0) { $this->exportQuestions(); } @@ -500,7 +500,7 @@ class ilQuestionSetPoolExporter extends ilXmlExporter } } - if(count($org_qst_ids) > 0) + if(is_array($org_qst_ids) && count($org_qst_ids) > 0) { $res_2 = $ilDB->query('SELECT obj_fi FROM qpl_questions WHERE '. $ilDB->in('question_id',$org_qst_ids, false, 'integer')); diff --git a/classes/class.ilQuestionSetPoolImporter.php b/classes/class.ilQuestionSetPoolImporter.php index 4d2b62ef28c31f8630fa04731c6273e9d2e56449..3d94e665515ad8563c7d360978f6d40f98cec8ed 100755 --- a/classes/class.ilQuestionSetPoolImporter.php +++ b/classes/class.ilQuestionSetPoolImporter.php @@ -288,7 +288,7 @@ class ilQuestionSetPoolImporter extends ilXmlImporter $this->addNodeMapping($node_data[0]['NodeId'], $node->getId()); $jump_conditions = $node_data['jump_conditions']; - if(count($jump_conditions) == 0) + if(is_array($jump_conditions) && count($jump_conditions) == 0) { continue 1; } @@ -434,7 +434,7 @@ class ilQuestionSetPoolImporter extends ilXmlImporter $this->initializeQplObject($new_qpl_id); } // Containter-Import (Plugin liegt im Kurs, die Originale unserer Fragen liegen ggf.(!!) in ebenfalls importierten Fragenpools) - else if ($this->is_single_import || count($this->qpl_qst_mapping['new_qpl']) > 0) + else if ($this->is_single_import || (is_array($this->qpl_qst_mapping['new_qpl']) && count($this->qpl_qst_mapping['new_qpl']) > 0)) { $parent_ref_id = $a_mapping->getTargetId(); if (!$this->is_single_import && $this->current_parent_ref_id > 0) diff --git a/classes/class.ilQuestionSetPoolXmlValidator.php b/classes/class.ilQuestionSetPoolXmlValidator.php index 4f22c3aa2925a4a8deb8126d745d2488d1d60999..c819dd6a6cd38f6a711726ffbfcf939e5ea3651b 100644 --- a/classes/class.ilQuestionSetPoolXmlValidator.php +++ b/classes/class.ilQuestionSetPoolXmlValidator.php @@ -229,7 +229,7 @@ class ilQuestionSetPoolXmlValidator return true; } - if(count($this->errors)) + if(is_array($this->errors) && count($this->errors)) { return false; } @@ -275,7 +275,7 @@ class ilQuestionSetPoolXmlValidator } } libxml_clear_errors(); - if(count($this->errors)) + if(is_array($this->errors) && count($this->errors)) { return false; } diff --git a/classes/controllers/abstract.ilPluginControllerTableGUI.php b/classes/controllers/abstract.ilPluginControllerTableGUI.php index 122557193569753c823518229ec1590e91252668..bbadb40356f796cbce173f31b2a0af320aac94bd 100644 --- a/classes/controllers/abstract.ilPluginControllerTableGUI.php +++ b/classes/controllers/abstract.ilPluginControllerTableGUI.php @@ -19,6 +19,6 @@ abstract class ilPluginControllerTableGUI extends ilPluginControllerGUI */ protected function dataSelected($key) { - return (isset($_POST[$key]) && count($_POST[$key]) > 0); + return (isset($_POST[$key]) && (is_array($_POST[$key]) && count($_POST[$key]) > 0)); } } diff --git a/classes/controllers/class.ilQuestionSetPoolNodeGUI.php b/classes/controllers/class.ilQuestionSetPoolNodeGUI.php index 56ea5a1f6f3c7021fc873fc8fce176f667b60280..34ba51a18fd479fa13f3d4fd1173a69b128724d8 100644 --- a/classes/controllers/class.ilQuestionSetPoolNodeGUI.php +++ b/classes/controllers/class.ilQuestionSetPoolNodeGUI.php @@ -264,7 +264,7 @@ class ilQuestionSetPoolNodeGUI extends ilPluginControllerFormGUI */ protected function redirectIfUnableToAddNewNode($model) { - if (count($this->getQuestionOptions($model)) == 0) + if (is_array($this->getQuestionOptions($model)) && count($this->getQuestionOptions($model)) == 0) { ilUtil::sendFailure($this->plugin->txt("unable_to_add_new_node"), true); $this->redirect( diff --git a/classes/controllers/class.ilQuestionSetPoolNodesGUI.php b/classes/controllers/class.ilQuestionSetPoolNodesGUI.php index d0a7892e77982f71c954794712931c631fc49dee..d5a662f3c5ae2901e70287fb22e8075d6bdf02c8 100644 --- a/classes/controllers/class.ilQuestionSetPoolNodesGUI.php +++ b/classes/controllers/class.ilQuestionSetPoolNodesGUI.php @@ -135,13 +135,15 @@ class ilQuestionSetPoolNodesGUI extends ilPluginControllerTableGUI "path_id" => (int)$_GET["path_id"] )); } - - for($i = 0; $i < count($data); $i++) + + if(is_array($data)) { - $data[$i]["node_index"] = ($i + 1); - $model->getNodes()->update($data[$i]); + for($i = 0; $i < count($data); $i++) + { + $data[$i]["node_index"] = ($i + 1); + $model->getNodes()->update($data[$i]); + } } - return $data; } @@ -194,40 +196,43 @@ class ilQuestionSetPoolNodesGUI extends ilPluginControllerTableGUI */ protected function conditionsAreValid($data) { - for ($index = 1; $index < count($data); $index++) + if(is_array($data)) { - $node = new ilQuestionSetPoolNode($data[$index]["id"]); - $node->read(); - $node->setIndex($data[$index]["node_index"]); - - if(!ilQuestionSetPoolConditionValidator::isValid($node->getInitialCondition(),$node,$data,$this->plugin)) + for($index = 1; $index < count($data); $index++) { - return false; - } + $node = new ilQuestionSetPoolNode($data[$index]["id"]); + $node->read(); + $node->setIndex($data[$index]["node_index"]); - foreach ($data[$index]["jump_conditions"] as $jump_condition) - { - if(!ilQuestionSetPoolConditionValidator::isValid($jump_condition["jump_condition"],$node,$data,$this->plugin)) + if(!ilQuestionSetPoolConditionValidator::isValid($node->getInitialCondition(), $node, $data, $this->plugin)) { return false; } - $error = false; - for ($inner_index = 0; $inner_index <= $index; $inner_index++) + foreach($data[$index]["jump_conditions"] as $jump_condition) { - if ($data[$inner_index]["question_fi"] == $jump_condition["question_fi"] || $jump_condition["question_fi"] == null) + if(!ilQuestionSetPoolConditionValidator::isValid($jump_condition["jump_condition"], $node, $data, $this->plugin)) { - $error = false; - break; + return false; } - else + + $error = false; + for($inner_index = 0; $inner_index <= $index; $inner_index++) { - $error = true; + if($data[$inner_index]["question_fi"] == $jump_condition["question_fi"] || $jump_condition["question_fi"] == null) + { + $error = false; + break; + } + else + { + $error = true; + } + } + if($error) + { + return false; } - } - if ($error) - { - return false; } } } diff --git a/classes/controllers/class.ilQuestionSetPoolPathGUI.php b/classes/controllers/class.ilQuestionSetPoolPathGUI.php index 7e674db69d364c9892b61435ea514a1a19def250..aa11d492b7a6e99d8be93c5646dc666588a00a74 100644 --- a/classes/controllers/class.ilQuestionSetPoolPathGUI.php +++ b/classes/controllers/class.ilQuestionSetPoolPathGUI.php @@ -167,7 +167,7 @@ class ilQuestionSetPoolPathGUI extends ilPluginControllerFormGUI */ protected function doesSetHaveQuestions($set) { - return count($set->getQuestionList()->getData()) > 0; + return is_array($set->getQuestionList()->getData()) ? count($set->getQuestionList()->getData()) > 0 : 0; } /** diff --git a/classes/controllers/class.ilQuestionSetPoolPathGraphGUI.php b/classes/controllers/class.ilQuestionSetPoolPathGraphGUI.php index 4b3fc8d52286fc0c3b854a001f4d760f5c2bbd8b..ff1b8d1cec4c1c30b62123e4048d9477a79f4145 100644 --- a/classes/controllers/class.ilQuestionSetPoolPathGraphGUI.php +++ b/classes/controllers/class.ilQuestionSetPoolPathGraphGUI.php @@ -51,7 +51,8 @@ class ilQuestionSetPoolPathGraphGUI extends ilPluginControllerGUI $model = new ilQuestionSetPoolPath($path['id']); $model->read(); $nodes = $model->getNodes()->getData(); - $num_nodes = count($nodes); + + $num_nodes = is_array($nodes) ? count($nodes): 0; for($i = 0; $i < $num_nodes; $i++) { $nodeId = 'Q' . $nodes[$i]['question_index']; @@ -73,7 +74,7 @@ class ilQuestionSetPoolPathGraphGUI extends ilPluginControllerGUI $model = new ilQuestionSetPoolPath($path['id']); $model->read(); $nodes = $model->getNodes()->getData(); - $num_nodes = count($nodes); + $num_nodes = is_array($nodes) ? count($nodes): 0; for($i = 0; $i < $num_nodes; $i++) { if(isset($nodes[$i + 1])) @@ -103,21 +104,21 @@ class ilQuestionSetPoolPathGraphGUI extends ilPluginControllerGUI { foreach($data_target as $node_target => $data_conditions) { - if(count($data_conditions['initial']) > 0) + if(is_array($data_conditions['initial']) && count($data_conditions['initial']) > 0) { $initial = join("\n", array_filter($data_conditions['initial'])); $edge = new Fhaculty\Graph\Edge\Directed($graph->getVertex($node_source), $graph->getVertex($node_target)); $edge->setAttribute('graphviz.color', 'darkgreen'); $edge->setAttribute('graphviz.label', $initial); } - if(count($data_conditions['jump']) > 0) + if(is_array($data_conditions['jump']) && count($data_conditions['jump']) > 0) { $jump = join("\n", array_filter($data_conditions['jump'])); $edge = new Fhaculty\Graph\Edge\Directed($graph->getVertex($node_source), $graph->getVertex($node_target)); $edge->setAttribute('graphviz.color', 'blue'); $edge->setAttribute('graphviz.label', $jump); } - if(count($data_conditions['end']) > 0) + if(is_array($data_conditions['end']) && count($data_conditions['end']) > 0) { $end = join("\n", array_filter($data_conditions['end'])); $edge = new Fhaculty\Graph\Edge\Directed($graph->getVertex($node_source), $graph->getVertex($node_target)); @@ -201,7 +202,7 @@ class ilQuestionSetPoolPathGraphGUI extends ilPluginControllerGUI $template->setVariable("QUESTION_INDEX", $node["question_index"]); $template->parseCurrentBlock(); - if (count($node["jump_conditions"]) > 0) + if (is_array($node["jump_conditions"]) && count($node["jump_conditions"]) > 0) { foreach ($node["jump_conditions"] as $jump_condition) { diff --git a/classes/controllers/class.ilQuestionSetPoolPathsGUI.php b/classes/controllers/class.ilQuestionSetPoolPathsGUI.php index 5e71fb0784b3240d4035ff6c414e979a06b72359..194c28da93ba4ceec4e369df77b004c8bfc03de7 100644 --- a/classes/controllers/class.ilQuestionSetPoolPathsGUI.php +++ b/classes/controllers/class.ilQuestionSetPoolPathsGUI.php @@ -36,7 +36,7 @@ class ilQuestionSetPoolPathsGUI extends ilPluginControllerTableGUI $set->read(); $table->setModelList($set->getPathList()); - $table->setTitle($set->getTitle() . " - " .$this->plugin->txt('paths')); + $table->setTitle($set->getTitle() . " - " . $this->plugin->txt('paths')); $table->addCommandButton("ilQuestionSetPoolPathsGUI.saveSorting", $this->plugin->txt("save_sorting")); $table->populate(); @@ -65,7 +65,7 @@ class ilQuestionSetPoolPathsGUI extends ilPluginControllerTableGUI $path = new ilQuestionSetPoolPath($path_id); $path->read(); - $data = $path->getSet()->getQuestionList()->getData(); + $data = $path->getSet()->getQuestionList()->getData(); $question_ids = array(); foreach($data as $element) { @@ -73,7 +73,7 @@ class ilQuestionSetPoolPathsGUI extends ilPluginControllerTableGUI } $title = $path->getTitle(); - $i = 2; + $i = 2; while(in_array($title . ' (' . $i . ')', $path_titles)) { $i++; @@ -164,15 +164,17 @@ class ilQuestionSetPoolPathsGUI extends ilPluginControllerTableGUI } $missing_perm_path_titles = array_filter($missing_perm_path_titles); - if(1 == count($missing_perm_path_titles)) + if(is_array($missing_perm_path_titles)) { - ilUtil::sendFailure(sprintf($this->plugin->txt('paths_del_perm_err_s'), implode(', ', $missing_perm_path_titles))); - } - else if(count($missing_perm_path_titles) > 1) - { - ilUtil::sendFailure(sprintf($this->plugin->txt('paths_del_perm_err_p'), implode(', ', $missing_perm_path_titles))); + if(1 == count($missing_perm_path_titles)) + { + ilUtil::sendFailure(sprintf($this->plugin->txt('paths_del_perm_err_s'), implode(', ', $missing_perm_path_titles))); + } + else if(count($missing_perm_path_titles) > 1) + { + ilUtil::sendFailure(sprintf($this->plugin->txt('paths_del_perm_err_p'), implode(', ', $missing_perm_path_titles))); + } } - if(!$num_items) { $this->listPaths(); @@ -229,15 +231,17 @@ class ilQuestionSetPoolPathsGUI extends ilPluginControllerTableGUI } $missing_perm_path_titles = array_filter($missing_perm_path_titles); - if(1 == count($missing_perm_path_titles)) + if(is_array($missing_perm_path_titles)) { - ilUtil::sendFailure(sprintf($this->plugin->txt('paths_del_perm_err_s'), implode(', ', $missing_perm_path_titles))); - } - else if(count($missing_perm_path_titles) > 1) - { - ilUtil::sendFailure(sprintf($this->plugin->txt('paths_del_perm_err_p'), implode(', ', $missing_perm_path_titles))); + if(1 == count($missing_perm_path_titles)) + { + ilUtil::sendFailure(sprintf($this->plugin->txt('paths_del_perm_err_s'), implode(', ', $missing_perm_path_titles))); + } + else if(count($missing_perm_path_titles) > 1) + { + ilUtil::sendFailure(sprintf($this->plugin->txt('paths_del_perm_err_p'), implode(', ', $missing_perm_path_titles))); + } } - $this->ctrl->setParameter($this->controller, 'set_id', $set->getId()); $this->redirect(__CLASS__ . '.listPaths'); } @@ -290,22 +294,23 @@ class ilQuestionSetPoolPathsGUI extends ilPluginControllerTableGUI $model->read(); $data = $model->getPathList()->getData(); - foreach ($data as $key => $element) + foreach($data as $key => $element) { $data[$key]["path_index"] = (int)$_POST["sorting"][$element["id"]]; } usort( - $data, function ($a, $b) - { - return $a["path_index"] - $b["path_index"]; - } + $data, function ($a, $b) { + return $a["path_index"] - $b["path_index"]; + } ); - - for ($i = 0; $i < count($data); $i++) + if(is_array($data)) { - $data[$i]["path_index"] = ($i + 1); - $model->getPathList()->update($data[$i]); + for($i = 0; $i < count($data); $i++) + { + $data[$i]["path_index"] = ($i + 1); + $model->getPathList()->update($data[$i]); + } } } -} +} \ No newline at end of file diff --git a/classes/controllers/class.ilQuestionSetPoolSetQuestionsGUI.php b/classes/controllers/class.ilQuestionSetPoolSetQuestionsGUI.php index b6ce6212c3b9008553bbe39873e444ba540d57b4..925179286fa5b8f623964ac10e04510908f4e0b2 100644 --- a/classes/controllers/class.ilQuestionSetPoolSetQuestionsGUI.php +++ b/classes/controllers/class.ilQuestionSetPoolSetQuestionsGUI.php @@ -136,24 +136,26 @@ class ilQuestionSetPoolSetQuestionsGUI extends ilPluginControllerTableGUI ilUtil::sendFailure($this->lng->txt('copy_no_questions_selected')); $this->listQuestions(); } - + $question_ids = array_filter((array)$_POST['q_id']); $set = new ilQuestionSetPoolSet((int)$_GET["set_id"]); $set->read(); $set->getQuestionList()->insert($question_ids, $this->controller->object); - - if(1 == count($question_ids)) - { - ilUtil::sendSuccess($this->plugin->txt('copy_questions_success_s'), true); - } - else + if(is_array($question_ids)) { - ilUtil::sendSuccess($this->plugin->txt('copy_questions_success_p'), true); + if(1 == count($question_ids)) + { + ilUtil::sendSuccess($this->plugin->txt('copy_questions_success_s'), true); + } + else + { + ilUtil::sendSuccess($this->plugin->txt('copy_questions_success_p'), true); + } + $this->redirect("ilQuestionSetPoolSetQuestionsGUI.listQuestions", array( + 'set_id' => (int)$_GET['set_id'] + )); } - $this->redirect("ilQuestionSetPoolSetQuestionsGUI.listQuestions", array( - 'set_id' => (int)$_GET['set_id'] - )); } /** @@ -220,7 +222,7 @@ class ilQuestionSetPoolSetQuestionsGUI extends ilPluginControllerTableGUI $model->read(); $model->getQuestionList()->remove($questions_to_delete); - if(count($questions_to_delete) == 1) + if(is_array($questions_to_delete) && count($questions_to_delete) == 1) { ilUtil::sendSuccess($this->plugin->txt('deleted_selected_questions_s'), true); } diff --git a/classes/controllers/class.ilQuestionSetPoolSetsGUI.php b/classes/controllers/class.ilQuestionSetPoolSetsGUI.php index 58957d0d269bc605279570bf1c3cb5c2f3a22d47..7e6510a340a166c8e086fbf0639a297e32d1674d 100644 --- a/classes/controllers/class.ilQuestionSetPoolSetsGUI.php +++ b/classes/controllers/class.ilQuestionSetPoolSetsGUI.php @@ -85,15 +85,17 @@ class ilQuestionSetPoolSetsGUI extends ilPluginControllerTableGUI } $missing_perm_nodes_titles = array_filter($missing_perm_nodes_titles); - if(1 == count($missing_perm_nodes_titles)) + if(is_array($missing_perm_nodes_titles)) { - ilUtil::sendFailure(sprintf($this->plugin->txt('sets_del_perm_err_s'), implode(', ', $missing_perm_nodes_titles))); - } - else if(count($missing_perm_nodes_titles) > 1) - { - ilUtil::sendFailure(sprintf($this->plugin->txt('sets_del_perm_err_p'), implode(', ', $missing_perm_nodes_titles))); + if(1 == count($missing_perm_nodes_titles)) + { + ilUtil::sendFailure(sprintf($this->plugin->txt('sets_del_perm_err_s'), implode(', ', $missing_perm_nodes_titles))); + } + else if(count($missing_perm_nodes_titles) > 1) + { + ilUtil::sendFailure(sprintf($this->plugin->txt('sets_del_perm_err_p'), implode(', ', $missing_perm_nodes_titles))); + } } - if(!$num_items) { $this->show(); @@ -146,15 +148,17 @@ class ilQuestionSetPoolSetsGUI extends ilPluginControllerTableGUI } $missing_perm_nodes_titles = array_filter($missing_perm_nodes_titles); - if(1 == count($missing_perm_nodes_titles)) + if(is_array($missing_perm_nodes_titles)) { - ilUtil::sendFailure(sprintf($this->plugin->txt('sets_del_perm_err_s'), implode(', ', $missing_perm_nodes_titles))); - } - else if(count($missing_perm_nodes_titles) > 1) - { - ilUtil::sendFailure(sprintf($this->plugin->txt('sets_del_perm_err_p'), implode(', ', $missing_perm_nodes_titles))); + if(1 == count($missing_perm_nodes_titles)) + { + ilUtil::sendFailure(sprintf($this->plugin->txt('sets_del_perm_err_s'), implode(', ', $missing_perm_nodes_titles))); + } + else if(count($missing_perm_nodes_titles) > 1) + { + ilUtil::sendFailure(sprintf($this->plugin->txt('sets_del_perm_err_p'), implode(', ', $missing_perm_nodes_titles))); + } } - $this->redirect(__CLASS__ . '.show'); } diff --git a/classes/models/class.ilQuestionPoolQuestionList.php b/classes/models/class.ilQuestionPoolQuestionList.php index 0743b5b4f0e667c00038ddeeb197e24a33aae6fd..7cb1992934c4aab7523e2af8179cf3f1f73cedf0 100644 --- a/classes/models/class.ilQuestionPoolQuestionList.php +++ b/classes/models/class.ilQuestionPoolQuestionList.php @@ -38,7 +38,7 @@ class ilQuestionPoolQuestionList extends ilPluginModelList $available_pools = array_keys(ilObjQuestionPool::_getAvailableQuestionpools(true,false, false, false, false)); - if(count($available_pools) == 0) + if(is_array($available_pools) && count($available_pools) == 0) { return null; } diff --git a/classes/tables/class.ilPluginTableGUI.php b/classes/tables/class.ilPluginTableGUI.php index 8e324bf9240d396ae26d2477fb618143008d7d6c..67f9e9682408b2b50a5f5484245fd9dbcbf46599 100644 --- a/classes/tables/class.ilPluginTableGUI.php +++ b/classes/tables/class.ilPluginTableGUI.php @@ -219,12 +219,15 @@ abstract class ilPluginTableGUI extends ilTable2GUI $data = $this->getModelList()->loadData($params, $filter); - if(!count($data['items']) && $this->getOffset() > 0 && $this->getExternalSegmentation()) + if(is_array($data['items'])) { - $this->resetOffset(); - $params['limit'] = $this->getLimit(); - $params['offset'] = $this->getOffset(); - $data = $this->getModelList()->loadData($params, $filter); + if(!count($data['items']) && $this->getOffset() > 0 && $this->getExternalSegmentation()) + { + $this->resetOffset(); + $params['limit'] = $this->getLimit(); + $params['offset'] = $this->getOffset(); + $data = $this->getModelList()->loadData($params, $filter); + } } if($data != null) @@ -235,7 +238,10 @@ abstract class ilPluginTableGUI extends ilTable2GUI $this->setData($data); if($this->getExternalSegmentation()) { - $this->setMaxCount(count($data)); + if(is_array($data)) + { + $this->setMaxCount(count($data)); + } } } } diff --git a/classes/tables/class.ilQuestionSetPoolNodeTableGUI.php b/classes/tables/class.ilQuestionSetPoolNodeTableGUI.php index 07390ea6ca0052c8abdb1a2a0649443bc7a6fcb6..a2037d29fbfc89ae7bedbf300258fcd18423fa88 100644 --- a/classes/tables/class.ilQuestionSetPoolNodeTableGUI.php +++ b/classes/tables/class.ilQuestionSetPoolNodeTableGUI.php @@ -214,13 +214,16 @@ class ilQuestionSetPoolNodeTableGUI extends ilPluginTableGUI $conditions .= $action->getHTML(); $conditions .= "
"; - if($key != count($row["jump_conditions"])-1) + if(is_array($row['jump_conditions'])) { - $conditions .= ' '; - } - else - { - $conditions .= ' '; + if($key != count($row["jump_conditions"]) - 1) + { + $conditions .= ' '; + } + else + { + $conditions .= ' '; + } } if($condition["repititions"] == null) @@ -231,7 +234,7 @@ class ilQuestionSetPoolNodeTableGUI extends ilPluginTableGUI $conditions .= $this->plugin->txt("repititions") . ": " . $condition["repititions"]; $conditions .= ""; } - if (count($row['jump_conditions'])) + if (is_array($row['jump_conditions']) && count($row['jump_conditions'])) { $row['jump_conditions'] = $conditions; } diff --git a/plugin.php b/plugin.php index ff53b3e013e8aba98e9ae75ac31ccb5350a7d8eb..3aa3b7627a886406f5ccd93f06a7eb9d5d28f1fa 100755 --- a/plugin.php +++ b/plugin.php @@ -7,10 +7,10 @@ * @author Thomas Joußen */ $id = "xqsp"; -$version = "5.0.3"; +$version = "6.0.0"; $ilias_min_version = "5.3.0"; -$ilias_max_version = "5.3.999"; +$ilias_max_version = "5.4.999"; $responsible = "Thomas Joußen"; $responsible_mail = "tjoussen@databay.de";