コード例 #1
0
    <?php 
/*
 * Add default values for new config settings
 */
require_once './Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/Certificate/classes/class.ilCertificatePlugin.php';
ilCertificateConfig::set(ilCertificateConfig::DATE_FORMAT, ilCertificatePlugin::DEFAULT_DATE_FORMAT);
ilCertificateConfig::set(ilCertificateConfig::DATETIME_FORMAT, ilCertificatePlugin::DEFAULT_DATETIME_FORMAT);
ilCertificateConfig::set(ilCertificateConfig::PATH_HOOK_CLASS, ilCertificatePlugin::DEFAULT_PATH_HOOK_CLASS);
ilCertificateConfig::set(ilCertificateConfig::ROLES_ADMINISTRATE_CERTIFICATES, ilCertificatePlugin::DEFAULT_ROLES_ADMINISTRATE_CERTIFICATES);
ilCertificateConfig::set(ilCertificateConfig::ROLES_ADMINISTRATE_CERTIFICATE_TYPES, ilCertificatePlugin::DEFAULT_ROLES_ADMINISTRATE_CERTIFICATE_TYPES);
?>
<#6>
    <?php 
// Update database schema, added created_at timestamp and active flag to certificates
require_once './Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/Certificate/classes/Certificate/class.srCertificate.php';
srCertificate::updateDB();
?>
<#7>
    <?php 
// Flag latest version of each certificate as active
require_once './Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/Certificate/classes/Certificate/class.srCertificate.php';
/** @var ilDB $ilDB */
$set = $ilDB->query('SELECT user_id, definition_id, MAX(file_version) AS max_file_version FROM cert_obj GROUP BY definition_id, user_id');
while ($row = $ilDB->fetchObject($set)) {
    /** @var srCertificate $cert */
    $cert = srCertificate::where(array('definition_id' => $row->definition_id, 'user_id' => $row->user_id, 'file_version' => $row->max_file_version))->first();
    if ($cert) {
        $cert->setActive(true);
        $cert->save();
    }
}