Minor - format code.

remotes/angel/1.11.x
jmontoyaa 8 years ago
parent e3bbb08d9c
commit 33a2f013ca
  1. 18
      main/attendance/attendance_add.php
  2. 27
      main/attendance/attendance_calendar.php
  3. 26
      main/attendance/attendance_controller.php
  4. 29
      main/attendance/attendance_edit.php
  5. 2
      main/attendance/attendance_list.php
  6. 4
      main/attendance/attendance_sheet.php
  7. 1
      main/attendance/calendar_logins.php
  8. 2
      main/attendance/index.php
  9. 28
      main/auth/courses_controller.php
  10. 15
      main/inc/lib/CourseChatUtils.php
  11. 3
      main/inc/lib/GamificationUtils.php
  12. 11
      main/inc/lib/auth.lib.php
  13. 3962
      main/inc/lib/blog.lib.php
  14. 20
      main/inc/lib/career.lib.php
  15. 1
      main/inc/lib/certificate.lib.php
  16. 28
      main/inc/lib/chat.lib.php
  17. 1
      main/inc/lib/conditional_login.class.php
  18. 100
      main/inc/lib/course_category.lib.php
  19. 32
      main/inc/lib/course_description.lib.php
  20. 415
      main/inc/lib/dashboard.lib.php
  21. 3
      main/inc/lib/diagnoser.lib.php
  22. 4
      main/inc/lib/events_email.class.php
  23. 5
      main/inc/lib/exercise.lib.php
  24. 19
      main/inc/lib/glossary.lib.php
  25. 19
      main/inc/lib/grade_model.lib.php
  26. 6
      main/inc/lib/gradebook.lib.php

@ -37,24 +37,34 @@ $form->addHtmlEditor(
array('ToolbarSet' => 'TrainingDescription', 'Width' => '100%', 'Height' => '150')
);
// Adavanced Parameters
// Advanced Parameters
if ((api_get_session_id() != 0 && Gradebook::is_active()) || api_get_session_id() == 0) {
$form->addButtonAdvancedSettings('id_qualify');
$form->addElement('html','<div id="id_qualify_options" style="display:none">');
// Qualify Attendance for gradebook option
$form->addElement('checkbox', 'attendance_qualify_gradebook', '', get_lang('QualifyAttendanceGradebook'),'onclick="javascript: if(this.checked){document.getElementById(\'options_field\').style.display = \'block\';}else{document.getElementById(\'options_field\').style.display = \'none\';}"');
$form->addElement(
'checkbox',
'attendance_qualify_gradebook',
'',
get_lang('QualifyAttendanceGradebook'),
'onclick="javascript: if(this.checked){document.getElementById(\'options_field\').style.display = \'block\';}else{document.getElementById(\'options_field\').style.display = \'none\';}"'
);
$form->addElement('html','<div id="options_field" style="display:none">');
GradebookUtils::load_gradebook_select_in_tool($form);
$form->addElement('text', 'attendance_qualify_title', get_lang('TitleColumnGradebook'));
$form->applyFilter('attendance_qualify_title', 'html_filter');
$form->addElement('text', 'attendance_weight', get_lang('QualifyWeight'),'value="0.00" Style="width:40px" onfocus="javascript: this.select();"');
$form->addElement(
'text',
'attendance_weight',
get_lang('QualifyWeight'),
'value="0.00" Style="width:40px" onfocus="javascript: this.select();"'
);
$form->applyFilter('attendance_weight', 'html_filter');
$form->addElement('html','</div>');
$form->addElement('html','</div>');
}
$form->addButtonCreate(get_lang('Save'));

