Minor - format code.

1.9.x
Julio Montoya 11 years ago
parent 31ab7c4c16
commit 9b8d08ea15
  1. 10
      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 {
$addparams['cidReq']='';
}
$no_qualification = false;
//here we are in a sub category
// Show certificate link.
if ($category != '0') {
$cat = new Category();
$category_id = intval($_GET['selectcat']);
@ -729,13 +731,13 @@ if ($category != '0') {
$show_message = $cat->show_message_resource_delete($course_id);
if ($show_message == '') {
//student
// Student
if (!api_is_allowed_to_edit()) {
$certificate_html = Category::register_user_certificate($category_id, $stud_id);
if ($certificate_html) {
echo $certificate_html;
}
} //end hack
}
}
}
@ -743,7 +745,7 @@ if (api_is_allowed_to_edit(null, true)) {
// Tool introduction
Display::display_introduction_section(TOOL_GRADEBOOK, array('ToolbarSet' => 'AssessmentsIntroduction'));
if ( (isset ($_GET['selectcat']) && $_GET['selectcat']<>0) ) {
if ( (isset ($_GET['selectcat']) && $_GET['selectcat']<>0)) {
//
} else {
if (((isset ($_GET['selectcat']) && $_GET['selectcat']==0) || ((isset($_GET['cidReq']) && $_GET['cidReq']!==''))) || isset($_GET['isStudentView']) && $_GET['isStudentView']=='false') {

@ -530,7 +530,8 @@ function parse_xml_data($file) {
* @param Datetime The date when you obtained the certificate
* @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);
$sql_exist = 'SELECT COUNT(*) as count FROM ' . $table_certificate . ' gc
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) {
$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) . '")';
$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
* @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);
$sql_get_date = 'SELECT * FROM ' . $table_certificate . ' WHERE cat_id="' . intval($cat_id) . '" AND user_id="' . intval($user_id) . '"';
$rs_get_date = Database::query($sql_get_date);
$row = Database::fetch_array($rs_get_date, 'ASSOC');
$sql = 'SELECT * FROM ' . $table_certificate . '
WHERE cat_id="' . intval($cat_id) . '" AND user_id="' . intval($user_id) . '"';
$result = Database::query($sql);
$row = Database::fetch_array($result, 'ASSOC');
return $row;
}

@ -2,6 +2,7 @@
/* For licensing terms, see /license.txt */
/**
* Certificate Class
* The certificates class is used to generate certificates from inside the
* gradebook tool.
* @package chamilo.library.certificates
@ -242,7 +243,10 @@ class Certificate extends Model
if (empty($this->certification_user_path)) {
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 false;

Loading…
Cancel
Save