getConfig()["SETTINGS"][self::getSectionName()] );
}
/**
* @return array
*/
protected static function getFileContentArray( )
{
return self::$_file_content_array;
}
/**
* @param array $file_content_array
*/
private static function setFileContentArray( )
{
self::$_file_content_array = file( Settings::SETTINGS_PATH . parent::getInstance()->getConfig()["SETTINGS"][self::getSectionName()] );
}
/**
* @return array
*/
protected static function getNavigation( )
{
return self::$_navigation;
}
/**
* @param array $navigation
*/
private static function setNavigation( )
{
self::$_navigation = new \RecursiveIteratorIterator(
new \RecursiveArrayIterator(
json_decode( self::getFileContentString() , TRUE )
), \RecursiveIteratorIterator::SELF_FIRST
);
}
/**
* Displays the content of the file line by line on the
* screen if it is in json format
*/
public function displayRawJsonNavigation( )
{
foreach (self::getNavigation() as $key => $val)
{
if(is_array($val))
{
echo "$key:
\n";
}
else
{
echo "$key => $val
\n";
}
}
}
/**
* Loads the navigation from a json file into
* the view, making the variables available
*/
public function loadJsonNavigationArray( $name = false )
{
if( $name )
{
self::$_navigation_array = array();
self::setSectionName( $name );
self::setName( $name );
parent::getInstance();
self::setFileContentString();
self::setFileContentArray();
self::setNavigation();
}
$nav = self::getNavigation();
foreach ( $nav as $item => $value)
{
if($item == self::getSectionName())
{
$keys = array_keys($value);
for($i=0; sizeof($keys)>$i;$i++)
{
if(array_key_exists('link', $value[$keys[$i]]))
{
self::$_navigation_array[] = array(
'title' => $keys[$i],
'icon' => $value[$keys[$i]]["icon"],
'link' => $value[$keys[$i]]["link"],
'tooltip' => $value[$keys[$i]]["tooltip"]
);
}
elseif(array_key_exists('onclick', $value[$keys[$i]]))
{
self::$_navigation_array[] = array(
'title' => $keys[$i],
'icon' => $value[$keys[$i]]["icon"],
'tooltip' => $value[$keys[$i]]["tooltip"],
'onclick' => $value[$keys[$i]]["onclick"]
);
}
}
}
}
if( $name )
{
View::getInstance()->getEngine()->assignGlobal(self::getName(), self::$_navigation_array);
}
else
{
View::getInstance()->getEngine()->assignGlobal("navigationJson", self::$_navigation_array);
}
}
}