Example #1
0
 public function run()
 {
     $criteria = new CDbCriteria();
     $criteria->addCondition('status=1');
     if ($this->catId) {
         $criteria->addCondition('term_id=' . $this->catId);
     }
     if ($this->currentId) {
         $criteria->addCondition('id<>' . $this->currentId);
     }
     $criteria->order = 'create_time DESC';
     $criteria->limit = 20;
     $news = News::model()->findAll($criteria);
     echo CHtml::openTag("div", array('class' => 'title', 'style' => 'color: #000000;font-size: 18px;'));
     echo "Tin khác";
     echo CHtml::closeTag("div");
     if ($news) {
         echo CHtml::openTag("ul", array('style' => 'border: 1px solid #CCCCCC;
 border-radius: 4px 4px 4px 4px;
 margin: 8px 0px 0px 0px;
 padding: 10px 5px;list-style:none;'));
         foreach ($news as $n) {
             echo CHtml::openTag('li');
             echo CHtml::link($n->title, array('/news/detail', 'id' => $n->id, 'tid' => $n->term_id, 'title' => Lnt::safeTitle($n->title))) . " <span style='color:#a7a7a7'>({$n->view})</span>";
             echo CHtml::closeTag('li');
         }
         echo CHtml::closeTag("ul");
     }
 }
Example #2
0
 /**
  * Renders the data item list.
  */
 public function renderItems()
 {
     echo CHtml::openTag('table', array('class' => 'po-table mind-list')) . "\n";
     echo CHtml::openTag('thead') . "\n";
     echo CHtml::tag('th', array('width' => 20), '&nbsp;') . "\n";
     echo CHtml::tag('th', array(), '&nbsp;') . "\n";
     echo CHtml::tag('th', array('width' => 30), '&nbsp;') . "\n";
     echo CHtml::tag('th', array('width' => 100), '&nbsp;') . "\n";
     echo CHtml::tag('th', array('width' => 150), '<span class="mind-list__clear-all">удалить все</span>') . "\n";
     echo CHtml::closeTag('thead');
     echo CHtml::openTag($this->itemsTagName, array('class' => $this->itemsCssClass)) . "\n";
     $data = $this->dataProvider->getData();
     if (($n = count($data)) > 0) {
         $owner = $this->getOwner();
         $viewFile = $owner->getViewFile($this->itemView);
         $j = 0;
         foreach ($data as $i => $item) {
             $data = $this->viewData;
             $data['index'] = $i;
             $data['data'] = $item;
             $data['widget'] = $this;
             $owner->renderFile($viewFile, $data);
             if ($j++ < $n - 1) {
                 echo $this->separator;
             }
         }
     }
     echo CHtml::closeTag($this->itemsTagName);
     echo CHtml::closeTag('table');
 }
Example #3
0
 /**
  * ### .run()
  *
  * Runs the widget.
  */
 public function run()
 {
     $options = !empty($this->options) ? CJavaScript::encode($this->options) : '';
     $id = !empty($this->htmlOptions['id']) ? $this->htmlOptions['id'] : $this->getId();
     $elementId = !empty($this->options['elementId']) ? $this->options['elementId'] : 'null';
     $elementUrl = !empty($this->options['elementUrl']) ? $this->options['elementUrl'] : 'null';
     echo CHtml::openTag('div', $this->htmlOptions);
     echo CHtml::openTag('table');
     echo '<thead><tr class="head"><th id="prev" style="visibility: visible;"><i class="icon-arrow-left"></i></th><th colspan="5" class="switch" style="text-align:center;">' . date("Y") . "年" . date("n") . "月" . '</th><th id="next" style="visibility: visible;"><i class="icon-arrow-right-2"></i></th></thead>';
     echo '<tbody></tbody>';
     echo CHtml::closeTag('table');
     echo CHtml::closeTag('div');
     ob_start();
     Yii::app()->getClientScript()->registerScript(__CLASS__ . '#' . $this->getId(), ob_get_clean() . ';');
     if (isset($_GET['date'])) {
         $year = date("Y", strtotime($_GET['date']));
         $month = date("n", strtotime($_GET['date']));
         $day = date("j", strtotime($_GET['date']));
     } else {
         $year = date("Y");
         $month = date("n");
         $day = date("j");
     }
     $this->registerJs($id, $year, $month, $day, $elementId, $elementUrl);
 }
Example #4
0
 public function run()
 {
     if (empty($this->links)) {
         return;
     }
     $this->activeLinkTemplate = '<a href="{url}" title="{title}" rel="v:url" property="v:title">{label}</a>';
     echo CHtml::openTag($this->tagName, $this->htmlOptions) . "\n";
     $links = array();
     if ($this->homeLink === null) {
         $links[] = CHtml::link(Yii::t('zii', 'Home'), Yii::app()->homeUrl);
     } elseif ($this->homeLink !== false) {
         $links[] = $this->homeLink;
     }
     foreach ($this->links as $label => $url) {
         if (is_string($label) || is_array($url)) {
             $links[] = strtr($this->activeLinkTemplate, array('{url}' => CHtml::normalizeUrl($url), '{label}' => $this->encodeLabel ? CHtml::encode($label) : $label, '{title}' => $this->encodeLabel ? CHtml::encode($label) : $label));
         } else {
             $links[] = str_replace('{label}', $this->encodeLabel ? CHtml::encode($url) : $url, $this->inactiveLinkTemplate);
         }
     }
     echo "<div xmlns:v='http://rdf.data-vocabulary.org/#'>";
     $i = 0;
     foreach ($links as $link) {
         if ($i > 0) {
             echo '&nbsp;&nbsp;<i class="icon icon_mt"></i>&nbsp;&nbsp;';
         }
         echo '<span typeof="v:Breadcrumb">' . $link . '</span>';
         $i++;
     }
     echo "</div>";
     //echo implode($this->separator,$links);
     echo CHtml::closeTag($this->tagName);
 }
Example #5
0
 public function run()
 {
     if (empty($this->links)) {
         return;
     }
     echo CHtml::openTag($this->tagName, $this->htmlOptions) . "\n";
     $links = array();
     if ($this->homeLink === null) {
         $links[] = CHtml::link(Yii::t('zii', 'Home'), Yii::app()->homeUrl);
     } else {
         if ($this->homeLink !== false) {
             $links[] = $this->homeLink;
         }
     }
     $i = 1;
     foreach ($this->links as $label => $url) {
         if (is_string($label) || is_array($url)) {
             if (count($this->links) == $i) {
                 $links[] = CHtml::link($this->encodeLabel ? CHtml::encode($label) : $label, $url, array('class' => $this->lastCssClass));
             } else {
                 $links[] = CHtml::link($this->encodeLabel ? CHtml::encode($label) : $label, $url);
             }
         } else {
             if (count($this->links) == $i) {
                 $links[] = '<span class="' . $this->lastCssClass . '">' . ($this->encodeLabel ? CHtml::encode($url) : $url) . '</span>';
             } else {
                 $links[] = '<span>' . ($this->encodeLabel ? CHtml::encode($url) : $url) . '</span>';
             }
         }
         $i++;
     }
     echo implode($this->separator, $links);
     echo CHtml::closeTag($this->tagName);
 }
Example #6
0
 public function run()
 {
     if (empty($this->links)) {
         return;
     }
     echo CHtml::openTag($this->tagName, $this->htmlOptions) . "\n";
     $links = array();
     echo '<span class="m_left20">当前位置:</span>';
     if ($this->homeLink === null) {
         $links[] = CHtml::link("工作台", Yii::app()->homeUrl);
     } else {
         if ($this->homeLink !== false) {
             $links[] = $this->homeLink;
         }
     }
     foreach ($this->links as $label => $url) {
         if (is_string($label) || is_array($url)) {
             $links[] = CHtml::link($this->encodeLabel ? CHtml::encode($label) : $label, $url);
         } else {
             $links[] = '<span>' . ($this->encodeLabel ? CHtml::encode($url) : $url) . '</span>';
         }
     }
     echo implode($this->separator, $links);
     echo CHtml::closeTag($this->tagName);
 }
 /**
  * Renders the widget. If there are no items, nothing will be rendered.
  * TODO: Reuse TbCollapse somehow
  */
 public function run()
 {
     $itemCount = count($this->items);
     if ($itemCount === 0) {
         return;
     }
     echo CHtml::openTag('div', $this->htmlOptions);
     foreach ($this->items as $k => $item) {
         $id = __CLASS__ . '_' . $this->id . '_' . $k;
         $contentId = $id . '_content';
         $linkOptions = array('class' => 'accordion-toggle episode-toggle', 'data-content-id' => $contentId, 'data-toggle' => 'collapse', 'data-parent' => $this->id);
         // Add content-url data attributes to the link when available
         if (isset($item['contentUrl'])) {
             $linkOptions['data-content-url'] = $item['contentUrl'];
         }
         // Render the contents of the heading
         $heading = $this->render('_seasonAccordionHeading', array('linkUrl' => '#' . $id, 'linkOptions' => $linkOptions, 'season' => $item['season']), true);
         $bodyOptions = array('class' => 'accordion-body collapse', 'id' => $id);
         if ($itemCount === 1) {
             TbHtml::addCssClass('in', $bodyOptions);
         }
         echo CHtml::openTag('div', array('class' => 'accordion-group'));
         echo CHtml::tag('div', array('class' => 'accordion-heading'), $heading);
         echo CHtml::openTag('div', $bodyOptions);
         echo CHtml::tag('div', array('id' => $contentId, 'class' => 'accordion-inner'), $item['content']);
         echo CHtml::closeTag('div');
         echo CHtml::closeTag('div');
     }
     echo CHtml::closeTag('div');
 }
Example #8
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');
 }
Example #9
0
 public function run()
 {
     echo CHtml::tag($this->tag, array('id' => $this->id));
     echo CHtml::closeTag($this->tag);
     $options = CJavaScript::encode($this->options);
     Yii::app()->getClientScript()->registerScript('jwplayer' . $this->id, "jwplayer('{$this->id}').setup({$options})");
 }
Example #10
0
 /**
  * Renders the widget.
  */
 public function run()
 {
     echo \CHtml::openTag('div', $this->options) . "\n";
     echo $this->renderItems() . "\n";
     echo \CHtml::closeTag('div') . "\n";
     $this->registerPlugin('collapse');
 }
Example #11
0
	/**
	 * Runs the widget.
	 */
	public function run()
	{
		$id=$this->getId();

		if (isset($this->htmlOptions['id']))
			$id = $this->htmlOptions['id'];
		else
			$this->htmlOptions['id']=$id;

		if(is_string($this->keys))
			$this->keys=array($this->keys);

		$markup='';
		foreach($this->keys as $key)
		{
			if(Yii::app()->user->hasFlash($key))
			{
				$markup.=strtr($this->template,array(
					'{key}'=>$key,
					'{message}'=>Yii::app()->user->getFlash($key),
				));
			}
		}

		if($markup!=='')
		{
			echo CHtml::openTag('div',$this->htmlOptions);
			echo $markup;
			echo CHtml::closeTag('div');
		}

		Yii::app()->clientScript->registerScript(__CLASS__.'#'.$id,
				"jQuery('#$id').animate({opacity: 2.0}, 3000).fadeOut('slow');",CClientScript::POS_READY);
	}
Example #12
0
 public function run()
 {
     if (empty($this->links)) {
         return;
     }
     $this->activeLinkTemplate = '<a href="{url}" itemprop="url"><span title="{label}" itemprop="title">{label}</span></a>';
     echo CHtml::openTag($this->tagName, $this->htmlOptions) . "\n";
     $links = array();
     if ($this->homeLink === null) {
         $links[] = CHtml::link(Yii::t('zii', 'Home'), Yii::app()->homeUrl);
     } elseif ($this->homeLink !== false) {
         $links[] = $this->homeLink;
     }
     foreach ($this->links as $label => $url) {
         if (is_string($label) || is_array($url)) {
             $links[] = strtr($this->activeLinkTemplate, array('{url}' => CHtml::normalizeUrl($url), '{label}' => $this->encodeLabel ? CHtml::encode($label) : $label, '{title}' => $this->encodeLabel ? CHtml::encode($label) : $label));
         } else {
             $links[] = str_replace('{label}', $this->encodeLabel ? CHtml::encode($url) : $url, $this->inactiveLinkTemplate);
         }
     }
     echo '<ul data-tracking-cat="breadcrumbs">';
     $i = 0;
     foreach ($links as $link) {
         if ($i > 0) {
             echo '<li class="separ"><span class="br-arr"></span></li>';
         }
         echo '<li itemscope="itemscope" itemtype="http://data-vocabulary.org/Breadcrumb">
                 ' . $link . '
             </li>';
         $i++;
     }
     echo "</ul>";
     //echo implode($this->separator,$links);
     echo CHtml::closeTag($this->tagName);
 }
Example #13
0
 /**
  * Run widget.
  * @return void
  */
 function run()
 {
     if (is_string($this->content)) {
         echo $this->content;
     }
     echo CHtml::closeTag('div');
 }
Example #14
0
 public function run()
 {
     $id = $this->getId();
     if (isset($this->htmlOptions['id'])) {
         $id = $this->htmlOptions['id'];
     } else {
         $this->htmlOptions['id'] = $id;
     }
     echo CHtml::openTag($this->tagName, $this->htmlOptions) . "\n";
     $tabsOut = "";
     $contentOut = "";
     $tabCount = 0;
     foreach ($this->tabs as $title => $content) {
         $tabId = is_array($content) && isset($content['id']) ? $content['id'] : $id . '_tab_' . $tabCount++;
         if (!is_array($content)) {
             $tabsOut .= strtr($this->headerTemplate, array('{title}' => $title, '{url}' => '#' . $tabId, '{id}' => '#' . $tabId)) . "\n";
             $contentOut .= strtr($this->contentTemplate, array('{content}' => $content, '{id}' => $tabId)) . "\n";
         } elseif (isset($content['ajax'])) {
             $tabsOut .= strtr($this->headerTemplate, array('{title}' => $title, '{url}' => CHtml::normalizeUrl($content['ajax']), '{id}' => '#' . $tabId)) . "\n";
         } else {
             $tabsOut .= strtr($this->headerTemplate, array('{title}' => $title, '{url}' => '#' . $tabId, '{id}' => $tabId)) . "\n";
             if (isset($content['content'])) {
                 $contentOut .= strtr($this->contentTemplate, array('{content}' => $content['content'], '{id}' => $tabId)) . "\n";
             }
         }
     }
     echo "<ul class='" . $this->ulClass . "'>\n" . $tabsOut . "</ul>\n";
     echo $contentOut;
     echo CHtml::closeTag($this->tagName) . "\n";
     $options = CJavaScript::encode($this->options);
     Yii::app()->getClientScript()->registerScript(__CLASS__ . '#' . $id, "jQuery('#{$id}').tabs({$options});");
 }
Example #15
0
 public function renderItems()
 {
     echo CHtml::openTag($this->itemsTagName, array('class' => $this->itemsCssClass)) . "\n";
     $data = $this->dataProvider->getData();
     if (($n = count($data)) > 0) {
         $owner = $this->getOwner();
         $render = $owner instanceof CController ? 'renderPartial' : 'render';
         $j = 0;
         $bandera = true;
         foreach ($data as $i => $item) {
             $data = $this->viewData;
             $data['index'] = $i;
             $data['data'] = $item;
             $data['widget'] = $this;
             if ($bandera == true) {
                 $owner->{$render}($this->headersview, $data);
                 $bandera = false;
             }
             $owner->{$render}($this->itemView, $data);
             if ($j++ < $n - 1) {
                 echo $this->separator;
             }
         }
         $owner->{$render}($this->footersview, $data);
     } else {
         $this->renderEmptyText();
     }
     echo CHtml::closeTag($this->itemsTagName);
 }
 public static function getHtmlTree()
 {
     $models = self::getRoot()->descendants()->findAll();
     $depth = 0;
     $res = '';
     foreach ($models as $n => $item) {
         if ($item->depth == $depth) {
             $res .= CHtml::closeTag('li') . "\n";
         } else {
             if ($item->depth > $depth) {
                 $res .= CHtml::openTag('ul', array('class' => 'depth_' . $item->depth)) . "\n";
             } else {
                 $res .= CHtml::closeTag('li') . "\n";
                 for ($i = $depth - $item->depth; $i; $i--) {
                     $res .= CHtml::closeTag('ul') . "\n";
                     $res .= CHtml::closeTag('li') . "\n";
                 }
             }
         }
         $res .= CHtml::openTag('li', array('id' => 'items_' . $item->id, 'class' => 'depth_' . $item->depth));
         $res .= CHtml::tag('div', array(), CHtml::encode($item->title) . '<img class="drag" src="/img/admin/hand.png" height="16" width="16" />');
         $depth = $item->depth;
     }
     for ($i = $depth; $i; $i--) {
         $res .= CHtml::closeTag('li') . "\n";
         $res .= CHtml::closeTag('ul') . "\n";
     }
     return $res;
 }
Example #17
0
 protected function renderContent()
 {
     $criteria = new CDbCriteria();
     $criteria->addCondition('status=1');
     $criteria->order = 'create_time DESC';
     $criteria->limit = 20;
     $hopam = Hopam::model()->findAll($criteria);
     /*$dataProvider = new CActiveDataProvider('Song', array(
           'pagination' => array(
               'pageSize' => Yii::app()->params['postsPerPage'],
           ),
           'criteria' => $criteria,
       ));
       $this->render('newest_song',array('songs'=>$dataProvider));*/
     echo CHtml::openTag("div", array('class' => 'title'));
     echo "Hợp Âm Mới";
     echo CHtml::closeTag("div");
     if ($hopam) {
         echo CHtml::openTag("ul");
         foreach ($hopam as $hp) {
             echo CHtml::openTag('li');
             echo CHtml::link($hp->title, array('/hopam/view', 'id' => $hp->id, "title" => Lnt::safeTitle($hp->title))) . " <span style='color:#a7a7a7'>({$hp->view})</span>";
             echo CHtml::closeTag('li');
         }
         echo CHtml::closeTag("ul");
     }
 }
Example #18
0
 /**
  *### .run()
  *
  * Runs the widget.
  */
 public function run()
 {
     $id = $this->htmlOptions['id'];
     echo CHtml::openTag('div', $this->htmlOptions);
     foreach ($this->alerts as $type => $alert) {
         if (is_string($alert)) {
             $type = $alert;
             $alert = array();
         }
         if (isset($alert['visible']) && $alert['visible'] === false) {
             continue;
         }
         /** @var CWebUser $userComponent */
         $userComponent = Yii::app()->getComponent($this->userComponentId);
         if (!$userComponent->hasFlash($type)) {
             continue;
         }
         $alertText = $userComponent->getFlash($type);
         if (empty($alertText)) {
             // null, ''
             continue;
         }
         $this->renderSingleAlert($alert, $type, $alertText);
     }
     echo CHtml::closeTag('div');
     $id .= '_' . self::$_containerId++;
     $selector = "#{$id} .alert";
     /** @var CClientScript $cs */
     $cs = Yii::app()->getClientScript();
     //$cs->registerScript(__CLASS__ . '#' . $id, "jQuery('{$selector}').alert();");
     foreach ($this->events as $name => $handler) {
         $handler = CJavaScript::encode($handler);
         $cs->registerScript(__CLASS__ . '#' . $id . '_' . $name, "jQuery('{$selector}').on('{$name}', {$handler});");
     }
 }
Example #19
0
 public function run()
 {
     $moduleModel = SiteModule::model()->findByPk(4);
     if (!empty($moduleModel)) {
         $root = CatalogRubrics::getRoot();
         $categories = $root->descendants()->findAll($root->id);
         $tree = '';
         $level = 0;
         foreach ($categories as $n => $category) {
             if ($category->status == 1) {
                 if ($category->level == $level) {
                     $tree .= CHtml::closeTag('li') . "\r\n";
                 } else {
                     if ($category->level > $level) {
                         $tree .= CHtml::openTag('ul') . "\r\n";
                     } else {
                         $tree .= CHtml::closeTag('li') . "\r\n";
                         for ($i = $level - $category->level; $i; $i--) {
                             $tree .= CHtml::closeTag('ul') . "\r\n";
                             $tree .= CHtml::closeTag('li') . "\r\n";
                         }
                     }
                 }
                 $tree .= CHtml::openTag('li');
                 $tree .= CHtml::link($category->name, Yii::app()->urlManager->createUrl($moduleModel->url_to_controller . '/element', array('param' => $category->url)));
                 $level = $category->level;
             }
         }
         $tree .= CHtml::closeTag('li') . "\r\n";
         $tree .= CHtml::closeTag('ul') . "\r\n";
         $data['tree'] = $tree;
         $this->render('view_Categories', $data);
     }
 }
Example #20
0
 public function run()
 {
     if (empty($this->links)) {
         return;
     }
     echo CHtml::openTag($this->tagName, $this->htmlOptions) . "\n";
     if ($this->homeLink === null) {
         $link = CHtml::link(Yii::t('zii', 'Home'), Yii::app()->homeUrl);
     } else {
         if ($this->homeLink !== false) {
             $link = $this->homeLink;
         }
     }
     foreach ($this->links as $label => $url) {
         if (is_string($label) || is_array($url)) {
             $link = CHtml::link($this->encodeLabel ? CHtml::encode($label) : $label, $url);
         } else {
             $link = '<span>' . ($this->encodeLabel ? CHtml::encode($url) : $url) . '</span>';
         }
         if (is_string($label)) {
             echo '<li>' . $link . '</li>';
         } else {
             echo '<li class="noChevron">' . $link . '</li>';
         }
     }
     echo CHtml::closeTag($this->tagName);
 }
 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');
 }
