Skip to content

Commit

Permalink
Merge pull request #70 from ilifau/dev54
Browse files Browse the repository at this point in the history
3.1.5
  • Loading branch information
Jesús Copado committed Aug 26, 2019
2 parents c133505 + b5ffff7 commit 72cc494
Show file tree
Hide file tree
Showing 14 changed files with 233 additions and 174 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,8 @@ Now all feedback Types are always displayed in the authoring interface also if n

Version 3.1.4 (2019-08-23) for ILIAS 5.4
----------------------------------------
This version includes support for PHP 7.2 in ILIAS 5.4 platform, during the process of update this plugin some ILIAS core bugs were found (e.g. importing question pools), those non-STACk related bugs can make the experience of using the plugin in a PHP 7.2 installation not smooth as intended, if you find any bugs in a PHP 7.2 platform, please report it in Mantis.
This version includes support for PHP 7.2 in ILIAS 5.4 platform, during the process of update this plugin some ILIAS core bugs were found (e.g. importing question pools), those non-STACk related bugs can make the experience of using the plugin in a PHP 7.2 installation not smooth as intended, if you find any bugs in a PHP 7.2 platform, please report it in Mantis.

Version 3.1.5 (2019-08-26) for ILIAS 5.4
----------------------------------------
Some bugs in PHP 7.2 installations has been solved.
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ public function addInputs()
$inputs_section_header->setTitle($this->getPlugin()->txt('inputs'));
$this->getForm()->addItem($inputs_section_header);

