当前位置: 首页>>代码示例>>PHP>>正文


PHP Pieform::is_submitted方法代码示例

本文整理汇总了PHP中Pieform::is_submitted方法的典型用法代码示例。如果您正苦于以下问题:PHP Pieform::is_submitted方法的具体用法?PHP Pieform::is_submitted怎么用?PHP Pieform::is_submitted使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Pieform的用法示例。


在下文中一共展示了Pieform::is_submitted方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: pieform_element_expiry

/**
 * Provides a duration chooser, with a text box for a number and a
 * select box to choose the units, in days, weeks, months, years, or 'no end date'.
 *
 * @param Pieform $form    The form to render the element for
 * @param array   $element The element to render
 * @return string          The HTML for the element
 */
function pieform_element_expiry(Pieform $form, $element)
{
    /*{{{*/
    $formname = $form->get_name();
    $result = '';
    $name = Pieform::hsc($element['name']);
    if (!isset($element['defaultvalue'])) {
        $element['defaultvalue'] = null;
    }
    $global = $form->get_property('method') == 'get' ? $_GET : $_POST;
    // Get the value of the element for rendering.
    if (isset($element['value'])) {
        $seconds = $element['value'];
        $values = pieform_element_expiry_get_expiry_from_seconds($element['value']);
    } else {
        if ($form->is_submitted() && isset($global[$element['name']]) && isset($global[$element['name'] . '_units'])) {
            $values = array('number' => $global[$element['name']], 'units' => $global[$element['name'] . '_units']);
            $seconds = $values['number'] * pieform_element_expiry_seconds_in($values['units']);
        } else {
            if (isset($element['defaultvalue'])) {
                $seconds = $element['defaultvalue'];
                $values = pieform_element_expiry_get_expiry_from_seconds($seconds);
            } else {
                $values = array('number' => '', 'units' => 'noenddate');
                $seconds = null;
            }
        }
    }
    // @todo probably create with an actual input element, as tabindex doesn't work here for one thing
    // Same with the select. And do the events using mochikit signal instead of dom events
    $numberinput = '<input';
    $numberinput .= $values['units'] == 'noenddate' && empty($element['rules']['required']) ? ' disabled="disabled"' : '';
    $numberinput .= ' type="text" size="4" name="' . $name . '"';
    $numberinput .= ' id="' . $formname . '_' . $name . '" value="' . Pieform::hsc($values['number']) . '" tabindex="' . Pieform::hsc($element['tabindex']) . '"';
    $numberinput .= (isset($element['error']) ? ' class="error"' : '') . ">\n";
    $uselect = '<select onchange="' . $name . '_change()" ';
    $uselect .= 'name="' . $name . '_units" id="' . $formname . '_' . $name . '_units"' . ' tabindex="' . Pieform::hsc($element['tabindex']) . "\">\n";
    foreach (pieform_element_expire_get_expiry_units() as $u) {
        // Don't allow 'no end date' if the element is required
        if ($u == 'noenddate' && !empty($element['rules']['required'])) {
            continue;
        }
        $uselect .= "\t<option value=\"{$u}\"" . ($values['units'] == $u ? ' selected="selected"' : '') . '>' . $form->i18n('element', 'expiry', $u, $element) . "</option>\n";
    }
    $uselect .= "</select>\n";
    // Make sure the input is disabled if "no end date" is selected
    $script = <<<EOJS
<script type="text/javascript" language="javascript">
function {$name}_change() {
    if (\$('{$formname}_{$name}_units').value == 'noenddate') {
        \$('{$formname}_{$name}').disabled = true;
    }
    else {
        \$('{$formname}_{$name}').disabled = false;
    }
}
</script>
EOJS;
    return $numberinput . $uselect . $script;
}
开发者ID:richardmansfield,项目名称:richardms-mahara,代码行数:68,代码来源:expiry.php

示例2: pieform_element_color_get_value