Example #22
0
 /**
  * Runs the widget and displays the input field
  */
 public function run()
 {
     list($name, $id) = $this->resolveNameID();
     $htmlOptions = $this->htmlOptions;
     $htmlOptions['id'] = $id;
     if (!isset($htmlOptions['class'])) {
         $htmlOptions['class'] = $this->containerClass;
     }
     if ($this->hasModel()) {
         $value = $this->model->{$this->attribute};
     } else {
         $value = $this->value;
     }
     if ($value instanceof Traversable) {
         $value = (array) $value;
     }
     if (!is_array($value)) {
         $value = array();
     }
     echo CHtml::openTag($this->tagName, $htmlOptions);
     echo CHtml::hiddenField($name, "");
     echo $this->renderArray($value, $name);
     echo CHtml::closeTag($this->tagName);
     $baseUrl = Yii::app()->assetManager->publish(__DIR__ . "/assets");
     Yii::app()->clientScript->registerScriptFile($baseUrl . "/AArrayInputWidget.js");
     $script = "jQuery('#{$id}').arrayInputWidget()";
     Yii::app()->clientScript->registerScript(get_class($this) . "#" . $id, $script);
 }
Example #23
0
    /**
     * Renders the input file field
     */
    public function renderField()
    {
        list($name, $id) = $this->resolveNameID();
        TbArray::defaultValue('id', $id, $this->htmlOptions);
        TbArray::defaultValue('name', $name, $this->htmlOptions);
        echo CHtml::openTag('div', $this->htmlOptions);
        echo CHtml::openTag('div', array('class' => 'input-prepend bfh-timepicker-toggle', 'data-toggle' => 'bfh-timepicker'));
        echo CHtml::tag('span', array('class' => 'add-on'), TbHtml::icon(TbHtml::ICON_TIME));
        if ($this->hasModel()) {
            echo CHtml::activeTextField($this->model, $this->attribute, $this->inputOptions);
        } else {
            echo CHtml::textField($name, $this->value, $this->inputOptions);
        }
        echo CHtml::closeTag('div');
        echo '<div class="bfh-timepicker-popover">
				<table class="table">
				<tbody>
					<tr>
						<td class="hour">
						<a class="next" href="#"><i class="icon-chevron-up"></i></a><br>
						<input type="text" class="input-mini" readonly><br>
						<a class="previous" href="#"><i class="icon-chevron-down"></i></a>
						</td>
						<td class="separator">:</td>
						<td class="minute">
						<a class="next" href="#"><i class="icon-chevron-up"></i></a><br>
						<input type="text" class="input-mini" readonly><br>
						<a class="previous" href="#"><i class="icon-chevron-down"></i></a>
						</td>
					</tr>
				</tbody>
				</table>
			</div>';
        echo CHtml::closeTag('div');
    }
 function getLink($post, $attr = true, $excerpt = true)
 {
     $postLink = '';
     $htmlOptions = '';
     //  uncomment jika ingin di tambahkan popup intro
     //if($excerpt == true){
     //    $htmlOptions =  array('onMouseOver'=>"pop(this,'.".$post->ID."');",);
     //    $postLink .= "<p class='".$post->ID." hide'>";
     //    $postLink .= $post->post_excerpt;
     //    $postLink .= "</p>";
     //}
     $postLink .= CHtml::Link($post->post_name, Yii::app()->createUrl('/photo/index', array('id' => $post->ID, 'slug' => $post->post_link)), $htmlOptions);
     $postLink .= $post->post_excerpt == '' ? "<br>" . Helper::getExcerpt($post->post_content, 0, 40) : "<br>" . Helper::getExcerpt($post->post_excerpt, 0, 40);
     if ($attr == true) {
         $postLink .= "<br><small class='text-muted'>";
         if ($post->categories != null) {
             $postLink .= CHtml::openTag('span', array('class' => 'label label-default'));
             $criteria = new CDbCriteria();
             $criteria->condition = "parent=0";
             //foreach($post->categories($criteria) as $category):
             //   $postLink .= $category->name.' ';
             //endforeach;
             $postLink .= CHtml::closeTag('span');
         }
         $postLink .= "  " . FTime::since($post->post_modified) . "</small>";
     } else {
         $postLink .= '<div class="entry-meta small muted">';
         $postLink .= FTime::since($post->post_modified);
         $postLink .= "</div>";
     }
     echo $postLink;
 }
