forked from darwin26/navigation_factory
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changed methodnames: ul in list and li in list item
- Loading branch information
RexDude
committed
Nov 15, 2015
1 parent
f56c859
commit efbadf8
Showing
9 changed files
with
169 additions
and
271 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,78 +1,110 @@ | ||
<?php | ||
|
||
class rex_breadcrumb_nav { | ||
protected $cssClass; | ||
protected $olList; | ||
protected $listId; | ||
protected $listClass; | ||
protected $orderedList; | ||
protected $startArticleName; | ||
protected $startArticleIconClass; | ||
protected $hideStartArticleName; | ||
|
||
public function __construct() { | ||
$this->cssClass = ''; | ||
$this->olList = false; | ||
$this->listId = ''; | ||
$this->listClass = ''; | ||
$this->orderedList = false; | ||
$this->startArticleName = ''; | ||
$this->startArticleIconClass = ''; | ||
$this->hideStartArticleName = false; | ||
} | ||
|
||
public function setCssClass($cssClass) { | ||
$this->cssClass = $cssClass; | ||
public function setListId($listId) { | ||
$this->listId = $listId; | ||
} | ||
|
||
public function setOlList($olList) { | ||
$this->olList = $olList; | ||
public function setListClass($listClass) { | ||
$this->listClass = $listClass; | ||
} | ||
|
||
public function setOrderedList($orderedList) { | ||
$this->orderedList = $orderedList; | ||
} | ||
|
||
public function setStartArticleName($startArticleName) { | ||
$this->startArticleName = $startArticleName; | ||
} | ||
|
||
public function setStartArticleIconClass($startArticleIconClass) { | ||
$this->startArticleIconClass = $startArticleIconClass; | ||
} | ||
|
||
public function setHideStartArticleName($hideStartArticleName) { | ||
$this->hideStartArticleName = $hideStartArticleName; | ||
} | ||
|
||
public function getNavigation() { | ||
global $REX; | ||
|
||
$listType = 'ul'; | ||
|
||
if ($this->olList) { | ||
if ($this->orderedList) { | ||
$listType = 'ol'; | ||
} else { | ||
$listType = 'ul'; | ||
} | ||
|
||
if ($this->listId !== '') { | ||
$listIdAttribute = ' id="' . $this->listId . '"'; | ||
} else { | ||
$listIdAttribute = ''; | ||
} | ||
|
||
if ($this->cssClass !== '') { | ||
$cssClass = ' class="' . $this->cssClass . '"'; | ||
if ($this->listClass !== '') { | ||
$listClassAttribute = ' class="' . $this->listClass . '"'; | ||
} else { | ||
$cssClass = ''; | ||
$listClassAttribute = ''; | ||
} | ||
|
||
$html = '<' . $listType . $cssClass . '>'; | ||
$html = '<' . $listType . $listIdAttribute . $listClassAttribute . '>'; | ||
$path = explode('|', $REX['ART'][$REX['ARTICLE_ID']]['path'][$REX['CUR_CLANG']] . $REX['ARTICLE_ID']); | ||
|
||
if ($REX['ARTICLE_ID'] !== $REX['START_ARTICLE_ID']) { | ||
$path = array_merge(array($REX['START_ARTICLE_ID']), $path); | ||
} | ||
|
||
foreach ($path as $id) { | ||
if ($id) { | ||
if ($this->startArticleName === false && intval($id) === $REX['START_ARTICLE_ID']) { | ||
continue; | ||
} | ||
|
||
if ($id > 0) { | ||
$article = OOArticle::getArticleById($id); | ||
$articleName = $article->getName(); | ||
|
||
if ($article->isOnline()) { | ||
if ($this->startArticleName !== '' && intval($id) === $REX['START_ARTICLE_ID']) { | ||
$articleName = $this->startArticleName; | ||
} | ||
|
||
$linkText = $article->getName(); | ||
$html .= '<li>'; | ||
|
||
if (intval($id) === $REX['START_ARTICLE_ID']) { | ||
if ($this->hideStartArticleName) { | ||
$linkText = ''; | ||
} else { | ||
if ($this->startArticleName != '') { | ||
$linkText = $this->startArticleName; | ||
} | ||
} | ||
|
||
if ($this->startArticleIconClass != '') { | ||
$linkText = '<i class="' . $this->startArticleIconClass . '"></i>' . $linkText; | ||
} | ||
} | ||
|
||
if (intval($id) === $REX['ARTICLE_ID']) { | ||
$html .= $articleName; | ||
$html .= $linkText; | ||
} else { | ||
$html .= '<a href="' . $article->getUrl() . '">' . $articleName . '</a>'; | ||
$html .= '<a href="' . $article->getUrl() . '">' . $linkText . '</a>'; | ||
} | ||
|
||
$html .= '</li>'; | ||
} | ||
} | ||
} | ||
|
||
$html .= '</' . $listType . '>'; | ||
|
||
return $html .= '</' . $listType . '>'; | ||
return $html; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.