Exemplo n.º 1
1
 /**
  * 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);
         }
     }
 }
Exemplo n.º 2
1
 /**
  * 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);
         }
     }
 }
 /**
  * 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>";
 }
Exemplo n.º 4
0
 /**
  * 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();
 }
 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>';
     }
 }
Exemplo n.º 6
0
 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();
 }
 /**
  * Class object initialization
  */
 public function init()
 {
     $this->title = CHtml::image(Yii::app()->request->baseUrl . '/images/portlets/charts.png') . " " . Yii::t('portlet', 'ProjectsProgressTitle');
     $this->decorationCssClass = "portlet-header";
     $this->titleCssClass = "portlet-title";
     parent::init();
 }
Exemplo n.º 8
0
	public function getCurIcon()
	{
		if (empty($this->icon))
			return '';
		else
			return CHtml::image($this->imgPath.$this->icon);
	}
Exemplo n.º 9
0
 /**
  * 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');
     }
 }
Exemplo n.º 10
0
 /**
  * @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));
 }
Exemplo n.º 11
0
 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>';
 }
Exemplo n.º 12
0
 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);
 }
 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>";
     }
 }
Exemplo n.º 14
0
 public function run()
 {
     //$this->user = XfUser::model()->find("username='******'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");
 }
Exemplo n.º 15
0
 public function run()
 {
     $this->iniciamarco();
     $this->determinacolor();
     echo CHtml::image($this->ruta . '/img/semaforo-' . $this->color . '.png');
     $this->cierradiv();
 }
Exemplo n.º 16
0
 /**
  * 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);
         }
     }
 }
Exemplo n.º 17
0
    public function run()
    {
        ///array del AJAX, segun el valor de la propiedad $comopintar
        if (!is_null($this->nombrearea)) {
            $opcionesajax = array('type' => 'POST', 'url' => Yii::app()->createUrl('/Matchcode/relaciona', array('campo' => $this->nombrecampo, 'ordencampo' => $this->ordencampo, 'clasesita' => $this->nombreclase, 'contr' => $this->controlador)), 'update' => '#' . $this->nombrearea);
        } else {
            //propiedad $comopintar='REPLACE'
            //$d=$this->comopintar;
            $opcionesajax = array('type' => 'POST', 'url' => Yii::app()->createUrl('/Matchcode/relaciona'), 'replace' => '#Detgui_c_descri');
        }
        echo "<div style='float: left; '>";
        echo $this->form->textField($this->model, $this->nombrecampo, array('size' => $this->tamano, 'ajax' => $opcionesajax));
        echo " </div>";
        echo " <div style='float: left;'>";
        echo CHtml::link(CHtml::image(Yii::app()->getTheme()->baseUrl . Yii::app()->params["rutatemaimagenes"] . "Search.png"), '#', array('onclick' => '$("#' . $this->nombreframe . '").attr(
																					"src",
																					"' . Yii::app()->createurl('/Matchcode/recibevalor', array("campo" => $this->nombrecampo, "clasesita" => $this->nombreclase, "controlado" => $this->controlador)) . '"); $("#' . $this->nombredialogo . '").data("hilo","' . $this->controlador . '_' . $this->nombrecampo . '@' . $this->nombrearea . '").dialog("open"); return false'));
        echo " </div>";
        // if (!is_null($this->nombrearea)) {
        echo " <div style='float: left; background-color :#FFF; padding:3px; font-family: verdana,tahoma,arial,sans-serif;\n\t\t\t\t\t\t\t\tfont-size: 8pt;'  id =" . $this->nombrearea . ">";
        if ($this->model->isNewRecord) {
            //if( !empty($this->defol) or !is_null($this->defol) or !empty($this->model->{$this->nombrecampo} ) or !is_null($this->model->{$this->nombrecampo}) ) {
            Yii::app()->explorador->buscavalor($this->nombrecampo, $this->model->{$this->nombrecampo}, $this->ordencampo, $this->nombreclase);
            // }
        } else {
            Yii::app()->explorador->buscavalor($this->nombrecampo, $this->model->{$this->nombrecampo}, $this->ordencampo, $this->nombreclase);
        }
        echo " </div>";
        // } ELSE {
        //PINTAR EL INPUT BOX DEL CAMPO EN UESTION
        //	echo "<input size='40' maxlength='40' value='". Yii::app()->explorador->buscavalor($this->nombrecampo,$this->model->{$this->nombrecampo},$this->ordencampo,$this->nombreclase)."'  name='Detgui[c_descri]' id='Detgui_c_descri' 	type='text' />	";
        //}
    }
Exemplo n.º 18
0
 /**
  * Set default user states so the application won't crash
  * when trying to access these properies and they don't exist
  */
 public function init()
 {
     $cs = Yii::app()->clientScript;
     $baseUrl = $this->createFrontendUrl('/');
     $cs->registerCssFile($baseUrl . '/themes/boxomatic/admin/css/admin.css');
     $this->scriptLocations[Yii::app()->basePath . '/../public_html/themes/boxomatic/admin/'] = $this->createFrontendUrl('/') . '/themes/boxomatic/admin/';
     $this->nav_brand_label = CHtml::image('/themes/boxomatic/images/cog-leaf.png');
     if (!Yii::app()->user->hasState('user_id')) {
         Yii::app()->user->setState('user_id', false);
     }
     if (!Yii::app()->user->hasState('supplier_id')) {
         Yii::app()->user->setState('supplier_id', false);
     }
     if (!Yii::app()->user->hasState('shadow_id')) {
         Yii::app()->user->setState('shadow_id', false);
     }
     if (!Yii::app()->user->hasState('shadow_name')) {
         Yii::app()->user->setState('shadow_name', false);
     }
     //Test if the login key find the user and auto login.
     $key = Yii::app()->request->getParam('key');
     if ($key) {
         $User = User::model()->findByAttributes(array('auto_login_key' => $key), 'update_time > date_sub(NOW(), interval 7 day)');
         if ($User) {
             $identity = new UserIdentity($User->email, '');
             $identity->authenticate(false);
             Yii::app()->user->login($identity);
             $User->auto_login_key = '';
             $User->save(false);
         }
         //exit;
     }
 }