/**
 * Returns the color value of the color selector element from the request or transparent
 *
 * @param Pieform $form    The form the element is attached to
 * @param array   $element The element to get the value for
 * @return string A 6-digit hex color value, or the string "transparent"
 */
function pieform_element_color_get_value(Pieform $form, $element)
{
    $name = $element['name'];
    $global = $form->get_property('method') == 'get' ? $_GET : $_POST;
    if ($form->is_submitted() && isset($global[$name . '_color']) && !isset($global[$name . '_optional'])) {
        $color = $global[$name . '_color'];
        // Whitelist for a 6-digit hex color
        $color = preg_replace('/[^a-f0-9]/i', '', $color);
        if (strlen($color) >= 6) {
            $color = substr($color, 0, 6);
        } else {
            if (strlen($color) >= 3) {
                // If they provided a 3-digit color string, convert it into a 6-digit one by doubling each digit
                $color = substr($color, 0, 3);
                $color = $color[0] . $color[0] . $color[1] . $color[1] . $color[2] . $color[2];
            } else {
                $color = '';
            }
        }
        if ($color === '') {
            return 'transparent';
        }
        $color = "#{$color}";
        return $color;
    }
    return 'transparent';
}
开发者ID:rboyatt,项目名称:mahara,代码行数:34,代码来源:color.php

示例3: pieform_element_hidden_get_value

/**
 * Returns the value for a hidden element. Hidden elements only listen to the
 * 'value' index, and not to GET/POST, unless the 'sesskey' property is set
 * on the element. Or, if the element has the "dynamic" tag set, which indicates
 * that it's a hidden field that is meant to be updated by Javascript.
 */
function pieform_element_hidden_get_value(Pieform $form, $element)
{
    /*{{{*/
    if (!empty($element['dynamic']) || !empty($element['sesskey']) && $form->is_submitted()) {
        return isset($_POST[$element['name']]) ? $_POST[$element['name']] : null;
    }
    return $element['value'];
}
开发者ID:rboyatt,项目名称:mahara,代码行数:14,代码来源:hidden.php

示例4: pieform_element_checkboxes_get_value

function pieform_element_checkboxes_get_value(Pieform $form, $element)
{
    /*{{{*/
    $global = $form->get_property('method') == 'get' ? $_GET : $_POST;
    if (isset($element['value'])) {
        $values = (array) $element['value'];
    } else {
        if ($form->is_submitted() && isset($global[$element['name']])) {
            $values = (array) $global[$element['name']];
        } else {
            if (!$form->is_submitted() && isset($element['defaultvalue'])) {
                $values = (array) $element['defaultvalue'];
            } else {
                $values = array();
            }
        }
    }
    return $values;
}
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:19,代码来源:checkboxes.php

示例5: pieform_element_trafficlights_get_value

function pieform_element_trafficlights_get_value(Pieform $form, $element)
{
    /*{{{*/
    $global = $form->get_property('method') == 'get' ? $_GET : $_POST;
    if (isset($element['value'])) {
        $value = $element['value'];
    } else {
        if ($form->is_submitted() && isset($global[$element['name']])) {
            $value = $global[$element['name']];
        } else {
            if (!$form->is_submitted() && isset($element['defaultvalue'])) {
                $value = $element['defaultvalue'];
            } else {
                $value = null;
            }
        }
    }
    return $value;
}
开发者ID:gbleydon,项目名称:mahara-survey,代码行数:19,代码来源:trafficlights.php

示例6: pieform_element_bytes

/**
 * Provides a size chooser, with a text box for a number and a
 * select box to choose the units, in bytes, kilobytes, megabytes or gigabytes
 *
 * @param Pieform $form    The form to render the element for
 * @param array   $element The element to render
 * @return string          The HTML for the element
 */
