Skip to content

Commit

Permalink
Merge pull request #19 from ILIAS-eLearning/trunk
Browse files Browse the repository at this point in the history
Trunk fixes
  • Loading branch information
bogenschlag committed Sep 18, 2015
2 parents aa06e57 + 7b9d3e5 commit fe63cc4
Show file tree
Hide file tree
Showing 12 changed files with 97 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function init()
$this->addColumn($this->lng->txt("tst_qst_order"),'order', '');
$this->addColumn($this->lng->txt("tst_question_title"),'title', '');

if( $this->isShowObligationsEnabled() )
if( false && $this->isShowObligationsEnabled() )
{
$this->addColumn($this->lng->txt("obligatory"), 'obligatory', '');
}
Expand All @@ -85,9 +85,10 @@ public function init()
$this->addColumn($this->lng->txt("tst_maximum_points"),'points', '');
}

$this->addColumn($this->lng->txt("worked_through"),'worked_through', '');
#$this->addColumn($this->lng->txt("worked_through"),'worked_through', '');
$this->addColumn($this->lng->txt("answered"),'answered', '');

if( $this->isShowObligationsEnabled() )
if( false && $this->isShowObligationsEnabled() )
{
$this->addColumn($this->lng->txt("answered"),'answered', '');
}
Expand Down Expand Up @@ -146,7 +147,7 @@ public function fillRow($data)
$this->tpl->touchBlock('marker');
}
}
if( $this->isShowObligationsEnabled() )
if( false && $this->isShowObligationsEnabled() )
{
// obligatory answer status
$value = ' ';
Expand Down
7 changes: 5 additions & 2 deletions Modules/TestQuestionPool/classes/class.assFormulaQuestion.php
Original file line number Diff line number Diff line change
Expand Up @@ -960,11 +960,14 @@ public function calculateReachedPointsFromPreviewSession(ilAssQuestionPreviewSes
$points = 0;
foreach($this->getResults() as $result)
{
$v = isset($user_solution[$result->getResult()]) ? $user_solution[$result->getResult()] : null;
$u = isset($user_solution[$result->getResult().'_unit']) ? $user_solution[$result->getResult().'_unit'] : null;

$points += $result->getReachedPoints(
$this->getVariables(),
$this->getResults(),
$user_solution[$result->getResult()],
$user_solution[$result->getResult().'_unit'],
$v,
$u,
$this->unitrepository->getUnits());
}

Expand Down
27 changes: 23 additions & 4 deletions Modules/TestQuestionPool/classes/class.assMultipleChoiceGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -372,15 +372,34 @@ function getSolutionOutput(
{
if (strcmp($mc_solution, $answer_id) == 0)
{
$template->setVariable("SOLUTION_IMAGE", ilUtil::getHtmlPath(ilUtil::getImagePath("checkbox_checked.png")));
$template->setVariable("SOLUTION_ALT", $this->lng->txt("checked"));
if( isset($_GET['pdf']) && $_GET['pdf'] )
{
$template->setVariable("SOLUTION_IMAGE", ilUtil::getHtmlPath(ilUtil::getImagePath("checkbox_checked.png")));
$template->setVariable("SOLUTION_ALT", $this->lng->txt("checked"));
}
else
{
$template->setVariable('QID', $this->object->getId());
$template->setVariable('SUFFIX', $show_correct_solution ? 'bestsolution' : 'usersolution');
$template->setVariable('SOLUTION_VALUE', $answer_id);
$template->setVariable('SOLUTION_CHECKED', 'checked');
}
$checked = TRUE;
}
}
if (!$checked)
{
$template->setVariable("SOLUTION_IMAGE", ilUtil::getHtmlPath(ilUtil::getImagePath("checkbox_unchecked.png")));
$template->setVariable("SOLUTION_ALT", $this->lng->txt("unchecked"));
if( isset($_GET['pdf']) && $_GET['pdf'] )
{
$template->setVariable("SOLUTION_IMAGE", ilUtil::getHtmlPath(ilUtil::getImagePath("checkbox_unchecked.png")));
$template->setVariable("SOLUTION_ALT", $this->lng->txt("unchecked"));
}
else
{
$template->setVariable('QID', $this->object->getId());
$template->setVariable('SUFFIX', $show_correct_solution ? 'bestsolution' : 'usersolution');
$template->setVariable('SOLUTION_VALUE', $answer_id);
}
}
$template->parseCurrentBlock();
}
Expand Down
25 changes: 20 additions & 5 deletions Modules/TestQuestionPool/classes/class.assSingleChoiceGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -288,16 +288,31 @@ function getSolutionOutput(
}
$template->setCurrentBlock("answer_row");
$template->setVariable("ANSWER_TEXT", $this->object->prepareTextareaOutput($answer->getAnswertext(), TRUE));
if (strcmp($user_solution, $answer_id) == 0)

if( isset($_GET['pdf']) && $_GET['pdf'] )
{
$template->setVariable("SOLUTION_IMAGE", ilUtil::getHtmlPath(ilUtil::getImagePath("radiobutton_checked.png")));
$template->setVariable("SOLUTION_ALT", $this->lng->txt("checked"));
if (strcmp($user_solution, $answer_id) == 0)
{
$template->setVariable("SOLUTION_IMAGE", ilUtil::getHtmlPath(ilUtil::getImagePath("radiobutton_checked.png")));
$template->setVariable("SOLUTION_ALT", $this->lng->txt("checked"));
}
else
{
$template->setVariable("SOLUTION_IMAGE", ilUtil::getHtmlPath(ilUtil::getImagePath("radiobutton_unchecked.png")));
$template->setVariable("SOLUTION_ALT", $this->lng->txt("unchecked"));
}
}
else
{
$template->setVariable("SOLUTION_IMAGE", ilUtil::getHtmlPath(ilUtil::getImagePath("radiobutton_unchecked.png")));
$template->setVariable("SOLUTION_ALT", $this->lng->txt("unchecked"));
$template->setVariable('QID', $this->object->getId());
$template->setVariable('SUFFIX', $show_correct_solution ? 'bestsolution' : 'usersolution');
$template->setVariable('SOLUTION_VALUE', $answer_id);
if (strcmp($user_solution, $answer_id) == 0)
{
$template->setVariable('SOLUTION_CHECKED', 'checked');
}
}

if ($result_output)
{
$points = $this->object->answers[$answer_id]->getPoints();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
<!-- BEGIN answer_row -->
<tr>
<td class="middle" width="15">
<!-- BEGIN solution_image -->
<img src="{SOLUTION_IMAGE}" alt="{SOLUTION_ALT}" title="{SOLUTION_ALT}" />
<!-- END solution_image -->
<!-- BEGIN solution_field -->
<input type="checkbox" name="multiple_choice_result_q{QID}_{SUFFIX}" value="{SOLUTION_VALUE}" readonly disabled {SOLUTION_CHECKED} />
<!-- END solution_field -->
</td>
<td class="middle">
<!-- BEGIN answer_image -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
<!-- BEGIN answer_row -->
<tr>
<td class="middle" width="15">
<!-- BEGIN solution_image -->
<img src="{SOLUTION_IMAGE}" alt="{SOLUTION_ALT}" title="{SOLUTION_ALT}" />
<!-- END solution_image -->
<!-- BEGIN solution_field -->
<input type="radio" name="multiple_choice_result_q{QID}_{SUFFIX}" value="{SOLUTION_VALUE}" readonly disabled {SOLUTION_CHECKED} />
<!-- END solution_field -->
</td>
<td class="middle">
<!-- BEGIN answer_image -->
Expand Down
19 changes: 19 additions & 0 deletions Services/Calendar/classes/class.ilTimeZone.php
Original file line number Diff line number Diff line change
Expand Up @@ -318,5 +318,24 @@ public static function _getDefaultTimeZone()
}
return self::$default_timezone = self::UTC;
}

/**
* Initialize default timezone from system settings
* @return bool
*/
public static function initDefaultTimeZone(ilIniFile $ini)
{
$tz = $ini->readVariable('server','timezone');
if(!strlen($tz))
{
$tz = self::_getDefaultTimeZone();
}
if(!strlen($tz))
{
$tz = 'UTC';
}
date_default_timezone_set($tz);
return $tz;
}
}
?>
3 changes: 3 additions & 0 deletions Services/Init/classes/class.ilIniFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

