Fix icons, fix toolbar, fix addSelectFromCollection

pull/3924/head
Julio Montoya 4 years ago
parent f3e3b9846f
commit 91b45bfed3
  1. 2
      public/main/admin/skill.php
  2. 8
      public/main/inc/lib/pear/HTML/QuickForm/advmultiselect.php
  3. 59
      public/main/survey/surveyUtil.class.php

@ -34,7 +34,7 @@ if (!empty($id)) {
} }
$form = new FormValidator('Skill', 'GET', api_get_self().'?action='.$action.'&id='.$id); $form = new FormValidator('Skill', 'GET', api_get_self().'?action='.$action.'&id='.$id);
$form->addSelectFromCollection('profile_id', get_lang('Profile'), $profiles, null, true); $form->addSelectFromCollection('profile_id', get_lang('Profile'), $profiles, [], true);
$form->addHidden('action', $action); $form->addHidden('action', $action);
$form->addHidden('id', $id); $form->addHidden('id', $id);
$form->addButtonSave(get_lang('Update')); $form->addButtonSave(get_lang('Update'));

@ -728,24 +728,24 @@ class HTML_QuickForm_advmultiselect extends HTML_QuickForm_select
$this->_removeButtonAttributes $this->_removeButtonAttributes
= array_merge($this->_removeButtonAttributes, $attributes); = array_merge($this->_removeButtonAttributes, $attributes);
$attrStrRemove = $this->_getAttrString($this->_removeButtonAttributes); $attrStrRemove = $this->_getAttrString($this->_removeButtonAttributes);
$strHtmlRemove = "<button $attrStrRemove /> <em class='fa fa-arrow-left'></em></button>"; $strHtmlRemove = "<button $attrStrRemove /> <em class='mdi mdi-chevron-left'></em></button>";
// build the add button with all its attributes // build the add button with all its attributes
$attributes = array('id' => $selectId.'_rightSelected'); $attributes = array('id' => $selectId.'_rightSelected');
$this->_addButtonAttributes = array_merge($this->_addButtonAttributes, $attributes); $this->_addButtonAttributes = array_merge($this->_addButtonAttributes, $attributes);
$attrStrAdd = $this->_getAttrString($this->_addButtonAttributes); $attrStrAdd = $this->_getAttrString($this->_addButtonAttributes);
$strHtmlAdd = "<button $attrStrAdd /> <em class='fa fa-arrow-right'></em></button><br /><br />"; $strHtmlAdd = "<button $attrStrAdd /> <em class='mdi mdi-chevron-right'></em></button><br /><br />";
if ($this->selectAllCheckBox) { if ($this->selectAllCheckBox) {
$attributes = array('id' => $selectId.'_rightAll'); $attributes = array('id' => $selectId.'_rightAll');
$this->_addButtonAttributes = array_merge($this->_addButtonAttributes, $attributes); $this->_addButtonAttributes = array_merge($this->_addButtonAttributes, $attributes);
$attrStrAdd = $this->_getAttrString($this->_addButtonAttributes); $attrStrAdd = $this->_getAttrString($this->_addButtonAttributes);
$rightAll = "<button $attrStrAdd /> <em class='fa fa-forward'></em></button><br /><br />"; $rightAll = "<button $attrStrAdd /> <em class='mdi mdi-chevron-double-right'></em></button><br /><br />";
$attributes = array('id' => $selectId.'_leftAll'); $attributes = array('id' => $selectId.'_leftAll');
$this->_addButtonAttributes = array_merge($this->_addButtonAttributes, $attributes); $this->_addButtonAttributes = array_merge($this->_addButtonAttributes, $attributes);
$attrStrAdd = $this->_getAttrString($this->_addButtonAttributes); $attrStrAdd = $this->_getAttrString($this->_addButtonAttributes);
$leftAll = "<br /><br /><button $attrStrAdd /> <em class='fa fa-backward'></em></button>"; $leftAll = "<br /><br /><button $attrStrAdd /> <em class='mdi mdi-chevron-double-left'></em></button>";
} }
// build the select all button with all its attributes // build the select all button with all its attributes

