Merge remote-tracking branch 'origin/master'

pull/5013/head
Angel Fernando Quiroz Campos 12 months ago
commit 019f2243c8
  1. 2
      README.md
  2. 11
      assets/css/app.scss
  3. 82
      public/main/course_progress/index.php
  4. 24
      public/main/forum/editpost.php
  5. 6
      public/main/forum/editthread.php
  6. 60
      public/main/forum/forumfunction.inc.php
  7. 4
      public/main/forum/forumqualify.php
  8. 42
      public/main/forum/index.php
  9. 3
      public/main/forum/newthread.php
  10. 10
      public/main/forum/reply.php
  11. 48
      public/main/forum/viewforum.php
  12. 48
      public/main/forum/viewforumcategory.php
  13. 22
      public/main/forum/viewthread.php
  14. 5
      public/main/inc/lib/display.lib.php
  15. 42
      public/main/inc/lib/formvalidator/Element/DateTimePicker.php
  16. 7
      public/main/inc/lib/sessionmanager.lib.php
  17. 35
      public/main/session/session_add.php
  18. 2
      src/CoreBundle/Component/Utils/ActionIcon.php
  19. 71
      src/CoreBundle/Component/Utils/ToolIcon.php

@ -93,7 +93,7 @@ git pull
composer update composer update
# Database update # Database update
php bin/console doctrine:schema:update --force php bin/console doctrine:schema:update --force --complete
# Clean Symfony cache # Clean Symfony cache
php bin/console cache:clear php bin/console cache:clear

@ -451,6 +451,17 @@ table#skill_holder {
padding: 20px 0px; padding: 20px 0px;
} }
#date_fields label {
top: 0px;
left: 0.5rem;
--tw-bg-opacity: 1;
background-color: rgb(255 255 255 / var(--tw-bg-opacity));
padding-left: 0.25rem;
padding-right: 0.25rem;
--tw-text-opacity: 1;
color: rgb(46 117 163 / var(--tw-text-opacity));
}
/* **************************************************** /* ****************************************************
END SKILL END SKILL
**************************************************** */ **************************************************** */

