Permalink
Browse files

Add a link to the current add-on type in the type column.

  • Loading branch information...
1 parent ba7cc68 commit 0d9b5c3924a52128c28877342f7755463f2b9470 @tobz-nz committed Apr 21, 2012
Showing with 18 additions and 12 deletions.
  1. +17 −11 system/third_party/devotee/acc.devotee.php
  2. +1 −1 system/third_party/devotee/views/accessory.php
@@ -33,6 +33,18 @@ class Devotee_acc {
protected $_addons = array();
/**
+ * @var array
+ * @access protected
+ */
+ protected $_available_types = array(
+ 'module' => 'MOD',
+ 'extension' => 'EXT',
+ 'plugin' => 'PLG',
+ 'fieldtype' => 'FLD',
+ 'accessory' => 'ACC'
+ );
+
+ /**
* @var string
* @access protected
*/
@@ -64,7 +76,7 @@ public function __construct()
// create cache folder if it doesn't exist
if(!is_dir($this->_cache_path))
{
- mkdir($this->_cache_path, DIR_WRITE_MODE);
+ mkdir($this->_cache_path, 0777);
}
// set theme url
@@ -115,7 +127,7 @@ public function set_sections()
*/
protected function _get_addons()
{
- $this->EE->load->helper('file');
+ $this->EE->load->helper(array('file','inflector'));
// load json services if not available in php
if( ! function_exists('json_decode'))
@@ -237,7 +249,8 @@ protected function _get_addons()
// return view
return $this->EE->load->view('accessory', array(
'updates' => json_decode($updates),
- 'last_check' => filemtime($cache_file)
+ 'last_check' => filemtime($cache_file),
+ 'available_types'=>$this->_available_types
), TRUE);
}
@@ -304,17 +317,10 @@ protected function _get_updates()
*/
protected function _abbreviate_types($types = array())
{
- $available_types = array(
- 'module' => 'MOD',
- 'extension' => 'EXT',
- 'plugin' => 'PLG',
- 'fieldtype' => 'FLD',
- 'accessory' => 'ACC'
- );
$abbrevs = array();
- foreach($available_types as $key => $abbrev)
+ foreach($this->_available_types as $key => $abbrev)
{
$abbrevs[$abbrev] = (in_array($key, $types)) ? TRUE : FALSE;
}
@@ -39,7 +39,7 @@
<td class="addon-type">
<ul>
<?php foreach($addon->types as $key => $val) : ?>
- <li class="<?php echo ($val) ? 'highlight' : '' ?>"><?php echo $key ?></li>
+ <li class="<?php echo ($val) ? 'highlight' : '' ?>"><?php if ($val) {?><a href="<?php echo BASE.'&amp;C=addons_'.plural(array_search($key, $available_types))?>"><?php echo $key ?></a><?php } else { echo $key; }?></li>
<?php endforeach ?>
</ul>
</td>

0 comments on commit 0d9b5c3

Please sign in to comment.