Minor - Replace div actions with Display::toolbarAction

pull/3890/head
Julio Montoya 4 years ago
parent c312e4c9df
commit badc7c37b0
  1. 11
      public/main/admin/extra_fields.php
  2. 8
      public/main/admin/system_announcements.php
  3. 2
      public/main/admin/user_list.php
  4. 12
      public/main/admin/usergroups.php
  5. 4
      public/main/calendar/agenda_js.php
  6. 17
      public/main/inc/lib/extra_field.lib.php
  7. 21
      public/main/inc/lib/message.lib.php
  8. 14
      public/main/inc/lib/usergroup.lib.php
  9. 5
      public/main/session/session_export.php
  10. 7
      public/main/session/session_import_drh.php
  11. 6
      public/main/session/session_list.php

@ -1,4 +1,5 @@
<?php <?php
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
$cidReset = true; $cidReset = true;
@ -122,10 +123,9 @@ switch ($action) {
} }
$obj->display(); $obj->display();
} else { } else {
echo '<div class="actions">'; $actions = '<a href="'.api_get_self().'?type='.$obj->type.'">'.
echo '<a href="'.api_get_self().'?type='.$obj->type.'">'.
Display::return_icon('back.png', get_lang('Back'), '', ICON_SIZE_MEDIUM).'</a>'; Display::return_icon('back.png', get_lang('Back'), '', ICON_SIZE_MEDIUM).'</a>';
echo '</div>'; echo Display::toolbarAction('toolbar', [$actions]);
$form->addElement('hidden', 'sec_token'); $form->addElement('hidden', 'sec_token');
$form->setConstants(['sec_token' => $token]); $form->setConstants(['sec_token' => $token]);
$form->display(); $form->display();
@ -147,10 +147,9 @@ switch ($action) {
); );
$obj->display(); $obj->display();
} else { } else {
echo '<div class="actions">'; $actions = '<a href="'.api_get_self().'?type='.$obj->type.'">'.
echo '<a href="'.api_get_self().'?type='.$obj->type.'">'.
Display::return_icon('back.png', get_lang('Back'), '', ICON_SIZE_MEDIUM).'</a>'; Display::return_icon('back.png', get_lang('Back'), '', ICON_SIZE_MEDIUM).'</a>';
echo '</div>'; echo Display::toolbarAction('toolbar', [$actions]);
$form->addElement('hidden', 'sec_token'); $form->addElement('hidden', 'sec_token');
$form->setConstants(['sec_token' => $token]); $form->setConstants(['sec_token' => $token]);
$form->display(); $form->display();

@ -85,20 +85,18 @@ function showCareer() {
// Displaying the header. // Displaying the header.
Display::display_header($tool_name); Display::display_header($tool_name);
if ('add' !== $action && 'edit' !== $action) { if ('add' !== $action && 'edit' !== $action) {
echo '<div class="actions">'; $actions = '<a href="?action=add">'.Display::return_icon('add.png', get_lang('Add an announcement'), [], 32).'</a>';
echo '<a href="?action=add">'.Display::return_icon('add.png', get_lang('Add an announcement'), [], 32).'</a>'; echo Display::toolbarAction('toolbar', [$actions]);
echo '</div>';
} }
$show_announcement_list = true; $show_announcement_list = true;
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null; $action = $_REQUEST['action'] ?? null;
// Form was posted? // Form was posted?
if (isset($_POST['action'])) { if (isset($_POST['action'])) {
$action_todo = true; $action_todo = true;
} }
// Actions
switch ($action) { switch ($action) {
case 'make_visible': case 'make_visible':
case 'make_invisible': case 'make_invisible':

@ -1248,7 +1248,7 @@ if (0 == $table->get_total_number_of_items()) {
} }
$toolbarActions = Display::toolbarAction( $toolbarActions = Display::toolbarAction(
'toolbarUser', 'toolbarUser',
[$actionsLeft, $actionsCenter, $actionsRight], [$actionsLeft, $actionsCenter.$actionsRight],
[4, 4, 4] [4, 4, 4]
); );

@ -1,4 +1,5 @@
<?php <?php
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Framework\Container; use Chamilo\CoreBundle\Framework\Container;
@ -104,10 +105,9 @@ switch ($action) {
header('Location: '.api_get_self()); header('Location: '.api_get_self());
exit; exit;
} else { } else {
$content .= '<div class="actions">'; $actions = '<a href="'.api_get_self().'">'.
$content .= '<a href="'.api_get_self().'">'.
Display::return_icon('back.png', get_lang('Back'), '', ICON_SIZE_MEDIUM).'</a>'; Display::return_icon('back.png', get_lang('Back'), '', ICON_SIZE_MEDIUM).'</a>';
$content .= '</div>'; $content .= Display::toolbarAction('toolbar', [$actions]);
$token = Security::get_token(); $token = Security::get_token();
$form->addElement('hidden', 'sec_token'); $form->addElement('hidden', 'sec_token');
$form->setConstants(['sec_token' => $token]); $form->setConstants(['sec_token' => $token]);
@ -152,14 +152,13 @@ switch ($action) {
header('Location: '.api_get_self()); header('Location: '.api_get_self());
exit; exit;
} else { } else {
$content .= '<div class="actions">'; $actions = '<a href="'.api_get_self().'">'.Display::return_icon(
$content .= '<a href="'.api_get_self().'">'.Display::return_icon(
'back.png', 'back.png',
get_lang('Back'), get_lang('Back'),
'', '',
ICON_SIZE_MEDIUM ICON_SIZE_MEDIUM
).'</a>'; ).'</a>';
$content .= '</div>'; $content .= Display::toolbarAction('toolbar', [$actions]);
$content .= $form->returnForm(); $content .= $form->returnForm();
} }
break; break;
@ -179,7 +178,6 @@ switch ($action) {
break; break;
} }
// The header.
Display::display_header(); Display::display_header();
?> ?>

@ -7,7 +7,7 @@ $use_anonymous = true;
$typeList = ['personal', 'course', 'admin', 'platform']; $typeList = ['personal', 'course', 'admin', 'platform'];
// Calendar type // Calendar type
$type = isset($_REQUEST['type']) && in_array($_REQUEST['type'], $typeList) ? $_REQUEST['type'] : 'personal'; $type = isset($_REQUEST['type']) && in_array($_REQUEST['type'], $typeList) ? $_REQUEST['type'] : 'personal';
$userId = isset($_REQUEST['user_id']) ? $_REQUEST['user_id'] : null; $userId = $_REQUEST['user_id'] ?? null;
if ('personal' === $type || 'admin' === $type) { if ('personal' === $type || 'admin' === $type) {
$cidReset = true; // fixes #5162 $cidReset = true; // fixes #5162
@ -18,8 +18,8 @@ api_block_inactive_user();
$current_course_tool = TOOL_CALENDAR_EVENT; $current_course_tool = TOOL_CALENDAR_EVENT;
$this_section = SECTION_MYAGENDA; $this_section = SECTION_MYAGENDA;
$htmlHeadXtra[] = api_get_asset('fullcalendar/main.js');
$htmlHeadXtra[] = api_get_css_asset('fullcalendar/main.css'); $htmlHeadXtra[] = api_get_css_asset('fullcalendar/main.css');
$htmlHeadXtra[] = api_get_asset('fullcalendar/main.js');
if (api_is_platform_admin() && ('admin' === $type || 'platform' === $type)) { if (api_is_platform_admin() && ('admin' === $type || 'platform' === $type)) {
$type = 'admin'; $type = 'admin';

@ -2055,25 +2055,24 @@ class ExtraField extends Model
*/ */
public function display() public function display()
{ {
// action links $actions = '<a href="../admin/index.php">';
echo '<div class="actions">'; $actions .= Display::return_icon(
echo '<a href="../admin/index.php">';
echo Display::return_icon(
'back.png', 'back.png',
get_lang('Back to').' '.get_lang('Administration'), get_lang('Back to').' '.get_lang('Administration'),
'', '',
ICON_SIZE_MEDIUM ICON_SIZE_MEDIUM
); );
echo '</a>'; $actions .= '</a>';
echo '<a href="'.api_get_self().'?action=add&type='.$this->type.'">'; $actions .= '<a href="'.api_get_self().'?action=add&type='.$this->type.'">';
echo Display::return_icon( $actions .= Display::return_icon(
'add_user_fields.png', 'add_user_fields.png',
get_lang('Add'), get_lang('Add'),
'', '',
ICON_SIZE_MEDIUM ICON_SIZE_MEDIUM
); );
echo '</a>'; $actions .= '</a>';
echo '</div>';
echo Display::toolbarAction('toolbar', [$actions]);
echo Display::grid_html($this->type.'_fields'); echo Display::grid_html($this->type.'_fields');
} }

@ -1375,7 +1375,6 @@ class MessageManager
$messageContent .= '<div class="row">'; $messageContent .= '<div class="row">';
$messageContent .= '<div class="col-md-12">'; $messageContent .= '<div class="col-md-12">';
$messageContent .= '<ul class="list-message">'; $messageContent .= '<ul class="list-message">';
if (null !== $message->getUserSender()) { if (null !== $message->getUserSender()) {
$messageContent .= '<li>'.$userImage.'</li>'; $messageContent .= '<li>'.$userImage.'</li>';
$messageContent .= '<li>'; $messageContent .= '<li>';
@ -1427,34 +1426,35 @@ class MessageManager
</tr> </tr>
</table> </table>
<div id="message-attach">'.(!empty($filesAttachments) ? implode('<br />', $filesAttachments) : '').'</div> <div id="message-attach">'.(!empty($filesAttachments) ? implode('<br />', $filesAttachments) : '').'</div>
<div style="padding: 15px 0px 5px 0px">'; ';
$social_link = ''; $social_link = '';
if (isset($_GET['f']) && 'social' === $_GET['f']) { if (isset($_GET['f']) && 'social' === $_GET['f']) {
$social_link = 'f=social'; $social_link = 'f=social';
} }
$actions = '';
switch ($type) { switch ($type) {
case self::MESSAGE_TYPE_OUTBOX: case self::MESSAGE_TYPE_OUTBOX:
$messageContent .= '<a href="outbox.php?'.$social_link.'">'. $actions .= '<a href="outbox.php?'.$social_link.'">'.
Display::return_icon('back.png', get_lang('Return to outbox')).'</a> &nbsp'; Display::return_icon('back.png', get_lang('Return to outbox')).'</a> &nbsp';
$messageContent .= '<a href="outbox.php?action=deleteone&id='.$messageId.'&'.$social_link.'" >'. $actions .= '<a href="outbox.php?action=deleteone&id='.$messageId.'&'.$social_link.'" >'.
Display::return_icon('delete.png', get_lang('Delete message')).'</a>&nbsp'; Display::return_icon('delete.png', get_lang('Delete message')).'</a>&nbsp';
break; break;
case self::MESSAGE_TYPE_INBOX: case self::MESSAGE_TYPE_INBOX:
$messageContent .= '<a href="inbox.php?'.$social_link.'">'. $actions .= '<a href="inbox.php?'.$social_link.'">'.
Display::return_icon('back.png', get_lang('Return to inbox')).'</a> &nbsp'; Display::return_icon('back.png', get_lang('Return to inbox')).'</a> &nbsp';
$messageContent .= '<a href="new_message.php?re_id='.$messageId.'&'.$social_link.'">'. $actions .= '<a href="new_message.php?re_id='.$messageId.'&'.$social_link.'">'.
Display::return_icon('message_reply.png', get_lang('Reply to this message')).'</a> &nbsp'; Display::return_icon('message_reply.png', get_lang('Reply to this message')).'</a> &nbsp';
$messageContent .= '<a href="inbox.php?action=deleteone&id='.$messageId.'&'.$social_link.'" >'. $actions .= '<a href="inbox.php?action=deleteone&id='.$messageId.'&'.$social_link.'" >'.
Display::return_icon('delete.png', get_lang('DeleteMessage')).'</a>&nbsp;'; Display::return_icon('delete.png', get_lang('DeleteMessage')).'</a>&nbsp;';
if (0 != $idPrevMessage) { if (0 != $idPrevMessage) {
$messageContent .= '<a $actions .= '<a
title="'.get_lang('PrevMessage').'" title="'.get_lang('PrevMessage').'"
href="view_message.php?type='.$type.'&id='.$idPrevMessage.'" ">'. href="view_message.php?type='.$type.'&id='.$idPrevMessage.'" ">'.
Display::return_icon('icons/22/back.png', get_lang('ScormPrevious')).'</a> &nbsp'; Display::return_icon('icons/22/back.png', get_lang('ScormPrevious')).'</a> &nbsp';
} }
if (0 != $idNextMessage) { if (0 != $idNextMessage) {
$messageContent .= '<a $actions .= '<a
title="'.get_lang('NextMessage').'" title="'.get_lang('NextMessage').'"
href="view_message.php?type='.$type.'&id='.$idNextMessage.'">'. href="view_message.php?type='.$type.'&id='.$idNextMessage.'">'.
Display::return_icon('icons/22/move.png', get_lang('ScormNext')).'</a> &nbsp'; Display::return_icon('icons/22/move.png', get_lang('ScormNext')).'</a> &nbsp';
@ -1462,7 +1462,8 @@ class MessageManager
break; break;
} }
$messageContent .= '</div></td> $messageContent .= Display::toolbarAction('toolbar-bottom', [$actions]);
$messageContent .= '</td>
<td width="10"></td> <td width="10"></td>
</tr> </tr>
</table>'; </table>';

@ -327,10 +327,10 @@ class UserGroup extends Model
*/ */
public function returnGrid() public function returnGrid()
{ {
// action links $html = '';
$html = '<div class="actions">'; $actions = '';
if (api_is_platform_admin()) { if (api_is_platform_admin()) {
$html .= '<a href="../admin/index.php">'. $actions .= '<a href="../admin/index.php">'.
Display::return_icon( Display::return_icon(
'back.png', 'back.png',
get_lang('Back to').' '.get_lang('Administration'), get_lang('Back to').' '.get_lang('Administration'),
@ -340,18 +340,18 @@ class UserGroup extends Model
'</a>'; '</a>';
} }
$html .= '<a href="'.api_get_self().'?action=add">'. $actions .= '<a href="'.api_get_self().'?action=add">'.
Display::return_icon('new_class.png', get_lang('Add classes'), '', ICON_SIZE_MEDIUM). Display::return_icon('new_class.png', get_lang('Add classes'), '', ICON_SIZE_MEDIUM).
'</a>'; '</a>';
$html .= Display::url( $actions .= Display::url(
Display::return_icon('import_csv.png', get_lang('Import'), [], ICON_SIZE_MEDIUM), Display::return_icon('import_csv.png', get_lang('Import'), [], ICON_SIZE_MEDIUM),
'usergroup_import.php' 'usergroup_import.php'
); );
$html .= Display::url( $actions .= Display::url(
Display::return_icon('export_csv.png', get_lang('Export'), [], ICON_SIZE_MEDIUM), Display::return_icon('export_csv.png', get_lang('Export'), [], ICON_SIZE_MEDIUM),
'usergroup_export.php' 'usergroup_export.php'
); );
$html .= '</div>'; $html .= Display::toolbarAction('toolbar', [$actions]);
$html .= Display::grid_html('usergroups'); $html .= Display::grid_html('usergroups');
return $html; return $html;

@ -286,10 +286,9 @@ if (api_is_multiple_url_enabled()) {
$result = Database::query($sql); $result = Database::query($sql);
$Sessions = Database::store_result($result); $Sessions = Database::store_result($result);
echo '<div class="actions">'; $actions = '<a href="../session/session_list.php">'.
echo '<a href="../session/session_list.php">'.
Display::return_icon('back.png', get_lang('Back to').' '.get_lang('Session list'), '', ICON_SIZE_MEDIUM).'</a>'; Display::return_icon('back.png', get_lang('Back to').' '.get_lang('Session list'), '', ICON_SIZE_MEDIUM).'</a>';
echo '</div>'; echo Display::toolbarAction('toolbar', [$actions]);
if (!empty($errorMsg)) { if (!empty($errorMsg)) {
echo Display::return_message($errorMsg, 'normal', false); //main API echo Display::return_message($errorMsg, 'normal', false); //main API

@ -19,13 +19,12 @@ set_time_limit(0);
$inserted_in_course = []; $inserted_in_course = [];
// Display the header.
Display::display_header($tool_name); Display::display_header($tool_name);
echo '<div class="actions">'; $actions = '<a href="../session/session_list.php">'.
echo '<a href="../session/session_list.php">'.
Display::return_icon('back.png', get_lang('Back to').' '.get_lang('Administration'), '', ICON_SIZE_MEDIUM).'</a>'; Display::return_icon('back.png', get_lang('Back to').' '.get_lang('Administration'), '', ICON_SIZE_MEDIUM).'</a>';
echo '</div>';
echo Display::toolbarAction('toolbar', [$actions]);
if (!empty($error_message)) { if (!empty($error_message)) {
echo Display::return_message($error_message, 'normal', false); echo Display::return_message($error_message, 'normal', false);

@ -386,11 +386,7 @@ if (api_is_platform_admin()) {
$actionsRight .= $form->returnForm().'</div>'; $actionsRight .= $form->returnForm().'</div>';
} }
echo Display::toolbarAction( echo Display::toolbarAction('toolbar', [$actionsLeft, $actionsRight]);
'toolbar',
[$actionsLeft, $actionsRight]
);
echo SessionManager::getSessionListTabs($listType); echo SessionManager::getSessionListTabs($listType);
echo '<div id="session-table" class="table-responsive">'; echo '<div id="session-table" class="table-responsive">';
echo Display::grid_html('sessions'); echo Display::grid_html('sessions');

Loading…
Cancel
Save