Exemplo n.º 19
0
 /**
  * Renders the widget.
  */
 public function run()
 {
     $this->textImage = urlencode($this->textImage);
     $base = $this->getController()->getId() . '/' . $this->thisAction;
     $params = array('textImage' => $this->textImage, 'fontSize' => $this->fontSize, 'fontFile' => $this->fontFile, 'backColor' => $this->backColor, 'foreColor' => $this->foreColor, 'transparent' => $this->transparent, 'v' => rand(0, 10000));
     echo CHtml::image(Yii::app()->createUrl($base, $params), '');
 }
 /**
  * Class object initialization
  */
 public function init()
 {
     $this->title = CHtml::image(Yii::app()->request->baseUrl . '/images/portlets/invoices.png') . " " . Yii::t('portlet', 'InvoicesStatisticsTitle');
     $this->decorationCssClass = "portlet-header";
     $this->titleCssClass = "portlet-title";
     parent::init();
 }
Exemplo n.º 21
0
 /**
  * Displays a particular report of model.'dataProvider'=>$dataProvider,
  * @param integer $id the ID of the model to be displayed
  */
 public function actionReport($id)
 {
     //$this->render('testReport', array());
     $dataProvider = new CActiveDataProvider('CatResult');
     # mPDF
     $mPDF1 = Yii::app()->ePdf->mpdf();
     # You can easily override default constructor's params
     $mPDF1 = Yii::app()->ePdf->mpdf('', 'A4');
     # render (full page)
     $mPDF1->WriteHTML($this->renderPartial('index', array('dataProvider' => $dataProvider), true));
     # Load a stylesheet
     $stylesheet = file_get_contents(Yii::getPathOfAlias('webroot.css') . '/main.css');
     $mPDF1->WriteHTML($stylesheet, 1);
     # renderPartial (only 'view' of current controller)
     //$mPDF1->WriteHTML($this->renderPartial('view', array(), true));
     # Renders image
     $mPDF1->WriteHTML(CHtml::image(Yii::getPathOfAlias('webroot.css') . '/bg.gif'));
     # Outputs ready PDF
     $mPDF1->Output();
     //$html2pdf = Yii::app()->ePdf->HTML2PDF();
     //$html2pdf->WriteHTML($this->render('update', array('model'=>$this->loadModel($id),), true));
     //$html2pdf->Output();
     //	Yii::app()->jasPHP->create(getcwd() . '/reports/', 'report1.jrxml', array('title' => $title,));
     //	Yii::app()->jasPHP->create(getcwd() . '/reports/', 'report1.jrxml', array('title' => $title,), array('property1' => $title,));
     //Yii::import('application.extensions.ireport.*');
     //$AReport = new IReport(dirname(__FILE__) . '/hello.jrxml');
     //$AReport->parameters = array("title"=>1);
     //$AReport->execute();
     //$this->render('index');
 }
