Skip to content

Commit

Permalink
Merge branch '2.2/develop' of github.com:pyrocms/pyrocms into 2.2/dev…
Browse files Browse the repository at this point in the history
…elop
  • Loading branch information
Phil Sturgeon committed Sep 17, 2012
2 parents ee2632d + 3dc58a5 commit 4dd14fb
Show file tree
Hide file tree
Showing 18 changed files with 352 additions and 460 deletions.
93 changes: 39 additions & 54 deletions system/cms/themes/pyrocms/theme.php
@@ -1,58 +1,49 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');

class Theme_PyroCMS extends Theme
{
class Theme_Pyrocms extends Theme {

public $name = 'PyroCMS - Admin Theme';
public $author = 'PyroCMS Dev Team';
public $author_website = 'http://pyrocms.com/';
public $website = 'http://pyrocms.com/';
public $description = 'PyroCMS admin theme. HTML5 and CSS3 styling.';
public $version = '1.0';
public $type = 'admin';
public $options = array(

'pyrocms_recent_comments' => array(
'title' => 'Recent Comments',
'description' => 'Would you like to display recent comments on the dashboard?',
'default' => 'yes',
'type' => 'radio',
'options' => 'yes=Yes|no=No',
'is_required' => TRUE
),

'pyrocms_news_feed' => array(
'title' => 'News Feed',
'description' => 'Would you like to display the news feed on the dashboard?',
'default' => 'yes',
'type' => 'radio',
'options' => 'yes=Yes|no=No',
'is_required' => TRUE
),

'pyrocms_quick_links' => array(
'title' => 'Quick Links',
'description' => 'Would you like to display quick links on the dashboard?',
'default' => 'yes',
'type' => 'radio',
'options' => 'yes=Yes|no=No',
'is_required' => TRUE
),

'pyrocms_analytics_graph' => array(
'title' => 'Analytics Graph',
'description' => 'Would you like to display the graph on the dashboard?',
'default' => 'yes',
'type' => 'radio',
'options' => 'yes=Yes|no=No',
'is_required' => TRUE
),
);
public $options = array('pyrocms_recent_comments' => array('title' => 'Recent Comments',
'description' => 'Would you like to display recent comments on the dashboard?',
'default' => 'yes',
'type' => 'radio',
'options' => 'yes=Yes|no=No',
'is_required' => TRUE),

'pyrocms_news_feed' => array('title' => 'News Feed',
'description' => 'Would you like to display the news feed on the dashboard?',
'default' => 'yes',
'type' => 'radio',
'options' => 'yes=Yes|no=No',
'is_required' => TRUE),

'pyrocms_quick_links' => array('title' => 'Quick Links',
'description' => 'Would you like to display quick links on the dashboard?',
'default' => 'yes',
'type' => 'radio',
'options' => 'yes=Yes|no=No',
'is_required' => TRUE),

'pyrocms_analytics_graph' => array('title' => 'Analytics Graph',
'description' => 'Would you like to display the graph on the dashboard?',
'default' => 'yes',
'type' => 'radio',
'options' => 'yes=Yes|no=No',
'is_required' => TRUE),
);

/**
* Run() is triggered when the theme is loaded for use
*
* This should contain the main logic for the theme.
*
* @access public
* @return void
*/
public function run()
Expand All @@ -63,19 +54,12 @@ public function run()
if ($this->module == '' && $this->method != 'login' && $this->method != 'help')
{
// don't bother fetching the data if it's turned off in the theme
if ($this->theme_options->pyrocms_analytics_graph === 'yes') self::get_analytics();
if ($this->theme_options->pyrocms_news_feed === 'yes') self::get_rss_feed();
if ($this->theme_options->pyrocms_recent_comments === 'yes') self::get_recent_comments();
if ($this->theme_options->pyrocms_analytics_graph == 'yes') self::get_analytics();
if ($this->theme_options->pyrocms_news_feed == 'yes') self::get_rss_feed();
if ($this->theme_options->pyrocms_recent_comments == 'yes') self::get_recent_comments();
}
}

/**
* Generate menu
*
* Build the admin menu at the top
*
* @return void
*/
private function generate_menu()
{
// Get a list of all modules available to this user/group
Expand All @@ -93,13 +77,13 @@ private function generate_menu()

foreach ($modules as $module)
{
if ( ! in_array($module['menu'], array('content', 'data', 'users', 'misc', 'addons', '0')))
if ($module['menu'] != 'content' && $module['menu'] != 'design' && $module['menu'] != 'users' && $module['menu'] != 'utilities' && $module['menu'] != '0')
{
$grouped_menu[] = $module['menu'];
}
}

array_push($grouped_menu, 'data', 'users', 'misc', 'addons');
array_push($grouped_menu, 'design', 'users', 'utilities');

$grouped_menu = array_unique($grouped_menu);

Expand All @@ -116,21 +100,22 @@ private function generate_menu()

public function get_analytics()
{
if ($this->settings->ga_email and $this->settings->ga_password and $this->settings->ga_profile)
if ($this->settings->ga_email AND $this->settings->ga_password AND $this->settings->ga_profile)
{
// Not FALSE? Return it
if ($cached_response = $this->pyrocache->get('analytics'))
{
$data['analytic_visits'] = $cached_response['analytic_visits'];
$data['analytic_views'] = $cached_response['analytic_views'];
}

else
{
try
{
$this->load->library('analytics', array(
'username' => $this->settings->ga_email,
'password' => $this->settings->ga_password,
'password' => $this->settings->ga_password
));

// Set by GA Profile ID if provided, else try and use the current domain
Expand Down

0 comments on commit 4dd14fb

Please sign in to comment.