Merge branch '1.11.x' of https://github.com/chamilo/chamilo-lms into 1.11.x

remotes/angel/1.11.x
José Loguercio 9 years ago
commit 79feb05248
  1. 7
      app/Migrations/Schema/V111/Version111.php
  2. 5
      documentation/optimization.html
  3. 1
      index.php
  4. 24
      main/admin/index.php
  5. 31
      main/coursecopy/classes/CourseSelectForm.class.php
  6. 4
      main/gradebook/certificate_template/template.html
  7. 2
      main/gradebook/exercise_jump.php
  8. 24
      main/inc/ajax/admin.ajax.php
  9. 9
      main/inc/global.inc.php
  10. 172
      main/inc/lib/TicketManager.php
  11. 6
      main/inc/lib/api.lib.php
  12. 15
      main/inc/lib/document.lib.php
  13. 40
      main/inc/lib/legal.lib.php
  14. 30
      main/inc/lib/login.lib.php
  15. 140
      main/inc/lib/sortable_table.class.php
  16. 11
      main/inc/lib/usermanager.lib.php
  17. 4
      main/install/configuration.dist.php
  18. 12
      main/install/data.sql
  19. 88
      main/install/index.php
  20. 122
      main/newscorm/lp_final_item.php
  21. 2
      main/ticket/categories.php
  22. 2
      main/ticket/categories_add_user.php
  23. 2
      main/ticket/index.php
  24. 23
      main/ticket/new_ticket.php
  25. 17
      main/ticket/projects.php
  26. 31
      main/ticket/ticket_details.php
  27. 5
      main/ticket/tickets.php
  28. 17
      plugin/azure_active_directory/README.md
  29. 14
      plugin/azure_active_directory/index.php
  30. 20
      plugin/azure_active_directory/lang/english.php
  31. 9
      plugin/azure_active_directory/plugin.php
  32. 30
      plugin/azure_active_directory/readme.txt
  33. 102
      plugin/azure_active_directory/src/AzureActiveDirectory.php
  34. 55
      plugin/azure_active_directory/src/callback.php
  35. 12
      plugin/azure_active_directory/view/block.tpl
  36. 2
      plugin/bbb/lib/bbb.lib.php
  37. 7
      src/Chamilo/CoreBundle/Entity/ExtraFieldValues.php
  38. 6
      src/Chamilo/CoreBundle/Entity/UsergroupRelUser.php
  39. 3
      src/Chamilo/CourseBundle/Entity/CQuizAnswer.php
  40. 3
      src/Chamilo/CourseBundle/Entity/CQuizQuestionRelCategory.php
  41. 3
      src/Chamilo/CourseBundle/Entity/CStudentPublication.php
  42. 200
      src/Chamilo/TicketBundle/Entity/Priority.php
  43. 183
      src/Chamilo/TicketBundle/Entity/Project.php
  44. 78
      src/Chamilo/TicketBundle/Entity/Status.php

@ -260,9 +260,16 @@ class Version111 extends AbstractMigrationChamilo
$this->addSql("INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('ticket_allow_student_add', NULL, 'radio','Ticket', 'false','TicketAllowStudentAddTitle','TicketAllowStudentAddComment',NULL,NULL, 0)");
$this->addSql("INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('ticket_allow_category_edition', NULL, 'radio','Ticket', 'false','TicketAllowCategoryEditionTitle','TicketAllowCategoryEditionComment',NULL,NULL, 0)");
$this->addSql("INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('ticket_send_warning_to_all_admins', NULL, 'radio','Ticket', 'false','TicketSendWarningToAllAdminsTitle','TicketSendWarningToAllAdminsComment',NULL,NULL, 0)");
$this->addSql("INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('ticket_warn_admin_no_user_in_category', NULL, 'radio','Ticket', 'false','TicketWarnAdminNoUserInCategoryTitle','TicketWarnAdminNoUserInCategoryComment',NULL,NULL, 0)");
$this->addSql("INSERT INTO settings_options (variable, value, display_text) VALUES ('ticket_allow_student_add', 'true', 'Yes'), ('ticket_allow_student_add', 'false', 'No')");
$this->addSql("INSERT INTO settings_options (variable, value, display_text) VALUES ('ticket_allow_category_edition', 'true', 'Yes'), ('ticket_allow_category_edition', 'false', 'No')");
$this->addSql("INSERT INTO settings_options (variable, value, display_text) VALUES ('ticket_send_warning_to_all_admins', 'true', 'Yes'), ('ticket_send_warning_to_all_admins', 'false', 'No')");
$this->addSql("INSERT INTO settings_options (variable, value, display_text) VALUES ('ticket_warn_admin_no_user_in_category', 'true', 'Yes'), ('ticket_warn_admin_no_user_in_category', 'false', 'No')");
$this->addSql("ALTER TABLE c_quiz_question_rel_category ADD INDEX idx_qqrc_qid (question_id)");
$this->addSql("ALTER TABLE c_quiz_answer ADD INDEX idx_cqa_q (question_id)");
$this->addSql("ALTER TABLE c_student_publication ADD INDEX idx_csp_u (user_id)");
}
}

@ -351,10 +351,13 @@ alter table c_quiz_rel_question ADD INDEX idx_cqrq_qid (question_id);
alter table c_quiz_rel_question ADD INDEX idx_cqrq_cid (c_id);
alter table c_quiz_answer add index idx_qa_cidqid (c_id, question_id);
</pre>
In Chamilo 1.10.6, an additional query was confirmed to still have effect a considerable effect:
<pre>
alter table c_quiz_question_rel_category add index idx_qqrc_qid (question_id);
</pre>
<hr />
<h2><a name="3.Indexes-caching"></a>3. Indexes caching</h2>
One good reference: <a href="http://dev.mysql.com/doc/refman/5.1/en/multiple-key-caches.html">MySQL documentation on multiple key caches</a><br />
<hr />
<h2><a name="4.Sessions-directories"></a>4. Sessions directories</h2>

@ -7,7 +7,6 @@
use \ChamiloSession as Session;
define('CHAMILO_HOMEPAGE', true);
// Avoid loading CKeditor lib on homepage (very heavy lib)
define('CHAMILO_LOAD_WYSIWYG', false);
/* Flag forcing the 'current course' reset, as we're not inside a course anymore. */

@ -446,6 +446,30 @@ if (api_is_platform_admin()) {
$blocks = $data['blocks'];
}
}
//Hack for fix migration on session_rel_user
$tableColumns = Database::getManager()
->getConnection()
->getSchemaManager()
->listTableColumns(
Database::get_main_table(TABLE_MAIN_SESSION_USER)
);
if (!array_key_exists('duration', $tableColumns)) {
try {
$dbSchema = Database::getManager()->getConnection()->getSchemaManager();
$durationColumn = new \Doctrine\DBAL\Schema\Column(
'duration',
Doctrine\DBAL\Types\Type::getType(\Doctrine\DBAL\Types\Type::INTEGER),
['notnull' => false]
);
$tableDiff = new \Doctrine\DBAL\Schema\TableDiff('session_rel_user', [$durationColumn]);
$dbSchema->alterTable($tableDiff);
} catch (Exception $e) {
error_log($e->getMessage());
}
}
//end hack
}
$admin_ajax_url = api_get_path(WEB_AJAX_PATH) . 'admin.ajax.php';

