Minor - format code.

1.9.x
Julio Montoya 11 years ago
parent 31ab7c4c16
commit 9b8d08ea15
  1. 8
      main/gradebook/index.php
  2. 15
      main/gradebook/lib/gradebook_functions.inc.php
  3. 6
      main/inc/lib/certificate.lib.php

@ -719,9 +719,11 @@ if (isset($_GET['cidReq']) && $_GET['cidReq']!='') {
} else { } else {
$addparams['cidReq']=''; $addparams['cidReq']='';
} }
$no_qualification = false; $no_qualification = false;
//here we are in a sub category // Show certificate link.
if ($category != '0') { if ($category != '0') {
$cat = new Category(); $cat = new Category();
$category_id = intval($_GET['selectcat']); $category_id = intval($_GET['selectcat']);
@ -729,13 +731,13 @@ if ($category != '0') {
$show_message = $cat->show_message_resource_delete($course_id); $show_message = $cat->show_message_resource_delete($course_id);
if ($show_message == '') { if ($show_message == '') {
//student // Student
if (!api_is_allowed_to_edit()) { if (!api_is_allowed_to_edit()) {
$certificate_html = Category::register_user_certificate($category_id, $stud_id); $certificate_html = Category::register_user_certificate($category_id, $stud_id);
if ($certificate_html) { if ($certificate_html) {
echo $certificate_html; echo $certificate_html;
} }
} //end hack }
} }
} }

@ -530,7 +530,8 @@ function parse_xml_data($file) {
* @param Datetime The date when you obtained the certificate * @param Datetime The date when you obtained the certificate
* @return void() * @return void()
*/ */
function register_user_info_about_certificate($cat_id, $user_id, $score_certificate, $date_certificate) { function register_user_info_about_certificate($cat_id, $user_id, $score_certificate, $date_certificate)
{
$table_certificate = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CERTIFICATE); $table_certificate = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CERTIFICATE);
$sql_exist = 'SELECT COUNT(*) as count FROM ' . $table_certificate . ' gc $sql_exist = 'SELECT COUNT(*) as count FROM ' . $table_certificate . ' gc
WHERE gc.cat_id="' . intval($cat_id) . '" AND user_id="' . intval($user_id) . '" '; WHERE gc.cat_id="' . intval($cat_id) . '" AND user_id="' . intval($user_id) . '" ';
@ -539,7 +540,7 @@ function register_user_info_about_certificate($cat_id, $user_id, $score_certific
if ($row['count'] == 0) { if ($row['count'] == 0) {
$sql = 'INSERT INTO ' . $table_certificate . ' (cat_id,user_id,score_certificate,created_at) $sql = 'INSERT INTO ' . $table_certificate . ' (cat_id,user_id,score_certificate,created_at)
VALUES("' . intval($cat_id) . '","' . intval($user_id) . '","' . Database::escape_string($score_certificate) . '","' . Database::escape_string($date_certificate) . '")'; VALUES("' . intval($cat_id) . '","' . intval($user_id) . '","' . Database::escape_string($score_certificate) . '","' . Database::escape_string($date_certificate) . '")';
$rs = Database::query($sql); Database::query($sql);
} }
} }
@ -549,11 +550,13 @@ function register_user_info_about_certificate($cat_id, $user_id, $score_certific
* @param int The user id * @param int The user id
* @return Datetime The date when you obtained the certificate * @return Datetime The date when you obtained the certificate
*/ */
function get_certificate_by_user_id($cat_id, $user_id) { function get_certificate_by_user_id($cat_id, $user_id)
{
$table_certificate = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CERTIFICATE); $table_certificate = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CERTIFICATE);
$sql_get_date = 'SELECT * FROM ' . $table_certificate . ' WHERE cat_id="' . intval($cat_id) . '" AND user_id="' . intval($user_id) . '"'; $sql = 'SELECT * FROM ' . $table_certificate . '
$rs_get_date = Database::query($sql_get_date); WHERE cat_id="' . intval($cat_id) . '" AND user_id="' . intval($user_id) . '"';
$row = Database::fetch_array($rs_get_date, 'ASSOC'); $result = Database::query($sql);
$row = Database::fetch_array($result, 'ASSOC');
return $row; return $row;
} }

@ -2,6 +2,7 @@
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
/** /**
* Certificate Class
* The certificates class is used to generate certificates from inside the * The certificates class is used to generate certificates from inside the
* gradebook tool. * gradebook tool.
* @package chamilo.library.certificates * @package chamilo.library.certificates
@ -242,7 +243,10 @@ class Certificate extends Model
if (empty($this->certification_user_path)) { if (empty($this->certification_user_path)) {
return false; return false;
} }
if (!empty($this->certificate_data) && isset($this->certificate_data['path_certificate']) && !empty($this->certificate_data['path_certificate'])) { if (!empty($this->certificate_data) &&
isset($this->certificate_data['path_certificate']) &&
!empty($this->certificate_data['path_certificate'])
) {
return true; return true;
} }
return false; return false;

Loading…
Cancel
Save