if (sizeof($this->getQuestionGUI()->object->getInputs()))
if (!empty($this->getQuestionGUI()->object->getInputs()))
{
//In case of edition
foreach ($this->getQuestionGUI()->object->getInputs() as $input_name => $input)
Expand All @@ -256,7 +256,7 @@ public function addPRTs()
{
$prts = new ilTabsFormPropertyGUI($this->getPlugin()->txt('prts'), "question_prts", 12, FALSE);

if (sizeof($this->getQuestionGUI()->object->getPotentialResponsesTrees()))
if (!empty($this->getQuestionGUI()->object->getPotentialResponsesTrees()))
{
foreach ($this->getQuestionGUI()->object->getPotentialResponsesTrees() as $prt_name => $prt)
{
Expand Down Expand Up @@ -755,7 +755,7 @@ public function getNodesPart(assStackQuestionPRT $prt, $container_width = "")
$nodes = new ilTabsFormPropertyGUI($this->getPlugin()->txt('prt_nodes'), 'prt_' . $prt->getPRTName() . '_nodes', $container_width, FALSE);

$q_nodes = $prt->getPRTNodes();
if (sizeof($q_nodes))
if (!empty($q_nodes))
{
foreach ($q_nodes as $node)
{
Expand All @@ -768,7 +768,7 @@ public function getNodesPart(assStackQuestionPRT $prt, $container_width = "")
}
}
//Add tab per node in the current PRT
if (sizeof($q_nodes))
if (!empty($q_nodes))
{
foreach ($q_nodes as $node)
{
Expand Down Expand Up @@ -1123,7 +1123,7 @@ public function manageErrorMessages()

if (isset($_SESSION["stack_authoring_errors"][$this->getQuestionGUI()->object->getId()]))
{
if (sizeof($_SESSION["stack_authoring_errors"][$this->getQuestionGUI()->object->getId()]))
if (!empty($_SESSION["stack_authoring_errors"][$this->getQuestionGUI()->object->getId()]))
{
foreach ($_SESSION["stack_authoring_errors"][$this->getQuestionGUI()->object->getId()] as $session_error)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ private function getQuestionNotesForSeeds()
$q_note = $deployed_seed->getQuestionNote();
$include = TRUE;

if (sizeof($valid_seeds))
if (!empty($valid_seeds))
{
foreach ($valid_seeds as $valid_seed)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function __construct(ilassStackQuestionPlugin $plugin, $feedback_data, $specific
//Set feedback data
$this->setFeedback($feedback_data);

if (sizeof($this->getFeedback('prt')) > 1)
if (!empty($this->getFeedback('prt')))
{
$this->show_user_response = TRUE;
} else
Expand Down
2 changes: 1 addition & 1 deletion classes/GUI/test/class.assStackQuestionTestGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public function showUnitTestsPanel($a_mode = FALSE)
$toolbar->addButtonInstance($run_all_tests);
$toolbar->setFormAction($ctrl->getLinkTargetByClass("assSTACKQuestionGUI"));

if (sizeof($this->getTests()))
if (!empty($this->getTests()))
{
include_once './Services/Accordion/classes/class.ilAccordionGUI.php';
$unit_tests_accordion = new ilAccordionGUI();
Expand Down
18 changes: 9 additions & 9 deletions classes/class.assStackQuestion.php
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,7 @@ public function saveAdditionalQuestionDataToDb($edit_question = "", $adding_to_t
}

//INPUTS
if (sizeof($this->inputs))
if (!empty($this->inputs))
{
foreach ($this->inputs as $input)
{
Expand All @@ -897,7 +897,7 @@ public function saveAdditionalQuestionDataToDb($edit_question = "", $adding_to_t
}

//POTENTIAL RESPONSE TREES
if (sizeof($this->potential_responses_trees))
if (!empty($this->potential_responses_trees))
{
foreach ($this->potential_responses_trees as $prt)
{
Expand Down Expand Up @@ -992,7 +992,7 @@ function beforeSyncWithOriginal($origQuestionId, $dupQuestionId, $origParentObjI
}

//Inputs
if (sizeof($this->inputs))
if (!empty($this->inputs))
{
$inputs = assStackQuestionInput::_read($origQuestionId);

Expand Down Expand Up @@ -1025,7 +1025,7 @@ function beforeSyncWithOriginal($origQuestionId, $dupQuestionId, $origParentObjI
}

//PRT
if (sizeof($this->potential_responses_trees))
if (!empty($this->potential_responses_trees))
{
$prts = assStackQuestionPRT::_read($origQuestionId);

Expand Down Expand Up @@ -1125,7 +1125,7 @@ function beforeCopy($origQuestionId)
}

//Inputs
if (sizeof($this->inputs))
if (!empty($this->inputs))
{
foreach ($this->inputs as $key => $input)
{
Expand All @@ -1138,7 +1138,7 @@ function beforeCopy($origQuestionId)
}

//PRT
if (sizeof($this->potential_responses_trees))
if (!empty($this->potential_responses_trees))
{

foreach ($this->potential_responses_trees as $prt_key => $prt)
Expand Down Expand Up @@ -1240,7 +1240,7 @@ public function loadFromDb($question_id)
//load inputs
$this->getPlugin()->includeClass('model/ilias_object/class.assStackQuestionInput.php');
$this->setInputs(assStackQuestionInput::_read($question_id));
if (sizeof($this->getInputs()) == 0)
if (empty($this->getInputs()))
{
//Create options
$input = new assStackQuestionInput(-1, $question_id, "ans1", "algebraic", "");
Expand Down Expand Up @@ -1793,7 +1793,7 @@ public function getQuestionSeedForCurrentTestRun($active_id, $pass)
}

//Determine if seed already exists and return it;
if (sizeof($this->getPotentialResponsesTrees()))
if (!empty($this->getPotentialResponsesTrees()))
{
foreach ($this->getPotentialResponsesTrees() as $prt)
{
Expand All @@ -1819,7 +1819,7 @@ public function getQuestionSeedForCurrentTestRun($active_id, $pass)

//get seed and save it to DB
$question_seed = $this->getStackQuestion()->getSeed();
if (sizeof($this->getPotentialResponsesTrees()))
if (!empty($this->getPotentialResponsesTrees()))
{
foreach ($this->getPotentialResponsesTrees() as $prt)
{
Expand Down
34 changes: 22 additions & 12 deletions classes/class.assStackQuestionGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -277,26 +277,33 @@ public function deletionManagement()

public function checkPRTForDeletion(assStackQuestionPRT $prt)
{
if (sizeof($this->object->getPotentialResponsesTrees()) < 2)
if (is_array($this->object->getPotentialResponsesTrees()))
{
$this->object->setErrors($this->object->getPlugin()->txt('deletion_error_not_enought_prts'));
if (sizeof($this->object->getPotentialResponsesTrees()) < 2)
{
$this->object->setErrors($this->object->getPlugin()->txt('deletion_error_not_enought_prts'));

return TRUE;
return TRUE;
}
}


return FALSE;
}

public function checkPRTNodeForDeletion(assStackQuestionPRT $prt, assStackQuestionPRTNode $node)
{

if (sizeof($prt->getPRTNodes()) < 2)
if (is_array($prt->getPRTNodes()))
{
$this->object->setErrors($this->object->getPlugin()->txt('deletion_error_not_enought_prt_nodes'));
if (sizeof($prt->getPRTNodes()) < 2)
{
$this->object->setErrors($this->object->getPlugin()->txt('deletion_error_not_enought_prt_nodes'));

return TRUE;
return TRUE;
}
}


if ((int)$prt->getFirstNodeName() == (int)$node->getNodeName())
{
$this->object->setErrors($this->object->getPlugin()->txt('deletion_error_first_node'));
Expand Down Expand Up @@ -343,11 +350,14 @@ public function writeQuestionSpecificPostData()
} else
{
//If doesn' exist, check if must be deleted
if (sizeof($this->object->getInputs()) < 2)
if (is_array($this->object->getInputs()))
{
//If there are less than two inputs you cannot delete it
//Add placeholder to question text
$this->object->setQuestion($this->object->getQuestion() . " [[input:{$input_name}]] [[validation:{$input_name}]]");
if (sizeof($this->object->getInputs()) < 2)
{
//If there are less than two inputs you cannot delete it
//Add placeholder to question text
$this->object->setQuestion($this->object->getQuestion() . " [[input:{$input_name}]] [[validation:{$input_name}]]");
}
} else
{
//Delete input from object
Expand Down Expand Up @@ -934,11 +944,11 @@ public function getSpecificFeedbackOutput($userSolution)
/**
* Returns the answer generic feedback depending on the results of the question
*
* @deprecated Use getGenericFeedbackOutput instead.
* @param integer $active_id Active ID of the user
* @param integer $pass Active pass
* @return string HTML Code with the answer specific feedback
* @access public
* @deprecated Use getGenericFeedbackOutput instead.
*/
function getAnswerFeedbackOutput($active_id, $pass)
{
Expand Down
Loading

0 comments on commit 72cc494

Please sign in to comment.