Example #25
0
 /**
  * ### .
  * run()
  *
  * Renders the content of the widget.
  */
 public function run()
 {
     if (empty($this->links)) {
         return;
     }
     echo CHtml::openTag($this->tagName, $this->htmlOptions);
     if ($this->homeLink === null) {
         $this->homeLink = CHtml::link(Yii::t('zii', 'Home'), Yii::app()->homeUrl);
     }
     if ($this->homeLink !== false) {
         // check whether home link is not a link
         $active = stripos($this->homeLink, '<a') === false ? ' class="active"' : '';
         echo '<li' . $active . '>' . $this->homeLink . '</li>';
     }
     end($this->links);
     $lastLink = key($this->links);
     foreach ($this->links as $label => $url) {
         if (is_string($label) || is_array($url)) {
             echo '<li>';
             echo strtr($this->activeLinkTemplate, array('{url}' => CHtml::normalizeUrl($url), '{label}' => $this->encodeLabel ? CHtml::encode($label) : $label));
         } else {
             echo '<li class="active">';
             echo str_replace('{label}', $this->encodeLabel ? CHtml::encode($url) : $url, $this->inactiveLinkTemplate);
         }
         echo '</li>';
     }
     echo CHtml::closeTag($this->tagName);
 }
Example #26
0
 protected function renderMenuItem($item, $isEnd = true)
 {
     $label = $item['label'];
     if (isset($item['glyph'])) {
         $label = '<span class="glyphicon glyphicon-' . $item['glyph'] . '"></span> ' . $label;
     }
     $label = '<span>' . $label . '</span>';
     // $options = array('itemscope'=>'itemscope', 'itemtype'=>"http://data-vocabulary.org/Breadcrumb");
     $options = array();
     if ($isEnd) {
         $options['class'] = 'active';
     }
     $return = CHtml::openTag('li', $options);
     if (!isset($item['url']) || $isEnd) {
         $return .= $label;
     } else {
         // $options = array('itemprop'=>'url');
         $options = array();
         if ($item['url'] == $this->rootLink) {
             $options['rel'] = 'home';
         }
         $return .= CHtml::link($label, $item['url'], $options);
     }
     $return .= CHtml::closeTag('li') . "\n";
     return $return;
 }
