本文整理汇总了PHP中Q_Html::img方法的典型用法代码示例。如果您正苦于以下问题:PHP Q_Html::img方法的具体用法?PHP Q_Html::img怎么用?PHP Q_Html::img使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Q_Html
的用法示例。
在下文中一共展示了Q_Html::img方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Users_avatar_tool
/**
* This tool renders a user avatar
*
* @param {array} $options An associative array of parameters, containing:
* @param {boolean} [$options.userId]
* "userId" => The user's id. Defaults to id of the logged-in user, if any.
* @param {boolean} [$options.icon]
* "icon" => Optional. Render icon before the username.
* @param {boolean} [$options.iconAttributes]
* "iconAttributes" => Optional. Array of attributes to render for the icon.
* @param {boolean} [$options.editable]
* "editable" => Optional. Whether to provide an interface for editing the user's info. Can be array containing "icon", "name".
* @param {array} [$options.inplaces] Additional fields to pass to the child Streams/inplace tools, if any
* @param {boolean} [$options.renderOnClient]
* If true, only the html container is rendered, so the client will do the rest.
*/
function Users_avatar_tool($options)
{
$defaults = array('icon' => false, 'editable' => false);
$options = array_merge($defaults, $options);
if (empty($options['userId'])) {
$user = Users::loggedInUser();
$options['userId'] = $user->id;
} else {
$user = Users_User::fetch($options['userId']);
}
Q_Response::addStylesheet('plugins/Q/css/Q.css');
Q_Response::setToolOptions($options);
if (!empty($options['renderOnClient'])) {
return '';
}
if (!$user) {
return '';
}
$user->addPreloaded();
$p = $options;
$p['userId'] = $user->id;
Q_Response::setToolOptions($p);
$result = '';
$icon = $options['icon'];
if ($icon) {
if ($icon === true) {
$icon = Q_Config::get('Users', 'icon', 'defaultSize', 40);
}
$attributes = isset($options['iconAttributes']) ? $options['iconAttributes'] : array();
$attributes['class'] = isset($attributes['class']) ? $attributes['class'] . ' Users_avatar_icon' : 'Users_avatar_icon';
$result .= Q_Html::img($user->iconUrl($icon), 'user icon', $attributes);
}
$result .= '<span class="Users_avatar_name">' . $user->username . '</span>';
return $result;
}
示例2: Users_avatar_tool
/**
* This tool renders a user avatar
*
* @param {array} $options An associative array of parameters, containing:
* @param {string} [$options.userId]
* The user's id. Defaults to id of the logged-in user, if any.
* Can be '' for a blank-looking avatar.
* @param {boolean} [options.short]
* Optional. Renders the short version of the display name.
* @param {boolean|integer} [options.icon=false]
* Optional. Pass the size in pixels of the (square) icon to render
* before the username. Or pass true to render the default size.
* @param {array} [options.iconAttributes]
* Optional. Array of attributes to render for the icon.
* @param {boolean|array} [options.editable=false]
* Optional. Whether to provide an interface for editing the user's info. Can be array containing one or more of "icon", "name".
* @param {boolean} [$options.show] The parts of the name to show. Can have the letters "f", "l", "u" in any order.
* @param {boolean} [options.cacheBust=null]
* Number of milliseconds to use for Q_Uri::cacheBust for combating unintended caching on some environments.
* @param {boolean} [options.renderOnClient]
* If true, only the html container is rendered, so the client will do the rest.
*/
function Users_avatar_tool($options)
{
$defaults = array('icon' => false, 'short' => false, 'cacheBust' => null, 'editable' => false);
$options = array_merge($defaults, $options);
Q_Response::addStylesheet('plugins/Users/css/Users.css');
$loggedInUser = Users::loggedInUser();
$loggedInUserId = $loggedInUser ? $loggedInUser->id : "";
if (empty($options['userId'])) {
$options['userId'] = $loggedInUserId;
}
unset($options['iconAttributes']);
if (empty($options['editable'])) {
$options['editable'] = array();
} else {
if (is_string($options['editable'])) {
$options['editable'] = array($options['editable']);
} else {
if ($options['editable'] === true) {
$options['editable'] = array('icon', 'name');
}
}
}
Q_Response::setToolOptions($options);
if (!empty($options['renderOnClient'])) {
return '';
}
$avatar = Streams_Avatar::fetch($loggedInUserId, $options['userId']);
if (!$avatar) {
return '';
}
$result = '';
if ($icon = $options['icon']) {
if ($icon === true) {
$icon = Q_Config::get('Users', 'icon', 'defaultSize', 40);
}
$attributes = isset($options['iconAttributes']) ? $options['iconAttributes'] : array();
$class = "Users_avatar_icon Users_avatar_icon_{$icon}";
$attributes['class'] = isset($attributes['class']) ? $attributes['class'] . ' ' . $class : $class;
if (isset($options['cacheBust'])) {
$attributes['cacheBust'] = $options['cacheBust'];
}
$result .= Q_Html::img(Users::iconUrl($avatar->icon, "{$icon}.png"), 'user icon', $attributes);
}
$o = $options['short'] ? array('short' => true) : array();
$o['html'] = true;
if (in_array('name', $options['editable'])) {
$o['show'] = 'fl';
$streams = Streams::fetch(null, $options['userId'], array('Streams/user/firstName', 'Streams/user/lastName', 'Streams/user/username'));
foreach ($streams as $s) {
$s->addPreloaded();
}
}
if (!empty($options['show'])) {
$o['show'] = $options['show'];
}
$displayName = $avatar->displayName($o, 'Someone');
$result .= "<span class='Users_avatar_name'>{$displayName}</span>";
return $result;
}
示例3: Q_columns_tool
/**
* This tool contains functionality to show things in columns
* @class Q columns
* @constructor
* @param {array} [options] Provide options for this tool
* @param {array} [options.animation] For customizing animated transitions
* @param {integer} [options.animation.duration] The duration of the transition in milliseconds, defaults to 500
* @param {array} [options.animation.hide] The css properties in "hide" state of animation
* @param {array} [options.animation.show] The css properties in "show" state of animation
* @param {array} [options.back] For customizing the back button on mobile
* @param {string} [options.back.src] The src of the image to use for the back button
* @param {boolean} [options.back.triggerFromTitle] Whether the whole title would be a trigger for the back button. Defaults to true.
* @param {boolean} [options.back.hide] Whether to hide the back button. Defaults to false, but you can pass true on android, for example.
* @param {array} [options.close] For customizing the back button on desktop and tablet
* @param {string} [options.close.src] The src of the image to use for the close button
* @param {string} [options.title] You can put a default title for all columns here (which is shown as they are loading)
* @param {string} [options.column] You can put a default content for all columns here (which is shown as they are loading)
* @param {array} [options.clickable] If not null, enables the Q/clickable tool with options from here. Defaults to null.
* @param {array} [options.scrollbarsAutoHide] If not null, enables Q/scrollbarsAutoHide functionality with options from here. Enabled by default.
* @param {boolean} [options.fullscreen] Whether to use fullscreen mode on mobile phones, using document to scroll instead of relying on possibly buggy "overflow" CSS implementation. Defaults to true on Android, false everywhere else.
* @param {array} [options.columns] In PHP only, an array of $name => $column pairs, where $column is in the form array('title' => $html, 'content' => $html, 'close' => true)
* @return {string}
*/
function Q_columns_tool($options)
{
$jsOptions = array('animation', 'back', 'close', 'title', 'scrollbarsAutoHide', 'fullscreen');
Q_Response::setToolOptions(Q::take($options, $jsOptions));
if (!isset($options['columns'])) {
return '';
}
Q_Response::addScript('plugins/Q/js/tools/columns.js');
Q_Response::addStylesheet('plugins/Q/css/columns.css');
$result = '<div class="Q_columns_container Q_clearfix">';
$columns = array();
$i = 0;
$closeSrc = Q::ifset($options, 'close', 'src', 'plugins/Q/img/x.png');
$backSrc = Q::ifset($options, 'back', 'src', 'plugins/Q/img/back-v.png');
foreach ($options['columns'] as $name => $column) {
$close = Q::ifset($column, 'close', $i > 0);
$Q_close = Q_Request::isMobile() ? 'Q_close' : 'Q_close Q_back';
$closeHtml = !$close ? '' : (Q_Request::isMobile() ? '<div class="Q_close Q_back">' . Q_Html::img($backSrc, 'Back') . '</div>' : '<div class="Q_close">' . Q_Html::img($closeSrc, 'Close') . '</div>');
$n = Q_Html::text($name);
$columnClass = 'Q_column_' . Q_Utils::normalize($name) . ' Q_column_' . $i;
if (isset($column['html'])) {
$html = $column['html'];
$columns[] = <<<EOT
\t<div class="Q_columns_column {$columnClass}" data-index="{$i}" data-name="{$n}">
\t\t{$html}
\t</div>
EOT;
} else {
$titleHtml = Q::ifset($column, 'title', '[title]');
$columnHtml = Q::ifset($column, 'column', '[column]');
$classes = $columnClass . ' ' . Q::ifset($column, 'class', '');
$attrs = '';
if (isset($column['data'])) {
$json = Q::json_encode($column['data']);
$attrs = 'data-more="' . Q_Html::text($json) . '"';
foreach ($column['data'] as $k => $v) {
$attrs .= 'data-' . Q_Html::text($k) . '="' . Q_Html::text($v) . '" ';
}
}
$data = Q::ifset($column, 'data', '');
$columns[] = <<<EOT
\t<div class="Q_columns_column {$classes}" data-index="{$i}" data-name="{$n}" {$attrs}>
\t\t<div class="Q_columns_title">
\t\t\t{$closeHtml}
\t\t\t<h2 class="Q_title_slot">{$titleHtml}</h2>
\t\t</div>
\t\t<div class="Q_column_slot">{$columnHtml}</div>
\t</div>
EOT;
}
++$i;
}
$result .= "\n" . implode("\n", $columns) . "\n</div>";
return $result;
}
示例4: Users_getintouch_tool
/**
* This tool renders ways to get in touch
*
* @param array [$options] An associative array of options, containing:
* @param {string|Users_User} [$options.user] Required. The user object or id of the user exposing their primary identifiers for getting in touch.
* @param {boolean|string} [$options.email] Pass true here to use the primary verified email address, if any. Or pass the string label for this button.
* @param {string} [$options.emailSubject] Fill this if you want the email subject to be automatically filled in
* @param {string} [$options.emailBody] Fill this if you want the email body to be automatically filled in
* @param {boolean|string} [$options.sms] Pass true here to allow texting the primary verified mobile number, if any. Or pass the string label for this button.
* @param {boolean|string} [$options.call] Pass true here to allow calling the primary verified mobile number, if any. Or pass the string label for this button.
* @param {string} [$options.tag] The type of tag to use, defaults to "button"
* @param {string} [$options.class] Any classes to add to the tags
* @param {string} [$options.between] Any HTML to put between the elements
*/
function Users_getintouch_tool($options)
{
$tag = 'button';
$class = null;
$between = '';
$user = null;
$emailSubject = '';
$emailBody = '';
extract($options, EXTR_IF_EXISTS);
if (!$user) {
throw new Q_Exception_RequiredField(array('field' => 'user'));
}
if (is_string($user)) {
$userId = $user;
$user = Users_User::fetch($userId);
if (!$user) {
throw new Q_Exception_MissingRow(array('table' => 'user', 'criteria' => "id={$userId}"));
}
}
$ways = array();
$email = $sms = $call = false;
if (!empty($options['email']) and $user->emailAddress) {
$email = is_string($options['email']) ? $options['email'] : "Email me";
$email = Q_Html::img("plugins/Users/img/email.png") . $email;
$ways['email'] = Q_Html::tag($tag, array('id' => 'email', 'class' => $class), $email);
Q_Response::setToolOptions(array('emailAddress' => Q_Utils::obfuscate($user->emailAddress), 'emailSubject' => Q_Utils::obfuscate($emailSubject), 'emailBody' => Q_Utils::obfuscate($emailBody)));
}
if (Q_Request::isMobile()) {
$obfuscated_mobileNumber = Q_Utils::obfuscate($user->mobileNumber);
if (!empty($options['sms']) and $user->mobileNumber) {
$sms = is_string($options['sms']) ? $options['sms'] : "Text me";
$sms = Q_Html::img("plugins/Users/img/sms.png") . $sms;
$ways['sms'] = Q_Html::tag($tag, array('id' => 'sms', 'class' => $class), $sms);
Q_Response::setToolOptions(array('mobileNumber' => $obfuscated_mobileNumber));
}
if (!empty($options['call']) and $user->mobileNumber) {
$call = is_string($options['call']) ? $options['call'] : "Call me";
$call = Q_Html::img("plugins/Users/img/call.png") . $call;
$ways['call'] = Q_Html::tag($tag, array('id' => 'call', 'class' => $class), $call);
Q_Response::setToolOptions(array('mobileNumber' => $obfuscated_mobileNumber));
}
}
return implode($between, $ways);
}
示例5: array
<div id="content">
<div id="Users_authorize_welcome">
<div>
Welcome to
</div>
<div>
<?php
echo Q_Html::img($client->iconUrl('80.png'), 'user icon', array('class' => 'Users_app_icon'));
?>
<span class="Users_app_name"><?php
echo $client->username;
?>
</span>
</div>
</div>
<div id="Users_authorize_act" class="Q_big_prompt">
<?php
if ($user) {
?>
<form action="" method="post">
<?php
if ($terms_label) {
?>
<div id="Users_authorize_terms">
<input type="checkbox" name="agree" id="Users_agree" value="yes">
<label for="Users_agree"><?php
echo $terms_label;
?>
</label>
</div>
<?php
示例6: array
<div class="explanation">
<?php
echo Q_Html::img('img/photo.jpg');
?>
<span>+</span>
<?php
echo Q_Html::img('img/flag.jpg');
?>
<span>→</span>
<?php
echo Q_Html::img('img/result.jpg');
?>
</div>
<div class="login">
<?php
echo Q_Html::img('img/facebook.png', 'login with facebook', array('id' => 'login', 'class' => 'Q_clickable Overlay_login'));
?>
</div>
<div class="section counter">
<?php
echo $counter + 4000;
?>
people have customized their photo
</div>
<div class="videoArea">
<iframe width="560" height="315" src="https://www.youtube.com/embed/2amNdUzhldM?rel=0&controls=0&showinfo=0" frameborder="0" allowfullscreen></iframe>
</div>
</div>
示例7: TODO
TODO (DT): this is tmp commented because of new code for SmartApp; maybe to be removed later
Participants:
<?php foreach ($avatars as $a): ?>
<?php echo $a->username ?>,
<?php endforeach ?>
*/
?>
<div class="Streams_participant_list_wrapper">
<ul class="Streams_participant_list">
<li>
<div class="Streams_participant_subscribed_icon"></div><br />
<span>Subscribed</span>
</li>
<?php
foreach ($participants as $p) {
?>
<li>
<?php
echo Q_Html::img($p['avatar']);
?>
<br />
<span><?php
echo $p['name'];
?>
</span>
</li>
<?php
}
?>
</ul>
</div>
示例8: compact
<div id="content">
<div class='Streams_stream_info_pane'>
<?php
if ($stream->icon) {
?>
<div class='Streams_stream_icon'>
<?php
echo Q_Html::img($stream->iconUrl('80.png'));
?>
</div>
<?php
}
?>
<div class='Streams_stream_title'>
<?php
echo Q_Html::text($stream->title);
?>
</div>
<div class='Streams_stream_player'>
<?php
echo Q::tool('Streams/player', compact('stream'));
?>
</div>
</div>
<div class='Streams_stream_activity_pane'>
<div class='Streams_participants'>
<?php
echo Q::tool('Streams/participants', compact('stream'));
?>
</div>
<div class='Streams_stream_activity'>
示例9: Streams_participants_tool
/**
* This tool renders the participants in a stream
* @class Streams participants
* @constructor
* @param {array} [options] Provide options for this tool
* @param {string} [options.publisherId] The id of the publisher
* @required
* @param {string} [options.streamName] The name of the stream
* @required
* @param {string} [options.stream] You can pass this instead of publisherId and streamName
* @param {integer} [options.max]
* The number, if any, to show in the denominator of the summary
* @optional
* @param {integer} [options.maxShow]
* The maximum number of participants to fetch for display
* @optional
* @default 10
* @param {Q.Event} [options.onRefresh] An event that occurs when the tool is refreshed
* @optional
* @param {boolean} [options.renderOnClient]
* If true, only the html container is rendered, so the client will do the rest.
* @optional
*/
function Streams_participants_tool($options)
{
if (!empty($options['renderOnClient'])) {
Q_Response::setToolOptions($options);
return '';
}
$publisherId = Q::ifset($options, 'publisherId', null);
$streamName = Q::ifset($options, 'streamName', null);
if (!empty($options['stream'])) {
$stream = $options['stream'];
$publisherId = $stream->publisherId;
$streamName = $stream->name;
unset($options['stream']);
}
if (!isset($publisherId)) {
$publisherId = Streams::requestedPublisherId(true);
}
if (!isset($streamName)) {
$streamName = Streams::requestedName(true);
}
$options['publisherId'] = $publisherId;
$options['streamName'] = $streamName;
$max = Q_Config::get('Streams', 'participants', 'max', Q::ifset($options, 'max', 10));
if (!$stream) {
$stream = Streams::fetchOne(null, $publisherId, $streamName);
}
if (empty($stream)) {
throw new Q_Exception_MissingRow(array('table' => 'Stream', 'criteria' => "{publisherId: '{$publisherId}', name: '{$streamName}'}"));
}
if (!$stream->testReadLevel('participants')) {
throw new Users_Exception_NotAuthorized();
}
$participants = $stream->getParticipants(compact('limit', 'offset', 'state'));
Q_Response::addScript('plugins/Streams/js/Streams.js');
Q_Response::addStylesheet('plugins/Streams/css/Streams.css');
$options['rendered'] = true;
Q_Response::setToolOptions($options);
$stream->addPreloaded();
$avatars = '';
$c = 0;
if ($participants) {
$i = 0;
foreach ($participants as $p) {
if ($p->state !== 'participating') {
continue;
}
++$c;
if (empty($options['maxShow']) or ++$i <= $options['maxShow']) {
$avatars .= Q::tool("Users/avatar", array('userId' => $p->userId, 'icon' => true, 'short' => true), $p->userId);
}
}
}
$spans = "<span class='Streams_participants_avatars'>{$avatars}</span>" . "<span class='Streams_participants_blanks'></span>";
$container = "<div class='Streams_participants_container'>{$spans}</div>";
$count = "<span class='Streams_participants_count'>{$c}</span>";
$m = isset($options['max']) ? '/' . $options['max'] : '';
$max = "<span class='Streams_participants_max'>{$m}</span>";
$img = Q_Html::img('plugins/Q/img/expand.png', 'expand', array('class' => 'Streams_participants_expand_img'));
$control = "<div class='Streams_participants_expand'>{$img}<span class='Streams_participants_expand_text'>See All</span></div>";
$summary = "<div class='Streams_participants_summary'><span>{$count}{$max}</span></div>";
$controls = "<div class='Streams_participants_controls'>{$control}</div>";
return $controls . $summary . $container;
}
示例10: array
?>
<?php
if ($passphrase_set) {
?>
<div class='Q_login 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));
?>
<?php
echo Q::tool('Q/form', array('fields' => array('passphrase' => array('label' => 'Enter your passphrase:', 'extra' => Q_Html::img($thumbnail_url, 'icon', array('title' => "You can change this later")), 'type' => 'password'), 'submit' => array('type' => 'submit_buttons', 'options' => array('join' => 'Join the chat'), 'label' => ''))));
?>
<?php
echo Q_Html::script("\n\t\t\t\t\t\t\$('#Q_form_passphrase').focus();\n\t\t\t\t\t");
?>
</form>
</div>
<?php
} else {
?>
<h2 class='notice' style='text-align: center'>
Before you can log in, you must set a pass phrase by clicking the link in the message we sent to
<?php
echo Q_Html::text($address);
?>
</h2>
示例11: array
<div class="Places_location_container Places_location_checking">
I'm interested in things taking place within
<?php
echo Q_Html::select('miles', array('class' => 'Places_location_miles'));
?>
<?php
echo Q_Html::options($miles, 'miles', $defaultMiles);
?>
</select>
of
<div class="Places_location_whileObtaining">
<?php
echo Q_Html::img($map['prompt'], 'map', array('class' => 'Places_location_set '));
?>
</div>
<div class="Places_location_whileObtained">
<div class="Places_location_map_container">
<div class="Places_location_map"></div>
</div>
<div class="Places_location_update Places_location_whileObtained">
<button class="Places_location_update_button Q_button">
Update my location
</button>
</div>
</div>
</div>
示例12: array
echo $src;
?>
"><?php
echo Q_Html::text($title);
?>
</option>
<?php
}
?>
</select>
<div id="preview">
<?php
echo Q_Html::img('', 'background', array('id' => 'background', 'crossorigin' => 'anonymous'));
?>
<?php
echo Q_Html::img($firstCountrySrc, 'foreground', array('id' => 'foreground'));
?>
</div>
</div>
<div class="buttons">
<label for="opacity">Opacity:</label>
<select id="opacity">
<?php
for ($f = 0.1; $f < 0.9; $f += 0.1) {
?>
<option value="<?php
echo $f;
?>
" <?php
if ($f === 0.5) {
echo 'selected="selected"';
示例13:
<div id="Q_dashboard_item_login" class="Q_dashboard_item Q_login Q_dialog_trigger">
<?php
echo Q_Html::img($icon) . "<span>{$label}</span>";
?>
</div>
<div class="Q_dashboard_expandable"></div>
示例14: array
<div id='dashboard'>
<div id="callUs">
<i class="fa fa-phone-square" style="font-size: 30px; color: #34ccff; position: relative; top: 5px;"></i>
<span>CALL : (212) 434-0067</span>
</div>
<h1 class="Shipping_logo">
<?php
echo Q_Html::img('img/logo/main-logo.png', 'Encompass Shipping');
?>
</h1>
<?php
echo Q::tool('Q/tabs', array('vertical' => !Q_Request::isMobile(), 'overflow' => '{{html}}', 'compact' => true, 'tabs' => $tabs, 'urls' => $urls, 'classes' => $classes));
?>
<div id="dashboard_user">
<?php
if ($user) {
?>
<?php
echo Q::tool("Users/avatar", array('userId' => $user->id, 'icon' => 50, 'short' => true), 'dashboard');
?>
<?php
} else {
?>
<a href="#login" class="Shipping_login">log in</a>
<?php
}
?>
<div id="dashboard_user_contextual" class="Q_contextual" data-handler="Shipping.userContextual">
<ul class="Q_listing">
示例15: array
<div id='dashboard'>
<h1><?php
echo Q_Html::img("img/logo.png", 'Trump Village ESTATES', array('class' => 'Trump_logo'));
?>
</h1>
<div id="dashboard_user">
<?php
if ($user) {
?>
<?php
echo Q::tool("Users/avatar", array('userId' => $user->id, 'icon' => true, 'short' => true));
?>
<?php
} else {
?>
<a href="#login" class="Trump_login">log in</a>
<?php
}
?>
<div id="dashboard_user_contextual" class="Q_contextual" data-handler="Trump.userContextual">
<ul class="Q_listing">
<?php
if ($user) {
?>
<?php
if (!$user->mobileNumber) {
?>
<li data-action="setIdentifier">set mobile number</li>
<?php
} elseif (!$user->emailAddress) {