Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
b40524b
Fix error missing array key 'ref_id'
ingoj Apr 15, 2024
6ba1e41
Update last fix
ingoj Apr 18, 2024
59e872b
allow $usr_ids to be null
ingoj Apr 18, 2024
e174405
make $usr_ids array
ingoj Apr 18, 2024
afe6d7b
fix errors when selecting some users for printing
ingoj Apr 18, 2024
ca354b6
fix missing bracket
ingoj Apr 18, 2024
e5a5d37
fix error for empty fields
ingoj Apr 25, 2024
038bb8a
fix typo
ingoj Apr 25, 2024
baf92ab
fix for empty datasets
ingoj May 15, 2024
bcc370f
filter correct test if given when calling
ingoj May 15, 2024
5dbc15e
add parameter description
ingoj May 15, 2024
b460f82
add properties, getters and setters
ingoj May 15, 2024
12ebc1c
fix typos
ingoj May 15, 2024
6530bc8
add some data
ingoj May 15, 2024
9e7c96b
avoid duplicates in TableGUI
ingoj May 15, 2024
24f92d4
Update class.ilLearnObjectFinalTestStates.phpfix typo
ingoj May 15, 2024
aab5529
fix typo
ingoj May 15, 2024
cfa7468
prepare for multiple masterloks
ingoj May 16, 2024
eee3602
Video Conferences variable iass_states moved so it is available in 'A…
ChristofBuch Jul 16, 2024
0a5356d
Merge pull request #1 from kroepelin-projekte/fix-certification-print
ingoj Jul 18, 2024
b0c68a2
Fix printing with or without ementoring
ingoj Aug 15, 2024
70ca746
Add on screen messages to ResultGUI
ingoj Aug 15, 2024
a79ea8a
move on screen messages to resultGUI
ingoj Aug 15, 2024
6bf7d14
prepare additional columns for Table
ingoj Aug 22, 2024
2c96b7d
prepare additional columns for Table
ingoj Aug 22, 2024
b2e7b19
fix broken im age in pdf
ingoj Sep 10, 2024
0c656eb
fix sorting of resultu column
ingoj Sep 10, 2024
84fff8f
twisted lang vars
ingoj Sep 10, 2024
290369a
twisted lang var
ingoj Sep 10, 2024
90aca29
twisted lang var
ingoj Sep 10, 2024
00db450
fix if user has set illegal sortfield
ingoj Sep 10, 2024
2beb313
fix collection of data
ingoj Sep 12, 2024
6ca9c7c
fix collection of data
ingoj Sep 12, 2024
c713458
Merge branch 'release_8' into release_8_print_fixes
ingoj Sep 12, 2024
964987c
Merge pull request #2 from ingoj/release_8_print_fixes
ingoj Sep 12, 2024
9099857
fetch only MaLoks
ingoj Sep 24, 2024
5d55b3d
fix wrong return type of function
ingoj Sep 24, 2024
d647be0
Merge pull request #3 from ingoj/release_8_print_fixes
ingoj Oct 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions classes/CrsInitialTestState/class.ilCrsInitialTestStates.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
<?php
use srag\Plugins\UserDefaults\UserSearch\usrdefObj;
use SRAG\ILIAS\Plugins\LearningObjectiveSuggestions\Config;
use SRAG\ILIAS\Plugins\LearningObjectiveSuggestions\Config\ConfigProvider;

class ilCrsInitialTestStates {

/**
* @param array $arr_usr_ids
*
* @param int crsRefId (defaults to 0=
*
* @return ilCrsInitialTestState[]
*/
public static function getData(array $arr_usr_ids = array()): array
public static function getData(array $arr_usr_ids = array(), int $crsRefId = 0): array
{
global $DIC;
$ilDB = $DIC->database();
Expand All @@ -26,7 +29,9 @@ public static function getData(array $arr_usr_ids = array()): array
$crsitst_state->setCrsitestItestTries($row['crsitest_itest_tries']);
$crsitst_state->setCrsitestItestSubmitted($row['crsitest_itest_submitted']);

$crsitst_data[$row['crsitest_usr_id']] = $crsitst_state;
if (( $crsRefId == 0 ) || ( $crsRefId == (int) $row['crsitest_crs_ref_id'] )) {
$crsitst_data[$row['crsitest_usr_id']] = $crsitst_state;
}
}

return $crsitst_data;
Expand All @@ -36,6 +41,8 @@ protected static function getSQL(array $arr_usr_ids = array()): string
{
global $DIC;
$ilDB = $DIC->database();
$course_configs = new ConfigProvider();
$arr_malok_ids = $course_configs->getCourseRefIds();
$select = "SELECT test_act.user_fi as crsitest_usr_id,
crs_obj.obj_id as crsitest_crs_obj_id,
crs_obj.title as crsitest_crs_title,
Expand All @@ -53,10 +60,10 @@ protected static function getSQL(array $arr_usr_ids = array()): string
inner join " . usrdefObj::TABLE_NAME . " as itest_obj on itest_obj.obj_id = itest_ref.obj_id
inner join tst_tests as test on test.obj_fi = itest_obj.obj_id
inner join tst_active as test_act on test_act.test_fi = test.test_id
where loc_settings.itest is not null AND " . $ilDB->in('test_act.user_fi', $arr_usr_ids, false, 'integer');
where loc_settings.itest is not null AND " . $ilDB->in('crs_ref.ref_id', $arr_malok_ids, false, 'integer') . " AND " . $ilDB->in('test_act.user_fi', $arr_usr_ids, false, 'integer');

return $select;
}
}

