ILIAS  release_8 Revision v8.24
PRGUpdateCompletionByMigration Class Reference
+ Inheritance diagram for PRGUpdateCompletionByMigration:
+ Collaboration diagram for PRGUpdateCompletionByMigration:

Public Member Functions

 getLabel ()
 
 getDefaultAmountOfStepsPerRun ()
 
 getPreconditions (Environment $environment)
 
 prepare (Environment $environment)
 
 step (Environment $environment)
 
 getRemainingAmountOfSteps ()
 

Private Attributes

const DEFAULT_AMOUNT_OF_STEPS = 10000
 
ilDBInterface $db
 
mixed $io
 

Detailed Description

Definition at line 25 of file class.PRGUpdateCompletionByMigration.php.

Member Function Documentation

◆ getDefaultAmountOfStepsPerRun()

PRGUpdateCompletionByMigration::getDefaultAmountOfStepsPerRun ( )

◆ getLabel()

PRGUpdateCompletionByMigration::getLabel ( )

Definition at line 35 of file class.PRGUpdateCompletionByMigration.php.

35 : string
36 {
37 return "Update 'Completion By' for Course(References)";
38 }

◆ getPreconditions()

◆ getRemainingAmountOfSteps()

PRGUpdateCompletionByMigration::getRemainingAmountOfSteps ( )

Definition at line 80 of file class.PRGUpdateCompletionByMigration.php.

80 : int
81 {
82 $query = 'SELECT count(completion_by) AS cnt FROM prg_usr_progress' . PHP_EOL
83 . 'JOIN object_data ON prg_usr_progress.completion_by = object_data.obj_id' . PHP_EOL
84 . 'WHERE object_data.type = "crsr"';
85
86 $result = $this->db->query($query);
87 $row = $this->db->fetchAssoc($result);
88 return (int) $row['cnt'];
89 }
$query

References $query.

◆ prepare()

PRGUpdateCompletionByMigration::prepare ( Environment  $environment)

Definition at line 54 of file class.PRGUpdateCompletionByMigration.php.

54 : void
55 {
56 $this->db = $environment->getResource(Setup\Environment::RESOURCE_DATABASE);
57 }
getResource(string $id)
Consumers of this method should check if the result is what they expect, e.g.

References ILIAS\Setup\Environment\getResource().

+ Here is the call graph for this function:

◆ step()

PRGUpdateCompletionByMigration::step ( Environment  $environment)
Exceptions
Exception

Definition at line 62 of file class.PRGUpdateCompletionByMigration.php.

62 : void
63 {
64 $query = 'SELECT assignment_id, prg_id, usr_id, completion_by, target_obj_id FROM prg_usr_progress' . PHP_EOL
65 . 'JOIN object_data ON prg_usr_progress.completion_by = object_data.obj_id' . PHP_EOL
66 . 'JOIN container_reference ON object_data.obj_id = container_reference.obj_id' . PHP_EOL
67 . 'WHERE object_data.type = "crsr" LIMIT 1';
68 $result = $this->db->query($query);
69 $row = $this->db->fetchAssoc($result);
70
71 $crs_id = $row['target_obj_id'];
72
73 $query = "UPDATE prg_usr_progress SET completion_by = " . $crs_id . PHP_EOL
74 . "WHERE assignment_id =" . $row['assignment_id'] . PHP_EOL
75 . "AND prg_id =" . $row['prg_id'] . PHP_EOL
76 . "AND usr_id =" . $row['usr_id'];
77 $this->db->manipulate($query);
78 }

References $query.

Field Documentation

◆ $db

ilDBInterface PRGUpdateCompletionByMigration::$db
private

Definition at line 28 of file class.PRGUpdateCompletionByMigration.php.

◆ $io

mixed PRGUpdateCompletionByMigration::$io
private

Definition at line 33 of file class.PRGUpdateCompletionByMigration.php.

◆ DEFAULT_AMOUNT_OF_STEPS

const PRGUpdateCompletionByMigration::DEFAULT_AMOUNT_OF_STEPS = 10000
private

The documentation for this class was generated from the following file: