本文整理汇总了PHP中Image::getHtml方法的典型用法代码示例。如果您正苦于以下问题:PHP Image::getHtml方法的具体用法?PHP Image::getHtml怎么用?PHP Image::getHtml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Image
的用法示例。
在下文中一共展示了Image::getHtml方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generate
/**
* Return if there are no files
*
* @return string
*/
public function generate()
{
if ($this->playerSRC == '') {
return '';
}
$source = \StringUtil::deserialize($this->playerSRC);
if (!is_array($source) || empty($source)) {
return '';
}
$objFiles = \FilesModel::findMultipleByUuidsAndExtensions($source, array('mp4', 'm4v', 'mov', 'wmv', 'webm', 'ogv', 'm4a', 'mp3', 'wma', 'mpeg', 'wav', 'ogg'));
if ($objFiles === null) {
return '';
}
// Display a list of files in the back end
if (TL_MODE == 'BE') {
$return = '<ul>';
while ($objFiles->next()) {
$objFile = new \File($objFiles->path);
$return .= '<li>' . \Image::getHtml($objFile->icon, '', 'class="mime_icon"') . ' <span>' . $objFile->name . '</span> <span class="size">(' . $this->getReadableSize($objFile->size) . ')</span></li>';
}
return $return . '</ul>';
}
$this->objFiles = $objFiles;
return parent::generate();
}
示例2: run
/**
* Generate the module
*
* @return string
*/
public function run()
{
/** @var \BackendTemplate|object $objTemplate */
$objTemplate = new \BackendTemplate('be_live_update');
$objTemplate->updateClass = 'tl_confirm';
$objTemplate->updateHeadline = $GLOBALS['TL_LANG']['tl_maintenance']['liveUpdate'];
$objTemplate->isActive = $this->isActive();
$strMessage = ' <a href="contao/changelog.php" onclick="Backend.openModalIframe({\'width\':860,\'title\':\'CHANGELOG\',\'url\':this.href});return false" title="' . specialchars($GLOBALS['TL_LANG']['tl_maintenance']['changelog']) . '">' . \Image::getHtml('changelog.gif', '', 'style="vertical-align:text-bottom;padding-left:3px"') . '</a>';
// Newer version available
if (\Config::get('latestVersion') && version_compare(VERSION . '.' . BUILD, \Config::get('latestVersion'), '<')) {
$objTemplate->updateClass = 'tl_info';
$objTemplate->updateMessage = sprintf($GLOBALS['TL_LANG']['tl_maintenance']['newVersion'], \Config::get('latestVersion')) . $strMessage;
} else {
$objTemplate->updateClass = 'tl_confirm';
$objTemplate->updateMessage = sprintf($GLOBALS['TL_LANG']['tl_maintenance']['upToDate'], VERSION . '.' . BUILD) . $strMessage;
}
// Automatically switch to SSL
if (\Environment::get('ssl')) {
\Config::set('liveUpdateBase', str_replace('http://', 'https://', \Config::get('liveUpdateBase')));
}
$objTemplate->uid = \Config::get('liveUpdateId');
$objTemplate->updateServer = \Config::get('liveUpdateBase') . 'index.php';
// Run the update
if (\Input::get('token') != '') {
$this->runLiveUpdate($objTemplate);
}
$objTemplate->version = VERSION . '.' . BUILD;
$objTemplate->liveUpdateId = $GLOBALS['TL_LANG']['tl_maintenance']['liveUpdateId'];
$objTemplate->runLiveUpdate = specialchars($GLOBALS['TL_LANG']['tl_maintenance']['runLiveUpdate']);
$objTemplate->referer = base64_encode(\Environment::get('base') . \Environment::get('request') . '|' . \Environment::get('server'));
$objTemplate->updateHelp = sprintf($GLOBALS['TL_LANG']['tl_maintenance']['updateHelp'], '<a href="https://update.contao.org" target="_blank">Live Update ID</a>');
$objTemplate->phar = file_exists(TL_ROOT . '/contao/update.phar.php');
$objTemplate->toLiveUpdate = $GLOBALS['TL_LANG']['tl_maintenance']['toLiveUpdate'];
return $objTemplate->parse();
}
示例3: compile
/**
* Generate the module
*/
protected function compile()
{
$intList = $this->athletes_group;
$objMembers = $this->Database->prepare("SELECT * FROM tl_athlete WHERE published=1 AND pid=? ORDER BY sorting")->execute($intList);
//$objMembers = \MembersModel;
// Return if no Members were found
if (!$objMembers->numRows) {
return;
}
$strLink = '';
// Generate a jumpTo link
if ($this->jumpTo > 0) {
$objJump = \PageModel::findByPk($this->jumpTo);
if ($objJump !== null) {
$strLink = $this->generateFrontendUrl($objJump->row(), $GLOBALS['TL_CONFIG']['useAutoItem'] ? '/%s' : '/items/%s');
}
}
$arrMembers = array();
// Generate Members
while ($objMembers->next()) {
$strPhoto = '';
$objPhoto = \FilesModel::findByPk($objMembers->photo);
// Add photo image
if ($objPhoto !== null) {
$strPhoto = \Image::getHtml(\Image::get($objPhoto->path, '140', '187', 'center_center'));
}
$arrMembers[] = array('name' => $objMembers->name, 'family' => $objMembers->family, 'post' => $objMembers->post, 'joined' => $objMembers->joined, 'photo' => $strPhoto, 'link' => strlen($strLink) ? sprintf($strLink, $objMembers->alias) : '');
}
$this->Template->members = $arrMembers;
}
示例4: editArticles
public function editArticles($row, $href, $label, $title, $icon)
{
if (!$this->User->hasAccess('article', 'modules')) {
return '';
}
return $row['type'] == 'regular' || $row['type'] == 'login' || $row['type'] == 'error_403' || $row['type'] == 'error_404' ? '<a href="' . $this->addToUrl($href . '&pn=' . $row['id']) . '" title="' . specialchars($title) . '">' . Image::getHtml($icon, $label) . '</a> ' : Image::getHtml(preg_replace('/\\.gif$/i', '_.gif', $icon)) . ' ';
}
示例5: generateWizardList
/**
* @param \Database_Result $records
* @param string $id
* @param \DcaWizard $dcaWizard
*
* @return string
*/
public function generateWizardList($records, $id, $dcaWizard)
{
$return = '';
$rows = $dcaWizard->getRows($records);
// Alter the rows
\System::loadLanguageFile('tl_iso_product_collection');
$rows = array_map(function ($row) {
// Force an algebraic sign for quantity
$row['quantity'] = sprintf('%+d', $row['quantity']);
// Make referenced product collection editable in a popup
$row['product_collection_id'] = $row['product_collection_id'] ? sprintf('<a href="contao/main.php?do=iso_orders&act=edit&id=%1$u&popup=1&nb=1&rt=%4$s" title="%3$s" onclick="Backend.openModalIframe({\'width\':768,\'title\':\'%3$s\',\'url\':this.href});return false">%2$s</a>', $row['product_collection_id'], \Image::getHtml('edit.gif') . $row['product_collection_id'], sprintf($GLOBALS['TL_LANG']['tl_iso_product_collection']['edit'][1], $row['product_collection_id']), REQUEST_TOKEN) : '-';
return $row;
}, $rows);
if ($rows) {
$template = new \BackendTemplate('be_widget_dcawizard');
$template->headerFields = $dcaWizard->getHeaderFields();
$template->hasRows = !empty($rows);
$template->rows = $rows;
$template->fields = $dcaWizard->fields;
$template->showOperations = $dcaWizard->showOperations;
if ($dcaWizard->showOperations) {
$template->operations = $dcaWizard->getActiveRowOperations();
}
$template->generateOperation = function ($operation, $row) use($dcaWizard) {
return $dcaWizard->generateRowOperation($operation, $row);
};
$dom = new \DOMDocument('1.0', 'utf-8');
$dom->loadHTML($template->parse());
$return = $dom->saveHTML($dom->getElementsByTagName('table')->item(0));
}
// Add the member's total bonus points
$return .= sprintf('<strong style="display: inline-block; margin: 4px 0 2px 6px; border-bottom: 3px double">%s</strong>', Stock::getStockForProduct($dcaWizard->currentRecord));
return $return;
}
示例6: pagePicker
/**
* Generate the page picker.
*
* @param \DataContainer $dataContainer The data container driver.
*
* @return string
*
* @SuppressWarnings(PHPMD.Superglobals)
*/
public function pagePicker(\DataContainer $dataContainer)
{
$template = ' <a href="contao/page.php?do=%s&table=%s&field=%s&value=%s" title="%s"';
$template .= ' onclick="Backend.getScrollOffset();Backend.openModalSelector({\'width\':765,\'title\':\'%s\'';
$template .= ',\'url\':this.href,\'id\':\'%s\',\'tag\':\'ctrl_%s\',\'self\':this});return false">%s</a>';
return sprintf($template, \Input::get('do'), $dataContainer->table, $dataContainer->field, str_replace(array('{{link_url::', '}}'), '', $dataContainer->value), specialchars($GLOBALS['TL_LANG']['MSC']['pagepicker']), specialchars(str_replace("'", "\\'", $GLOBALS['TL_LANG']['MOD']['page'][0])), $dataContainer->field, $dataContainer->field . (\Input::get('act') == 'editAll' ? '_' . $dataContainer->id : ''), \Image::getHtml('pickpage.gif', $GLOBALS['TL_LANG']['MSC']['pagepicker'], 'style="vertical-align:top;cursor:pointer"'));
}
示例7: getLabel
/**
* Generate the label.
*
* @param array $row The current row.
* @param string $label The default label.
*
* @return string
* @SuppressWarnings(PHPMD.Superglobals)
*/
public function getLabel($row, $label)
{
if ($row['backend'] && $row['frontend']) {
$label = 'BE+FE ' . $label;
} elseif ($row['backend']) {
$label = 'BE ' . $label;
} elseif ($row['frontend']) {
$label = 'FE ' . $label;
} else {
$label = \Image::getHtml('system/themes/' . $this->getTheme() . '/images/invisible.gif', '');
}
list($group, $path) = explode('::', $row['langvar'], 2);
$path = $this->formatPath($group, $path);
if (empty($GLOBALS['TL_TRANSLATION'][$group][$path]['label'])) {
$label .= ' <strong>' . $path . '</strong>';
} else {
$label .= ' <strong>' . $GLOBALS['TL_TRANSLATION'][$group][$path]['label'] . '</strong>';
}
$varContent = deserialize($row['content']);
if (!$varContent) {
$varContent = $row['content'];
}
if (is_array($varContent)) {
$label .= '<pre class="translation_content">– ';
$label .= implode('<br>– ', array_map(array($this->languageEditor, 'plainEncode'), $varContent));
$label .= '</pre>';
return $label;
} else {
$label .= '<pre class="translation_content">' . $this->languageEditor->plainEncode($varContent) . '</pre>';
}
return $label;
}
示例8: staticPagePicker
public static function staticPagePicker(array $arrData)
{
$strTitle = specialchars($GLOBALS['TL_LANG']['MSC']['pagepicker']);
$onClick = "Backend.getScrollOffset();Backend.openModalSelector({'width':765,'title':'" . specialchars(str_replace("'", "\\'", $GLOBALS['TL_LANG']['MOD']['page'][0])) . "','url':this.href,'id':'" . $arrData['field'] . "','tag':'ctrl_" . $arrData['field'] . (\Input::get('act') == 'editAll' ? '_' . $arrData['id'] : '') . "','self':this});return false";
$strImage = \Image::getHtml('pickpage.gif', $GLOBALS['TL_LANG']['MSC']['pagepicker'], 'style="vertical-align:top;cursor:pointer"');
return ' <a href="contao/page.php?do=' . \Input::get('do') . '&table=' . $arrData['table'] . '&field=' . $arrData['field'] . '&value=' . str_replace(array('{{link_url::', '}}'), '', $arrData['value']) . '" title="' . $strTitle . '" onclick="' . $onClick . '">' . $strImage . '</a>';
}
示例9: generateRendererButton
/**
* Generate the metamodels renderer button.
*
* @param array $row Current row.
* @param string $href The button href.
* @param string $label The button label.
* @param string $title The button title.
* @param string $icon The button icon.
* @param string $attributes Optional attributes.
*
* @return string
*/
public function generateRendererButton($row, $href, $label, $title, $icon, $attributes)
{
if (empty($this->layers[$row['type']]['metamodels'])) {
return '';
}
return sprintf('<a href="%s" title="%s">%s</a> ', \Backend::addToUrl($href . '&id=' . $row['id']), $title, \Image::getHtml($icon, $label, $attributes));
}
示例10: generate
/**
* Generate the widget and return it as string
*
* @return string
*/
public function generate()
{
$arrButtons = array('copy', 'delete', 'drag');
// Make sure there is at least an empty array
if (!is_array($this->varValue) || empty($this->varValue)) {
$this->varValue = array('');
}
// Initialize the tab index
if (!\Cache::has('tabindex')) {
\Cache::set('tabindex', 1);
}
$return = '<ul id="ctrl_' . $this->strId . '" class="tl_listwizard">';
// Add input fields
for ($i = 0, $c = count($this->varValue); $i < $c; $i++) {
$return .= '
<li><input type="text" name="' . $this->strId . '[]" class="tl_text" value="' . \StringUtil::specialchars($this->varValue[$i]) . '"' . $this->getAttributes() . '> ';
// Add buttons
foreach ($arrButtons as $button) {
if ($button == 'drag') {
$return .= ' <button type="button" class="drag-handle" title="' . \StringUtil::specialchars($GLOBALS['TL_LANG']['MSC']['move']) . '">' . \Image::getHtml('drag.svg') . '</button>';
} else {
$return .= ' <button type="button" data-command="' . $button . '" title="' . \StringUtil::specialchars($GLOBALS['TL_LANG']['MSC']['lw_' . $button]) . '">' . \Image::getHtml($button . '.svg') . '</button>';
}
}
$return .= '</li>';
}
return $return . '
</ul>
<script>Backend.listWizard("ctrl_' . $this->strId . '")</script>';
}
示例11: generate
public function generate($row, $href, $label, $title, $icon, $attributes)
{
$href .= '&id=' . $row['id'];
if ($row['type'] == 'module') {
return '<a href="' . $this->addToUrl($href) . '" title="' . specialchars($title) . '"' . $attributes . '>' . Image::getHtml($icon, $label) . '</a> ';
}
}
示例12: generateItemRow
/**
* Generate a song row and return it as HTML string
* @param array
* @return string
*/
public function generateItemRow($arrRow)
{
$objImage = \FilesModel::findByPk($arrRow['singleSRC']);
if ($objImage !== null) {
$strImage = \Image::getHtml(\Image::get($objImage->path, '30', '30', 'center_center'));
}
return '<div><div style="float:left; margin-right:10px;">' . $strImage . '</div>' . $arrRow['title'] . '</div>';
}
示例13: generateActRow
public function generateActRow($arrRow)
{
$objImage = \FilesModel::findByPk($arrRow['singleSRC']);
if ($objImage !== null) {
$strImage = \Image::getHtml(\Image::get($objImage->path, '25', '33', 'center_center'));
}
return '<div><div style="float:left; margin-right:10px;">' . $strImage . '</div>' . $arrRow['title'] . ' <br /><span style="padding-left:3px;color:#b3b3b3;">[' . $arrRow['post'] . ']</span></div>';
}
示例14: addTypeIcon
public function addTypeIcon($row, $label, DataContainer $dc, $args = null)
{
$args[0] = \Image::getHtml(\Image::get('system/modules/mail_to/assets/mail-open-image.png', 16, 16));
$objFile = FilesModel::findByUuid($row['folder']);
$args[2] = $objFile !== null ? $objFile->path : '-';
$args[5] = Date::parse(Date::getFormatFromRgxp('datim'), $row['lastrun']);
return $args;
}
示例15: generateButton
/**
* Generate the clear cache button.
*
* @param array $row The data row.
* @param string $href The link.
* @param string $label The label.
* @param string $title The title.
* @param string $icon The icon.
* @param string $attributes The attributes.
*
* @return string
*/
public function generateButton($row, $href, $label, $title, $icon, $attributes)
{
$count = $this->service()->countPageCacheEntries($row['id']);
if (!$count) {
return \Image::getHtml($icon, $label, 'style="opacity:0.5;filter: gray;-webkit-filter: grayscale(100%);"');
}
return sprintf('<a href="%s" title="%s"%s>%s</a> ', \Backend::addToUrl($href . '&id=' . $row['id']), $title . sprintf($GLOBALS['TL_LANG']['tl_page']['clearCacheCount'], $count), $attributes, \Image::getHtml($icon, $label));
}