Example #1
0
function gravatar_link($email=null, $size=48, $alt='', $title='', $class='', $id='') 
{
	// Set our default image based on required size.
	$default_image = Template::theme_url('images/user.png');
	
	// Set our minimum site rating to PG
	$rating = 'PG';
	
	// Border color 
	$border = 'd6d6d6';
	
	// URL for Gravatar
	$gravatarURL = "http://www.gravatar.com/avatar.php?gravatar_id=%s&default=%s&size=%s&border=%s&rating=%s";
	
	$avatarURL = sprintf
	(
		$gravatarURL, 
		md5($email), 
		$default_image,
		$size,
		$border,
		$rating
	);
	
	return '<img src="'. $avatarURL .'" width="'.	$size .'" height="'. $size . '" alt="'. $alt .'" title="'. $title .'" class="'. $class .'" id="'. $id .'" />';
}
 /**
  * Creates an image link based on Gravatar for the specified email address.
  * It will default to the site's generic image if none is found for
  * the user.
  *
  * Note that if gravatar does not have an image that matches the criteria,
  * it will return a link to an image under *your_theme/images/user.png*.
  * Also, by explicity omitting email you're denying http-req to gravatar.com.
  *
  * @param $email string The email address to check for. If NULL, defaults to theme img.
  * @param $size int The width (and height) of the resulting image to grab.
  * @param $alt string Alt text to be put in the link tag.
  * @param $title string The title text to be put in the link tag.
  * @param $class string Any class(es) that should be assigned to the link tag.
  * @param $id string The id (if any) that should put in the link tag.
  *
  * @return string The resulting image tag.
  */
 function gravatar_link($email = NULL, $size = 48, $alt = '', $title = '', $class = NULL, $id = NULL)
 {
     // Set our default image based on required size.
     $default_image = Template::theme_url('images/user.png');
     // Set our minimum site rating to PG
     $rating = 'PG';
     // Border color
     $border = 'd6d6d6';
     // If email null, means we don't want gravatar.com HTTP request
     if ($email) {
         // Check if HTTP or HTTPS Request should be used
         if (isset($_SERVER['HTTPS'])) {
             $http_protocol = "https://secure.";
         } else {
             $http_protocol = "http://www.";
         }
         // URL for Gravatar
         $gravatarURL = $http_protocol . "gravatar.com/avatar.php?gravatar_id=%s&amp;default=%s&amp;size=%s&amp;border=%s&amp;rating=%s";
         $avatarURL = sprintf($gravatarURL, md5($email), $default_image, $size, $border, $rating);
     } else {
         $avatarURL = $default_image;
     }
     $alt = htmlentities($alt, ENT_QUOTES, 'UTF-8');
     $title = htmlentities($title, ENT_QUOTES, 'UTF-8');
     $id = $id !== NULL ? ' id="' . $id . '" ' : ' ';
     $class = $class !== NULL ? ' class="' . $class . '"' : ' ';
     return '<img src="' . $avatarURL . '" width="' . $size . '" height="' . $size . '" alt="' . $alt . '" title="' . $title . '" ' . $class . $id . ' />';
 }
Example #3
0
 /**
  * Constructor
  *
  * @return void
  */
 public function __construct()
 {
     parent::__construct();
     $this->load->model('orders/orders_model');
     $this->load->model('comments/comments_model');
     $this->lang->load('orders');
     Assets::add_js('codeigniter-csrf.js');
     Assets::add_js(Template::theme_url('js/editors/ckeditor/ckeditor.js'));
 }
Example #4
0
 /**
  * Constructor
  *
  * @return void
  */
 public function __construct()
 {
     parent::__construct();
     $this->load->model(array('profile/profile_model', 'profile_users/profile_users_model', 'team/team_model', 'registration/registration_model', 'registration_team/registration_team_model'));
     $this->lang->load('profile');
     $this->load->library('session');
     Assets::add_js('//cdn.tinymce.com/4/tinymce.min.js');
     Assets::add_js(Template::theme_url('js/editors/tiny_mce_init.js'));
     Assets::add_module_js('profile', 'profile.js');
 }
Example #5
0
 /**
  * Constructor
  *
  * @return void
  */
 public function __construct()
 {
     parent::__construct();
     $this->auth->restrict($this->permissionView);
     $this->load->model('orders/orders_model');
     $this->lang->load('orders');
     Assets::add_js(Template::theme_url('js/editors/ckeditor/ckeditor.js'));
     $this->form_validation->set_error_delimiters("<span class='error'>", "</span>");
     Template::set_block('sub_nav', 'settings/_sub_nav');
     Assets::add_module_js('orders', 'orders.js');
 }
