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

remotes/angel/1.11.x
Yannick Warnier 8 years ago
commit e993016911
  1. 10
      app/Resources/public/css/base.css
  2. 64
      main/admin/add_users_to_usergroup.php
  3. 2
      main/gradebook/gradebook_edit_link.php
  4. 24
      main/gradebook/gradebook_edit_result.php
  5. 46
      main/gradebook/gradebook_view_result.php
  6. 4
      main/gradebook/lib/GradebookUtils.php
  7. 16
      main/gradebook/lib/be/abstractlink.class.php
  8. 7
      main/gradebook/lib/be/category.class.php
  9. 2
      main/gradebook/lib/be/evaluation.class.php
  10. 5
      main/gradebook/lib/be/forumthreadlink.class.php
  11. 1
      main/gradebook/lib/be/linkfactory.class.php
  12. 2
      main/gradebook/lib/be/studentpublicationlink.class.php
  13. 70
      main/gradebook/lib/fe/displaygradebook.php
  14. 71
      main/gradebook/lib/fe/evalform.class.php
  15. 14
      main/gradebook/lib/fe/linkaddeditform.class.php
  16. 2
      main/gradebook/lib/fe/linkform.class.php
  17. 11
      main/gradebook/lib/fe/resulttable.class.php
  18. 200
      main/gradebook/lib/fe/scoredisplayform.class.php
  19. 2
      main/gradebook/lib/fe/userform.class.php
  20. 11
      main/gradebook/lib/flatview_data_generator.class.php
  21. 10
      main/gradebook/lib/gradebook_data_generator.class.php
  22. 2
      main/gradebook/lib/scoredisplay.class.php
  23. 47
      main/inc/lib/api.lib.php
  24. 11
      main/inc/lib/course.lib.php
  25. 8
      main/inc/lib/formvalidator/Rule/CompareDateTimeText.php
  26. 2
      main/inc/lib/pear/HTML/QuickForm.php
  27. 2
      main/inc/lib/pear/HTML/QuickForm/Rule/Compare.php
  28. 15
      main/inc/lib/sessionmanager.lib.php
  29. 17
      main/inc/lib/usermanager.lib.php
  30. 2
      main/install/configuration.dist.php
  31. 2
      main/lang/french/trad4all.inc.php
  32. 1
      main/lang/german/trad4all.inc.php
  33. 15
      main/lp/learnpath.class.php
  34. 6
      main/lp/lp_build.php
  35. 2
      main/social/friends.php
  36. 17
      main/social/home.php
  37. 4
      main/template/default/mail/mail.tpl
  38. 4
      main/work/work.lib.php
  39. 52
      plugin/vchamilo/install.php
  40. 5
      plugin/vchamilo/lang/english.php
  41. 13
      plugin/vchamilo/lib/Virtual.php
  42. 5
      plugin/vchamilo/views/editinstance_form.php