@ -46,7 +46,6 @@ if (isset($error_checkdate) && $error_checkdate) {
Display::display_error_message($message, false);
}
if (isset($action) && $action == 'calendar_add') {
$groupList = GroupManager::get_group_list(null, null, 1);
$groupIdList = array('--');
@ -62,13 +61,11 @@ if (isset($action) && $action == 'calendar_add') {
''
);
$form->addElement('header', get_lang('AddADateTime'));
//$form->addElement('date_time_picker', 'date_time');
$form->addDateTimePicker(
'date_time',
array(get_lang('StartDate')),
array('id' => 'date_time')
);
'date_time',
array(get_lang('StartDate')),
array('id' => 'date_time')
);
$defaults['date_time'] = date('Y-m-d H:i', api_strtotime(api_get_local_time()));
@ -97,7 +94,12 @@ if (isset($action) && $action == 'calendar_add') {
);
$form->addElement('select', 'repeat_type', get_lang('RepeatType') , $a_repeat_type);
$form->addElement('date_picker', 'end_date_time', get_lang('RepeatEnd'), array('form_name'=>'attendance_calendar_add'));
$form->addElement(
'date_picker',
'end_date_time',
get_lang('RepeatEnd'),
array('form_name'=>'attendance_calendar_add')
);
$defaults['end_date_time'] = date('Y-m-d');
$form->addElement('html', '</div>');
@ -123,7 +125,7 @@ if (isset($action) && $action == 'calendar_add') {
foreach ($attendance_calendar as $calendar) {
echo '<li class="list-group-item">';
if ((isset($action) && $action == 'calendar_edit') &&
if ((isset($action) && $action === 'calendar_edit') &&
(isset($calendar_id) && $calendar_id == $calendar['id'])
) {
// calendar edit form
@ -134,7 +136,12 @@ if (isset($action) && $action == 'calendar_add') {
'index.php?action=calendar_edit&attendance_id=' . $attendance_id . '&calendar_id=' . $calendar_id . '&' . api_get_cidreq(),
''
);
$form->addDateTimePicker('date_time', array(get_lang('Date')), array('form_name'=>'attendance_calendar_edit'), 5);
$form->addDateTimePicker(
'date_time',
array(get_lang('Date')),
array('form_name'=>'attendance_calendar_edit'),
5
);
$defaults['date_time'] = $calendar['date_time'];
$form->addButtonSave(get_lang('Save'));
$form->addButtonCancel(get_lang('Cancel'), 'cancel');

@ -50,8 +50,7 @@ class AttendanceController
$attendance = new Attendance();
$data = array();
if (strtoupper($_SERVER['REQUEST_METHOD']) == "POST") {
if (strtoupper($_SERVER['REQUEST_METHOD']) == 'POST') {
if (!empty($_POST['title'])) {
$check = Security::check_token();
if ($check) {
@ -95,8 +94,7 @@ class AttendanceController
$data = array();
$attendance_id = intval($attendance_id);
if (strtoupper($_SERVER['REQUEST_METHOD']) == "POST") {
if (strtoupper($_SERVER['REQUEST_METHOD']) == 'POST') {
if (!empty($_POST['title'])) {
$check = Security::check_token();
if ($check) {
@ -112,7 +110,7 @@ class AttendanceController
) {
$link_to_gradebook = true;
}
$attendance->attendance_edit($attendance_id,$link_to_gradebook);
$attendance->attendance_edit($attendance_id, $link_to_gradebook);
Security::clear_token();
header('location:index.php?action=attendance_list&'.api_get_cidreq());
exit;
@ -203,7 +201,6 @@ class AttendanceController
$this->attendance_list();
}
/**
* Restores an attendance entry and fallback to attendances rendering
* @param int $attendance_id
@ -223,8 +220,8 @@ class AttendanceController
/**
* Lock or unlock an attendance
* render to attendance_list view
* @param string action (lock_attendance or unlock_attendance)
* @param int attendance id
* @param string $action (lock_attendance or unlock_attendance)
* @param int $attendance_id
* render to attendance_list view
*/
public function lock_attendance($action, $attendance_id)
@ -301,7 +298,7 @@ class AttendanceController
$data['next_attendance_calendar_id'] = $attendance->get_next_attendance_calendar_id($attendance_id);
$data['next_attendance_calendar_datetime'] = $attendance->get_next_attendance_calendar_datetime($attendance_id);
if (strtoupper($_SERVER['REQUEST_METHOD']) == "POST") {
if (strtoupper($_SERVER['REQUEST_METHOD']) == 'POST') {
if (isset($_POST['hidden_input'])) {
foreach ($_POST['hidden_input'] as $cal_id) {
$users_present = array();
@ -408,7 +405,7 @@ class AttendanceController
$action = 'calendar_list';
}
}
} else if ($action == 'calendar_edit') {
} else if ($action === 'calendar_edit') {
$data['calendar_id'] = $calendar_id;
if (strtoupper($_SERVER['REQUEST_METHOD']) == "POST") {
if (!isset($_POST['cancel'])) {
@ -507,9 +504,7 @@ class AttendanceController
}
// Get data table
$data_table = array();
$head_table = array('#', get_lang('Name'));
foreach ($data_array['attendant_calendar'] as $class_day) {
$head_table[] =
@ -529,12 +524,13 @@ class AttendanceController
$result['full_name'] = api_get_person_name($user['firstname'], $user['lastname']);
foreach ($data_array['attendant_calendar'] as $class_day) {
if ($class_day['done_attendance'] == 1) {
if ($data_users_presence[$user['user_id']][$class_day['id']]['presence'] == 1)
if ($data_users_presence[$user['user_id']][$class_day['id']]['presence'] == 1) {
$result[$class_day['id']] = get_lang('UserAttendedSymbol');
else
} else {
$result[$class_day['id']] = '<span style="color:red">'.get_lang('UserNotAttendedSymbol').'</span>';
}
} else {
$result[$class_day['id']] = " ";
$result[$class_day['id']] = ' ';
}
$cols++;
}

@ -31,7 +31,7 @@ $form->addElement('hidden', 'sec_token', $token);
$form->addElement('hidden', 'attendance_id', $attendance_id);
$form->addText('title', get_lang('Title'), true);
$form->applyFilter('title','html_filter');
$form->applyFilter('title', 'html_filter');
$form->addHtmlEditor(
'description',
get_lang('Description'),
@ -50,21 +50,38 @@ if (Gradebook::is_active()) {
if (!empty($attendance_qualify_title) || !empty($attendance_weight)) {
$form->addButtonAdvancedSettings('id_qualify');
$form->addElement('html','<div id="id_qualify_options" style="display:block">');
$form->addElement('checkbox', 'attendance_qualify_gradebook', '', get_lang('QualifyAttendanceGradebook'),array('checked'=>'true','onclick'=>'javascript: if(this.checked){document.getElementById(\'options_field\').style.display = \'block\';}else{document.getElementById(\'options_field\').style.display = \'none\';}'));
$form->addElement(
'checkbox',
'attendance_qualify_gradebook',
'',
get_lang('QualifyAttendanceGradebook'),
array('checked'=>'true','onclick'=>'javascript: if(this.checked){document.getElementById(\'options_field\').style.display = \'block\';}else{document.getElementById(\'options_field\').style.display = \'none\';}')
);
$form->addElement('html','<div id="options_field" style="display:block">');
} else {
$form->addButtonAdvancedSettings('id_qualify');
$form->addElement('html','<div id="id_qualify_options" style="display:none">');
$form->addElement('checkbox', 'attendance_qualify_gradebook', '', get_lang('QualifyAttendanceGradebook'),'onclick="javascript: if(this.checked){document.getElementById(\'options_field\').style.display = \'block\';}else{document.getElementById(\'options_field\').style.display = \'none\';}"');
$form->addElement(
'checkbox',
'attendance_qualify_gradebook',
'',
get_lang('QualifyAttendanceGradebook'),
'onclick="javascript: if(this.checked){document.getElementById(\'options_field\').style.display = \'block\';}else{document.getElementById(\'options_field\').style.display = \'none\';}"'
);
$form->addElement('html','<div id="options_field" style="display:none">');
}
GradebookUtils::load_gradebook_select_in_tool($form);
$form->addElement('text', 'attendance_qualify_title', get_lang('TitleColumnGradebook'));
$form->applyFilter('attendance_qualify_title', 'html_filter');
$form->addElement('text', 'attendance_weight', get_lang('QualifyWeight'),'value="0.00" Style="width:40px" onfocus="javascript: this.select();"');
$form->addElement(
'text',
'attendance_weight',
get_lang('QualifyWeight'),
'value="0.00" Style="width:40px" onfocus="javascript: this.select();"'
);
$form->applyFilter('attendance_weight', 'html_filter');
$form->addElement('html','</div>');
$form->addElement('html','</div>');
$form->addElement('html', '</div>');
$form->addElement('html', '</div>');
}
$form->addButtonUpdate(get_lang('Save'));

@ -13,7 +13,7 @@ api_protect_course_script(true);
if (api_is_allowed_to_edit(null, true)) {
echo '<div class="actions">';
echo '<a href="index.php?'.api_get_cidreq().'&action=attendance_add">'.
Display::return_icon('new_attendance_list.png', get_lang('CreateANewAttendance'),'',ICON_SIZE_MEDIUM).'</a>';
Display::return_icon('new_attendance_list.png', get_lang('CreateANewAttendance'), '', ICON_SIZE_MEDIUM).'</a>';
echo '</div>';
}
$attendance = new Attendance();

@ -74,8 +74,6 @@ if (api_is_allowed_to_edit(null, true) ||
['id' => 'filter_id', 'onchange' => 'submit();']
);
//$form->addElement('select', 'filter', get_lang('Filter'), $values, array('id' => 'filter_id'));
$groupList = GroupManager::get_group_list(null, null, 1);
$groupIdList = array('--');
foreach ($groupList as $group) {
@ -442,7 +440,7 @@ if (api_is_allowed_to_edit(null, true) ||
$i = 0;
foreach ($users_presence[$user_id] as $presence) {
$class = '';
if ($i%2==0) {
if ($i % 2 == 0) {
$class = 'row_even';
} else {
$class = 'row_odd';

@ -6,6 +6,5 @@ echo '<div class="actions">';
echo '<a href="index.php?'.api_get_cidreq().'&action=calendar_list">'.
Display::return_icon('back.png',get_lang('AttendanceCalendar'),'',ICON_SIZE_MEDIUM).'</a>';
echo '</div>';
echo $form;
echo $table;

@ -9,9 +9,7 @@
* @package chamilo.attendance
*/
// including files
require_once '../inc/global.inc.php';
require_once 'attendance_controller.php';
require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/fe/exportgradebook.php';

@ -165,8 +165,14 @@ class CoursesController
* @param $limit
* @param boolean $justVisible Whether to search only in courses visibles in the catalogue
*/
public function search_courses($search_term, $message = '', $error = '', $content = null, $limit = array(), $justVisible = false)
{
public function search_courses(
$search_term,
$message = '',
$error = '',
$content = null,
$limit = array(),
$justVisible = false
) {
$data = array();
$limit = !empty($limit) ? $limit : CourseCategory::getLimitArray();
@ -264,8 +270,8 @@ class CoursesController
/**
* Change course category
* render to listing view
* @param string Course code
* @param int Category id
* @param string $course_code
* @param int $category_id
*/
public function change_course_category($course_code, $category_id)
{
@ -283,9 +289,9 @@ class CoursesController
/**
* Move up/down courses inside a category
* render to listing view
* @param string move to up or down
* @param string Course code
* @param int Category id
* @param string $move move to up or down
* @param string $course_code
* @param int $category_id Category id
*/
public function move_course($move, $course_code, $category_id)
{
@ -300,8 +306,8 @@ class CoursesController
/**
* Move up/down categories
* render to listing view
* @param string move to up or down
* @param int Category id
* @param string $move move to up or down
* @param int $category_id Category id
*/
public function move_category($move, $category_id)
{
@ -316,8 +322,8 @@ class CoursesController
/**
* Edit course category
* render to listing view
* @param string Category title
* @param int Category id
* @param string $title Category title
* @param int $category Category id
*/
public function edit_course_category($title, $category)
{

@ -2,6 +2,7 @@
/* For licensing terms, see /license.txt */
use Michelf\MarkdownExtra;
use Doctrine\Common\Collections\Criteria;
/**
* Class CourseChat
@ -23,10 +24,10 @@ class CourseChatUtils
*/
public function __construct($courseId, $userId, $sessionId = 0, $groupId = 0)
{
$this->courseId = intval($courseId);
$this->userId = intval($userId);
$this->sessionId = intval($sessionId);
$this->groupId = intval($groupId);
$this->courseId = (int) $courseId;
$this->userId = (int) $userId;
$this->sessionId = (int) $sessionId;
$this->groupId = (int) $groupId;
}
/**
@ -42,10 +43,7 @@ class CourseChatUtils
$course = $em->find('ChamiloCoreBundle:Course', $this->courseId);
if ($this->sessionId) {
$criteria = \Doctrine\Common\Collections\Criteria::create()
->where(
\Doctrine\Common\Collections\Criteria::expr()->eq("course", $course)
);
$criteria = Criteria::create()->where(Criteria::expr()->eq("course", $course));
return $em
->find('ChamiloCoreBundle:Session', $this->sessionId)
@ -1506,7 +1504,6 @@ class CourseChatUtils
public function getFileName($absolute = false, $friendId = 0)
{
$date = date('Y-m-d');
$base = 'messages-' . $date . '.log.html';
if ($this->groupId && !$friendId) {

@ -9,7 +9,6 @@
*/
class GamificationUtils
{
/**
* Get the calculated points on session with gamification mode
* @param int $userId The user ID
@ -26,6 +25,7 @@ class GamificationUtils
);
if (empty($sessions)) {
return 0;
}
@ -222,5 +222,4 @@ class GamificationUtils
return round($progress / count($sessions), 2);
}
}

@ -406,7 +406,7 @@ class Auth
* @param boolean $justVisible search only on visible courses in the catalogue
* @return array An array containing a list of all the courses matching the the search term.
*/
public function search_courses($search_term, $limit, $justVisible=false)
public function search_courses($search_term, $limit, $justVisible = false)
{
$courseTable = Database::get_main_table(TABLE_MAIN_COURSE);
$extraFieldTable = Database :: get_main_table(TABLE_EXTRA_FIELD);
@ -434,7 +434,7 @@ class Auth
$without_special_courses = ' AND course.code NOT IN (' . implode(',', $special_course_list) . ')';
}
$visibilityCondition = ($justVisible?CourseManager::getCourseVisibilitySQLCondition('course'):'');
$visibilityCondition = $justVisible ? CourseManager::getCourseVisibilitySQLCondition('course') : '';
$search_term_safe = Database::escape_string($search_term);
$sql_find = "SELECT * FROM $courseTable
@ -503,7 +503,7 @@ class Auth
/**
* unsubscribe the user from a given course
* @param string Course code
* @param string $course_code
* @return bool True if it success
*/
public function remove_user_from_course($course_code)
@ -678,8 +678,7 @@ class Auth
$em = Database::getManager();
$qb = $em->createQueryBuilder();
$_sessions = $qb->select('s')
->from('ChamiloCoreBundle:Session', 's');
$_sessions = $qb->select('s')->from('ChamiloCoreBundle:Session', 's');
if (!empty($limit)) {
$_sessions->setFirstResult($limit['start'])
@ -788,12 +787,10 @@ SQL;
->getResult();
$sessionsToBrowse = [];
foreach ($sessions as $session) {
if ($session->getNbrCourses() === 0) {
continue;
}
$sessionsToBrowse[] = $session;
}

File diff suppressed because it is too large Load Diff

@ -21,7 +21,7 @@ class Career extends Model
*/
public function __construct()
{
$this->table = Database::get_main_table(TABLE_CAREER);
$this->table = Database::get_main_table(TABLE_CAREER);
}
/**
@ -77,8 +77,10 @@ class Career extends Model
public function display()
{
echo '<div class="actions" style="margin-bottom:20px">';
echo '<a href="career_dashboard.php">'.Display::return_icon('back.png',get_lang('Back'),'','32').'</a>';
echo '<a href="'.api_get_self().'?action=add">'.Display::return_icon('new_career.png',get_lang('Add'),'','32').'</a>';
echo '<a href="career_dashboard.php">'.
Display::return_icon('back.png', get_lang('Back'), '', ICON_SIZE_MEDIUM).'</a>';
echo '<a href="'.api_get_self().'?action=add">'.
Display::return_icon('new_career.png', get_lang('Add'), '', ICON_SIZE_MEDIUM).'</a>';
echo '</div>';
echo Display::grid_html('careers');
}
@ -88,7 +90,10 @@ class Career extends Model
*/
public function get_status_list()
{
return array(CAREER_STATUS_ACTIVE => get_lang('Unarchived'), CAREER_STATUS_INACTIVE => get_lang('Archived'));
return array(
CAREER_STATUS_ACTIVE => get_lang('Unarchived'),
CAREER_STATUS_INACTIVE => get_lang('Archived')
);
}
/**
@ -110,7 +115,6 @@ class Career extends Model
$form->addElement('header', $header);
$id = isset($_GET['id']) ? intval($_GET['id']) : '';
$form->addElement('hidden', 'id', $id);
$form->addElement('text', 'name', get_lang('Name'), array('size' => '70'));
$form->addHtmlEditor(
'description',
@ -184,10 +188,10 @@ class Career extends Model
if ($copy_promotions) {
//Now also copy each session of the promotion as a new session and register it inside the promotion
$promotion = new Promotion();
$promo_list = $promotion->get_all_promotions_by_career_id($id);
$promo_list = $promotion->get_all_promotions_by_career_id($id);
if (!empty($promo_list)) {
foreach($promo_list as $item) {
$pid = $promotion->copy($item['id'], $cid, true);
foreach ($promo_list as $item) {
$promotion->copy($item['id'], $cid, true);
}
}
}

@ -47,7 +47,6 @@ class Certificate extends Model
public function __construct($certificate_id = 0, $userId = 0)
{
$this->table = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CERTIFICATE);
$this->user_id = !empty($userId) ? $userId : api_get_user_id();
if (!empty($certificate_id)) {

@ -3,7 +3,7 @@
/**
* Class Chat
*
* @todo ChamiloSession instead of $_SESSION
* @package chamilo.library.chat
*/
class Chat extends Model
@ -18,6 +18,7 @@ class Chat extends Model
*/
public function __construct()
{
parent::__construct();
$this->table = Database::get_main_table(TABLE_MAIN_CHAT);
$this->window_list = $_SESSION['window_list'] = isset($_SESSION['window_list']) ? $_SESSION['window_list'] : array();
}
@ -26,7 +27,7 @@ class Chat extends Model
* Get user chat status
* @return int 0 if disconnected, 1 if connected
*/
function get_user_status()
public function get_user_status()
{
$status = UserManager::get_extra_user_data_by_field(
api_get_user_id(),
@ -100,7 +101,8 @@ class Chat extends Model
foreach ($rows as $chat) {
$chat['message'] = Security::remove_XSS($chat['message']);
$item = array('s' => '0',
$item = array(
's' => '0',
'f' => $from_user_id,
'm' => $chat['message'],
'username' => $user_info['complete_name'],
@ -141,9 +143,6 @@ class Chat extends Model
WHERE to_user = '".$to_user_id."' AND recd = 0";
Database::query($sql);
if ($items != '') {
//$items = substr($items, 0, -1);
}
echo json_encode(array('items' => $items));
}
@ -181,6 +180,7 @@ class Chat extends Model
* @param string $message Message
* @param boolean $printResult Optional. Whether print the result
* @param boolean $sanitize Optional. Whether sanitize the message
*
* @return void Prints "1"
*/
public function send(
@ -189,8 +189,7 @@ class Chat extends Model
$message,
$printResult = true,
$sanitize = true
)
{
) {
$user_friend_relation = SocialManager::get_relation_between_contacts(
$from_user_id,
$to_user_id
@ -208,12 +207,11 @@ class Chat extends Model
$messagesan = $message;
}
error_log(print_r($sanitize) . '----' . $messagesan);
if (!isset($_SESSION['chatHistory'][$to_user_id])) {
$_SESSION['chatHistory'][$to_user_id] = array();
}
$item = array("s" => "1",
$item = array(
"s" => "1",
"f" => $from_user_id,
"m" => $messagesan,
"username" => get_lang('Me')
@ -274,7 +272,7 @@ class Chat extends Model
return $text;
}
/**
* SET Disable Chat
* @param boolean status to disable chat
@ -284,7 +282,7 @@ class Chat extends Model
{
$_SESSION['disable_chat'] = $status;
}
/**
* Disable Chat - disable the chat
* @return boolean - return true if setDisableChat status is true
@ -298,10 +296,10 @@ class Chat extends Model
return true;
}
}
return false;
}
public function is_chat_blocked_by_exercises()
{
if (isset($_SESSION['current_exercises'])) {

@ -8,7 +8,6 @@
*/
class ConditionalLogin
{
/**
* Check conditions based in the $login_conditions see conditional_login.php file
* @param type $user

@ -60,7 +60,7 @@ class CourseCategory
$parentIdCondition = " AND (t1.parent_id IS NULL OR t1.parent_id = '' )";
if (!empty($category)) {
$parentIdCondition = " AND t1.parent_id = '$category' ";
$parentIdCondition = " AND t1.parent_id = '$category' ";
}
$sql = "SELECT
@ -90,8 +90,8 @@ class CourseCategory
$result = Database::query($sql);
$categories = Database::store_result($result);
foreach ($categories as $category) {
$category['nbr_courses'] = 1;
foreach ($categories as &$categoryItem) {
$categoryItem['nbr_courses'] = 1;
}
return $categories;
@ -328,7 +328,8 @@ class CourseCategory
{
$tbl_category = Database::get_main_table(TABLE_MAIN_CATEGORY);
$categoryCode = Database::escape_string($categoryCode);
$result = Database::query("SELECT code, id FROM $tbl_category WHERE parent_id = '$categoryCode'");
$sql = "SELECT code, id FROM $tbl_category WHERE parent_id = '$categoryCode'";
$result = Database::query($sql);
$children = array();
while ($row = Database::fetch_array($result, 'ASSOC')) {
$children[] = $row;
@ -426,10 +427,10 @@ class CourseCategory
$moveUrl = $mainUrl.'&id='.$category['code'].'&action=moveUp&tree_pos='.$category['tree_pos'];
$deleteUrl = $mainUrl.'&id='.$category['code'].'&action=delete';
$actions = Display::url($editIcon, $editUrl).Display::url($moveIcon, $moveUrl).Display::url(
$deleteIcon,
$deleteUrl
);
$actions = Display::url($editIcon, $editUrl).
Display::url($moveIcon, $moveUrl).
Display::url($deleteIcon, $deleteUrl);
$url = api_get_path(WEB_CODE_PATH).'admin/course_category.php?category='.$category['code'];
$title = Display::url(
Display::return_icon(
@ -496,11 +497,11 @@ class CourseCategory
$tbl_category = Database::get_main_table(TABLE_MAIN_CATEGORY);
$sql = "SELECT code, name
FROM $tbl_category c
$conditions
WHERE (auth_course_child = 'TRUE' OR code = '".Database::escape_string($categoryCode)."')
$whereCondition
ORDER BY tree_pos";
FROM $tbl_category c
$conditions
WHERE (auth_course_child = 'TRUE' OR code = '".Database::escape_string($categoryCode)."')
$whereCondition
ORDER BY tree_pos";
$res = Database::query($sql);
$categories[''] = '-';
@ -525,14 +526,15 @@ class CourseCategory
$whereCondition = " WHERE a.access_url_id = ".api_get_current_access_url_id();
$sql = "SELECT c.* FROM $tbl_category c
$conditions
$whereCondition
ORDER BY tree_pos ASC";
$conditions
$whereCondition
ORDER BY tree_pos ASC";
$result = Database::query($sql);
$url_access_id = 1;
if (api_is_multiple_url_enabled()) {
$url_access_id = api_get_current_access_url_id();
}
$countCourses = CourseManager::countAvailableCourses($url_access_id);
$categories = array();
@ -609,14 +611,14 @@ class CourseCategory
}
$sql = "SELECT * FROM $tbl_course
WHERE
visibility != '0' AND
visibility != '4'
$categoryFilter
$searchFilter
$without_special_courses
$visibilityCondition
";
WHERE
visibility != '0' AND
visibility != '4'
$categoryFilter
$searchFilter
$without_special_courses
$visibilityCondition
";
// Showing only the courses of the current portal access_url_id.
if (api_is_multiple_url_enabled()) {
@ -651,9 +653,7 @@ class CourseCategory
public static function browseCoursesInCategory($category_code, $random_value = null, $limit = array())
{
$tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
$specialCourseList = CourseManager::get_special_course_list();
$without_special_courses = '';
if (!empty($specialCourseList)) {
$without_special_courses = ' AND course.code NOT IN ("'.implode('","', $specialCourseList).'")';
@ -673,26 +673,26 @@ class CourseCategory
$tbl_url_rel_course = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
$sql = "SELECT COUNT(*) FROM $tbl_course course
INNER JOIN $tbl_url_rel_course as url_rel_course
ON (url_rel_course.c_id = course.id)
WHERE access_url_id = $url_access_id ";
INNER JOIN $tbl_url_rel_course as url_rel_course
ON (url_rel_course.c_id = course.id)
WHERE access_url_id = $url_access_id ";
$result = Database::query($sql);
list($num_records) = Database::fetch_row($result);
$sql = "SELECT course.id FROM $tbl_course course
INNER JOIN $tbl_url_rel_course as url_rel_course
ON (url_rel_course.c_id = course.id)
WHERE
access_url_id = $url_access_id AND
RAND()*$num_records< $random_value
$without_special_courses $visibilityCondition
ORDER BY RAND()
LIMIT 0, $random_value";
INNER JOIN $tbl_url_rel_course as url_rel_course
ON (url_rel_course.c_id = course.id)
WHERE
access_url_id = $url_access_id AND
RAND()*$num_records< $random_value
$without_special_courses $visibilityCondition
ORDER BY RAND()
LIMIT 0, $random_value";
} else {
$sql = "SELECT id FROM $tbl_course course
WHERE RAND()*$num_records< $random_value $without_special_courses $visibilityCondition
ORDER BY RAND()
LIMIT 0, $random_value";
WHERE RAND()*$num_records< $random_value $without_special_courses $visibilityCondition
ORDER BY RAND()
LIMIT 0, $random_value";
}
$result = Database::query($sql);
@ -870,12 +870,11 @@ class CourseCategory
$keyword = Database::escape_string($keyword);
$sql = "SELECT c.*, c.name as text
FROM $tableCategory c $conditions
WHERE
FROM $tableCategory c $conditions
WHERE
(
c.code LIKE '%$keyword%' OR name LIKE '%$keyword%'
) AND
auth_course_child = 'TRUE'
) AND auth_course_child = 'TRUE'
$whereCondition ";
$result = Database::query($sql);
@ -963,21 +962,16 @@ class CourseCategory
}
// For each page add its page button to html
for (
$i = $pageBottom;
$i <= $pageTop;
$i++
) {
for ($i = $pageBottom; $i <= $pageTop; $i++) {
if ($i === $pageCurrent) {
$pageItemAttributes = array('class' => 'active');
} else {
$pageItemAttributes = array();
}
$pageDiv .= self::getPageNumberItem($i, $pageLength, $pageItemAttributes);
}
// Check if current page is the last page
// Check if current page is the last page
if ($pageTop < $pageTotal) {
if ($pageTop < ($pageTotal - 1)) {
$pageDiv .= self::getPageNumberItem($pageTop + 1, $pageLength, null, '...');
@ -1016,9 +1010,7 @@ class CourseCategory
$action = 'subscribe';
}
$categoryCodeRequest = isset($_REQUEST['category_code']) ? Security::remove_XSS(
$_REQUEST['category_code']
) : null;
$categoryCodeRequest = isset($_REQUEST['category_code']) ? Security::remove_XSS($_REQUEST['category_code']) : null;
$categoryCode = isset($categoryCode) ? Security::remove_XSS($categoryCode) : $categoryCodeRequest;
$hiddenLinksRequest = isset($_REQUEST['hidden_links']) ? Security::remove_XSS($_REQUEST['hidden_links']) : null;

@ -94,10 +94,10 @@ class CourseDescription
/**
* Get all data by description and session id,
* first you must set session_id property with the object CourseDescription
* @param int $description_type Description type
* @param int $description_type Description type
* @param string $courseId Course code (optional)
* @param int $session_id Session id (optional)
* @return array List of fields from the descriptions found of the given type
* @param int $session_id Session id (optional)
* @return array List of fields from the descriptions found of the given type
*/
public function get_data_by_description_type(
$description_type,
@ -227,14 +227,14 @@ class CourseDescription
);
}
return ($last_id > 0)?1:0;
return ($last_id > 0) ? 1 : 0;
}
/**
* Insert a row like history inside track_e_item_property table
* first you must set description_type, title, content, progress and
* session_id properties with the object CourseDescription
* @param int description type
* @param int $description_type
* @return int affected rows
*/
public function insert_stats($description_type)
@ -449,7 +449,7 @@ class CourseDescription
$information[6] = get_lang('HumanAndTechnicalResourcesInformation');
$information[7] = get_lang('AssessmentInformation');
//$information[8]= get_lang('ThematicAdvanceInformation');
return $information;
}
@ -464,7 +464,7 @@ class CourseDescription
/**
* Set description's course id
* @param int Course ID
* @param int $id Course ID
* @return void
*/
public function set_course_id($id)
@ -474,7 +474,7 @@ class CourseDescription
/**
* Set description title
* @return void
* @param string $title
*/
public function set_title($title)
{
@ -483,7 +483,8 @@ class CourseDescription
/**
* Set description content
* @return void
*
* @param string $content
*/
public function set_content($content)
{
@ -491,8 +492,10 @@ class CourseDescription
}
/**
*
* Set description session id
* @return void
*
* @param int $session_id
*/
public function set_session_id($session_id)
{
@ -509,8 +512,10 @@ class CourseDescription
}
/**
*
* Set progress of a description
* @return void
*
* @param string $progress
*/
public function set_progress($progress)
{
@ -519,6 +524,7 @@ class CourseDescription
/**
* get description id
*
* @return int
*/
public function get_id()
@ -528,6 +534,7 @@ class CourseDescription
/**
* get description title
*
* @return string
*/
public function get_title()
@ -546,6 +553,7 @@ class CourseDescription
/**
* get session id
*
* @return int
*/
public function get_session_id()
@ -555,6 +563,7 @@ class CourseDescription
/**
* get description type
*
* @return int
*/
public function get_description_type()
@ -564,6 +573,7 @@ class CourseDescription
/**
* get progress of a description
*
* @return int
*/
public function get_progress()

@ -22,7 +22,7 @@ class DashboardManager
public static function handle_dashboard_plugins()
{
$token = Security::get_existing_token();
$tokenCondition = '&amp;sec_token='.$token;
$tokenCondition = '&sec_token='.$token;
/* We scan the plugin directory. Each folder is a potential plugin. */
$dashboard_pluginpath = api_get_path(SYS_PLUGIN_PATH).'dashboard/';
@ -189,7 +189,8 @@ class DashboardManager
}
// clean from block data
if (!empty($not_selected_blocks_id)) {
$sql_check = "SELECT id FROM $tbl_block WHERE id IN(".implode(',',$not_selected_blocks_id).")";
$sql_check = "SELECT id FROM $tbl_block
WHERE id IN(".implode(',',$not_selected_blocks_id).")";
$rs_check = Database::query($sql_check);
if (Database::num_rows($rs_check) > 0) {
$del = "DELETE FROM $tbl_block WHERE id IN(".implode(',',$not_selected_blocks_id).")";
@ -249,245 +250,246 @@ class DashboardManager
return $affected_rows;
}
/**
* Get all plugins path inside dashboard directory
* @return array name plugins directories
*/
public static function getPossibleDashboardPluginsPath()
/**
* Get all plugins path inside dashboard directory
* @return array name plugins directories
*/
public static function getPossibleDashboardPluginsPath()
{
// get all plugins path inside plugin directory
/* We scan the plugin directory. Each folder is a potential plugin. */
$possiblePlugins = array();
$dashboard_pluginpath = api_get_path(SYS_PLUGIN_PATH).'dashboard/';
$handle = @opendir($dashboard_pluginpath);
while (false !== ($file = readdir($handle))) {
if ($file <> '.' AND $file <> '..' AND is_dir($dashboard_pluginpath.$file)) {
$possiblePlugins[] = $file;
}
}
@closedir($handle);
// get all plugins path inside plugin directory
/* We scan the plugin directory. Each folder is a potential plugin. */
$possiblePlugins = array();
$dashboard_pluginpath = api_get_path(SYS_PLUGIN_PATH).'dashboard/';
$handle = @opendir($dashboard_pluginpath);
while (false !== ($file = readdir($handle))) {
if ($file <> '.' AND $file <> '..' AND is_dir($dashboard_pluginpath.$file)) {
$possiblePlugins[] = $file;
}
}
@closedir($handle);
return $possiblePlugins;
}
return $possiblePlugins;
}
/**
* Get all blocks data without plugin directory
* @return array Block data
*/
public static function get_block_data_without_plugin()
/**
* Get all blocks data without plugin directory
* @return array Block data
*/
public static function get_block_data_without_plugin()
{
$tbl_block = Database :: get_main_table(TABLE_MAIN_BLOCK);
$possibleplugins = self::getPossibleDashboardPluginsPath();
// We check if plugin exists inside directory for updating active field
$sql = "SELECT * FROM $tbl_block";
$rs = Database::query($sql);
if (Database::num_rows($rs) > 0){
while ($row = Database::fetch_array($rs)) {
$path = $row['path'];
if (!in_array($row['path'],$possibleplugins)) {
$active = 0;
} else {
$active = 1;
}
// update active
$upd = "UPDATE $tbl_block SET active = '$active'
WHERE path = '".$row['path']."'";
Database::query($upd);
}
}
$tbl_block = Database :: get_main_table(TABLE_MAIN_BLOCK);
$possibleplugins = self::getPossibleDashboardPluginsPath();
// get disabled block data
$block_data = array();
$sql = "SELECT * FROM $tbl_block WHERE active = 0";
$rs_block = Database::query($sql);
if (Database::num_rows($rs_block) > 0) {
while ($row_block = Database::fetch_array($rs_block)) {
$block_data[] = $row_block;
}
}
// We check if plugin exists inside directory for updating active field
$sql = "SELECT * FROM $tbl_block";
$rs = Database::query($sql);
if (Database::num_rows($rs) > 0){
while ($row = Database::fetch_array($rs)) {
if (!in_array($row['path'], $possibleplugins)) {
$active = 0;
} else {
$active = 1;
}
// update active
$upd = "UPDATE $tbl_block SET active = '$active'
WHERE path = '".$row['path']."'";
Database::query($upd);
}
}
return $block_data;
// get disabled block data
$block_data = array();
$sql = "SELECT * FROM $tbl_block WHERE active = 0";
$rs_block = Database::query($sql);
if (Database::num_rows($rs_block) > 0) {
while ($row_block = Database::fetch_array($rs_block)) {
$block_data[] = $row_block;
}
}
return $block_data;
}
/**
* get data about enabled dashboard block (stored insise block table)
* @param string plugin path
* @return array data
*/
public static function get_enabled_dashboard_blocks($path = '')
/**
* get data about enabled dashboard block (stored insise block table)
* @param string $path plugin path
*
* @return array data
*/
public static function get_enabled_dashboard_blocks($path = '')
{
$tbl_block = Database :: get_main_table(TABLE_MAIN_BLOCK);
$condition_path = '';
if (!empty($path)) {
$path = Database::escape_string($path);
$condition_path = ' AND path = "'.$path.'" ';
}
$tbl_block = Database :: get_main_table(TABLE_MAIN_BLOCK);
$condition_path = '';
if (!empty($path)) {
$path = Database::escape_string($path);
$condition_path = ' AND path = "'.$path.'" ';
}
$sql = "SELECT * FROM $tbl_block WHERE active = 1 $condition_path ";
$rs = Database::query($sql);
$block_data = array();
if (Database::num_rows($rs) > 0) {
while ($row = Database::fetch_array($rs)) {
$block_data[$row['path']] = $row;
}
}
return $block_data;
}
$sql = "SELECT * FROM $tbl_block WHERE active = 1 $condition_path ";
$rs = Database::query($sql);
$block_data = array();
if (Database::num_rows($rs) > 0) {
while ($row = Database::fetch_array($rs)) {
$block_data[$row['path']] = $row;
}
}
return $block_data;
}
/**
* display user dashboard list
* @param int User id
* @return void
*/
public static function display_user_dashboard_list($user_id)
/**
* display user dashboard list
* @param int User id
* @return void
*/
public static function display_user_dashboard_list($user_id)
{
$enabled_dashboard_plugins = self::get_enabled_dashboard_blocks();
$user_block_data = self::get_user_block_data($user_id);
$enabled_dashboard_plugins = self::get_enabled_dashboard_blocks();
$user_block_data = self::get_user_block_data($user_id);
if (count($enabled_dashboard_plugins) > 0) {
echo '<div style="margin-top:20px">';
echo '<div><strong>'.get_lang('SelectBlockForDisplayingInsideBlocksDashboardView').'</strong></div><br />';
echo '<form name="dashboard_list" method="post" action="index.php?action=store_user_block">';
echo '<table class="data_table">';
echo '<tr>';
echo '<th width="5%">';
echo get_lang('Enabled');
echo '</th>';
echo '<th width="30%">';
echo get_lang('Name');
echo '</th>';
echo '<th width="40%">';
echo get_lang('Description');
echo '</th>';
echo '<th>';
echo get_lang('ColumnPosition');
echo '</th>';
echo '</tr>';
// We display all enabled plugins and the checkboxes
foreach ($enabled_dashboard_plugins as $block) {
$path = $block['path'];
$controller_class = $block['controller'];
$filename_controller = $path.'.class.php';
$dashboard_plugin_path = api_get_path(SYS_PLUGIN_PATH).'dashboard/'.$path.'/';
require_once $dashboard_plugin_path.$filename_controller;
if (class_exists($controller_class)) {
$obj_block = new $controller_class($user_id);
// check if user is allowed to see the block
if (method_exists($obj_block, 'is_block_visible_for_user')) {
$is_block_visible_for_user = $obj_block->is_block_visible_for_user($user_id);
if (!$is_block_visible_for_user) {
continue;
}
}
if (count($enabled_dashboard_plugins) > 0) {
echo '<div style="margin-top:20px">';
echo '<div><strong>'.get_lang('SelectBlockForDisplayingInsideBlocksDashboardView').'</strong></div><br />';
echo '<form name="dashboard_list" method="post" action="index.php?action=store_user_block">';
echo '<table class="data_table">';
echo '<tr>';
echo '<th width="5%">';
echo get_lang('Enabled');
echo '</th>';
echo '<th width="30%">';
echo get_lang('Name');
echo '</th>';
echo '<th width="40%">';
echo get_lang('Description');
echo '</th>';
echo '<th>';
echo get_lang('ColumnPosition');
echo '</th>';
echo '</tr>';
// We display all enabled plugins and the checkboxes
foreach ($enabled_dashboard_plugins as $block) {
$path = $block['path'];
$controller_class = $block['controller'];
$filename_controller = $path.'.class.php';
$dashboard_plugin_path = api_get_path(SYS_PLUGIN_PATH).'dashboard/'.$path.'/';
require_once $dashboard_plugin_path.$filename_controller;
if (class_exists($controller_class)) {
$obj_block = new $controller_class($user_id);
// check if user is allowed to see the block
if (method_exists($obj_block, 'is_block_visible_for_user')) {
$is_block_visible_for_user = $obj_block->is_block_visible_for_user($user_id);
if (!$is_block_visible_for_user) continue;
}
echo '<tr>';
// checkboxes
self::display_user_dashboard_list_checkboxes($user_id, $block['id']);
echo '<td>'.$block['name'].'</td>';
echo '<td>'.$block['description'].'</td>';
echo '<td>
echo '<tr>';
// checkboxes
self::display_user_dashboard_list_checkboxes($user_id, $block['id']);
echo '<td>'.$block['name'].'</td>';
echo '<td>'.$block['description'].'</td>';
echo '<td>
<select class="selectpicker show-tick form-control" name="columns['.$block['id'].']">
<option value="1" '.(isset($user_block_data[$block['id']]) && $user_block_data[$block['id']]['column']==1?'selected':'').' >1</option>
<option value="2" '.(isset($user_block_data[$block['id']]) && $user_block_data[$block['id']]['column']==2?'selected':'').' >2</option>
</select>
</td>';
echo '</tr>';
} else {
echo Display::tag('tr', Display::tag('td', get_lang('Error').' '.$controller_class, array('colspan'=>'3')));
}
}
echo '</table>';
echo '<div class="row"><div class="col-md-12">';
echo '<button class="btn btn-default" type="submit" name="submit_dashboard_list" value="'.get_lang('EnableDashboardBlock').'"><em class="fa fa-check-square"></em> '.
echo '</tr>';
} else {
echo Display::tag('tr', Display::tag('td', get_lang('Error').' '.$controller_class, array('colspan'=>'3')));
}
}
echo '</table>';
echo '<div class="row"><div class="col-md-12">';
echo '<button class="btn btn-default" type="submit" name="submit_dashboard_list" value="'.get_lang('EnableDashboardBlock').'"><em class="fa fa-check-square"></em> '.
get_lang('EnableDashboardBlock').'</button></form>';
echo '</div></div>';
} else {
echo '<div style="margin-top:20px">'.get_lang('ThereAreNoEnabledDashboardPlugins').'</div>';
if (api_is_platform_admin()) {
echo '<a class="btn btn-default" href="'.api_get_path(WEB_CODE_PATH).'admin/settings.php?category=Plugins">'.
echo '</div></div>';
} else {
echo '<div style="margin-top:20px">'.get_lang('ThereAreNoEnabledDashboardPlugins').'</div>';
if (api_is_platform_admin()) {
echo '<a class="btn btn-default" href="'.api_get_path(WEB_CODE_PATH).'admin/settings.php?category=Plugins">'.
get_lang('ConfigureDashboardPlugin').'</a>';
}
}
}
/**
* display checkboxes for user dashboard list
* @param int User id
* @param int Block id
* @return void
*/
public static function display_user_dashboard_list_checkboxes($user_id, $block_id) {
}
}
}
$user_id = intval($user_id);
$user_block_data = self::get_user_block_data($user_id);
$enabled_blocks_id = array_keys($user_block_data);
/**
* display checkboxes for user dashboard list
* @param int User id
* @param int Block id
* @return void
*/
public static function display_user_dashboard_list_checkboxes($user_id, $block_id)
{
$user_id = intval($user_id);
$user_block_data = self::get_user_block_data($user_id);
$enabled_blocks_id = array_keys($user_block_data);
$checked = '';
if (in_array($block_id, $enabled_blocks_id)) {
$checked = "checked";
}
$checked = '';
if (in_array($block_id, $enabled_blocks_id)) {
$checked = "checked";
}
echo "<td align=\"center\">";
echo '<input type="checkbox" name="enabled_blocks['.$block_id.']" value="true" '.$checked.'/>';
echo "</td>";
}
echo "<td align=\"center\">";
echo '<input type="checkbox" name="enabled_blocks['.$block_id.']" value="true" '.$checked.'/>';
echo "</td>";
}
/**
* This function store enabled blocks id with its column position (block_id1:colum;block_id2:colum; ...) inside extra user fields
* @param int User id
* @param array selected blocks
* @param array columns position
* @return bool
*/
public static function store_user_blocks($user_id, $enabled_blocks, $columns) {
$selected_blocks_id = array();
if (is_array($enabled_blocks) && count($enabled_blocks) > 0) {
$selected_blocks_id = array_keys($enabled_blocks);
}
/**
* This function store enabled blocks id with its column position (block_id1:colum;block_id2:colum; ...)
* inside extra user fields
* @param int $user_id User id
* @param array $enabled_blocks selected blocks
* @param array $columns columns position
* @return bool
*/
public static function store_user_blocks($user_id, $enabled_blocks, $columns)
{
$selected_blocks_id = array();
if (is_array($enabled_blocks) && count($enabled_blocks) > 0) {
$selected_blocks_id = array_keys($enabled_blocks);
}
// build data for storing inside extra user field
$fname = 'dashboard';
$fvalue = array();
foreach ($selected_blocks_id as $block_id) {
$fvalue[] = $block_id.':'.$columns[$block_id];
}
// build data for storing inside extra user field
$fname = 'dashboard';
$fvalue = array();
foreach ($selected_blocks_id as $block_id) {
$fvalue[] = $block_id.':'.$columns[$block_id];
}
$upd_extra_field = UserManager::update_extra_field_value(
$user_id,
$fname,
$fvalue
);
return $upd_extra_field;
}
return $upd_extra_field;
}
/**
* This function get user block data (block id with its number of column) from extra user data
* @param int User id
* @return array data (block_id,column)
*/
public static function get_user_block_data($user_id)
/**
* This function get user block data (block id with its number of column) from extra user data
* @param int User id
* @return array data (block_id,column)
*/
public static function get_user_block_data($user_id)
{
$user_id = intval($user_id);
$field_variable = 'dashboard';
$extra_user_data = UserManager::get_extra_user_data_by_field($user_id, $field_variable);
$extra_user_data = explode(';',$extra_user_data[$field_variable]);
$data = array();
foreach ($extra_user_data as $extra) {
$split_extra = explode(':',$extra);
if (!empty($split_extra)) {
$block_id = $split_extra[0];
$column = isset($split_extra[1]) ? $split_extra[1] : null;
$data[$block_id] = array('block_id' => $block_id, 'column' => $column);
}
}
$user_id = intval($user_id);
$field_variable = 'dashboard';
$extra_user_data = UserManager::get_extra_user_data_by_field($user_id, $field_variable);
$extra_user_data = explode(';', $extra_user_data[$field_variable]);
$data = array();
foreach ($extra_user_data as $extra) {
$split_extra = explode(':',$extra);
if (!empty($split_extra)) {
$block_id = $split_extra[0];
$column = isset($split_extra[1]) ? $split_extra[1] : null;
$data[$block_id] = array('block_id' => $block_id, 'column' => $column);
}
}
return $data;
}
return $data;
}
/**
* This function update extra user blocks data after closing a dashboard block
@ -527,5 +529,4 @@ class DashboardManager
return '<link rel="stylesheet" href="'.api_get_path(WEB_PLUGIN_PATH).'dashboard/css/default.css" type="text/css" />'.PHP_EOL;
}
}

@ -25,6 +25,9 @@ class Diagnoser
{
}
/**
* Show html table
*/
public function show_html()
{
$sections = array('chamilo', 'php', 'database', 'webserver');

@ -155,8 +155,8 @@ class EventsMail
// we get the message in the correct language (or in english if doesn't exist)
$result = self::getMessage($event_name, $language);
$message = "";
$subject = "";
$message = '';
$subject = '';
self::getCorrectMessage($message, $subject, $language, $result);
// replace the keycodes used in the message

@ -39,8 +39,7 @@ class ExerciseLib
$show_comment = false,
$exercise_feedback = null,
$show_answers = false
)
{
) {
$course_id = api_get_course_int_id();
// Change false to true in the following line to enable answer hinting
$debug_mark_answer = $show_answers;
@ -318,7 +317,7 @@ class ExerciseLib
}
$answer = Security::remove_XSS($answer, STUDENT);
$s .= Display::input(
'hidden',
'choice2[' . $questionId . ']',

@ -318,7 +318,6 @@ class GlossaryManager
// Database table definition
$t_glossary = Database :: get_course_table(TABLE_GLOSSARY);
$course_id = api_get_course_int_id();
$glossaryInfo = self::get_glossary_information($glossary_id);
if (empty($glossaryInfo)) {
@ -379,25 +378,25 @@ class GlossaryManager
$actionsLeft = '';
if (api_is_allowed_to_edit(null, true)) {
$actionsLeft .= '<a href="index.php?'.api_get_cidreq().'&action=addglossary&msg=add?'.api_get_cidreq().'">'.
Display::return_icon('new_glossary_term.png',get_lang('TermAddNew'),'', ICON_SIZE_MEDIUM).'</a>';
Display::return_icon('new_glossary_term.png',get_lang('TermAddNew'), '', ICON_SIZE_MEDIUM).'</a>';
}
$actionsLeft .= '<a href="index.php?'.api_get_cidreq().'&action=export">'.
Display::return_icon('export_csv.png',get_lang('ExportGlossaryAsCSV'),'',ICON_SIZE_MEDIUM).'</a>';
Display::return_icon('export_csv.png',get_lang('ExportGlossaryAsCSV'), '', ICON_SIZE_MEDIUM).'</a>';
if (api_is_allowed_to_edit(null, true)) {
$actionsLeft .= '<a href="index.php?'.api_get_cidreq().'&action=import">'.
Display::return_icon('import_csv.png',get_lang('ImportGlossary'),'',ICON_SIZE_MEDIUM).'</a>';
Display::return_icon('import_csv.png',get_lang('ImportGlossary'), '', ICON_SIZE_MEDIUM).'</a>';
}
$actionsLeft .= '<a href="index.php?'.api_get_cidreq().'&action=export_to_pdf">'.
Display::return_icon('pdf.png',get_lang('ExportToPDF'),'', ICON_SIZE_MEDIUM).'</a>';
Display::return_icon('pdf.png',get_lang('ExportToPDF'), '', ICON_SIZE_MEDIUM).'</a>';
if (($view == 'table') || (!isset($view))) {
$actionsLeft .= '<a href="index.php?'.api_get_cidreq().'&action=changeview&view=list">'.
Display::return_icon('view_detailed.png',get_lang('ListView'),'',ICON_SIZE_MEDIUM).'</a>';
Display::return_icon('view_detailed.png',get_lang('ListView'), '', ICON_SIZE_MEDIUM).'</a>';
} else {
$actionsLeft .= '<a href="index.php?'.api_get_cidreq().'&action=changeview&view=table">'.
Display::return_icon('view_text.png',get_lang('TableView'),'',ICON_SIZE_MEDIUM).'</a>';
Display::return_icon('view_text.png',get_lang('TableView'), '', ICON_SIZE_MEDIUM).'</a>';
}
/* BUILD SEARCH FORM */
@ -452,7 +451,7 @@ class GlossaryManager
*/
public static function displayGlossaryList()
{
$glossary_data = self::get_glossary_data(0,1000,0,'ASC');
$glossary_data = self::get_glossary_data(0, 1000, 0, 'ASC');
$content = '';
foreach ($glossary_data as $key => $glossary_item) {
$actions = '';
@ -593,13 +592,13 @@ class GlossaryManager
public static function actions_filter($glossary_id, $url_params, $row)
{
$glossary_id = $row[2];
$return = '<a href="'.api_get_self().'?action=edit_glossary&amp;glossary_id='.$glossary_id.'&'.api_get_cidreq().'&msg=edit">'.
$return = '<a href="'.api_get_self().'?action=edit_glossary&glossary_id='.$glossary_id.'&'.api_get_cidreq().'&msg=edit">'.
Display::return_icon('edit.png',get_lang('Edit'),'',22).'</a>';
$glossary_data = GlossaryManager::get_glossary_information($glossary_id);
$glossary_term = $glossary_data['name'];
if (api_is_allowed_to_edit(null, true)) {
if ($glossary_data['session_id'] == api_get_session_id()) {
$return .= '<a href="'.api_get_self().'?action=delete_glossary&amp;glossary_id='.$glossary_id.'&'.api_get_cidreq().'" onclick="return confirmation(\''.$glossary_term.'\');">'.
$return .= '<a href="'.api_get_self().'?action=delete_glossary&glossary_id='.$glossary_id.'&'.api_get_cidreq().'" onclick="return confirmation(\''.$glossary_term.'\');">'.
Display::return_icon('delete.png', get_lang('Delete'),'',22).'</a>';
} else {
$return = get_lang('EditionNotAvailableFromSession');

@ -55,8 +55,8 @@ class GradeModel extends Model
{
// action links
echo '<div class="actions" style="margin-bottom:20px">';
echo '<a href="grade_models.php">'.Display::return_icon('back.png',get_lang('Back'),'','32').'</a>';
echo '<a href="'.api_get_self().'?action=add">'.Display::return_icon('add.png',get_lang('Add'),'','32').'</a>';
echo '<a href="grade_models.php">'.Display::return_icon('back.png',get_lang('Back'),'', ICON_SIZE_MEDIUM).'</a>';
echo '<a href="'.api_get_self().'?action=add">'.Display::return_icon('add.png', get_lang('Add'), '', ICON_SIZE_MEDIUM).'</a>';
echo '</div>';
echo Display::grid_html('grade_model');
}
@ -215,8 +215,8 @@ class GradeModel extends Model
*/
public function save($params, $show_query = false)
{
$id = parent::save($params, $show_query);
if (!empty($id)) {
$id = parent::save($params, $show_query);
if (!empty($id)) {
foreach ($params['components'] as $component) {
if (!empty($component['title']) && !empty($component['percentage']) && !empty($component['acronym'])) {
$obj = new GradeModelComponents();
@ -227,7 +227,7 @@ class GradeModel extends Model
}
//event_system(LOG_CAREER_CREATE, LOG_CAREER_ID, $id, api_get_utc_datetime(), api_get_user_id());
return $id;
return $id;
}
/**
@ -248,7 +248,6 @@ class GradeModel extends Model
}
}
}
//$params['components']
}
/**
@ -259,6 +258,12 @@ class GradeModel extends Model
parent::delete($id);
}
/**
* @param $form
* @param string $name
* @param null $default_value
* @return bool
*/
public function fill_grade_model_select_in_form(&$form, $name = 'gradebook_model_id', $default_value = null)
{
if (api_get_setting('gradebook_enable_grade_model') == 'false') {
@ -318,7 +323,7 @@ class GradeModelComponents extends Model
public function save($params, $show_query = false)
{
$id = parent::save($params, $show_query);
return $id;
}
}

@ -26,6 +26,7 @@ class Gradebook extends Model
*/
public function __construct()
{
parent::__construct();
$this->table = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY);
$this->table_skill = Database::get_main_table(TABLE_MAIN_SKILL);
$this->table_skill_rel_gradebook = Database::get_main_table(TABLE_MAIN_SKILL_REL_GRADEBOOK);
@ -198,8 +199,7 @@ class Gradebook extends Model
}
$form->addButtonCreate(get_lang('Add'), 'submit');
$form->setDefaults(array('skill'=>$clean_selected_skills));
$form->setDefaults(array('skill' => $clean_selected_skills));
return $form;
}
@ -208,7 +208,7 @@ class Gradebook extends Model
* @param int $gradebook_id
* @return array|resource
*/
function get_skills_by_gradebook($gradebook_id)
public function get_skills_by_gradebook($gradebook_id)
{
$gradebook_id = intval($gradebook_id);
$sql = "SELECT skill.id, skill.name FROM {$this->table_skill} skill

Loading…
Cancel
Save