示例#1
0
/**
 * Register's menu items for icon's menu. Used in icon libraries in the preview.php
 * to view the icons in the admin @link /admin/utilities/icons
 *
 * @param array $icons	An array with names of the icons to register.
 * @param int   $size	The size of the icons. Default <64>
 *
 * @return void
*/
function deyan_icons_menu($icons, $size = 64) {
	foreach ($icons as $icon) {
	elgg_register_menu_item('icons', array(
				'name' => $icon,
				'href' => "#$icon",
				'text' => deyan_view_icon($icon, $size) . $icon,
			));
	}
}
示例#2
0
/**
 * @package Deyan
 * @author Angel Gabriel
 * @web http://angelgabriel.tk
 * @mail angel.wrt@gmail.com
 **/  

function deyan_init() {

    //Register & Load our libraries
	$lib_path = elgg_get_plugins_path() . 'deyan/lib/';
	elgg_register_library('deyan', $lib_path . 'deyan.php');
	elgg_register_library('iconslib', $lib_path . 'icons.php');
	elgg_register_library('panel', $lib_path . 'panel.php');
	elgg_register_library('themes', $lib_path . 'themes.php');
	
	elgg_load_library('deyan'); 
	elgg_load_library('iconslib'); 
	elgg_load_library('panel'); 
	elgg_load_library('themes'); 
	
    //Register our hook for the index
	elgg_register_plugin_hook_handler('index', 'system', 'deyan_index_handler');

    //Register actions
	$action_path = elgg_get_plugins_path() . 'deyan/actions/deyan';
	elgg_register_action("deyan/xor_selector", "$action_path/xor_selector.php");
	elgg_register_action("deyan/background", "$action_path/background.php");
	elgg_register_action("deyan/panel", "$action_path/panel.php");
	elgg_register_action("deyan/iconadmin", "$action_path/iconadmin.php");
	
        
    //page handlers
	elgg_register_page_handler('dashboard', 'deyan_dashboard_handler'); 
	elgg_register_page_handler('personalize', 'deyan_personalize_handler');
	elgg_register_page_handler('register', 'deyan_register_handler');
	elgg_register_page_handler('login', 'deyan_login_handler');
	elgg_register_page_handler('forgotpassword', 'deyan_forgotpassword_handler');
	
    //render admin section
	deyan_admin_init();

	
    //we don't want search box in the header
	elgg_unextend_view('page/elements/header', 'search/search_box');
    //also the search css is included on theme's panel css
	elgg_unextend_view('css/elgg', 'search/css');
    
    //Page menus
    $user = elgg_get_logged_in_user_entity();
    
		// Personalize > appearance
		elgg_register_menu_item('page', array(
			'name' => 'personalize_appearance',
			'text' => elgg_echo('deyan:appearance'),
			'href' => "personalize/appearance/{$user->username}",
			'context' => 'personalize',
		));
		
		// Personalize > theme
		if(elgg_get_plugin_setting('theme_selector', 'deyan') == 'yes') {
		elgg_register_menu_item('page', array(
			'name' => 'personalize_theme',
			'text' => elgg_echo('deyan:theme'),
			'href' => "personalize/theme/{$user->username}",
			'context' => 'personalize',
		));
		}
		// Personalize > icons
		if(elgg_get_plugin_setting('icon_selector', 'deyan') == 'yes') {
		elgg_register_menu_item('page', array(
			'name' => 'personalize_icons',
			'text' => elgg_echo('deyan:icons'),
			'href' => "personalize/icons/{$user->username}",
			'context' => 'personalize',
		));
		}
		// personalize > panel
		elgg_register_menu_item('page', array(
			'name' => 'personalize_panel',
			'text' => elgg_echo('deyan:panel'),
			'href' => "personalize/panel/{$user->username}",
			'context' => 'personalize',
		));


    // Register our panel modules. Also we register the user & start menus to be showed on the modules 
    // user_menu & start_menu.
    
    if (elgg_is_active_plugin('search')) {
			deyan_register_panel_mod('search', 'right', 1000);
		}
		
    if(elgg_is_logged_in()){
		
		
		
		// Mods for the left side of the panel
		
		deyan_register_panel_mod('dashboard', 'left', 600);
		deyan_register_panel_mod('start_menu');
			//Register the start menu
			elgg_register_menu_item('start', array(	
				'name' => 'activity',
				'href' => "activity",
				'text' => deyan_view_icon('world') . elgg_echo('activity'),
				'priority' => 10,
			));
			if (elgg_is_active_plugin('blog')) {
			elgg_register_menu_item('start', array(	
				'name' => 'blog',
				'href' => "/blog/owner/$user->username",
				'text' => deyan_view_icon('notepad') . elgg_echo('blog'),
				'priority' => 70,
			));
			}
			
			if (elgg_is_active_plugin('pages')) {
				elgg_register_menu_item('start', array(	
					'name' => 'pages',
					'href' => "/pages/owner/$user->username",
					'text' => deyan_view_icon('file') . elgg_echo('pages'),
					'priority' => 20,
				));
			}
			
			if (elgg_is_active_plugin('groups')) {
				elgg_register_menu_item('start', array(	
					'name' => 'groups',
					'href' => "/groups/member/$user->username",
					'text' => deyan_view_icon('friends') . elgg_echo('groups'),
					'priority' => 30,
				));
			}
			
			if (elgg_is_active_plugin('bookmarks')) {
				elgg_register_menu_item('start', array(	
					'name' => 'bookmarks',
					'href' => "/bookmarks/owner/$user->username",
					'text' => deyan_view_icon('bookmarks') . elgg_echo('bookmarks'),
					'priority' => 40,
				));
			}
			
			if (elgg_is_active_plugin('file')) {
				elgg_register_menu_item('start', array(	
					'name' => 'file',
					'href' => "/file/owner/$user->username",
					'text' => deyan_view_icon('hard-drive') . elgg_echo('files'),
					'priority' => 50,
				));
			}
			
			if (elgg_is_active_plugin('thewire')) {
				elgg_register_menu_item('start', array(	
					'name' => 'thewire',
					'href' => "/thewire/friends/$user->username",
					'text' => deyan_view_icon('wireless') . elgg_echo('thewire'),
					'priority' => 60,
				));
			}
				
		
		
		// Mods for the right side of the panel
		
		deyan_register_panel_mod('friends', 'right', 800);
		
		if (elgg_is_active_plugin('messages')) {
			deyan_register_panel_mod('messages', 'right', 600);
		}

		deyan_register_panel_mod('user_menu', 'right', 400);			
			//Register the user menu
			elgg_register_menu_item('user', array(
				'name' => 'usersettings',
				'href' => "settings/user/" . $user->username,
				'text' => deyan_view_icon('settings', 16) . elgg_echo('settings'),
				'priority' => 800,
			));

			elgg_register_menu_item('user', array(
				'name' => 'logout',
				'href' => "action/logout",
				'text' => deyan_view_icon('logout', 16) . elgg_echo('logout'),
				'is_action' => TRUE,
				'priority' => 1000,
			));
			
			elgg_register_menu_item('user', array(
				'name' => 'profile',
				'href' =>  $user->getURL(),
				'text' => deyan_view_icon('user', 16) . elgg_echo('profile'),
				'priority' => 200,
			));
			
			elgg_register_menu_item('user', array(
				'name' => 'personalize',
				'href' =>  "personalize/appearance/$user->username",
				'text' => deyan_view_icon('paint', 16) . elgg_echo('deyan:personalize'),
				'priority' => 400,
			));
			
			if (elgg_is_admin_logged_in()) {
			elgg_register_menu_item('user', array(
				'name' => 'administration',
				'href' => 'admin',
				'text' => deyan_view_icon('gear', 16) . elgg_echo('admin'),
				'priority' => 600,
			));
			}
		
	}
	else{
	// Mods for non-logged in people
		deyan_register_panel_mod('login_menu', 'right');
		deyan_register_panel_mod('register', 'right');
	}
	
	
    // Register default theme <glass>
	deyan_register_theme('glass');
	
    // Register the default icon library
	deyan_register_iconlib('gray');
	
    
}
示例#3
0
<?php
/**
 * @package Deyan
 * @author Angel Gabriel
 * @web http://angelgabriel.tk
 * @mail angel.wrt@gmail.com
 *
 * @view panel/modules/login_menu/content
 * This file holds the login form of the panel
 * 
 **/  

