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

pull/2865/head
Julio 7 years ago
commit 6a182ceb3d
  1. 22
      app/Resources/public/css/base.css
  2. 58
      main/exercise/exercise.php
  3. 8
      main/inc/ajax/admin.ajax.php
  4. 22
      main/inc/lib/skill.lib.php
  5. 9
      main/inc/lib/usergroup.lib.php
  6. 4
      main/survey/preview.php
  7. 4
      main/template/default/admin/settings_index.tpl
  8. 7
      plugin/apaexportsurvey/lang/english.php
  9. 7
      plugin/apaexportsurvey/lang/spanish.php
  10. 4
      plugin/apaexportsurvey/plugin.php
  11. 4
      plugin/surveyexporttxt/README.md
  12. 16
      plugin/surveyexporttxt/SurveyExportTxtPlugin.php
  13. 2
      plugin/surveyexporttxt/export.php
  14. 2
      plugin/surveyexporttxt/install.php
  15. 7
      plugin/surveyexporttxt/lang/english.php
  16. 7
      plugin/surveyexporttxt/lang/spanish.php
  17. 4
      plugin/surveyexporttxt/plugin.php
  18. 6
      plugin/surveyexporttxt/start.php
  19. 2
      plugin/surveyexporttxt/uninstall.php
  20. 2
      src/Chamilo/CoreBundle/Entity/Repository/SequenceRepository.php

