This repository has been archived by the owner on Aug 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Added a helper to handle navigation links and updated navigation pa…
…rtials accordingly.
- Loading branch information
Raphaël Rougeron
committed
Apr 22, 2008
1 parent
82bd75e
commit 6d166a9
Showing
6 changed files
with
61 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
|
||
/** | ||
* Helper for navigation links. | ||
* | ||
* It sets a 'class' attribute with 'current' as a value if the $href provided | ||
* corresponds to the request URI. | ||
* | ||
*/ | ||
class PHP_App_Base_Helper_NavAction extends Solar_View_Helper_Action | ||
{ | ||
/** | ||
* Internal request object. | ||
* | ||
* @var Solar_Request | ||
*/ | ||
protected $_request = null; | ||
|
||
/** | ||
* Constructor | ||
* | ||
* @param array $config User-specified configuration. | ||
*/ | ||
public function __construct($config = null) | ||
{ | ||
parent::__construct($config); | ||
|
||
$this->_request = Solar::factory('Solar_Request'); | ||
} | ||
|
||
/** | ||
* Returns an action link. | ||
* | ||
* The $text link text will be put in a span tag. | ||
* | ||
* @param string $href The action href. | ||
* | ||
* @param string $text A locale translation key. | ||
* | ||
* @return string | ||
*/ | ||
public function navAction($text, $href) | ||
{ | ||
if ($this->_request->server('REQUEST_URI') == $href) { | ||
return "<a class=\"current\" href=\"$href\"><span>$text</span></a>"; | ||
} | ||
return "<a href=\"$href\"><span>$text</span></a>"; | ||
} | ||
} | ||
|
||
?> |
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,5 +1,5 @@ | ||
<ul id="nav-links"> | ||
<li class="current"><a href="/contributors"><span>My Account</span></a></li> | ||
<li><a href="/contributors/upload"><span>Upload test(s)</span></a></li> | ||
<li><a href="/contributors/myfiles"><span>My Files</span></a></li> | ||
<li><?php echo $this->navAction('My Account', '/contributors'); ?></li> | ||
<li><?php echo $this->navAction('Upload test(s)', '/contributors/upload'); ?></li> | ||
<li><?php echo $this->navAction('My Files', '/contributors/myfiles'); ?></li> | ||
</ul> |
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,6 +1,6 @@ | ||
<ul id="nav-links"> | ||
<li class="current"><a href="/mentors/my"><span>My Account</span></a></li> | ||
<li><a href="/mentors/review"><span>Test Review</span></a></li> | ||
<li><a href="/mentors/livetest"><span>Live Testing Area</span></a></li> | ||
<li><a href="/mentors/announce"><span>Announcements</span></a></li> | ||
<li><?php echo $this->navAction('My Account', '/mentors/my'); ?></li> | ||
<li><?php echo $this->navAction('Test Review', '/mentors/review'); ?></li> | ||
<li><?php echo $this->navAction('Live Testing Area', '/mentors/livetest'); ?></li> | ||
<li><?php echo $this->navAction('Announcements', '/mentors/announce'); ?></li> | ||
</ul> |
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 |
---|---|---|
|
@@ -25,7 +25,7 @@ class PHP_App_Contributors extends PHP_App_Base | |
*/ | ||
public function actionIndex() | ||
{ | ||
|
||
} | ||
|
||
/** | ||
|
This file was deleted.
Oops, something went wrong.
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