Exemplo n.º 22
0
 public function render()
 {
     parent::appendOption($this->_htmlOptions, 'class', $this->_cssClass);
     echo CHtml::openTag('li', $this->_htmlOptions);
     if (!empty($this->_data)) {
         echo '<ul>';
         foreach ($this->_data as $item) {
             $i = $item['icon'];
             $l = $item['label'];
             $u = $item['url'];
             echo '<li>';
             if (!empty($i)) {
                 if (is_array($i)) {
                     $img = CHtml::tag('img', $i, '');
                 } else {
                     $img = CHtml::image($i, CHtml::encode($l));
                 }
                 $l = $img . $l;
             }
             echo CHtml::link($l, $u, @$item['htmlOptions']);
             echo '</li>';
         }
         echo '</ul>';
     }
     echo CHtml::closeTag('li');
 }
 public function layout($model)
 {
     echo CHtml::openTag('div', array('class' => 'widget categories content-inner widget_post_category'));
     if ($this->data('title') != '') {
         echo CHtml::openTag('h3', array('class' => 'main-color widget_header'));
         echo $this->data('title');
         echo CHtml::closeTag('h3');
     }
     echo CHtml::openTag('div', array('class' => 'row'));
     echo CHtml::openTag('div', array('class' => 'col-xs-12'));
     $first = true;
     $end = CHtml::listData($model, 'ID', 'ID');
     foreach ($model as $post) {
         if ($this->data('showThumbPost')) {
             echo CHtml::openTag('div', array('class' => 'single_comments'));
             echo "<span>";
             if ($post->post_image != '') {
                 echo CHtml::image(Helper::getThumb('content', $post->post_image));
             }
             echo "</span>";
             $this->getLink($post, true, $this->data('showExcerpt'), 20);
             echo CHtml::closeTag('div');
         } else {
             echo CHtml::openTag('div', array('class' => 'single_comments'));
             $this->getLink($post, true, $this->data('showExcerpt'), $this->data('batasJudul'));
             echo CHtml::closeTag('div');
         }
     }
     if ($this->data('showIndexLink')) {
         echo CHtml::Link('<i class="glyphicon glyphicon-plus"></i>  Indeks ', array('indeks/populer'), array('class' => 'indeks'));
     }
     echo CHtml::closeTag('div');
     echo CHtml::closeTag('div');
     echo CHtml::closeTag('div');
 }
Exemplo n.º 24
0
 public static function DrawUserAvatar($fileName = null)
 {
     $filePath = User::getProfileImageUploadUrl();
     Yii::log($filePath);
     $filePath .= !empty($fileName) ? $fileName : User::defaultImage;
     return CHtml::image($filePath, 'User Avatar', array('class' => 'avatar-holder'));
 }
