Fix PHP warnings/errors

pull/3741/head
Julio Montoya 4 years ago
parent 8c25c2801f
commit b5492b2169
  1. 13
      public/main/inc/lib/display.lib.php
  2. 4
      public/main/lp/learnpath.class.php
  3. 5
      public/main/lp/lp_edit.php
  4. 1
      public/main/lp/lp_subscribe_users.php
  5. 12
      public/main/lp/lp_view.php
  6. 2
      public/main/template/default/auth/inscription.html.twig
  7. 6
      public/main/template/default/auth/inscription_edit.html.twig
  8. 14
      src/CoreBundle/Controller/ResourceController.php

@ -841,12 +841,6 @@ class Display
$filterPath = true
) {
if (empty($image_path)) {
// For some reason, the call to img() happened without a proper
// image. Log the error and return an empty string to avoid
// breaking the HTML
$trace = debug_backtrace();
$caller = $trace[1];
//error_log('No image provided in Display::img(). Caller info: '.print_r($caller, 1));
return '';
}
// Sanitizing the parameter $image_path
@ -2830,8 +2824,9 @@ HTML;
}
$lpJs = api_get_path(WEB_PUBLIC_PATH).'build/lp.js';
//{type:"script", src:"'.api_get_jquery_ui_js_web_path().'"},
//{type:"script", src: "'.$webPublicPath.'build/libs/mediaelement/plugins/markersrolls/markersrolls.js"},
// {type:"script", src:"'.api_get_jquery_ui_js_web_path().'"},
// {type:"script", src: "'.$webPublicPath.'build/libs/mediaelement/plugins/markersrolls/markersrolls.js"},
// {type:"script", src:"'.$webPublicPath.'build/libs/mathjax/MathJax.js?config=AM_HTMLorMML"},
$videoFeatures = implode("','", $videoFeatures);
$frameReady = '
$.frameReady(function() {
@ -2860,8 +2855,6 @@ HTML;
'.$translateHtml.'
]},
'.$videoPluginCssFiles.'
{type:"script", src:"'.$webPublicPath.'build/libs/mathjax/MathJax.js?config=AM_HTMLorMML"},
]);';
return $frameReady;

@ -6371,7 +6371,7 @@ class learnpath
}
if ($allowExpand) {
$actionsLeft .= Display::url(
/*$actionsLeft .= Display::url(
Display::return_icon(
'expand.png',
get_lang('Expand'),
@ -6386,7 +6386,7 @@ class learnpath
),
'#',
['role' => 'button', 'id' => 'hide_bar_template']
);
);*/
}
if ($showRequirementButtons) {

@ -3,6 +3,7 @@
/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Framework\Container;
use Chamilo\CourseBundle\Entity\CLp;
use ChamiloSession as Session;
/**
@ -24,7 +25,7 @@ if (empty($lpId)) {
}
$lpId = (int) $lpId;
/** @var \Chamilo\CourseBundle\Entity\CLp $lp */
/** @var CLp $lp */
$lp = $lpRepo->find($lpId);
$nameTools = get_lang('Document');
@ -172,7 +173,7 @@ $expired_on = $learnPath->expired_on;
$publicated_on = $learnPath->publicated_on;
// Prerequisites
$form->addElement('html', '<div class="form-group">');
$form->addElement('html', '<div class="row form-group ">');
$items = $learnPath->display_lp_prerequisites_list();
$form->addElement('html', '<label class="col-md-2">'.get_lang('Prerequisites').'</label>');
$form->addElement('html', '<div class="col-md-8">');

@ -51,7 +51,6 @@ $courseCode = api_get_course_id();
$sessionId = api_get_session_id();
$url = api_get_self().'?'.api_get_cidreq().'&lp_id='.$lpId;
$lp = new learnpath($courseCode, $lpId, api_get_user_id());
$em = Database::getManager();
$courseRepo = Container::getCourseRepository();

@ -424,7 +424,7 @@ switch ($returnLink) {
$lpPreviewImagePath = Display::returnIconPath('unknown.png', ICON_SIZE_BIG);
if ($lp->getResourceNode()->hasResourceFile()) {
$lpPreviewImagePath = $lpRepo->getResourceFileUrl($lp);
$lpPreviewImagePath = $lpRepo->getResourceFileUrl($lp).'?'.api_get_cidreq();
}
if ($oLP->current == $oLP->get_last()) {
@ -571,15 +571,7 @@ if (!empty(api_get_configuration_value('lp_menu_location'))) {
}
$template->assign('menu_location', $menuLocation);
$template->assign('disable_js_in_lp_view', (int) api_get_configuration_value('disable_js_in_lp_view'));
$template->assign(
'lp_preview_image',
Display::img(
$lpPreviewImagePath,
$oLP->getNameNoTags(),
[],
ICON_SIZE_BIG
)
);
$template->assign('lp_preview_image', '<img src="'.$lpPreviewImagePath.'" alt="'.$oLP->getNameNoTags().'" />');
$frameReady = Display::getFrameReadyBlock('#content_id, #content_id_blank');
$template->assign('frame_ready', $frameReady);

@ -7,8 +7,6 @@
{% block content %}
{% autoescape false %}
{{ sonata_page_render_container('content', page) }}
{{ inscription_header }}
{{ inscription_content }}
{{ form }}

@ -2,13 +2,7 @@
{% block content %}
{% autoescape false %}
<div class="well">
{{ sonata_page_render_container('content', page) }}
</div>
{{ form }}
{% endautoescape %}
{% endblock %}

@ -533,8 +533,7 @@ class ResourceController extends AbstractResourceController implements CourseCon
public function viewAction(Request $request, RouterInterface $router): Response
{
$id = $request->get('id');
$filter = $request->get('filter'); // See filters definitions in /config/services.yml
$em = $this->getDoctrine();
$filter = $request->get('filter'); // See filters definitions in /config/services.yml.
/** @var ResourceNode $resourceNode */
$resourceNode = $this->getResourceNodeRepository()->find($id);
@ -542,14 +541,6 @@ class ResourceController extends AbstractResourceController implements CourseCon
throw new FileNotFoundException('Resource not found');
}
/*$repo = $this->getRepositoryFromRequest($request);
if ($repo instanceof ResourceWithLinkInterface) {
$resource = $repo->getResourceFromResourceNode($resourceNode->getId());
$url = $repo->getLink($resource, $router, $this->getCourseUrlQueryToArray());
return $this->redirect($url);
}*/
return $this->processFile($request, $resourceNode, 'show', $filter);
}
@ -611,7 +602,7 @@ class ResourceController extends AbstractResourceController implements CourseCon
}
$zipName = $resourceNode->getSlug().'.zip';
$rootNodePath = $resourceNode->getPathForDisplay();
//$rootNodePath = $resourceNode->getPathForDisplay();
$resourceNodeRepo = $repo->getResourceNodeRepository();
$type = $repo->getResourceType();
@ -704,7 +695,6 @@ class ResourceController extends AbstractResourceController implements CourseCon
$this->trans('Unauthorised view access to resource')
);
//$repo = $this->getRepositoryFromRequest($request);
$resourceFile = $resourceNode->getResourceFile();
if (!$resourceFile) {

Loading…
Cancel
Save