本文整理汇总了PHP中Q_Html::getIdPrefix方法的典型用法代码示例。如果您正苦于以下问题:PHP Q_Html::getIdPrefix方法的具体用法?PHP Q_Html::getIdPrefix怎么用?PHP Q_Html::getIdPrefix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Q_Html
的用法示例。
在下文中一共展示了Q_Html::getIdPrefix方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Q_before_Q_tool_render
function Q_before_Q_tool_render($params, &$result)
{
$info = $params['info'];
$extra = $params['extra'];
if (is_string($extra)) {
$extra_id = $extra;
$extra = array();
} else {
$extra_id = isset($extra['id']) ? $extra['id'] : '';
}
$cur_prefix = isset($extra['prefix']) ? $extra['prefix'] : Q_Html::getIdPrefix();
$tool_ids = array();
$tool_prefixes = array();
foreach ($info as $name => $options) {
$tool_id = implode('_', explode('/', $name));
if (!empty($extra_id)) {
$tool_id .= '-' . $extra_id;
}
$tool_id = $cur_prefix . $tool_id;
$tool_ids[$name] = $tool_id;
$tool_prefix = $tool_id . '_';
if (isset(Q::$toolWasRendered[$tool_prefix])) {
trigger_error("A tool with prefix \"{$tool_prefix}\" was already rendered.", E_USER_NOTICE);
}
Q::$toolWasRendered[$tool_prefix] = true;
$tool_prefixes[$name] = $tool_prefix;
}
$prev_prefix = Q_Html::pushIdPrefix($tool_prefixes, $tool_ids);
}
示例2: Q_before_Q_tool_render
function Q_before_Q_tool_render($params, &$result)
{
$info = $params['info'];
$extra = $params['extra'];
if (is_string($extra) or is_numeric($extra)) {
$extra_id = $extra;
$extra = array();
} else {
$extra_id = isset($extra['id']) ? $extra['id'] : '';
}
$cur_prefix = isset($extra['prefix']) ? $extra['prefix'] : Q_Html::getIdPrefix();
$tool_ids = array();
$tool_prefixes = array();
foreach ($info as $name => $options) {
$tool_id = Q_Html::id($name . ($extra_id === '' ? '' : "-{$extra_id}"), $cur_prefix);
$tool_ids[$name] = $tool_id;
$tool_prefix = $tool_id . '_';
if (isset(Q::$toolWasRendered[$tool_prefix])) {
trigger_error("A tool with prefix \"{$tool_prefix}\" was already rendered.", E_USER_NOTICE);
}
Q::$toolWasRendered[$tool_prefix] = true;
$tool_prefixes[$name] = $tool_prefix;
}
$prev_prefix = Q_Html::pushIdPrefix($tool_prefixes, $tool_ids);
}
示例3: Q_after_Q_tool_render
function Q_after_Q_tool_render($params, &$result)
{
$info = $params['info'];
$extra = $params['extra'];
if (!is_array($extra)) {
$extra = array();
}
$id_prefix = Q_Html::getIdPrefix();
$tool_ids = Q_Html::getToolIds();
$tag = Q::ifset($extra, 'tag', 'div');
if (empty($tag)) {
Q_Html::popIdPrefix();
return;
}
$classes = '';
$data_options = '';
$count = count($info);
foreach ($info as $name => $opt) {
$classes = ($classes ? "{$classes} " : $classes) . implode('_', explode('/', $name)) . '_tool';
$options = Q_Response::getToolOptions($name);
if (isset($options)) {
$friendly_options = str_replace(array('"', '\\/'), array('"', '/'), Q_Html::text(Q::json_encode($options)));
} else {
$friendly_options = '';
}
$normalized = Q_Utils::normalize($name, '-');
if (isset($options) or $count > 1) {
$id = $tool_ids[$name];
$id_string = $count > 1 ? "{$id} " : '';
$data_options .= " data-{$normalized}='{$id_string}{$friendly_options}'";
}
$names[] = $name;
}
if (isset($extra['classes'])) {
$classes .= ' ' . $extra['classes'];
}
$attributes = isset($extra['attributes']) ? ' ' . Q_Html::attributes($extra['attributes']) : '';
$data_retain = !empty($extra['retain']) || Q_Response::shouldRetainTool($id_prefix) ? " data-Q-retain=''" : '';
$data_replace = !empty($extra['replace']) || Q_Response::shouldReplaceWithTool($id_prefix) ? " data-Q-replace=''" : '';
$names = $count === 1 ? ' ' . key($info) : 's ' . implode(" ", $names);
$ajax = Q_Request::isAjax();
$result = "<{$tag} id='{$id_prefix}tool' " . "class='Q_tool {$classes}'{$data_options}{$data_retain}{$data_replace}{$attributes}>" . "{$result}</{$tag}>";
if (!Q_Request::isAjax()) {
$result = "<!--\nbegin tool{$names}\n-->{$result}<!--\nend tool{$names} \n-->";
}
Q_Html::popIdPrefix();
}
示例4: helperIdPrefix
static function helperIdPrefix($template, $context, $args, $source)
{
return Q_Html::getIdPrefix();
}
示例5: toolReplace
/**
* @method toolReplace
* @static
* @param {boolean} [$toReplaceWith=true] Defaults to true. Whether to cache the tool being rendered.
*/
static function toolReplace($toRetain = true)
{
$idPrefix = Q_Html::getIdPrefix();
self::$toolReplace[$idPrefix] = $toRetain;
}
示例6: array
<?php
$prefix = Q_Html::getIdPrefix();
echo Q_Html::form(Q_Request::baseUrl() . '/action.php/Streams/basic', 'post');
echo Q_Html::formInfo(Q_Dispatcher::uri());
?>
<table>
<tr>
<td class="Q_field_title">
<label for="<?php
echo $prefix;
?>
firstName">First Name</label>
<?php
if ($showAccess) {
?>
<?php
echo Q::tool('Streams/access', array('readLevel' => Streams::my('Streams/user/firstName', 'readLevel'), 'streamName' => 'Streams/user/firstName', 'input_id' => Q_Html::id('firstName_readLevel')), 'firstName');
?>
<input type="hidden" name="firstName_readLevel"
id="<?php
echo Q_Html::id('firstName_readLevel');
?>
"
value="<?php
echo Streams::my('Streams/user/firstName', 'readLevel');
?>
">