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


PHP Q_Html::form方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: array

<?php

echo Q_Html::div('tool', 'Users_contact_tool necessary panel');
?>
 
	<?php 
echo Q_Html::form($tool_action_url, 'post', array('class' => 'askEmail'));
?>
 
		<?php 
echo Q_Html::formInfo($onSuccess, null, $snf);
?>
 
		<h3 class='feedback'>
			We emailed your activation link to
			<span class='email'><?php 
echo $email->address;
?>
</span>.
		</h3>
		<p>Has it been a while and you didn't get anything? Have it re-sent:</p>
		<label for="authorized_email">email address:</label>
		<input id="authorized_email" name="emailAddress" type="text" />
		<button type="submit" name="do_add" class="submit"><?php 
echo $button_content;
?>
</button>
	</form>
</div>
开发者ID:dmitriz,项目名称:Platform,代码行数:29,代码来源:verify.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

        ?>
						<?php 
        echo Q_Html::hidden(array('emailAddress' => $user->emailAddress));
        ?>
						<button type="submit" class="Users_login_start Q_main_button">Re-send activation message</button>
					</form>
				</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 
}
?>
开发者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: array

        if (empty($_REQUEST['p'])) {
            ?>
						Choose a <strong>pass phrase</strong> to log in with.<br>
						A simple phrase consisting of a few words that
						you will easily remember.
					<?php 
        } else {
            ?>
						Choose a good <strong>pass phrase</strong> to protect your account.
						See the suggestions for some ideas.
					<?php 
        }
        ?>
					</p>
					<?php 
        echo Q_Html::form(Q_Dispatcher::uri(), 'post', array('id' => 'Q_activation_form'));
        ?>
						<?php 
        echo Q_Html::formInfo(null);
        ?>
						<input type="password" id='activate_passphrase' name="passphrase" class='password' autofocus placeholder="Enter a passphrase" autocomplete="new-password" /><br>
						<button type="submit" class="Q_button" style="width: 250px;">Activate My Account</button>
						<input type="hidden" id="activate_identifier" name="<?php 
        echo $t;
        ?>
"
							value="<?php 
        echo Q_Html::text($identifier);
        ?>
">
						<input type="hidden" name="code" value="<?php 
开发者ID:AndreyTepaykin,项目名称:Platform,代码行数:31,代码来源:activate.php

示例12: array

<div class="Websites_side_column">
	<?php 
echo Q::tool(array('Streams/preview' => array('publisherId' => $article->publisherId, 'streamName' => $article->name, 'creatable' => array('clickable' => false), 'imagepicker' => array('showSize' => '200x'), 'actions' => null), 'Streams/image/preview' => array('showTitle' => true, 'dontSetSize' => true)), 'article');
?>
	<?php 
if ($getintouch and ($canEdit or $article->getintouch)) {
    ?>
		<?php 
    echo Q::tool('Users/getintouch', $getintouch);
    ?>
	<?php 
}
?>
	<?php 
if ($canEdit) {
    ?>
		<?php 
    echo Q_Html::form(Q_Request::baseUrl('action.php') . '/Websites/article', 'put', array('class' => 'Websites_getintouch'));
    ?>
			<?php 
    echo Q::view('Websites/tool/getintouch.php', compact('article', 'getintouch'));
    ?>
		</form>
	<?php 
}
?>
</div>
<?php 
echo Q::tool("Streams/html", array_merge(array('publisherId' => $article->publisherId, 'streamName' => $article->name, 'field' => 'article', 'placeholder' => 'Enter content here'), $html), 'article');
开发者ID:AndreyTepaykin,项目名称:Platform,代码行数:29,代码来源:article.php

示例13: array

<?php

echo Q_Html::form('https://test.authorize.net/profile/manage', 'POST', array('target' => 'Assets_authnet'));
?>
	<button class="Q_button Assets_subscribe" type="submit"><?php 
echo $subscribeButton;
?>
</button>
</form>
开发者ID:AndreyTepaykin,项目名称:Platform,代码行数:9,代码来源:Stripe.php

示例14: Q_panel_tool

/**
 * This tool generates a panel with a <form> tag inside it
 * @class Q panel
 * @constructor
 * @param array $options
 *  An associative array of parameters, containing:
 *  "uri" => the uri or url the form should post to
 *  "method" => the method used to submit form
 *  "title" => the title of the panel
 *  "complete" => boolean, indicating whether the data on the server is in a complete state
 *  "editing" => boolean, indicating whether to show the form in the "editing" state
 *  "form" => string containing the contents of the form portion of the panel
 *    which is normally generated by a "Q/form" tool
 *  "static" => string containing the contents of the "static" portion
 *  "collapsed" => defaults to false. Whether the panel is shown as collapsed into just the header
 *  "toggle" => defaults to false. The events that cause toggling of collapsed state.
 *    If the string is 'click' then toggles the panel on clicks.
 *    If the string is 'move' then toggles the panel on mouseenter/mouseleave.
 *  "edit_button" => optional, to override the edit button
 *  "save_button" => optional, to override the save button
 *  "cancel_button" => optional, to override the cancel button
 *  "panel_classes" => optional, additional classes for the panel
 *  "snf" => optional. The name of the nonce field in the session
 *  "onSuccess" => optional. The URI to redirect to on success
 *  "onErrors" => optional. The URI to display if errors occur
 *  "inProcess" => optional. Causes the panel to appear as if it's a step in a process.
 */