function pieform_element_bytes(Pieform $form, $element)
{
    /*{{{*/
    $formname = $form->get_name();
    $result = '';
    $name = Pieform::hsc($element['name']);
    if (!isset($element['defaultvalue'])) {
        $element['defaultvalue'] = null;
    }
    $global = $form->get_property('method') == 'get' ? $_GET : $_POST;
    // Get the value of the element for rendering.
    if (isset($element['value'])) {
        $bytes = $element['value'];
        $values = pieform_element_bytes_get_bytes_from_bytes($element['value']);
    } else {
        if ($form->is_submitted() && isset($global[$element['name']]) && isset($global[$element['name'] . '_units'])) {
            $values = array('number' => $global[$element['name']], 'units' => $global[$element['name'] . '_units']);
            $bytes = $values['number'] * pieform_element_bytes_in($values['units']);
        } else {
            if (isset($element['defaultvalue'])) {
                $bytes = $element['defaultvalue'];
                $values = pieform_element_bytes_get_bytes_from_bytes($bytes);
            } else {
                $values = array('number' => '0', 'units' => 'bytes');
                $bytes = 0;
            }
        }
    }
    // @todo probably create with an actual input element, as tabindex doesn't work here for one thing
    // Same with the select. And do the events using mochikit signal instead of dom events
    $numberinput = '<div class="with-dropdown js-with-dropdown text">';
    $numberinput .= '<label for="' . $formname . '_' . $name . '">' . Pieform::hsc($element['title']) . ': </label><input';
    $numberinput .= ' type="text" size="6" name="' . $name . '"';
    $numberinput .= ' id="' . $formname . '_' . $name . '" value="' . Pieform::hsc($values['number']) . '" tabindex="' . Pieform::hsc($element['tabindex']) . '"';
    $numberinput .= 'class="with-dropdown js-with-dropdown form-control text' . (isset($element['error']) ? ' error"' : '') . '"';
    if (isset($element['description'])) {
        $numberinput .= ' aria-describedby="' . $form->element_descriptors($element) . '"';
    }
    $numberinput .= "></div>\n";
    $uselect = '<div class="dropdown-connect js-dropdown-connect select">';
    $uselect .= '<label for="' . $formname . '_' . $name . '_units" class="accessible-hidden sr-only">' . get_string('units') . '</label>';
    $uselect .= '<span class="picker"><select class="form-control dropdown-connect js-dropdown-connect select" name="' . $name . '_units" id="' . $formname . '_' . $name . '_units"' . ' tabindex="' . Pieform::hsc($element['tabindex']) . '"';
    if (isset($element['description'])) {
        $uselect .= ' aria-describedby="' . $form->element_descriptors($element) . '"';
    }
    $uselect .= ">\n";
    foreach (pieform_element_bytes_get_bytes_units() as $u) {
        $uselect .= "\t<option value=\"{$u}\"" . ($values['units'] == $u ? ' selected="selected"' : '') . '>' . $form->i18n('element', 'bytes', $u, $element) . "</option>\n";
    }
    $uselect .= "</select></span></div>\n";
    $fieldset = '<div id="' . $formname . '_' . $name . '_fieldset" class="dropdown-group js-dropdown-group form-group">' . '<fieldset class="pieform-fieldset dropdown-group js-dropdown-group">' . $numberinput . $uselect . '</fieldset></div>';
    return $fieldset;
}
开发者ID:rboyatt,项目名称:mahara,代码行数:61,代码来源:bytes.php

示例7: pieform_element_image_get_value

function pieform_element_image_get_value(Pieform $form, $element)
{
    /*{{{*/
    if (isset($element['value'])) {
        return $element['value'];
    }
    $global = $form->get_property('method') == 'get' ? $_GET : $_POST;
    if ($form->is_submitted() && isset($global[$element['name'] . '_x'])) {
        return true;
    }
    return null;
}
开发者ID:Br3nda,项目名称:mahara,代码行数:12,代码来源:image.php

示例8: pieform_element_password_get_value

function pieform_element_password_get_value(Pieform $form, $element)
{
    /*{{{*/
    if (isset($element['value'])) {
        return $element['value'];
    }
    $global = $form->get_property('method') == 'get' ? $_GET : $_POST;
    if ($form->is_submitted() && isset($global[$element['name']])) {
        return $global[$element['name']];
    }
    if (isset($element['defaultvalue'])) {
        return $element['defaultvalue'];
    }
    return null;
}
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:15,代码来源:password.php