Example #27
0
 public function run()
 {
     if (empty($this->links)) {
         return;
     }
     if (isset($this->htmlOptions['class'])) {
         $this->htmlOptions['class'] .= ' breadcrumb';
     } else {
         $this->htmlOptions['class'] = 'breadcrumb';
     }
     echo CHtml::openTag($this->tagName, $this->htmlOptions) . "\n";
     $links = array();
     if ($this->homeLink === null) {
         $links[] = CHtml::link(Yii::t('zii', 'Home'), Yii::app()->homeUrl);
     } else {
         if ($this->homeLink !== false) {
             $links[] = $this->homeLink;
         }
     }
     foreach ($this->links as $label => $url) {
         if (is_string($label) || is_array($url)) {
             $links[] = CHtml::link($this->encodeLabel ? CHtml::encode($label) : $label, $url);
         } else {
             $links[] = '<span>' . ($this->encodeLabel ? CHtml::encode($url) : $url) . '</span>';
         }
     }
     $separator = CHtml::tag('span', array('class' => 'divider'), $this->separator) . CHtml::closeTag('li') . ' ' . CHtml::openTag('li');
     echo CHtml::openTag('li') . implode($separator, $links) . CHtml::closeTag('li');
     echo CHtml::closeTag($this->tagName);
 }