@ -3,6 +3,7 @@
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Framework\Container; use Chamilo\CoreBundle\Framework\Container;
use Chamilo\CoreBundle\Component\Utils\ActionIcon;
use Chamilo\CourseBundle\Entity\CThematic; use Chamilo\CourseBundle\Entity\CThematic;
use Chamilo\CourseBundle\Entity\CThematicAdvance; use Chamilo\CourseBundle\Entity\CThematicAdvance;
use Chamilo\CourseBundle\Entity\CThematicPlan; use Chamilo\CourseBundle\Entity\CThematicPlan;
@ -340,11 +341,12 @@ switch ($action) {
break; break;
case 'thematic_import_select': case 'thematic_import_select':
$actionLeft = '<a href="index.php?'.api_get_cidreq().'">'; $actionLeft = '<a href="index.php?'.api_get_cidreq().'">';
$actionLeft .= Display::return_icon( $actionLeft .= Display::getMdiIcon(
'back.png', ActionIcon::BACK,
get_lang('Back to').' '.get_lang('Thematic view with details'), 'ch-tool-icon',
'', null,
ICON_SIZE_MEDIUM ICON_SIZE_MEDIUM,
get_lang('Back to').' '.get_lang('Thematic view with details')
); );
$actionLeft .= '</a>'; $actionLeft .= '</a>';
@ -501,20 +503,15 @@ switch ($action) {
break; break;
case 'thematic_details': case 'thematic_details':
$actionLeft = '<a href="index.php?'.api_get_cidreq().'&action=thematic_add'.$url_token.'">'. $actionLeft = '<a href="index.php?'.api_get_cidreq().'&action=thematic_add'.$url_token.'">'.
Display::return_icon( Display::getMdiIcon('progress-star', 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('New thematic section')).'</a>';
'new_course_progress.png',
get_lang('New thematic section'),
'',
ICON_SIZE_MEDIUM
).'</a>';
$actionLeft .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_import_select'.$url_token.'">'. $actionLeft .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_import_select'.$url_token.'">'.
Display::return_icon('import_csv.png', get_lang('Import course progress'), '', ICON_SIZE_MEDIUM).'</a>'; Display::getMdiIcon('file-delimited', 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Import course progress')).'</a>';
$actionLeft .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_export'.$url_token.'">'. $actionLeft .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_export'.$url_token.'">'.
Display::return_icon('export_csv.png', get_lang('Export course progress'), '', ICON_SIZE_MEDIUM).'</a>'; Display::getMdiIcon(ActionIcon::EXPORT_CSV, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Export course progress')).'</a>';
$actionLeft .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_export_pdf'.$url_token.'">'. $actionLeft .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_export_pdf'.$url_token.'">'.
Display::return_icon('pdf.png', get_lang('Export to PDF'), '', ICON_SIZE_MEDIUM).'</a>'; Display::getMdiIcon(ActionIcon::EXPORT_PDF, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Export to PDF')).'</a>';
/*$actionLeft .= Display::url( /*$actionLeft .= Display::url(
Display::return_icon('export_to_documents.png', get_lang('Export latest version of this page to Documents'), [], ICON_SIZE_MEDIUM), Display::getMdiIcon('export_to_documents', 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Export latest version of this page to Documents')),
api_get_self().'?'.api_get_cidreq().'&'.http_build_query(['action' => 'export_documents']).$url_token api_get_self().'?'.api_get_cidreq().'&'.http_build_query(['action' => 'export_documents']).$url_token
);*/ );*/
$total_average_of_advances = null; $total_average_of_advances = null;
@ -547,20 +544,10 @@ switch ($action) {
if (isset($last_id) && $last_id) { if (isset($last_id) && $last_id) {
$link_to_thematic_plan = '<a $link_to_thematic_plan = '<a
href="index.php?'.api_get_cidreq().'&action=thematic_plan_list&thematic_id='.$last_id.'">'. href="index.php?'.api_get_cidreq().'&action=thematic_plan_list&thematic_id='.$last_id.'">'.
Display::return_icon( Display::getMdiIcon('progress-check', 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Thematic plan')).'</a>';
'lesson_plan.png',
get_lang('Thematic plan'),
['style' => 'vertical-align:middle;float:none;'],
ICON_SIZE_SMALL
).'</a>';
$link_to_thematic_advance = '<a $link_to_thematic_advance = '<a
href="index.php?'.api_get_cidreq().'&action=thematic_advance_list&thematic_id='.$last_id.'">'. href="index.php?'.api_get_cidreq().'&action=thematic_advance_list&thematic_id='.$last_id.'">'.
Display::return_icon( Display::getMdiIcon('progress-clock', 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Thematic advance')).'</a>';
'lesson_plan_calendar.png',
get_lang('Thematic advance'),
['style' => 'vertical-align:middle;float:none;'],
ICON_SIZE_SMALL
).'</a>';
Display::addFlash( Display::addFlash(
Display::return_message( Display::return_message(
get_lang('Thematic section has been created successfully').'<br />'.sprintf( get_lang('Thematic section has been created successfully').'<br />'.sprintf(
@ -602,12 +589,7 @@ switch ($action) {
if (api_is_allowed_to_edit(null, true)) { if (api_is_allowed_to_edit(null, true)) {
// Thematic title // Thematic title
$toolbarThematic = Display::url( $toolbarThematic = Display::url(
Display::return_icon( Display::getMdiIcon('disc', 'ch-tool-icon', null, ICON_SIZE_TINY, get_lang('Copy')),
'cd.png',
get_lang('Copy'),
null,
ICON_SIZE_TINY
),
'index.php?'.api_get_cidreq().'&action=thematic_copy&thematic_id='.$id.$params.$url_token, 'index.php?'.api_get_cidreq().'&action=thematic_copy&thematic_id='.$id.$params.$url_token,
['class' => 'btn btn--plain'] ['class' => 'btn btn--plain']
); );
@ -616,27 +598,27 @@ switch ($action) {
$toolbarThematic .= ' <a $toolbarThematic .= ' <a
class="btn btn--plain" class="btn btn--plain"
href="'.api_get_self().'?action=moveup&'.api_get_cidreq().'&thematic_id='.$id.$params.$url_token.'">'. href="'.api_get_self().'?action=moveup&'.api_get_cidreq().'&thematic_id='.$id.$params.$url_token.'">'.
Display::return_icon('up.png', get_lang('Up'), '', ICON_SIZE_TINY).'</a>'; Display::getMdiIcon(ActionIcon::UP, 'ch-tool-icon', null, ICON_SIZE_TINY, get_lang('Up')).'</a>';
} else { } else {
$toolbarThematic .= '<div class="btn btn--plain">'. $toolbarThematic .= '<div class="btn btn--plain">'.
Display::return_icon('up_na.png', '&nbsp;', '', ICON_SIZE_TINY).'</div>'; Display::getMdiIcon(ActionIcon::UP, 'ch-tool-icon-disabled', null, ICON_SIZE_TINY, get_lang('Up')).'</div>';
} }
//$thematic->getDisplayOrder() //$thematic->getDisplayOrder()
if ($thematic->getDisplayOrder() < $max_thematic_item) { if ($thematic->getDisplayOrder() < $max_thematic_item) {
$toolbarThematic .= ' <a $toolbarThematic .= ' <a
class="btn btn--plain" class="btn btn--plain"
href="'.api_get_self().'?action=movedown&a'.api_get_cidreq().'&thematic_id='.$id.$params.$url_token.'">'. href="'.api_get_self().'?action=movedown&a'.api_get_cidreq().'&thematic_id='.$id.$params.$url_token.'">'.
Display::return_icon('down.png', get_lang('down'), '', ICON_SIZE_TINY).'</a>'; Display::getMdiIcon(ActionIcon::DOWN, 'ch-tool-icon', null, ICON_SIZE_TINY, get_lang('Down')).'</a>';
} else { } else {
$toolbarThematic .= '<div class="btn btn--plain">'. $toolbarThematic .= '<div class="btn btn--plain">'.
Display::return_icon('down_na.png', '&nbsp;', '', ICON_SIZE_TINY).'</div>'; Display::getMdiIcon(ActionIcon::DOWN, 'ch-tool-icon-disabled', null, ICON_SIZE_TINY, get_lang('Down')).'</div>';
} }
} }
if (true) { if (true) {
//if (api_get_session_id() == $thematic->getSessionId()) { //if (api_get_session_id() == $thematic->getSessionId()) {
$toolbarThematic .= Display::url( $toolbarThematic .= Display::url(
Display::return_icon('pdf.png', get_lang('Export to PDF'), null, ICON_SIZE_TINY), Display::getMdiIcon(ActionIcon::EXPORT_PDF, 'ch-tool-icon', null, ICON_SIZE_TINY, get_lang('Export to PDF')),
api_get_self().'?'.api_get_cidreq()."$url_token&".http_build_query( api_get_self().'?'.api_get_cidreq()."$url_token&".http_build_query(
[ [
'action' => 'export_single_thematic', 'action' => 'export_single_thematic',
@ -646,12 +628,7 @@ switch ($action) {
['class' => 'btn btn--plain'] ['class' => 'btn btn--plain']
); );
/*$toolbarThematic .= Display::url( /*$toolbarThematic .= Display::url(
Display::return_icon( Display::getMdiIcon(ActionIcon::EXPORT_DOC, 'ch-tool-icon', null, ICON_SIZE_TINY, get_lang('Export latest version of this page to Documents')),
'export_to_documents.png',
get_lang('Export latest version of this page to Documents'),
[],
ICON_SIZE_TINY
),
api_get_self().'?'.api_get_cidreq().$url_token.'&'.http_build_query( api_get_self().'?'.api_get_cidreq().$url_token.'&'.http_build_query(
['action' => 'export_single_documents', 'thematic_id' => $id] ['action' => 'export_single_documents', 'thematic_id' => $id]
), ),
@ -660,14 +637,14 @@ switch ($action) {
$toolbarThematic .= '<a $toolbarThematic .= '<a
class="btn btn--plain" class="btn btn--plain"
href="index.php?'.api_get_cidreq().'&action=thematic_edit&thematic_id='.$id.$params.$url_token.'">' href="index.php?'.api_get_cidreq().'&action=thematic_edit&thematic_id='.$id.$params.$url_token.'">'
.Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_TINY).'</a>'; .Display::getMdiIcon(ActionIcon::EDIT, 'ch-tool-icon', null, ICON_SIZE_TINY, get_lang('Edit')).'</a>';
$toolbarThematic .= '<a $toolbarThematic .= '<a
class="btn btn--plain" class="btn btn--plain"
onclick="javascript:if(!confirm(\'' onclick="javascript:if(!confirm(\''
.get_lang('Are you sure you want to delete') .get_lang('Are you sure you want to delete')
.'\')) return false;" href="index.php?'.api_get_cidreq().'&action=thematic_delete&thematic_id=' .'\')) return false;" href="index.php?'.api_get_cidreq().'&action=thematic_delete&thematic_id='
.$id.$params.$url_token.'">' .$id.$params.$url_token.'">'
.Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_TINY).'</a>'; .Display::getMdiIcon(ActionIcon::DELETE, 'ch-tool-icon', null, ICON_SIZE_TINY, get_lang('Delete')).'</a>';
} }
} }
$extra[$thematic->getIid()]['toolbar'] = $toolbarThematic; $extra[$thematic->getIid()]['toolbar'] = $toolbarThematic;
@ -694,12 +671,7 @@ switch ($action) {
case 'thematic_list': case 'thematic_list':
$interbreadcrumb[] = ['url' => '#', 'name' => get_lang('Thematic control')]; $interbreadcrumb[] = ['url' => '#', 'name' => get_lang('Thematic control')];
$actionLeft = '<a href="index.php?'.api_get_cidreq().'&action=thematic_add'.$url_token.'">'. $actionLeft = '<a href="index.php?'.api_get_cidreq().'&action=thematic_add'.$url_token.'">'.
Display::return_icon( Display::getMdiIcon('progress-star', 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('New thematic section')).'</a>';
'new_course_progress.png',
get_lang('New thematic section'),
'',
ICON_SIZE_MEDIUM
).'</a>';
$table = new SortableTable( $table = new SortableTable(
'thematic_list', 'thematic_list',
@ -858,7 +830,7 @@ switch ($action) {
]; ];
} }
/*$actionLeft = '<a href="index.php?'.api_get_cidreq().'&action=thematic_add'.$url_token.'">'. /*$actionLeft = '<a href="index.php?'.api_get_cidreq().'&action=thematic_add'.$url_token.'">'.
Display::return_icon('new_course_progress.png', get_lang('New thematic section'), '', ICON_SIZE_MEDIUM).'</a>';*/ Display::getMdiIcon('progress-star', 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('New thematic section')).'</a>';*/
$htmlHeadXtra[] = " $htmlHeadXtra[] = "
<script> <script>
$(function () { $(function () {
@ -1263,10 +1235,10 @@ switch ($action) {
// thematic advance list // thematic advance list
$actions = '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=thematic_details">'. $actions = '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=thematic_details">'.
Display::return_icon('back.png', get_lang('Back to'), '', ICON_SIZE_MEDIUM).'</a>'; Display::getMdiIcon(ActionIcon::BACK, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Back to')).'</a>';
if (api_is_allowed_to_edit(false, true)) { if (api_is_allowed_to_edit(false, true)) {
$actions .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=thematic_advance_add&thematic_id='.$thematicId.'"> '. $actions .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=thematic_advance_add&thematic_id='.$thematicId.'"> '.
Display::return_icon('add.png', get_lang('New thematic advance'), '', ICON_SIZE_MEDIUM).'</a>'; Display::getMdiIcon('progress-clock', 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('New thematic advance')).'</a>';
} }
$content = Display::toolbarAction('thematic', [$actions]); $content = Display::toolbarAction('thematic', [$actions]);

@ -6,6 +6,7 @@ use Chamilo\CoreBundle\Framework\Container;
use Chamilo\CourseBundle\Entity\CForum; use Chamilo\CourseBundle\Entity\CForum;
use Chamilo\CourseBundle\Entity\CForumPost; use Chamilo\CourseBundle\Entity\CForumPost;
use Chamilo\CourseBundle\Entity\CForumThread; use Chamilo\CourseBundle\Entity\CForumThread;
use Chamilo\CoreBundle\Component\Utils\ActionIcon;
/** /**
* These files are a complete rework of the forum. The database structure is * These files are a complete rework of the forum. The database structure is
@ -194,7 +195,7 @@ $htmlHeadXtra[] = <<<JS
name: 'user_upload[]' name: 'user_upload[]'
}); });
$('[name="user_upload[]"]').parent().append(newInputFile); $('[name="user_upload[]"]').parent().append(newInputFile);
}); })
}); });
</script> </script>
JS; JS;
@ -248,30 +249,15 @@ if ('learnpath' !== $origin) {
//$actions .= '<span style="float:right;">'.search_link().'</span>'; //$actions .= '<span style="float:right;">'.search_link().'</span>';
if ('group' === $origin) { if ('group' === $origin) {
$actions .= '<a href="../group/group_space.php?'.api_get_cidreq().'">'. $actions .= '<a href="../group/group_space.php?'.api_get_cidreq().'">'.
Display::return_icon( Display::getMdiIcon(ActionIcon::BACK, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Back to').' '.get_lang('Groups')).
'back.png',
get_lang('Back to').' '.get_lang('Groups'),
'',
ICON_SIZE_MEDIUM
).
'</a>'; '</a>';
} else { } else {
$actions .= '<a href="index.php?'.api_get_cidreq().'">'. $actions .= '<a href="index.php?'.api_get_cidreq().'">'.
Display::return_icon( Display::getMdiIcon(ActionIcon::BACK, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Back toForumOverview')).
'back.png',
get_lang('Back toForumOverview'),
'',
ICON_SIZE_MEDIUM
).
'</a>'; '</a>';
} }
$actions .= '<a href="viewforum.php?forum='.$forumId.'&'.api_get_cidreq().'">'. $actions .= '<a href="viewforum.php?forum='.$forumId.'&'.api_get_cidreq().'">'.
Display::return_icon( Display::getMdiIcon('comment-quote', 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Back toForum')).
'forum.png',
get_lang('Back toForum'),
'',
ICON_SIZE_MEDIUM
).
'</a>'; '</a>';
echo Display::toolbarAction('toolbar', [$actions]); echo Display::toolbarAction('toolbar', [$actions]);
} }

@ -4,6 +4,8 @@
use Chamilo\CoreBundle\Framework\Container; use Chamilo\CoreBundle\Framework\Container;
use Chamilo\CourseBundle\Entity\CForum; use Chamilo\CourseBundle\Entity\CForum;
use Chamilo\CoreBundle\Component\Utils\ActionIcon;
/** /**
* Edit a Forum Thread. * Edit a Forum Thread.
@ -200,7 +202,7 @@ $htmlHeadXtra[] = <<<JS
$("[name='weight_calification']").val(0); $("[name='weight_calification']").val(0);
$("[name='thread_peer_qualify'][value='0']").prop('checked', true); $("[name='thread_peer_qualify'][value='0']").prop('checked', true);
} }
}); })
}); });
</script> </script>
JS; JS;
@ -208,7 +210,7 @@ JS;
// Action links // Action links
$actions = [ $actions = [
Display::url( Display::url(
Display::return_icon('back.png', get_lang('Back to forum'), '', ICON_SIZE_MEDIUM), Display::getMdiIcon(ActionIcon::BACK, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Back to forum')),
'viewforum.php?forum='.$forumId.'&'.$cidreq 'viewforum.php?forum='.$forumId.'&'.$cidreq
), ),
search_link(), search_link(),

@ -19,6 +19,8 @@ use Chamilo\CourseBundle\Entity\CLpItem;
use ChamiloSession as Session; use ChamiloSession as Session;
use Doctrine\Common\Collections\Criteria; use Doctrine\Common\Collections\Criteria;
use Symfony\Component\HttpFoundation\File\UploadedFile; use Symfony\Component\HttpFoundation\File\UploadedFile;
use Chamilo\CoreBundle\Component\Utils\ActionIcon;
/** /**
* @todo convert this library into a class * @todo convert this library into a class
@ -918,7 +920,7 @@ function returnVisibleInvisibleIcon(
} }
} }
$html .= 'action=invisible&content='.$content.'&id='.$id.'">'. $html .= 'action=invisible&content='.$content.'&id='.$id.'">'.
Display::return_icon('visible.png', get_lang('MakeInvisible'), [], ICON_SIZE_SMALL).'</a>'; Display::getMdiIcon(ActionIcon::VISIBLE, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('MakeInvisible')).'</a>';
} }
if (0 == $current_visibility_status) { if (0 == $current_visibility_status) {
$html .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&'; $html .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&';
@ -928,7 +930,7 @@ function returnVisibleInvisibleIcon(
} }
} }
$html .= 'action=visible&content='.$content.'&id='.$id.'">'. $html .= 'action=visible&content='.$content.'&id='.$id.'">'.
Display::return_icon('invisible.png', get_lang('Make Visible'), [], ICON_SIZE_SMALL).'</a>'; Display::getMdiIcon(ActionIcon::INVISIBLE, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Make Visible')).'</a>';
} }
return $html; return $html;
@ -952,13 +954,14 @@ function returnLockUnlockIcon(
//check if the forum is blocked due //check if the forum is blocked due
if ('thread' === $content) { if ('thread' === $content) {
if (api_resource_is_locked_by_gradebook($id, LINK_FORUM_THREAD)) { if (api_resource_is_locked_by_gradebook($id, LINK_FORUM_THREAD)) {
return $html.Display::return_icon( return $html.Display::getMdiIcon(
'lock_na.png', ActionIcon::LOCK,
'ch-tool-icon-disabled',
'',
ICON_SIZE_SMALL,
get_lang( get_lang(
'This option is not available because this activity is contained by an assessment, which is currently locked. To unlock the assessment, ask your platform administrator.' 'This option is not available because this activity is contained by an assessment, which is currently locked. To unlock the assessment, ask your platform administrator.'
), )
[],
ICON_SIZE_SMALL
); );
} }
} }
@ -970,7 +973,7 @@ function returnLockUnlockIcon(
} }
} }
$html .= 'action=unlock&content='.$content.'&id='.$id.'">'. $html .= 'action=unlock&content='.$content.'&id='.$id.'">'.
Display::return_icon('lock.png', get_lang('Unlock'), [], ICON_SIZE_SMALL).'</a>'; Display::getMdiIcon(ActionIcon::LOCK, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Unlock')).'</a>';
} }
if ('0' == $current_lock_status) { if ('0' == $current_lock_status) {
$html .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&'; $html .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&';
@ -980,7 +983,7 @@ function returnLockUnlockIcon(
} }
} }
$html .= 'action=lock&content='.$content.'&id='.$id.'">'. $html .= 'action=lock&content='.$content.'&id='.$id.'">'.
Display::return_icon('unlock.png', get_lang('Lock'), [], ICON_SIZE_SMALL).'</a>'; Display::getMdiIcon(ActionIcon::UNLOCK, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Lock')).'</a>';
} }
return $html; return $html;
@ -1017,10 +1020,10 @@ function returnUpDownIcon(string $content, int $id, array $list): string
$return_value = '<a $return_value = '<a
href="'.api_get_self().'?'.api_get_cidreq().'&action=move&direction=up&content='.$content.'&forumcategory='.$forumCategory.'&id='.$id.'" href="'.api_get_self().'?'.api_get_cidreq().'&action=move&direction=up&content='.$content.'&forumcategory='.$forumCategory.'&id='.$id.'"
title="'.get_lang('Move up').'">'. title="'.get_lang('Move up').'">'.
Display::return_icon('up.png', get_lang('Move up'), [], ICON_SIZE_SMALL).'</a>'; Display::getMdiIcon(ActionIcon::UP, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Move up')).'</a>';
} else { } else {
$return_value = Display::url( $return_value = Display::url(
Display::return_icon('up_na.png', '-', [], ICON_SIZE_SMALL), Display::getMdiIcon(ActionIcon::UP, 'ch-tool-icon-disabled', null, ICON_SIZE_SMALL, ''),
'javascript:void(0)' 'javascript:void(0)'
); );
} }
@ -1029,10 +1032,10 @@ function returnUpDownIcon(string $content, int $id, array $list): string
$return_value .= '<a $return_value .= '<a
href="'.api_get_self().'?'.api_get_cidreq().'&action=move&direction=down&content='.$content.'&forumcategory='.$forumCategory.'&id='.$id.'" href="'.api_get_self().'?'.api_get_cidreq().'&action=move&direction=down&content='.$content.'&forumcategory='.$forumCategory.'&id='.$id.'"
title="'.get_lang('Move down').'" >'. title="'.get_lang('Move down').'" >'.
Display::return_icon('down.png', get_lang('Move down'), [], ICON_SIZE_SMALL).'</a>'; Display::getMdiIcon(ActionIcon::DOWN, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Move down')).'</a>';
} else { } else {
$return_value = Display::url( $return_value = Display::url(
Display::return_icon('down_na.png', '-', [], ICON_SIZE_SMALL), Display::getMdiIcon(ActionIcon::DOWN, 'ch-tool-icon-disabled', null, ICON_SIZE_SMALL, ''),
'javascript:void(0)' 'javascript:void(0)'
); );
} }
@ -1483,7 +1486,6 @@ function get_thread_users_details(int $thread_id)
AND course_user.relation_type <> ".COURSE_RELATION_TYPE_RRHH." AND course_user.relation_type <> ".COURSE_RELATION_TYPE_RRHH."
AND p.thread_id = $thread_id AND p.thread_id = $thread_id
AND course_user.status != '1' AND AND course_user.status != '1' AND
p.c_id = $course_id AND
course_user.c_id = $course_id $orderby"; course_user.c_id = $course_id $orderby";
} }
@ -3381,7 +3383,6 @@ function handle_mail_cue($content, $id)
$sql = "SELECT users.firstname, users.lastname, users.id as user_id, users.email, posts.forum_id $sql = "SELECT users.firstname, users.lastname, users.id as user_id, users.email, posts.forum_id
FROM $table_mailcue mailcue, $table_posts posts, $table_users users FROM $table_mailcue mailcue, $table_posts posts, $table_users users
WHERE WHERE
posts.c_id = $course_id AND
mailcue.c_id = $course_id AND mailcue.c_id = $course_id AND
posts.thread_id = $id AND posts.thread_id = $id AND
posts.post_notification = '1' AND posts.post_notification = '1' AND
@ -4000,7 +4001,7 @@ function search_link()
$origin = api_get_origin(); $origin = api_get_origin();
if ('learnpath' != $origin) { if ('learnpath' != $origin) {
$return = '<a href="forumsearch.php?'.api_get_cidreq().'&action=search"> '; $return = '<a href="forumsearch.php?'.api_get_cidreq().'&action=search"> ';
$return .= Display::return_icon('search.png', get_lang('Search'), '', ICON_SIZE_MEDIUM).'</a>'; $return .= Display::getMdiIcon('magnify-plus-outline ', 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Search')).'</a>';
if (!empty($_GET['search'])) { if (!empty($_GET['search'])) {
$return .= ': '.Security::remove_XSS($_GET['search']).' '; $return .= ': '.Security::remove_XSS($_GET['search']).' ';
@ -4012,7 +4013,7 @@ function search_link()
} }
} }
$url .= implode('&', $url_parameter); $url .= implode('&', $url_parameter);
$return .= '<a href="'.$url.'">'.Display::return_icon('delete.gif', get_lang('Clean search results')).'</a>'; $return .= '<a href="'.$url.'">'.Display::getMdiIcon(ActionIcon::DELETE, 'ch-tool-icon', '', ICON_SIZE_SMALL, get_lang('Clean search results')).'</a>';
} }
} }
@ -4638,20 +4639,20 @@ function get_thread_user_post(Course $course, $thread_id, $user_id)
/** /**
* This function get the name of an thread by id. * This function get the name of an thread by id.
* *
* @param int $thread_id * @param int $threadId
* *
* @return string * @return string
* *
* @author Christian Fasanando * @author Christian Fasanando
* @author Julio Montoya <gugli100@gmail.com> Adding security * @author Julio Montoya <gugli100@gmail.com> Adding security
*/ */
function get_name_thread_by_id($thread_id) function get_name_thread_by_id(int $threadId): string
{ {
$t_forum_thread = Database::get_course_table(TABLE_FORUM_THREAD); $tForumThread = Database::get_course_table(TABLE_FORUM_THREAD);
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
$sql = "SELECT thread_title $sql = "SELECT thread_title
FROM $t_forum_thread FROM $tForumThread
WHERE c_id = $course_id AND iid = '".(int) $thread_id."' "; WHERE iid = $threadId";
$result = Database::query($sql); $result = Database::query($sql);
$row = Database::fetch_array($result); $row = Database::fetch_array($result);
@ -4700,12 +4701,7 @@ function get_all_post_from_user(int $user_id, int $courseId): string
$post_counter = count($post_list); $post_counter = count($post_list);
if (is_array($post_list) && count($post_list) > 0) { if (is_array($post_list) && count($post_list) > 0) {
$hand_forums .= '<div id="social-thread">'; $hand_forums .= '<div id="social-thread">';
$hand_forums .= Display::return_icon( $hand_forums .= Display::getMdiIcon('format-quote-open', 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Thread'));
'thread.png',
get_lang('Thread'),
'',
ICON_SIZE_MEDIUM
);
$hand_forums .= '&nbsp;'.Security::remove_XSS($thread->getThreadTitle(), STUDENT); $hand_forums .= '&nbsp;'.Security::remove_XSS($thread->getThreadTitle(), STUDENT);
$hand_forums .= '</div>'; $hand_forums .= '</div>';
@ -4724,7 +4720,7 @@ function get_all_post_from_user(int $user_id, int $courseId): string
$forum_results .= '<div id="social-forum">'; $forum_results .= '<div id="social-forum">';
$forum_results .= '<div class="clear"></div><br />'; $forum_results .= '<div class="clear"></div><br />';
$forum_results .= '<div id="social-forum-title">'. $forum_results .= '<div id="social-forum-title">'.
Display::return_icon('forum.gif', get_lang('Forum')).'&nbsp;'.Security::remove_XSS($forum->getForumTitle(), STUDENT). Display::getMdiIcon('comment-quote', 'ch-tool-icon', '', ICON_SIZE_SMALL, get_lang('Forum')).'&nbsp;'.Security::remove_XSS($forum->getForumTitle(), STUDENT).
'<div style="float:right;margin-top:-35px"> '<div style="float:right;margin-top:-35px">
<a href="../forum/viewforum.php?'.api_get_cidreq_params($courseId).'&forum='.$forum->getIid().' " >'. <a href="../forum/viewforum.php?'.api_get_cidreq_params($courseId).'&forum='.$forum->getIid().' " >'.
get_lang('See forum').' get_lang('See forum').'
@ -5061,16 +5057,16 @@ function getAttachedFiles(
// Check if $row is consistent // Check if $row is consistent
if ($attachment) { if ($attachment) {
// Set result as success and bring delete URL // Set result as success and bring delete URL
$json['result'] = Display::return_icon('accept.png', get_lang('Uploaded.')); $json['result'] = Display::getMdiIcon('check-circle', 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Uploaded.'));
$url = api_get_path(WEB_CODE_PATH).'forum/viewthread.php?'.api_get_cidreq().'&action=delete_attach&forum='.$forumId.'&thread='.$threadId.'&id_attach='.$row['iid']; $url = api_get_path(WEB_CODE_PATH).'forum/viewthread.php?'.api_get_cidreq().'&action=delete_attach&forum='.$forumId.'&thread='.$threadId.'&id_attach='.$row['iid'];
$json['delete'] = Display::url( $json['delete'] = Display::url(
Display::return_icon('delete.png', get_lang('Delete'), [], ICON_SIZE_SMALL), Display::getMdiIcon(ActionIcon::DELETE, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Delete')),
$url, $url,
['class' => 'deleteLink'] ['class' => 'deleteLink']
); );
} else { } else {
// If not, set an exclamation result // If not, set an exclamation result
$json['result'] = Display::return_icon('exclamation.png', get_lang('Error')); $json['result'] = Display::getMdiIcon('close-circle', 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Error'));
} }
// Store array data into $_SESSION // Store array data into $_SESSION
$_SESSION['forum']['upload_file'][$courseId][$json['id']] = $json; $_SESSION['forum']['upload_file'][$courseId][$json['id']] = $json;

@ -5,6 +5,8 @@
use Chamilo\CoreBundle\Framework\Container; use Chamilo\CoreBundle\Framework\Container;
use Chamilo\CourseBundle\Entity\CForum; use Chamilo\CourseBundle\Entity\CForum;
use Chamilo\CourseBundle\Entity\CForumThread; use Chamilo\CourseBundle\Entity\CForumThread;
use Chamilo\CoreBundle\Component\Utils\ActionIcon;
/** /**
* @todo fix all this qualify files avoid including files, use classes POO jmontoya * @todo fix all this qualify files avoid including files, use classes POO jmontoya
@ -339,7 +341,7 @@ if (isset($rows)) {
echo '<tr ><td height="50%">'; echo '<tr ><td height="50%">';
$realname = $attachment_list['path']; $realname = $attachment_list['path'];
$user_filename = $attachment_list['filename']; $user_filename = $attachment_list['filename'];
echo Display::return_icon('attachment.gif', get_lang('Attachment')); echo Display::getMdiIcon('paperclip', 'ch-tool-icon', '', ICON_SIZE_SMALL, get_lang('Attachment'));
echo '<a href="download.php?file='; echo '<a href="download.php?file=';
echo $realname; echo $realname;
echo ' "> '.$user_filename.' </a>'; echo ' "> '.$user_filename.' </a>';

@ -4,6 +4,7 @@
use Chamilo\CourseBundle\Entity\CForumPost; use Chamilo\CourseBundle\Entity\CForumPost;
use ChamiloSession as Session; use ChamiloSession as Session;
use Chamilo\CoreBundle\Component\Utils\ActionIcon;
/** /**
* These files are a complete rework of the forum. The database structure is * These files are a complete rework of the forum. The database structure is
@ -204,11 +205,12 @@ if (!empty($_GET['lp_id']) || !empty($_POST['lp_id'])) {
$url = '../lp/lp_controller.php?'.api_get_cidreq() $url = '../lp/lp_controller.php?'.api_get_cidreq()
."&gradebook=&action=add_item&type=step&lp_id='.$lp_id.'#resource_tab-5"; ."&gradebook=&action=add_item&type=step&lp_id='.$lp_id.'#resource_tab-5";
$actionLeft .= Display::url( $actionLeft .= Display::url(
Display::return_icon( Display::getMdiIcon(
'back.png', ActionIcon::BACK,
get_lang('Back to').' '.get_lang('Learning paths'), 'ch-tool-icon',
null, null,
ICON_SIZE_MEDIUM ICON_SIZE_MEDIUM,
get_lang('Back to').' '.get_lang('Learning paths')
), ),
$url $url
); );
@ -217,23 +219,13 @@ if (!empty($_GET['lp_id']) || !empty($_POST['lp_id'])) {
if (api_is_allowed_to_edit(false, true)) { if (api_is_allowed_to_edit(false, true)) {
if (is_array($forumCategories) && !empty($forumCategories)) { if (is_array($forumCategories) && !empty($forumCategories)) {
$actionLeft .= Display::url( $actionLeft .= Display::url(
Display::return_icon( Display::getMdiIcon('comment-quote', 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Add a forum')),
'new_forum.png',
get_lang('Add a forum'),
null,
ICON_SIZE_MEDIUM
),
api_get_self().'?'.api_get_cidreq().'&action=add_forum&lp_id='.$lp_id api_get_self().'?'.api_get_cidreq().'&action=add_forum&lp_id='.$lp_id
); );
} }
$actionLeft .= Display::url( $actionLeft .= Display::url(
Display::return_icon( Display::getMdiIcon('folder-multiple-plus', 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Add a forumCategory')),
'new_folder.png',
get_lang('Add a forumCategory'),
null,
ICON_SIZE_MEDIUM
),
api_get_self().'?'.api_get_cidreq().'&action=add_category&lp_id='.$lp_id api_get_self().'?'.api_get_cidreq().'&action=add_category&lp_id='.$lp_id
); );
} }
@ -346,12 +338,7 @@ if (is_array($forumCategories)) {
) { ) {
$tools .= '<a href="'.api_get_self().'?'.api_get_cidreq() $tools .= '<a href="'.api_get_self().'?'.api_get_cidreq()
.'&action=edit_category&content=forumcategory&id='.$categoryId .'&action=edit_category&content=forumcategory&id='.$categoryId
.'">'.Display::return_icon( .'">'.Display::getMdiIcon(ActionIcon::EDIT, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Edit'))
'edit.png',
get_lang('Edit'),
[],
ICON_SIZE_SMALL
)
.'</a>'; .'</a>';
$tools .= '<a href="'.api_get_self().'?'.api_get_cidreq() $tools .= '<a href="'.api_get_self().'?'.api_get_cidreq()
@ -362,12 +349,7 @@ if (is_array($forumCategories)) {
ENT_QUOTES ENT_QUOTES
)) ))
."')) return false;\">" ."')) return false;\">"
.Display::return_icon( .Display::getMdiIcon(ActionIcon::DELETE, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Delete'))
'delete.png',
get_lang('Delete'),
[],
ICON_SIZE_SMALL
)
.'</a>'; .'</a>';
$tools .= returnVisibleInvisibleIcon( $tools .= returnVisibleInvisibleIcon(
'forumcategory', 'forumcategory',
@ -542,7 +524,7 @@ if (is_array($forumCategories)) {
if (api_is_allowed_to_edit(false, true)) { if (api_is_allowed_to_edit(false, true)) {
$toolActions .= '<a href="'.api_get_self().'?'.api_get_cidreq() $toolActions .= '<a href="'.api_get_self().'?'.api_get_cidreq()
.'&action=edit_forum&content=forum&id='.$forumId.'">' .'&action=edit_forum&content=forum&id='.$forumId.'">'
.Display::return_icon('edit.png', get_lang('Edit'), [], ICON_SIZE_SMALL) .Display::getMdiIcon(ActionIcon::EDIT, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Edit'))
.'</a>'; .'</a>';
$toolActions .= '<a href="'.api_get_self().'?'.api_get_cidreq() $toolActions .= '<a href="'.api_get_self().'?'.api_get_cidreq()
.'&action=delete_forum&content=forum&id='.$forumId .'&action=delete_forum&content=forum&id='.$forumId
@ -550,7 +532,7 @@ if (is_array($forumCategories)) {
api_htmlentities(get_lang('Delete forum ?'), ENT_QUOTES) api_htmlentities(get_lang('Delete forum ?'), ENT_QUOTES)
) )
."')) return false;\">" ."')) return false;\">"
.Display::return_icon('delete.png', get_lang('Delete'), [], ICON_SIZE_SMALL) .Display::getMdiIcon(ActionIcon::DELETE, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Delete'))
.'</a>'; .'</a>';
$toolActions .= returnVisibleInvisibleIcon( $toolActions .= returnVisibleInvisibleIcon(

@ -4,6 +4,7 @@
use Chamilo\CoreBundle\Framework\Container; use Chamilo\CoreBundle\Framework\Container;
use Chamilo\CourseBundle\Entity\CForum; use Chamilo\CourseBundle\Entity\CForum;
use Chamilo\CoreBundle\Component\Utils\ActionIcon;
/** /**
* These files are a complete rework of the forum. The database structure is * These files are a complete rework of the forum. The database structure is
@ -223,7 +224,7 @@ Display::display_header();
//$actions '<span style="float:right;">'.search_link().'</span>'; //$actions '<span style="float:right;">'.search_link().'</span>';
$actions = '<a href="viewforum.php?forum='.(int) ($_GET['forum']).'&'.$cidreq.'">'. $actions = '<a href="viewforum.php?forum='.(int) ($_GET['forum']).'&'.$cidreq.'">'.
Display::return_icon('back.png', get_lang('Back to forum'), '', ICON_SIZE_MEDIUM).'</a>'; Display::getMdiIcon(ActionIcon::BACK, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Back to forum')).'</a>';
echo Display::toolbarAction('toolbar', [$actions]); echo Display::toolbarAction('toolbar', [$actions]);
// Set forum attachment data into $_SESSION // Set forum attachment data into $_SESSION

@ -5,6 +5,7 @@
use Chamilo\CoreBundle\Framework\Container; use Chamilo\CoreBundle\Framework\Container;
use Chamilo\CourseBundle\Entity\CForum; use Chamilo\CourseBundle\Entity\CForum;
use Chamilo\CourseBundle\Entity\CForumThread; use Chamilo\CourseBundle\Entity\CForumThread;
use Chamilo\CoreBundle\Component\Utils\ActionIcon;
/** /**
* These files are a complete rework of the forum. The database structure is * These files are a complete rework of the forum. The database structure is
@ -204,7 +205,7 @@ $htmlHeadXtra[] = <<<JS
}); });
$('[name="user_upload[]"]').parent().append(newInputFile); $('[name="user_upload[]"]').parent().append(newInputFile);
}); })
}); });
</script> </script>
JS; JS;
@ -239,12 +240,7 @@ Display::display_header();
if ('learnpath' !== $origin) { if ('learnpath' !== $origin) {
//$actionsLeft = '<span style="float:right;">'.search_link().'</span>'; //$actionsLeft = '<span style="float:right;">'.search_link().'</span>';
$actionsLeft = '<a href="viewthread.php?'.api_get_cidreq().'&forum='.$forumId.'&thread='.$threadId.'">'; $actionsLeft = '<a href="viewthread.php?'.api_get_cidreq().'&forum='.$forumId.'&thread='.$threadId.'">';
$actionsLeft .= Display::return_icon( $actionsLeft .= Display::getMdiIcon(ActionIcon::BACK, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Back to thread')).'</a>';
'back.png',
get_lang('Back to thread'),
'',
ICON_SIZE_MEDIUM
).'</a>';
echo Display::toolbarAction('toolbar', [$actionsLeft]); echo Display::toolbarAction('toolbar', [$actionsLeft]);
} }

@ -5,6 +5,8 @@
use Chamilo\CoreBundle\Framework\Container; use Chamilo\CoreBundle\Framework\Container;
use Chamilo\CourseBundle\Entity\CForum; use Chamilo\CourseBundle\Entity\CForum;
use Chamilo\CourseBundle\Entity\CForumPost; use Chamilo\CourseBundle\Entity\CForumPost;
use Chamilo\CoreBundle\Component\Utils\ActionIcon;
use Chamilo\CoreBundle\Component\Utils\ToolIcon;
require_once __DIR__.'/../inc/global.inc.php'; require_once __DIR__.'/../inc/global.inc.php';
@ -240,7 +242,7 @@ if ('liststd' === $my_action &&
$qualificationBlock .= '</tr>'; $qualificationBlock .= '</tr>';
$max_qualify = showQualify('2', $userId, $_GET['id']); $max_qualify = showQualify('2', $userId, $_GET['id']);
$counter = 0; $counter = 0;
$icon = Display::return_icon('quiz.png', get_lang('Grade activity')); $icon = Display::getMdiIcon(ActionIcon::GRADE, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Grade activity'));
if (Database::num_rows($student_list) > 0) { if (Database::num_rows($student_list) > 0) {
while ($row_student_list = Database::fetch_array($student_list)) { while ($row_student_list = Database::fetch_array($student_list)) {
$userInfo = api_get_user_info($row_student_list['id']); $userInfo = api_get_user_info($row_student_list['id']);
@ -290,12 +292,12 @@ $actions = '';
if ('learnpath' !== $origin) { if ('learnpath' !== $origin) {
if (!empty($groupId)) { if (!empty($groupId)) {
$actions .= '<a href="'.api_get_path(WEB_CODE_PATH).'group/group_space.php?'.api_get_cidreq().'">' $actions .= '<a href="'.api_get_path(WEB_CODE_PATH).'group/group_space.php?'.api_get_cidreq().'">'
.Display::return_icon('back.png', get_lang('Back to') .Display::getMdiIcon(ActionIcon::BACK, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Back to')
.' '.get_lang('Groups'), '', ICON_SIZE_MEDIUM).'</a>'; .' '.get_lang('Groups'), '', ICON_SIZE_MEDIUM).'</a>';
} else { } else {
$actions .= '<span style="float:right;">'.search_link().'</span>'; $actions .= '<span style="float:right;">'.search_link().'</span>';
$actions .= '<a href="'.$forumUrl.'index.php?'.api_get_cidreq().'">' $actions .= '<a href="'.$forumUrl.'index.php?'.api_get_cidreq().'">'
.Display::return_icon('back.png', get_lang('Back toForumOverview'), '', ICON_SIZE_MEDIUM) .Display::getMdiIcon(ActionIcon::BACK, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Back toForumOverview'))
.'</a>'; .'</a>';
} }
} }
@ -312,7 +314,7 @@ if (api_is_allowed_to_edit(false, true) ||
if (!api_is_anonymous() && !api_is_invitee()) { if (!api_is_anonymous() && !api_is_invitee()) {
$actions .= '<a href="'.$forumUrl.'newthread.php?'.api_get_cidreq().'&forum=' $actions .= '<a href="'.$forumUrl.'newthread.php?'.api_get_cidreq().'&forum='
.$forumId.'">' .$forumId.'">'
.Display::return_icon('new_thread.png', get_lang('Create thread'), '', ICON_SIZE_MEDIUM) .Display::getMdiIcon('format-quote-open', 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Create thread'))
.'</a>'; .'</a>';
} }
} else { } else {
@ -321,12 +323,7 @@ if (api_is_allowed_to_edit(false, true) ||
} }
$descriptionForum = $forumEntity->getForumComment(); $descriptionForum = $forumEntity->getForumComment();
$iconForum = Display::return_icon( $iconForum = Display::getMdiIcon('comment-quote', 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Forum'));
'forum_yellow.png',
get_lang('Forum'),
null,
ICON_SIZE_MEDIUM
);
$header = ''; $header = '';
// The current forum // The current forum
@ -426,14 +423,9 @@ if (is_array($threads)) {
} }
$html .= '<div class="col-md-4">' $html .= '<div class="col-md-4">'
.Display::return_icon('post-forum.png', null, null, ICON_SIZE_SMALL) .Display::getMdiIcon('format-quote-open', 'ch-tool-icon', '', ICON_SIZE_SMALL, get_lang('Replies'))
." {$thread->getThreadReplies()} ".get_lang('Replies').'<br>'; ." {$thread->getThreadReplies()} ".get_lang('Replies').'<br>';
$html .= Display::return_icon( $html .= Display::getMdiIcon('format-quote-open', 'ch-tool-icon', '', ICON_SIZE_SMALL, get_lang('Views')).' '.$thread->getThreadReplies().' '.get_lang('Views').'<br>';
'post-forum.png',
null,
null,
ICON_SIZE_SMALL
).' '.$thread->getThreadReplies().' '.get_lang('Views').'<br>';
$html .= '</div>'; $html .= '</div>';
$last_post = null; $last_post = null;
if ($thread->getThreadLastPost()) { if ($thread->getThreadLastPost()) {
@ -457,20 +449,15 @@ if (is_array($threads)) {
.'&forum='.$forumId.'&thread=' .'&forum='.$forumId.'&thread='
.$thread->getIid() .$thread->getIid()
.'&id_attach='.$id_attach.'">' .'&id_attach='.$id_attach.'">'
.Display::return_icon('edit.png', get_lang('Edit'), [], ICON_SIZE_SMALL).'</a>'; .Display::getMdiIcon(ActionIcon::EDIT, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Edit')).'</a>';
if (api_resource_is_locked_by_gradebook($thread->getIid(), LINK_FORUM_THREAD)) { if (api_resource_is_locked_by_gradebook($thread->getIid(), LINK_FORUM_THREAD)) {
$iconsEdit .= Display::return_icon( $iconsEdit .= Display::getMdiIcon(ActionIcon::DELETE, 'ch-tool-icon-disabled', null, ICON_SIZE_SMALL, get_lang('This option is not available because this activity is contained by an assessment'));
'delete_na.png',
get_lang('This option is not available because this activity is contained by an assessment, which is currently locked. To unlock the assessment, ask your platform administrator.'),
[],
ICON_SIZE_SMALL
);
} else { } else {
$iconsEdit .= '<a href="'.$url.'&forum='.$forumId.'&action=delete_thread&content=thread&id=' $iconsEdit .= '<a href="'.$url.'&forum='.$forumId.'&action=delete_thread&content=thread&id='
.$thread->getIid()."\" onclick=\"javascript:if(!confirm('" .$thread->getIid()."\" onclick=\"javascript:if(!confirm('"
.addslashes(api_htmlentities(get_lang('Delete complete thread?'), ENT_QUOTES)) .addslashes(api_htmlentities(get_lang('Delete complete thread?'), ENT_QUOTES))
."')) return false;\">" ."')) return false;\">"
.Display::return_icon('delete.png', get_lang('Delete'), [], ICON_SIZE_SMALL).'</a>'; .Display::getMdiIcon(ActionIcon::DELETE, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Delete')).'</a>';
} }
$iconsEdit .= returnVisibleInvisibleIcon( $iconsEdit .= returnVisibleInvisibleIcon(
@ -492,29 +479,28 @@ if (is_array($threads)) {
] ]
); );
$iconsEdit .= '<a href="'.$viewForumUrl.'&forum='.$forumId.'&action=move_thread&thread='.$threadId.'">' $iconsEdit .= '<a href="'.$viewForumUrl.'&forum='.$forumId.'&action=move_thread&thread='.$threadId.'">'
.Display::return_icon('move.png', get_lang('Move Thread'), [], ICON_SIZE_SMALL) .Display::getMdiIcon(ActionIcon::MOVE, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Move Thread'))
.'</a>'; .'</a>';
} }
} }
$iconnotify = 'notification_mail_na.png'; $disable = true;
if (is_array( if (is_array(
isset($_SESSION['forum_notification']['thread']) ? $_SESSION['forum_notification']['thread'] : null isset($_SESSION['forum_notification']['thread']) ? $_SESSION['forum_notification']['thread'] : null
) )
) { ) {
if (in_array($threadId, $_SESSION['forum_notification']['thread'])) { if (in_array($threadId, $_SESSION['forum_notification']['thread'])) {
$iconnotify = 'notification_mail.png'; $disable = false;
} }
} }
$icon_liststd = 'user.png';
if (!api_is_anonymous() && api_is_allowed_to_session_edit(false, true)) { if (!api_is_anonymous() && api_is_allowed_to_session_edit(false, true)) {
$iconsEdit .= '<a href="'.$url.'&forum='.$forumId."&action=notify&content=thread&id={$threadId}".'">'. $iconsEdit .= '<a href="'.$url.'&forum='.$forumId."&action=notify&content=thread&id={$threadId}".'">'.
Display::return_icon($iconnotify, get_lang('Notify me')).'</a>'; Display::getMdiIcon('email-alert', ($disable ? 'ch-tool-icon-disabled' : 'ch-tool-icon'), '', ICON_SIZE_SMALL, get_lang('Notify me')).'</a>';
} }
if (api_is_allowed_to_edit(null, true) && 'learnpath' != $origin) { if (api_is_allowed_to_edit(null, true) && 'learnpath' != $origin) {
$iconsEdit .= '<a href="'.$viewForumUrl.'&forum='.$forumId."&action=liststd&content=thread&id={$threadId}".'">'. $iconsEdit .= '<a href="'.$viewForumUrl.'&forum='.$forumId."&action=liststd&content=thread&id={$threadId}".'">'.
Display::return_icon($icon_liststd, get_lang('Learners list'), [], ICON_SIZE_SMALL) Display::getMdiIcon(ToolIcon::MEMBER, 'ch-tool-icon', '', ICON_SIZE_SMALL, get_lang('Learners list'))
.'</a>'; .'</a>';
} }
$html .= $iconsEdit; $html .= $iconsEdit;

@ -4,6 +4,8 @@
use Chamilo\CourseBundle\Entity\CForumPost; use Chamilo\CourseBundle\Entity\CForumPost;
use ChamiloSession as Session; use ChamiloSession as Session;
use Chamilo\CoreBundle\Component\Utils\ActionIcon;
use Chamilo\CoreBundle\Component\Utils\ToolIcon;
require_once __DIR__.'/../inc/global.inc.php'; require_once __DIR__.'/../inc/global.inc.php';
@ -123,12 +125,7 @@ if (!empty($_GET['lp_id']) || !empty($_POST['lp_id'])) {
$url = '../lp/lp_controller.php?'.api_get_cidreq() $url = '../lp/lp_controller.php?'.api_get_cidreq()
."&gradebook=&action=add_item&type=step&lp_id='.$lp_id.'#resource_tab-5"; ."&gradebook=&action=add_item&type=step&lp_id='.$lp_id.'#resource_tab-5";
$actionLeft .= Display::url( $actionLeft .= Display::url(
Display::return_icon( Display::getMdiIcon(ActionIcon::BACK, 'ch-tool-icon', '', ICON_SIZE_MEDIUM, get_lang('Back to').' '.get_lang('Learning paths')),
'back.png',
get_lang('Back to').' '.get_lang('Learning paths'),
null,
ICON_SIZE_MEDIUM
),
$url $url
); );
} }
@ -137,34 +134,19 @@ if (api_is_allowed_to_edit(false, true)) {
$url = 'index.php?'.api_get_cidreq(); $url = 'index.php?'.api_get_cidreq();
$actionLeft .= Display::url( $actionLeft .= Display::url(
Display::return_icon( Display::getMdiIcon(ActionIcon::BACK, 'ch-tool-icon', '', ICON_SIZE_MEDIUM, get_lang('Back to').' '.get_lang('Learning paths')),
'back.png',
get_lang('Back to').' '.get_lang('Learning paths'),
null,
ICON_SIZE_MEDIUM
),
$url $url
); );
if (is_array($forumCategories) && !empty($forumCategories)) { if (is_array($forumCategories) && !empty($forumCategories)) {
$actionLeft .= Display::url( $actionLeft .= Display::url(
Display::return_icon( Display::getMdiIcon(ToolIcon::FORUM, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Add a forum')),
'new_forum.png',
get_lang('Add a forum'),
null,
ICON_SIZE_MEDIUM
),
api_get_self().'?'.api_get_cidreq().'&action=add_forum&lp_id='.$lp_id api_get_self().'?'.api_get_cidreq().'&action=add_forum&lp_id='.$lp_id
); );
} }
$actionLeft .= Display::url( $actionLeft .= Display::url(
Display::return_icon( Display::getMdiIcon(ActionIcon::FOLDER_CREATE, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Add a forumCategory')),
'new_folder.png',
get_lang('Add a forumCategory'),
null,
ICON_SIZE_MEDIUM
),
api_get_self().'?'.api_get_cidreq().'&action=add_category&lp_id='.$lp_id api_get_self().'?'.api_get_cidreq().'&action=add_category&lp_id='.$lp_id
); );
} }
@ -212,12 +194,7 @@ if (is_array($forumCategories)) {
) { ) {
$tools .= '<a href="'.api_get_self().'?'.api_get_cidreq() $tools .= '<a href="'.api_get_self().'?'.api_get_cidreq()
.'&action=edit_category&content=forumcategory&id='.$categoryId .'&action=edit_category&content=forumcategory&id='.$categoryId
.'">'.Display::return_icon( .'">'.Display::getMdiIcon(ActionIcon::EDIT, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Edit'))
'edit.png',
get_lang('Edit'),
[],
ICON_SIZE_SMALL
)
.'</a>'; .'</a>';
$tools .= '<a href="'.api_get_self().'?'.api_get_cidreq() $tools .= '<a href="'.api_get_self().'?'.api_get_cidreq()
@ -228,12 +205,7 @@ if (is_array($forumCategories)) {
ENT_QUOTES ENT_QUOTES
)) ))
."')) return false;\">" ."')) return false;\">"
.Display::return_icon( .Display::getMdiIcon(ActionIcon::DELETE, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Delete'))
'delete.png',
get_lang('Delete'),
[],
ICON_SIZE_SMALL
)
.'</a>'; .'</a>';
$tools .= returnVisibleInvisibleIcon( $tools .= returnVisibleInvisibleIcon(
'forumcategory', 'forumcategory',
@ -336,7 +308,7 @@ if (is_array($forumCategories)) {
if (api_is_allowed_to_edit(false, true)) { if (api_is_allowed_to_edit(false, true)) {
$toolActions .= '<a href="'.api_get_self().'?'.api_get_cidreq() $toolActions .= '<a href="'.api_get_self().'?'.api_get_cidreq()
.'&action=edit_forum&content=forum&id='.$forumId.'">' .'&action=edit_forum&content=forum&id='.$forumId.'">'
.Display::return_icon('edit.png', get_lang('Edit'), [], ICON_SIZE_SMALL) .Display::getMdiIcon(ActionIcon::EDIT, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Edit'))
.'</a>'; .'</a>';
$toolActions .= '<a href="'.api_get_self().'?'.api_get_cidreq() $toolActions .= '<a href="'.api_get_self().'?'.api_get_cidreq()
.'&action=delete_forum&content=forum&id='.$forumId .'&action=delete_forum&content=forum&id='.$forumId
@ -344,7 +316,7 @@ if (is_array($forumCategories)) {
api_htmlentities(get_lang('Delete forum ?'), ENT_QUOTES) api_htmlentities(get_lang('Delete forum ?'), ENT_QUOTES)
) )
."')) return false;\">" ."')) return false;\">"
.Display::return_icon('delete.png', get_lang('Delete'), [], ICON_SIZE_SMALL) .Display::getMdiIcon(ActionIcon::DELETE, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Delete'))
.'</a>'; .'</a>';
$toolActions .= returnVisibleInvisibleIcon( $toolActions .= returnVisibleInvisibleIcon(

@ -7,6 +7,8 @@ use Chamilo\CourseBundle\Entity\CForum;
use Chamilo\CourseBundle\Entity\CForumAttachment; use Chamilo\CourseBundle\Entity\CForumAttachment;
use Chamilo\CourseBundle\Entity\CForumPost; use Chamilo\CourseBundle\Entity\CForumPost;
use Chamilo\CourseBundle\Entity\CForumThread; use Chamilo\CourseBundle\Entity\CForumThread;
use Chamilo\CoreBundle\Component\Utils\ActionIcon;
use Chamilo\CoreBundle\Component\Utils\ToolIcon;
require_once __DIR__.'/../inc/global.inc.php'; require_once __DIR__.'/../inc/global.inc.php';
@ -295,7 +297,7 @@ if ('learnpath' === $origin) {
$actions = '<span style="float:right;">'.search_link().'</span>'; $actions = '<span style="float:right;">'.search_link().'</span>';
if ('learnpath' != $origin) { if ('learnpath' != $origin) {
$actions .= '<a href="'.$forumUrl.'viewforum.php?forum='.$forumId.'&'.api_get_cidreq().'">' $actions .= '<a href="'.$forumUrl.'viewforum.php?forum='.$forumId.'&'.api_get_cidreq().'">'
.Display::return_icon('back.png', get_lang('Back to forum'), '', ICON_SIZE_MEDIUM).'</a>'; .Display::getMdiIcon(ActionIcon::BACK, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Back to forum')).'</a>';
} }
// The reply to thread link should only appear when the forum_category is // The reply to thread link should only appear when the forum_category is
@ -313,14 +315,14 @@ if (($current_forum_category &&
// back link inside lp // back link inside lp
if ('learnpath' == $origin && !empty($threadId)) { if ('learnpath' == $origin && !empty($threadId)) {
$actions .= '<a href="'.$forumUrl.'viewforum.php?forum='.$forumId.'&'.api_get_cidreq().'">' $actions .= '<a href="'.$forumUrl.'viewforum.php?forum='.$forumId.'&'.api_get_cidreq().'">'
.Display::return_icon('back.png', get_lang('Back to forum'), '', ICON_SIZE_MEDIUM).'</a>'; .Display::getMdiIcon(ActionIcon::BACK, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Back to forum')).'</a>';
} }
// reply link // reply link
if (!api_is_anonymous() && api_is_allowed_to_session_edit(false, true)) { if (!api_is_anonymous() && api_is_allowed_to_session_edit(false, true)) {
$actions .= '<a href="'.$forumUrl.'reply.php?'.api_get_cidreq().'&forum='.$forumId.'&thread=' $actions .= '<a href="'.$forumUrl.'reply.php?'.api_get_cidreq().'&forum='.$forumId.'&thread='
.$threadId.'&action=replythread">' .$threadId.'&action=replythread">'
.Display::return_icon('reply_thread.png', get_lang('Reply to this thread'), '', ICON_SIZE_MEDIUM) .Display::getMdiIcon('reply', 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Reply to this thread'))
.'</a>'; .'</a>';
} }
// new thread link // new thread link
@ -437,7 +439,7 @@ foreach ($posts as $post) {
$editUrl = api_get_path(WEB_CODE_PATH).'forum/editpost.php?'.api_get_cidreq(); $editUrl = api_get_path(WEB_CODE_PATH).'forum/editpost.php?'.api_get_cidreq();
$editUrl .= "&forum=$forumId&thread=$threadId&post={$post['post_id']}&id_attach=$id_attach"; $editUrl .= "&forum=$forumId&thread=$threadId&post={$post['post_id']}&id_attach=$id_attach";
$iconEdit .= "<a href='".$editUrl."'>" $iconEdit .= "<a href='".$editUrl."'>"
.Display::return_icon('edit.png', get_lang('Edit'), [], ICON_SIZE_SMALL) .Display::getMdiIcon(ActionIcon::EDIT, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Edit'))
.'</a>'; .'</a>';
$editButton = Display::toolbarButton( $editButton = Display::toolbarButton(
@ -464,7 +466,7 @@ foreach ($posts as $post) {
] ]
); );
$iconEdit .= Display::url( $iconEdit .= Display::url(
Display::return_icon('delete.png', get_lang('Delete'), [], ICON_SIZE_SMALL), Display::getMdiIcon(ActionIcon::DELETE, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Delete')),
$deleteUrl, $deleteUrl,
[ [
'onclick' => "javascript:if(!confirm('" 'onclick' => "javascript:if(!confirm('"
@ -501,7 +503,7 @@ foreach ($posts as $post) {
if ($count > 0) { if ($count > 0) {
$iconEdit .= '<a href="viewthread.php?'.api_get_cidreq() $iconEdit .= '<a href="viewthread.php?'.api_get_cidreq()
."&forum=$forumId&thread=$threadId&action=move&post={$post['post_id']}" ."&forum=$forumId&thread=$threadId&action=move&post={$post['post_id']}"
.'">'.Display::return_icon('move.png', get_lang('Move post'), [], ICON_SIZE_SMALL).'</a>'; .'">'.Display::getMdiIcon(ActionIcon::MOVE, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Move post')).'</a>';
} }
} }
@ -563,7 +565,7 @@ foreach ($posts as $post) {
."&forum=$forumId&thread=$threadId&action=list&post={$post['post_id']}" ."&forum=$forumId&thread=$threadId&action=list&post={$post['post_id']}"
."&user={$userId}&user_id={$userId}" ."&user={$userId}&user_id={$userId}"
."&idtextqualify=$current_qualify_thread" ."&idtextqualify=$current_qualify_thread"
.'" >'.Display::return_icon('quiz.png', get_lang('Grade activity')).'</a>'; .'" >'.Display::getMdiIcon(ToolIcon::QUIZ, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Grade activity')).'</a>';
} }
} }
} }
@ -666,7 +668,7 @@ foreach ($posts as $post) {
'AW:', 'AW:',
'Aw:', 'Aw:',
]; ];
$replace = '<span>'.Display::getMdiIcon('reply').'</span>'; $replace = '<span>'.Display::getMdiIcon('reply', 'ch-tool-icon', '', ICON_SIZE_SMALL).'</span>';
$post['post_title'] = str_replace($search, $replace, Security::remove_XSS($post['post_title'])); $post['post_title'] = str_replace($search, $replace, Security::remove_XSS($post['post_title']));
// The post title // The post title
@ -685,7 +687,7 @@ foreach ($posts as $post) {
$repo = Container::getForumAttachmentRepository(); $repo = Container::getForumAttachmentRepository();
/** @var CForumAttachment $attachment */ /** @var CForumAttachment $attachment */
foreach ($attachments as $attachment) { foreach ($attachments as $attachment) {
$post['post_attachments'] .= Display::getMdiIcon('paperclip'); $post['post_attachments'] .= Display::getMdiIcon('paperclip', 'ch-tool-icon', '', ICON_SIZE_SMALL);
$url = $repo->getResourceFileDownloadUrl($attachment).'?'.api_get_cidreq(); $url = $repo->getResourceFileDownloadUrl($attachment).'?'.api_get_cidreq();
$post['post_attachments'] .= Display::url($attachment->getFilename(), $url); $post['post_attachments'] .= Display::url($attachment->getFilename(), $url);
$post['post_attachments'] .= '<span class="forum_attach_comment" >'.$attachment->getComment().'</span>'; $post['post_attachments'] .= '<span class="forum_attach_comment" >'.$attachment->getComment().'</span>';
@ -697,7 +699,7 @@ foreach ($posts as $post) {
.$attachment->getIid().'&forum='.$forumId.'&thread='.$threadId.'&post='.$post['post_id'] .$attachment->getIid().'&forum='.$forumId.'&thread='.$threadId.'&post='.$post['post_id']
.'" onclick="javascript:if(!confirm(\'' .'" onclick="javascript:if(!confirm(\''
.addslashes(api_htmlentities(get_lang('Please confirm your choice'), ENT_QUOTES)).'\')) return false;">' .addslashes(api_htmlentities(get_lang('Please confirm your choice'), ENT_QUOTES)).'\')) return false;">'
.Display::return_icon('delete.png', get_lang('Delete')).'</a><br />'; .Display::getMdiIcon('delete', 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Delete')).'</a><br />';
} }
} }
} }

@ -3,6 +3,7 @@
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Component\Utils\ActionIcon; use Chamilo\CoreBundle\Component\Utils\ActionIcon;
use Chamilo\CoreBundle\Component\Utils\ToolIcon;
use Chamilo\CoreBundle\Entity\ExtraField; use Chamilo\CoreBundle\Entity\ExtraField;
use Chamilo\CoreBundle\Entity\ExtraFieldValues; use Chamilo\CoreBundle\Entity\ExtraFieldValues;
use Chamilo\CoreBundle\Framework\Container; use Chamilo\CoreBundle\Framework\Container;
@ -2219,7 +2220,7 @@ class Display
return $html; return $html;
} }
public static function getMdiIcon(string|ActionIcon $name, string $additionalClass = null, string $style = null, int $pixelSize = null, string $title = null, array $additionalAttributes = null): string public static function getMdiIcon(string|ActionIcon|ToolIcon $name, string $additionalClass = null, string $style = null, int $pixelSize = null, string $title = null, array $additionalAttributes = null): string
{ {
$sizeString = ''; $sizeString = '';
if (!empty($pixelSize)) { if (!empty($pixelSize)) {
@ -2231,7 +2232,7 @@ class Display
$additionalAttributes['class'] = 'mdi mdi-'; $additionalAttributes['class'] = 'mdi mdi-';
if ($name instanceof ActionIcon) { if ($name instanceof ActionIcon or $name instanceof ToolIcon) {
$additionalAttributes['class'] .= $name->value; $additionalAttributes['class'] .= $name->value;
} else { } else {
$additionalAttributes['class'] .= $name; $additionalAttributes['class'] .= $name;

@ -86,48 +86,6 @@ class DateTimePicker extends HTML_QuickForm_text
} }
}; };
$('#{$id}').flatpickr(config); $('#{$id}').flatpickr(config);
/*
var txtDateTime = $('#$id'),
inputGroup = txtDateTime.parents('.input-group'),
txtDateTimeAlt = $('#{$id}_alt'),
txtDateTimeAltText = $('#{$id}_alt_text');
txtDateTime
.hide()
.datetimepicker({
defaultDate: '".$this->getValue()."',
dateFormat: 'yy-mm-dd',
timeFormat: 'HH:mm',
altField: '#{$id}_alt',
altFormat: \"".get_lang('MM dd, yy')."\",
altTimeFormat: \"".get_lang('HH:mm')."\",
altSeparator: \" ".get_lang(' at')." \",
altFieldTimeOnly: false,
showOn: 'both',
buttonImage: '".Display::return_icon('attendance.png', null, [], ICON_SIZE_TINY, true, true)."',
buttonImageOnly: true,
buttonText: '".get_lang('Select date')."',
changeMonth: true,
changeYear: true
})
.on('change', function (e) {
txtDateTimeAltText.text(txtDateTimeAlt.val());
});
txtDateTimeAltText.on('click', function () {
txtDateTime.datepicker('show');
});
inputGroup
.find('button')
.on('click', function (e) {
e.preventDefault();
$('#$id, #{$id}_alt').val('');
$('#{$id}_alt_text').html('');
});
*/
}); });
</script>"; </script>";

@ -8099,7 +8099,7 @@ class SessionManager
]; ];
$form->addSelect('access', get_lang('Access'), $options, [ $form->addSelect('access', get_lang('Access'), $options, [
'onchange' => 'accessSwitcher()', 'onchange' => 'accessSwitcher(this.value)',
'id' => 'access', 'id' => 'access',
]); ]);
@ -8122,7 +8122,7 @@ class SessionManager
// Dates // Dates
$form->addDateTimePicker( $form->addDateTimePicker(
'access_start_date', 'access_start_date',
[get_lang('Access start date'), get_lang('Date on which the session is made available to all')], [get_lang('Access start'), get_lang('Date on which the session is made available to all')],
['id' => 'access_start_date'] ['id' => 'access_start_date']
); );
@ -8193,9 +8193,6 @@ class SessionManager
$form->addCheckBox( $form->addCheckBox(
'send_subscription_notification', 'send_subscription_notification',
[
//get_lang('Send mail notification to students to inform of subscription'),
],
get_lang('Send an email when a user being subscribed to session'), get_lang('Send an email when a user being subscribed to session'),
); );

@ -78,12 +78,28 @@ function search_coachs($needle)
return $xajax_response; return $xajax_response;
} }
$urlAction = api_get_self();
$session = null;
$fromSessionId = null;
$accessSelected = 0;
if (isset($_GET['fromSessionId'])) {
$fromSessionId = (int) $_GET['fromSessionId'];
$session = api_get_session_entity($fromSessionId);
if ($session && 0 === (int) $session->getDuration()) {
$accessSelected = 1;
}
$urlAction .= '?fromSessionId=' . $fromSessionId;
}
$xajax->processRequests(); $xajax->processRequests();
$htmlHeadXtra[] = $xajax->getJavascript('../inc/lib/xajax/'); $htmlHeadXtra[] = $xajax->getJavascript('../inc/lib/xajax/');
$htmlHeadXtra[] = " $htmlHeadXtra[] = "
<script> <script>
$(function() { $(function() {
accessSwitcher(0); setTimeout(function() {
$('#access').val('".$accessSelected."').trigger('change');
accessSwitcher('".$accessSelected."');
}, 1000);
}); });
function fill_coach_field (username) { function fill_coach_field (username) {
@ -121,8 +137,6 @@ if (isset($_POST['formSent']) && $_POST['formSent']) {
$tool_name = get_lang('Add a training session'); $tool_name = get_lang('Add a training session');
$urlAction = api_get_self();
function check_session_name($name) function check_session_name($name)
{ {
$session = SessionManager::get_session_by_name($name); $session = SessionManager::get_session_by_name($name);
@ -130,13 +144,6 @@ function check_session_name($name)
return empty($session) ? true : false; return empty($session) ? true : false;
} }
$session = null;
$fromSessionId = null;
if (isset($_GET['fromSessionId'])) {
$fromSessionId = (int) $_GET['fromSessionId'];
$session = api_get_session_entity($fromSessionId);
$urlAction .= '?fromSessionId=' . $fromSessionId;
}
$form = new FormValidator('add_session', 'post', $urlAction); $form = new FormValidator('add_session', 'post', $urlAction);
$form->addElement('header', $tool_name); $form->addElement('header', $tool_name);
$result = SessionManager::setForm($form, null, $fromSessionId); $result = SessionManager::setForm($form, null, $fromSessionId);
@ -157,7 +164,9 @@ $(function() {
function repopulateFormValues() { function repopulateFormValues() {
var formValues = JSON.parse(sessionStorage.getItem('formValues')); var formValues = JSON.parse(sessionStorage.getItem('formValues'));
$.each(formValues, function(i, field) { $.each(formValues, function(i, field) {
$('[name=\"' + field.name + '\"]').val(field.value); if (field.name === 'coach_username' || field.name === 'name' || field.name === 'system_template') {
$('[name=\"' + field.name + '\"]').val(field.value);
}
}); });
} }
@ -244,9 +253,9 @@ $form->setDefaults($formDefaults);
if ($form->validate()) { if ($form->validate()) {
$params = $form->getSubmitValues(); $params = $form->getSubmitValues();
$name = $params['name']; $name = $params['name'];
$startDate = $params['access_start_date']; $startDate = $params['access_start_date2'];
$endDate = $params['access_end_date']; $endDate = $params['access_end_date'];
$displayStartDate = $params['display_start_date']; $displayStartDate = $params['display_start_date2'];
$displayEndDate = $params['display_end_date']; $displayEndDate = $params['display_end_date'];
$coachStartDate = $params['coach_access_start_date']; $coachStartDate = $params['coach_access_start_date'];
if (empty($coachStartDate)) { if (empty($coachStartDate)) {

@ -97,7 +97,7 @@ enum ActionIcon: string
// Send a message // Send a message
case MESSAGE_SEND = 'send'; case MESSAGE_SEND = 'send';
// Add an attachment // Add an attachment
case ATTACHMENT_ADD = 'file-plus'; case ATTACHMENT_ADD = 'paperclip-plus';
// ? // ?
//case CLOUD_UPLOAD = 'cloud-upload'; //case CLOUD_UPLOAD = 'cloud-upload';
// Three vertical dots to indicate the possibility to extend a menu/set of options // Three vertical dots to indicate the possibility to extend a menu/set of options

@ -0,0 +1,71 @@
<?php
/* For licensing terms, see /license.txt */
declare(strict_types=1);
namespace Chamilo\CoreBundle\Component\Utils;
enum ToolIcon: string
{
// Agenda/calendar
case AGENDA = 'calendar-text';
// Announcement
case ANNOUNCEMENT = 'bullhorn';
// Assignment/Work/Student publication
case ASSIGNMENT = 'inbox-full';
// Attendance
case ATTENDANCE = 'av-timer';
// Chat
case CHAT = 'chat-processing';
// Course description
case COURSE_DESCRIPTION = 'apple-safari';
// Course homepage
case COURSE_HOME = 'upload';
// Course progress / Thematic advance
case COURSE_PROGRESS = 'progress-star';
// Course progress' lesson plan
case COURSE_PROGRESS_PLAN = 'progress-check';
// Course progress' schedule
case COURSE_PROGRESS_SCHEDULE = 'progress-clock';
// Course tool / Course entity
case COURSE = 'book-open-page-variant';
// Document
case DOCUMENT = 'bookshelf';
// Exercise / Test / Quiz / Exam
case QUIZ = 'order-bool-ascending-variant';
// Forum
case FORUM = 'comment-quote';
// Glossary
case GLOSSARY = 'alphabetical';
// Gradebook
case GRADEBOOK = 'certificate';
// Group
case GROUP = 'account-group';
// Learning path
case LP = 'map-marker-path';
// Link
case LINK = 'file-link';
// Maintenance
case MAINTENANCE = 'wrench-cog';
// Members / Users
case MEMBER = 'account';
// Notebook
case NOTEBOOK = 'note';
// Settings
case SETTINGS = 'cog';
// Shortcut
case SHORTCUT = 'flash-outline';
// Survey
case SURVEY = 'form-dropdown';
// Tool intro
case INTRO = 'image-text';
// Tracking/Reporting
case TRACKING = 'chart-box';
// Videoconference
case VIDEOCONFERENCE = 'video';
// Wiki
case WIKI = 'view-dashboard-edit';
// Security
case SECURITY = 'security';
}
Loading…
Cancel
Save