|
@@ -210,12 +210,13 @@ class Certificate extends Model
|
|
|
}
|
|
|
|
|
|
$params['hide_print_button'] = isset($params['hide_print_button']) ? true : false;
|
|
|
-
|
|
|
+ $categoryId = 0;
|
|
|
if (isset($this->certificate_data) && isset($this->certificate_data['cat_id'])) {
|
|
|
- $my_category = Category::load($this->certificate_data['cat_id']);
|
|
|
+ $categoryId = $this->certificate_data['cat_id'];
|
|
|
+ $my_category = Category::load($categoryId);
|
|
|
}
|
|
|
|
|
|
- if (isset($my_category[0]) &&
|
|
|
+ if (isset($my_category[0]) && !empty($categoryId) &&
|
|
|
$my_category[0]->is_certificate_available($this->user_id)
|
|
|
) {
|
|
|
$courseInfo = api_get_course_info($my_category[0]->get_course_code());
|
|
@@ -332,7 +333,7 @@ class Certificate extends Model
|
|
|
$my_new_content_html = str_replace(
|
|
|
'((certificate_barcode))',
|
|
|
Display::img(
|
|
|
- +$this->certification_web_user_path.$file_info['filename'].'_qr.png',
|
|
|
+ $this->certification_web_user_path.$file_info['filename'].'_qr.png',
|
|
|
'QR'
|
|
|
),
|
|
|
$content
|
|
@@ -457,9 +458,9 @@ class Certificate extends Model
|
|
|
$user_id,
|
|
|
$path_certificate
|
|
|
) {
|
|
|
- $table = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CERTIFICATE);
|
|
|
- $now = api_get_utc_datetime();
|
|
|
if (!UserManager::is_user_certified($cat_id, $user_id)) {
|
|
|
+ $table = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CERTIFICATE);
|
|
|
+ $now = api_get_utc_datetime();
|
|
|
$sql = 'UPDATE '.$table.' SET
|
|
|
path_certificate="'.Database::escape_string($path_certificate).'",
|
|
|
created_at = "'.$now.'"
|
|
@@ -656,7 +657,6 @@ class Certificate extends Model
|
|
|
0,
|
|
|
$this->user_id
|
|
|
);
|
|
|
-
|
|
|
if (empty($myCertificate)) {
|
|
|
GradebookUtils::registerUserInfoAboutCertificate(
|
|
|
0,
|