diff options
author | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-02-13 01:30:12 +0000 |
---|---|---|
committer | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-02-13 01:30:12 +0000 |
commit | 0b17969bf1eecf5698a6cd5a4e17b763d198771d (patch) | |
tree | 0af25a0a8c74ed91d30dac8b208c0e8d227bc3a1 /mod | |
parent | 020d82988582c543e04b679a0eb0b89743c8227c (diff) | |
download | elgg-0b17969bf1eecf5698a6cd5a4e17b763d198771d.tar.gz elgg-0b17969bf1eecf5698a6cd5a4e17b763d198771d.tar.bz2 |
updated custom index for 1.8
git-svn-id: http://code.elgg.org/elgg/trunk@8193 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod')
-rw-r--r-- | mod/custom_index/index.php | 91 | ||||
-rw-r--r-- | mod/custom_index/languages/en.php | 25 | ||||
-rw-r--r-- | mod/custom_index/manifest.xml | 22 | ||||
-rw-r--r-- | mod/custom_index/start.php | 49 | ||||
-rw-r--r-- | mod/custom_index/views/default/canvas/layouts/new_index.php | 131 | ||||
-rw-r--r-- | mod/custom_index/views/default/custom_index/css.php | 100 | ||||
-rw-r--r-- | mod/custom_index/views/default/layout/shells/custom_index.php | 65 |
7 files changed, 182 insertions, 301 deletions
diff --git a/mod/custom_index/index.php b/mod/custom_index/index.php index 953e2a85b..34a24ba38 100644 --- a/mod/custom_index/index.php +++ b/mod/custom_index/index.php @@ -1,36 +1,59 @@ <?php +/** + * Elgg custom index page + * + */ - /** - * Elgg custom index - * - * @package ElggCustomIndex - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd <info@elgg.com> - * @copyright Curverider Ltd 2008 - * @link http://elgg.com/ - */ - - // Get the Elgg engine - require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); - - //get required data - set_context('search');//display results in search mode, which is list view - //grab the latest 4 blog posts. to display more, change 4 to something else - $blogs = elgg_list_entities(array('type' => 'object', 'subtype' => 'blog', 'limit' => 4, 'full_view' => FALSE, 'view_type_toggle' => FALSE, 'pagination' => FALSE)); - //grab the latest bookmarks - $bookmarks = elgg_list_entities(array('type' => 'object', 'subtype' => 'bookmarks', 'limit' => 4, 'full_view' => FALSE, 'view_type_toggle' => FALSE, 'pagination' => FALSE)); - //grab the latest files - $files = elgg_list_entities(array('type' => 'object', 'subtype' => 'file', 'limit' => 4, 'full_view' => FALSE, 'view_type_toggle' => FALSE, 'pagination' => FALSE)); - //get the newest members who have an avatar - $newest_members = elgg_get_entities_from_metadata(array('metadata_names' => 'icontime', 'types' => 'user', 'limit' => 10)); - //newest groups - $groups = elgg_list_entities(array(type => 'group', 'limit' => 4, 'full_view' => FALSE, 'view_type_toggle' => FALSE, 'pagination' => FALSE)); - //grab the login form - $login = elgg_view("account/forms/login"); - - //display the contents in our new canvas layout - $body = elgg_view_layout('new_index',$login, $files, $newest_members, $blogs, $groups, $bookmarks); - - page_draw($title, $body); - -?>
\ No newline at end of file +elgg_push_context('front'); + +elgg_push_context('widgets'); + +$list_params = array( + 'type' => 'object', + 'limit' => 4, + 'full_view' => false, + 'view_type_toggle' => false, + 'pagination' => false, +); + +//grab the latest 4 blog posts +$list_params['subtype'] = 'blog'; +$blogs = elgg_list_entities($list_params); + +//grab the latest bookmarks +$list_params['subtype'] = 'bookmarks'; +$bookmarks = elgg_list_entities($list_params); + +//grab the latest files +$list_params['subtype'] = 'file'; +$files = elgg_list_entities($list_params); + +//get the newest members who have an avatar +$newest_members = elgg_list_entities_from_metadata(array( + 'metadata_names' => 'icontime', + 'types' => 'user', + 'limit' => 10, +)); + +//newest groups +$list_params['type'] = 'group'; +unset($list_params['subtype']); +$groups = elgg_list_entities($list_params); + +//grab the login form +$login = elgg_view("core/account/login_box"); + +elgg_pop_context(); + +// lay out the content +$params = array( + 'blogs' => $blogs, + 'bookmarks' => $bookmarks, + 'files' => $files, + 'groups' => $groups, + 'login' => $login, + 'members' => $newest_members, +); +$body = elgg_view_layout('custom_index', $params); + +echo elgg_view_page('', $body); diff --git a/mod/custom_index/languages/en.php b/mod/custom_index/languages/en.php index 091297297..071ff81e5 100644 --- a/mod/custom_index/languages/en.php +++ b/mod/custom_index/languages/en.php @@ -1,17 +1,14 @@ <?php +/** + * Custom Index English language file + */ - $english = array( - - 'custom:bookmarks' => "Latest bookmarks", - 'custom:groups' => "Latest groups", - 'custom:files' => "Latest files", - 'custom:blogs' => "Latest blog posts", - 'custom:members' => "Newest members", - 'custom:nofiles' => "There are no files yet", - 'custom:nogroups' => "There are no groups yet", - - ); +$english = array( + 'custom:bookmarks' => "Latest bookmarks", + 'custom:groups' => "Latest groups", + 'custom:files' => "Latest files", + 'custom:blogs' => "Latest blog posts", + 'custom:members' => "Newest members", +); - add_translation("en",$english); - -?>
\ No newline at end of file +add_translation("en", $english); diff --git a/mod/custom_index/manifest.xml b/mod/custom_index/manifest.xml index 16e648f54..fe4dcacf0 100644 --- a/mod/custom_index/manifest.xml +++ b/mod/custom_index/manifest.xml @@ -1,11 +1,15 @@ <?xml version="1.0" encoding="UTF-8"?> -<plugin_manifest> - <field key="author" value="Curverider" /> - <field key="version" value="1.7" /> - <field key="description" value="A simple plugin to replace the sites index page with boxes containing the latest content from the site." /> - <field key="website" value="http://www.elgg.org/" /> - <field key="copyright" value="(C) Curverider 2008-2010" /> - <field key="licence" value="GNU Public License version 2" /> - <field key="elgg_version" value="2010030101" /> - <field key="admin_interface" value="advanced" /> +<plugin_manifest xmlns="http://www.elgg.org/plugin_manifest/1.8"> + <name>Custom Index</name> + <author>Curverider</author> + <version>1.8</version> + <description>A demonstration of how to create a front page plugin.</description> + <website>http://www.elgg.org/</website> + <copyright>(C) Curverider 2008-2010</copyright> + <license>GNU Public License version 2</license> + <requires> + <type>elgg_version</type> + <version>2009030702</version> + </requires> + <admin_interface>advanced</admin_interface> </plugin_manifest> diff --git a/mod/custom_index/start.php b/mod/custom_index/start.php index 16d277a10..3c395e87b 100644 --- a/mod/custom_index/start.php +++ b/mod/custom_index/start.php @@ -1,36 +1,25 @@ <?php +/** + * Elgg demo custom index page plugin + * + */ - /** - * Elgg custom index page - * - * @package ElggIndexCustom - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider <info@elgg.com> - * @copyright Curverider Ltd 2008 - * @link http://elgg.com/ - */ +register_elgg_event_handler('init', 'system', 'custom_index_init'); - - function indexCustom_init() { - - // Extend system CSS with our own styles - elgg_extend_view('css','custom_index/css'); - - // Replace the default index page - register_plugin_hook('index','system','custom_index'); - - - } - - function custom_index() { - - if (!include_once(dirname(__FILE__) . "/index.php")) return false; - return true; - - } +function custom_index_init() { + // Extend system CSS with our own styles + elgg_extend_view('css/screen', 'custom_index/css'); - // Make sure the - register_elgg_event_handler('init','system','indexCustom_init'); + // Replace the default index page + register_plugin_hook('index', 'system', 'custom_index'); +} -?>
\ No newline at end of file +function custom_index() { + if (!include_once(dirname(__FILE__) . "/index.php")) { + return false; + } + + // return true to signify that we have handled the front page + return true; +} diff --git a/mod/custom_index/views/default/canvas/layouts/new_index.php b/mod/custom_index/views/default/canvas/layouts/new_index.php deleted file mode 100644 index e1b48ec0c..000000000 --- a/mod/custom_index/views/default/canvas/layouts/new_index.php +++ /dev/null @@ -1,131 +0,0 @@ -<?php - - /** - * Elgg custom profile - * You can edit the layout of this page with your own layout and style. Whatever you put in the file - * will replace the frontpage of your Elgg site. - * - * @package Elgg - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd - * @copyright Curverider Ltd 2008 - * @link http://elgg.org/ - */ - -?> - -<div id="custom_index"> - - <!-- left column content --> - <div id="index_left"> - <!-- welcome message --> - <div id="index_welcome"> - <?php - if (isloggedin()){ - echo "<h2>" . elgg_echo("welcome") . " "; - echo $vars['user']->name; - echo "</h2>"; - } - ?> - <?php - //include a view that plugins can extend - echo elgg_view("index/lefthandside"); - ?> - <?php - //this displays some content when the user is logged out - if (!isloggedin()){ - //display the login form - echo $vars['area1']; - echo "<div class=\"clearfloat\"></div>"; - } - ?> - </div> -<?php - if(is_plugin_enabled('file')){ -?> - <!-- display latest files --> - <div class="index_box"> - <h2><?php echo elgg_echo("custom:files"); ?></h2> - <?php - if (!empty($vars['area2'])) { - echo $vars['area2'];//this will display files - }else{ - echo "<p><?php echo elgg_echo('custom:nofiles'); ?></p>"; - } - ?> - </div> -<?php - } - - if(is_plugin_enabled('groups')){ -?> - <!-- display latest groups --> - <div class="index_box"> - <h2><?php echo elgg_echo("custom:groups"); ?></h2> - <?php - if (!empty($vars['area5'])) { - echo $vars['area5'];//this will display groups - }else{ - echo "<p><?php echo elgg_echo('custom:nogroups'); ?>.</p>"; - } - ?> - </div> -<?php - } -?> - </div> - - <!-- right hand column --> - <div id="index_right"> - <!-- more content --> - <?php - //include a view that plugins can extend - echo elgg_view("index/righthandside"); - ?> - <!-- latest members --> - <div class="index_box"> - <h2><?php echo elgg_echo("custom:members"); ?></h2> - <div class="contentWrapper"> - <?php - if(isset($vars['area3'])) { - //display member avatars - foreach($vars['area3'] as $members){ - echo "<div class=\"index_members\">"; - echo elgg_view("profile/icon",array('entity' => $members, 'size' => 'small')); - echo "</div>"; - } - } - ?> - <div class="clearfloat"></div> - </div> - </div> -<?php - if(is_plugin_enabled('blog')){ -?> - <!-- latest blogs --> - <div class="index_box"> - <h2><?php echo elgg_echo("custom:blogs"); ?></h2> - <?php - if (isset($vars['area4'])) - echo $vars['area4']; //display blog posts - ?> - </div> -<?php - } - - if(is_plugin_enabled('bookmarks')){ -?> - <!-- display latest bookmarks --> - <div class="index_box"> - <h2><?php echo elgg_echo("custom:bookmarks"); ?></h2> - <?php - if (isset($vars['area6'])) - echo $vars['area6']; //display bookmarks - ?> - </div> -<?php - } -?> - </div> - <div class="clearfloat"></div> -</div>
\ No newline at end of file diff --git a/mod/custom_index/views/default/custom_index/css.php b/mod/custom_index/views/default/custom_index/css.php index 9c35aaa27..f21ea72b2 100644 --- a/mod/custom_index/views/default/custom_index/css.php +++ b/mod/custom_index/views/default/custom_index/css.php @@ -1,86 +1,20 @@ <?php - /** - * Custom Index page css extender - * - * @package custom_index - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider <info@elgg.com> - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.org/ - */ +/** + * Custom Index CSS + * + */ ?> -#custom_index { - margin:10px; -} -#index_left { - width:442px; - float:left; - margin:0 0 30px 0; - padding:0 0 20px 0px; -} -#index_right { - width:442px; - float:right; - margin:0 0 30px 0; - padding:0 0px 20px 0; -} -#index_welcome { - padding:5px 10px 5px 10px; - margin:0 0 20px 0; - border:1px solid silver; - background: white; - -moz-border-radius: 8px; - -webkit-border-radius: 8px; -} -#index_welcome #login-box { - margin:5px 0 10px 0; - padding:0 0 10px 0; - background: #dedede; - -webkit-border-radius: 8px; - -moz-border-radius: 8px; - width:240px; -} -#index_welcome #login-box form { - margin:0 10px 0 10px; - padding:0 10px 4px 10px; - background: white; - -webkit-border-radius: 8px; - -moz-border-radius: 8px; - width:200px; -} -#index_welcome #login-box h2, -.index_box h2 { - color:#0054A7; - font-size:1.35em; - line-height:1.2em; - margin:0 0 0 8px; - padding:5px; -} -#index_welcome #login-box h2 { - padding-bottom:5px; -} - -.index_box { - margin:0 0 20px 0; - background: #dedede; - padding:0 0 5px 0; - -webkit-border-radius: 8px; - -moz-border-radius: 8px; -} - -.index_box .search_listing { - -} -.index_box .index_members { - float:left; - margin:2pt 5px 3px 0pt; -} -#persistent_login { - float:right; - display:block; - margin-top:-34px; -} - - - +/******************************* + Custom Index +********************************/ +.custom-index .elgg-module-featured { + box-shadow: 1px 1px 5px #CCC; + -moz-box-shadow: 1px 1px 5px #CCC; + -webkit-box-shadow: 1px 1px 5px #CCC; +} +.custom-index .elgg-module-featured:hover { + box-shadow: 1px 1px 6px #AAA; + -moz-box-shadow: 1px 1px 6px #AAA; + -webkit-box-shadow: 1px 1px 6px #AAA; +}
\ No newline at end of file diff --git a/mod/custom_index/views/default/layout/shells/custom_index.php b/mod/custom_index/views/default/layout/shells/custom_index.php new file mode 100644 index 000000000..48039dbd9 --- /dev/null +++ b/mod/custom_index/views/default/layout/shells/custom_index.php @@ -0,0 +1,65 @@ +<?php +/** + * Elgg custom index layout + * + * You can edit the layout of this page with your own layout and style. + * Whatever you put in this view will appear on the front page of your site. + * + */ +?> + +<div class="custom-index elgg-main elgg-grid clearfix"> + <div class="elgg-col elgg-col-1of2"> + <div class="elgg-inner pam"> +<?php +// left column + +// Top box for login or welcome message +if (elgg_is_logged_in()) { + $top_box = "<h2>" . elgg_echo("welcome") . " "; + $top_box .= get_loggedin_user()->name; + $top_box .= "</h2>"; +} else { + $top_box = $vars['login']; +} +echo elgg_view_module('featured', '', $top_box, array('header' => false)); + +// a view for plugins to extend +echo elgg_view("index/lefthandside"); + +// files +if (elgg_is_active_plugin('file')) { + echo elgg_view_module('featured', elgg_echo("custom:files"), $vars['files']); +} + +// groups +if (elgg_is_active_plugin('groups')) { + echo elgg_view_module('featured', elgg_echo("custom:groups"), $vars['groups']); +} +?> + </div> + </div> + <div class="elgg-col elgg-col-1of2"> + <div class="elgg-inner pam"> +<?php +// right column + +// a view for plugins to extend +echo elgg_view("index/righthandside"); + +// files +echo elgg_view_module('featured', elgg_echo("custom:members"), $vars['members']); + +// groups +if (elgg_is_active_plugin('blog')) { + echo elgg_view_module('featured', elgg_echo("custom:blogs"), $vars['blogs']); +} + +// files +if (elgg_is_active_plugin('bookmarks')) { + echo elgg_view_module('featured', elgg_echo("custom:bookmarks"), $vars['bookmarks']); +} +?> + </div> + </div> +</div> |