Example #6
0
 /**
  *	add_news.
  *
  *	Displays a default list of news articles. The nbumber of articles displayed is managed via
  *	the news.default_article_count setting.
  *
  *	@return					<void>	This function outputs to the Template::render() function
  *
  */
 public function add_news()
 {
     $settings = $this->_settings;
     if ($this->input->post('submit')) {
         $this->load->module('news/content');
         $uploadData = array();
         $upload = true;
         if (isset($_FILES['attachment']) && is_array($_FILES['attachment']) && $_FILES['attachment']['error'] != 4) {
             $uploadData = $this->content->handle_upload();
             if (isset($uploadData['error']) && !empty($uploadData['error'])) {
                 $upload = false;
             }
         }
         if (count($uploadData) > 0 && $upload || count($uploadData) == 0 && $upload) {
             if ($id = $this->content->save_article($uploadData)) {
                 $article = $this->news_model->find($id);
                 $this->load->model('activities/activity_model');
                 $this->activity_model->log_activity($this->current_user->id, 'Created Article: ' . $article->id, 'news');
                 Template::set_message('Article successfully submitted. It will be reviewed by the news moderator.', 'success');
                 Template::set_view('index');
                 Template::render();
             } else {
                 Template::set_message('There was a problem creating the article: ' . $this->news_model->error);
             }
         } else {
             Template::set_message('There was a problem saving the file attachment: ' . $uploadData['error']);
         }
     }
     if ($settings['news.public_submissions'] == 1) {
         $showForm = true;
         if ($settings['news.public_submitters'] == 1) {
             $cookie = unserialize($this->input->cookie($this->config->item('sess_cookie_name')));
             $showForm = isset($cookie['logged_in']);
             $error = 'You must be <a href="' . site_url('/login/') . '">logged in</a> to post news to this site.';
             unset($cookie);
         }
         if ($showForm) {
             $this->load->helper('form');
             Assets::add_css(array(Template::theme_url('js/editors/markitup/skins/markitup/style.css'), Template::theme_url('js/editors/markitup/sets/default/style.css'), css_path() . 'chosen.css', css_path() . 'bootstrap-datepicker.css'));
             Assets::add_js(array(Template::theme_url('js/editors/markitup/jquery.markitup.js'), Template::theme_url('js/editors/markitup/sets/default/set.js'), js_path() . 'chosen.jquery.min.js', js_path() . 'bootstrap-datepicker.js'));
             Template::set('public', true);
             Template::set('settings', $settings);
             Template::set('toolbar_title', lang('us_create_news'));
             Template::set_view('content/news_form');
             Template::render();
         } else {
             show_error($error, 501, 'Form Access Error');
         }
     } else {
         show_error('<h2>Sorry</h2><br />Public news submissions are not currently available.<br /><a href="' . site_url() . '">Return to the site</a>.', 501, 'Public News Submission not available');
     }
 }
Example #7
0
 /**
  * Constructor
  *
  * @return void
  */
 public function __construct()
 {
     parent::__construct();
     $this->auth->restrict('Site.Reports.View');
     $this->auth->restrict('Bonfire.Activities.View');
     $this->lang->load('activities');
     $this->lang->load('datatable');
     Template::set('toolbar_title', lang('activity_title'));
     Assets::add_js(Template::theme_url('js/bootstrap.js'));
     Assets::add_js($this->load->view('reports/activities_js', null, true), 'inline');
     Assets::add_js(array(Template::theme_url('js/jquery.dataTables.min.js')));
     Assets::add_js(array(Template::theme_url('js/bootstrap-dataTables.js')));
     Assets::add_css(array(Template::theme_url('css/datatable.css')));
     Assets::add_css(array(Template::theme_url('css/bootstrap-dataTables.css')));
     //Assets::add_module_css ('activities', 'datatables.css');
     if (has_permission('Activities.User.View') || has_permission('Activities.Module.View') || has_permission('Activities.Date.View')) {
         Template::set_block('sub_nav', 'reports/_sub_nav');
     }
 }
Example #8
0
 /**
  * Checks Auth Permissions and setups all java-scripts and other stuff
  *
  * @property CI_Pagination $pagination
  * @property MY_Model      $my_model
  * @property news_model    $news_model
  * @property author_model  $author_model
  *
  * @return   void
  */
 public function __construct()
 {
     parent::__construct();
     $this->auth->restrict('News.Content.View');
     $this->load->model('news/news_model');
     $this->load->model('news/author_model');
     $this->load->helper('news');
     $this->lang->load('news');
     $this->load->helper('author');
     $this->load->library('pagination');
     $this->_settings = $this->settings_model->select('name,value')->find_all_by('module', 'news');
     Assets::add_css(array(Template::theme_url('js/editors/markitup/skins/markitup/style.css'), Template::theme_url('js/editors/markitup/sets/default/style.css'), css_path() . 'chosen.css', css_path() . 'bootstrap-datepicker.css'));
     Assets::add_js(array(Template::theme_url('js/editors/markitup/jquery.markitup.js'), Template::theme_url('js/editors/markitup/sets/default/set.js'), js_path() . 'chosen.jquery.min.js', js_path() . 'bootstrap-datepicker.js'));
     $the_path = $this->_settings['news.upload_dir_path'];
     $this->_news_dir = realpath($the_path);
     if (!is_dir($this->_news_dir) && !is_writeable($this->_news_dir)) {
         Template::set_message('Attachment Upload Directory is not write-able: ' . $this->_news_dir, 'error');
         log_message('error', 'Attachment Upload Directory is not write-able: ' . $this->_news_dir);
     }
     Template::set_block('sub_nav', 'content/_sub_nav');
 }
