HCE Project DC service web UI  0.2
Hierarchical Cluster Engine DC service web UI
 All Classes Namespaces Files Functions Variables Pages
TbBreadcrumbs.php
Go to the documentation of this file.
1 <?php
8 Yii::import('zii.widgets.CBreadcrumbs');
9 
15 class TbBreadcrumbs extends CBreadcrumbs {
20  public $tagName = 'ul';
21 
26  public $htmlOptions = array('class' => 'breadcrumb');
27 
34  public $inactiveLinkTemplate = '{label}';
35 
41  public function run() {
42 
43  if (empty($this->links))
44  return;
45 
46  echo CHtml::openTag($this->tagName, $this->htmlOptions);
47 
48  if ($this->homeLink === null) {
49  $this->homeLink = CHtml::link(Yii::t('zii', 'Home'), Yii::app()->homeUrl);
50  }
51  if ($this->homeLink !== false) {
52  // check whether home link is not a link
53  $active = (stripos($this->homeLink, '<a') === false) ? ' class="active"' : '';
54  echo '<li' . $active . '>' . $this->homeLink . '</li>';
55  }
56 
57  end($this->links);
58  $lastLink = key($this->links);
59 
60  foreach ($this->links as $label => $url) {
61  if (is_string($label) || is_array($url)) {
62  echo '<li>';
63  echo strtr($this->activeLinkTemplate, array(
64  '{url}' => CHtml::normalizeUrl($url),
65  '{label}' => $this->encodeLabel ? CHtml::encode($label) : $label,
66  ));
67  } else {
68  echo '<li class="active">';
69  echo str_replace('{label}', $this->encodeLabel ? CHtml::encode($url) : $url, $this->inactiveLinkTemplate);
70  }
71 
72  echo '</li>';
73  }
74 
75  echo CHtml::closeTag($this->tagName);
76  }
77 }