示例9: pieform_element_multitext_get_value

function pieform_element_multitext_get_value(Pieform $form, $element)
{
    if (isset($element['value'])) {
        return $element['value'];
    }
    $global = $form->get_property('method') == 'get' ? $_GET : $_POST;
    $name = $form->get_name() . '_' . $element['name'];
    if ($form->is_submitted() && isset($global[$name]) && is_array($global[$name])) {
        return array_values($global[$name]);
    }
    if (isset($element['defaultvalue'])) {
        return $element['defaultvalue'];
    }
    return null;
}
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:15,代码来源:multitext.php

示例10: pieform_element_textarea_get_value

function pieform_element_textarea_get_value(Pieform $form, $element)
{
    /*{{{*/
    if (isset($element['value'])) {
        return $element['value'];
    }
    $global = $form->get_property('method') == 'get' ? $_GET : $_POST;
    if ($form->is_submitted() && isset($global[$element['name']])) {
        return str_replace("\r\n", "\n", $global[$element['name']]);
    }
    if (isset($element['defaultvalue'])) {
        return $element['defaultvalue'];
    }
    return '';
}
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:15,代码来源:textarea.php

示例11: pieform_element_passwordnoread_get_value

/**
 * Return the value of the element. This returns an array with the defaultvalue (if supplied),
 * and the value newly submitted in this form (if supplied)
 *
 * @param Pieform $form
 * @param array $element
 * @return array with two keys, 'defaultvalue' and 'submittedvalue'
 */
function pieform_element_passwordnoread_get_value(Pieform $form, $element)
{
    $ret = array();
    if (isset($element['defaultvalue'])) {
        $ret['defaultvalue'] = $element['defaultvalue'];
    } else {
        $ret['defaultvalue'] = null;
    }
    $global = $form->get_property('method') == 'get' ? $_GET : $_POST;
    if ($form->is_submitted() && isset($global[$element['name']])) {
        $ret['submittedvalue'] = $global[$element['name']];
    } else {
        $ret['submittedvalue'] = null;
    }
    return $ret;
}
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:24,代码来源:passwordnoread.php

示例12: pieform_element_checkbox_get_value

function pieform_element_checkbox_get_value(Pieform $form, $element)
{
    /*{{{*/
    $name = $element['name'];
    $global = $form->get_property('method') == 'get' ? $_GET : $_POST;
    if (isset($element['value'])) {
        return $element['value'];
    }
    if ($form->is_submitted()) {
        if (isset($global[$name])) {
            return true;
        }
        return false;
    }
    if (isset($element['defaultvalue'])) {
        return $element['defaultvalue'];
    }
    return false;
}
开发者ID:Br3nda,项目名称:mahara,代码行数:19,代码来源:checkbox.php

示例13: pieform_element_bytes

/**
 * Provides a size chooser, with a text box for a number and a
 * select box to choose the units, in bytes, kilobytes, megabytes or gigabytes
 *
 * @param Pieform $form    The form to render the element for
 * @param array   $element The element to render
 * @return string          The HTML for the element
 */