@ -3015,6 +3015,28 @@ form .formw .freeze {
/* ****************************************************
CSS SKILL
**************************************************** */
#skillList .header-title{
padding: 8px;
border-bottom: 2px solid #ddd;
font-weight: bold;
margin-bottom: 15px;
}
.skills-badges{
display: grid;
grid-gap: 1rem;
grid-row-gap: 16px;
grid-template-columns: repeat(6, 1fr);
}
.skills-badges .item{
display: inline-block;
width: 100%;
text-align: center;
justify-content: center;
align-items: center;
}
.skills-badges a .caption{
text-align: center;
}
.list-horizontal .list-skills{
display: grid;
grid-gap: 1rem;

@ -1250,36 +1250,29 @@ if (!empty($exerciseList)) {
$hotpotatoes_exist = false;
if ($is_allowedToEdit) {
$sql = "SELECT d.path as path, d.comment as comment, ip.visibility as visibility
$sql = "SELECT d.iid, d.path as path, d.comment as comment
FROM $TBL_DOCUMENT d
INNER JOIN $TBL_ITEM_PROPERTY ip
ON (d.id = ip.ref AND d.c_id = ip.c_id)
WHERE
d.c_id = $courseId AND
ip.c_id = $courseId AND
ip.tool = '".TOOL_DOCUMENT."' AND
(d.path LIKE '%htm%') AND
d.path LIKE '".Database :: escape_string($uploadPath.'/%/%')."'
LIMIT ".$from.",".$limit; // only .htm or .html files listed
} else {
$sql = "SELECT d.path as path, d.comment as comment, ip.visibility as visibility
$sql = "SELECT d.iid, d.path as path, d.comment as comment
FROM $TBL_DOCUMENT d
INNER JOIN $TBL_ITEM_PROPERTY ip
ON (d.id = ip.ref AND d.c_id = ip.c_id)
WHERE
d.c_id = $courseId AND
ip.c_id = $courseId AND
ip.tool = '".TOOL_DOCUMENT."' AND
(d.path LIKE '%htm%') AND
d.path LIKE '".Database :: escape_string($uploadPath.'/%/%')."' AND
ip.visibility='1'
d.path LIKE '".Database :: escape_string($uploadPath.'/%/%')."'
LIMIT ".$from.",".$limit;
}
$result = Database::query($sql);
$attribute = [];
while ($row = Database :: fetch_array($result, 'ASSOC')) {
$attribute['id'][] = $row['iid'];
$attribute['path'][] = $row['path'];
$attribute['visibility'][] = $row['visibility'];
$attribute['comment'][] = $row['comment'];
}
@ -1288,8 +1281,6 @@ if (isset($attribute['path']) && is_array($attribute['path'])) {
$hotpotatoes_exist = true;
foreach ($attribute['path'] as $key => $path) {
$item = '';
$vis = $attribute['visibility'][$key];
$active = !empty($vis);
$title = GetQuizName($path, $documentPath);
if ($title == '') {
$title = basename($path);
@ -1297,6 +1288,26 @@ if (isset($attribute['path']) && is_array($attribute['path'])) {
// prof only
if ($is_allowedToEdit) {
$visibility = api_get_item_visibility(
['real_id' => $courseId],
TOOL_DOCUMENT,
$attribute['id'][$key],
0
);
if (!empty($sessionId)) {
if (0 == $visibility) {
continue;
}
$visibility = api_get_item_visibility(
['real_id' => $courseId],
TOOL_DOCUMENT,
$attribute['id'][$key],
$sessionId
);
}
$item = Display::tag(
'td',
implode(PHP_EOL, [
@ -1307,7 +1318,7 @@ if (isset($attribute['path']) && is_array($attribute['path'])) {
'file' => $path,
'uid' => $userId,
]),
['class' => !$active ? 'text-muted' : null]
['class' => $visibility == 0 ? 'text-muted' : null]
),
])
);
@ -1328,7 +1339,7 @@ if (isset($attribute['path']) && is_array($attribute['path'])) {
Display::return_icon('test_results.png', get_lang('Results'), '', ICON_SIZE_SMALL).'</a>';
// if active
if ($active) {
if ($visibility != 0) {
$nbrActiveTests = $nbrActiveTests + 1;
$actions .= ' <a href="'.$exercisePath.'?'.api_get_cidreq().'&hpchoice=disable&page='.$page.'&file='.$path.'">'.
Display::return_icon('visible.png', get_lang('Deactivate'), '', ICON_SIZE_SMALL).'</a>';
@ -1341,8 +1352,18 @@ if (isset($attribute['path']) && is_array($attribute['path'])) {
$item .= Display::tag('td', $actions);
$tableRows[] = Display::tag('tr', $item);
} else {
$visibility = api_get_item_visibility(
['real_id' => $courseId],
TOOL_DOCUMENT,
$attribute['id'][$key],
$sessionId
);
if (0 == $visibility) {
continue;
}
// Student only
if ($active) {
$attempt = ExerciseLib::getLatestHotPotatoResult(
$path,
$userId,
@ -1392,7 +1413,6 @@ if (isset($attribute['path']) && is_array($attribute['path'])) {
}
}
}
}
if (empty($exerciseList) && $hotpotatoes_exist == false) {
if ($is_allowedToEdit && $origin != 'learnpath') {

@ -4,6 +4,7 @@
use Chamilo\CoreBundle\Entity\BranchSync;
use Chamilo\CoreBundle\Entity\Repository\BranchSyncRepository;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\GuzzleException;
/**
* Responses to AJAX calls.
@ -78,11 +79,15 @@ switch ($action) {
break;
}
try {
$latestNews = getLatestNews();
$latestNews = json_decode($latestNews, true);
echo Security::remove_XSS($latestNews['text'], COURSEMANAGER);
break;
} catch (Exception $e) {
break;
}
}
/**
@ -241,6 +246,7 @@ function check_system_version()
* Display the latest news from the Chamilo Association for admins.
*
* @throws \GuzzleHttp\Exception\GuzzleException
* @throws Exception
*
* @return string|void
*/
@ -260,7 +266,7 @@ function getLatestNews()
);
if ($response->getStatusCode() !== 200) {
return;
throw new Exception(get_lang('DenyEntry'));
}
return $response->getBody()->getContents();

@ -834,10 +834,10 @@ class Skill extends Model
$item = '';
if ($showBadge) {
$item = $skill[$imageSize];
$item = '<div class="item">'.$skill[$imageSize].'</div>';
}
$name = $skill['name'];
$name = '<div class="caption">'. $skill['name'].'</div>';
if (!empty($skill['short_code'])) {
$name = $skill['short_code'];
}
@ -1433,15 +1433,9 @@ class Skill extends Model
}
if ($addTitle) {
$tableResult .= '
<table class="table">
<thead>
<tr>
<th>' . get_lang('AchievedSkills') . '</th>
</tr>
</thead>
<tbody>
<tr><td>';
$tableResult .= '<div class="header-title">' . get_lang('AchievedSkills') . '</div>
<div class="skills-badges">
';
}
if (!empty($skillParents)) {
@ -1541,11 +1535,7 @@ class Skill extends Model
}
if ($addTitle) {
$tableResult .= '</td>
</tr>
</tbody>
</table>
';
$tableResult .= '</div>';
}
$tableResult .= '</div>';

@ -1387,8 +1387,13 @@ class UserGroup extends Model
$path = $path_info['dir'];
// If this directory does not exist - we create it.
if (!file_exists($path)) {
@mkdir($path, api_get_permissions_for_new_directories(), true);
if (!is_dir($path)) {
$res = @mkdir($path, api_get_permissions_for_new_directories(), true);
if ($res === false) {
// There was an issue creating the directory $path, probably
// permissions-related
return false;
}
}
// The old photos (if any).

@ -29,6 +29,8 @@ $surveyId = (int) $_GET['survey_id'];
$userInvited = 0;
$userAnonymous = 0;
$allowRequiredSurveyQuestions = api_get_configuration_value('allow_required_survey_questions');
//query to ask if logged user is allowed to see the preview (if he is invited of he is a teacher)
$sql = "SELECT survey_invitation.user
FROM $table_survey_invitation survey_invitation
@ -164,6 +166,7 @@ if (api_is_course_admin() ||
survey_question_option.question_option_id,
survey_question_option.option_text,
survey_question_option.sort as option_sort
".($allowRequiredSurveyQuestions ? ', survey_question.is_required' : '')."
FROM $table_survey_question survey_question
LEFT JOIN $table_survey_question_option survey_question_option
ON
@ -189,6 +192,7 @@ if (api_is_course_admin() ||
//$questions[$sort]['options'][intval($row['option_sort'])] = $row['option_text'];
$questions[$sort]['options'][$row['question_option_id']] = $row['option_text'];
$questions[$sort]['maximum_score'] = $row['max_value'];
$questions[$row['sort']]['is_required'] = $allowRequiredSurveyQuestions && $row['is_required'];
} else {
// If the type is a pagebreak we are finished loading the questions for this page
//break;

@ -42,6 +42,10 @@
$
.ajax('{{ web_admin_ajax_url }}?a=get_latest_news')
.then(function (response) {
if (!response.length) {
return;
}
$('#chamilo-news').removeClass('hidden');
$('#chamilo-news-content').html(response);
});

@ -1,7 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
$strings['plugin_title'] = "APA Export Survey";
$strings['plugin_comment'] = "Export surveys for APA.";
$strings['enabled'] = 'Enabled';

@ -1,7 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
$strings['plugin_title'] = "APA Export Survey";
$strings['plugin_comment'] = "Exportar encuestas para APA.";
$strings['enabled'] = 'Habilitado';

@ -1,4 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
$plugin_info = ApaExportSurvey::create()->get_info();

@ -1,6 +1,6 @@
# APA Export Survey
# Survey Export TXT
Export surveys for APA.
Export surveys to TXT file.
This plugin will add a new action button in survey list allowing export the survey.

@ -2,12 +2,12 @@
/* For licensing terms, see /license.txt */
/**
* Class ApaExportSurvey.
* Class SurveyExportTxtPlugin.
*/
class ApaExportSurvey extends Plugin
class SurveyExportTxtPlugin extends Plugin
{
/**
* ApaExportSurvey constructor.
* SurveyExportTxtPlugin constructor.
*/
protected function __construct()
{
@ -15,11 +15,11 @@ class ApaExportSurvey extends Plugin
'enabled' => 'boolean',
];
parent::__construct('0.1', 'Angel Fernado Quiroz Campos', $settings);
parent::__construct('0.1', 'Angel Fernando Quiroz Campos', $settings);
}
/**
* @return ApaExportSurvey|null
* @return SurveyExportTxtPlugin|null
*/
public static function create()
{
@ -49,7 +49,7 @@ class ApaExportSurvey extends Plugin
*/
public static function filterModify($params)
{
$enabled = api_get_plugin_setting('apaexportsurvey', 'enabled');
$enabled = api_get_plugin_setting('SurveyExportTxtPlugin', 'enabled');
if ($enabled !== 'true') {
return '';
@ -64,7 +64,7 @@ class ApaExportSurvey extends Plugin
return Display::url(
Display::return_icon('export_evaluation.png', get_lang('Export'), [], $iconSize),
api_get_path(WEB_PLUGIN_PATH).'apaexportsurvey/export.php?survey='.$surveyId.'&'.api_get_cidreq()
api_get_path(WEB_PLUGIN_PATH).'surveyexporttxt/export.php?survey='.$surveyId.'&'.api_get_cidreq()
);
}
@ -89,6 +89,6 @@ class ApaExportSurvey extends Plugin
{
Database::getManager()
->createQuery('DELETE FROM ChamiloCourseBundle:CTool t WHERE t.link LIKE :link AND t.category = :category')
->execute(['link' => 'apaexportsurvey/start.php%', 'category' => 'plugin']);
->execute(['link' => 'surveyexporttxt/start.php%', 'category' => 'plugin']);
}
}

@ -16,7 +16,7 @@ if (empty($surveyData)) {
api_not_allowed(true);
}
$plugin = ApaExportSurvey::create();
$plugin = SurveyExportTxtPlugin::create();
if ($plugin->get('enabled') !== 'true') {
api_not_allowed(true);

@ -1,4 +1,4 @@
<?php
/* For licensing terms, see /license.txt */
ApaExportSurvey::create()->install();
SurveyExportTxtPlugin::create()->install();

@ -0,0 +1,7 @@
<?php
/* For licensing terms, see /license.txt */
$strings['plugin_title'] = "Survey Export TXT";
$strings['plugin_comment'] = "Export surveys results to TXT file";
$strings['enabled'] = 'Enabled';

@ -0,0 +1,7 @@
<?php
/* For licensing terms, see /license.txt */
$strings['plugin_title'] = "Survey Export TXT";
$strings['plugin_comment'] = "Exportar resultados de encuestas en archivo TXT.";
$strings['enabled'] = 'Habilitado';

@ -0,0 +1,4 @@
<?php
/* For licensing terms, see /license.txt */
$plugin_info = SurveyExportTxtPlugin::create()->get_info();

@ -6,7 +6,7 @@ require_once __DIR__.'/../../main/inc/global.inc.php';
api_protect_course_script(true);
api_protect_teacher_script();
$plugin = ApaExportSurvey::create();
$plugin = SurveyExportTxtPlugin::create();
$courseCode = api_get_course_id();
@ -33,10 +33,10 @@ $table->set_column_filter(8, ['SurveyUtil', 'anonymous_filter']);
if (api_get_configuration_value('allow_mandatory_survey')) {
$table->set_header(9, get_lang('IsMandatory'), true, ['class' => 'text-center'], ['class' => 'text-center']);
$table->set_header(10, get_lang('Export'), false, ['class' => 'text-center'], ['class' => 'text-center']);
$table->set_column_filter(10, ['ApaExportSurvey', 'filterModify']);
$table->set_column_filter(10, ['SurveyExportTxtPlugin', 'filterModify']);
} else {
$table->set_header(9, get_lang('Export'), false, ['class' => 'text-center'], ['class' => 'text-center']);
$table->set_column_filter(9, ['ApaExportSurvey', 'filterModify']);
$table->set_column_filter(9, ['SurveyExportTxtPlugin', 'filterModify']);
}
$pageTitle = $plugin->get_title();

@ -1,4 +1,4 @@
<?php
/* For licensing terms, see /license.txt */
ApaExportSurvey::create()->uninstall();
SurveyExportTxtPlugin::create()->uninstall();

@ -40,7 +40,7 @@ class SequenceRepository extends EntityRepository
public function getRequirementAndDependencies($resourceId, $type)
{
$sequence = $this->findRequirementForResource($resourceId, $type);
$result = ['requirements' => '', 'dependencies' => []];
$result = ['requirements' => [], 'dependencies' => []];
if ($sequence && $sequence->hasGraph()) {
$graph = $sequence->getSequence()->getUnSerializeGraph();
$vertex = $graph->getVertex($resourceId);

Loading…
Cancel
Save