$login_url = elgg_get_site_url();
if (elgg_get_config('https_login')) {
	$login_url = str_replace("http", "https", elgg_get_site_url());
}

$body = elgg_view_form('login', array('action' => "{$login_url}action/login"), array('returntoreferer' => TRUE));

echo deyan_view_panel_module('login-menu', $body, 'small', deyan_view_icon('user-alt', 32));
?>
示例#4
0
<?php
/**
 * @package Deyan
 * @author Angel Gabriel
 * @web http://angelgabriel.tk
 * @mail angel.wrt@gmail.com
 *
 * @view panel/modules/dashboard/content
 * This file shows the link to the dashboard or index
 * 
 **/ 

echo deyan_view_panel_link('dashboard', deyan_view_icon('crop', 32));
?> 
示例#5
0
 *
 * This is the main page for non-logged in people.
 *
 **/ 

?>

<div class="deyan-index">
	<ul>
		<li>
			<?php echo deyan_view_icon('friends', 128); ?> <label> <?php echo elgg_echo('friends'); ?> </label>
		</li>
		
		<li>
			<?php echo deyan_view_icon('apps', 128); ?> <label> <?php echo elgg_echo('groups'); ?> </label>
		</li>
		
		<li>
			<?php echo deyan_view_icon('bookmarks', 128); ?> <label> <?php echo elgg_echo('bookmarks'); ?> </label>
		</li>
		
		<li>
			<?php echo deyan_view_icon('mail', 128); ?> <label> <?php echo elgg_echo('messages'); ?> </label>
		</li>
		
		<li>
			<?php echo deyan_view_icon('notepad', 128); ?> <label> <?php echo elgg_echo('blog'); ?> </label>
		</li>
	</ul>