Exemplo n.º 25
0
	public function formInput(&$controller, $tagOptions=array())
	{
		ob_start();
		$inputName = $this->formInputName();
		$inputID = "i_{$inputName}";
		echo CHtml::label($this->label, $inputID);
		echo CHtml::tag('br');
		if($this->isReadonly)
			$tagOptions['disabled'] = true;

		if($this->value)
		{
			$oldOptions = array('readonly'=>true);
			if($this->isReadonly)
				$tagOptions['disabled'] = true;
			echo CHtml::image("{$this->options['directoryPath']}/{$this->value}", $this->label, array('title'=>$this->label));
			echo CHtml::textField($inputName, $this->value, $oldOptions);
			unset($oldOptions['readonly']);
			?>
			<label class="delfile">
				<?php echo Yii::t('AutoAdmin.form', '<b class="warning">Delete</b> the image')?> <span class="tip">(<?php echo Yii::t('AutoAdmin.form', 'set checkbox on for confirm')?>)</span>:
				<?php echo CHtml::checkBox("{$inputName}[del]", false, $oldOptions)?>
			</label>
			<?php
		}
		$tagOptions['id'] = $inputID;
		echo CHtml::label(Yii::t('AutoAdmin.form', 'New image').':', $inputID);
		?>
		<div class="tip inline">&lt;img src=<?php echo $this->options['directoryPath']?>/</div>
		<?php
		echo CHtml::fileField(AutoAdmin::INPUT_PREFIX."[{$this->name}_new]", null, $tagOptions);

		return ob_get_clean();
	}
 /**
  * Class object initialization
  */
 public function init()
 {
     $this->title = CHtml::image(Yii::app()->request->baseUrl . '/images/portlets/overdue.png') . " " . Yii::t('portlet', 'UpcomingMilestonesTitle');
     $this->decorationCssClass = "portlet-header";
     $this->titleCssClass = "portlet-title";
     parent::init();
 }
