Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 20... Línea 20...
20
 
20
 
21
use core_plugin_manager;
21
use core_plugin_manager;
22
use MoodleQuickForm;
22
use MoodleQuickForm;
23
use stdClass;
23
use stdClass;
-
 
24
use core\output\notification;
24
use core\output\notification;
25
use core_reportbuilder\external\custom_report_audience_cards_exporter;
25
use core_reportbuilder\local\helpers\database;
26
use core_reportbuilder\local\helpers\database;
26
use core_reportbuilder\local\models\audience;
27
use core_reportbuilder\local\models\audience;
Línea 27... Línea 28...
27
use core_reportbuilder\report_access_exception;
28
use core_reportbuilder\exception\report_access_exception;
28
 
29
 
29
/**
30
/**
30
 * Audience base class
31
 * Audience base class
Línea 46... Línea 47...
46
     */
47
     */
47
    protected function __construct() {
48
    protected function __construct() {
48
    }
49
    }
Línea 49... Línea 50...
49
 
50
 
50
    /**
51
    /**
-
 
52
     * Creates an instance of audience type, with persistent. Typically by loading an existing record, however in the absence of
51
     * Loads an existing instance of audience with persistent
53
     * specified classname (in the case of {@see custom_report_audience_cards_exporter}) we create one based on the current class
52
     *
54
     *
53
     * @param int $id
55
     * @param int $id
54
     * @param null|stdClass $record
56
     * @param null|stdClass $record
55
     * @return self|null
57
     * @return self|null
56
     */
58
     */
57
    final public static function instance(int $id = 0, ?stdClass $record = null): ?self {
59
    final public static function instance(int $id = 0, ?stdClass $record = null): ?self {
-
 
60
        $persistent = new audience($id, $record);
58
        $persistent = new audience($id, $record);
61
 
59
        // Needed for get_audience_types() method.
62
        // Populate persistent classname automatically if not set (e.g. when not loading an existing instance).
60
        if (!$classname = $persistent->get('classname')) {
-
 
61
            // Use the called class name.
63
        if (!$classname = $persistent->get('classname')) {
62
            $classname = get_called_class();
64
            $classname = get_called_class();
63
            $persistent->set('classname', $classname);
65
            $persistent->set('classname', $classname);
Línea 64... Línea 66...
64
        }
66
        }