@ -44,11 +44,13 @@ class CourseSelectForm
el = document.getElementById('div_'+item);
if (el.style.display=='none'){
el.style.display='';
document.getElementById('img_'+item).src='<?php echo Display::returnIconPath('1.gif'); ?>';
//document.getElementById('img_'+item).src='<?php echo Display::returnIconPath('1.gif'); ?>';
document.getElementById('img_'+item).className='fa fa-minus-square-o fa-lg';
}
else{
el.style.display='none';
document.getElementById('img_'+item).src='<?php echo Display::returnIconPath('0.gif'); ?>';
//document.getElementById('img_'+item).src='<?php echo Display::returnIconPath('0.gif'); ?>';
document.getElementById('img_'+item).className ='fa fa-plus-square-o fa-lg';
}
}
@ -203,7 +205,8 @@ class CourseSelectForm
case RESOURCE_SCORM:
break;
default :
echo '<img id="img_'.$type.'" src="'.Display::returnIconPath('1.gif').'" onclick="javascript:exp('."'$type'".');" />&nbsp;';
//echo '<img id="img_'.$type.'" src="'.Display::returnIconPath('1.gif').'" onclick="javascript:exp('."'$type'".');" />&nbsp;';
echo '<span id="img_'.$type.'" class="fa fa-minus-square-o fa-lg" onclick="javascript:exp('."'$type'".');" >&nbsp;</span>&nbsp;';
echo '<b onclick="javascript:exp('."'$type'".');" >'.$resource_titles[$type].'</b><br />';
echo '<div id="div_'.$type.'">';
if ($type == RESOURCE_LEARNPATH) {
@ -216,23 +219,27 @@ class CourseSelectForm
}
}
echo '<blockquote>';
echo '<div class="well">';
echo '<div class="btn-group">';
echo "<a class=\"btn btn-default\" href=\"javascript: void(0);\" onclick=\"javascript: setCheckbox('$type',true);\" >".get_lang('All')."</a>";
echo "<a class=\"btn btn-default\" href=\"javascript: void(0);\" onclick=\"javascript:setCheckbox('$type',false);\" >".get_lang('None')."</a>";
echo '</div><br />';
echo '<ul class="list-unstyled">';
foreach ($resources as $id => $resource) {
if ($resource) {
echo '<li>';
// Event obj in 1.9.x in 1.10.x the class is CalendarEvent
Coursecopy\Resource::setClassType($resource);
echo '<label class="checkbox">';
echo '<input type="checkbox" name="resource['.$type.']['.$id.']" id="resource['.$type.']['.$id.']" />';
$resource->show();
echo '</label>';
echo '</li>';
}
}
echo '</blockquote>';
echo '</ul>';
echo '</div>';
echo '</div>';
echo '<script language="javascript">exp('."'$type'".')</script>';
$element_count++;
@ -244,7 +251,8 @@ class CourseSelectForm
if (!empty($forum_categories)) {
$type = RESOURCE_FORUMCATEGORY;
echo '<img id="img_'.$type.'" src="'.Display::returnIconPath('1.gif').'" onclick="javascript:exp('."'$type'".');" />&nbsp;';
//echo '<img id="img_'.$type.'" src="'.Display::returnIconPath('1.gif').'" onclick="javascript:exp('."'$type'".');" />&nbsp;';
echo '<span id="img_'.$type.'" class="fa fa-minus-square-o fa-lg" onclick="javascript:exp('."'$type'".');" >&nbsp;</span>&nbsp;';
echo '<b onclick="javascript:exp('."'$type'".');" >'.$resource_titles[RESOURCE_FORUM].'</b><br />';
echo '<div id="div_'.$type.'">';
@ -581,11 +589,13 @@ class CourseSelectForm
el = document.getElementById('div_'+item);
if (el.style.display=='none'){
el.style.display='';
document.getElementById('img_'+item).src='<?php echo Display::returnIconPath('1.gif'); ?>';
//document.getElementById('img_'+item).src='<?php echo Display::returnIconPath('1.gif'); ?>';
document.getElementById('img_'+item).className('fa fa-minus-square-o fa-lg');
}
else{
el.style.display='none';
document.getElementById('img_'+item).src='<?php echo Display::returnIconPath('0.gif'); ?>';
//document.getElementById('img_'+item).src='<?php echo Display::returnIconPath('0.gif'); ?>';
document.getElementById('img_'+item).className('fa fa-plus-square-o fa-lg');
}
}
function setCheckbox(type,value) {
@ -638,7 +648,8 @@ class CourseSelectForm
foreach ($list_course as $course){
foreach ($course->resources as $type => $resources) {
if (count($resources) > 0) {
echo '<img id="img_'.$course->code.'" src="'.Display::returnIconPath('1.gif').'" onclick="javascript:exp('."'$course->code'".');" />';
//echo '<img id="img_'.$course->code.'" src="'.Display::returnIconPath('1.gif').'" onclick="javascript:exp('."'$course->code'".');" />';
echo '<span id="img_'.$course->code.'" class="fa fa-minus-square-o fa-lg" onclick="javascript:exp('."'$course->code'".');" >&nbsp;</span>';
echo '<b onclick="javascript:exp('."'$course->code'".');" > '.$course->code.'</b><br />';
echo '<div id="div_'.$course->code.'">';
echo '<blockquote>';

@ -1,10 +1,12 @@
<html prefix="og: http://ogp.me/ns/article#">
<!DOCTYPE html>
<html prefix="og:http://ogp.me/ns/article#">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>((course_title)) - ((user_firstname)) ((user_lastname)) - ((date_certificate_no_time))</title>
<meta property="og:type" content="article" />
<meta property="og:title" content="((course_title)) - Certificate for ((user_firstname)) ((user_lastname))" />
<meta property="og:url" content="((certificate_link))" />
<style>((external_style))</style>
</head>
<body style="background-color: #fff;">
<div style="width: 1072px;margin-left: auto;margin-right: auto;">

@ -22,7 +22,7 @@ $type = Security::remove_XSS($_GET['type']);
$doExerciseUrl = '';
if (isset($_GET['doexercise'])) {
$doExerciseUrl = api_get_path(WEB_CODE_PATH) . 'exercise/overview.php?' . http_build_query([
$doExerciseUrl = api_get_path(WEB_CODE_PATH) . 'exercice/overview.php?' . http_build_query([
'session_id' => $session_id,
'cidReq' => $cidReq,
'gradebook' => $gradebook,

@ -127,6 +127,10 @@ function check_system_version()
// The number of sessions
$number_of_sessions = Statistics::countSessions();
$packager = api_get_configuration_value('packager');
if (empty($packager)) {
$packager = 'chamilo';
}
$data = array(
'url' => api_get_path(WEB_PATH),
@ -144,6 +148,11 @@ function check_system_version()
'language' => api_get_setting('platformLanguage'), //helps us know the spread of language usage for campuses, by main language
'adminname' => api_get_setting('administratorName').' '.api_get_setting('administratorSurname'), //not sure this is necessary...
'ip' => $_SERVER['REMOTE_ADDR'], //the admin's IP address, with the only purpose of trying to geolocate portals around the globe to draw a map
// Reference to the packager system or provider through which
// Chamilo is installed/downloaded. Packagers can change this in
// the default config file (main/install/configuration.dist.php)
// or in the installed config file. The default value is 'chamilo'
'packager' => $packager,
);
$version = null;
// version.php has been updated to include the version in an HTTP header
@ -182,14 +191,13 @@ function check_system_version()
/**
* Function to make an HTTP request through fsockopen (specialised for GET)
* Derived from Jeremy Saintot: http://www.php.net/manual/en/function.fsockopen.php#101872
* @param string IP or hostname
* @param int Target port
* @param string URI (defaults to '/')
* @param array GET data
* @param float Timeout
* @param bool Include HTTP Request headers?
* @param bool Include HTTP Response headers?
* @param string $ip
* @param string $ip IP or hostname
* @param int $port Target port
* @param string $uri URI (defaults to '/')
* @param array $getdata GET data
* @param int $timeout Timeout
* @param bool $req_hdr Include HTTP Request headers?
* @param bool $res_hdr Include HTTP Response headers?
* @return string
*/
function _http_request($ip, $port = 80, $uri = '/', $getdata = array(), $timeout = 5, $req_hdr = false, $res_hdr = false)

@ -24,13 +24,6 @@
// Showing/hiding error codes in global error messages.
define('SHOW_ERROR_CODES', false);
// Make sure the CHAMILO_LOAD_WYSIWYG constant is defined
// To remove CKeditor libs from HTML, set this constant to true before loading
// global.inc.php
if (!defined('CHAMILO_LOAD_WYSIWYG')) {
define('CHAMILO_LOAD_WYSIWYG', true);
}
// Include the libraries that are necessary everywhere
require_once __DIR__.'/../../vendor/autoload.php';
require_once __DIR__.'/../../app/AppKernel.php';
@ -442,7 +435,7 @@ if (!empty($valid_languages)) {
$language_interface = api_get_language_from_type($language_priority4);
} else {
$language_interface = api_get_setting('platformLanguage');
}
}
if (!empty($language_priority3) && api_get_language_from_type($language_priority3) !== false) {
$language_interface = api_get_language_from_type($language_priority3);

@ -1,6 +1,10 @@
<?php
/* For licensing terms, see /license.txt */
use Chamilo\TicketBundle\Entity\Project;
use Chamilo\TicketBundle\Entity\Status;
use Chamilo\TicketBundle\Entity\Priority;
/**
* Class TicketManager
* @package chamilo.plugin.ticket
@ -174,7 +178,7 @@ class TicketManager
if (self::userIsAssignedToCategory($userId, $categoryId) == false) {
$params = [
'category_id' => $categoryId,
'user_id' => $userId
'user_id' => $userId,
];
Database::insert($table, $params);
}
@ -331,7 +335,6 @@ class TicketManager
'project_id' => $project_id,
'category_id' => $category_id,
'priority_id' => $priority,
'course_id' => $course_id,
'personal_email' => $personalEmail,
'status_id' => $status,
'start_date' => $now,
@ -344,6 +347,11 @@ class TicketManager
'subject' => $subject,
'message' => $content
];
if (!empty($course_id)) {
$params['course_id'] = $course_id;
}
$ticket_id = Database::insert($table_support_tickets, $params);
if ($ticket_id) {
@ -375,13 +383,13 @@ class TicketManager
// Update code
$sql = "UPDATE $table_support_tickets
SET code = '$ticket_code'
WHERE ticket_id = '$ticket_id'";
WHERE id = '$ticket_id'";
Database::query($sql);
// Update total
$sql = "UPDATE $table_support_category
SET total_tickets = total_tickets + 1
WHERE category_id = '$category_id'";
WHERE id = $category_id";
Database::query($sql);
$user = api_get_user_info($assigned_user);
@ -418,7 +426,8 @@ class TicketManager
</table>';
if (empty($category_id)) {
if ($plugin->get('send_warning_to_all_admins')) {
if (api_get_setting('ticket_send_warning_to_all_admins') == 'true') {
$warningSubject = sprintf(
get_lang('TicketXCreatedWithNoCategory'),
$ticket_code
@ -442,7 +451,7 @@ class TicketManager
$message = '<h2>'.get_lang('TicketInformation').'</h2><br />'.$helpDeskMessage;
if ($plugin->get('warn_admin_no_user_in_category')) {
if (api_get_setting('ticket_warn_admin_no_user_in_category') == 'true') {
$usersInCategory = TicketManager::getUsersInCategory($category_id);
if (empty($usersInCategory)) {
$subject = sprintf(
@ -450,7 +459,7 @@ class TicketManager
$categoryInfo['name']
);
if ($plugin->get('send_warning_to_all_admins')) {
if (api_get_setting('ticket_send_warning_to_all_admins') == 'true') {
Display::addFlash(Display::return_message(
sprintf(
get_lang('CategoryWithNoUserNotificationSentToAdmins'),
@ -577,7 +586,7 @@ class TicketManager
'ticket_id' => $ticket_id,
'user_id' => $user_id,
'assigned_date' => $now,
'sys_insert_user_id' => $insert_id
'sys_insert_user_id' => $insert_id,
];
Database::insert($table_support_assigned_log, $params);
@ -612,7 +621,7 @@ class TicketManager
null, // sender name
null, // sender e-mail
array(
'cc' => $sender['email']
'cc' => $sender['email'],
) // should be support e-mail (platform admin) here
);
}
@ -677,7 +686,7 @@ class TicketManager
'sys_insert_datetime' => $now,
'sys_lastedit_user_id' => $user_id,
'sys_lastedit_datetime' => $now,
'status' => $status
'status' => $status,
];
Database::insert($table_support_messages, $params);
@ -788,7 +797,7 @@ class TicketManager
return array(
'path' => $path_message_attach . $safe_new_file_name,
'filename' => $safe_file_name
'filename' => $safe_file_name,
);
}
}
@ -1046,7 +1055,7 @@ class TicketManager
$name,
$row['assigned_last_user'],
$row['col7'],
$row['col8']
$row['col8'],
);
} else {
$actions = '';
@ -1059,7 +1068,7 @@ class TicketManager
$dif = $now - $last_edit_date;
if ($dif > 172800 && $row['priority_id'] === self::PRIORITY_NORMAL && $row['status_id'] != self::STATUS_CLOSE) {
$actions .= '<a href="'.api_get_path(WEB_CODE_PATH).'ticket/myticket.php?ticket_id=' . $row['ticket_id'] . '&amp;action=alert">
$actions .= '<a href="'.api_get_path(WEB_CODE_PATH).'ticket/tickets.php?ticket_id=' . $row['ticket_id'] . '&amp;action=alert">
<img src="' . Display::returnIconPath('exclamation.png') . '" border="0" /></a>';
}
if ($row['priority_id'] === self::PRIORITY_HIGH) {
@ -1070,7 +1079,7 @@ class TicketManager
api_format_date($row['col1'], '%d/%m/%y - %I:%M:%S %p'),
api_format_date($row['col2'], '%d/%m/%y - %I:%M:%S %p'),
$row['col3'],
$row['col7']
$row['col7'],
);
}
/*if ($unread > 0) {
@ -1467,7 +1476,7 @@ class TicketManager
'priority_id' => isset($params['priority_id']) ? $params['priority_id'] : '',
'status_id' => isset($params['status_id']) ? $params['status_id'] : '',
'sys_lastedit_user_id' => $userId,
'sys_lastedit_datetime' => $now
'sys_lastedit_datetime' => $now,
];
Database::update($table, $newParams, ['id = ? ' => $ticketId]);
@ -1574,8 +1583,8 @@ class TicketManager
}
/**
* @param $ticket_id
* @param $user_id
* @param int $ticket_id
* @param int $user_id
*/
public static function close_ticket($ticket_id, $user_id)
{
@ -1838,7 +1847,7 @@ class TicketManager
utf8_decode('Estado'),
utf8_decode('Mensajes'),
utf8_decode('Responsable'),
utf8_decode('Programa')
utf8_decode('Programa'),
);
while ($row = Database::fetch_assoc($result)) {
@ -1876,18 +1885,135 @@ class TicketManager
return $form;
}
public static function getProjects()
/**
* @return array
*/
public static function getStatusList()
{
$em = Database::getManager()->getRepository('ChamiloTicketBundle')->findAll();
$projects = Database::getManager()->getRepository('ChamiloTicketBundle:Status')->findAll();
return $em;
$list = [];
/** @var \Chamilo\TicketBundle\Entity\Status $row */
foreach ($projects as $row) {
$list[$row->getId()] = $row->getName();
}
return $list;
}
/**
* @return array
*/
public static function getPriorityList()
{
$projects = Database::getManager()->getRepository('ChamiloTicketBundle:Priority')->findAll();
$list = [];
/** @var \Chamilo\TicketBundle\Entity\Priority $row */
foreach ($projects as $row) {
$list[$row->getId()] = $row->getName();
}
return $list;
}
/**
* @return array
*/
public static function getProjects()
{
$projects = Database::getManager()->getRepository('ChamiloTicketBundle:Project')->findAll();
$list = [];
/** @var Project $row */
foreach ($projects as $row) {
$list[] = [
'id' => $row->getId(),
'0' => $row->getId(),
'1' => $row->getName(),
'2' => $row->getDescription(),
'3' => $row->getId()
];
}
return $list;
}
/**
* @return int
*/
public static function getProjectsCount()
{
$em = Database::getManager()->getRepository('ChamiloTicketBundle')->findAll();
$count = Database::getManager()->getRepository('ChamiloTicketBundle:Project')->createQueryBuilder('p')
->select('COUNT(p.id)')
->getQuery()
->getSingleScalarResult();
return $em;
return $count;
}
/**
* @param array $params
*/
public static function addProject($params)
{
$project = new Project();
$project->setName($params['name']);
$project->setDescription($params['description']);
$project->setInsertUserId(api_get_user_id());
//$project->setEmail($params['email']);
Database::getManager()->persist($project);
Database::getManager()->flush();
}
/**
* @param $id
* @return Project
*/
public static function getProject($id)
{
return Database::getManager()->getRepository('ChamiloTicketBundle:Project')->find($id);
}
/**
* @param int $id
* @param array $params
*/
public static function updateProject($id, $params)
{
$project = self::getProject($id);
$project->setName($params['name']);
$project->setDescription($params['description']);
$project->setLastEditDateTime(new DateTime($params['sys_lastedit_datetime']));
$project->setLastEditUserId($params['sys_lastedit_user_id']);
Database::getManager()->merge($project);
Database::getManager()->flush();
}
/**
* @param int $id
*/
public static function deleteProject($id)
{
$project = self::getProject($id);
Database::getManager()->remove($project);
Database::getManager()->flush();
}
/**
* @param string $url
* @return FormValidator
*/
public static function getProjectForm($url)
{
$form = new FormValidator('project', 'post', $url);
$form->addText('name', get_lang('Name'));
$form->addHtmlEditor('description', get_lang('Description'));
$form->addButtonUpdate(get_lang('Save'));
return $form;
}
}

@ -571,6 +571,12 @@ define('SHORTCUTS_VERTICAL', 1);
// Image class
define('IMAGE_PROCESSOR', 'gd'); // 'imagick' or 'gd' strings
// Make sure the CHAMILO_LOAD_WYSIWYG constant is defined
// To remove CKeditor libs from HTML, set this constant to true before loading
if (!defined('CHAMILO_LOAD_WYSIWYG')) {
define('CHAMILO_LOAD_WYSIWYG', true);
}
/**
* Inclusion of internationalization libraries
*/

@ -364,8 +364,10 @@ class DocumentManager
$content_type = self::file_get_mime_type($filename);
$lpFixedEncoding = api_get_configuration_value('lp_fixed_encoding');
header('Expires: Wed, 01 Jan 1990 00:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
// Comented to let courses content to be cached in order to improve performance:
//header('Expires: Wed, 01 Jan 1990 00:00:00 GMT');
//header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
// Commented to avoid double caching declaration when playing with IE and HTTPS
//header('Cache-Control: no-cache, must-revalidate');
//header('Pragma: no-cache');
@ -1901,6 +1903,13 @@ class DocumentManager
$url = api_get_path(WEB_PATH) . 'certificates/index.php?id=' . $info_grade_certificate['id'];
$externalStyleFile = api_get_path(SYS_CSS_PATH) . 'themes/' . api_get_visual_theme() . '/certificate.css';
$externalStyle = '';
if (is_file($externalStyleFile)) {
$externalStyle = file_get_contents($externalStyleFile);
}
//replace content
$info_to_replace_in_content_html = array(
$first_name,
@ -1918,6 +1927,7 @@ class DocumentManager
$url,
'<a href="' . $url . '" target="_blank">' . get_lang('CertificateOnlineLink') . '</a>',
'((certificate_barcode))',
$externalStyle
);
$info_to_be_replaced_in_content_html = array('((user_firstname))',
@ -1935,6 +1945,7 @@ class DocumentManager
'((certificate_link))',
'((certificate_link_html))',
'((certificate_barcode))',
'((external_style))'
);
if (!empty($extraFields)) {

@ -44,7 +44,7 @@ class LegalManager
Database::insert($legal_table, $params);
return true;
} elseif($last['type'] != $type && $language==$last['language_id']) {
} elseif($last['type'] != $type && $language == $last['language_id']) {
//update
$id = $last['legal_id'];
$params = [
@ -56,10 +56,14 @@ class LegalManager
return true;
} else {
return false;
}
}
/**
* @param int $id
*/
public static function delete($id)
{
/*
@ -137,7 +141,7 @@ class LegalManager
/**
* Show the last condition
* @param array with type and content i.e array('type'=>'1', 'content'=>'hola');
* @param array $term_preview with type and content i.e array('type'=>'1', 'content'=>'hola');
*
* @return string html preview
*/
@ -172,9 +176,9 @@ class LegalManager
/**
* Get the terms and condition table (only for maintenance)
* @param int offset
* @param int number of items
* @param int column
* @param int $from
* @param int $number_of_items
* @param int $column
* @return array
*/
public static function get_legal_data($from, $number_of_items, $column)
@ -191,19 +195,21 @@ class LegalManager
$sql .= "LIMIT $from, $number_of_items ";
$result = Database::query($sql);
$legals = array ();
$versions = array ();
$legals = array();
$versions = array();
while ($legal = Database::fetch_array($result)) {
// max 2000 chars
//echo strlen($legal[1]); echo '<br>';
$versions[]=$legal[0];
$languages[]=$legal[1];
if (strlen($legal[2])>2000)
$legal[2]= substr($legal[2],0,2000).' ... ';
if ($legal[4]==0)
$legal[4]= get_lang('HTMLText');
elseif($legal[4]==1)
$legal[4]=get_lang('PageLink');
$versions[] = $legal[0];
$languages[] = $legal[1];
if (strlen($legal[2]) > 2000) {
$legal[2] = substr($legal[2], 0, 2000).' ... ';
}
if ($legal[4] == 0) {
$legal[4] = get_lang('HTMLText');
} elseif ($legal[4] == 1) {
$legal[4] = get_lang('PageLink');
}
$legals[] = $legal;
}
return $legals;
@ -228,8 +234,8 @@ class LegalManager
/**
* Get type of terms and conditions
* @param int The legal id
* @param int The language id
* @param int $legal_id
* @param int $language_id
* @return int The current type of terms and conditions
*/
public static function get_type_of_terms_and_conditions($legal_id, $language_id)

@ -99,7 +99,12 @@ class Login
$email_body = get_lang('YourAccountParam') . " " . $portal_url . "\n\n$user_account_list";
// SEND MESSAGE
$sender_name = api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'), null, PERSON_NAME_EMAIL_ADDRESS);
$sender_name = api_get_person_name(
api_get_setting('administratorName'),
api_get_setting('administratorSurname'),
null,
PERSON_NAME_EMAIL_ADDRESS
);
$email_admin = api_get_setting('emailAdministrator');
if (api_mail_html('', $email_to, $email_subject, $email_body, $sender_name, $email_admin) == 1) {
@ -175,7 +180,10 @@ class Login
api_get_setting('administratorSurname')
)
);
$message = sprintf(get_lang('ThisPlatformWasUnableToSendTheEmailPleaseContactXForMoreInformation'), $admin_email);
$message = sprintf(
get_lang('ThisPlatformWasUnableToSendTheEmailPleaseContactXForMoreInformation'),
$admin_email
);
return $message;
}
@ -196,16 +204,12 @@ class Login
$url = api_get_path(WEB_CODE_PATH).'auth/reset.php?token='.$uniqueId;
$mailTemplate = new Template(null, false, false, false, false, false);
$mailLayout = $mailTemplate->get_template('mail/reset_password.tpl');
$mailTemplate->assign('complete_user_name', $user->getCompleteName());
$mailTemplate->assign('link', $url);
//$mailTemplate = new Template(null, false, false, false, false, false);
//$mailLayout = $mailTemplate->get_template('mail/reset_password.tpl');
//$mailTemplate->assign('complete_user_name', $user->getCompleteName());
//$mailTemplate->assign('link', $url);
$mailSubject = get_lang('ResetPasswordInstructions');
$mailBody = $mailTemplate->fetch($mailLayout);
$mailBody = nl2br($mailBody);
//$mailBody = $mailTemplate->fetch($mailLayout);
$mailBody = sprintf(
get_lang('ResetPasswordCommentWithUrl'),
@ -256,7 +260,7 @@ class Login
$user = Database::fetch_array($result);
if ($user['auth_source'] == 'extldap') {
return get_lang('CouldNotResetPassword');
}
} else {
@ -879,7 +883,7 @@ class Login
if ($result && $num_rows > 0) {
return Database::fetch_assoc($result);
}
return false;
}
}

@ -174,21 +174,21 @@ class SortableTable extends HTML_Table
$this->per_page = isset($_SESSION[$this->param_prefix.'per_page']) ? intval($_SESSION[$this->param_prefix.'per_page']) : $default_items_per_page;
$this->per_page = isset($_GET[$this->param_prefix.'per_page']) ? intval($_GET[$this->param_prefix.'per_page']) : $this->per_page;
$_SESSION[$this->param_prefix.'per_page'] = $this->per_page;
$_SESSION[$this->param_prefix.'direction'] = $this->direction ;
$_SESSION[$this->param_prefix.'page_nr'] = $this->page_nr;
$_SESSION[$this->param_prefix.'column'] = $this->column;
$this->pager = null;
$this->default_items_per_page = $default_items_per_page;
$this->total_number_of_items = -1;
$this->get_total_number_function = $get_total_number_function;
$this->get_data_function = $get_data_function;
$this->column_filters = array();
$this->form_actions = array();
$this->checkbox_name = null;
$this->td_attributes = array();
$this->th_attributes = array();
$this->other_tables = array();
$_SESSION[$this->param_prefix.'per_page'] = $this->per_page;
$_SESSION[$this->param_prefix.'direction'] = $this->direction;
$_SESSION[$this->param_prefix.'page_nr'] = $this->page_nr;
$_SESSION[$this->param_prefix.'column'] = $this->column;
$this->pager = null;
$this->default_items_per_page = $default_items_per_page;
$this->total_number_of_items = -1;
$this->get_total_number_function = $get_total_number_function;
$this->get_data_function = $get_data_function;
$this->column_filters = array();
$this->form_actions = array();
$this->checkbox_name = null;
$this->td_attributes = array();
$this->th_attributes = array();
$this->other_tables = array();
}
/**
@ -197,23 +197,23 @@ class SortableTable extends HTML_Table
public function get_pager()
{
if (is_null($this->pager)) {
$total_number_of_items = $this->get_total_number_of_items();
$params['mode'] = 'Sliding';
$params['perPage'] = $this->per_page;
$params['totalItems'] = $total_number_of_items;
$params['urlVar'] = $this->param_prefix.'page_nr';
$params['currentPage'] = $this->page_nr;
$icon_attributes = array('style' => 'vertical-align: middle;');
$params['prevImg'] = Display :: return_icon('action_prev.png', get_lang('PreviousPage'), $icon_attributes);
$params['nextImg'] = Display :: return_icon('action_next.png', get_lang('NextPage'), $icon_attributes);
$params['firstPageText'] = Display :: return_icon('action_first.png', get_lang('FirstPage'), $icon_attributes);
$params['lastPageText'] = Display :: return_icon('action_last.png', get_lang('LastPage'), $icon_attributes);
$params['firstPagePre'] = '';
$params['lastPagePre'] = '';
$total_number_of_items = $this->get_total_number_of_items();
$params['mode'] = 'Sliding';
$params['perPage'] = $this->per_page;
$params['totalItems'] = $total_number_of_items;
$params['urlVar'] = $this->param_prefix.'page_nr';
$params['currentPage'] = $this->page_nr;
$icon_attributes = array('style' => 'vertical-align: middle;');
$params['prevImg'] = Display:: return_icon('action_prev.png', get_lang('PreviousPage'), $icon_attributes);
$params['nextImg'] = Display:: return_icon('action_next.png', get_lang('NextPage'), $icon_attributes);
$params['firstPageText'] = Display:: return_icon('action_first.png', get_lang('FirstPage'), $icon_attributes);
$params['lastPageText'] = Display:: return_icon('action_last.png', get_lang('LastPage'), $icon_attributes);
$params['firstPagePre'] = '';
$params['lastPagePre'] = '';
$params['firstPagePost'] = '';
$params['lastPagePost'] = '';
$params['lastPagePost'] = '';
$params['spacesBeforeSeparator'] = '';
$params['spacesAfterSeparator'] = '';
$params['spacesAfterSeparator'] = '';
$query_vars = array_keys($_GET);
$query_vars_needed = array ($this->param_prefix.'column', $this->param_prefix.'direction', $this->param_prefix.'per_page');
if (count($this->additional_parameters) > 0) {
@ -231,9 +231,7 @@ class SortableTable extends HTML_Table
*/
public function display()
{
echo $this->return_table();
}
/**
@ -243,7 +241,6 @@ class SortableTable extends HTML_Table
public function return_table()
{
$empty_table = false;
$content = $this->get_table_html();
if ($this->get_total_number_of_items() == 0) {
$cols = $this->getColCount();
@ -299,21 +296,21 @@ class SortableTable extends HTML_Table
if (count($this->form_actions) > 0) {
$html .= '<div class="btn-toolbar">';
$html .= '<div class="btn-group">';
$html .= '<a class="btn btn-default" href="?'.$params.'&amp;'.$this->param_prefix.'selectall=1" onclick="javascript: setCheckbox(true, \''.$table_id.'\'); return false;">'.get_lang('SelectAll').'</a>';
$html .= '<a class="btn btn-default" href="?'.$params.'" onclick="javascript: setCheckbox(false, \''.$table_id.'\'); return false;">'.get_lang('UnSelectAll').'</a> ';
$html .= '</div>';
$html .= '<div class="btn-group">
<button class="btn btn-default" onclick="javascript:return false;">'.get_lang('Actions').'</button>
<button class="btn btn-default dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
</button>';
$html .= '<ul class="dropdown-menu">';
foreach ($this->form_actions as $action => & $label) {
$html .= '<li><a data-action ="'.$action.'" href="#" onclick="javascript:action_click(this, \''.$table_id.'\');">'.$label.'</a></li>';
}
$html .= '</ul>';
$html .= '</div>';//btn-group
$html .= '<div class="btn-group">';
$html .= '<a class="btn btn-default" href="?'.$params.'&amp;'.$this->param_prefix.'selectall=1" onclick="javascript: setCheckbox(true, \''.$table_id.'\'); return false;">'.get_lang('SelectAll').'</a>';
$html .= '<a class="btn btn-default" href="?'.$params.'" onclick="javascript: setCheckbox(false, \''.$table_id.'\'); return false;">'.get_lang('UnSelectAll').'</a> ';
$html .= '</div>';
$html .= '<div class="btn-group">
<button class="btn btn-default" onclick="javascript:return false;">'.get_lang('Actions').'</button>
<button class="btn btn-default dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
</button>';
$html .= '<ul class="dropdown-menu">';
foreach ($this->form_actions as $action => & $label) {
$html .= '<li><a data-action ="'.$action.'" href="#" onclick="javascript:action_click(this, \''.$table_id.'\');">'.$label.'</a></li>';
}
$html .= '</ul>';
$html .= '</div>';//btn-group
$html .= '</div>'; //toolbar
} else {
$html .= $form;
@ -336,7 +333,7 @@ class SortableTable extends HTML_Table
$html .= '</form>';
}
}
return '<div class="table-responsive">' . $html . '</div>';
}
@ -346,7 +343,6 @@ class SortableTable extends HTML_Table
**/
public function display_grid()
{
$empty_table = false;
if ($this->get_total_number_of_items() == 0) {
$cols = $this->getColCount();
@ -358,7 +354,7 @@ class SortableTable extends HTML_Table
$html = '';
if (!$empty_table) {
$form = $this->get_page_select_form();
$nav = $this->get_navigation_html();
$nav = $this->get_navigation_html();
// @todo This style css must be moved to default.css only for dev
echo '<style>
@ -558,11 +554,12 @@ class SortableTable extends HTML_Table
*/
public function get_navigation_html()
{
$pager = $this->get_pager();
$pager_links = $pager->getLinks();
$nav = $pager_links['first'].' '.$pager_links['back'];
$nav .= ' '.$pager->getCurrentPageId().' / '.$pager->numPages().' ';
$nav .= $pager_links['next'].' '.$pager_links['last'];
$pager = $this->get_pager();
$pager_links = $pager->getLinks();
$nav = $pager_links['first'].' '.$pager_links['back'];
$nav .= ' '.$pager->getCurrentPageId().' / '.$pager->numPages().' ';
$nav .= $pager_links['next'].' '.$pager_links['last'];
return $nav;
}
@ -583,6 +580,7 @@ class SortableTable extends HTML_Table
$count = 1;
foreach ($table_data as & $row) {
$row = $this->filter_data($row);
$newRow = array();
if (!empty($this->columnsToHide)) {
$counter = 0;
@ -613,6 +611,7 @@ class SortableTable extends HTML_Table
foreach ($this->td_attributes as $column => $attributes) {
$this->setColAttributes($column, $attributes);
}
return $this->toHTML();
}
@ -623,9 +622,9 @@ class SortableTable extends HTML_Table
*/
public function get_clean_html($sort = true)
{
$pager = $this->get_pager();
$offset = $pager->getOffsetByPageId();
$from = $offset[0] - 1;
$pager = $this->get_pager();
$offset = $pager->getOffsetByPageId();
$from = $offset[0] - 1;
$table_data = $this->get_table_data($from, null, null, null, $sort);
@ -636,6 +635,7 @@ class SortableTable extends HTML_Table
$new_table_data[] = $row;
}
}
return $new_table_data;
}
@ -685,6 +685,7 @@ class SortableTable extends HTML_Table
{
$pager = $this->get_pager();
$showed_items = $pager->getOffsetByPageId();
return $showed_items[0].' - '.$showed_items[1].' / '.$this->get_total_number_of_items();
}
@ -763,8 +764,13 @@ class SortableTable extends HTML_Table
* @param string $td_attributes Additional attributes for the td-tags of the
* column
*/
public function set_header($column, $label, $sortable = true, $th_attributes = array('class' => 'th-header'), $td_attributes = null)
{
public function set_header(
$column,
$label,
$sortable = true,
$th_attributes = array('class' => 'th-header'),
$td_attributes = null
) {
$this->headers[$column] = array(
'label' => $label,
'sortable' => $sortable,
@ -810,8 +816,9 @@ class SortableTable extends HTML_Table
foreach ($param as $key => & $value) {
$param_string_parts[] = urlencode($key).'='.urlencode($value);
}
if (count($param_string_parts) > 0)
if (count($param_string_parts) > 0) {
$result .= '&amp;'.implode('&amp;', $param_string_parts);
}
}
return $result;
}
@ -831,6 +838,7 @@ class SortableTable extends HTML_Table
$param_string_parts[] = urlencode($key).'='.urlencode($value);
}
$res = implode('&amp;', $param_string_parts);
return $res;
}
@ -901,10 +909,10 @@ class SortableTable extends HTML_Table
*/
public function filter_data($row)
{
$url_params = $this->get_sortable_table_param_string().'&amp;'.$this->get_additional_url_paramstring();
$url_params = $this->get_sortable_table_param_string().'&'.$this->get_additional_url_paramstring();
foreach ($this->column_filters as $column => & $function) {
$firstParam = isset($row[$column]) ? $row[$column] : 0;
$row[$column] = call_user_func($function, $firstParam, $url_params, $row);
}
if (count($this->form_actions) > 0) {
@ -923,6 +931,7 @@ class SortableTable extends HTML_Table
}
}
}
return $row;
}
@ -966,8 +975,6 @@ class SortableTable extends HTML_Table
return $data;
}
}
/**
@ -1032,7 +1039,6 @@ class SortableTableFromArray extends SortableTable
}
}
/**
* Sortable table which can be used for data available in an array
*

@ -294,8 +294,11 @@ class UserManager
//Checking the user language
$languages = api_get_languages();
$language = strtolower($language);
if (!in_array($language, $languages['folder'])) {
$language = api_get_setting('platformLanguage');
if (isset($languages['folder'])) {
if (!in_array($language, $languages['folder'])) {
$language = api_get_setting('platformLanguage');
}
}
if (!empty($currentUserId)) {
@ -1365,7 +1368,7 @@ class UserManager
$result['complete_name'] = api_get_person_name(
$result['firstname'],
$result['lastname']
$result['lastname']
);
$return_array[] = $result;
}
@ -4832,7 +4835,7 @@ EOF;
/**
* Subscribe boss to students
*
*
* @param int $bossId The boss id
* @param array $usersId The users array
* @return int Affected rows

@ -242,3 +242,7 @@ $_configuration['system_stable'] = NEW_VERSION_STABLE;
//$_configuration['messaging_gdc_api_key'] = '';
// New grid view the list of courses
//$_configuration['view_grid_courses'] = true;
// Chamilo is installed/downloaded. Packagers can change this
// to reflect their packaging method. The default value is 'chamilo'. This will
// be reflected on the https://version.chamilo.org/stats page in the future.
//$_configuration['packager'] = 'chamilo';

@ -310,6 +310,8 @@ VALUES
('allow_coach_feedback_exercises',NULL,'radio','Session','true','AllowCoachFeedbackExercisesTitle','AllowCoachFeedbackExercisesComment',NULL,NULL, 0),
('allow_my_files',NULL,'radio','Platform','true','AllowMyFilesTitle','AllowMyFilesComment','',NULL, 1),
('ticket_allow_student_add', NULL, 'radio','Ticket', 'false','TicketAllowStudentAddTitle','TicketAllowStudentAddComment',NULL,NULL, 0),
('ticket_send_warning_to_all_admins', NULL, 'radio','Ticket', 'false','TicketSendWarningToAllAdminsTitle','TicketSendWarningToAllAdminsComment',NULL,NULL, 0),
('ticket_warn_admin_no_user_in_category', NULL, 'radio','Ticket', 'false','TicketWarnAdminNoUserInCategoryTitle','TicketWarnAdminNoUserInCategoryComment',NULL,NULL, 0),
('ticket_allow_category_edition', NULL, 'radio','Ticket', 'false','TicketAllowCategoryEditionTitle','TicketAllowCategoryEditionComment',NULL,NULL, 0);
INSERT INTO settings_options (variable, value, display_text)
@ -630,11 +632,15 @@ VALUES
('allow_coach_feedback_exercises','true','Yes'),
('allow_coach_feedback_exercises','false','No'),
('allow_my_files','true','Yes'),
('allow_my_files','false','No')
('allow_my_files','false','No'),
('ticket_allow_student_add','true','Yes'),
('ticket_allow_student_add','false','No'),
('ticket_allow_category_edition','true','Yes'),
('ticket_allow_category_edition','false','No');
('ticket_allow_category_edition', 'true', 'Yes'),
('ticket_allow_category_edition', 'false', 'No'),
('ticket_send_warning_to_all_admins', 'true', 'Yes'),
('ticket_send_warning_to_all_admins', 'false', 'No'),
('ticket_warn_admin_no_user_in_category', 'true', 'Yes'),
('ticket_warn_admin_no_user_in_category', 'false', 'No');
INSERT INTO language (original_name, english_name, isocode, dokeos_folder, available) VALUES
('&#1575;&#1604;&#1593;&#1585;&#1576;&#1610;&#1577;','arabic','ar','arabic',0),

@ -814,7 +814,6 @@ if (@$_POST['step2']) {
$connection = $manager->getConnection();
$connection->executeQuery(
'CREATE TABLE page__site (id INT AUTO_INCREMENT NOT NULL, enabled TINYINT(1) NOT NULL, name VARCHAR(255) NOT NULL, relative_path VARCHAR(255) DEFAULT NULL, host VARCHAR(255) NOT NULL, enabled_from DATETIME DEFAULT NULL, enabled_to DATETIME DEFAULT NULL, is_default TINYINT(1) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, locale VARCHAR(6) DEFAULT NULL, title VARCHAR(64) DEFAULT NULL, meta_keywords VARCHAR(255) DEFAULT NULL, meta_description VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB'
);
@ -917,6 +916,93 @@ if (@$_POST['step2']) {
$connection->executeQuery("ALTER TABLE faq_category_translation ADD CONSTRAINT FK_5493B0FC2C2AC5D3 FOREIGN KEY (translatable_id) REFERENCES faq_category (id) ON DELETE CASCADE;");
$connection->executeQuery("ALTER TABLE faq_question ADD CONSTRAINT FK_4A55B05912469DE2 FOREIGN KEY (category_id) REFERENCES faq_category (id);");
// Tickets
$table = Database::get_main_table(TABLE_TICKET_PROJECT);
// Default Project Table Ticket
$attributes = array(
'id' => 1,
'name' => 'Ticket System'
);
Database::insert($table, $attributes);
$categories = array(
get_lang('Enrollment') => get_lang('TicketsAboutEnrollment'),
get_lang('GeneralInformation') => get_lang('TicketsAboutGeneralInformation'),
get_lang('RequestAndPapework') => get_lang('TicketsAboutRequestAndPapework'),
get_lang('AcademicIncidence') => get_lang('TicketsAboutAcademicIncidence'),
get_lang('VirtualCampus') => get_lang('TicketsAboutVirtualCampus'),
get_lang('OnlineEvaluation') => get_lang('TicketsAboutOnlineEvaluation')
);
$i = 1;
$table = Database::get_main_table(TABLE_TICKET_CATEGORY);
foreach ($categories as $category => $description) {
// Online evaluation requires a course
if ($i == 6) {
$attributes = array(
'id' => $i,
'name' => $category,
'description' => $description,
'project_id' => 1,
'course_required' => 1
);
} else {
$attributes = array(
'id' => $i,
'project_id' => 1,
'description' => $description,
'name' => $category,
'course_required' => 0
);
}
Database::insert($table, $attributes);
$i++;
}
// Default Priorities
$defaultPriorities = array(
TicketManager::PRIORITY_NORMAL => get_lang('PriorityNormal'),
TicketManager::PRIORITY_HIGH => get_lang('PriorityHigh'),
TicketManager::PRIORITY_LOW => get_lang('PriorityLow')
);
$table = Database::get_main_table(TABLE_TICKET_PRIORITY);
$i = 1;
foreach ($defaultPriorities as $code => $priority) {
$attributes = array(
'id' => $i,
'name' => $priority,
'code' => $code
);
Database::insert($table, $attributes);
$i++;
}
$table = Database::get_main_table(TABLE_TICKET_STATUS);
// Default status
$defaultStatus = array(
TicketManager::STATUS_NEW => get_lang('StatusNew'),
TicketManager::STATUS_PENDING => get_lang('StatusPending'),
TicketManager::STATUS_UNCONFIRMED => get_lang('StatusUnconfirmed'),
TicketManager::STATUS_CLOSE => get_lang('StatusClose'),
TicketManager::STATUS_FORWARDED => get_lang('StatusForwarded')
);
$i = 1;
foreach ($defaultStatus as $code => $status) {
$attributes = array(
'id' => $i,
'code' => $code,
'name' => $status
);
Database::insert($table, $attributes);
$i++;
}
$sysPath = api_get_path(SYS_PATH);

@ -7,8 +7,10 @@
*/
// Initialize context
$_in_course = true;
require_once __DIR__.'/../inc/global.inc.php';
$current_course_tool = TOOL_GRADEBOOK;
require_once __DIR__ . '/../inc/global.inc.php';
$current_course_tool = TOOL_GRADEBOOK;
// Make sure no anonymous user gets here without permission
api_protect_course_script(true);
@ -40,7 +42,11 @@ $currentItemId = $lp->get_current_item_id();
$currentItem = $lp->items[$currentItemId];
$currentItemStatus = $currentItem->get_status();
$accessGranted = false;
if (($count - $completed == 0) or (($count - $completed == 1 && ($currentItemStatus == 'incomplete') or ($currentItemStatus == 'not attempted') ))) {
if (
($count - $completed == 0) or
($count - $completed == 1 && ($currentItemStatus == 'incomplete') or ($currentItemStatus == 'not attempted'))
) {
if ($lp->prerequisites_match($currentItemId)) {
$accessGranted = true;
}
@ -62,10 +68,14 @@ if ($accessGranted == false) {
// If not gradebook has been defined
if (empty($catLoad)) {
$finalItemTemplate = generateLPFinalItemTemplate($id, $courseCode, $sessionId, $downloadCertificateLink,
$badgeLink);
$finalItemTemplate = generateLPFinalItemTemplate(
$id,
$courseCode,
$sessionId,
$downloadCertificateLink,
$badgeLink
);
// TODO: Missing validation of learning path completion
} else {
// A gradebook was found, proceed...
$categoryId = $catLoad[0]->get_id();
@ -78,10 +88,8 @@ if ($accessGranted == false) {
if ($show_message == '') {
if (!api_is_allowed_to_edit() && !api_is_excluded_user_type()) {
$certificate = Category::register_user_certificate(
$categoryId,
$userId
);
$certificate = Category::register_user_certificate($categoryId, $userId);
if (!empty($certificate['pdf_url']) || !empty($certificate['badge_link'])) {
if (is_array($certificate) && isset($certificate['pdf_url'])) {
$downloadCertificateLink = generateLPFinalItemTemplateCertificateLinks($certificate);
@ -92,13 +100,18 @@ if ($accessGranted == false) {
$badgeLink = generateLPFinalItemTemplateBadgeLinks($userId, $courseId, $sessionId);
}
}
$currentScore = Category::getCurrentScore($userId, $categoryId, $courseCode, $sessionId, true);
Category::registerCurrentScore($currentScore, $userId, $categoryId);
}
}
}
$finalItemTemplate = generateLPFinalItemTemplate($id, $courseCode, $sessionId, $downloadCertificateLink,
$badgeLink);
$finalItemTemplate = generateLPFinalItemTemplate($id, $courseCode, $downloadCertificateLink, $badgeLink);
if (!$finalItemTemplate) {
Display::display_warning_message(get_lang('FileNotFound'));
}
}
}
@ -118,7 +131,7 @@ $tpl->display_one_col_template();
* @param string $badgeLink
* @return mixed|string
*/
function generateLPFinalItemTemplate($lpItemId, $courseCode, $sessionId=0, $downloadCertificateLink='', $badgeLink='')
function generateLPFinalItemTemplate($lpItemId, $courseCode, $sessionId = 0, $downloadCertificateLink = '', $badgeLink = '')
{
$documentInfo = DocumentManager::get_document_data_by_id(
$lpItemId,
@ -131,6 +144,7 @@ function generateLPFinalItemTemplate($lpItemId, $courseCode, $sessionId=0, $down
$finalItemTemplate = str_replace('((certificate))', $downloadCertificateLink, $finalItemTemplate);
$finalItemTemplate = str_replace('((skill))', $badgeLink, $finalItemTemplate);
return $finalItemTemplate;
}
@ -141,48 +155,48 @@ function generateLPFinalItemTemplate($lpItemId, $courseCode, $sessionId=0, $down
* @param int $sessionId
* @return string HTML string for badges
*/
function generateLPFinalItemTemplateBadgeLinks($userId, $courseId, $sessionId=0)
function generateLPFinalItemTemplateBadgeLinks($userId, $courseId, $sessionId = 0)
{
$em = Database::getManager();
$skillRelUser = new SkillRelUser();
$userSkills = $skillRelUser->get_user_skills($userId, $courseId, $sessionId);
$skillList = '';
$badgeLink = '';
if ($userSkills) {
$skill = new Skill();
foreach ($userSkills as $userSkill) {
$oneSkill = $skill->get($userSkill['skill_id']);
$skill = $em->find('ChamiloCoreBundle:Skill', $userSkill['skill_id']);
$skillList .= "
<div class='row'>
<div class='col-md-2 col-xs-6'>
<div class='thumbnail'>
<img class='skill-badge-img' src='" . $oneSkill['web_icon_path'] . "' >
</div>
</div>
<div class='col-md-8 col-xs-6'>
<h5><b>" . $oneSkill['name'] . "</b></h5>
" . $oneSkill['description'] . "
</div>
<div class='col-md-2 col-xs-12'>
<h5><b>" . get_lang('ShareWithYourFriends') . "</b></h5>
<a href='http://www.facebook.com/sharer.php?u=" . api_get_path(WEB_PATH) . "badge/" . $oneSkill['id'] . "/user/" . $userId . "' target='_new'>
<em class='fa fa-facebook-square fa-3x text-info' aria-hidden='true'></em>
</a>
<a href='https://twitter.com/home?status=" . api_get_path(WEB_PATH) . "badge/" . $oneSkill['id'] . "/user/" . $userId . "' target='_new'>
<em class='fa fa-twitter-square fa-3x text-light' aria-hidden='true'></em>
</a>
</div>
</div>
";
<div class='row'>
<div class='col-md-2 col-xs-4'>
<div class='thumbnail'>
<img class='skill-badge-img' src='" . $skill->getWebIconPath() . "' >
</div>
</div>
<div class='col-md-8 col-xs-8'>
<h5><b>" . $skill->getName() . "</b></h5>
" . $skill->getDescription() . "
</div>
<div class='col-md-2 col-xs-12'>
<h5><b>" . get_lang('ShareWithYourFriends') . "</b></h5>
<a href='http://www.facebook.com/sharer.php?u=" . api_get_path(WEB_PATH) . "badge/" . $skill->getId() . "/user/" . $userId . "' target='_new'>
<em class='fa fa-facebook-square fa-3x text-info' aria-hidden='true'></em>
</a>
<a href='https://twitter.com/home?status=" . sprintf(get_lang('IHaveObtainedSkillXOnY'), '"' . $skill->getName() . '"', api_get_setting('siteName')) . ' - ' . api_get_path(WEB_PATH) . 'badge/' . $skill->getId() . '/user/' . $userId . "' target='_new'>
<em class='fa fa-twitter-square fa-3x text-light' aria-hidden='true'></em>
</a>
</div>
</div>
";
}
$badgeLink .= "
<div class='panel panel-default'>
<div class='panel-body'>
<h3 class='text-center'>" . get_lang('AdditionallyYouHaveObtainedTheFollowingSkills') . "</h3>
$skillList
</div>
</div>
";
<div class='panel panel-default'>
<div class='panel-body'>
<h3 class='text-center'>" . get_lang('AdditionallyYouHaveObtainedTheFollowingSkills') . "</h3>
$skillList
</div>
</div>
";
}
return $badgeLink;
}
@ -194,19 +208,19 @@ function generateLPFinalItemTemplateBadgeLinks($userId, $courseId, $sessionId=0)
*/
function generateLPFinalItemTemplateCertificateLinks($certificate)
{
$downloadCertificateLink = Display::url(Display::returnFontAwesomeIcon('file-pdf-o') .
get_lang('DownloadCertificatePdf'),
$downloadCertificateLink = Display::url(
Display::returnFontAwesomeIcon('file-pdf-o') . get_lang('DownloadCertificatePdf'),
$certificate['pdf_url'],
['class' => 'btn btn-default']
);
$viewCertificateLink = $certificate['certificate_link'];
$downloadCertificateLink = "
<div class='panel panel-default'>
<div class='panel-body'>
<h3 class='text-center'>" . get_lang('NowDownloadYourCertificateClickHere') . "</h3>
<div class='text-center'>$downloadCertificateLink $viewCertificateLink</div>
</div>
</div>
";
<div class='panel panel-default'>
<div class='panel-body'>
<h3 class='text-center'>" . get_lang('NowDownloadYourCertificateClickHere') . "</h3>
<div class='text-center'>$downloadCertificateLink $viewCertificateLink</div>
</div>
</div>
";
return $downloadCertificateLink;
}
}

@ -36,7 +36,7 @@ $formToString = '';
$id = isset($_GET['id']) ? intval($_GET['id']) : 0;
$interbreadcrumb[] = array(
'url' => api_get_path(WEB_CODE_PATH).'ticket/myticket.php',
'url' => api_get_path(WEB_CODE_PATH).'ticket/tickets.php',
'name' => get_lang('MyTickets')
);

@ -50,7 +50,7 @@ if ($form->validate()) {
}
$interbreadcrumb[] = array(
'url' => api_get_path(WEB_CODE_PATH).'ticket/myticket.php',
'url' => api_get_path(WEB_CODE_PATH).'ticket/tickets.php',
'name' => get_lang('MyTickets')
);
$interbreadcrumb[] = array(

@ -7,5 +7,5 @@
*/
require_once __DIR__.'/../inc/global.inc.php';
header('Location:' . api_get_path(WEB_CODE_PATH) . 'ticket/myticket.php');
header('Location:' . api_get_path(WEB_CODE_PATH) . 'ticket/tickets.php');
exit;

@ -8,9 +8,8 @@
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';
if (!api_is_platform_admin() && api_get_setting('ticket_allow_student_add') != 'true'
) {
header('location:' . api_get_path(WEB_CODE_PATH).'ticket/myticket.php');
if (!api_is_platform_admin() && api_get_setting('ticket_allow_student_add') != 'true') {
header('location:' . api_get_path(WEB_CODE_PATH).'ticket/tickets.php');
exit;
}
@ -204,7 +203,8 @@ function show_form_send_ticket()
'for' => 'status_id'
);
$statusList[TicketManager::STATUS_NEW] = get_lang('StatusNew');
$statusList = TicketManager::getStatusList();
/*$statusList[TicketManager::STATUS_NEW] = get_lang('StatusNew');
if (api_is_platform_admin()) {
$statusAttributes = array(
'id' => 'status_id',
@ -215,7 +215,7 @@ function show_form_send_ticket()
$statusList[TicketManager::STATUS_UNCONFIRMED] = get_lang('StatusUnconfirmed');
$statusList[TicketManager::STATUS_CLOSE] = get_lang('StatusClose');
$statusList[TicketManager::STATUS_FORWARDED] = get_lang('StatusForwarded');
}
}*/
//End Status List
// Source List
@ -238,10 +238,11 @@ function show_form_send_ticket()
}
// Priority List
$priorityList = array();
/*$priorityList = array();
$priorityList[TicketManager::PRIORITY_NORMAL] = get_lang('PriorityNormal');
$priorityList[TicketManager::PRIORITY_HIGH] = get_lang('PriorityHigh');
$priorityList[TicketManager::PRIORITY_LOW] = get_lang('PriorityLow');
$priorityList[TicketManager::PRIORITY_LOW] = get_lang('PriorityLow');*/
$priorityList = TicketManager::getPriorityList();
$form = new FormValidator(
'send_ticket',
@ -419,14 +420,14 @@ function show_form_send_ticket()
*/
function save_ticket()
{
global $plugin;
$category_id = $_POST['category_id'];
$content = $_POST['content'];
if ($_POST['phone'] != '') {
$content .= '<p style="color:red">&nbsp;' . get_lang('Phone') . ': ' . Security::remove_XSS($_POST['phone']). '</p>';
}
$course_id = isset($_POST['course_id']) ? $_POST['course_id'] : 0;
$course_id = isset($_POST['course_id']) ? $_POST['course_id'] : '';
$project_id = $_POST['project_id'];
$project_id = 1;
$subject = $_POST['subject'];
$other_area = (int) $_POST['other_area'];
$email = $_POST['email'];
@ -455,7 +456,7 @@ function save_ticket()
Display::addFlash(
Display::return_message(get_lang('TckSuccessSave'), 'success')
);
header('Location:' . api_get_path(WEB_CODE_PATH).'/ticket/myticket.php');
header('Location:' . api_get_path(WEB_CODE_PATH).'ticket/tickets.php');
exit;
} else {
Display::display_header(get_lang('ComposeMessage'));
@ -570,7 +571,7 @@ function get_user_data($from, $number_of_items, $column, $direction)
}
$interbreadcrumb[] = array(
'url' => api_get_path(WEB_CODE_PATH).'ticket/myticket.php',
'url' => api_get_path(WEB_CODE_PATH).'ticket/tickets.php',
'name' => get_lang('MyTickets')
);

@ -36,7 +36,7 @@ $formToString = '';
$id = isset($_GET['id']) ? intval($_GET['id']) : 0;
$interbreadcrumb[] = array(
'url' => api_get_path(WEB_CODE_PATH).'ticket/myticket.php',
'url' => api_get_path(WEB_CODE_PATH).'ticket/tickets.php',
'name' => get_lang('MyTickets')
);
@ -63,11 +63,7 @@ if (isset($_GET['action'])) {
$params = [
'name' => $values['name'],
'description' => $values['description'],
'total_tickets' => 0,
'sys_insert_user_id' => api_get_user_id(),
'sys_insert_datetime' => api_get_utc_datetime(),
'course_required' => ''
'description' => $values['description']
];
TicketManager::addProject($params);
@ -86,8 +82,11 @@ if (isset($_GET['action'])) {
$url = api_get_self().'?action=edit&id='.$id;
$form = TicketManager::getProjectForm($url);
$cat = TicketManager::getProject($_GET['id']);
$form->setDefaults($cat);
$item = TicketManager::getProject($_GET['id']);
$form->setDefaults([
'name' => $item->getName(),
'description' => $item->getDescription()]
);
$formToString = $form->returnForm();
if ($form->validate()) {
$values =$form->getSubmitValues();
@ -138,7 +137,7 @@ $table->set_header(0, '', false);
$table->set_header(1, get_lang('Title'), false);
$table->set_header(2, get_lang('Description'), true, array("style" => "width:200px"));
$table->set_header(3, get_lang('Actions'), true);
$table->set_column_filter(3, 'modify_filter');
$table->set_column_filter('3', 'modify_filter');
Display::display_header($toolName);

@ -13,7 +13,7 @@ api_block_anonymous_users();
$user_id = api_get_user_id();
$isAdmin = api_is_platform_admin();
$interbreadcrumb[] = array(
'url' => api_get_path(WEB_CODE_PATH).'ticket/myticket.php',
'url' => api_get_path(WEB_CODE_PATH).'ticket/tickets.php',
'name' => get_lang('MyTickets')
);
$interbreadcrumb[] = array('url' => '#', 'name' => get_lang('TicketDetail'));
@ -183,16 +183,16 @@ if (!isset($ticket['ticket'])) {
api_not_allowed();
}
if (!isset($_GET['ticket_id'])) {
header('Location: '.api_get_path(WEB_CODE_PATH).'ticket/myticket.php');
header('Location: '.api_get_path(WEB_CODE_PATH).'ticket/tickets.php');
exit;
}
if (isset($_POST['response'])) {
if ($user_id == $ticket['ticket']['request_user']) {
$response = ($_POST['response'] == "1") ? true : ($_POST['response'] == "0" ? false : null);
if ($user_id == $ticket['ticket']['assigned_last_user']) {
$response = $_POST['response'] == '1' ? true : $_POST['response'] == "0" ? false : null;
if ($response && $ticket['ticket']['status_id'] == TicketManager::STATUS_UNCONFIRMED) {
TicketManager::close_ticket($_GET['ticket_id'], $user_id);
/*TicketManager::close_ticket($_GET['ticket_id'], $user_id);
$ticket['ticket']['status_id'] = TicketManager::STATUS_CLOSE;
$ticket['ticket']['status'] = get_lang('Closed');
$ticket['ticket']['status'] = get_lang('Closed');*/
} else if (!is_null($response) && $ticket['ticket']['status_id'] == TicketManager::STATUS_UNCONFIRMED) {
TicketManager::update_ticket_status(TicketManager::STATUS_PENDING, $_GET['ticket_id'], $user_id);
$ticket['ticket']['status_id'] = TicketManager::STATUS_PENDING;
@ -242,12 +242,12 @@ if (!isset($_POST['compose'])) {
$ticket['ticket']['status_id'] != TicketManager::STATUS_CLOSE &&
$isAdmin
) {
if (intval($ticket['ticket']['assigned_last_user']) == $user_id) {
/*if (intval($ticket['ticket']['assigned_last_user']) == $user_id) {
if ($ticket['ticket']['status_id'] != TicketManager::STATUS_CLOSE) {
$form_close_ticket.= '<a href="' . api_get_self() . '?close=1&ticket_id=' . $ticket['ticket']['id'] . '" id="close" class="btn btn-danger" >';
$form_close_ticket.= get_lang('Close') . '</a>';
}
}
}*/
}
$img_assing = '';
@ -473,7 +473,8 @@ function show_form_send_message($ticket)
);
if ($isAdmin) {
$statusList[TicketManager::STATUS_NEW] = get_lang('StatusNew');
/*$statusList[TicketManager::STATUS_NEW] = get_lang('StatusNew');
$statusAttributes = array(
'id' => 'status_id',
'for' => 'status_id',
@ -482,21 +483,21 @@ function show_form_send_message($ticket)
$statusList[TicketManager::STATUS_PENDING] = get_lang('StatusPending');
$statusList[TicketManager::STATUS_UNCONFIRMED] = get_lang('StatusUnconfirmed');
$statusList[TicketManager::STATUS_CLOSE] = get_lang('StatusClose');
$statusList[TicketManager::STATUS_FORWARDED] = get_lang('StatusForwarded');
$statusList[TicketManager::STATUS_FORWARDED] = get_lang('StatusForwarded');*/
$statusList = TicketManager::getStatusList();
$form->addElement(
'select',
'status_id',
get_lang('Status'),
$statusList,
$statusAttributes
$statusList
);
$priorityList = array();
/*$priorityList = array();
$priorityList[TicketManager::PRIORITY_NORMAL] = get_lang('PriorityNormal');
$priorityList[TicketManager::PRIORITY_HIGH] = get_lang('PriorityHigh');
$priorityList[TicketManager::PRIORITY_LOW] = get_lang('PriorityLow');
$priorityList[TicketManager::PRIORITY_LOW] = get_lang('PriorityLow');*/
$priorityList = TicketManager::getPriorityList();
$form->addElement(
'select',
'priority_id',

@ -225,6 +225,11 @@ if ($isAdmin) {
Display::return_icon('folder_document.gif'),
api_get_path(WEB_CODE_PATH) . 'ticket/categories.php'
);
echo Display::url(
Display::return_icon('folder_document.gif'),
api_get_path(WEB_CODE_PATH) . 'ticket/projects.php'
);
}
echo Display::url(

@ -0,0 +1,17 @@
# The Azure Active Directory Plugin
Allow authentication with Microsoft's Azure Active Directory
### To configure Azure Active Directory
* [Create an Azure AD B2C tenant](https://azure.microsoft.com/en-us/documentation/articles/active-directory-b2c-get-started/)
* [Register your application](https://azure.microsoft.com/en-us/documentation/articles/active-directory-b2c-app-registration/)
* [Configure Facebook, Google+, Microsoft account, Amazon, and LinkedIn accounts for use in your consumer-facing applications](https://azure.microsoft.com/en-us/documentation/articles/active-directory-b2c-overview/#how-to-articles)
### To configure this plugin
* Enable
* Application ID: Enter the Application Id assinged to your app by the Azure portal, e.g. 580e250c-8f26-49d0-bee8-1c078add1609
* Tenant: Enter the name of your B2C directory, e.g. contoso.onmicrosoft.com
* Sign up policy: Enter your sign up policy name, e.g. b2c_1_sign_up
* Sign in policy: Enter your sign in policy name, e.g. b2c_1_sign_in
* Block name: (Optional) The name to show above the buttons
And assign a region. Preferably `login_bottom`

@ -0,0 +1,14 @@
<?php
/* For licensing terms, see /license.txt */
/**
* @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com>
* @package chamilo.plugin.azure_active_directory
*/
$activeDirectoryPlugin = AzureActiveDirectory::create();
if ($activeDirectoryPlugin->get(AzureActiveDirectory::SETTING_ENABLE) === 'true') {
$_template['block_title'] = $activeDirectoryPlugin->get(AzureActiveDirectory::SETTING_BLOCK_NAME);
$_template['signup_url'] = $activeDirectoryPlugin->getUrl(AzureActiveDirectory::URL_TYPE_SIGNUP);
$_template['signin_url'] = $activeDirectoryPlugin->getUrl(AzureActiveDirectory::URL_TYPE_SIGNIN);
$_template['signout_url'] = $activeDirectoryPlugin->getUrl(AzureActiveDirectory::URL_TYPE_SIGNOUT);
}

@ -0,0 +1,20 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Strings to english L10n
* @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com>
* @package chamilo.plugin.azure_active_directory
*/
$strings['plugin_title'] = 'Azure Active Directory';
$strings['plugin_comment'] = 'Allow authentication with Microsoft\'s Azure Active Directory';
$strings['enable'] = 'Enable';
$strings['app_id'] = 'Application ID';
$strings['app_id_help'] = 'Enter the Application Id assinged to your app by the Azure portal, e.g. 580e250c-8f26-49d0-bee8-1c078add1609';
$strings['tenant'] = 'Tenant';
$strings['tenant_help'] = 'Enter the name of your B2C directory, e.g. contoso.onmicrosoft.com';
$strings['signup_policy'] = 'Sign up policy';
$strings['signup_policy_help'] = 'Enter your sign up policy name, e.g.g b2c_1_sign_up';
$strings['signin_policy'] = 'Sign in policy';
$strings['signin_policy_help'] = 'Enter your sign in policy name, e.g. b2c_1_sign_in';
$strings['block_name'] = 'Block name';

@ -0,0 +1,9 @@
<?php
/* For licensing terms, see /license.txt */
/**
* @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com>
* @package chamilo.plugin.azure_active_directory
*/
$plugin_info = AzureActiveDirectory::create()->get_info();
$plugin_info['templates'] = array('view/block.tpl');

@ -0,0 +1,30 @@
<h1 class="page-header">The Azure Active Directory Plugin</h1>
<p>Allow authentication with Microsoft's Azure Active Directory</p>
<h3>To configure Azure Active Directory</h3>
<ul>
<li>
<a href="https://azure.microsoft.com/en-us/documentation/articles/active-directory-b2c-get-started/">
Create an Azure AD B2C tenant
</a>
</li>
<li>
<a href="https://azure.microsoft.com/en-us/documentation/articles/active-directory-b2c-app-registration/">
Register your application
</a>
</li>
<li>
<a href="https://azure.microsoft.com/en-us/documentation/articles/active-directory-b2c-overview/#how-to-articles">
Configure Facebook, Google+, Microsoft account, Amazon, and LinkedIn accounts for use in your consumer-facing applications
</a>
</li>
</ul>
<h3>To configure this plugin</h3>
<ul>
<li>Enable</li>
<li>Application ID: Enter the Application Id assinged to your app by the Azure portal, e.g. 580e250c-8f26-49d0-bee8-1c078add1609</li>
<li>Tenant: Enter the name of your B2C directory, e.g. contoso.onmicrosoft.com</li>
<li>Sign up policy: Enter your sign up policy name, e.g. b2c_1_sign_up</li>
<li>Sign in policy: Enter your sign in policy name, e.g. b2c_1_sign_in</li>
<li>Block name: (Optional) The name to show above the buttons</li>
</ul>
<p>And assign a region. Preferably <code>login_bottom</code></p>

@ -0,0 +1,102 @@
<?php
/**
* AzureActiveDirectory plugin class
* @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com>
* @package chamilo.plugin.azure_active_directory
*/
class AzureActiveDirectory extends Plugin
{
const SETTING_ENABLE = 'enable';
const SETTING_APP_ID = 'app_id';
const SETTING_TENANT = 'tenant';
const SETTING_SIGNUP_POLICY = 'signup_policy';
const SETTING_SIGNIN_POLICY = 'signin_policy';
const SETTING_BLOCK_NAME = 'block_name';
const URL_TYPE_SIGNUP = 'sign-up';
const URL_TYPE_SIGNIN = 'sign-in';
const URL_TYPE_SIGNOUT = 'sign-out';
/**
* AzureActiveDirectory constructor.
*/
protected function __construct()
{
$settings = [
self::SETTING_ENABLE => 'boolean',
self::SETTING_APP_ID => 'text',
self::SETTING_TENANT => 'text',
self::SETTING_SIGNUP_POLICY => 'text',
self::SETTING_SIGNIN_POLICY => 'text',
self::SETTING_BLOCK_NAME => 'text'
];
parent::__construct('1.0', 'Angel Fernando Quiroz Campos', $settings);
}
/**
* Instance the plugin
* @staticvar null $result
* @return Tour
*/
static function create()
{
static $result = null;
return $result ? $result : $result = new self();
}
/**
* @return string
*/
public function get_name()
{
return 'azure_active_directory';
}
/**
* @param $urlType Type of URL to generate
* @return string
*/
public function getUrl($urlType)
{
$settingsInfo = $this->get_settings();
$settings = [];
foreach ($settingsInfo as $settingInfo) {
$variable = str_replace($this->get_name() . '_', '', $settingInfo['variable']);
$settings[$variable] = $settingInfo['selected_value'];
}
$url = "https://login.microsoftonline.com/{$settings[self::SETTING_TENANT]}/oauth2/v2.0/";
$callback = api_get_path(WEB_PLUGIN_PATH) . $this->get_name() . '/src/callback.php';
if ($urlType === self::URL_TYPE_SIGNOUT) {
$action = 'logout';
$urlParams = [
'p' => $settings[self::SETTING_SIGNIN_POLICY],
'post_logout_redirect_uri' => $callback
];
} else {
$action = 'authorize';
$policy = $settings[self::SETTING_SIGNUP_POLICY];
if ($urlType === self::URL_TYPE_SIGNIN) {
$policy = $settings[self::SETTING_SIGNIN_POLICY];
}
$urlParams = [
'client_id' => $settings[self::SETTING_APP_ID],
'response_type' => 'id_token',
'redirect_uri' => $callback,
'scope' => 'openid',
'response_mode' => 'form_post',
'state' => time(),
'nonce' => time(),
'p' => $policy
];
}
return $url . $action . '?' . http_build_query($urlParams);
}
}

@ -0,0 +1,55 @@
<?php
require dirname(__FILE__) . '/../../../main/inc/global.inc.php';
require_once dirname(__FILE__) . '/../../../main/auth/external_login/functions.inc.php';
if (isset($_POST['error']) || empty($_REQUEST)) {
header('Location: ' . api_get_path(WEB_PATH) . 'index.php?logout=logout');
exit;
}
list($jwtHeader, $jwtPayload, $jwtSignature) = explode('.', $_REQUEST['id_token']);
$jwtHeader = json_decode(
base64_decode($jwtHeader)
);
$jwtPayload = json_decode(
base64_decode($jwtPayload)
);
$u = array(
'firstname' => $jwtPayload->given_name,
'lastname' => $jwtPayload->family_name,
'status' => STUDENT,
'email' => $jwtPayload->emails[0],
'username' => $jwtPayload->emails[0],
'language' => 'en',
'password' => 'azure_active_directory',
'auth_source' => 'azure_active_directory ' . $jwtPayload->idp,
'extra' => array()
);
$userInfo = api_get_user_info_from_email($jwtPayload->emails[0]);
if ($userInfo === false) {
// we have to create the user
$chamilo_uid = external_add_user($u);
if ($chamilo_uid !== false) {
$_user['user_id'] = $chamilo_uid;
$_user['uidReset'] = true;
$_SESSION['_user'] = $_user;
}
} else {
// User already exists, update info and login
$chamilo_uid = $userInfo['user_id'];
$u['user_id'] = $chamilo_uid;
external_update_user($u);
$_user['user_id'] = $chamilo_uid;
$_user['uidReset'] = true;
$_SESSION['_user'] = $_user;
}
header('Location: ' . api_get_path(WEB_PATH));
exit;

@ -0,0 +1,12 @@
<div id="azure-active-directory-login">
{% if _u.logged %}
{# <a href="{{ azure_active_directory.signout_url }}" class="btn btn-primary">{{ 'Logout'|get_lang }}</a> #}
{% else %}
{% if not azure_active_directory.block_title is empty %}
<h4>{{ azure_active_directory.block_title }}</h4>
{% endif %}
<a href="{{ azure_active_directory.signin_url }}" class="btn btn-default">{{ 'SignIn'|get_lang }}</a>
<a href="{{ azure_active_directory.signup_url }}" class="btn btn-success">{{ 'SignUp'|get_lang }}</a>
{% endif %}
</div>

@ -64,7 +64,7 @@ class bbb
}
}
if ($bbbPlugin === 'true') {
if ($bbbPlugin == true) {
$userInfo = api_get_user_info();
$this->userCompleteName = $userInfo['complete_name'];
$this->salt = $bbb_salt;

@ -10,7 +10,12 @@ use Sylius\Component\Attribute\Model\AttributeValue as BaseAttributeValue;
/**
* Class ExtraFieldValues
*
* @ORM\Table(name="extra_field_values")
* @ORM\Table(
* name="extra_field_values",
* indexes={
* @ORM\Index(name="idx_efv_fiii", columns={"field_id", "item_id"}),
* }
* )
* @ORM\Entity(repositoryClass="Chamilo\CoreBundle\Entity\Repository\ExtraFieldValuesRepository")
* @ORM\MappedSuperclass
*/

@ -18,7 +18,11 @@ use Doctrine\ORM\Mapping as ORM;
* Class UsergroupRelUser
*
* @ORM\Table(
* name="usergroup_rel_user"
* name="usergroup_rel_user",
* indexes={
* @ORM\Index(name="IDX_739515A9A76ED395", columns={"user_id"}),
* @ORM\Index(name="IDX_739515A9D2112630", columns={"usergroup_id"})
* }
* )
* @ORM\Entity
*/

@ -11,7 +11,8 @@ use Doctrine\ORM\Mapping as ORM;
* @ORM\Table(
* name="c_quiz_answer",
* indexes={
* @ORM\Index(name="c_id", columns={"c_id"})
* @ORM\Index(name="c_id", columns={"c_id"}),
* @ORM\Index(name="idx_cqa_q", columns={"question_id"})
* }
* )
* @ORM\Entity

@ -11,7 +11,8 @@ use Doctrine\ORM\Mapping as ORM;
* @ORM\Table(
* name="c_quiz_question_rel_category",
* indexes={
* @ORM\Index(name="course", columns={"c_id"})
* @ORM\Index(name="course", columns={"c_id"}),
* @ORM\Index(name="idx_qqrc_qid", columns={"question_id"})
* }
* )
* @ORM\Entity

@ -12,7 +12,8 @@ use Doctrine\ORM\Mapping as ORM;
* name="c_student_publication",
* indexes={
* @ORM\Index(name="course", columns={"c_id"}),
* @ORM\Index(name="session_id", columns={"session_id"})
* @ORM\Index(name="session_id", columns={"session_id"}),
* @ORM\Index(name="idx_csp_u", columns={"user_id"})
* }
* )
* @ORM\Entity

@ -87,4 +87,204 @@ class Priority
* @ORM\Column(name="sys_lastedit_datetime", type="datetime", nullable=true, unique=false)
*/
protected $lastEditDateTime;
/**
* Priority constructor.
*/
public function __construct()
{
$this->insertDateTime = new \DateTime();
}
/**
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* @param int $id
* @return Priority
*/
public function setId($id)
{
$this->id = $id;
return $this;
}
/**
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* @param string $name
* @return Priority
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* @return string
*/
public function getCode()
{
return $this->code;
}
/**
* @param string $code
* @return Priority
*/
public function setCode($code)
{
$this->code = $code;
return $this;
}
/**
* @return string
*/
public function getDescription()
{
return $this->description;
}
/**
* @param string $description
* @return Priority
*/
public function setDescription($description)
{
$this->description = $description;
return $this;
}
/**
* @return string
*/
public function getColor()
{
return $this->color;
}
/**
* @param string $color
* @return Priority
*/
public function setColor($color)
{
$this->color = $color;
return $this;
}
/**
* @return string
*/
public function getUrgency()
{
return $this->urgency;
}
/**
* @param string $urgency
* @return Priority
*/
public function setUrgency($urgency)
{
$this->urgency = $urgency;
return $this;
}
/**
* @return int
*/
public function getInsertUserId()
{
return $this->insertUserId;
}
/**
* @param int $insertUserId
* @return Priority
*/
public function setInsertUserId($insertUserId)
{
$this->insertUserId = $insertUserId;
return $this;
}
/**
* @return \DateTime
*/
public function getInsertDateTime()
{
return $this->insertDateTime;
}
/**
* @param \DateTime $insertDateTime
* @return Priority
*/
public function setInsertDateTime($insertDateTime)
{
$this->insertDateTime = $insertDateTime;
return $this;
}
/**
* @return int
*/
public function getLastEditUserId()
{
return $this->lastEditUserId;
}
/**
* @param int $lastEditUserId
* @return Priority
*/
public function setLastEditUserId($lastEditUserId)
{
$this->lastEditUserId = $lastEditUserId;
return $this;
}
/**
* @return \DateTime
*/
public function getLastEditDateTime()
{
return $this->lastEditDateTime;
}
/**
* @param \DateTime $lastEditDateTime
* @return Priority
*/
public function setLastEditDateTime($lastEditDateTime)
{
$this->lastEditDateTime = $lastEditDateTime;
return $this;
}
}

@ -59,7 +59,7 @@ class Project
* @ORM\Column(name="sys_insert_user_id", type="integer", nullable=false, unique=false)
*/
protected $insertUserId;
/**
* @var \DateTime
*
@ -80,4 +80,185 @@ class Project
* @ORM\Column(name="sys_lastedit_datetime", type="datetime", nullable=true, unique=false)
*/
protected $lastEditDateTime;
/**
* Project constructor.
*/
public function __construct()
{
$this->insertDateTime = new \DateTime();
}
/**
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* @param int $id
* @return Project
*/
public function setId($id)
{
$this->id = $id;
return $this;
}
/**
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* @param string $name
* @return Project
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* @return string
*/
public function getDescription()
{
return $this->description;
}
/**
* @param string $description
* @return Project
*/
public function setDescription($description)
{
$this->description = $description;
return $this;
}
/**
* @return string
*/
public function getEmail()
{
return $this->email;
}
/**
* @param string $email
* @return Project
*/
public function setEmail($email)
{
$this->email = $email;
return $this;
}
/**
* @return string
*/
public function getOtherArea()
{
return $this->otherArea;
}
/**
* @param string $otherArea
* @return Project
*/
public function setOtherArea($otherArea)
{
$this->otherArea = $otherArea;
return $this;
}
/**
* @return int
*/
public function getInsertUserId()
{
return $this->insertUserId;
}
/**
* @param int $insertUserId
* @return Project
*/
public function setInsertUserId($insertUserId)
{
$this->insertUserId = $insertUserId;
return $this;
}
/**
* @return \DateTime
*/
public function getInsertDateTime()
{
return $this->insertDateTime;
}
/**
* @param \DateTime $insertDateTime
* @return Project
*/
public function setInsertDateTime($insertDateTime)
{
$this->insertDateTime = $insertDateTime;
return $this;
}
/**
* @return int
*/
public function getLastEditUserId()
{
return $this->lastEditUserId;
}
/**
* @param int $lastEditUserId
* @return Project
*/
public function setLastEditUserId($lastEditUserId)
{
$this->lastEditUserId = $lastEditUserId;
return $this;
}
/**
* @return \DateTime
*/
public function getLastEditDateTime()
{
return $this->lastEditDateTime;
}
/**
* @param \DateTime $lastEditDateTime
* @return Project
*/
public function setLastEditDateTime($lastEditDateTime)
{
$this->lastEditDateTime = $lastEditDateTime;
return $this;
}
}

@ -45,4 +45,82 @@ class Status
* @ORM\Column(name="description", type="text", nullable=true)
*/
protected $description;
/**
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* @param int $id
* @return Status
*/
public function setId($id)
{
$this->id = $id;
return $this;
}
/**
* @return string
*/
public function getCode()
{
return $this->code;
}
/**
* @param string $code
* @return Status
*/
public function setCode($code)
{
$this->code = $code;
return $this;
}
/**
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* @param string $name
* @return Status
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* @return string
*/
public function getDescription()
{
return $this->description;
}
/**
* @param string $description
* @return Status
*/
public function setDescription($description)
{
$this->description = $description;
return $this;
}
}

Loading…
Cancel
Save