function pieform_element_bytes(Pieform $form, $element)
{
    /*{{{*/
    $formname = $form->get_name();
    $result = '';
    $name = Pieform::hsc($element['name']);
    if (!isset($element['defaultvalue'])) {
        $element['defaultvalue'] = null;
    }
    $global = $form->get_property('method') == 'get' ? $_GET : $_POST;
    // Get the value of the element for rendering.
    if (isset($element['value'])) {
        $bytes = $element['value'];
        $values = pieform_element_bytes_get_bytes_from_bytes($element['value']);
    } else {
        if ($form->is_submitted() && isset($global[$element['name']]) && isset($global[$element['name'] . '_units'])) {
            $values = array('number' => $global[$element['name']], 'units' => $global[$element['name'] . '_units']);
            $bytes = $values['number'] * pieform_element_bytes_in($values['units']);
        } else {
            if (isset($element['defaultvalue'])) {
                $bytes = $element['defaultvalue'];
                $values = pieform_element_bytes_get_bytes_from_bytes($bytes);
            } else {
                $values = array('number' => '0', 'units' => 'bytes');
                $bytes = 0;
            }
        }
    }
    // @todo probably create with an actual input element, as tabindex doesn't work here for one thing
    // Same with the select. And do the events using mochikit signal instead of dom events
    $numberinput = '<input';
    $numberinput .= ' type="text" size="6" name="' . $name . '"';
    $numberinput .= ' id="' . $formname . '_' . $name . '" value="' . Pieform::hsc($values['number']) . '" tabindex="' . Pieform::hsc($element['tabindex']) . '"';
    $numberinput .= (isset($element['error']) ? ' class="error"' : '') . ">\n";
    $uselect = '<select name="' . $name . '_units" id="' . $formname . '_' . $name . '_units"' . ' tabindex="' . Pieform::hsc($element['tabindex']) . "\">\n";
    foreach (pieform_element_bytes_get_bytes_units() as $u) {
        $uselect .= "\t<option value=\"{$u}\"" . ($values['units'] == $u ? ' selected="selected"' : '') . '>' . $form->i18n('element', 'bytes', $u, $element) . "</option>\n";
    }
    $uselect .= "</select>\n";
    return $numberinput . $uselect;
}
开发者ID:richardmansfield,项目名称:richardms-mahara,代码行数:49,代码来源:bytes.php

示例14: pieform_element_rolepermissions_get_value

function pieform_element_rolepermissions_get_value(Pieform $form, $element)
{
    /*{{{*/
    if (isset($element['value'])) {
        return $element['value'];
    }
    if (isset($element['defaultvalue'])) {
        $value = $element['defaultvalue'];
    } else {
        $value = group_get_default_artefact_permissions($element['group']);
    }
    if ($form->is_submitted()) {
        $global = $form->get_property('method') == 'get' ? $_GET : $_POST;
        $prefix = $form->get_name() . '_' . $element['name'] . '_p';
        foreach ($value as $r => $perms) {
            foreach (array_keys(get_object_vars($perms)) as $p) {
                if ($r != 'admin') {
                    $value[$r]->{$p} = param_boolean($prefix . '_' . $r . '_' . $p);
                }
            }
        }
    }
    return $value;
}
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:24,代码来源:rolepermissions.php

示例15: pieform_element_autocomplete_get_value

/**
 * Translates the raw form data into PHP variables. Basically it just needs to
 * decide whether we should return an array (if this is a multi-select) or a
 * scalar (if this is not a multi-select)
 *
 * @param Pieform $form
 * @param array $element
 * @return mixed
 */
function pieform_element_autocomplete_get_value(Pieform $form, $element)
{
    $global = $form->get_property('method') == 'get' ? $_GET : $_POST;
    if (isset($element['value'])) {
        $values = $element['value'];
    } else {
        if ($form->is_submitted() && isset($global[$element['name']])) {
            $values = $global[$element['name']];
        } else {
            if (!$form->is_submitted() && isset($element['defaultvalue'])) {
                $values = $element['defaultvalue'];
            } else {
                if (!empty($element['disabled']) && isset($element['defaultvalue'])) {
                    $values = $element['defaultvalue'];
                } else {
                    $values = null;
                }
            }
        }
    }
    if (empty($element['multiple'])) {
        return $values;
    } else {
        // Defaultvalue will already be an array
        if (is_array($values)) {
            return $values;
        }
        // Values returned form the form will be a comma-separated list
        $r = explode(',', $values);
        if ($r === false) {
            return array();
        } else {
            return $r;
        }
    }
}
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:45,代码来源:autocomplete.php


注:本文中的Pieform::is_submitted方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。