</div>
示例#6
0
<?php
/**
 * @package Deyan
 * @author Angel Gabriel
 * @web http://angelgabriel.tk
 * @mail angel.wrt@gmail.com
 *
 * @view panel/modules/register/content
 * This file echo the link to register page
 * 
 **/ 

echo deyan_view_panel_link('register', deyan_view_icon('edit-square', 32));
?> 
示例#7
0
<?php
/**
 * @package Deyan
 * @author Angel Gabriel
 * @web http://angelgabriel.tk
 * @mail angel.wrt@gmail.com
 *
 * @view panel/modules/friends/content
 * This file shows the link to the friends page
 * 
 **/ 
$user = elgg_get_logged_in_user_entity();
echo deyan_view_panel_link("friends/$user->username", deyan_view_icon('friends', 32));
?> 
示例#8
0
<?php
/**
 * @package Deyan
 * @author Angel Gabriel
 * @web http://angelgabriel.tk
 * @mail angel.wrt@gmail.com
 *
 * @view panel/modules/start_menu/content
 * This file shows the main menu
 * 
 **/

$content = elgg_view_menu('start', array('sort_by' => 'priority'));
$content .= "<div class=\"clearfloat\"></div>";

echo deyan_view_panel_module('start-menu', $content, 'full', deyan_view_icon('apps', 32));
?>
示例#9
0
<?php
/**
 * @package Deyan
 * @author Angel Gabriel
 * @web http://angelgabriel.tk
 * @mail angel.wrt@gmail.com
 *
 * @view deyan/window/register_welcome
 * This file shows a welcome message when register
 * 
 **/ 

echo deyan_view_icon('light', 128);
echo elgg_echo('deyan:register:welcome');



?>  

示例#10
0
<?php
/**
 * @package Deyan
 * @author Angel Gabriel
 * @web http://angelgabriel.tk
 * @mail angel.wrt@gmail.com
 *
 * @view panel/modules/messages/content
 * This file echo the link to messages and count unread messages.
 * 
 **/ 
 $icon = deyan_view_icon('mail', 32); 
$num_messages = (int)messages_count_unread();
		if ($num_messages != 0) {
			$icon .= "<span class=\"messages-new\">$num_messages</span>";
			$messages = deyan_get_unread_messages();
			$body_vars = array(
				'folder' => 'inbox',
				'list' => $messages,
			);
			$content = elgg_view_form('messages/process', array(), $body_vars);
			echo deyan_view_panel_module('messages', $content, 'small', $icon);
		}
		else {
		echo deyan_view_panel_link('messages/inbox/' . elgg_get_logged_in_user_entity()->username, $icon);
		}

?> 
示例#11
0
<?php
/**
 * @package Deyan
 * @author Angel Gabriel
 * @web http://angelgabriel.tk
 * @mail angel.wrt@gmail.com
 *
 * @view panel/modules/user_menu/content
 * This file shows the user's menu
 * 
 **/
$user = elgg_get_logged_in_user_entity();
$icon_url = $user->getIconURL('small');
$icon = deyan_view_icon('user-alt', 32);
if(elgg_get_plugin_user_setting('avatar_panel', $user->guid, 'deyan')) {
	$icon = "<img src=\"$icon_url\" class=\"deyan-panel-avatar\"/>";
     }
echo deyan_view_panel_module('user-menu', elgg_view_menu('user', array('sort_by' => 'priority')), 'small', $icon);


?>