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


PHP Q_Html::hidden方法代码示例

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


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

示例1: form

 /**
  * Renders a form
  * @method form
  * @static
  * @param {string|Q_Uri} [$action=''] Could be a URL string, a Q_Uri object, or a string representing a Q_Uri object.
  * @param {string} [$method='post'] The method for the form submission.
  * @param {array} [$attributes=array()] An associative array of additional attributes. (say that 4 times fast)
  * @param {string} [$contents=null] If null, only the opening tag is generated. 
  *  If a string, also inserts the contents and generates a closing tag.
  *  If you want to do escaping on the contents, you must do it yourself.
  * @return {string} The generated markup
  * @throws {Exception}
  */
 static function form($action = '', $method = 'POST', $attributes = array(), $contents = null)
 {
     if (isset($method) and !is_string($method)) {
         throw new Exception("form method is not a string");
     }
     if (!is_array($attributes)) {
         if (isset($attributes)) {
             $contents = $attributes;
         }
         $attributes = array();
     }
     $input = null;
     $method = strtoupper($method);
     if ($method != 'GET' and $method != 'POST') {
         $input = Q_Html::hidden(array('Q.method' => $method));
         $method = 'POST';
     }
     if (!isset($method)) {
         unset($method);
     }
     $tag_params = array_merge(compact('action', 'method'), $attributes);
     if (isset($contents)) {
         $contents = $input . $contents;
     }
     $form = self::tag('form', $tag_params, $contents);
     return isset($contents) ? $form : $form . $input;
 }
开发者ID:AndreyTepaykin,项目名称:Platform,代码行数:40,代码来源:Html.php

示例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')));
}
开发者ID:dmitriz,项目名称:Platform,代码行数:10,代码来源:tool.php

示例3: Streams_message_tool