?>
?>
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
<?php
class ilLearnObjectFinalTestState {
protected ?string $locftest_learn_objective_title;
protected ?string $locftest_learn_objective_title;
protected ?int $locftest_usr_id;
protected ?int $locftest_crs_obj_id = null;
protected ?int $locftest_master_crs_id = null;
protected ?string $locftest_master_crs_title;
protected ?string $locftest_crs_title;
protected ?int $locftest_objective_id = null;
protected ?string $locftest_objective_title;
protected ?int $locftest_master_objective_id = null;
protected ?int $locftest_test_ref_id = null;
protected ?int $locftest_test_obj_id = null;
protected ?string $locftest_test_title;
Expand All @@ -15,6 +18,16 @@ class ilLearnObjectFinalTestState {
protected bool $objectives_sug_completed;
protected bool $objectives_suggested;

public function getLocftestMasterObjectiveId(): ?int
{
return $this->locftest_master_objective_id;
}

public function setLocftestMasterObjectiveId ( ?int $locftest_master_objective_id ): void
{
$this->locftest_master_objective_id = $locftest_master_objective_id;
}

public function getLocftestLearnObjectiveTitle() : ?string
{
return $this->locftest_learn_objective_title;
Expand Down Expand Up @@ -77,15 +90,34 @@ public function setLocftestObjectiveTitle(?string $locftest_objective_title): vo
$this->locftest_objective_title = $locftest_objective_title;
}

public function getLocftestMasterCrsId(): ?int
{
return $this->locftest_master_crs_id;
}

public function setLocftestMasterCrsId(?int $locftest_master_crs_id): void
{
$this->locftest_master_crs_id = $locftest_master_crs_id;
}

public function getLocftestMasterCrsTitle() : ?string
{
return $this->locftest_master_crs_title;
}

public function setLocftestMasterCrsTitle(?string $locftest_master_crs_title): void
{
$this->locftest_master_crs_title = $locftest_master_crs_title;
}
public function getLocftestTestRefId(): ?int
{
return $this->locftest_test_ref_id;
}
{
return $this->locftest_test_ref_id;
}

public function setLocftestTestRefId(?int $locftest_test_ref_id): void
{
$this->locftest_test_ref_id = $locftest_test_ref_id;
}
{
$this->locftest_test_ref_id = $locftest_test_ref_id;
}

public function getLocftestTestObjId(): ?int
{
Expand Down Expand Up @@ -156,4 +188,4 @@ public function setObjectivesSuggested(bool $objectives_suggested): void
{
$this->objectives_suggested = $objectives_suggested;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ public static function getData(array $arr_usr_ids = array()): array
$locftst_state = new ilLearnObjectFinalTestState();
$locftst_state->setLocftestUsrId($row['usr_id']);
$locftst_state->setLocftestCrsObjId($row['learn_objective_crs_obj_id']);
$locftst_state->setLocftestLearnObjectiveTitle($row['learn_objective_title']);
$locftst_state->setLocftestLearnObjectiveTitle($row['learn_objective_title']);
$locftst_state->setLocftestCrsTitle($row['learn_objective_crs_title']);
$locftst_state->setLocftestObjectiveId($row['master_crs_objective_id']);
$locftst_state->setLocftestMasterObjectiveId($row['master_crs_objective_id']);
$locftst_state->setLocftestObjectiveId($row['crs_objective_id']);
$locftst_state->setLocftestObjectiveTitle($row['crs_objective_title']);
$locftst_state->setLocftestTestObjId($row['tst_obj_id']);
$locftst_state->setLocftestTestRefId($row['tst_ref_id']);
Expand All @@ -27,6 +28,8 @@ public static function getData(array $arr_usr_ids = array()): array
$locftst_state->setObjectivesSugCompleted($row['objectives_sug_completed']);
$locftst_state->setObjectivesSuggested($row['suggested']);
$locftst_state->setLocftestQplsRequiredPercentage($row['tst_req_percentage']);
$locftst_state->setLocftestMasterCrsId($row['master_crs_id']);
$locftst_state->setLocftestMasterCrsTitle($row['master_crs_title']);

$locftst_data[$row['usr_id']][$row['master_crs_objective_id']][] = $locftst_state;
}
Expand Down Expand Up @@ -121,4 +124,4 @@ public static function createTemporaryTableLearnObjectFinalTest(array $arr_usr_i

$ilDB->query($sql);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function setObjectiveAsPercentage(int $objective_as_percentage): void
$this->objective_as_percentage = $objective_as_percentage;
}

public function getObjectiveAsFractionString(): int
public function getObjectiveAsFractionString(): string
{
return $this->objective_as_fraction_string;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class ilParticipationCertificateMultipleResultGUI
/**
* @var int[]
*/
protected array $usr_ids;
protected ?array $usr_ids;
/**
* @var int
*/
Expand Down Expand Up @@ -106,4 +106,4 @@ protected function initTables(): void
$this->tables[] = new ilParticipationCertificateMultipleResultTableGUI($this, self::CMD_SHOW_ALL_RESULTS, $usr_id, $this->usr_ids);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function executeCommand(): void
}
}

public function generatePDF(bool $rendered, int $total_users): void
public function generatePDF(string $rendered, int $total_users): void
{
global $printCount, $tempFile;

Expand Down
74 changes: 37 additions & 37 deletions classes/Report/class.ilParticipationCertificateTwigParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class ilParticipationCertificateTwigParser {

protected \Twig\TemplateWrapper|Twig_TemplateWrapper $twig_template;

public function __construct(int $group_ref_id, array $twig_options, int $usr_id = null, bool $ementor = true, bool $edited = false, array|null $array = NULL) {
public function __construct(int $group_ref_id, array $twig_options, array $usr_id = null, bool $ementor = true, bool $edited = false, array|null $array = NULL) {
global $DIC;
$this->pl = ilParticipationCertificatePlugin::getInstance();
$this->tpl = $DIC->ui()->mainTemplate();
Expand All @@ -30,7 +30,7 @@ public function __construct(int $group_ref_id, array $twig_options, int $usr_id

$this->usr_id = $usr_id;
//wenn keine $usr_id übegeben wird, werden alle in der Gruppe gedruckt
if ($usr_id == NULL) {
if ($usr_id[0] == NULL || $usr_id == NULL) {
$this->usr_id = $this->usr_ids;
}
$this->ementor = $ementor;
Expand Down Expand Up @@ -165,47 +165,47 @@ public function parseData(): void
if (key_exists($usr_id, $arr_learn_sugg_results) && is_object($arr_learn_sugg_results[$usr_id])) {
$learn_sugg_result = $arr_learn_sugg_results[$usr_id]->getAveragePercentage(ilParticipationCertificateConfig::getConfig('calculation_type_processing_state_suggested_objectives',$_GET['ref_id']),true);
}
/*Video Conferences */
$countPassed = 0;
$countTests = 0;
if (key_exists($usr_id, $arr_new_iass_states) && is_array($arr_new_iass_states[$usr_id])) {
foreach ($arr_new_iass_states[$usr_id] as $item) {
$countPassed = $countPassed + $item->getPassed();
$countTests = $countTests + $item->getTotal();
}
}

if (key_exists($usr_id, $arr_xali_states) && is_object($arr_xali_states[$usr_id])) {
$countPassed = $countPassed + $arr_xali_states[$usr_id]->getPassed();
$countTests = $countTests + $arr_xali_states[$usr_id]->getTotal();
}

if($countTests > 0) {
$percentage = $countPassed / $countTests * 100;

switch ($countTests) {
case 1:
if ($countPassed == 1) {
$iass_states = "<img alt='' src=" . ILIAS_ABSOLUTE_PATH . substr($this->pl->getImagePath("passed_s.png"), 1) . ">";
} else {
$iass_states = "<img alt='' src=" . ILIAS_ABSOLUTE_PATH . substr($this->pl->getImagePath("failed_s.png"), 1) . ">";
}
break;
default:
$iass_states = $countPassed . "/" . $countTests;
break;
}
} else {
$iass_states = "<img alt='' src=" . ILIAS_ABSOLUTE_PATH . substr($this->pl->getImagePath("not_attempted_s.png"), 1) . ">";
}

//Home Work
$excercise_percentage = 0;
if (key_exists($usr_id, $arr_excercise_states) && is_object($arr_excercise_states[$usr_id])) {
$excercise_percentage = $arr_excercise_states[$usr_id]->getPassedPercentage();
}
}

/*Video Conferences */
$countPassed = 0;
$countTests = 0;
if (key_exists($usr_id, $arr_new_iass_states) && is_array($arr_new_iass_states[$usr_id])) {
foreach ($arr_new_iass_states[$usr_id] as $item) {
$countPassed = $countPassed + $item->getPassed();
$countTests = $countTests + $item->getTotal();
}
}

if (key_exists($usr_id, $arr_xali_states) && is_object($arr_xali_states[$usr_id])) {
$countPassed = $countPassed + $arr_xali_states[$usr_id]->getPassed();
$countTests = $countTests + $arr_xali_states[$usr_id]->getTotal();
}

if($countTests > 0) {
$percentage = $countPassed / $countTests * 100;

switch ($countTests) {
case 1:
if ($countPassed == 1) {
$iass_states = "<img alt='' src=" . ILIAS_ABSOLUTE_PATH . "/" . $this->pl->getImagePath("passed_s.png") . ">";
} else {
$iass_states = "<img alt='' src=" . ILIAS_ABSOLUTE_PATH . "/" . $this->pl->getImagePath("failed_s.png") . ">";
}
break;
default:
$iass_states = $countPassed . "/" . $countTests;
break;
}
} else {
$iass_states = "<img alt='' src=" . ILIAS_ABSOLUTE_PATH . "/" . $this->pl->getImagePath("not_attempted_s.png") . ">";
}

$arr_render = array(
'text_values' => $processed_arr_text_values,
'show_ementoring' => $this->ementor,
Expand Down Expand Up @@ -233,4 +233,4 @@ protected function loadTwig(): void
$loaded = true;
}
}
}
}
4 changes: 2 additions & 2 deletions classes/Score/NewLearningObjectiveScores.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ protected static function getSQL(int $usr_id): string
$select = "select * from " . LearningObjectiveScore::TABLE_NAME . "
inner join crs_objectives on " . LearningObjectiveScore::TABLE_NAME . ".objective_id = crs_objectives.objective_id
where user_id =" . $ilDB->quote($usr_id, "integer") . "
order by score DESC";
order by course_obj_id, score DESC";

return $select;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ public function parseData(): array
$arr_FinalTestsStates = ilLearnObjectFinalTestStates::getData([$this->usr_id]);
$usr_id = $this->usr_id;
$rec_array = array();
$processed = array();

if (count($arr_FinalTestsStates)) {

Expand All @@ -194,19 +195,28 @@ public function parseData(): array
*/

foreach($rec_final_tests as $key => $value) {
if ($value->getLocftestCrsObjId()) {
//first line - title lp
$rec_array[$row_key[$value->getLocftestCrsObjId()]][$value->getLocftestCrsObjId()] = $value->getLocftestObjectiveTitle();

$row_key[$value->getLocftestCrsObjId()] += 1;
//second line - array progressbar
$rec_array[$row_key[$value->getLocftestCrsObjId()]][$value->getLocftestCrsObjId()][0] = $value->getLocftestPercentage();
$rec_array[$row_key[$value->getLocftestCrsObjId()]][$value->getLocftestCrsObjId()][1] = $value->getLocftestQplsRequiredPercentage();
$rec_array[$row_key[$value->getLocftestCrsObjId()]][$value->getLocftestCrsObjId()][2] = 1;

$row_key[$value->getLocftestCrsObjId()] += 1;
}
}
if ($value->getLocftestCrsObjId()) {
// check if data already exists
$crs_obj_id = $value->getLocftestCrsObjId();
$crs_objective_id = $value->getLocftestObjectiveId();
if (isset($processed[$crs_obj_id])) {
if (isset($processed[$crs_obj_id][$crs_objective_id])) {
continue;
}
}
//first line - title lp
$rec_array[$row_key[$value->getLocftestCrsObjId()]][$value->getLocftestCrsObjId()] = $value->getLocftestObjectiveTitle();

$row_key[$value->getLocftestCrsObjId()] += 1;
//second line - array progressbar
$rec_array[$row_key[$value->getLocftestCrsObjId()]][$value->getLocftestCrsObjId()][0] = $value->getLocftestPercentage();
$rec_array[$row_key[$value->getLocftestCrsObjId()]][$value->getLocftestCrsObjId()][1] = $value->getLocftestQplsRequiredPercentage();
$rec_array[$row_key[$value->getLocftestCrsObjId()]][$value->getLocftestCrsObjId()][2] = 1;

$row_key[$value->getLocftestCrsObjId()] += 1;
$processed[$crs_obj_id][$crs_objective_id]=$usr_id;
}
}



Expand Down Expand Up @@ -255,7 +265,7 @@ public function fillRow(array $a_set): void
foreach ($this->getSelectableColumns() as $k => $v) {

if ($this->isColumnSelected($k)) {
if ($a_set[$k]) {
if (isset($a_set[$k])) {
$this->tpl->setCurrentBlock('td');
if (is_array($a_set[$k])) {

Expand Down
Loading