Example #9
0
<?php

Assets::add_js(array(Template::theme_url('js/bootstrap.min.js'), Template::theme_url('js/jwerty.js')), 'external', true);
echo theme_view('partials/_header');
?>

<div class="container-fluid body">

	<div class="row-fluid">
		<div class="span2">
			<?php 
echo Template::block('sidebar');
?>
		</div>

		<div class="span10">
			<?php 
echo Template::message();
?>

			<?php 
echo isset($content) ? $content : Template::content();
?>

		</div>
	</div>

</div>

<?php 
echo theme_view('partials/_footer');
Example #10
0
<div class="view split-view">
	<!-- List -->
	<div class="view">
	
		<?php if (isset($logs) && is_array($logs) && count($logs)) : ?>
		
		<div class="scrollable">
			<div class="list-view" id="user-list">
			<?php foreach ($logs as $log) : ?>
				<?php if ($log != 'index.html') : ?>
				<div class="list-item" data-id="<?php echo $log ?>">				
					<img src="<?php echo Template::theme_url('images/issue.png') ?>" />

					<p>
						<b><?php 
								echo date('F j, Y', strtotime(str_replace('.php', '', str_replace('log-', '', $log))));
							?></b><br/>
						<?php echo $log ?>
					</p>
				</div>
				<?php endif; ?>
			<?php endforeach; ?>
			</div>	<!-- /list -->
		</div>
		
		<?php else : ?>
		
			<div class="notification information">
				<p>No logs found.</p>
			</div>
		
Example #11
0
<div class="view split-view">
	
	<!-- Role List -->
	<div class="view">
	
	<?php if (isset($roles) && is_array($roles) && count($roles)) : ?>
		<div class="scrollable">
			<div class="list-view" id="role-list">
				<?php foreach ($roles as $role) : ?>
					<div class="list-item with-icon" data-id="<?php echo $role->role_id ?>">
						<img src="<?php echo Template::theme_url('images/customers.png') ?>" />
					
						<p>
							<b><?php echo $role->role_name ?></b><br/>
							<span class="small"><?php echo $role->description ?></span>
						</p>
					</div>
				<?php endforeach; ?>
			</div>	<!-- /list-view -->
		</div>
	
	<?php else: ?>
	
	<div class="notification attention">
		<p>There aren't any roles in the system. <?php echo anchor('admin/settings/roles/create', 'Create a new role.') ?></p>
	</div>
	
	<?php endif; ?>
	</div>
	
	<!-- Role Editor -->
Example #12
0
	<!-- Role List -->
	<div class="view">	
	<?php 
