本文整理汇总了PHP中PMA_Util::getCheckbox方法的典型用法代码示例。如果您正苦于以下问题:PHP PMA_Util::getCheckbox方法的具体用法?PHP PMA_Util::getCheckbox怎么用?PHP PMA_Util::getCheckbox使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PMA_Util
的用法示例。
在下文中一共展示了PMA_Util::getCheckbox方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetCheckboxCheckedOnclick
function testGetCheckboxCheckedOnclick()
{
$name = "test_display_html_checkbox";
$label = "text_label_for_checkbox";
$this->assertEquals(
PMA_Util::getCheckbox($name, $label, true, true),
'<input type="checkbox" name="' . $name . '" id="' . $name . '" checked="checked" class="autosubmit" /><label for="' . $name . '">' . $label . '</label>'
);
}
示例2: PMA_getHtmlForAddUser
/**
* Get HTML for addUsersForm, This function call if isset($_REQUEST['adduser'])
*
* @param string $dbname database name
*
* @return string HTML for addUserForm
*/
function PMA_getHtmlForAddUser($dbname)
{
$html_output = '<h2>' . "\n" . PMA_Util::getIcon('b_usradd.png') . __('Add user') . "\n" . '</h2>' . "\n" . '<form name="usersForm" id="addUsersForm"' . ' onsubmit="return checkAddUser(this);"' . ' action="server_privileges.php" method="post" autocomplete="off" >' . "\n" . PMA_URL_getHiddenInputs('', '') . PMA_getHtmlForLoginInformationFields('new');
$html_output .= '<fieldset id="fieldset_add_user_database">' . "\n" . '<legend>' . __('Database for user') . '</legend>' . "\n";
$html_output .= PMA_Util::getCheckbox('createdb-1', __('Create database with same name and grant all privileges.'), false, false, 'createdb-1');
$html_output .= '<br />' . "\n";
$html_output .= PMA_Util::getCheckbox('createdb-2', __('Grant all privileges on wildcard name (username\\_%).'), false, false, 'createdb-2');
$html_output .= '<br />' . "\n";
if (!empty($dbname)) {
$html_output .= PMA_Util::getCheckbox('createdb-3', sprintf(__('Grant all privileges on database "%s".'), htmlspecialchars($dbname)), true, false, 'createdb-3');
$html_output .= '<input type="hidden" name="dbname" value="' . htmlspecialchars($dbname) . '" />' . "\n";
$html_output .= '<br />' . "\n";
}
$html_output .= '</fieldset>' . "\n";
if ($GLOBALS['is_grantuser']) {
$html_output .= PMA_getHtmlToDisplayPrivilegesTable('*', '*', false);
}
$html_output .= '<fieldset id="fieldset_add_user_footer" class="tblFooters">' . "\n" . '<input type="hidden" name="adduser_submit" value="1" />' . "\n" . '<input type="submit" id="adduser_submit" value="' . __('Go') . '" />' . "\n" . '</fieldset>' . "\n" . '</form>' . "\n";
return $html_output;
}
示例3: _getOptionsBlock
/**
* Prepare option fields block
*
* @return string $options_html html content
*
* @access private
*
* @see _getTableHeaders()
*/
private function _getOptionsBlock()
{
$options_html = '';
$options_html .= '<form method="post" action="sql.php" ' . 'name="displayOptionsForm"';
$options_html .= ' class="ajax" ';
$options_html .= '>';
$url_params = array('db' => $this->__get('db'), 'table' => $this->__get('table'), 'sql_query' => $this->__get('sql_query'), 'goto' => $this->__get('goto'), 'display_options_form' => 1);
$options_html .= PMA_URL_getHiddenInputs($url_params) . '<br />' . PMA_Util::getDivForSliderEffect('', __('Options')) . '<fieldset>';
$options_html .= '<div class="formelement">';
$choices = array('P' => __('Partial texts'), 'F' => __('Full texts'));
// pftext means "partial or full texts" (done to reduce line lengths)
$options_html .= PMA_Util::getRadioFields('pftext', $choices, $_SESSION['tmpval']['pftext'], true, true, '', 'pftext_' . $this->__get('unique_id')) . '</div>';
if ($GLOBALS['cfgRelation']['relwork'] && $GLOBALS['cfgRelation']['displaywork']) {
$options_html .= '<div class="formelement">';
$choices = array('K' => __('Relational key'), 'D' => __('Relational display column'));
$options_html .= PMA_Util::getRadioFields('relational_display', $choices, $_SESSION['tmpval']['relational_display'], true, true, '', 'relational_display_' . $this->__get('unique_id')) . '</div>';
}
$options_html .= '<div class="formelement">' . PMA_Util::getCheckbox('display_binary', __('Show binary contents'), !empty($_SESSION['tmpval']['display_binary']), false, 'display_binary_' . $this->__get('unique_id')) . '<br />' . PMA_Util::getCheckbox('display_blob', __('Show BLOB contents'), !empty($_SESSION['tmpval']['display_blob']), false, 'display_blob_' . $this->__get('unique_id')) . '</div>';
// I would have preferred to name this "display_transformation".
// This is the only way I found to be able to keep this setting sticky
// per SQL query, and at the same time have a default that displays
// the transformations.
$options_html .= '<div class="formelement">' . PMA_Util::getCheckbox('hide_transformation', __('Hide browser transformation'), !empty($_SESSION['tmpval']['hide_transformation']), false, 'hide_transformation_' . $this->__get('unique_id')) . '</div>';
if (!PMA_DRIZZLE) {
$options_html .= '<div class="formelement">';
$choices = array('GEOM' => __('Geometry'), 'WKT' => __('Well Known Text'), 'WKB' => __('Well Known Binary'));
$options_html .= PMA_Util::getRadioFields('geoOption', $choices, $_SESSION['tmpval']['geoOption'], true, true, '', 'geoOption_' . $this->__get('unique_id')) . '</div>';
}
$options_html .= '<div class="clearfloat"></div>' . '</fieldset>';
$options_html .= '<fieldset class="tblFooters">' . '<input type="submit" value="' . __('Go') . '" />' . '</fieldset>' . '</div>' . '</form>';
return $options_html;
}
示例4: testPMAGetHtmlForAddUser
/**
* Test for PMA_getHtmlForAddUser
*
* @return void
* @group medium
*/
public function testPMAGetHtmlForAddUser()
{
$dbi_old = $GLOBALS['dbi'];
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')->disableOriginalConstructor()->getMock();
$fields_info = array(array('COLUMN_NAME' => 'Host', 'CHARACTER_MAXIMUM_LENGTH' => 80), array('COLUMN_NAME' => 'User', 'CHARACTER_MAXIMUM_LENGTH' => 40));
$dbi->expects($this->any())->method('fetchResult')->will($this->returnValue($fields_info));
$GLOBALS['dbi'] = $dbi;
$dbname = "pma_dbname";
$html = PMA_getHtmlForAddUser($dbname);
//validate 1: PMA_URL_getHiddenInputs
$this->assertContains(PMA_URL_getHiddenInputs('', ''), $html);
//validate 2: PMA_getHtmlForLoginInformationFields
$this->assertContains(PMA_getHtmlForLoginInformationFields('new'), $html);
//validate 3: Database for user
$this->assertContains(__('Database for user'), $html);
$item = PMA_Util::getCheckbox('createdb-2', __('Grant all privileges on wildcard name (username\\_%).'), false, false, 'createdb-2');
$this->assertContains($item, $html);
//validate 4: PMA_getHtmlToDisplayPrivilegesTable
$this->assertContains(PMA_getHtmlToDisplayPrivilegesTable('*', '*', false), $html);
//validate 5: button
$this->assertContains(__('Go'), $html);
$GLOBALS['dbi'] = $dbi_old;
}
示例5: PMA_getHtmlForAddUser
/**
* Get HTML for addUsersForm, This function call if isset($_REQUEST['adduser'])
*
* @param string $dbname
*
* @return string HTML for addUserForm
*/
function PMA_getHtmlForAddUser($dbname)
{
$GLOBALS['url_query'] .= '&adduser=1';
$html_output = '<h2>' . "\n" . PMA_Util::getIcon('b_usradd.png') . __('Add user') . "\n" . '</h2>' . "\n" . '<form name="usersForm" class="ajax" id="addUsersForm"' . ' action="server_privileges.php" method="post">' . "\n" . PMA_generate_common_hidden_inputs('', '') . PMA_getHtmlForDisplayLoginInformationFields('new');
$html_output .= '<fieldset id="fieldset_add_user_database">' . "\n" . '<legend>' . __('Database for user') . '</legend>' . "\n";
$html_output .= PMA_Util::getCheckbox('createdb-1', __('Create database with same name and grant all privileges'), false, false);
$html_output .= '<br />' . "\n";
$html_output .= PMA_Util::getCheckbox('createdb-2', __('Grant all privileges on wildcard name (username\\_%)'), false, false);
$html_output .= '<br />' . "\n";
if (!empty($dbname)) {
$html_output .= PMA_Util::getCheckbox('createdb-3', sprintf(__('Grant all privileges on database "%s"'), htmlspecialchars($dbname)), true, false);
$html_output .= '<input type="hidden" name="dbname" value="' . htmlspecialchars($dbname) . '" />' . "\n";
$html_output .= '<br />' . "\n";
}
$html_output .= '</fieldset>' . "\n";
$html_output .= PMA_getHtmlToDisplayPrivilegesTable('*', '*', false);
$html_output .= '<fieldset id="fieldset_add_user_footer" class="tblFooters">' . "\n" . '<input type="submit" name="adduser_submit" ' . 'value="' . __('Go') . '" />' . "\n" . '</fieldset>' . "\n" . '</form>' . "\n";
return $html_output;
}
示例6: _getSearchAndReplaceHTML
/**
* Displays the 'Find and Replace' form
*
* @return string HTML for 'Find and Replace' form
*/
function _getSearchAndReplaceHTML()
{
$htmlOutput = __('Find:') . '<input type="text" value="" name="find" required />';
$htmlOutput .= __('Replace with:') . '<input type="text" value="" name="replaceWith" required />';
$htmlOutput .= __('Column:') . '<select name="columnIndex">';
for ($i = 0, $nb = count($this->_columnNames); $i < $nb; $i++) {
$type = preg_replace('@\\(.*@s', '', $this->_columnTypes[$i]);
if ($GLOBALS['PMA_Types']->getTypeClass($type) == 'CHAR') {
$column = $this->_columnNames[$i];
$htmlOutput .= '<option value="' . $i . '">' . htmlspecialchars($column) . '</option>';
}
}
$htmlOutput .= '</select>';
$htmlOutput .= '<br>' . PMA_Util::getCheckbox('useRegex', __('Use regular expression'), false, false);
return $htmlOutput;
}
示例7: testPMAGetHtmlForAddUser
/**
* Test for PMA_getHtmlForAddUser
*
* @return void
*/
public function testPMAGetHtmlForAddUser()
{
$dbi_old = $GLOBALS['dbi'];
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
->disableOriginalConstructor()
->getMock();
$fields_info = array(
"Host" => array(
"Field" => "host",
"Type" => "char(60)",
"Null" => "NO",
)
);
$dbi->expects($this->any())->method('getColumns')
->will($this->returnValue($fields_info));
$GLOBALS['dbi'] = $dbi;
$dbname = "pma_dbname";
$html = PMA_getHtmlForAddUser($dbname);
//validate 1: PMA_URL_getHiddenInputs
$this->assertContains(
PMA_URL_getHiddenInputs('', ''),
$html
);
//validate 2: PMA_getHtmlForDisplayLoginInformationFields
$this->assertContains(
PMA_getHtmlForDisplayLoginInformationFields('new'),
$html
);
//validate 3: Database for user
$this->assertContains(
__('Database for user'),
$html
);
$item = PMA_Util::getCheckbox(
'createdb-2',
__('Grant all privileges on wildcard name (username\\_%).'),
false, false
);
$this->assertContains(
$item,
$html
);
//validate 4: PMA_getHtmlToDisplayPrivilegesTable
$this->assertContains(
PMA_getHtmlToDisplayPrivilegesTable('*', '*', false),
$html
);
//validate 5: button
$this->assertContains(
__('Go'),
$html
);
$GLOBALS['dbi'] = $dbi_old;
}