function Streams_message_tool($options)
{
    extract($options);
    $user = Users::loggedInUser();
    if (!$user) {
        throw new Users_Exception_NotLoggedIn();
    }
    if (empty($publisherId)) {
        $publisherId = Streams::requestedPublisherId();
    }
    if (empty($publisherId)) {
        $publisherId = $_REQUEST['publisherId'] = $user->id;
    }
    if (empty($name)) {
        $name = Streams::requestedName(true);
    }
    $stream = Streams::fetch($user->id, $publisherId, $name);
    $stream = !empty($stream) ? reset($stream) : null;
    if (!$stream) {
        throw new Q_Exception_MissingRow(array('table' => 'stream', 'criteria' => 'with that name'), 'streamName');
    }
    if (!$stream->testReadLevel('messages') || !$stream->testWriteLevel('post')) {
        throw new Users_Exception_NotAuthorized();
    }
    $hidden = array('publisherId' => $publisherId, 'streamName' => $name);
    $fields = array('stream' => array('label' => 'Stream', 'type' => 'static', 'value' => $stream->title));
    $type = Streams::requestedType();
    // check if stream has messages
    $types = Q_Config::get('Streams', 'messages', $stream->type, array());
    if (count($types) === 0) {
        throw new Q_Exception("Stream of type '{$stream->type}' does not support messages");
    }
    if (!empty($type) && !in_array($type, $types)) {
        throw new Q_Exception("Requested message type '{$type}' is not alowed for streams of type '{$stream->type}'");
    }
    if (!empty($type)) {
        $hidden['type'] = $type;
        $fields['type'] = array('label' => 'Message type', 'type' => 'static', 'value' => $type);
    } else {
        $fields['type'] = array('label' => 'Message type', 'type' => 'select', 'options' => array_merge(array('' => 'Select type'), array_combine($types, $types)), 'value' => '');
    }
    $fields['content'] = array('label' => 'Content', 'type' => 'textarea');
    $fields['submit'] = array('label' => '', 'type' => 'submit_buttons', 'options' => array('submit' => 'Post'));
    return Q_Html::tag('h3', array(), 'Post a message') . Q_Html::form(Q_Request::baseUrl() . '/action.php/Streams/message', 'post', array(), Q_Html::hidden($hidden) . Q::tool('Q/form', array('fields' => $fields, 'onSuccess' => 'function (data) {
					if (data.errors) alert(data.errors);
					else {
						alert("Message posted");
						var message = Q.getObject(["slots", "form", "fields"], data);
						Q.handle(Q.info.baseUrl+"/plugins/Streams/message?publisherId="+message.publisherId+"&name="+message.streamName);
					}
				}')));
}
开发者ID:dmitriz,项目名称:Platform,代码行数:52,代码来源:tool.php

示例4: Streams_form_tool

/**
 * Generates a form with inputs that modify various streams
 * @class Streams form
 * @constructor
 * @param {array} $options
 *  An associative array of parameters, containing:
 * @param {array} [$options.fields] an associative array of $id => $fieldinfo pairs,
 *   where $id is the id to append to the tool's id, to generate the input's id,
 *   and fieldinfo is either an associative array with the following fields,
 *   or a regular array consisting of fields in the following order:
 *     "publisherId" => Required. The id of the user publishing the stream
 *     "streamName" => Required. The name of the stream
 *     "field" => The stream field to edit, or "attribute:$attributeName" for an attribute.
 *     "input" => The type of the input (@see Q_Html::smartTag())
 *     "attributes" => Additional attributes for the input
 *     "options" => options for the input (if type is "select", "checkboxes" or "radios")
 *     "params" => array of extra parameters to Q_Html::smartTag
 */
function Streams_form_tool($options)
{
    $fields = Q::ifset($options, 'fields', array());
    $defaults = array('publisherId' => null, 'streamName' => null, 'field' => null, 'type' => 'text', 'attributes' => array(), 'value' => array(), 'options' => array(), 'params' => array());
    $sections = array();
    $hidden = array();
    $contents = '';
    foreach ($fields as $id => $field) {
        if (Q::isAssociative($field)) {
            $r = Q::take($field, $defaults);
        } else {
            $c = count($field);
            if ($c < 4) {
                throw new Q_Exception("Streams/form tool: field needs at least 4 values");
            }
            $r = array('publisherId' => $field[0], 'streamName' => $field[1], 'field' => $field[2], 'type' => $field[3], 'attributes' => isset($field[4]) ? $field[4] : array(), 'value' => isset($field[5]) ? $field[5] : '', 'options' => isset($field[6]) ? $field[6] : null, 'params' => isset($field[7]) ? $field[7] : null);
        }
        $r['attributes']['name'] = "input_{$id}";
        if (!isset($r['type'])) {
            var_dump($r['type']);
            exit;
        }
        $stream = Streams::fetchOne(null, $r['publisherId'], $r['streamName']);
        if ($stream) {
            if (substr($r['field'], 0, 10) === 'attribute:') {
                $attribute = trim(substr($r['field'], 10));
                $value = $stream->get($attribute, $r['value']);
            } else {
                $field = $r['field'];
                $value = $stream->{$field};
            }
        } else {
            $value = $r['value'];
        }
        $tag = Q_Html::smartTag($r['type'], $r['attributes'], $value, $r['options'], $r['params']);
        $class1 = 'publisherId_' . Q_Utils::normalize($r['publisherId']);
        $class2 = 'streamName_' . Q_Utils::normalize($r['streamName']);
        $contents .= "<span class='Q_before {$class1} {$class2}'></span>" . Q_Html::tag('span', array('data-publisherId' => $r['publisherId'], 'data-streamName' => $r['streamName'], 'data-field' => $r['field'], 'data-type' => $r['type'], 'class' => "{$class1} {$class2}"), $tag);
        $hidden[$id] = array(!!$stream, $r['publisherId'], $r['streamName'], $r['field']);
    }
    $contents .= Q_Html::hidden(array('inputs' => Q::json_encode($hidden)));
    return Q_Html::form('Streams/form', 'post', array(), $contents);
    //
    // $fields = array('onSubmit', 'onResponse', 'onSuccess', 'slotsToRequest', 'loader', 'contentElements');
    // Q_Response::setToolOptions(Q::take($options, $fields));
    // Q_Response::addScript('plugins/Q/js/tools/form.js');
    // Q_Response::addStylesheet('plugins/Q/css/form.css');
    // return $result;
}
开发者ID:dmitriz,项目名称:Platform,代码行数:67,代码来源:tool.php

示例5: Q_inplace_tool

/**
 * This tool generates an inline editor, along with a form tag.
 * @class Q inplace
 * @constructor
 * @param {array} [$options] An associative array of parameters, containing:
 *   @param {string} $options.fieldInput  Required. HTML representing a text input, textarea, or select.
 *   @param {string} $options.staticHtml  Required. The static HTML to display when the input isn't showing.
 *   @param {string} [$options.type='textarea']  The type of the input. Can be "textarea", "text" or "select"
 *   @param {string} [$options.action=""]  The uri or url to submit to
 *   @param {string} [$options.method="put"]  The method to use for submitting the form.
 *   @param {boolean} [$options.editing]  If true, then renders the inplace tool in editing mode.
 *   @param {boolean} [$options.editOnClick=true]  If true, then edit mode starts only if "Edit" button is clicked.
 *   @param {boolean} [$options.selectOnEdit=true] If true, selects all the text when entering edit mode.
 *   @param {string} [$options.placeholder] Text to show in the staticHtml or input field when the editor is empty
 *   @param {array} [$options.hidden] An associative array of additional hidden fields to submit in the form
 *   @param {integer} [$options.maxWidth] The maximum width for the Q/autogrow
 *   @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.
 */
function Q_inplace_tool($options)
{
    $action = '';
    $method = 'put';
    $fieldInput = '';
    $staticHtml = '';
    $type = 'textarea';
    $editOnClick = true;
    $selectOnEdit = true;
    extract($options);
    if (isset($inplace)) {
        extract($inplace);
    }
    if (!isset($fieldInput)) {
        throw new Q_Exception_RequiredField(array('field' => 'fieldInput'));
    }
    $staticClass = $type === 'textarea' ? 'Q_inplace_tool_blockstatic' : 'Q_inplace_tool_static';
    Q_Response::addScript('plugins/Q/js/tools/inplace.js');
    Q_Response::addStylesheet('plugins/Q/css/inplace.css');
    $formTag = Q_Html::form("{$action}", $method, array('class' => 'Q_inplace_tool_form'));
    $hiddenInputs = $options['hidden'] ? Q_Html::hidden($options['hidden']) : '';
    $classes = !empty($editing) ? 'Q_editing Q_nocancel' : '';
    $options = compact('editOnClick', 'selectOnEdit', 'showEditButtons', 'maxWidth', 'beforeSave', 'onSave', 'placeholder', 'type');
    Q_Response::setToolOptions($options);
    $sh = $staticHtml ? $staticHtml : '<span class="Q_placeholder">' . Q_Html::text($placeholder) . '</span>';
    return <<<EOT
<div class='Q_inplace_tool_container {$classes} Q_inplace_{$type}' style="position: relative;">
\t<div class='Q_inplace_tool_editbuttons'>
\t\t<button class='Q_inplace_tool_edit basic16 basic16_edit'>Edit</button>
\t</div>
\t<div class='{$staticClass}'>{$sh}</div>
\t{$formTag}
\t\t{$fieldInput}
\t\t{$hiddenInputs}
\t\t<div class='Q_inplace_tool_buttons'>
\t\t\t<button class='Q_inplace_tool_cancel basic16 basic16_cancel'>Cancel</button>
\t\t\t<button class='Q_inplace_tool_save basic16 basic16_save'>Save</button>
\t\t</div>
\t</form>
</div>

EOT;
}
开发者ID:AndreyTepaykin,项目名称:Platform,代码行数:63,代码来源:tool.php

示例6: array

echo Q_Html::img($byUser->iconUrl('80.png'), $byDisplayName, array('class' => 'item_icon'));
?>
				</td>
				<td>
					<h2><?php 
echo $byDisplayName;
?>
 invited you to:</h2>
					<div class='stream_title'><?php 
echo $stream->title;
?>
</div>
				</td>
			</tr>
		</table>
		<h3>Let your friends recognize you:</h3>
		<div class='Q_login Q_big_prompt'>
			<?php 
echo Q_Html::form(Q_Request::baseUrl() . '/action.php/Streams/basic', 'post');
?>
			<?php 
echo Q_Html::hidden(array('token' => $token, 'userId' => $user->id));
?>
			<?php 
echo Q::tool('Q/form', array('fields' => array('name' => array('placeholder' => "", 'label' => 'Enter your name:'), '' => array('type' => 'submit', 'value' => 'Get Started')), 'onSuccess' => Q_Request::baseUrl() . "/plugins/Streams/stream?publisherId={$stream->publisherId}&streamName={$stream->name}"), array('id' => 'Streams_Register'));
?>
			</form>
		</div>
	</div>
</div>
开发者ID:dmitriz,项目名称:Platform,代码行数:30,代码来源:register.php

示例7: array

<?php

echo Q_Html::form($action, 'POST', array('target' => 'Assets_authnet'));
?>
	<?php 
echo Q_Html::hidden(array('Token' => $token));
?>
	<button class="Q_button Assets_pay" type="submit"><?php 
echo $payButton;
?>
</button>
</form>
开发者ID:AndreyTepaykin,项目名称:Platform,代码行数:12,代码来源:Authnet.php

示例8: array

				</div>
			<?php 
    }
    ?>
		<?php 
} else {
    ?>
			<div class="Q_register Q_big_prompt">
				<?php 
    echo Q_Html::form(Q_Request::baseUrl() . '/action.php/Streams/invited');
    ?>
				<?php 
    echo Q_Html::formInfo($stream_uri);
    ?>
				<?php 
    echo Q_Html::hidden(array('token' => $invite->token, 'icon' => $thumbnail_url));
    ?>
				<?php 
    echo Q::tool('Q/form', array('fields' => $fields));
    ?>
				</form>
			</div>
		<?php 
}
?>
	</div>
	<?php 
