本文整理汇总了PHP中HTML_Common::HTML_Common方法的典型用法代码示例。如果您正苦于以下问题:PHP HTML_Common::HTML_Common方法的具体用法?PHP HTML_Common::HTML_Common怎么用?PHP HTML_Common::HTML_Common使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTML_Common
的用法示例。
在下文中一共展示了HTML_Common::HTML_Common方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: MyQuickForm
function MyQuickForm($formName = '', $method = 'post', $action = '', $target = '', $attributes = null, $trackSubmit = false)
{
HTML_Common::HTML_Common($attributes);
$method = strtoupper($method) == 'GET' ? 'get' : 'post';
$action = $action == '' ? $_SERVER['PHP_SELF'] : $action;
$target = empty($target) ? array() : array('target' => $target);
$attributes = array('action' => $action, 'method' => $method, 'name' => $formName, 'id' => $formName) + $target;
$this->_trackSubmit = $trackSubmit;
$this->updateAttributes($attributes);
$this->initRequest();
if (preg_match('/^([0-9]+)([a-zA-Z]*)$/', ini_get('upload_max_filesize'), $matches)) {
// see http://www.php.net/manual/en/faq.using.php#faq.using.shorthandbytes
switch (strtoupper($matches['2'])) {
case 'G':
$this->_maxFileSize = $matches['1'] * 1073741824;
break;
case 'M':
$this->_maxFileSize = $matches['1'] * 1048576;
break;
case 'K':
$this->_maxFileSize = $matches['1'] * 1024;
break;
default:
$this->_maxFileSize = $matches['1'];
}
}
}
示例2: HTML_Table
/**
* Class constructor
* @param array $attributes Associative array of table tag attributes
* @param int $tabOffset
* @access public
*/
function HTML_Table($attributes = null, $tabOffset = 0)
{
$commonVersion = 1.7;
if (HTML_Common::apiVersion() < $commonVersion) {
return PEAR::raiseError("HTML_Table version " . $this->apiVersion() . " requires " . "HTML_Common version {$commonVersion} or greater.", 0, PEAR_ERROR_TRIGGER);
}
HTML_Common::HTML_Common($attributes, $tabOffset);
}
示例3: HTML_QuickForm_element
/**
* Class constructor
*
* @param string Name of the element
* @param mixed Label(s) for the element
* @param mixed Associative array of tag attributes or HTML attributes name="value" pairs
* @since 1.0
* @access public
* @return void
*/
function HTML_QuickForm_element($elementName = null, $elementLabel = null, $attributes = null)
{
HTML_Common::HTML_Common($attributes);
if (isset($elementName)) {
$this->setName($elementName);
}
if (isset($elementLabel)) {
$this->setLabel($elementLabel);
}
}
示例4: HTML_Select
/**
* Class constructor
*
* @param string $name (optional)Name attribute of the SELECT
* @param int $size (optional) Size attribute of the SELECT
* @param bool $multiple (optional)Whether the select will allow multiple
* selections or not
* @param mixed $attributes (optional)Either a typical HTML attribute string
* or an associative array
* @param int $tabOffset (optional)Number of tabs to offset HTML source
* @since 1.0
* @access public
* @return void
* @throws
*/
function HTML_Select($name = '', $size = 1, $multiple = false, $attributes = null, $tabOffset = 0)
{
HTML_Common::HTML_Common($attributes, $tabOffset);
$attr = array('name' => $name, 'size' => $size);
if ($multiple) {
$attr['multiple'] = 'multiple';
}
$this->updateAttributes($attr);
$this->setSelectedValues(array());
}
示例5: ilp_MoodleQuickForm
/**
* Class constructor - same parameters as HTML_QuickForm_DHTMLRulesTableless
* @param string $formName Form's name.
* @param string $method (optional)Form's method defaults to 'POST'
* @param mixed $action (optional)Form's action - string or moodle_url
* @param string $target (optional)Form's target defaults to none
* @param mixed $attributes (optional)Extra attributes for <form> tag
* @param bool $trackSubmit (optional)Whether to track if the form was submitted by adding a special hidden field
* @access public
*/
function ilp_MoodleQuickForm($formName, $method, $action, $target = '', $attributes = array())
{
global $CFG, $OUTPUT;
static $formcounter = 1;
HTML_Common::HTML_Common($attributes);
$target = empty($target) ? array() : array('target' => $target);
$this->_formName = $formName;
if (is_a($action, 'moodle_url')) {
$this->_pageparams = $action->hidden_params_out();
$action = $action->out(true);
} else {
$this->_pageparams = '';
}
//no 'name' atttribute for form in xhtml strict :
$attributes['action'] = $action;
$attributes['method'] = $method;
$attributes['accept-charset'] = 'utf-8';
$attributes['id'] = empty($attributes['id']) ? 'mform' . $formcounter : $attributes['id'];
$attributes += $target;
//
// array('action'=>$action, 'method'=>$method,
// 'accept-charset'=>'utf-8', 'id'=>'mform'.$formcounter) + $target;
$formcounter++;
$this->updateAttributes($attributes);
//this is custom stuff for Moodle :
$oldclass = $this->getAttribute('class');
if (!empty($oldclass)) {
$this->updateAttributes(array('class' => $oldclass . ' mform'));
} else {
$this->updateAttributes(array('class' => 'mform'));
}
$this->_reqHTML = '<img class="req" title="' . get_string('requiredelement', 'form') . '" alt="' . get_string('requiredelement', 'form') . '" src="' . $OUTPUT->pix_url('req') . '" />';
$this->_advancedHTML = '<img class="adv" title="' . get_string('advancedelement', 'form') . '" alt="' . get_string('advancedelement', 'form') . '" src="' . $OUTPUT->pix_url('adv') . '" />';
$this->setRequiredNote(get_string('somefieldsrequired', 'form', '<img alt="' . get_string('requiredelement', 'form') . '" src="' . $OUTPUT->pix_url('req') . '" />'));
//(Help file doesn't add anything) helpbutton('requiredelement', get_string('requiredelement', 'form'), 'moodle', true, false, '', true));
}
示例6: MoodleQuickForm
/**
* Class constructor - same parameters as HTML_QuickForm_DHTMLRulesTableless
*
* @staticvar int $formcounter counts number of forms
* @param string $formName Form's name.
* @param string $method Form's method defaults to 'POST'
* @param string|moodle_url $action Form's action
* @param string $target (optional)Form's target defaults to none
* @param mixed $attributes (optional)Extra attributes for <form> tag
*/
function MoodleQuickForm($formName, $method, $action, $target = '', $attributes = null)
{
global $CFG, $OUTPUT;
static $formcounter = 1;
HTML_Common::HTML_Common($attributes);
$target = empty($target) ? array() : array('target' => $target);
$this->_formName = $formName;
if (is_a($action, 'moodle_url')) {
$this->_pageparams = html_writer::input_hidden_params($action);
$action = $action->out_omit_querystring();
} else {
$this->_pageparams = '';
}
// No 'name' atttribute for form in xhtml strict :
$attributes = array('action' => $action, 'method' => $method, 'accept-charset' => 'utf-8') + $target;
if (is_null($this->getAttribute('id'))) {
$attributes['id'] = 'mform' . $formcounter;
}
$formcounter++;
$this->updateAttributes($attributes);
// This is custom stuff for Moodle :
$oldclass = $this->getAttribute('class');
if (!empty($oldclass)) {
$this->updateAttributes(array('class' => $oldclass . ' mform'));
} else {
$this->updateAttributes(array('class' => 'mform'));
}
$this->_reqHTML = '<img class="req" title="' . get_string('requiredelement', 'form') . '" alt="' . get_string('requiredelement', 'form') . '" src="' . $OUTPUT->pix_url('req') . '" />';
$this->_advancedHTML = '<img class="adv" title="' . get_string('advancedelement', 'form') . '" alt="' . get_string('advancedelement', 'form') . '" src="' . $OUTPUT->pix_url('adv') . '" />';
$this->setRequiredNote(get_string('somefieldsrequired', 'form', '<img alt="' . get_string('requiredelement', 'form') . '" src="' . $OUTPUT->pix_url('req') . '" />'));
}
示例7: HTML_QuickForm
/**
* Class constructor
* @param string $formName Form's name.
* @param string $method (optional)Form's method defaults to 'POST'
* @param string $action (optional)Form's action
* @param string $target (optional)Form's target defaults to '_self'
* @param mixed $attributes (optional)Extra attributes for <form> tag
* @param bool $trackSubmit (optional)Whether to track if the form was submitted by adding a special hidden field
* @access public
*/
function HTML_QuickForm($formName = '', $method = 'post', $action = '', $target = '', $attributes = null, $trackSubmit = false)
{
HTML_Common::HTML_Common($attributes);
$method = strtoupper($method) == 'GET' ? 'get' : 'post';
$action = CRM_Utils_System::postURL($action);
// $action = ($action == '') ? $_SERVER['PHP_SELF'] : $action;
$target = empty($target) ? array() : array('target' => $target);
$attributes = array('action' => $action, 'method' => $method, 'name' => $formName, 'id' => $formName) + $target;
$this->updateAttributes($attributes);
if (!$trackSubmit || isset($_REQUEST['_qf__' . $formName])) {
if (1 == get_magic_quotes_gpc()) {
$this->_submitValues = $this->_recursiveFilter('stripslashes', 'get' == $method ? $_GET : $_POST);
foreach ($_FILES as $keyFirst => $valFirst) {
foreach ($valFirst as $keySecond => $valSecond) {
if ('name' == $keySecond) {
$this->_submitFiles[$keyFirst][$keySecond] = $this->_recursiveFilter('stripslashes', $valSecond);
} else {
$this->_submitFiles[$keyFirst][$keySecond] = $valSecond;
}
}
}
} else {
$this->_submitValues = 'get' == $method ? $_GET : $_POST;
$this->_submitFiles = $_FILES;
}
$this->_flagSubmitted = count($this->_submitValues) > 0 || count($this->_submitFiles) > 0;
}
if ($trackSubmit) {
unset($this->_submitValues['_qf__' . $formName]);
$this->addElement('hidden', '_qf__' . $formName, null);
}
if (preg_match('/^([0-9]+)([a-zA-Z]*)$/', ini_get('upload_max_filesize'), $matches)) {
// see http://www.php.net/manual/en/faq.using.php#faq.using.shorthandbytes
switch (strtoupper($matches['2'])) {
case 'G':
$this->_maxFileSize = $matches['1'] * 1073741824;
break;
case 'M':
$this->_maxFileSize = $matches['1'] * 1048576;
break;
case 'K':
$this->_maxFileSize = $matches['1'] * 1024;
break;
default:
$this->_maxFileSize = $matches['1'];
}
}
}
示例8: __construct
/**
* Class constructor
* @param string $formName Form's name.
* @param string $method (optional)Form's method defaults to 'POST'
* @param string $action (optional)Form's action
* @param string $target (optional)Form's target defaults to '_self'
* @param mixed $attributes (optional)Extra attributes for <form> tag
* @param bool $trackSubmit (optional)Whether to track if the form was submitted by adding a special hidden field
* @access public
*/
public function __construct($formName = '', $method = 'post', $action = '', $target = '', $attributes = null, $trackSubmit = false)
{
HTML_Common::HTML_Common($attributes);
$method = strtoupper($method) == 'GET' ? 'get' : 'post';
// Modified by Chamilo team, 16-MAR-2010
//$action = ($action == '') ? $_SERVER['PHP_SELF'] : $action;
$action = $action == '' ? api_get_self() : $action;
//
$target = empty($target) ? array() : array('target' => $target);
$form_id = $formName;
if (isset($attributes['id']) && !empty($attributes['id'])) {
$form_id = Security::remove_XSS($attributes['id']);
}
$attributes = array('action' => $action, 'method' => $method, 'name' => $formName, 'id' => $form_id) + $target;
$this->updateAttributes($attributes);
if (!$trackSubmit || isset($_REQUEST['_qf__' . $formName])) {
if (1 == get_magic_quotes_gpc()) {
$this->_submitValues = $this->_recursiveFilter('stripslashes', 'get' == $method ? $_GET : $_POST);
foreach ($_FILES as $keyFirst => $valFirst) {
foreach ($valFirst as $keySecond => $valSecond) {
if ('name' == $keySecond) {
$this->_submitFiles[$keyFirst][$keySecond] = $this->_recursiveFilter('stripslashes', $valSecond);
} else {
$this->_submitFiles[$keyFirst][$keySecond] = $valSecond;
}
}
}
} else {
$this->_submitValues = 'get' == $method ? $_GET : $_POST;
$this->_submitFiles = $_FILES;
}
$this->_flagSubmitted = count($this->_submitValues) > 0 || count($this->_submitFiles) > 0;
}
if ($trackSubmit) {
unset($this->_submitValues['_qf__' . $formName]);
$this->addElement('hidden', '_qf__' . $formName, null);
}
if (preg_match('/^([0-9]+)([a-zA-Z]*)$/', ini_get('upload_max_filesize'), $matches)) {
// see http://www.php.net/manual/en/faq.using.php#faq.using.shorthandbytes
switch (strtoupper($matches['2'])) {
case 'G':
$this->_maxFileSize = $matches['1'] * 1073741824;
break;
case 'M':
$this->_maxFileSize = $matches['1'] * 1048576;
break;
case 'K':
$this->_maxFileSize = $matches['1'] * 1024;
break;
default:
$this->_maxFileSize = $matches['1'];
}
}
$course_id = api_get_course_int_id();
//If I'm in a course replace the default max filesize with the course limits
if (!empty($course_id)) {
$free_course_quota = DocumentManager::get_course_quota() - DocumentManager::documents_total_space();
if (empty($this->_maxFileSize) || $free_course_quota <= $this->_maxFileSize) {
$this->_maxFileSize = intval($free_course_quota);
}
}
}
示例9: __construct
/**
* Class constructor
*
* @param int $tabOffset
* @param bool $useTGroups Whether to use <thead>, <tfoot> and
* <tbody> or not
* @access public
*/
function __construct($tabOffset = 0, $useTGroups = false)
{
HTML_Common::HTML_Common(null, (int) $tabOffset);
$this->_useTGroups = (bool) $useTGroups;
}
示例10: HTML_QuickForm_element
/**
* Class constructor
*
* @param string Name of the element
* @param mixed Label(s) for the element
* @param mixed Associative array of tag attributes or HTML attributes name="value" pairs
* @since 1.0
* @access public
* @return void
*/
function HTML_QuickForm_element($elementName = null, $elementLabel = null, $attributes = null)
{
$array = array('text', 'textarea', 'select', 'static', 'password', 'group');
if (in_array($this->getType(), $array)) {
if (empty($attributes)) {
$attributes = array('class' => 'form-control ');
} else {
if (is_array($attributes)) {
$defaultClass = isset($attributes['class']) ? $attributes['class'] : null;
$attributes['class'] = 'form-control ' . $defaultClass;
}
}
}
HTML_Common::HTML_Common($attributes);
if (isset($elementName)) {
$this->setName($elementName);
}
if (isset($elementLabel)) {
$this->setLabel($elementLabel);
}
}
示例11: HTML_QuickForm_element
/**
* Class constructor
*
* @param string Name of the element
* @param mixed Label(s) for the element
* @param mixed Associative array of tag attributes or HTML attributes name="value" pairs
* @since 1.0
* @access public
* @return void
*/
function HTML_QuickForm_element($elementName = null, $elementLabel = null, $attributes = null)
{
HTML_Common::HTML_Common($attributes);
if (isset($elementName)) {
$this->setName($elementName);
}
if (isset($elementLabel)) {
$labelFor = "";
//Default Inputs generate this
if (!empty($attributes['id'])) {
$labelFor = $attributes['id'];
}
//Default Labels generate this
if (!empty($attributes['for'])) {
$labelFor = $attributes['for'];
}
$this->setLabel($elementLabel, $labelFor);
}
} //end constructor
示例12: HTML_QuickForm
/**
* Class constructor
* @param string $formName Form's name.
* @param string $method (optional)Form's method defaults to 'POST'
* @param string $action (optional)Form's action
* @param string $target (optional)Form's target defaults to '_self'
* @param mixed $attributes (optional)Extra attributes for <form> tag
* @param bool $trackSubmit (optional)Whether to track if the form was submitted by adding a special hidden field
* @access public
*/
function HTML_QuickForm($formName = '', $method = 'post', $action = '', $target = '_self', $attributes = null, $trackSubmit = false)
{
HTML_Common::HTML_Common($attributes);
$method = strtoupper($method) == 'GET' ? 'get' : 'post';
$action = $action == '' ? $_SERVER['PHP_SELF'] : $action;
$target = empty($target) || $target == '_self' ? array() : array('target' => $target);
$attributes = array('action' => $action, 'method' => $method, 'name' => $formName, 'id' => $formName) + $target;
$this->updateAttributes($attributes);
if (!$trackSubmit || isset($_REQUEST['_qf__' . $formName])) {
if (1 == get_magic_quotes_gpc()) {
$this->_submitValues = $this->_recursiveFilter('stripslashes', 'get' == $method ? $_GET : $_POST);
foreach ($_FILES as $keyFirst => $valFirst) {
foreach ($valFirst as $keySecond => $valSecond) {
if ('name' == $keySecond) {
$this->_submitFiles[$keyFirst][$keySecond] = $this->_recursiveFilter('stripslashes', $valSecond);
} else {
$this->_submitFiles[$keyFirst][$keySecond] = $valSecond;
}
}
}
} else {
$this->_submitValues = 'get' == $method ? $_GET : $_POST;
$this->_submitFiles = $_FILES;
}
}
if ($trackSubmit) {
unset($this->_submitValues['_qf__' . $formName]);
$this->addElement('hidden', '_qf__' . $formName, null);
}
}
示例13: HTML_Table
/**
* Class constructor
* @param array $attributes Associative array of table tag
* attributes
* @param int $tabOffset Tab offset of the table
* @param bool $useTGroups Whether to use <thead>, <tfoot> and
* <tbody> or not
* @access public
*/
public function HTML_Table($attributes = null, $tabOffset = 0, $useTGroups = false)
{
HTML_Common::HTML_Common($attributes, (int) $tabOffset);
$this->_useTGroups = (bool) $useTGroups;
$this->addBody();
if ($this->_useTGroups) {
$this->_thead =& new HTML_Table_Storage($tabOffset, $this->_useTGroups);
$this->_tfoot =& new HTML_Table_Storage($tabOffset, $this->_useTGroups);
}
}
示例14: HTML_QuickForm
/**
* Class constructor
* @param string $formName Form's name.
* @param string $method (optional)Form's method defaults to 'POST'
* @param string $action (optional)Form's action
* @param string $target (optional)Form's target defaults to '_self'
* @param mixed $attributes (optional)Extra attributes for <form> tag
* @param bool $trackSubmit (optional)Whether to track if the form was submitted by adding a special hidden field
* @access public
*/
function HTML_QuickForm($formName = '', $method = 'post', $action = '', $target = '', $attributes = null, $trackSubmit = false)
{
HTML_Common::HTML_Common($attributes);
$method = strtoupper($method) == 'GET' ? 'get' : 'post';
$action = $action == '' ? $_SERVER['PHP_SELF'] : $action;
$target = empty($target) ? array() : array('target' => $target);
$attributes = array('action' => $action, 'method' => $method, 'name' => $formName, 'id' => $formName) + $target;
$this->updateAttributes($attributes);
if (!$trackSubmit || isset($_REQUEST['_qf__' . $formName])) {
$this->_setSubmitValues('get' == $method ? $_GET : $_POST, $_FILES);
}
if ($trackSubmit) {
unset($this->_submitValues['_qf__' . $formName]);
$this->addElement('hidden', '_qf__' . $formName, null);
}
if (preg_match('/^([0-9]+)([a-zA-Z]*)$/', ini_get('upload_max_filesize'), $matches)) {
// see http://www.php.net/manual/en/faq.using.php#faq.using.shorthandbytes
switch (strtoupper($matches['2'])) {
case 'G':
$this->_maxFileSize = $matches['1'] * 1073741824;
break;
case 'M':
$this->_maxFileSize = $matches['1'] * 1048576;
break;
case 'K':
$this->_maxFileSize = $matches['1'] * 1024;
break;
default:
$this->_maxFileSize = $matches['1'];
}
}
}
示例15: HTML_Table_Storage
/**
* Class constructor
* @param int $tabOffset
* @param bool $useTGroups Whether to use <thead>, <tfoot> and
* <tbody> or not
* @access public
*/
function HTML_Table_Storage($tabOffset = 0, $useTGroups = false)
{
HTML_Common::HTML_Common(null, (int) $tabOffset);
$this->_useTGroups = (bool) $useTGroups;
}