Exemplo n.º 27
0
 public function init()
 {
     $assets = Yii::app()->getAssetManager()->publish(dirname(__FILE__) . '/assets');
     if (!isset($this->htmlOptions['id'])) {
         $this->htmlOptions['id'] = $this->getId();
     }
     $this->id = $id = $this->htmlOptions['id'];
     echo CHtml::image($this->url, $this->alt, $this->htmlOptions);
     if (!empty($this->buttons)) {
         echo '<div class="jcrop-buttons">' . CHtml::button($this->buttons['start']['label'], $this->getHtmlOptions('start', 'inline'));
         echo CHtml::button($this->buttons['crop']['label'], $this->getHtmlOptions('crop'));
         echo CHtml::button($this->buttons['cancel']['label'], $this->getHtmlOptions('cancel')) . '</div>';
     }
     echo CHtml::hiddenField($id . '_x', 0, array('class' => 'coords'));
     echo CHtml::hiddenField($id . '_y', 0, array('class' => 'coords'));
     echo CHtml::hiddenField($id . '_w', 0, array('class' => 'coords'));
     echo CHtml::hiddenField($id . '_h', 0, array('class' => 'coords'));
     echo CHtml::hiddenField($id . '_x2', 0, array('class' => 'coords'));
     echo CHtml::hiddenField($id . '_y2', 0, array('class' => 'coords'));
     $cls = Yii::app()->getClientScript();
     $cls->registerScriptFile($assets . '/js/jquery.Jcrop.min.js');
     $cls->registerScriptFile($assets . '/js/ejcrop.js', CClientScript::POS_HEAD);
     $cls->registerCssFile($assets . '/css/jquery.Jcrop.css');
     $this->options['onChange'] = "js:function(c) {ejcrop_getCoords(c,'{$id}'); ejcrop_showThumb(c,'{$id}');}";
     $this->options['ajaxUrl'] = $this->ajaxUrl;
     $this->options['ajaxParams'] = $this->ajaxParams;
     $options = CJavaScript::encode($this->options);
     if (!empty($this->buttons)) {
         $js = "ejcrop_initWithButtons('{$id}', {$options});";
     } else {
         $js = "jQuery('#{$id}').Jcrop({$options});";
     }
     $cls->registerScript(__CLASS__ . '#' . $id, $js, CClientScript::POS_READY);
 }
 public function layout($model)
 {
     echo CHtml::openTag('div', array('class' => 'widget categories content-inner  '));
     if ($this->data('title') != '') {
         echo CHtml::openTag('h3', array('class' => 'main-color widget_header'));
         echo $this->data('title');
         echo CHtml::closeTag('h3');
     }
     echo CHtml::openTag('div', array('class' => 'row'));
     echo CHtml::openTag('div', array('class' => 'col-xs-12'));
     $first = true;
     $end = CHtml::listData($model, 'ID', 'ID');
     foreach ($model as $post) {
         if ($this->data('showThumbPost')) {
             echo CHtml::openTag('div', array('class' => 'single_comments'));
             if ($this->getFoto($post) != '') {
                 echo CHtml::image(Helper::getThumb('content', $this->getFoto($post)));
             }
             $this->getLink($post);
             echo CHtml::closeTag('div');
         } else {
             echo CHtml::openTag('div', array('class' => 'single_comments'));
             $this->getLink($post);
             echo CHtml::closeTag('div');
         }
     }
     if ($this->data('showIndexLink')) {
         echo CHtml::Link('<i class="fa fa-angle-double-right"></i> Index Photo', array('/photohome'), array('class' => 'indeks'));
     }
     echo CHtml::closeTag('div');
     echo CHtml::closeTag('div');
     echo CHtml::closeTag('div');
 }
 /**
  * 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;
     }
     $label = isset($button['label']) ? $button['label'] : $id;
     $url = isset($button['url']) ? $this->evaluateExpression($button['url'], array('data' => $data, 'row' => $row)) : '#';
     $options = isset($button['options']) ? $button['options'] : array();
     if (!isset($options['title'])) {
         $options['title'] = $label;
     }
     if (!isset($options['rel'])) {
         $options['rel'] = 'tooltip';
     }
     if (isset($button['icon'])) {
         if (strpos($button['icon'], 'icon') === false) {
             $button['icon'] = 'icon-' . implode(' icon-', explode(' ', $button['icon']));
         }
         echo CHtml::link('<i class="' . $button['icon'] . '"></i>', $url, $options);
     } else {
         if (isset($button['imageUrl']) && is_string($button['imageUrl'])) {
             echo CHtml::link(CHtml::image($button['imageUrl'], $label), $url, $options);
         } else {
             echo CHtml::link($label, $url, $options);
         }
     }
 }
Exemplo n.º 30
0
	public static function attachmentActionText($actionDescription,$makeLink = false,$makeImage = false) {
	
		$data = explode(':',$actionDescription);
		if(count($data) == 2 && is_numeric($data[1])) {

			$str = Yii::t('media','File:') . ' ';
			
			$file = Yii::app()->file->set('uploads/'.$data[0]);
			
			if($makeLink && $file->exists)
				$str .= CHtml::link($data[0],array('media/view','id'=>$data[1]));
			else
				$str .= $data[0];
			if (!$file->exists)
				$str .= ' '.Yii::t('media','(deleted)');

			if($makeImage && $file->exists) {	// to render an image, first check file extension

				$file_ext = $file->getExtension();
				$legal_extensions = array('jpg','gif','png','bmp','jpeg','jpe');
				
				if(in_array($file_ext,$legal_extensions))
					$str .= CHtml::image(Yii::app()->request->baseUrl.'/uploads/'.$data[0],'',array('class'=>'attachment-img'));
			}
			
			
			return $str;
			
		} else
			return $actionDescription;
	}