if ($show_chat) {
    ?>
	<div class='social_pane'>
		<?php 
开发者ID:dmitriz,项目名称:Platform,代码行数:31,代码来源:invited.php

示例9: Streams_invite_tool

function Streams_invite_tool($options)
{
    extract($options);
    $form_tool = Q::tool('Q/form', array('fields' => array('displayName' => array('label' => "Display name", 'type' => 'text', 'value' => Streams::displayName(Users::loggedInUser(), array('fullAccess' => true))), 'userId' => array('label' => "User id to invite", 'type' => 'textarea'), 'identifier' => array('label' => 'Mobile Number or Email Address', 'type' => 'textarea'), 'label' => array('label' => 'Group label', 'type' => 'textarea'), 'readLevel' => array('label' => 'Read level', 'type' => 'select', 'value' => Streams::$READ_LEVEL['content'], 'options' => array_flip(Streams::$READ_LEVEL)), 'writeLevel' => array('label' => 'Write level', 'type' => 'select', 'value' => Streams::$WRITE_LEVEL['post'], 'options' => array_flip(Streams::$WRITE_LEVEL)), 'adminLevel' => array('label' => 'Admin level', 'type' => 'select', 'options' => array_flip(Streams::$ADMIN_LEVEL)), 'submit' => array('label' => '', 'type' => 'submit_buttons', 'options' => array('submit' => 'Send Invite'))))) . Q_Html::hidden(array('publisherId' => $stream->publisherId, 'streamName' => $stream->name));
    return Q_Html::tag('h3', array(), 'Invite to stream "' . $options['stream']->name . '"') . Q_Html::form(Q_Request::baseUrl() . '/action.php/Streams/invite', 'post', array(), $form_tool);
}
开发者ID:dmitriz,项目名称:Platform,代码行数:6,代码来源:tool.php

示例10: Streams_stream_tool

function Streams_stream_tool($options)
{
    extract($options);
    $fields = array();
    $hidden = array();
    $user = Users::loggedInUser();
    if (!$user) {
        throw new Users_Exception_NotLoggedIn();
    }
    // if PK provided check for the stream
    if (isset($publisherId) && isset($name)) {
        $stream = Streams::fetch($user->id, $publisherId, $name);
        $stream = !empty($stream) ? reset($stream) : null;
        if (!$stream) {
            throw new Q_Exception_MissingRow(array('table' => 'stream', 'criteria' => 'with that name'), 'streamName');
        }
        if (!$stream->testReadLevel('content') || !$stream->testWriteLevel('edit')) {
            throw new Users_Exception_NotAuthorized();
        }
    } else {
        $stream = null;
    }
    // publisherId can be taken from request or shall be equal to user id
    $hidden['publisherId'] = $publisherId = isset($stream) ? $stream->publisherId : $user->id;
    // name for existing stream, for new streams name will be generated from type
    if (isset($stream)) {
        $hidden['name'] = $stream->name;
    }
    if (isset($publisherId)) {
        $fields['publisherId'] = array('label' => 'Publisher ID', 'type' => 'static', 'value' => $publisherId);
    }
    if (isset($name)) {
        $fields['name'] = array('label' => 'Stream name', 'type' => 'static', 'value' => $name);
    }
    // type shall be defined for new streams
    if (!isset($stream)) {
        $range = array_keys(Q_Config::expect('Streams', 'types'));
        if (!isset($type)) {
            // selection of available types
            $fields['type'] = array('label' => 'Stream type', 'type' => 'select', 'options' => array_combine($range, $range), 'value' => 'Streams/text');
        } else {
            // check if type is allowed
            if (!in_array($type, $range)) {
                throw new Q_Exception_WrongValue(array('field' => 'stream type', 'range' => join(', ', $range)));
            }
            $hidden['type'] = $type;
        }
    }
    // stream title
    $fields['title'] = array('label' => 'Title', 'type' => 'text', 'value' => $stream ? $stream->title : '');
    // stream content
    $fields['content'] = array('label' => 'Content', 'type' => 'textarea', 'value' => $stream ? $stream->content : '');
    $read_options = array_flip(Streams::$READ_LEVEL);
    if ($stream) {
        foreach ($read_options as $key => $value) {
            if (!$stream->testReadLevel($key)) {
                unset($read_options[$key]);
            }
        }
        $readLevel = min(isset($readLevel) ? $readLevel : 100, $stream->readLevel);
    }
    $fields['readLevel'] = array('label' => 'Read level', 'type' => 'select', 'value' => $readLevel ? $readLevel : Streams::$READ_LEVEL['content'], 'options' => $read_options);
    $write_options = array_flip(Streams::$WRITE_LEVEL);
    if ($stream) {
        foreach ($write_options as $key => $value) {
            if (!$stream->testWriteLevel($key)) {
                unset($write_options[$key]);
            }
        }
        $writeLevel = min(isset($writeLevel) ? $writeLevel : 100, $stream->writeLevel);
    }
    $fields['writeLevel'] = array('label' => 'Write level', 'type' => 'select', 'value' => $writeLevel ? $writeLevel : Streams::$WRITE_LEVEL['post'], 'options' => $write_options);
    $admin_options = array_flip(Streams::$ADMIN_LEVEL);
    if ($stream) {
        foreach ($admin_options as $key => $value) {
            if (!$stream->testAdminLevel($key)) {
                unset($admin_options[$key]);
            }
        }
        $adminLevel = min(isset($adminLevel) ? $adminLevel : 100, $stream->adminLevel);
    }
    array_pop($admin_options);
    $fields['adminLevel'] = array('label' => 'Admin level', 'type' => 'select', 'value' => $adminLevel ? $adminLevel : Streams::$ADMIN_LEVEL['none'], 'options' => $admin_options);
    $fields['submit'] = array('label' => '', 'type' => 'submit_buttons', 'options' => array('submit' => $stream ? 'Update' : 'Create'));
    if (empty($noJoin)) {
        $hidden['join'] = true;
    }
    return Q_Html::tag('h3', array(), !$stream ? 'Create a stream' : 'Update stream') . Q_Html::form(Q_Request::baseUrl() . '/action.php/Streams/stream', $stream ? 'put' : 'post', array(), Q_Html::hidden($hidden) . Q::tool('Q/form', array('fields' => $fields, 'onSuccess' => 'function (data) {
					if (data.errors) alert(data.errors);
					else {
						var stream = Q.getObject(["slots", "form", "fields"], data);
						Q.handle(Q.info.baseUrl+"/plugins/Streams/put?publisherId="+stream.publisherId+"&name="+stream.name);
					}
				}')));
}
开发者ID:dmitriz,项目名称:Platform,代码行数:95,代码来源:tool.php

示例11: Q_form_tool

/**
 * This tool is meant to be wrapped in a <form> tag
 * @param {array} $options An associative array of parameters, containing:
 * @param {array} $options.fields an associative array of fieldname => fieldinfo pairs,
 *   where fieldinfo contains the following:
 *     "type" => the type of the field (@see Q_Html::smartTag())
 *     "attributes" => additional attributes for the field input
 *     "value" => the initial value of the field input
 *     "options" => options for the field input (if type is "select", "checkboxes" or "radios")
 *     "message" => initial message, if any to put in the field's message space
 *     "label" => the label for the field
 *     "extra" => if set, this is html to replace the first cell, displacing the label
 *     "placeholder" => if set, this is the placeholder text for the input
 *     "fillFromRequest" => Defaults to true.
 *       If true, uses $_REQUEST to fill any fields with same name.
 *       Currently doesn't work for names which specify arrays, such as a[b].
 * @param {string} [$options.onSubmit] Optional. Name of the javascript function or url to pass to Q.handle on submit
 * @param {string} [$options.onResponse] Name of the javascript function or url to pass to Q.handle on response
 * @param {string} [$options.onSuccess] Name of javascript function or url to pass to Q.handle on success
 * @param {string} [$options.loader] Optional. Name of a javascript function which takes (action, method, params, slots, callback) as arguments.
 *    It should call the callback and pass it an object with the response info. Can be used to implement caching, etc.
 *    instead of the default HTTP request.
 *    If "loader" is Q.getter and request should be done bypasing cache, assign true to .ignoreCache property of the tool
 * @param {array|string} [$options.slotsToRequest] Optional. A string or array of slot names to request in response. Should include "form".
 * @param {array|string} [$options.contentElements] Optional. Array of $slotName => $cssSelector pairs for child element of the form to fill with HTML returned from the slot.
 */
function Q_form_tool($options)
{
    if (empty($options['fields'])) {
        $options['fields'] = array();
    }
    if (!array_key_exists('fillFromRequest', $options)) {
        $options['fillFromRequest'] = true;
    }
    if (empty($options['contentElements'])) {
        $options['contentElements'] = array();
    }
    $field_defaults = array('type' => 'text', 'attributes' => array(), 'value' => null, 'options' => array(), 'message' => '', 'placeholder' => null);
    $tr_array = array();
    $messages_td = false;
    $colspan = '';
    foreach ($options['fields'] as $name => $field) {
        if (isset($field['message'])) {
            $messages_td = true;
            $colspan = "colspan='2'";
        }
    }
    foreach ($options['fields'] as $name => $field) {
        if (!is_array($field)) {
            $name2 = '"' . addslashes($name) . '"';
            throw new Q_Exception_WrongType(array('field' => "\$options[{$name2}]", 'type' => 'array'));
        }
        $field2 = array_merge($field_defaults, $field);
        $type = $field2['type'];
        if ($type === 'hidden') {
            continue;
        }
        $attributes = array('name' => $name, 'id' => $name);
        $value = $field2['value'];
        $o = $field2['options'];
        $message = $field2['message'];
        if (!empty($options['fillFromRequest']) and !in_array($type, array('button', 'submit'))) {
            if (isset($_REQUEST[$name])) {
                $value = $_REQUEST[$name];
            } else {
                if ($type === 'static' or $type === 'date') {
                    $parts = array($name . '_hour' => 0, $name . '_minute' => 0, $name . '_second' => 0, $name . '_month' => date('m'), $name . '_day' => date('d'), $name . '_year' => date('Y'));
                    $provided = Q::ifset($_REQUEST, array_keys($parts), null);
                    if (isset($provided)) {
                        $mktime = Q::take($_REQUEST, $parts);
                        $value = call_user_func_array('mktime', $mktime);
                    }
                }
            }
        }
        if (isset($field2['placeholder'])) {
            $attributes['placeholder'] = $field2['placeholder'];
        }
        if ($field2['attributes']) {
            $attributes = array_merge($attributes, $field2['attributes']);
        }
        if (ctype_alnum($type)) {
            if (isset($attributes['class'])) {
                if (is_array($attributes['class'])) {
                    foreach ($attributes['class'] as $k => $v) {
                        $attributes['class'][$k] .= " {$type}";
                    }
                } else {
                    $attributes['class'] .= " {$type}";
                }
            } else {
                $attributes['class'] = " {$type}";
            }
        }
        $label = isset($field['label']) ? $field['label'] : Q_Html::text($name);
        $label = Q_Html::tag('label', array('for' => $attributes['id']), $label);
        $name_text = Q_Html::text($name);
        $extra = isset($field['extra']) ? $field['extra'] : null;
        switch ($type) {
            case 'textarea':
//.........这里部分代码省略.........
开发者ID:dmitriz,项目名称:Platform,代码行数:101,代码来源:tool.php

示例12: 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'));
开发者ID:dmitriz,项目名称:Platform,代码行数:17,代码来源:getintouch.php


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