/**
* INIFile Parser
*
* Early access in init proceess!
* Avoid further dependencies like logging or other services
*
* Description:
*
Expand Down
13 changes: 4 additions & 9 deletions Services/Init/classes/class.ilInitialisation.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,15 +156,9 @@ protected static function initIliasIniFile()
break;
}

$tz = $ilIliasIniFile->readVariable("server","timezone");
if ($tz != "")
{
if (function_exists('date_default_timezone_set'))
{
date_default_timezone_set($tz);
}
}
define ("IL_TIMEZONE", $ilIliasIniFile->readVariable("server","timezone"));
include_once './Services/Calendar/classes/class.ilTimeZone.php';
$tz = ilTimeZone::initDefaultTimeZone($ilIliasIniFile);
define ("IL_TIMEZONE", $tz);
}

/**
Expand Down Expand Up @@ -573,6 +567,7 @@ public static function initUserAccount()
// init console log handler
include_once './Services/Logging/classes/public/class.ilLoggerFactory.php';
ilLoggerFactory::getInstance()->initUser($ilUser->getLogin());
ilLoggerFactory::getRootLogger()->debug('Using default timezone: '. IL_TIMEZONE);
}
else
{
Expand Down
21 changes: 0 additions & 21 deletions setup/classes/class.ilSetupGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -2787,16 +2787,6 @@ function updateDatabase()
include_once "./Services/Xml/classes/class.ilSaxParser.php";
include_once "./Services/Object/classes/class.ilObjectDefinition.php";

// #9019: init timezone
$tz = $this->setup->ini->readVariable("server","timezone");
if ($tz != "")
{
if (function_exists('date_default_timezone_set'))
{
date_default_timezone_set($tz);
}
define ("IL_TIMEZONE", $tz);
}

// referencing db handler in language class
$ilDB = $this->setup->getClient()->db;
Expand Down Expand Up @@ -3677,17 +3667,6 @@ function reloadControlStructure()
return;
}

// init timezone
$tz = $this->setup->ini->readVariable("server","timezone");
if ($tz != "")
{
if (function_exists('date_default_timezone_set'))
{
date_default_timezone_set($tz);
}
define ("IL_TIMEZONE", $tz);
}

// referencing does not work in dbupdate-script
$GLOBALS["ilDB"] = $this->setup->getClient()->getDB();
// BEGIN WebDAV
Expand Down
8 changes: 7 additions & 1 deletion setup/include/inc.setup_header.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,13 @@
define ('ILIAS_ABSOLUTE_PATH',str_replace("/setup/include", "", dirname(__FILE__)));
}

// set default timezone
include_once './Services/Calendar/classes/class.ilTimeZone.php';
include_once './Services/Init/classes/class.ilIniFile.php';
$ini = new ilIniFile(ILIAS_ABSOLUTE_PATH.'/ilias.ini.php');
$ini->read();
$tz = ilTimeZone::initDefaultTimeZone($ini);
define('IL_TIMEZONE',$tz);

define ("TPLPATH","./templates/blueshadow");

Expand Down Expand Up @@ -130,7 +137,6 @@
$log = ilLoggerFactory::newInstance($logging_settings)->getComponentLogger('setup');
$ilLog = $log;


// init template - in the main program please use ILIAS Template class
// instantiate main template
//$tpl = new ilTemplate("./setup/templates");
Expand Down
2 changes: 1 addition & 1 deletion setup/sql/dbupdate_04.php
Original file line number Diff line number Diff line change
Expand Up @@ -8151,7 +8151,7 @@
$ilDB->execute($ps_up_tree_entry, array($right, $right, $usr_id));
$ilDB->execute($ps_in_tree_entry, array($usr_id, $folder_id, $root_id, $lft, $rgt, 2));
$GLOBALS['ilLog']->write(sprintf(
"DB Step %s, iteration %s: Created node with id %s (lft: %s | rgt: %s) for user % in 'mail_tree'.",
"DB Step %s, iteration %s: Created node with id %s (lft: %s | rgt: %s) for user %s in 'mail_tree'.",
$db_step, $i, $folder_id, $lft, $rgt, $usr_id
));

Expand Down

0 comments on commit fe63cc4

Please sign in to comment.