@ -437,8 +437,7 @@ class SurveyUtil
// Actions bar // Actions bar
if ($addActionBar) { if ($addActionBar) {
echo '<div class="actions">'; $actions = '<a href="'.$reportingUrl.'">'.
echo '<a href="'.$reportingUrl.'">'.
Display::return_icon( Display::return_icon(
'back.png', 'back.png',
get_lang('Back to').' '.get_lang('Reporting overview'), get_lang('Back to').' '.get_lang('Reporting overview'),
@ -449,32 +448,32 @@ class SurveyUtil
if (isset($_GET['user'])) { if (isset($_GET['user'])) {
if (api_is_allowed_to_edit()) { if (api_is_allowed_to_edit()) {
// The delete link // The delete link
echo '<a $actions .= '<a
href="'.$reportingUrl.'&action=deleteuserreport&user='.Security::remove_XSS($_GET['user']).'" >'. href="'.$reportingUrl.'&action=deleteuserreport&user='.Security::remove_XSS($_GET['user']).'" >'.
Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_MEDIUM).'</a>'; Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_MEDIUM).'</a>';
} }
// Export the user report // Export the user report
echo '<a href="javascript: void(0);" onclick="document.form1a.submit();">' $actions .= '<a href="javascript: void(0);" onclick="document.form1a.submit();">'
.Display::return_icon('export_csv.png', get_lang('CSV export'), '', ICON_SIZE_MEDIUM).'</a> '; .Display::return_icon('export_csv.png', get_lang('CSV export'), '', ICON_SIZE_MEDIUM).'</a> ';
echo '<a href="javascript: void(0);" onclick="document.form1b.submit();">' $actions .= '<a href="javascript: void(0);" onclick="document.form1b.submit();">'
.Display::return_icon('export_excel.png', get_lang('Excel export'), '', ICON_SIZE_MEDIUM).'</a> '; .Display::return_icon('export_excel.png', get_lang('Excel export'), '', ICON_SIZE_MEDIUM).'</a> ';
echo '<form id="form1a" name="form1a" method="post" action="'.api_get_self().'?action=' $actions .= '<form id="form1a" name="form1a" method="post" action="'.api_get_self().'?action='
.Security::remove_XSS($_GET['action']).'&survey_id='.$surveyId.'&'.api_get_cidreq().'&user_id=' .Security::remove_XSS($_GET['action']).'&survey_id='.$surveyId.'&'.api_get_cidreq().'&user_id='
.Security::remove_XSS($_GET['user']).'">'; .Security::remove_XSS($_GET['user']).'">';
echo '<input type="hidden" name="export_report" value="export_report">'; $actions .= '<input type="hidden" name="export_report" value="export_report">';
echo '<input type="hidden" name="export_format" value="csv">'; $actions .= '<input type="hidden" name="export_format" value="csv">';
echo '</form>'; $actions .= '</form>';
echo '<form id="form1b" name="form1b" method="post" action="'.api_get_self().'?action=' $actions .= '<form id="form1b" name="form1b" method="post" action="'.api_get_self().'?action='
.Security::remove_XSS($_GET['action']).'&survey_id='.$surveyId.'&'.api_get_cidreq().'&user_id=' .Security::remove_XSS($_GET['action']).'&survey_id='.$surveyId.'&'.api_get_cidreq().'&user_id='
.Security::remove_XSS($_GET['user']).'">'; .Security::remove_XSS($_GET['user']).'">';
echo '<input type="hidden" name="export_report" value="export_report">'; $actions .= '<input type="hidden" name="export_report" value="export_report">';
echo '<input type="hidden" name="export_format" value="xls">'; $actions .= '<input type="hidden" name="export_format" value="xls">';
echo '</form>'; $actions .= '</form>';
echo '<form id="form2" name="form2" method="post" action="'.api_get_self().'?action=' $actions .= '<form id="form2" name="form2" method="post" action="'.api_get_self().'?action='
.Security::remove_XSS($_GET['action']).'&survey_id='.$surveyId.'&'.api_get_cidreq().'">'; .Security::remove_XSS($_GET['action']).'&survey_id='.$surveyId.'&'.api_get_cidreq().'">';
} }
echo '</div>'; echo Display::toolbarAction('survey', [$actions]);
} }
echo self::displayUserReportForm($survey, $people_filled); echo self::displayUserReportForm($survey, $people_filled);
@ -515,8 +514,7 @@ class SurveyUtil
$table_survey_question_option = Database::get_course_table(TABLE_SURVEY_QUESTION_OPTION); $table_survey_question_option = Database::get_course_table(TABLE_SURVEY_QUESTION_OPTION);
$table_survey_answer = Database::get_course_table(TABLE_SURVEY_ANSWER); $table_survey_answer = Database::get_course_table(TABLE_SURVEY_ANSWER);
echo '<div class="actions">'; $actions = '<a
echo '<a
href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?survey_id='.$surveyId.'&'.api_get_cidreq().'">'. href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?survey_id='.$surveyId.'&'.api_get_cidreq().'">'.
Display::return_icon( Display::return_icon(
'back.png', 'back.png',
@ -524,7 +522,7 @@ class SurveyUtil
'', '',
ICON_SIZE_MEDIUM ICON_SIZE_MEDIUM
).'</a>'; ).'</a>';
echo Display::url( $actions .= Display::url(
Display::return_icon( Display::return_icon(
'pdf.png', 'pdf.png',
get_lang('ExportToPdf'), get_lang('ExportToPdf'),
@ -534,7 +532,9 @@ class SurveyUtil
'javascript: void(0);', 'javascript: void(0);',
['onclick' => 'exportToPdf();'] ['onclick' => 'exportToPdf();']
); );
echo '</div>';
echo Display::toolbarAction('survey', [$actions]);
$fromUntil = sprintf( $fromUntil = sprintf(
get_lang('FromXUntilY'), get_lang('FromXUntilY'),
api_get_local_time($survey->getAvailFrom()), api_get_local_time($survey->getAvailFrom()),
@ -957,8 +957,7 @@ class SurveyUtil
$action = isset($_GET['action']) ? Security::remove_XSS($_GET['action']) : ''; $action = isset($_GET['action']) ? Security::remove_XSS($_GET['action']) : '';
$content = ''; $content = '';
if ($addActionBar) { if ($addActionBar) {
$content .= '<div class="actions">'; $actions = '<a
$content .= '<a
href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?survey_id='.$surveyId.'&'.api_get_cidreq().'">' href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?survey_id='.$surveyId.'&'.api_get_cidreq().'">'
.Display::return_icon( .Display::return_icon(
'back.png', 'back.png',
@ -967,17 +966,18 @@ class SurveyUtil
ICON_SIZE_MEDIUM ICON_SIZE_MEDIUM
) )
.'</a>'; .'</a>';
$content .= '<a class="survey_export_link" href="javascript: void(0);" onclick="document.form1a.submit();">' $actions .= '<a class="survey_export_link" href="javascript: void(0);" onclick="document.form1a.submit();">'
.Display::return_icon('export_csv.png', get_lang('CSV export'), '', ICON_SIZE_MEDIUM).'</a>'; .Display::return_icon('export_csv.png', get_lang('CSV export'), '', ICON_SIZE_MEDIUM).'</a>';
$content .= '<a class="survey_export_link" href="javascript: void(0);" onclick="document.form1b.submit();">' $actions .= '<a class="survey_export_link" href="javascript: void(0);" onclick="document.form1b.submit();">'
.Display::return_icon('export_excel.png', get_lang('Excel export'), '', ICON_SIZE_MEDIUM).'</a>'; .Display::return_icon('export_excel.png', get_lang('Excel export'), '', ICON_SIZE_MEDIUM).'</a>';
$content .= '<a class="survey_export_link" href="javascript: void(0);" onclick="document.form1c.submit();">' $actions .= '<a class="survey_export_link" href="javascript: void(0);" onclick="document.form1c.submit();">'
.Display::return_icon('export_compact_csv.png', get_lang('ExportAsCompactCSV'), '', ICON_SIZE_MEDIUM).'</a>'; .Display::return_icon('export_compact_csv.png', get_lang('ExportAsCompactCSV'), '', ICON_SIZE_MEDIUM).'</a>';
$content .= '</div>';
$content .= Display::toolbarAction('survey', [$actions]);
// The form // The form
$content .= '<form id="form1a" name="form1a" method="post" action="'.api_get_self( $content .= '<form
).'?action='.$action.'&survey_id=' id="form1a" name="form1a" method="post" action="'.api_get_self().'?action='.$action.'&survey_id='
.$surveyId.'&'.api_get_cidreq().'">'; .$surveyId.'&'.api_get_cidreq().'">';
$content .= '<input type="hidden" name="export_report" value="export_report">'; $content .= '<input type="hidden" name="export_report" value="export_report">';
$content .= '<input type="hidden" name="export_format" value="csv">'; $content .= '<input type="hidden" name="export_format" value="csv">';
@ -1990,8 +1990,7 @@ class SurveyUtil
$questions = SurveyManager::get_questions($surveyId); $questions = SurveyManager::get_questions($surveyId);
// Actions bar // Actions bar
echo '<div class="actions">'; $actions = '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?survey_id='.$surveyId.'&'.api_get_cidreq()
echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?survey_id='.$surveyId.'&'.api_get_cidreq()
.'">' .'">'
.Display::return_icon( .Display::return_icon(
'back.png', 'back.png',
@ -2000,7 +1999,7 @@ class SurveyUtil
ICON_SIZE_MEDIUM ICON_SIZE_MEDIUM
) )
.'</a>'; .'</a>';
echo '</div>'; echo Display::toolbarAction('survey', [$actions]);
// Displaying an information message that only the questions with predefined answers can be used in a comparative report // Displaying an information message that only the questions with predefined answers can be used in a comparative report
echo Display::return_message(get_lang('Only questions with predefined answers can be used'), 'normal', false); echo Display::return_message(get_lang('Only questions with predefined answers can be used'), 'normal', false);

Loading…
Cancel
Save