Example #28
0
 /**
  * @see CMenu::renderMenuRecursive
  */
 protected function renderMenuRecursive($items)
 {
     foreach ($items as $item) {
         echo CHtml::openTag('li', isset($item['htmlOptions']) ? $item['htmlOptions'] : array());
         if (isset($item['encodeLabel']) ? $item['encodeLabel'] : $this->encodeLabel) {
             $item['label'] = CHtml::encode($item['label']);
         }
         if (isset($item['url']) && !($this->activeLinkDisable && $item['active'])) {
             $menu = CHtml::link($item['label'], $item['url'], isset($item['linkOptions']) ? $item['linkOptions'] : array());
         } else {
             $menu = CHtml::tag('span', isset($item['linkOptions']) ? $item['linkOptions'] : array(), $item['label']);
         }
         if (isset($this->itemTemplate) || isset($item['template'])) {
             $template = isset($item['template']) ? $item['template'] : $this->itemTemplate;
             echo strtr($template, array('{menu}' => $menu));
         } else {
             echo $menu;
         }
         if (isset($item['items']) && count($item['items'])) {
             echo "\n" . CHtml::openTag('ul', CMap::mergeArray($this->submenuHtmlOptions, $item['submenuHtmlOptions'] ? $item['submenuHtmlOptions'] : array())) . "\n";
             $this->renderMenuRecursive($item['items']);
             echo CHtml::closeTag('ul') . "\n";
         }
         echo CHtml::closeTag('li') . "\n";
     }
 }