if (isset($modules) && is_array($modules) && count($modules)) {
    ?>
		<div class="scrollable">
			<div class="list-view" id="module-list">
				<?php 
    foreach ($modules as $module => $config) {
        ?>
					<div class="list-item with-icon" data-id="<?php 
        echo $config['name'];
        ?>
">
						<img src="<?php 
        echo Template::theme_url('images/database.png');
        ?>
" />
					
						<p>
							<b><?php 
        echo $config['name'];
        ?>
</b><br/>
							<span class="small"><?php 
        echo isset($config['description']) ? $config['description'] : lang('mb_generic_description');
        ?>
</span>
						</p>
					</div>
				<?php 
Example #13
0
					
					<p><b>Development</b><br/>
					<span><?php echo $settings['development']['default']['hostname'] .'/'. $settings['development']['default']['database'] ?></span>
					</p>
				</div>
				
				<div class="list-item with-icon" data-id="testing">
					<img src="<?php echo Template::theme_url('images/database.png') ?>" />
					
					<p><b>Staging/Test</b><br/>
					<span><?php echo $settings['testing']['default']['hostname'] .'/'. $settings['testing']['default']['database'] ?></span>
					</p>
				</div>
				
				<div class="list-item with-icon" data-id="production">
					<img src="<?php echo Template::theme_url('images/database.png') ?>" />
					
					<p><b>Production</b><br/>
					<span><?php echo $settings['production']['default']['hostname'] .'/'. $settings['production']['default']['database'] ?></span>
					</p>
				</div>
			
			</div>
		</div>
	
	</div>	<!-- /vertical-panel -->
	
	<!-- Editor -->
	<div id="content" class="view">
		<div class="scrollable" id="ajax-content">
			
Example #14
0
 /**
  * Renders a list-based menu (with submenus) for each context.
  *
  * @param string $mode            What to output in the top menu ('icon'/'text'/'both').
  * @param string $order_by        The sort order of the elements ('normal'/'reverse'/'asc'/'desc').
  * @param boolean $top_level_only If true, output only the top-level links.
  * @param boolean $benchmark      If true, output benchmark start/end marks.
  *
  * @return string A string with the built navigation.
  */
 public static function render_menu($mode = 'text', $order_by = 'normal', $top_level_only = false, $benchmark = false)
 {
     if ($benchmark) {
         self::$ci->benchmark->mark('render_menu_start');
     }
     // As long as the contexts were set with setContexts(), the required contexts
     // should be in place. However, it's still a good idea to make sure an array
     // of contexts was provided.
     $contexts = self::getContexts();
     if (empty($contexts) || !is_array($contexts)) {
         die(self::$ci->lang->line('bf_no_contexts'));
     }
     // Sorting (top-level menus).
     switch ($order_by) {
         case 'reverse':
             $contexts = array_reverse($contexts);
             break;
         case 'asc':
             natsort($contexts);
             break;
         case 'desc':
             rsort($contexts);
             break;
         case 'normal':
         case 'default':
         default:
             break;
     }
     $template = '';
     if ($mode == 'text') {
         $template = self::$templateContextText;
     } else {
         $template = self::$templateContextImage;
         if ($mode == 'both') {
             $template .= self::$templateContextText;
         }
     }
     $template .= self::$templateContextEnd;
     // Build out the navigation.
     $menu = '';
     foreach ($contexts as $context) {
         // Don't display an entry in the menu if the user doesn't have permission
         // to view it (unless the permission doesn't exist).
         $viewPermission = 'Site.' . ucfirst($context) . '.View';
         if (self::$ci->auth->has_permission($viewPermission) || !self::$ci->auth->permission_exists($viewPermission)) {
             // The text/image displayed in the top-level context menu.
             $title = self::$ci->lang->line("bf_context_{$context}");
             $navTitle = str_replace(array('{title}', '{image}'), array($title, $mode == 'text' ? '' : Template::theme_url("images/context_{$context}.png")), $template);
             // Build the menu for this context.
             $menu .= str_replace(array('{parent_class}', '{url}', '{id}', '{current_class}', '{title}', '{extra}', '{text}', '{content}'), array(self::$parent_class . ' ' . check_class($context, true), site_url(self::$site_area . "/{$context}"), "tb_{$context}", $top_level_only ? '' : self::$templateContextMenuAnchorClass, $title, str_replace('{dataId}', $context, self::$templateContextMenuExtra), $navTitle, $top_level_only ? '' : self::context_nav($context)), self::$templateContextMenu);
         }
     }
     // Put the generated menu into the context nav template.
     $nav = str_replace(array('{class}', '{extra}', '{menu}'), array(self::$outer_class, trim(self::$outer_id) == '' ? '' : ' id="' . self::$outer_id . '"', $menu), self::$templateContextNav);
     if ($benchmark) {
         self::$ci->benchmark->mark('render_menu_end');
     }
     return $nav;
 }
Example #15
0
	</div>	<!-- /users-list -->
	
	<!-- User Editor -->
	<div id="content" class="view">
		<div class="scrollable" id="ajax-content">
			<div class="padded">
			
				<div class="row" style="margin-bottom: 2.5em">
					<div class="column size1of2">
						<img src="<?php echo Template::theme_url('images/user.png') ?>" style="vertical-align: bottom; position: relative; top: -5px; margin-right: 1em;" />	
						
						<span class="big-text"><b><?php echo $user_count ?></b></span> &nbsp; users
					</div>
					
					<div class="column size1of2">
						<img src="<?php echo Template::theme_url('images/user.png') ?>" style="vertical-align: bottom; position: relative; top: -5px; margin-right: 1em;" />	
						
						<span class="big-text"><b><?php echo $deleted_users ?></b></span> &nbsp; <?php echo anchor('admin/settings/users/deleted', 'deleted users', 'class="ajaxify"') ?>
					</div>
				</div>
			
			
				<div class="box create rounded">
					<a class="button good ajaxify" href="<?php echo site_url('admin/settings/users/create'); ?>">Create New User</a>
				
					<h3>Create A New User</h3>
					
					<p>Create new accounts for other users in your circle.</p>
				</div>	
				
				<div class="row" style="margin-top: 3em">
Example #16
0
<?php
	// Setup our default assets to load.
	Assets::add_js( array(
		base_url() .'assets/js/jquery-1.5.min.js',
		Template::theme_url('js/jquery.form.js'),
		Template::theme_url('js/jquery.ajaxify.min.js'),
		Template::theme_url('js/ui.js')
	));
?>
<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	
	<title><?php echo isset($toolbar_title) ? $toolbar_title .' : ' : ''; ?> <?php echo config_item('site.title') ?></title>
	
	<?php Assets::css(null, 'screen', true); ?>
	
	<!-- Fix the mobile Safari auto-zoom bug -->
	<meta name="viewport" content="width=device-width, initial-scale=1"/>
	
	<script src="<?php echo base_url() .'assets/js/head.min.js' ?>"></script>
</head>
<body>

	<noscript>
		<p>Javascript is required to use Bonfire's admin.</p>
	</noscript>
	
	<div id="message">
		<?php echo Template::message(); ?>
Example #17
0
		<?php 
if (isset($toolbar_title)) {
    ?>
			<h1><?php 
    echo $toolbar_title;
    ?>
</h1>
		<?php 
}
?>

		<div class="pull-right" id="sub-menu">
			<?php 
Template::block('sub_nav', '');
?>
		</div>
	</div>
</div>

<!-- Ajax Loader Image/Overlay -->
<div id="loader">
	<div class="box">
		<img src="<?php 
echo Template::theme_url('images/ajax_loader.gif');
?>
" />
	</div>
</div>

<!-- End Ajax Loader Image/Overlay -->
Example #18
0
				<div class="row" style="margin-bottom: 2.5em">
					<div class="column size1of2">
						<img src="<?php 
echo Template::theme_url('images/user.png');
?>
" style="vertical-align: bottom; position: relative; top: -5px; margin-right: 1em;" />	
						
						<span class="big-text"><b><?php 
echo $user_count;
?>
</b></span> &nbsp; users
					</div>
					
					<div class="column size1of2 last-column">
						<img src="<?php 
echo Template::theme_url('images/user.png');
?>
" style="vertical-align: bottom; position: relative; top: -5px; margin-right: 1em;" />	
						
						<span class="big-text"><b><?php 
echo $deleted_users;
?>
</b></span> &nbsp; <?php 
echo anchor(SITE_AREA . '/settings/users/deleted', 'deleted users', 'class="ajaxify"');
?>
					</div>
				</div>
			
			
				<div class="box create rounded">
					<a class="button good ajaxify" href="<?php 
Example #19
0
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title><?php 
e($this->settings_lib->item('site.title'));
?>
</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">

				<script src="<?php 
echo Template::theme_url('js/modernizr-2.5.3.js');
?>
"></script>

				<?php 
echo Assets::css();
?>

    <!-- iPhone and Mobile favicon's and touch icons -->
    <link rel="shortcut icon" href="<?php 
echo base_url();
?>
favicon.ico">
    <link rel="apple-touch-icon" href="<?php 
echo base_url();
?>
assets/images/apple-touch-icon.png">
    <link rel="apple-touch-icon" sizes="72x72" href="<?php 
Example #20
0
 /**
  * Renders a list-based menu (with submenus) for each context.
  *
  * @param string $mode           What to display in the top menu. Either 'icon', 'text', or 'both'.
  * @param string $order_by       Determines the sort order of the elements. Valid options are 'normal', 'reverse', 'asc', 'desc'.
  * @param bool   $top_level_only If true, will only display the top-level links.
  * @param bool   $benchmark      If true, benchmark start/end marks will be output
  *
  * @return string A string with the built navigation.
  */
 public static function render_menu($mode = 'text', $order_by = 'normal', $top_level_only = false, $benchmark = false)
 {
     if ($benchmark) {
         self::$ci->benchmark->mark('render_menu_start');
     }
     $contexts = self::$contexts;
     if (empty($contexts) || !is_array($contexts) || !count($contexts)) {
         die(lang('bf_no_contexts'));
     }
     // Ensure required contexts exist
     foreach (self::$requiredContexts as $requiredContext) {
         if (!in_array($requiredContext, $contexts)) {
             $contexts[] = $requiredContext;
         }
     }
     // Sorting
     switch ($order_by) {
         case 'reverse':
             $contexts = array_reverse($contexts);
             break;
         case 'asc':
             natsort($contexts);
             break;
         case 'desc':
             rsort($contexts);
             break;
         case 'normal':
             // no break
         // no break
         case 'default':
             // no break
         // no break
         default:
             break;
     }
     $parentClass = self::$parent_class;
     $siteAreaUrl = site_url(self::$site_area) . '/';
     $template = '';
     if ($mode == 'text') {
         $template = self::$templateContextText;
     } else {
         $template = self::$templateContextImage;
         if ($mode == 'both') {
             $template .= self::$templateContextText;
         }
     }
     $template .= self::$templateContextEnd;
     $search = array('{parent_class}', '{url}', '{id}', '{current_class}', '{title}', '{extra}', '{text}', '{content}');
     $menu = '';
     // Build out the navigation.
     foreach ($contexts as $context) {
         $viewPermission = 'Site.' . ucfirst($context) . '.View';
         if (has_permission($viewPermission) || !permission_exists($viewPermission)) {
             $url = $siteAreaUrl . $context;
             $class = check_class($context, true);
             $id = "tb_{$context}";
             $title = lang("bf_context_{$context}");
             $icon = $mode == 'text' ? '' : Template::theme_url("images/context_{$context}.png");
             $navTitle = str_replace(array('{title}', '{image}'), array($title, $icon), $template);
             $replace = array("{$parentClass} {$class}", $url, $id, self::$templateContextMenuAnchorClass, $title, str_replace('{dataId}', $context, self::$templateContextMenuExtra), $navTitle, $top_level_only ? '' : self::context_nav($context));
             $menu .= str_replace($search, $replace, self::$templateContextMenu);
         }
     }
     $extra = trim(self::$outer_id) == '' ? '' : ' id="' . self::$outer_id . '"';
     $nav = str_replace(array('{class}', '{extra}', '{menu}'), array(self::$outer_class, $extra, $menu), self::$templateContextNav);
     if ($benchmark) {
         self::$ci->benchmark->mark('render_menu_end');
     }
     return $nav;
 }
 /**
  * Builds the navigation used in the admin theme for the main
  * contexts list.
  *
  * @param $mode string The type of toolbar buttons to create. Valid options are 'icon', 'text', 'both'.
  *
  * @return string A string with the toolbar items required for the context nav.
  */
 function context_nav($mode = 'icon')
 {
     $contexts = config_item('contexts');
     if (empty($contexts) || !is_array($contexts) || !count($contexts)) {
         die(lang('bf_no_contexts'));
     }
     // Ensure settings context exists
     if (!in_array('settings', $contexts)) {
         array_push($contexts, 'settings');
     }
     // Ensure developer context exists
     if (!in_array('developer', $contexts)) {
         array_push($contexts, 'developer');
     }
     $nav = '';
     /*
     	Build out our navigation.
     */
     foreach ($contexts as $context) {
         if (has_permission('Site.' . ucfirst($context) . '.View')) {
             $url = site_url(SITE_AREA . '/' . $context);
             $class = check_class($context);
             $id = 'tb_' . $context;
             $title = lang('bf_context_' . $context);
             $nav .= "<a href='{$url}' {$class} id='{$id}' title='{$title}'>";
             // Image
             if ($mode == 'icon' || $mode == 'both') {
                 $nav .= "<img src='" . Template::theme_url('images/context_' . $context . '.png') . "' alt='{$title}' />";
             }
             // Display String
             if ($mode == 'text' || $mode == 'both') {
                 $nav .= $title;
             }
             $nav .= "</a>";
         }
     }
     return $nav;
 }
Example #22
0
 /**
  * Renders a list-based menu (with submenus) for each context.
  *
  * @access public
  * @static
  *
  * @param string $mode           What to display in the top menu. Either 'icon', 'text', or 'both'.
  * @param string $order_by       Determines the sort order of the elements. Valid options are 'normal', 'reverse', 'asc', 'desc'.
  * @param bool   $top_level_only If TRUE, will only display the top-level links.
  *
  * @return string A string with the built navigation.
  */
 public static function render_menu($mode = 'text', $order_by = 'normal', $top_level_only = FALSE)
 {
     self::$ci->benchmark->mark('context_menu_start');
     $contexts = self::$contexts;
     if (empty($contexts) || !is_array($contexts) || !count($contexts)) {
         die(lang('bf_no_contexts'));
     }
     // Ensure settings context exists
     if (!in_array('settings', $contexts)) {
         array_push($contexts, 'settings');
     }
     // Ensure developer context exists
     if (!in_array('developer', $contexts)) {
         array_push($contexts, 'developer');
     }
     // Sorting
     switch ($order_by) {
         case 'reverse':
             $contexts = array_reverse($contexts);
             break;
         case 'asc':
             natsort($contexts);
             break;
         case 'desc':
             rsort($contexts);
             break;
         case 'normal':
         case 'default':
             break;
     }
     $nav_id = trim(self::$outer_id) != '' ? ' id="' . self::$outer_id . '"' : '';
     $nav = '<ul class="' . self::$outer_class . '" ' . $nav_id . ' >';
     /*
     	Build out our navigation.
     */
     foreach ($contexts as $context) {
         if (has_permission('Site.' . ucfirst($context) . '.View') == true || permission_exists('Site.' . ucfirst($context) . '.View') == false) {
             $url = site_url(self::$site_area . '/' . $context);
             $class = check_class($context, true);
             $id = 'tb_' . $context;
             if (lang('bf_context_' . $context)) {
                 $title = lang('bf_context_' . $context);
             } else {
                 $title = ucfirst($context);
             }
             $nav .= "<li class='dropdown {$class}'><a href='{$url}' id='{$id}' class='dropdown-toggle' title='{$title}' data-toggle='dropdown' data-id='{$context}_menu'>";
             // Image
             if ($mode == 'icon' || $mode == 'both') {
                 $nav .= "<img src='" . Template::theme_url('images/context_' . $context . '.png') . "' alt='{$title}' />";
             }
             // Display String
             if ($mode == 'text' || $mode == 'both') {
                 $nav .= "{$title}";
             }
             $nav .= "<b class='caret'></b></a>";
             if (!$top_level_only) {
                 $nav .= self::context_nav($context);
             }
             $nav .= "</li>\n";
         }
         //end if
     }
     //end foreach
     $nav .= '</ul>';
     self::$ci->benchmark->mark('context_menu_end');
     return $nav;
 }
 /**
  * Create an image link based on Gravatar for the specified email address.
  * It will default to the site's generic image if none is found for the user.
  *
  * Note that if gravatar does not have an image that matches the criteria, it
  * will default to gravatar's 'identicon' return a link to an image under *your_theme/images/user.png*.
  * Also, by explicity omitting email you're denying http-req to gravatar.com.
  *
  * @param string  $email The email address to check for. If null, the gravatar
  * image defaults to 'identicon'.
  * @param integer $size  The width (and height) of the resulting image to grab.
  * @param string $alt   Alt text to be put in the link tag.
  * @param string $title The title text to be put in the link tag.
  * @param string $class Any class(es) that should be assigned to the link tag.
  * @param string $id    The id (if any) that should put in the link tag.
  *
  * @return string The resulting image tag.
  */
 function gravatar_link($email = null, $size = 48, $alt = '', $title = '', $class = null, $id = null)
 {
     // Make sure $size is an integer.
     $size = empty($size) || is_object($size) || !is_int($size) ? 48 : intval($size);
     // If email is empty, don't send an HTTP request to gravatar.com.
     if (empty($email)) {
         $avatarURL = Template::theme_url('images/user.png');
     } else {
         // While it would be more efficient to place the values for $defaultImage,
         // $rating, and $gravatarUrl (and $httpProtocol) directly into the call
         // to sprintf(), it would be more difficult to document and change the
         // values when necessary (as was the case when the format for the URL
         // changed in the past).
         //
         // Similarly, the calls to the strtolower() and rawurlencode() functions
         // to manipulate the $rating and $defaultImage values in the sprintf()
         // call could be avoided/removed by making sure the values were correct
         // beforehand, but the requirements would need to be documented for
         // each value anyway...
         // Set the default image.
         $defaultImage = 'identicon';
         // Set the minimum site rating to PG.
         $rating = 'PG';
         // Check whether HTTP or HTTPS Request should be used.
         $httpProtocol = is_https() ? 'https://secure.' : 'http://www.';
         // URL for Gravatar, with placeholders for sprintf().
         $gravatarUrl = "{$httpProtocol}gravatar.com/avatar/%s?s=%s&amp;r=%s&amp;d=%s";
         $avatarURL = sprintf($gravatarUrl, md5(strtolower(trim($email))), $size, strtolower($rating), rawurlencode($defaultImage));
     }
     // Escape all of the attributes, except the src, width, and height.
     // Use an empty alt attribute if $alt is empty.
     $alt = empty($alt) ? '' : html_escape($alt);
     // These are the most commonly-required attributes for an image tag.
     $imageAttributes = array("src='{$avatarURL}'", "width='{$size}'", "height='{$size}'", "alt='{$alt}'");
     if (!empty($id)) {
         $imageAttributes[] = "id='" . html_escape($id) . "'";
     }
     if (!empty($class)) {
         $imageAttributes[] = "class='" . html_escape($class) . "'";
     }
     if (!empty($title)) {
         $imageAttributes[] = "title='" . html_escape($title) . "'";
     }
     return "<img " . implode(' ', $imageAttributes) . " />";
 }
Example #24
0
echo isset(Template::$blocks['nav_bottom']) ? 'with-bottom-bar' : '';
?>
">
			<?php 
echo Template::yield();
?>
	</div>
	
	<?php 
Template::block('nav_bottom', '');
?>
	
	<div id="loader">
		<div class="box">
			<img src="<?php 
echo Template::theme_url();
?>
images/ajax_loader.gif" />
		</div>
	</div>
	
	<div id="debug"><!-- Stores the Profiler Results --></div>
	
	<script>
		head.js(<?php 
echo Assets::external_js(null, true);
?>
);
		head.js(<?php 
echo Assets::module_js(true);
?>
Example #25
0
					<span><?php 
    echo lang('activity_module_description');
    ?>
</span>
					</p>
				</div>
				<?php 
}
?>

				<?php 
if (has_permission('Activities.Date.View')) {
    ?>
				<div class="list-item with-icon" data-id="activity_date">
					<img src="<?php 
    echo Template::theme_url('images/calendar.png');
    ?>
" />
					
					<p><b><?php 
    echo lang('activity_date');
    ?>
</b><br/>
					<span><?php 
    echo lang('activity_date_description');
    ?>
</span>
					</p>
				</div>
				<?php 
}
Example #26
0
	
		<div class="scrollable">
			<div class="list-view" id="role-list">
				<?php 
    foreach ($records as $record) {
        ?>
					<?php 
        $record = (array) $record;
        ?>
					<?php 
        $permission_pieces = explode('.', $record['name']);
        if ($permission_pieces[0] != $permission_header) {
            ?>
					<h4 class="permission_set pointer">
						<img src="<?php 
            echo Template::theme_url('images/plus.png');
            ?>
" />	
						<?php 
            echo $permission_pieces[0];
            ?>
				
					</h4>
					<?php 
            $permission_header = $permission_pieces[0];
            ?>
					<?php 
        }
        ?>
					
					<div class="list-item" data-id="<?php 
Example #27
0
						<span class="icon-bar"></span>
						<span class="icon-bar"></span>
					</a>
					<?php 
echo anchor('/', html_escape($this->settings_lib->item('site.title')), 'class="brand"');
?>


					<?php 
if (isset($shortcut_data) && is_array($shortcut_data['shortcuts']) && is_array($shortcut_data['shortcut_keys']) && count($shortcut_data['shortcut_keys'])) {
    ?>
					<!-- Shortcut Menu -->
					<div class="nav pull-right" id="shortcuts">
					<div class="btn-group">
						<a class="dropdown-toggle light btn" data-toggle="dropdown" href="#"><img src="<?php 
    echo Template::theme_url('images/keyboard-icon.png');
    ?>
" id="shortkeys_show" title="Keyboard Shortcuts" alt="Keyboard Shortcuts"/></a>
						<ul class="dropdown-menu pull-right toolbar-keys">
								<li>
										<div class="inner keys">
											<?php 
    if (isset($shortcut_data) && is_array($shortcut_data['shortcut_keys'])) {
        ?>
											<h4><?php 
        echo lang('bf_keyboard_shortcuts');
        ?>
</h4>
											<ul>
											<?php 
        foreach ($shortcut_data['shortcut_keys'] as $key => $data) {
Example #28
0
	<div class="view">
	
	<?php 
if (isset($roles) && is_array($roles) && count($roles)) {
    ?>
		<div class="scrollable">
			<div class="list-view" id="role-list">
				<?php 
    foreach ($roles as $role) {
        ?>
					<div class="list-item with-icon" data-id="<?php 
        echo $role->role_id;
        ?>
">
						<img src="<?php 
        echo Template::theme_url('images/customers.png');
        ?>
" />
					
						<p>
							<b><?php 
        echo $role->role_name;
        ?>
</b><br/>
							<span class="small"><?php 
        echo $role->description;
        ?>
</span>
						</p>
					</div>
				<?php 
Example #29
0
    ?>
		
		<div class="scrollable">
			<div class="list-view" id="user-list">
			<?php 
    foreach ($logs as $log) {
        ?>
				<?php 
        if ($log != 'index.html') {
            ?>
				<div class="list-item" data-id="<?php 
            echo $log;
            ?>
">				
					<img src="<?php 
            echo Template::theme_url('images/issue.png');
            ?>
" />

					<p>
						<b><?php 
            echo date('F j, Y', strtotime(str_replace('.php', '', str_replace('log-', '', $log))));
            ?>
</b><br/>
						<?php 
            echo $log;
            ?>
					</p>
				</div>
				<?php 
        }
Example #30
0
 /**
  * Display the screen to edit the email templagtes
  *
  * @access public
  *
  * @return void
  */
 public function template()
 {
     if ($this->input->post('submit')) {
         $header = $_POST['header'];
         $footer = $_POST['footer'];
         $this->load->helper('file');
         write_file(APPPATH . 'core_modules/emailer/views/email/_header.php', $header, 'w+');
         write_file(APPPATH . 'core_modules/emailer/views/email/_footer.php', $footer, 'w+');
         Template::set_message('Template successfully saved.', 'success');
         redirect(SITE_AREA . '/settings/emailer/template');
     }
     Assets::add_js(Template::theme_url('js/editors/ace/ace.js'));
     Assets::add_js(Template::theme_url('js/editors/ace/theme-monokai.js'));
     Assets::add_js(Template::theme_url('js/editors/ace/mode-html.js'));
     Assets::add_module_js('emailer', 'js/ace');
     Template::set('toolbar_title', lang('em_email_template'));
     Template::render();
 }