本文整理汇总了PHP中Q_Html::input方法的典型用法代码示例。如果您正苦于以下问题:PHP Q_Html::input方法的具体用法?PHP Q_Html::input怎么用?PHP Q_Html::input使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Q_Html
的用法示例。
在下文中一共展示了Q_Html::input方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Streams_inplace_tool
/**
* This tool generates an inline editor to edit the content or attribute of a stream.
* @class Streams inplace
* @constructor
* @param {array} $options Options for the tool
* An associative array of parameters, containing:
* @param {string} [$options.inplaceType='textarea'] The type of the fieldInput. Can be "textarea" or "text"
* @param {array} [$options.convert] The characters to convert to HTML. Pass an array containing zero or more of "\n", " "
* @param {Streams_Stream} $options.stream A Streams_Stream object
* @param {string} [$options.field] Optional, name of an field to change instead of the content of the stream
* @param {string} [$options.attribute] Optional, name of an attribute to change instead of any field.
* @param {string} [$options.beforeSave] Reference to a callback to call after a successful save. This callback can cancel the save by returning false.
* @param {string} [$options.onSave] Reference to a callback or event to run after a successful save.
* @param {string} [$options.onCancel] Reference to a callback or event to run after cancel.
* @param {array} [$options.inplace=array()] Additional fields to pass to the child Q/inplace tool, if any
* @uses Q inplace
*/
function Streams_inplace_tool($options)
{
if (empty($options['stream'])) {
if (empty($options['publisherId']) or empty($options['streamName'])) {
throw new Q_Exception_RequiredField(array('field' => 'stream'));
}
$publisherId = $options['publisherId'];
$streamName = $options['streamName'];
$stream = Streams::fetchOne(null, $publisherId, $streamName);
if (!$stream) {
throw new Q_Exception_MissingRow(array('table' => 'stream', 'criteria' => "publisherId={$publisherId}, name={$streamName}"));
}
} else {
$stream = $options['stream'];
}
$inplaceType = Q::ifset($options, 'inplaceType', 'textarea');
$inplace = array('action' => $stream->actionUrl(), 'method' => 'PUT', 'type' => $inplaceType);
if (isset($options['inplace'])) {
$inplace = array_merge($options['inplace'], $inplace);
}
$convert = Q::ifset($options, 'convert', array("\n"));
$inplace['hidden']['convert'] = json_encode($convert);
if (!empty($options['attribute'])) {
$field = 'attributes[' . urlencode($options['attribute']) . ']';
$content = $stream->get($options['attribute'], '');
$maxlength = $stream->maxSize_attributes - strlen($stream->maxSize_attributes) - 10;
} else {
$field = !empty($options['field']) ? $options['field'] : 'content';
$content = $stream->{$field};
$maxlength = $stream->maxSizeExtended($field);
}
switch ($inplaceType) {
case 'text':
$inplace['fieldInput'] = Q_Html::input($field, $content, array('placeholder' => Q::ifset($input, 'placeholder', null), 'maxlength' => $maxlength));
$inplace['staticHtml'] = Q_Html::text($content);
break;
case 'textarea':
$inplace['fieldInput'] = Q_Html::textarea($field, 5, 80, array('placeholder' => Q::ifset($inplace, 'placeholder', null), 'maxlength' => $maxlength), $content);
$inplace['staticHtml'] = Q_Html::text($content, $convert);
break;
default:
return "inplaceType must be 'textarea' or 'text'";
}
if (!$stream->testWriteLevel('suggest')) {
if (!isset($options['classes'])) {
$options['classes'] = '';
}
Q_Response::setToolOptions(array('publisherId' => $stream->publisherId, 'streamName' => $stream->name));
$staticClass = $options['inplaceType'] === 'textarea' ? 'Q_inplace_tool_blockstatic' : 'Q_inplace_tool_static';
return "<span class='Q_inplace_tool_container {$options['classes']}' style='position: relative;'>" . "<div class='{$staticClass}'>{$inplace['staticHtml']}</div></span>";
}
$toolOptions = array('publisherId' => $stream->publisherId, 'streamName' => $stream->name, 'inplaceType' => $options['inplaceType']);
Q::take($options, array('attribute', 'field', 'convert'), $toolOptions);
$toolOptions['inplace'] = $inplace;
Q_Response::setToolOptions($toolOptions);
return Q::tool("Q/inplace", $inplace);
}
示例2: Streams_publish_Broadcast_tool
function Streams_publish_Broadcast_tool($options)
{
extract($options);
$publisherId = $stream->publisherId;
$streamName = $stream->name;
$type = 'Broadcast';
$input = Q_Html::input('content', '');
$button = Q_Html::tag('button', array(), 'Post');
return Q_Html::form('Streams/stream', 'post', array(), Q_Html::formInfo(true) . Q_Html::hidden(compact('publisherId', 'streamName', 'type')) . Q::tool('Q/form', array('fields' => array('message' => array('type' => 'text', 'message' => 'this message will appear as if the user typed it before posting'), 'link' => array('type' => 'text', 'message' => 'the address of the webpage to share'), 'picture' => array('type' => 'text', 'message' => 'if you enter a picture url here, it will override the picture that is posted'), 'description' => array('type' => 'textarea', 'message' => 'if you enter something here, it will override the description that facebook would have automatically grabbed from that page'), '' => array('type' => 'button', 'value' => 'Post')), 'onSuccess' => 'Q.plugins.Broadcast.onBroadcastSuccess')));
}
示例3: Q_filter_tool
/**
* Implements an input that filters an associated list (like an autocomplete)
* @class Q filter
* @constructor
* @param {array} [$options] Override various options for this tool
* @param {String} [$options.name=filter] The name of the text input
* @param {String} [$options.value=''] The initial value of the text input
* @param {String} [$options.placeholder] Any placeholder text
* @param {array} [$options.placeholders={}] Options for Q/placeholders, or null to omit it
* @param {String} [$options.results=''] HTML to display in the results initially. If setting them later, remember to call stateChanged('results')
* @param {Q.Event} [$options.onFilter] Name of a JS event handler that is meant to fetch and update results by editing the contents of the element pointed to by the second argument. The first argument is the content of the text input.
* @return {string}
*/
function Q_filter_tool($options)
{
Q_Response::setToolOptions($options);
$name = Q::ifset($options, 'name', 'filter');
$value = Q::ifset($options, 'value', '');
$placeholder = Q::ifset($options, 'placeholder', 'filter');
$class = 'Q_filter_input';
Q_Response::addScript('plugins/Q/js/tools/filter.js');
Q_Response::addStylesheet('plugins/Q/css/filter.css');
return Q_Html::input($name, $value, compact('placeholder', 'class')) . '<div class="Q_filter_results"></div>';
}
示例4: Streams_userChooser_tool
/**
* userChooser tool
* @param array $options
* "maxResults" => the maximum number of results to show, defaults to 3
* "onSuccess" => the name of the function for what to do
* "placeholder" => override the default placeholder text,
* "exclude" => associative array of userId => true, where userId are the ids of the users
* to exclude from the results. Defaults to id of logged-in user, if logged in.
*/
function Streams_userChooser_tool($options)
{
$maxResults = Q_Config::get('Streams', 'userChooser', 'maxResults', 3);
$placeholder = "Start typing...";
extract($options);
if (!isset($exclude) and $user = Users::loggedInUser()) {
$exclude = array($user->id => true);
}
Q_Response::addScript('plugins/Streams/js/Streams.js');
Q_Response::setToolOptions(compact('onSuccess', 'maxResults', 'exclude'));
return Q_Html::input('query', '', array('class' => 'text', 'placeholder' => $placeholder, 'autocomplete' => 'off'));
}
示例5: array
<?php
echo Q::tool('Q/form');
?>
<?php
echo Q_Html::formInfo(Q_Request::url());
?>
<?php
echo Q_Html::input('getintouch', 'true', array('type' => 'checkbox', 'checked' => !empty($getintouch) ? 'checked' : null, 'id' => 'getintouch'));
?>
<?php
echo Q_Html::hidden(array('publisherId' => $article->publisherId, 'name' => $article->name));
?>
<?php
echo Q_Html::label('getintouch', 'Provide ways to get in touch');
?>
<?php
echo Q_Html::buttons('submit', array('submit' => 'Submit'));