Example #29
0
 /**
  * Retrieves all cards in a particular category
  * @param  string $id The category id
  */
 public function actionGetCardsByCategory($id = NULL)
 {
     if ($id === NULL) {
         throw new CHttpException(400, Yii::t('Dashboard.main', 'Missing category id'));
     }
     $categories = Yii::app()->cache->get('cards_in_category');
     if ($categories === false) {
         $this->getCards();
         $categories = Yii::app()->cache->get('cards_in_category');
     }
     $cards = $categories[$id];
     $elements = $elementOptions = array();
     // TODO: Fix multiple select
     //$elementOptions['multiple'] = 'multiple';
     foreach ($cards as $k => $card) {
         $asset = Yii::app()->assetManager->publish(YiiBase::getPathOfAlias($card['path']), true, -1, YII_DEBUG);
         $elements[] = $k;
         $elementOptions['options'][] = array('value' => $k, 'data-img-src' => Yii::app()->getBaseUrl(true) . $asset . '/default.png');
     }
     $form = $this->beginWidget('ext.cii.widgets.CiiActiveForm', array('htmlOptions' => array('class' => 'pure-form pure-form-aligned item-selection-form')));
     echo CHtml::openTag('div', array('class' => 'pure-form-group', 'style' => 'padding-bottom: 20px'));
     echo CHtml::link(Yii::t('Dashboard.main', 'Add to Dashboard'), '#', array('id' => 'add-cards-button', 'class' => 'pure-button pure-button-link pure-button-primary pull-right pure-button-small', 'style' => 'position: absolute; top: 15px; right: 3%;'));
     echo CHtml::tag('legend', array(), $id);
     echo CHtml::dropDownList('card', NULL, $elements, $elementOptions);
     echo CHtml::closeTag('div');
     $this->endWidget();
 }
Example #30
0
 public function run()
 {
     if (empty($this->links)) {
         return;
     }
     echo CHtml::openTag($this->tagName, $this->htmlOptions) . "\n";
     if (!empty($this->prefixText)) {
         echo $this->prefixText;
     }
     $links = array();
     if ($this->homeLink === null) {
         $links[] = CHtml::link(Yii::t('zii', 'Home'), Yii::app()->homeUrl);
     } elseif ($this->homeLink !== false) {
         $links[] = $this->homeLink;
     }
     foreach ($this->links as $label => $url) {
         if (is_string($label) || is_array($url)) {
             $links[] = CHtml::link($this->encodeLabel ? CHtml::encode($label) : $label, $url);
         } else {
             $links[] = '<span>' . ($this->encodeLabel ? CHtml::encode($url) : $url) . '</span>';
         }
     }
     echo implode($this->separator, $links);
     echo CHtml::closeTag($this->tagName);
 }