diff options
author | Maurício Meneghini Fauth <mauricio@fauth.dev> | 2019-09-03 18:15:59 +0300 |
---|---|---|
committer | Maurício Meneghini Fauth <mauricio@fauth.dev> | 2019-09-03 18:15:59 +0300 |
commit | fc606d27460df0c6c2e575414175b0ad7eeb1940 (patch) | |
tree | 5bfd7bddb5eda140e8059ce29d7c05f64e783b66 /libraries/classes/SqlQueryForm.php | |
parent | 53ce1d256c3ea64d6614596819fdf8745f1eb62d (diff) |
Extract HTML from SqlQueryForm::getHtmlForBookmark
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
Diffstat (limited to 'libraries/classes/SqlQueryForm.php')
-rw-r--r-- | libraries/classes/SqlQueryForm.php | 53 |
1 files changed, 10 insertions, 43 deletions
diff --git a/libraries/classes/SqlQueryForm.php b/libraries/classes/SqlQueryForm.php index 30241df3be..fd2e108c14 100644 --- a/libraries/classes/SqlQueryForm.php +++ b/libraries/classes/SqlQueryForm.php @@ -226,51 +226,18 @@ class SqlQueryForm return null; } - $html = '<fieldset id="fieldsetBookmarkOptions">'; - $html .= '<legend>'; - $html .= __('Bookmarked SQL query') . '</legend>' . "\n"; - $html .= '<div class="formelement">'; - $html .= '<select name="id_bookmark" id="id_bookmark">' . "\n"; - $html .= '<option value=""> </option>' . "\n"; + $bookmarks = []; foreach ($bookmark_list as $bookmark) { - $html .= '<option value="' . htmlspecialchars((string) $bookmark->getId()) . '"' - . ' data-varcount="' . $bookmark->getVariableCount() - . '">' - . htmlspecialchars($bookmark->getLabel()) - . (empty($bookmark->getUser()) ? (' (' . __('shared') . ')') : '') - . '</option>' . "\n"; + $bookmarks[] = [ + 'id' => $bookmark->getId(), + 'variable_count' => $bookmark->getVariableCount(), + 'label' => $bookmark->getLabel(), + 'is_shared' => empty($bookmark->getUser()), + ]; } - // is required for correct display with styles/line height - $html .= '</select> ' . "\n"; - $html .= '</div>' . "\n"; - $html .= '<div class="formelement">' . "\n"; - $html .= '<input type="radio" name="action_bookmark" value="0"' - . ' id="radio_bookmark_exe" checked="checked">' - . '<label for="radio_bookmark_exe">' . __('Submit') - . '</label>' . "\n"; - $html .= '<input type="radio" name="action_bookmark" value="1"' - . ' id="radio_bookmark_view">' - . '<label for="radio_bookmark_view">' . __('View only') - . '</label>' . "\n"; - $html .= '<input type="radio" name="action_bookmark" value="2"' - . ' id="radio_bookmark_del">' - . '<label for="radio_bookmark_del">' . __('Delete') - . '</label>' . "\n"; - $html .= '</div>' . "\n"; - $html .= '<div class="clearfloat"></div>' . "\n"; - $html .= '<div class="formelement hide">' . "\n"; - $html .= __('Variables'); - $html .= Util::showDocu('faq', 'faqbookmark'); - $html .= '<div id="bookmark_variables"></div>'; - $html .= '</div>' . "\n"; - $html .= '</fieldset>' . "\n"; - $html .= '<fieldset id="fieldsetBookmarkOptionsFooter" class="tblFooters">'; - $html .= '<input class="btn btn-primary" type="submit" name="SQL" id="button_submit_bookmark" value="' - . __('Go') . '">'; - $html .= '<div class="clearfloat"></div>' . "\n"; - $html .= '</fieldset>' . "\n"; - - return $html; + return $this->template->render('sql/query/bookmark', [ + 'bookmarks' => $bookmarks, + ]); } } |