@ -1910,6 +1910,10 @@ div.admin_section h4 {
font-size: 22px;
margin: 0;
}
.question_row_answer img {
max-width: 80%;
height: auto !important;
}
.ribbon {
float:left;
width:100%;
@ -5687,7 +5691,11 @@ a.sessionView {
.modal-body .sectioncomment{
color: #666;
}
.progress{
border: 1px solid #c5c5c5;
background: #E9E9E9;
text-shadow: 1px 1px 1px rgba(0, 0, 0, 1);
}
.wami-container {
height: 144px;
position: relative;

@ -27,7 +27,6 @@ $interbreadcrumb[]= array('url' => 'usergroups.php','name' => get_lang('Classes'
$tool_name = get_lang('SubscribeUsersToClass');
$id = intval($_GET['id']);
$relation = isset($_REQUEST['relation']) ? intval($_REQUEST['relation']) : '';
$htmlHeadXtra[] = '
@ -98,7 +97,7 @@ $new_field_list = array();
if (is_array($extra_field_list)) {
foreach ($extra_field_list as $extra_field) {
//if is enabled to filter and is a "<select>" field type
if ($extra_field[8]==1 && $extra_field[2]==4 ) {
if ($extra_field[8] == 1 && $extra_field[2] == 4) {
$new_field_list[] = array(
'name'=> $extra_field[3],
'variable' => $extra_field[1], 'data'=> $extra_field[9]
@ -139,7 +138,6 @@ if (isset($_GET['action']) && $_GET['action'] == 'export') {
$groupInfo = $usergroup->get($id);
$users = $usergroup->getUserListByUserGroup($id);
if (!empty($users)) {
$data = array(
array('UserName', 'ClassName')
);
@ -152,11 +150,10 @@ if (isset($_GET['action']) && $_GET['action'] == 'export') {
}
}
// Filter by Extra Fields
$use_extra_fields = false;
if (is_array($extra_field_list)) {
if (is_array($new_field_list) && count($new_field_list)>0 ) {
if (is_array($new_field_list) && count($new_field_list) > 0) {
foreach ($new_field_list as $new_field) {
$varname = 'field_'.$new_field['variable'];
if (UserManager::is_extra_field_available($new_field['variable'])) {
@ -250,6 +247,7 @@ if (!empty($complete_user_list)) {
continue;
}
}
// Avoid anonymous users
if ($item['status'] == 6) {
continue;
@ -347,38 +345,36 @@ echo '</div>';
<?php
echo '<legend>'.$tool_name.': '.$data['name'].'</legend>';
if (is_array($extra_field_list)) {
if (is_array($new_field_list) && count($new_field_list)>0) {
echo '<h3>'.get_lang('FilterByUser').'</h3>';
foreach ($new_field_list as $new_field) {
echo $new_field['name'];
$varname = 'field_'.$new_field['variable'];
echo '&nbsp;<select name="'.$varname.'">';
echo '<option value="0">--'.get_lang('Select').'--</option>';
foreach ($new_field['data'] as $option) {
$checked='';
if (isset($_POST[$varname])) {
if ($_POST[$varname] == $option[1]) {
$checked = 'selected="true"';
}
if (is_array($extra_field_list)) {
if (is_array($new_field_list) && count($new_field_list)>0) {
echo '<h3>'.get_lang('FilterByUser').'</h3>';
foreach ($new_field_list as $new_field) {
echo $new_field['name'];
$varname = 'field_'.$new_field['variable'];
echo '&nbsp;<select name="'.$varname.'">';
echo '<option value="0">--'.get_lang('Select').'--</option>';
foreach ($new_field['data'] as $option) {
$checked='';
if (isset($_POST[$varname])) {
if ($_POST[$varname] == $option[1]) {
$checked = 'selected="true"';
}
echo '<option value="'.$option[1].'" '.$checked.'>'.$option[1].'</option>';
}
echo '</select>';
echo '&nbsp;&nbsp;';
echo '<option value="'.$option[1].'" '.$checked.'>'.$option[1].'</option>';
}
echo '<input type="button" value="'.get_lang('Filter').'" onclick="validate_filter()" />';
echo '<br /><br />';
echo '</select>';
echo '&nbsp;&nbsp;';
}
echo '<input type="button" value="'.get_lang('Filter').'" onclick="validate_filter()" />';
echo '<br /><br />';
}
}
echo Display::input('hidden', 'id', $id);
echo Display::input('hidden', 'form_sent', '1');
echo Display::input('hidden', 'add_type', null);
?>
<div class="row">
<div class="col-md-5">
<?php if ($data['group_type'] == UserGroup::SOCIAL_CLASS) { ?>
@ -412,7 +408,12 @@ echo Display::input('hidden', 'add_type', null);
'elements_not_in_name',
$elements_not_in,
'',
array('class'=>'col-md-7', 'multiple'=>'multiple','id'=>'elements_not_in','size'=>'15px'),
array(
'class' => 'form-control',
'multiple' => 'multiple',
'id' => 'elements_not_in',
'size' => '15px',
),
false
);
?>
@ -442,14 +443,18 @@ echo Display::input('hidden', 'add_type', null);
'elements_in_name[]',
$elements_in,
'',
array('class'=>'col-md-7', 'multiple'=>'multiple','id'=>'elements_in','size'=>'15px'),
array(
'class' => 'form-control',
'multiple' => 'multiple',
'id' => 'elements_in',
'size' => '15px'
),
false
);
unset($sessionUsersList);
?>
</div>
</div>
<?php
echo '<button class="btn btn-primary" type="button" value="" onclick="valide()" ><em class="fa fa-check"></em>'.
get_lang('SubscribeUsersToClass').'</button>';
@ -469,7 +474,6 @@ function moveItem(origin , destination) {
}
function sortOptions(options) {
newOptions = new Array();
for (i = 0 ; i<options.length ; i++)
newOptions[i] = options[i];

@ -70,7 +70,7 @@ if ($form->validate()) {
$row_attendance = Database::fetch_array($rs_attendance);
$attendance_id = $row_attendance['ref_id'];
$sql = 'UPDATE '.$tbl_attendance.' SET
attendance_weight ='.floatval($final_weight).'
attendance_weight ='.api_float_val($final_weight).'
WHERE c_id = '.$course_id.' AND id = '.intval($attendance_id);
Database::query($sql);
}

@ -1,5 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Script
* @package chamilo.gradebook
@ -11,8 +12,8 @@ $select_eval=Security::remove_XSS($_GET['selecteval']);
if (empty($select_eval)) {
api_not_allowed();
}
$resultedit = Result :: load (null,null,$select_eval);
$evaluation = Evaluation :: load ($select_eval);
$resultedit = Result::load(null, null, $select_eval);
$evaluation = Evaluation::load($select_eval);
$evaluation[0]->check_lock_permissions();
@ -22,25 +23,26 @@ $edit_result_form = new EvalForm(
$resultedit,
'edit_result_form',
null,
api_get_self().'?&selecteval='.$select_eval
api_get_self().'?selecteval='.$select_eval.'&'.api_get_cidreq()
);
$table = $edit_result_form->toHtml();
if ($edit_result_form->validate()) {
$values = $edit_result_form->exportValues();
$scores = ($values['score']);
$scores = $values['score'];
foreach ($scores as $row) {
$resultedit = Result :: load (key($scores));
$resultedit = Result:: load(key($scores));
$row_value = $row;
if ($row_value != '' ) {
$resultedit[0]->set_score(floatval(number_format($row_value, api_get_setting('gradebook_number_decimals'))));
if ($row_value != '') {
$resultedit[0]->set_score(api_number_format($row_value, api_get_setting('gradebook_number_decimals')));
$resultedit[0]->save();
}
next($scores);
}
header('Location: gradebook_view_result.php?selecteval='.$select_eval.'&editallresults=&'.api_get_cidreq());
Display::addFlash(Display::return_message(get_lang('AllResultsEdited')));
header('Location: gradebook_view_result.php?selecteval='.$select_eval.'&'.api_get_cidreq());
exit;
}
$table = $edit_result_form->toHtml();
$interbreadcrumb[] = array (
'url' => $_SESSION['gradebook_dest'],
'name' => get_lang('Gradebook')
@ -49,7 +51,7 @@ $interbreadcrumb[]= array (
'url' => 'gradebook_view_result.php?selecteval='.$select_eval.'&'.api_get_cidreq(),
'name' => get_lang('ViewResult')
);
Display :: display_header(get_lang('EditResult'));
Display::display_header(get_lang('EditResult'));
DisplayGradebook::display_header_result($evaluation[0], null, 0, 0);
echo $table;
Display :: display_footer();

@ -73,9 +73,9 @@ if (isset($_GET['editres'])) {
$result->set_id($edit_res_xml);
$result->set_user_id($values['hid_user_id']);
$result->set_evaluation_id($select_eval);
$row_value = isset($values['score']) ? (float) $values['score'] : 0;
$row_value = isset($values['score']) ? $values['score'] : 0;
if (!empty($row_value) || $row_value == 0) {
$result->set_score(floatval(number_format($row_value, api_get_setting('gradebook_number_decimals'))));
$result->set_score(api_number_format($row_value, api_get_setting('gradebook_number_decimals')));
}
$result->save();
unset($result);
@ -162,7 +162,7 @@ if (isset($_GET['import'])) {
$result = new Result();
$result->set_user_id($importedresult['user_id']);
if (!empty($importedresult['score'])) {
$result->set_score(floatval(number_format($importedresult['score'], api_get_setting('gradebook_number_decimals'))));
$result->set_score(api_number_format($importedresult['score'], api_get_setting('gradebook_number_decimals')));
}
if (!empty($importedresult['date'])) {
$result->set_date(api_get_utc_datetime($importedresult['date']));
@ -176,21 +176,43 @@ if (isset($_GET['import'])) {
}
} else {
header('Location: ' . api_get_self() . '?import=&selecteval=' . $select_eval . '&importnofile=');
Display::addFlash(Display::return_message(get_lang('ImportNoFile'), 'warning', false));
Display::addFlash(
Display::return_message(
get_lang('ImportNoFile'),
'warning',
false
)
);
exit;
}
if ($overwritescore != 0) {
header('Location: ' . api_get_self() . '?selecteval=' . $select_eval. '&importoverwritescore=' . $overwritescore);
Display::addFlash(Display::return_message(get_lang('ImportOverWriteScore') . ' ' . $overwritescore));
Display::addFlash(
Display::return_message(
get_lang('ImportOverWriteScore').' '.$overwritescore
)
);
exit;
}
if ($nr_results_added == 0) {
Display::addFlash(Display::return_message(get_lang('ProblemUploadingFile'), 'warning', false));
Display::addFlash(
Display::return_message(
get_lang('ProblemUploadingFile'),
'warning',
false
)
);
header('Location: ' . api_get_self() . '?selecteval=' . $select_eval. '&nothingadded=');
exit;
}
Display::addFlash(Display::return_message(get_lang('FileUploadComplete'), 'success', false));
Display::addFlash(
Display::return_message(
get_lang('FileUploadComplete'),
'success',
false
)
);
header('Location: ' . api_get_self() . '?selecteval=' . $select_eval . '&importok=');
exit;
}
@ -356,7 +378,8 @@ if (isset($_GET['export'])) {
if (isset($_GET['resultdelete'])) {
$result = Result :: load($_GET['resultdelete']);
$result[0]->delete();
header('Location: gradebook_view_result.php?deleteresult=&selecteval=' . $select_eval);
Display::addFlash(Display::return_message(get_lang('ResultDeleted')));
header('Location: gradebook_view_result.php?selecteval=' . $select_eval.'&'.api_get_cidreq());
exit;
}
@ -458,13 +481,6 @@ if (isset($_GET['adduser'])) {
Display :: display_confirmation_message(get_lang('UserAdded'), false);
}
if (isset($_GET['deleteresult'])) {
Display :: display_confirmation_message(get_lang('ResultDeleted'), false);
}
if (isset($_GET['editallresults'])) {
Display :: display_confirmation_message(get_lang('AllResultsEdited'), false);
}
if (isset($_GET['incorrectdata'])) {
Display :: display_warning_message(get_lang('IncorrectData'), false);
}

@ -79,7 +79,7 @@ class GradebookUtils
if (!empty($link_id)) {
$link_id = intval($link_id);
$sql = 'UPDATE ' . Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK) . '
SET weight = ' . "'" . Database::escape_string((float) $weight) . "'" . '
SET weight = ' . "'" . api_float_val($weight) . "'" . '
WHERE course_code = "' . $course_code . '" AND id = ' . $link_id;
Database::query($sql);
}
@ -1152,7 +1152,7 @@ class GradebookUtils
public static function updateLinkWeight($linkId, $name, $weight)
{
$linkId = intval($linkId);
$weight = floatval($weight);
$weight = api_float_val($weight);
$course_id = api_get_course_int_id();
AbstractLink::add_link_log($linkId, $name);

@ -138,22 +138,22 @@ abstract class AbstractLink implements GradebookItem
return $this->visible;
}
public function set_id ($id)
public function set_id($id)
{
$this->id = $id;
}
public function set_type ($type)
public function set_type($type)
{
$this->type = $type;
}
public function set_ref_id ($ref_id)
public function set_ref_id($ref_id)
{
$this->ref_id = $ref_id;
}
public function set_user_id ($user_id)
public function set_user_id($user_id)
{
$this->user_id = $user_id;
}
@ -163,9 +163,11 @@ abstract class AbstractLink implements GradebookItem
*/
public function set_course_code($course_code)
{
$this->course_code = $course_code;
$course_info = api_get_course_info($course_code);
$this->course_id = $course_info['real_id'];
$courseInfo = api_get_course_info($course_code);
if ($courseInfo) {
$this->course_code = $course_code;
$this->course_id = $courseInfo['real_id'];
}
}
public function getStudentList()

@ -2254,11 +2254,8 @@ class Category implements GradebookItem
$courseEvaluations = $category->get_evaluations($userId, true);
$courseLinks = $category->get_links($userId, true);
$evaluationsAndLinks = array_merge($courseEvaluations, $courseLinks);
$categoryScore = 0;
for ($i = 0; $i < count($evaluationsAndLinks); $i++) {
$item = $evaluationsAndLinks[$i];
$score = $item->calc_score($userId);
@ -2272,7 +2269,7 @@ class Category implements GradebookItem
$categoryScore += $itemValue;
}
return floatval($categoryScore);
return api_float_val($categoryScore);
}
/**
@ -2289,7 +2286,7 @@ class Category implements GradebookItem
[
'category_id' => intval($categoryId),
'user_id' => intval($userId),
'score' => floatval($score),
'score' => api_float_val($score),
'registered_at' => api_get_utc_datetime()
]
);

@ -329,7 +329,7 @@ class Evaluation implements GradebookItem
$sql .= ',type';
$sql .= ") VALUES ('".Database::escape_string($this->get_name())."'"
.','.intval($this->get_user_id())
.','.floatval($this->get_weight())
.','.api_float_val($this->get_weight())
.','.intval($this->get_max())
.','.intval($this->is_visible());
if (isset($this->description)) {

@ -357,11 +357,12 @@ class ForumThreadLink extends AbstractLink
function save_linked_data()
{
$weight = (float)$this->get_weight();
$weight = api_float_val($this->get_weight());
$ref_id = $this->get_ref_id();
if (!empty($ref_id)) {
$sql = 'UPDATE '.$this->get_forum_thread_table().' SET thread_weight='.$weight.'
$sql = 'UPDATE '.$this->get_forum_thread_table().' SET
thread_weight='.$weight.'
WHERE c_id = '.$this->course_id.' AND thread_id= '.$ref_id;
Database::query($sql);
}

@ -112,6 +112,5 @@ class LinkFactory
public function delete()
{
}
}

@ -423,7 +423,7 @@ class StudentPublicationLink extends AbstractLink
}
$id = $data['id'];
$weight = (float) $this->get_weight();
$weight = api_float_val($this->get_weight());
if (!empty($id)) {
//Cleans works
$sql = 'UPDATE '.$this->get_studpub_table().'

@ -62,12 +62,11 @@ class DisplayGradebook
}
$scoredisplay = ScoreDisplay :: instance();
$student_score = '';
$average = "";
if (($evalobj->has_results())) { // TODO this check needed ?
$average = '';
if (($evalobj->has_results())) {
// TODO this check needed ?
$score = $evalobj->calc_score();
if ($score != null) {
$average = get_lang('Average') . ' :<b> ' . $scoredisplay->display_score($score, SCORE_AVERAGE) . '</b>';
$student_score = $evalobj->calc_score(api_get_user_id());
@ -261,7 +260,6 @@ class DisplayGradebook
}
if (!$is_course_admin && ($status <> 1 || $sessionStatus == 0) && $selectcat <> 0) {
$catcourse = Category::load($catobj->get_id());
/** @var Category $category */
$category = $catcourse[0];
@ -269,9 +267,7 @@ class DisplayGradebook
$scoredisplay = ScoreDisplay :: instance();
$allevals = $category->get_evaluations($userId, true);
$alllinks = $category->get_links($userId, true);
$allEvalsLinks = array_merge($allevals, $alllinks);
$item_value_total = 0;
$scoreinfo = null;
@ -387,14 +383,14 @@ class DisplayGradebook
if ($my_category['generate_certificates'] == 1) {
$actionsLeft .= Display::url(
Display::return_icon(
'certificate_list.png',
get_lang('GradebookSeeListOfStudentsCertificates'),
'',
ICON_SIZE_MEDIUM
),
"gradebook_display_certificate.php?$my_api_cidreq&cat_id=" . $selectcat
);
Display::return_icon(
'certificate_list.png',
get_lang('GradebookSeeListOfStudentsCertificates'),
'',
ICON_SIZE_MEDIUM
),
"gradebook_display_certificate.php?$my_api_cidreq&cat_id=" . $selectcat
);
}
$actionsLeft .= Display::url(
@ -470,8 +466,14 @@ class DisplayGradebook
* @param bool $show_add_qualification
* @param bool $show_add_link
*/
public function display_reduce_header_gradebook($catobj, $is_course_admin, $is_platform_admin, $simple_search_form, $show_add_qualification = true, $show_add_link = true)
{
public function display_reduce_header_gradebook(
$catobj,
$is_course_admin,
$is_platform_admin,
$simple_search_form,
$show_add_qualification = true,
$show_add_link = true
) {
//student
if (!$is_course_admin) {
$user = api_get_user_info(api_get_user_id());
@ -504,46 +506,42 @@ class DisplayGradebook
}
/**
* @param int $userid
* @param $userId
* @param $categoryId
* @return string
*/
public static function display_header_user($userid, $categoryId)
public static function display_header_user($userId, $categoryId)
{
$user_id = $userid;
$user = api_get_user_info($user_id);
$user = api_get_user_info($userId);
if (empty($user)) {
return '';
}
$catcourse = Category :: load($categoryId);
$scoredisplay = ScoreDisplay :: instance();
$scorecourse = $catcourse[0]->calc_score($user_id);
// generating the total score for a course
$allevals = $catcourse[0]->get_evaluations($user_id, true);
$alllinks = $catcourse[0]->get_links($user_id, true);
$allevals = $catcourse[0]->get_evaluations($userId, true, api_get_course_id());
$alllinks = $catcourse[0]->get_links($userId, true, api_get_course_id());
$evals_links = array_merge($allevals, $alllinks);
$item_value = 0;
$item_total = 0;
for ($count = 0; $count < count($evals_links); $count++) {
$item = $evals_links[$count];
$score = $item->calc_score($user_id);
$score = $item->calc_score($userId);
$my_score_denom = ($score[1] == 0) ? 1 : $score[1];
$item_value+=$score[0] / $my_score_denom * $item->get_weight();
$item_total+=$item->get_weight();
}
$item_value = number_format($item_value, 2, '.', ' ');
$item_value = api_number_format($item_value, 2);
$total_score = array($item_value, $item_total);
$scorecourse_display = $scoredisplay->display_score($total_score, SCORE_DIV_PERCENT);
//$scorecourse_display = (isset($scorecourse) ? $scoredisplay->display_score($scorecourse,SCORE_AVERAGE) : get_lang('NoResultsAvailable'));
$cattotal = Category :: load(0);
$scoretotal = $cattotal[0]->calc_score($user_id);
$scoretotal_display = (isset($scoretotal) ? $scoredisplay->display_score($scoretotal, SCORE_PERCENT) : get_lang('NoResultsAvailable'));
$imageUrl = UserManager::getUserPicture($userid);
$info = '<div class="row"><div class="col-md-3">';
$info .= '<div class="thumbnail"><img src="' . $imageUrl . '" /></div>';
$info .= '<div class="thumbnail"><img src="' . $user['avatar'] . '" /></div>';
$info .= '</div>';
$info .= '<div class="col-md-6">';
$info .= get_lang('Name') . ' : <a target="_blank" href="' . api_get_path(WEB_CODE_PATH) . 'social/profile.php?u=' . $userid . '"> ' .
$info .= get_lang('Name') . ' : <a target="_blank" href="' . api_get_path(WEB_CODE_PATH) . 'social/profile.php?u=' . $userId . '"> ' .
$user['complete_name'] . '</a><br />';
if (api_get_setting('show_email_addresses') == 'true') {
@ -553,8 +551,6 @@ class DisplayGradebook
$info .= get_lang('TotalUser') . ' : <b>' . $scorecourse_display . '</b>';
$info .= '</div>';
$info .= '</div>';
echo $info;
}
}

@ -52,7 +52,6 @@ class EvalForm extends FormValidator
if (isset($extra1)) {
$this->extra = $extra1;
}
switch ($form_type) {
case self :: TYPE_EDIT:
$this->build_editing_form();
@ -85,9 +84,15 @@ class EvalForm extends FormValidator
protected function build_add_user_to_eval()
{
$this->addElement('header', get_lang('ChooseUser'));
$select = $this->addElement('select', 'firstLetterUser', get_lang('FirstLetter'), null, array(
'onchange' => 'document.add_users_to_evaluation.submit()'
));
$select = $this->addElement(
'select',
'firstLetterUser',
get_lang('FirstLetter'),
null,
array(
'onchange' => 'document.add_users_to_evaluation.submit()',
)
);
$select->addOption('', '');
for ($i = 65; $i <= 90; $i ++) {
$letter = chr($i);
@ -170,9 +175,7 @@ class EvalForm extends FormValidator
$results_and_users[] = array('result' => $result, 'user' => $user);
}
usort($results_and_users, array('EvalForm', 'sort_by_user'));
$defaults = array();
foreach ($results_and_users as $result_and_user) {
$user = $result_and_user['user'];
$result = $result_and_user['result'];
@ -299,7 +302,6 @@ class EvalForm extends FormValidator
$firstUser = true;
foreach ($tblusers as $user) {
$element_name = 'score[' . $user[0] . ']';
$scoreColumnProperties = array('maxlength' => 5);
if ($firstUser) {
@ -360,22 +362,38 @@ class EvalForm extends FormValidator
'score' => $this->result_object->get_score(),
'maximum' => $this->evaluation_object->get_max()
));
$userinfo = api_get_user_info($this->result_object->get_user_id());
$userInfo = api_get_user_info($this->result_object->get_user_id());
$renderer = & $this->defaultRenderer();
$renderer->setCustomElementTemplate('<span>{element}</span> ');
$this->addElement('label', get_lang('User'), $userinfo['complete_name']);
$this->addHeader(get_lang('User').': '.$userInfo['complete_name']);
$this->addText('score', array(get_lang('Score'), null, '/ ' . $this->evaluation_object->get_max()), false, array(
'size' => '4',
'class' => 'span1',
'maxlength' => '5'
));
$this->addText(
'score',
array(
get_lang('Score'),
null,
'/ '.$this->evaluation_object->get_max(),
),
false,
array(
'size' => '4',
'maxlength' => '5',
)
);
$this->addButtonSave(get_lang('Edit'), 'submit');
$this->addElement('hidden', 'minvalue', 0);
$this->addElement('hidden', 'hid_user_id', $this->result_object->get_user_id());
$this->addElement('hidden', 'maxvalue', $this->evaluation_object->get_max());
$this->addRule('score', get_lang('OnlyNumbers'), 'numeric', null, 'client');
$this->addRule(
'score',
get_lang('OnlyNumbers'),
'numeric',
null,
'client'
);
$this->addRule(
array(
'score',
@ -403,9 +421,14 @@ class EvalForm extends FormValidator
*/
protected function build_add_form()
{
$this->setDefaults(array('hid_user_id' => $this->evaluation_object->get_user_id(),
'hid_category_id' => $this->evaluation_object->get_category_id(),
'hid_course_code' => $this->evaluation_object->get_course_code(), 'created_at' => api_get_utc_datetime()));
$this->setDefaults(
array(
'hid_user_id' => $this->evaluation_object->get_user_id(),
'hid_category_id' => $this->evaluation_object->get_category_id(),
'hid_course_code' => $this->evaluation_object->get_course_code(),
'created_at' => api_get_utc_datetime(),
)
);
$this->build_basic_form(0);
if ($this->evaluation_object->get_course_code() == null) {
$this->addElement('checkbox', 'adduser', null, get_lang('AddUserToEval'));
@ -473,7 +496,15 @@ class EvalForm extends FormValidator
$session_id = api_get_session_id();
$course_code = api_get_course_id();
$all_categories = Category :: load(null, null, $course_code, null, null, $session_id, false);
$all_categories = Category:: load(
null,
null,
$course_code,
null,
null,
$session_id,
false
);
if (count($all_categories) == 1) {
$this->addElement('hidden', 'hid_category_id', $cat_id);
@ -532,7 +563,6 @@ class EvalForm extends FormValidator
'class' => 'span1'
)); */
if ($edit) {
if (!$this->evaluation_object->has_results()) {
$this->addText(
@ -623,5 +653,4 @@ class EvalForm extends FormValidator
}
return $result;
}
}

@ -9,8 +9,8 @@
*/
class LinkAddEditForm extends FormValidator
{
const TYPE_ADD = 1;
const TYPE_EDIT = 2;
const TYPE_ADD = 1;
const TYPE_EDIT = 2;
/**
* Constructor
@ -52,11 +52,11 @@ class LinkAddEditForm extends FormValidator
} else {
$select = $this->addElement('select', 'select_link', get_lang('ChooseItem'));
foreach ($link->get_all_links() as $newlink) {
$select->addoption($newlink[1],$newlink[0]);
$select->addoption($newlink[1], $newlink[0]);
}
}
} else {
$this->addElement('label',get_lang('Name'), '<span class="freeze">'.$link->get_name().' ['.$link->get_type_name().']</span>');
$this->addElement('label', get_lang('Name'), '<span class="freeze">'.$link->get_name().' ['.$link->get_type_name().']</span>');
$this->addElement('hidden','name_link',$link->get_name(),array('id'=>'name_link'));
}
@ -78,7 +78,7 @@ class LinkAddEditForm extends FormValidator
if ($my_cat->get_course_code() == api_get_course_id()) {
$grade_model_id = $my_cat->get_grade_model_id();
if (empty($grade_model_id)) {
if ($my_cat->get_parent_id() == 0 ) {
if ($my_cat->get_parent_id() == 0) {
$default_weight = $my_cat->get_weight();
$select_gradebook->addoption(get_lang('Default'), $my_cat->get_id());
} else {
@ -117,7 +117,7 @@ class LinkAddEditForm extends FormValidator
'class' => 'span1'
));*/
$this->addRule('weight_mask',get_lang('OnlyNumbers'),'numeric');
$this->addRule('weight_mask', get_lang('OnlyNumbers'), 'numeric');
$this->addRule(array ('weight_mask', 'zero'), get_lang('NegativeValue'), 'compare', '>=');
if ($form_type == self :: TYPE_EDIT) {
$parent_cat = Category :: load($link->get_category_id());
@ -188,5 +188,5 @@ class LinkAddEditForm extends FormValidator
// set default values
$this->setDefaults($defaults);
}
}
}

@ -44,7 +44,7 @@ class LinkForm extends FormValidator
}
}
if (isset ($extra)) {
if (isset($extra)) {
$this->extra = $extra;
}
if ($form_type == self :: TYPE_CREATE) {

@ -20,7 +20,12 @@ class ResultTable extends SortableTable
*/
public function __construct($evaluation, $results = array(), $iscourse, $addparams = null,$forprint = false)
{
parent :: __construct('resultlist', null, null, (api_is_western_name_order() xor api_sort_by_first_name()) ? 2 : 1);
parent:: __construct(
'resultlist',
null,
null,
(api_is_western_name_order() xor api_sort_by_first_name()) ? 2 : 1
);
$this->datagen = new ResultsDataGenerator($evaluation, $results, true);
@ -28,7 +33,7 @@ class ResultTable extends SortableTable
$this->iscourse = $iscourse;
$this->forprint = $forprint;
if (isset ($addparams)) {
if (isset($addparams)) {
$this->set_additional_parameters($addparams);
}
$scoredisplay = ScoreDisplay :: instance();
@ -51,7 +56,7 @@ class ResultTable extends SortableTable
$this->set_header($column++, get_lang('Display'));
}
if (!$this->forprint) {
$this->set_header($column++, get_lang('Modify'),false);
$this->set_header($column++, get_lang('Modify'), false);
}
}

@ -29,29 +29,34 @@ class ScoreDisplayForm extends FormValidator
$this->addElement('hidden', 'minvalue', '0');
$counter= 1;
//setting the default values
if(is_array($customdisplays)) {
foreach ($customdisplays as $customdisplay) {
$this->setDefaults(array (
'endscore[' . $counter . ']' => $customdisplay['score'],
'displaytext[' . $counter . ']' => $customdisplay['display']
));
$counter++;
}
}
$scorecol = array();
//setting the default values
if (is_array($customdisplays)) {
foreach ($customdisplays as $customdisplay) {
$this->setDefaults(array (
'endscore[' . $counter . ']' => $customdisplay['score'],
'displaytext[' . $counter . ']' => $customdisplay['display']
));
$counter++;
}
}
$scorecol = array();
//settings for the colored score
$this->addElement('header', get_lang('ScoreEdit'));
$this->addElement('header', get_lang('ScoreEdit'));
if ($displayscore->is_coloring_enabled()) {
$this->addElement('html', '<b>' . get_lang('ScoreColor') . '</b>');
$this->addElement('text', 'scorecolpercent', array(get_lang('Below'), get_lang('WillColorRed'), '%'), array(
'size' => 5,
'maxlength' => 5,
'input-size' => 2
));
$this->addElement('html', '<b>'.get_lang('ScoreColor') . '</b>');
$this->addElement(
'text',
'scorecolpercent',
array(get_lang('Below'), get_lang('WillColorRed'), '%'),
array(
'size' => 5,
'maxlength' => 5,
'input-size' => 2,
)
);
if (api_get_setting('teachers_can_change_score_settings') != 'true') {
$this->freeze('scorecolpercent');
@ -64,90 +69,95 @@ class ScoreDisplayForm extends FormValidator
//Settings for the scoring system
if ($displayscore->is_custom()) {
if ($displayscore->is_custom()) {
$this->addElement('html', '<br /><b>' . get_lang('ScoringSystem') . '</b>');
$this->addElement('static', null, null, get_lang('ScoreInfo'));
$this->setDefaults(array(
'beginscore' => '0'
));
$this->addElement('text', 'beginscore', array(get_lang('Between'), null, '%'), array(
'size' => 5,
'maxlength' => 5,
'disabled' => 'disabled',
'input-size' => 2
));
for ($counter= 1; $counter <= 20; $counter++) {
$renderer =& $this->defaultRenderer();
$elementTemplateTwoLabel =
'<div id=' . $counter . ' style="display: '.(($counter<=$nr_items)?'inline':'none').';">
<!-- BEGIN required --><span class="form_required">*</span> <!-- END required -->
$this->addElement('static', null, null, get_lang('ScoreInfo'));
$this->setDefaults(array(
'beginscore' => '0'
));
$this->addElement('text', 'beginscore', array(get_lang('Between'), null, '%'), array(
'size' => 5,
'maxlength' => 5,
'disabled' => 'disabled',
'input-size' => 2
));
for ($counter= 1; $counter <= 20; $counter++) {
$renderer =& $this->defaultRenderer();
$elementTemplateTwoLabel =
'<div id=' . $counter . ' style="display: '.(($counter<=$nr_items)?'inline':'none').';">
<!-- BEGIN required --><span class="form_required">*</span> <!-- END required -->
<label class="control-label">{label}</label>
<div class="form-group">
<label class="col-sm-2 control-label">
<div class="form-group">
<label class="col-sm-2 control-label">
</label>
<div class="col-sm-1">
<!-- BEGIN error --><span class="form_error">{error}</span><br />
<!-- END error -->&nbsp<b>'.get_lang('And').'</b>
</div>
<div class="col-sm-2">
{element}
</div>
<div class="col-sm-1">
=
</div>
';
$elementTemplateTwoLabel2 ='
<div class="col-sm-2">
<!-- BEGIN error --><span class="form_error">{error}</span>
<!-- END error -->
{element}
</div>
<div class="col-sm-1">
<div class="col-sm-1">
<!-- BEGIN error --><span class="form_error">{error}</span><br />
<!-- END error -->&nbsp<b>'.get_lang('And').'</b>
</div>
<div class="col-sm-2">
{element}
</div>
<div class="col-sm-1">
=
</div>
';
$elementTemplateTwoLabel2 ='
<div class="col-sm-2">
<!-- BEGIN error --><span class="form_error">{error}</span>
<!-- END error -->
{element}
</div>
<div class="col-sm-1">
<a href="javascript:plusItem(' . ($counter+1) . ')">
<img style="display: '.(($counter>=$nr_items)?'inline':'none').';" id="plus-' . ($counter+1) . '" src="'.Display::returnIconPath('add.png').'" alt="'.get_lang('Add').'" title="'.get_lang('Add').'"></a>
<a href="javascript:minItem(' . ($counter) . ')">
<img style="display: '.(($counter>=$nr_items && $counter!=1)?'inline':'none').';" id="min-' . $counter . '" src="'.Display::returnIconPath('delete.png').'" alt="'.get_lang('Delete').'" title="'.get_lang('Delete').'"></a>
</div>
</div>
</div>';
$scorebetw = array();
$this->addElement('text', 'endscore[' . $counter . ']', null, array (
'size' => 5,
'maxlength' => 5,
'id' => 'txta-'.$counter,
'input-size' => 2
));
$this->addElement('text', 'displaytext[' . $counter . ']', null,array (
'size' => 40,
'maxlength' => 40,
'id' => 'txtb-'.$counter
));
$renderer->setElementTemplate($elementTemplateTwoLabel, 'endscore[' . $counter . ']');
$renderer->setElementTemplate($elementTemplateTwoLabel2, 'displaytext[' . $counter . ']');
$this->addRule('endscore[' . $counter . ']', get_lang('OnlyNumbers'), 'numeric');
$this->addRule(array ('endscore[' . $counter . ']', 'maxvalue'), get_lang('Over100'), 'compare', '<=');
$this->addRule(array ('endscore[' . $counter . ']', 'minvalue'), get_lang('UnderMin'), 'compare', '>');
}
}
<a href="javascript:minItem(' . ($counter) . ')">
<img style="display: '.(($counter>=$nr_items && $counter!=1)?'inline':'none').';" id="min-' . $counter . '" src="'.Display::returnIconPath('delete.png').'" alt="'.get_lang('Delete').'" title="'.get_lang('Delete').'"></a>
</div>
</div>
</div>';
$scorebetw = array();
$this->addElement('text', 'endscore[' . $counter . ']', null, array (
'size' => 5,
'maxlength' => 5,
'id' => 'txta-'.$counter,
'input-size' => 2
));
$this->addElement(
'text',
'displaytext['.$counter.']',
null,
array(
'size' => 40,
'maxlength' => 40,
'id' => 'txtb-'.$counter,
)
);
$renderer->setElementTemplate($elementTemplateTwoLabel, 'endscore[' . $counter . ']');
$renderer->setElementTemplate($elementTemplateTwoLabel2, 'displaytext[' . $counter . ']');
$this->addRule('endscore[' . $counter . ']', get_lang('OnlyNumbers'), 'numeric');
$this->addRule(array ('endscore[' . $counter . ']', 'maxvalue'), get_lang('Over100'), 'compare', '<=');
$this->addRule(array ('endscore[' . $counter . ']', 'minvalue'), get_lang('UnderMin'), 'compare', '>');
}
}
if ($displayscore->is_custom()) {
$this->addButtonSave(get_lang('Ok'));
}
}
$this->addButtonSave(get_lang('Ok'));
}
}
public function validate()
public function validate()
{
return parent :: validate();
}
return parent :: validate();
}
}

@ -48,7 +48,7 @@ class UserForm extends FormValidator
}
$renderer =& $this->defaultRenderer();
$renderer->setCustomElementTemplate('<span>{element}</span> ');
$this->addElement('text','keyword','');
$this->addElement('text', 'keyword', '');
$this->addButtonSearch(get_lang('Search'), 'submit');
}

@ -83,7 +83,6 @@ class FlatViewDataGenerator
public function get_header_names($items_start = 0, $items_count = null, $show_detail = false)
{
$headers = array();
if (isset($this->params['show_official_code']) && $this->params['show_official_code']) {
$headers[] = get_lang('OfficialCode');
}
@ -174,7 +173,6 @@ class FlatViewDataGenerator
).$add_weight;
if (api_get_setting('gradebook_detailed_admin_view') === 'true') {
$links = $sub_cat->get_links();
$evaluations = $sub_cat->get_evaluations();
@ -526,7 +524,7 @@ class FlatViewDataGenerator
if ($convert_using_the_global_weight) {
//$item_total = $main_weight;
}
} else {
} else {
// All evaluations
$result = $this->parseEvaluations(
$user_id,
@ -669,7 +667,9 @@ class FlatViewDataGenerator
(isset($this->params['only_total_category']) && $this->params['only_total_category'] == false)
) {
if (!$show_all) {
if (in_array($item->get_type(), array(
if (in_array(
$item->get_type(),
array(
LINK_EXERCISE,
LINK_DROPBOX,
LINK_STUDENTPUBLICATION,
@ -677,7 +677,8 @@ class FlatViewDataGenerator
LINK_FORUM_THREAD,
LINK_ATTENDANCE,
LINK_SURVEY,
LINK_HOTPOTATOES)
LINK_HOTPOTATOES,
)
)
) {
if (!empty($score[0])) {

@ -285,7 +285,6 @@ class GradebookDataGenerator
$forceSimpleResult = false
) {
$scoredisplay = ScoreDisplay::instance();
$score = $item->calc_score($userId);
if (!empty($score)) {
@ -328,11 +327,14 @@ class GradebookDataGenerator
];
//}
$display = $scoredisplay->display_score($score, SCORE_DIV_PERCENT_WITH_CUSTOM);
$display = $scoredisplay->display_score(
$score,
SCORE_DIV_PERCENT_WITH_CUSTOM
);
$type = $item->get_item_type();
if ($type == 'L' && get_class($item) == 'ExerciseLink') {
$display = ExerciseLib::show_score($score[0], $score[1], false);
$display = ExerciseLib::show_score($score[0], $score[1], false);
}
return array(
@ -441,7 +443,7 @@ class GradebookDataGenerator
public function sort_by_weight($item1, $item2)
{
if ($item1->get_weight() == $item2->get_weight()) {
return $this->sort_by_name($item1,$item2);
return $this->sort_by_name($item1, $item2);
} else {
return ($item1->get_weight() < $item2->get_weight() ? -1 : 1);
}

@ -281,7 +281,7 @@ class ScoreDisplay
*/
public function format_score($score)
{
return floatval(number_format($score, $this->get_number_decimals()));
return api_number_format($score, $this->get_number_decimals());
}
/**

@ -842,10 +842,14 @@ function api_get_path($path = '', $configuration = [])
if (!empty($virtualChamilo)) {
$paths[$root_web][SYS_ARCHIVE_PATH] = api_add_trailing_slash($virtualChamilo[SYS_ARCHIVE_PATH]);
$paths[$root_web][SYS_HOME_PATH] = api_add_trailing_slash($virtualChamilo[SYS_HOME_PATH]);
$paths[$root_web][WEB_HOME_PATH] = api_add_trailing_slash($virtualChamilo[WEB_HOME_PATH]);
$paths[$root_web][SYS_COURSE_PATH] = api_add_trailing_slash($virtualChamilo[SYS_COURSE_PATH]);
$paths[$root_web][SYS_UPLOAD_PATH] = api_add_trailing_slash($virtualChamilo[SYS_UPLOAD_PATH]);
$paths[$root_web][WEB_HOME_PATH] = api_add_trailing_slash($virtualChamilo[WEB_HOME_PATH]);
$paths[$root_web][WEB_UPLOAD_PATH] = api_add_trailing_slash($virtualChamilo[WEB_UPLOAD_PATH]);
$paths[$root_web][WEB_ARCHIVE_PATH] = api_add_trailing_slash($virtualChamilo[WEB_ARCHIVE_PATH]);
//$paths[$root_web][WEB_COURSE_PATH] = api_add_trailing_slash($virtualChamilo[WEB_COURSE_PATH]);
// WEB_UPLOAD_PATH should be handle by apache htaccess in the vhost
// RewriteEngine On
@ -7801,10 +7805,8 @@ function api_mail_html(
if (isset($additionalParameters['link'])) {
$mailView->assign('link', $additionalParameters['link']);
}
$mailView->assign(
'mail_header_style',
api_get_configuration_value('mail_header_style')
);
$mailView->assign('mail_header_style',api_get_configuration_value('mail_header_style'));
$mailView->assign('mail_content_style',api_get_configuration_value('mail_content_style'));
$layout = $mailView->get_template('mail/mail.tpl');
$mail->Body = $mailView->fetch($layout);
@ -8032,26 +8034,19 @@ function api_remove_uploaded_file($type, $file)
}
/**
* Converts values to float value
* Converts string value to float value
*
* 3.141516 => 3.141516
* 3,141516 => 3.141516
* @todo WIP
*
* @param $number
* @return false|float|int|mixed
* @param string $number
* @return float
*/
function api_parse_float_val($number)
function api_float_val($number)
{
if (INTL_INSTALLED) {
$iso = api_get_language_isocode();
$iso = 'fr';
$formatter = new NumberFormatter($iso, NumberFormatter::DECIMAL);
return $formatter->parse($number);
} else {
return floatval($number);
}
$number = (float) str_replace(',', '.', trim($number));
return $number;
}
/**
@ -8069,15 +8064,7 @@ function api_parse_float_val($number)
*/
function api_number_format($number, $decimals = 0)
{
if (INTL_INSTALLED) {
$iso = api_get_language_isocode();
$iso = 'fr';
$formatter = new NumberFormatter($iso, NumberFormatter::DECIMAL);
$formatter->setAttribute(NumberFormatter::MAX_FRACTION_DIGITS, $decimals);
$formatter->setAttribute(NumberFormatter::GROUPING_SEPARATOR_SYMBOL, '');
return $formatter->format($number);
} else {
return number_format($number, $decimals);
}
}
$number = api_float_val($number);
return number_format($number, $decimals);
}

@ -532,7 +532,7 @@ class CourseManager
$courseInfo = api_get_course_info($course_code);
$courseId = $courseInfo['real_id'];
$courseCode = $courseInfo['code'];
//$userCourseCategoryId = intval($userCourseCategoryId);
$userCourseCategoryId = intval($userCourseCategoryId);
if (empty($user_id) || empty($course_code)) {
return false;
@ -570,7 +570,12 @@ class CourseManager
if (!empty($session_id)) {
SessionManager::subscribe_users_to_session_course(array($user_id), $session_id, $courseCode);
} else {
CourseManager::add_user_to_course($user_id, $courseCode, $status);
CourseManager::add_user_to_course(
$user_id,
$courseCode,
$status,
$userCourseCategoryId
);
// Add event to the system log
Event::addEvent(
@ -728,7 +733,7 @@ class CourseManager
'status' => $status,
'sort' => $max_sort + 1,
'relation_type' => 0,
'user_course_cat' => $userCourseCategoryId
'user_course_cat' => (int) $userCourseCategoryId
];
$insertId = Database::insert($course_user_table, $params);

@ -11,8 +11,9 @@ class HTML_QuickForm_Rule_CompareDateTimeText extends HTML_QuickForm_Rule_Compar
* @param string $operator The operator to use (default '==')
* @return boolean True if the 2 given dates match the operator
*/
function validate($values, $operator = null) {
$datetime1 = api_strtotime($values[0]);
function validate($values, $operator = null)
{
$datetime1 = api_strtotime($values[0]);
$datetime2 = api_strtotime($values[1]);
if (strpos($operator, 'allow_empty') !== false) {
@ -21,7 +22,8 @@ class HTML_QuickForm_Rule_CompareDateTimeText extends HTML_QuickForm_Rule_Compar
return true;
}
}
$result = parent::validate(array($datetime1, $datetime2), $operator);
$result = parent::validate(array($datetime1, $datetime2), $operator);
return $result;
}
}

@ -1774,7 +1774,7 @@ class HTML_QuickForm extends HTML_Common
}
if (count($test) > 0) {
return
"\n<script type=\"text/javascript\">\n" .
"<script>" .
"//<![CDATA[\n" .
"function validate_" . $this->_attributes['id'] . "(frm) {\n" .
" var value = '';\n" .

@ -72,7 +72,6 @@ class HTML_QuickForm_Rule_Compare extends HTML_QuickForm_Rule
}
}
function validate($values, $operator = null)
{
$operator = $this->_findOperator($operator);
@ -95,6 +94,7 @@ class HTML_QuickForm_Rule_Compare extends HTML_QuickForm_Rule
} else {
$check = "!(String({jsVar}[0]) {$operator} String({jsVar}[1]))";
}
return array('', "'' != {jsVar}[0] && {$check}");
}
}

@ -3988,7 +3988,12 @@ class SessionManager
}
$users = null;
//Subscribing in read only mode
self::subscribe_users_to_session($sid, $short_users, SESSION_VISIBLE_READ_ONLY, true);
self::subscribe_users_to_session(
$sid,
$short_users,
SESSION_VISIBLE_READ_ONLY,
true
);
$short_users = null;
}
return $sid;
@ -4855,7 +4860,7 @@ class SessionManager
);
if ($debug) {
$logger->addInfo("Subscribe user #$teacherToAdd as teacher in course $course_code ");
$logger->addInfo("Subscribe user #$teacherToAdd as teacher in course $course_code with user userCourseCategory $userCourseCategory");
}
if (isset($groupBackup['user'][$teacherToAdd]) &&
@ -4972,7 +4977,7 @@ class SessionManager
);
if ($debug) {
$logger->addInfo("Add user as teacher #".$teacherId." in base course: $course_code");
$logger->addInfo("Add user as teacher #".$teacherId." in base course: $course_code with userCourseCategory: $userCourseCategory");
}
if (isset($groupBackup['user'][$teacherId]) &&
@ -8177,8 +8182,8 @@ class SessionManager
*/
public static function redirectToSession()
{
$sessionId = isset($_SESSION['session_redirect']) ? $_SESSION['session_redirect'] : null;
$onlyOneCourseSessionToRedirect = isset($_SESSION['only_one_course_session_redirect']) ? $_SESSION['only_one_course_session_redirect'] : null;
$sessionId = ChamiloSession::read('session_redirect');
$onlyOneCourseSessionToRedirect = ChamiloSession::read('only_one_course_session_redirect');
$userId = api_get_user_id();
$sessionInfo = api_get_session_info($sessionId);

@ -409,7 +409,14 @@ class UserManager
null,
PERSON_NAME_EMAIL_ADDRESS
);
$tplSubject = new Template(null, false, false, false, false, false);
$tplSubject = new Template(
null,
false,
false,
false,
false,
false
);
$layoutSubject = $tplSubject->get_template(
'mail/subject_registration_platform.tpl'
);
@ -558,7 +565,6 @@ class UserManager
WHERE status=1 AND c_id = " . intval($course->c_id);
$res2 = Database::query($sql);
if (Database::num_rows($res2) == 1) {
return false;
}
}
@ -797,7 +803,6 @@ class UserManager
public static function deactivate_users($ids = array())
{
if (empty($ids)) {
return false;
}
@ -828,7 +833,6 @@ class UserManager
public static function activate_users($ids = array())
{
if (empty($ids)) {
return false;
}
@ -1203,7 +1207,6 @@ class UserManager
public static function create_username($firstname, $lastname)
{
if (empty($firstname) && empty($lastname)) {
return false;
}
@ -1478,9 +1481,9 @@ class UserManager
if (count($order_by) > 0) {
$sql_query .= ' ORDER BY '.Database::escape_string(implode(',', $order_by), null, false);
}
$sql_result = Database::query($sql_query);
while ($result = Database::fetch_array($sql_result)) {
$result['complete_name'] = api_get_person_name(
$result['firstname'],
$result['lastname']
@ -1570,7 +1573,7 @@ class UserManager
*
* @return array Array of 2 elements: 'dir' and 'file' which contain
* the dir and file as the name implies if image does not exist it will
* return the unknow image if anonymous parameter is true if not it returns an empty array
* return the unknown image if anonymous parameter is true if not it returns an empty array
*/
public static function getUserPicturePathById($id, $type = 'web', $userInfo = [])
{

@ -267,6 +267,8 @@ $_configuration['system_stable'] = NEW_VERSION_STABLE;
//$_configuration['show_prerequisite_as_blocked'] = false;
// Mail header extra HTML attributes
//$_configuration['mail_header_style'] = '';
// Mail body extra HTML attributes
//$_configuration['mail_content_style'] = '';
// Show all agenda events in personal agenda from all session no matter the visibility.
//$_configuration['personal_agenda_show_all_session_events'] = false;
// Allows to redirect to the session after the inscription in session about

@ -7628,7 +7628,7 @@ $NowDownloadYourCertificateClickHere = "Télécharge ton certificat en cliquant
$AdditionallyYouHaveObtainedTheFollowingSkills = "En plus, tu as acquis les compétences suivantes";
$IHaveObtainedSkillXOnY = "J'ai acquis la compétence %s sur %s";
$AnotherAttempt = "Nouvelle tentative";
$RemainingXAttempts = "%s tentatives restantes";
$RemainingXAttempts = "Nombre de tentatives restantes: %s";
$Map = "Carte";
$MyLocation = "Ma position";
$ShowCourseInUserLanguage = "Afficher les cours dans la langue de l'utilisateur";

@ -6897,6 +6897,7 @@ $HideColumn = "Spalte verstecken";
$DisplayColumn = "Spalte anzeigen";
$LegalAgreementAccepted = "Nutzungsbedingungen akzeptiert";
$DateFormatLongNoDayJS = "dd MM yy";
$RemainingXAttempts = "Anzahl der verbleibenden Versuche: %s";
$Contact = "Kontakt";
$YourPasswordCannotBeTheSameAsYourEmail = "Ihr Passwort kann nicht die gleiche sein wie Ihre E-Mail";
$YourPasswordCannotContainYourUsername = "Ihr Passwort kann nicht enthalten Ihren Benutzernamen";

@ -2652,6 +2652,7 @@ class learnpath
if (isset($size)) {
$info = pathinfo($preview_image);
$image_custom_size = $info['filename'].'.'.$size.'.'.$info['extension'];
if (file_exists($image_sys_path.$image_custom_size)) {
if ($path_type == 'web') {
return $image_path.$image_custom_size;
@ -8714,7 +8715,7 @@ class learnpath
$row = Database :: fetch_array($result);
$prerequisiteId = $row['prerequisite'];
$session_id = api_get_session_id();
$session_condition = api_get_session_condition($session_id);
$session_condition = api_get_session_condition($session_id, true, true);
$sql = "SELECT * FROM $tbl_lp
WHERE c_id = $course_id $session_condition
ORDER BY display_order ";
@ -8822,7 +8823,7 @@ class learnpath
$tbl_quiz = Database :: get_course_table(TABLE_QUIZ_TEST);
$session_id = api_get_session_id();
$condition_session = api_get_session_condition($session_id);
$condition_session = api_get_session_condition($session_id, true, true);
$setting = api_get_configuration_value('show_invisible_exercise_in_lp_list');
@ -8894,9 +8895,15 @@ class learnpath
$moveEverywhereIcon = Display::return_icon('move_everywhere.png', get_lang('Move'), array(), ICON_SIZE_TINY);
$session_id = api_get_session_id();
$condition_session = api_get_session_condition($session_id, true, null, "link.session_id");
$condition_session = api_get_session_condition(
$session_id,
true,
true,
"link.session_id"
);
$sql = "SELECT link.id as link_id,
$sql = "SELECT
link.id as link_id,
link.title as link_title,
link.category_id as category_id,
link_category.category_title as category_title

@ -24,9 +24,9 @@ $tbl_lp = Database::get_course_table(TABLE_LP_MAIN);
$tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM);
$tbl_lp_view = Database::get_course_table(TABLE_LP_VIEW);
$isStudentView = (int) $_REQUEST['isStudentView'];
$learnpath_id = (int) $_REQUEST['lp_id'];
$submit = $_POST['submit_button'];
$isStudentView = (int)$_REQUEST['isStudentView'];
$learnpath_id = (int)$_REQUEST['lp_id'];
$submit = $_POST['submit_button'];
/* MAIN CODE */
if ((!$is_allowed_to_edit) || ($isStudentView)) {

@ -129,6 +129,8 @@ if (count($friends) == 0) {
$toolBar = '<button class="btn btn-danger" onclick="delete_friend(this)" id=img_' . $friend['friend_user_id'] . '>
' . get_lang('Delete') . '
</button>';
$url = api_get_path(WEB_PATH).'main/social/profile.php?u='.$friend['friend_user_id'];
$friend['user_info']['complete_name'] = Display::url($friend['user_info']['complete_name'], $url);
$friend_html .= Display::getUserCard($friend['user_info'], '', $toolBar);
}
$j++;

@ -102,9 +102,12 @@ if (!empty($results)) {
$group_url = "group_view.php?id=$id";
$result['name'] = '<div class="group-name">'.Display::url(
api_ucwords(cut($result['name'], 40, true)), $group_url)
.'</div><div class="count-username">'.
$link = Display::url(
api_ucwords(cut($result['name'], 40, true)),
$group_url
);
$result['name'] = '<div class="group-name">'.$link.'</div><div class="count-username">'.
Display::returnFontAwesomeIcon('user').$result['count'].'</div>';
$picture = $userGroup->get_picture_group(
@ -115,7 +118,7 @@ if (!empty($results)) {
);
$result['picture'] = '<img class="img-responsive" src="' . $picture['file'] . '" />';
$group_actions = '<div class="group-more"><a href="groups.php?#tab_browse-2">' . get_lang('SeeMore') . '</a></div>';
$group_actions = '<div class="group-more"><a class="btn btn-default" href="groups.php?#tab_browse-2">' . get_lang('SeeMore') . '</a></div>';
$group_info= '<div class="description"><p>' . cut($result['description'], 120, true) . "</p></div>";
$groups_newest[] = array(
Display::url(
@ -158,7 +161,7 @@ foreach ($results as $result) {
GROUP_IMAGE_SIZE_BIG
);
$result['picture_uri'] = '<img class="img-responsive" src="' . $picture['file'] . '" />';
$group_actions = '<div class="group-more" ><a href="groups.php?#tab_browse-3">' . get_lang('SeeMore') . '</a></div>';
$group_actions = '<div class="group-more"><a class="btn btn-default" href="groups.php?#tab_browse-3">' . get_lang('SeeMore') . '</a></div>';
$group_info= '<div class="description"><p>' . cut($result['description'], 120, true) . "</p></div>";
$groups_pop[] = array(
Display::url($result['picture_uri'], $group_url),
@ -171,7 +174,7 @@ $social_group_block = null;
if ($list > 0) {
$social_group_block .= '<div class="list-group-newest">';
$social_group_block .= '<div class="group-title">' . get_lang('Newest') . '</div>';
for ($i = 0;$i < $list; $i++) {
for ($i = 0; $i < $list; $i++) {
$social_group_block.='<div class="row">';
$social_group_block.='<div class="col-md-3">' . $groups_newest[$i][0] . '</div>';
$social_group_block.='<div class="col-md-9">' . $groups_newest[$i][1];
@ -185,7 +188,7 @@ if ($list > 0) {
$social_group_block .= '<div class="list-group-newest">';
$social_group_block .= '<div class="group-title">' . get_lang('Popular') . '</div>';
for ($i = 0;$i < $list; $i++) {
for ($i = 0; $i < $list; $i++) {
$social_group_block.='<div class="row">';
$social_group_block.='<div class="col-md-3">' . $groups_pop[$i][0] . '</div>';
$social_group_block.='<div class="col-md-9">' . $groups_pop[$i][1];

@ -16,7 +16,7 @@
}
</script>
</head>
<body style="margin: 0; padding: 0;">
<body style="margin: 0; padding: 0; ">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td>
@ -28,7 +28,9 @@
</tr>
<tr>
<td cellpadding="0" cellspacing="0" style="padding: 40px 10px">
<span {{ mail_content_style }}>
{{ content }}
</span>
</td>
</tr>
<tr>

@ -5128,6 +5128,10 @@ function protectWork($courseInfo, $workId)
}
}
/**
* @param array $courseInfo
* @param array $work
*/
function deleteCorrection($courseInfo, $work)
{
if (isset($work['url_correction']) && !empty($work['url_correction']) && isset($work['iid'])) {

@ -17,29 +17,39 @@ api_protect_admin_script();
$table = 'vchamilo';
$tablename = Database::get_main_table($table);
$sql = "CREATE TABLE IF NOT EXISTS $tablename (
id int NOT NULL AUTO_INCREMENT,
sitename varchar(80) NOT NULL,
slug varchar(255) NOT NULL,
institution varchar(80) NOT NULL,
root_web varchar(120),
db_host varchar(80) NOT NULL,
db_user varchar(16) DEFAULT 'root',
db_password varchar(32),
table_prefix varchar(16),
db_prefix varchar(16),
main_database varchar(60) DEFAULT 'chamilo',
url_append varchar(32),
course_folder varchar(80),
visible int,
lastcrongap int,
lastcron int,
croncount int,
template varchar(255),
password_encryption varchar(255),
PRIMARY KEY (id)
$sql = "
CREATE TABLE IF NOT EXISTS $tablename (
id int NOT NULL AUTO_INCREMENT,
sitename varchar(80) NOT NULL,
slug varchar(255) NOT NULL,
institution varchar(80) NOT NULL,
root_web varchar(120),
db_host varchar(80) NOT NULL,
db_user varchar(16) DEFAULT 'root',
db_password varchar(32),
table_prefix varchar(16),
db_prefix varchar(16),
main_database varchar(60) DEFAULT 'chamilo',
url_append varchar(32),
course_folder varchar(80),
visible int,
lastcrongap int,
lastcron int,
croncount int,
template varchar(255),
password_encryption varchar(255),
archive_url varchar(255),
home_url varchar(255),
upload_url varchar(255),
course_url varchar(255),
PRIMARY KEY (id)
) DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
";
/*ALTER TABLE vchamilo ADD COLUMN archive_url varchar(255);
ALTER TABLE vchamilo ADD COLUMN home_url varchar(255);
ALTER TABLE vchamilo ADD COLUMN upload_url varchar(255);
ALTER TABLE vchamilo ADD COLUMN course_url varchar(255);*/
Database::query($sql);
$table = 'vchamilo_config';

@ -117,3 +117,8 @@ $strings['CoursePath'] = 'Path to courses directory';
$strings['HomePath'] = 'Path to home directory';
$strings['UploadPath'] = 'Path to upload directory';
$strings['ArchiveUrl'] = 'Archive URL';
$strings['HomeUrl'] = 'Home URL';
$strings['UploadUrl'] = 'Upload URL';
$strings['CourseUrl'] = 'Course URL';

@ -96,10 +96,13 @@ class Virtual
$data['SYS_ARCHIVE_PATH'] = self::addTrailingSlash($archivePath).$data['slug'];
$data['SYS_HOME_PATH'] = self::addTrailingSlash($homePath).$data['slug'];
$data['WEB_HOME_PATH'] = $_configuration['vchamilo_web_root'] . '/var/home/' . $data['slug'];
$data['SYS_COURSE_PATH'] = self::addTrailingSlash($coursePath).$data['slug'];
$data['SYS_UPLOAD_PATH'] = self::addTrailingSlash($uploadPath).$data['slug'];
//$data['WEB_UPLOAD_PATH'] = $_configuration['vchamilo_web_root'] . '/var/upload/' . $data['slug'];
$data['WEB_HOME_PATH'] = self::addTrailingSlash($data['home_url']);
$data['WEB_UPLOAD_PATH'] = self::addTrailingSlash($data['upload_url']);
$data['WEB_ARCHIVE_PATH'] = self::addTrailingSlash($data['archive_url']);
//$data['WEB_COURSE_PATH'] = self::addTrailingSlash($data['course_url']);
if (!empty($passwordEncryption)) {
$_configuration['password_encryption'] = $passwordEncryption;
@ -962,6 +965,12 @@ class Virtual
}
$data->root_web = api_add_trailing_slash($data->root_web);
$data->archive_url = api_add_trailing_slash($data->archive_url);
$data->home_url = api_add_trailing_slash($data->home_url);
$data->upload_url = api_add_trailing_slash($data->upload_url);
$data->course_url = api_add_trailing_slash($data->course_url);
if (substr($data->root_web, 0, 4) != 'http') {
$data->root_web = api_get_protocol().'://'.$data->root_web;
}

@ -415,6 +415,11 @@ class InstanceForm extends ChamiloForm
'onclick="opencnxpopup(\''.$_configuration['root_web'].'\'); return false;"'
);
$form->addText('archive_url', $this->_plugin->get_lang('ArchiveUrl'));
$form->addText('home_url', $this->_plugin->get_lang('HomeUrl'));
$form->addText('upload_url', $this->_plugin->get_lang('UploadUrl'));
//$form->addText('course_url', $this->_plugin->get_lang('CourseUrl'));
/**
* Template selection.
*/

Loading…
Cancel
Save