function Q_panel_tool($options)
{
    foreach (array('title', 'static', 'form') as $f) {
        if (!array_key_exists($f, $options)) {
            throw new Q_Exception_RequiredField(array('field' => '$' . $f));
        }
    }
    $edit_button = "<button type='submit' class='basic16 basic16_edit Q_panel_tool_edit'>edit</button>";
    $save_button = "<button type='submit' class='basic16 basic16_check Q_panel_tool_save'>save</button>";
    $cancel_button = "<button type='reset' class='basic16 basic16_cancel Q_panel_tool_cancel'>cancel</button>";
    $panel_classes = '';
    $uri = null;
    $method = 'post';
    $collapsed = false;
    $toggle = false;
    $inProcess = false;
    $onSuccess = null;
    $onErrors = null;
    $snf = null;
    $static = null;
    $form = null;
    $editing = false;
    $complete = false;
    $setSlots = null;
    extract($options, EXTR_OVERWRITE);
    $more_class = $options['complete'] ? 'Q_panel_tool_complete' : 'Q_panel_tool_incomplete';
    $panel_classes = "{$more_class} {$panel_classes}";
    $title_div = "<div class='Q_panel_tool_title'>{$title}</div>";
    if ($uri) {
        $header = "<div class='Q_panel_tool_buttons'>{$save_button}{$cancel_button}{$edit_button}</div>{$title_div}";
    } else {
        $header = $title_div;
    }
    // Whether to display the panel one way or the other
    if ($inProcess) {
        $header = $title_div;
        if (is_array($form)) {
            $form['fields']['_Q_buttons'] = array('type' => 'buttons', 'label' => '', 'options' => array('continue' => 'Continue'), 'attributes' => array('class' => 'basic32 basic32_right', 'type' => 'submit'));
        } else {
            $form .= "<div class='Q_panel_tool_formbuttons'><button type='submit' class='Q_panel_tool_continue basic32 basic32_right' value='continue'>Continue</button></div>";
        }
    }
    if (is_array($static)) {
        foreach ($static['fields'] as $k => $f) {
            if (Q::ifset($static, 'fields', $k, 'type', null)) {
                switch ($static['fields'][$k]['type']) {
                    case 'textarea':
                        $static['fields'][$k]['value'] = str_replace("\n", "<br>", $static['fields'][$k]['value']);
                        break;
                    case 'date':
                        if (!isset($static['fields'][$k]['options']['date'])) {
                            $static['fields'][$k]['options']['date'] = "M j, Y";
                        }
                        break;
                    case 'buttons':
                        unset($static['fields'][$k]);
                }
            }
            $static['fields'][$k]['type'] = 'static';
        }
        $static = Q::tool('Q/form', $static, array('id' => 'static'));
    }
    // Turn the form into a form
    if (is_array($form)) {
        $form['slotsToRequest'] = array('form', 'static');
        $form['contentElements'] = array('form' => '.Q_panel_tool_form', 'static' => '.Q_panel_tool_static');
        $form = Q::tool('Q/form', $form);
    }
    // Build the panel
    $panel = "<div class='Q_panel_tool_header'>{$header}</div>" . "<div class='Q_panel_tool_form'>{$form}</div>";
    if (isset($snf) or isset($onSuccess) or isset($onErrors)) {
        $panel .= "<div>" . Q_Html::formInfo($onSuccess, $onErrors, $snf) . "</div>";
    }
//.........这里部分代码省略.........
开发者ID:dmitriz,项目名称:Platform,代码行数:101,代码来源:tool.php

示例15: compact

				</tr>
				<?php 
}
?>
			</table>
		</div>
		<div class='main_pane'>
			<h2>Broadcast a Message</h2>
			<div class='Streams_player'>
				<?php 
echo Q::tool('Streams/player', compact('stream'));
?>
			</div>
			<h2>Widget code:</h2>
			<div>Customize your widget</div>
			<?php 
echo Q_Html::form(Q_Dispatcher::uri(), 'GET');
?>
				<?php 
echo Q::tool('Q/form', array('fields' => array('explanation' => array('message' => 'explanation above the button', 'value' => Q_Config::expect('Broadcast', 'text', 'explanation')), 'button' => array('message' => 'text of the button', 'value' => Q_Config::expect('Broadcast', 'text', 'button')), 'checkmark' => array('message' => 'text of the checkbox', 'value' => Q_Config::expect('Broadcast', 'text', 'checkbox')), 'css' => array('message' => 'optional url of a css file to use for styles'), '' => array('type' => 'submit', 'value' => 'Generate code')), 'onSuccess' => 'Q.plugins.Broadcast.onWidgetmakerSuccess'));
?>
			</form>
			<div>Copy and paste the following code into your website:</div>
			<textarea class="widget_code" style="width: 100%; height: 200px;">
				

				
			</textarea>
		</div>
	</div>
</div>
开发者ID:dmitriz,项目名称:Platform,代码行数:31,代码来源:stream.php


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