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


PHP CHtml::image方法代码示例

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


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

示例1: renderButton

 /**
  * Render the link or ajax link
  * @param string $id the ID of the button
  * @param array $button the button configuration which may contain 'label', 'url', 'imageUrl' and 'options' elements.
  * See {@link buttons} for more details.
  * @param integer $row the row number (zero-based)
  * @param mixed $data the data object associated with the row
  */
 protected function renderButton($id, $button, $row, $data)
 {
     if (isset($button['visible']) && !$this->evaluateExpression($button['visible'], array('row' => $row, 'data' => $data))) {
         return;
     }
     $label = isset($button['label']) ? $button['label'] : $id;
     if (isset($button['url'])) {
         $url = $this->evaluateExpression($button['url'], array('data' => $data, 'row' => $row));
         // Not Coding Standard
     } else {
         $url = '#';
     }
     $options = isset($button['options']) ? $button['options'] : array();
     if (!isset($options['title'])) {
         $options['title'] = $label;
     }
     if (isset($button['ajaxOptions'])) {
         unset($options['ajaxOptions']);
         echo ZurmoHtml::ajaxLink($label, $url, $button['ajaxOptions'], $options);
     } else {
         if (isset($button['imageUrl']) && is_string($button['imageUrl'])) {
             echo ZurmoHtml::link(CHtml::image($button['imageUrl'], $label), $url, $options);
         } else {
             echo ZurmoHtml::link($label, $url, $options);
         }
     }
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:35,代码来源:ButtonColumn.php

示例2: renderButton

 /**
  * Renders a link button.
  * @param string $id the ID of the button
  * @param array $button the button configuration which may contain 'label', 'url', 'imageUrl' and 'options' elements.
  * @param integer $row the row number (zero-based)
  * @param mixed $data the data object associated with the row
  */
 protected function renderButton($id, $button, $row, $data)
 {
     if (isset($button['visible']) && !$this->evaluateExpression($button['visible'], array('row' => $row, 'data' => $data))) {
         return;
     }
     $url = \bootstrap\helpers\BSArray::popValue('url', $button, '#');
     if (strcmp($url, '#') !== 0) {
         $url = $this->evaluateExpression($url, array('data' => $data, 'row' => $row));
     }
     $imageUrl = \bootstrap\helpers\BSArray::popValue('imageUrl', $button, false);
     $label = \bootstrap\helpers\BSArray::popValue('label', $button, $id);
     $options = \bootstrap\helpers\BSArray::popValue('options', $button, array());
     \bootstrap\helpers\BSArray::defaultValue('data-title', $label, $options);
     \bootstrap\helpers\BSArray::defaultValue('title', $label, $options);
     \bootstrap\helpers\BSArray::defaultValue('data-toggle', 'tooltip', $options);
     if ($icon = \bootstrap\helpers\BSArray::popValue('icon', $button, false)) {
         echo CHtml::link(BSHtml::icon($icon), $url, $options);
     } else {
         if ($imageUrl && is_string($imageUrl)) {
             echo CHtml::link(CHtml::image($imageUrl, $label), $url, $options);
         } else {
             echo CHtml::link($label, $url, $options);
         }
     }
 }
开发者ID:bafio89,项目名称:qea-u,代码行数:32,代码来源:BsButtonColumn.php

示例3: run

 /**
  * affichage de la ligne de menu.
  */
 public function run()
 {
     echo "<div style=\"background:#EFFDFF;margin-bottom:2px;padding-top:2px;padding-bottom:2px;padding-right: 10px;height:20px;\">";
     if (isset($this->links)) {
         foreach ($this->links as $link) {
             $label = "non def";
             $image = "";
             if (count($link) > 2) {
                 if (!empty($link[2])) {
                     $image = CHtml::image(Yii::app()->baseUrl . '/images/' . $link[2], $link[0]);
                 }
             }
             $style = "";
             $style = "style=\"padding-right: 10px;\"";
             echo "<span " . $style . ">" . CHtml::link($image . $link[0], array($link[1])) . "</span>";
         }
     }
     if (isset($this->controllerName)) {
         //recherche avancee
         if ($this->searchable) {
             $imagesearch = CHtml::image(Yii::app()->baseUrl . '/images/zoom.png', Yii::t('common', 'advancedsearch'));
             echo CHtml::link($imagesearch . Yii::t('common', 'advancedsearch'), '#', array('class' => 'search-button'));
         }
         echo "<div style=\"display:inline;float:right;\">";
         // Export CSV
         $imageexport = CHtml::image(Yii::app()->baseUrl . '/images/page_white_csv.png', 'Liste format csv', array("title" => "Exporter en CSV"));
         $actionNameCsv = 'exportCsv';
         if (isset($this->actionExportCsv)) {
             $actionNameCsv = $this->actionExportCsv;
         }
         echo "<span style=\"padding-left: 10px;\">" . CHtml::link($imageexport, array($this->controllerName . '/' . $actionNameCsv)) . "</span>";
         echo "</div>";
     }
     echo "</div>";
 }
开发者ID:Biobanques,项目名称:cbsd_platform,代码行数:38,代码来源:CMenuBarLineWidget.php

示例4: init

 /**
  * Class object initialization
  */
 public function init()
 {
     $this->title = CHtml::image(Yii::app()->request->baseUrl . '/images/portlets/bug.png') . " " . Yii::t('portlet', 'TasksToDoTitle');
     $this->decorationCssClass = "portlet-header";
     $this->titleCssClass = "portlet-title";
     parent::init();
 }
开发者ID:lanzelotik,项目名称:celestic-community,代码行数:10,代码来源:LateTask.php

示例5: renderItems

 protected function renderItems($items)
 {
     foreach ($items as $i => $item) {
         if (!is_array($item)) {
             continue;
         }
         if (isset($item['visible']) && $item['visible'] === false) {
             continue;
         }
         if (!isset($item['itemOptions'])) {
             $item['itemOptions'] = array();
         }
         $classes = array('item');
         if ($i === 0) {
             $classes[] = 'active';
         }
         if (!empty($classes)) {
             $classes = implode(' ', $classes);
             if (isset($item['itemOptions']['class'])) {
                 $item['itemOptions']['class'] .= ' ' . $classes;
             } else {
                 $item['itemOptions']['class'] = $classes;
             }
         }
         echo CHtml::openTag('div', $item['itemOptions']);
         if (isset($item['image'])) {
             if (!isset($item['alt'])) {
                 $item['alt'] = '';
             }
             if (!isset($item['imageOptions'])) {
                 $item['imageOptions'] = array();
             }
             $image = CHtml::image($item['image'], $item['alt'], $item['imageOptions']);
             if (isset($item['link'])) {
                 echo CHtml::link($image, $item['link']);
             } else {
                 echo $image;
             }
         }
         if (!empty($item['caption']) && (isset($item['label']) || isset($item['caption']))) {
             if (!isset($item['captionOptions'])) {
                 $item['captionOptions'] = array();
             }
             if (isset($item['captionOptions']['class'])) {
                 $item['captionOptions']['class'] .= ' carousel-caption';
             } else {
                 $item['captionOptions']['class'] = 'carousel-caption';
             }
             echo CHtml::openTag('div', $item['captionOptions']);
             if (isset($item['label'])) {
                 echo '<h4>' . $item['label'] . '</h4>';
             }
             if (isset($item['caption'])) {
                 echo '<p>' . $item['caption'] . '</p>';
             }
             echo '</div>';
         }
         echo '</div>';
     }
 }
开发者ID:aakbar24,项目名称:CollegeCorner_Ver_2.0,代码行数:60,代码来源:TbLinkCarousel.php

示例6: actionUpload

 public function actionUpload()
 {
     $name = $_POST['name'];
     $model = new News();
     $image = CUploadedFile::getInstance($model, 'image');
     switch (strtolower($image->type)) {
         case 'image/png':
             $type = '.png';
             break;
         case 'image/jpeg':
             $type = '.jpeg';
             break;
         case 'image/gif':
             $type = '.gif';
             break;
         default:
             die('image type not supported');
     }
     $image->saveAs(Yii::getPathOfAlias('webroot.uploads.news.full') . DIRECTORY_SEPARATOR . $name . $type);
     list($resource['width'], $resource['height']) = getimagesize(Yii::getPathOfAlias('webroot.uploads.news.full') . DIRECTORY_SEPARATOR . $name . $type);
     echo CHtml::image(Yii::app()->baseUrl . '/uploads/news/full/' . $name . $type, '', array('id' => 'crop'));
     echo CHtml::hiddenField('nameFull', $name . $type);
     echo CHtml::hiddenField('src_w', $resource['width']);
     echo CHtml::hiddenField('src_h', $resource['height']);
     Yii::app()->end();
 }
开发者ID:Vladimirtishenko,项目名称:val.ua,代码行数:26,代码来源:UploadController.php

示例7: getCurIcon

	public function getCurIcon()
	{
		if (empty($this->icon))
			return '';
		else
			return CHtml::image($this->imgPath.$this->icon);
	}
开发者ID:nizsheanez,项目名称:PolymorphCMS,代码行数:7,代码来源:Union.php

示例8: run

 /**
  * Runs the widget. If an icon can be determined it will be rendered.
  */
 public function run()
 {
     $icon = $this->getIcon();
     if ($icon !== false) {
         echo CHtml::image($this->_iconBaseDir . '/' . $icon . '.png');
     }
 }
开发者ID:Tebro,项目名称:xbmc-video-server,代码行数:10,代码来源:MediaFlag.php

示例9: run

 /**
  * @throws CException
  */
 public function run()
 {
     $this->imageSrc = $this->user->getAvatar($this->size);
     $this->imageAlt = $this->user->nick_name;
     $this->width = $this->size . 'px';
     $this->htmlOptions = ['class' => 'avatar avatar-' . $this->user->id];
     if (!$this->height) {
         $this->height = $this->width;
     }
     Yii::app()->clientScript->registerCssFile(Yii::app()->assetManager->publish(Yii::getPathOfAlias('user.assets.css') . '/image-wrapper.css'));
     $htmlOptions = ['class' => 'img-wrapper-tocenter', 'style' => 'width: ' . $this->width . '; height: ' . $this->height . '; background-color: ' . $this->backgroundColor . ';'];
     if (isset($this->htmlOptions['class'])) {
         $class = $this->htmlOptions['class'];
         unset($this->htmlOptions['class']);
         $htmlOptions['class'] .= ' ' . $class;
     }
     if (isset($this->htmlOptions['style'])) {
         $style = $this->htmlOptions['style'];
         unset($this->htmlOptions['style']);
         $htmlOptions['style'] .= ' ' . $style;
     }
     if (is_array($this->htmlOptions) && count($this->htmlOptions) > 0) {
         $htmlOptions = array_merge($htmlOptions, $this->htmlOptions);
     }
     echo CHtml::tag('div', $htmlOptions, CHtml::image($this->imageSrc . ($this->noCache ? '?' . microtime(true) : ''), $this->imageAlt, $this->imageHtmlOptions));
 }
开发者ID:alextravin,项目名称:yupe,代码行数:29,代码来源:AvatarWidget.php

示例10: filterDialog

 static function filterDialog($data)
 {
     $id = 'HfilterDialog_' . ++Helper::$count;
     $filter = CHtml::image(Yii::app()->baseUrl . '/images/icons/filter_32.png', 'filtrar', array('style' => 'cursor:pointer;', 'onclick' => "\$('.dlgHelFilter div:not(#{$id})').slideUp(); \$('#{$id}').slideToggle();"));
     $filter .= "<div id='" . $id . "'>" . $data . "</div>";
     return '<div class="dlgHelFilter">' . $filter . '</div>';
 }
开发者ID:bruno-melo,项目名称:components,代码行数:7,代码来源:Helper.php

示例11: imageField

 public function imageField($model, $attribute, $htmlOptions = array())
 {
     $controlOptions = BsArray::popValue('controlOptions', $htmlOptions, array());
     $labelOptions = BsArray::popValue('labelOptions', $htmlOptions, array());
     $layout = $this->layout;
     $output = '';
     //$htmlOptions = BsHtml::addClassName('form-control',$htmlOptions);
     $output .= BsHtml::activeFileField($model, $attribute, $htmlOptions);
     //@TODO: render in field type partial?
     $attr = $model->{$attribute};
     if (!empty($attr)) {
         //Special logic for ContentTypes
         $tmpModel = $model;
         if ($model instanceof ContentType) {
             $tmpModel = $model->Content;
         }
         $output .= CHtml::image(Yii::app()->controller->createFrontendUrl('/site/getImage', array('id' => $tmpModel->id, 'modelName' => get_class($tmpModel), 'field' => $attribute, 'w' => 200)), 'Image', array('class' => 'img'));
         $output .= '<div class="checkbox">' . CHtml::checkBox($attribute . '_delete');
         $output .= CHtml::label('Delete?', $attribute . '_delete') . '</div>';
     }
     $htmlOptions['input'] = $output;
     $htmlOptions['labelOptions'] = BsHtml::setLabelOptionsByLayout($layout, $labelOptions);
     if (!empty($layout)) {
         if ($layout === BsHtml::FORM_LAYOUT_HORIZONTAL) {
             $controlClass = BsArray::popValue('class', $controlOptions, BsHtml::$formLayoutHorizontalControlClass);
             BsHtml::addCssClass($controlClass, $htmlOptions['controlOptions']);
         }
     }
     return BsHTML::activeTextFieldControlGroup($model, $attribute, $htmlOptions);
 }
开发者ID:snapfrozen,项目名称:snapcms,代码行数:30,代码来源:SnapActiveForm.php

示例12: layout

 public function layout($model)
 {
     echo "<div class='content-inner latest-article'>";
     if ($this->data('title') != '') {
         echo '<h2>';
         echo $this->data('title');
         echo '</h2>';
     }
     $first = true;
     $end = CHtml::listData($model, 'ID', 'ID');
     foreach ($model as $post) {
         echo '<div class="blog-item">
       ';
         echo '<div class="blog-content">';
         if ($post->post_image != '') {
             echo "<div class='col-xs-5'>";
             echo CHtml::image(Helper::getThumb('content', $post->post_image, 'medium'), '', array('class' => 'img-responsive img-blog'));
             echo ' </div><div class="col-xs-7">';
             $this->getLink($post);
             echo '</div>';
         } else {
             echo '<div class="col-xs-12">';
             $this->getLink($post);
             echo '</div>';
         }
         echo '  </div></div>';
     }
     if ($this->data('showIndexLink')) {
         echo '<div style="padding:15px;">';
         echo CHtml::Link('<i class="glyphicon glyphicon-plus"></i> Indeks ', array('Indeks/view/param/post'));
         echo "</div></div>";
     }
 }
开发者ID:beckblurry,项目名称:Yii1-Base-Core-V.Alpha.1,代码行数:33,代码来源:widget_latest_article.php

示例13: run

 public function run()
 {
     //$this->user = XfUser::model()->find("username='".$_GET['username']."'");
     echo CHtml::openTag("div", array('id' => "box_profile"));
     echo CHtml::image(Lnt::get_picture_href($this->user->user_id), '', array('width' => '70px', 'height' => '70px'));
     echo CHtml::openTag("p");
     echo $this->user->username;
     echo CHtml::closeTag("p");
     echo CHtml::openTag("div", array('class' => 'o_like'));
     echo CHtml::openTag("p", array('class' => 'like'));
     echo "5.134";
     echo CHtml::closeTag("p");
     echo CHtml::closeTag("div");
     echo CHtml::openTag("div", array('class' => 'reg_date'));
     echo "<span style='color:#2DB5DC'>Lưu bút</span><br/>";
     echo "Ym:<br/>";
     echo "Skype:<br/>";
     echo "Email: {$this->user->email} <br/>";
     echo "Website:<br/>";
     echo "Facebook:<br/>";
     echo "Điện thoại:<br/>";
     echo "<div style='font-size:11px;color:#797979;'>Ngày đăng ký: " . date("d/m/Y - H:i", $this->user->register_date) . "</div>";
     echo "<div style='font-size:11px;color:#797979;'>Đăng nhập cuối: " . date("d/m/Y - H:i", $this->user->last_activity) . "</div>";
     echo CHtml::closeTag("div");
     echo CHtml::closeTag("div");
 }
开发者ID:ngdvan,项目名称:lntguitar,代码行数:26,代码来源:BoxProfile.php

示例14: run

 public function run()
 {
     $this->iniciamarco();
     $this->determinacolor();
     echo CHtml::image($this->ruta . '/img/semaforo-' . $this->color . '.png');
     $this->cierradiv();
 }
开发者ID:hipogea,项目名称:zega,代码行数:7,代码来源:Semaforo.php

示例15: renderButton

 /**
  * Renders a link button.
  * @param string $id the ID of the button
  * @param array $button the button configuration which may contain 'label', 'url', 'imageUrl' and 'options' elements.
  * @param integer $row the row number (zero-based)
  * @param mixed $data the data object associated with the row
  */
 protected function renderButton($id, $button, $row, $data)
 {
     if (isset($button['visible']) && !$this->evaluateExpression($button['visible'], array('row' => $row, 'data' => $data))) {
         return;
     }
     $url = TbHtml::popOption('url', $button, '#');
     if (strcmp($url, '#') !== 0) {
         $url = $this->evaluateExpression($url, array('data' => $data, 'row' => $row));
     }
     $imageUrl = TbHtml::popOption('imageUrl', $button, false);
     $label = TbHtml::popOption('label', $button, $id);
     $options = TbHtml::popOption('options', $button, array());
     $options = TbHtml::defaultOption('title', $label, $options);
     $options = TbHtml::defaultOption('rel', 'tooltip', $options);
     if ($icon = TbHtml::popOption('icon', $button, false)) {
         /* todo: not sure if we require this anymore */
         if (strpos($icon, 'icon') === false) {
             $icon = 'icon-' . implode(' icon-', explode(' ', $icon));
         }
         echo CHtml::link('<i class="' . $icon . '"></i>', $url, $options);
     } else {
         if ($imageUrl && is_string($imageUrl)) {
             echo CHtml::link(CHtml::image($imageUrl, $label), $url, $options);
         } else {
             echo CHtml::link($label, $url, $options);
         }
     }
 }
开发者ID:tatyanayavkina,项目名称:yii_city_game,代码行数:35,代码来源:TbButtonColumn.php


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