Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added Fustrate's home module, as sample module.

  • Loading branch information...
commit 68f54e8df0949f4c823de1776c6043e17342f5f2 1 parent 8bc3a0b
@norv norv authored
View
11 modules/home/HomeModule.php
@@ -0,0 +1,11 @@
+<?php
+
+namespace smCore\modules\home;
+use smCore\model\Module;
+
+/**
+ * Main class of the home module.
+ */
+class HomeModule extends Module
+{
+}
View
19 modules/home/config.yaml
@@ -0,0 +1,19 @@
+name: Home Module
+identifier: com.fustrate.home
+version: 1.0
+author:
+ name: Steven Hoffman
+ email: fustrate@me.com
+ website: http://www.fustrate.com/
+template_ns: home
+language_ns: home
+namespace: \smCore\modules\home
+routes:
+ home:
+ title: home_home
+ controller: \smCore\modules\home\controllers\HomeController
+ method: homeAction
+ order: 1
+ visible: true
+ resource: [role, member]
+ default: true
View
64 modules/home/controllers/HomeController.php
@@ -0,0 +1,64 @@
+<?php
+
+/**
+ * smCore platform
+ *
+ * @package home
+ * @author Fustrate
+ * @license MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version 1.1
+ * (the "License"); you may not use this package except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * The Original Code is smCore.
+ *
+ * The Initial Developer of the Original Code is the smCore project.
+ *
+ * Portions created by the Initial Developer are Copyright (C) 2011
+ * the Initial Developer. All Rights Reserved.
+ *
+ * @version 1.0 alpha
+ */
+
+namespace smCore\modules\home\controllers;
+use smCore\Application, smCore\handlers\ModuleController;
+
+/**
+ * Simple home page.
+ */
+class HomeController extends ModuleController
+{
+ /**
+ * Construct this controller.
+ */
+ public function __construct()
+ {
+ //
+ }
+
+ /**
+ * action home
+ */
+ public function homeAction()
+ {
+ $module = $this->_parentModule;
+ $module->loadTemplates('main');
+ $module->addTemplate('home');
+
+ Application::addValueToContext('random_welcome_message', mt_rand(0, 4));
+ Application::addValueToContext('page_title', $module->lang('home'));
+ }
+
+ public function preDispatch()
+ {
+ $module = $this->_parentModule;
+ $module->loadLanguage('strings.yaml');
+ }
+
+ public function postDispatch()
+ {
+ // TODO: Implement postDispatch() method.
+ }
+}
View
8 modules/home/languages/english_us.strings.yaml
@@ -0,0 +1,8 @@
+home:
+ welcome_messages:
+ - Hey!
+ - What?
+ - Huh?
+ - Totally!
+ - Meh.
+ home: Home
View
24 modules/home/templates/main.tox
@@ -0,0 +1,24 @@
+<tpl:container>
+ <tpl:template name="home:home">
+ <div style="width: 49%; float: left;" id="left_blocks"></div>
+ <div style="width: 49%; float: right;" id="right_blocks"></div>
+ <div class="clear"></div>
+
+ <script type="text/javascript"><!--
+ $(function()
+ {
+ left_blocks = $("#left_blocks");
+ right_blocks = $("#right_blocks");
+
+ $(".home_block").each(function(index)
+ {
+ $(this).detach().appendTo(index % 2 == 0 ? left_blocks : right_blocks);
+ });
+ });
+ --></script>
+
+ <site:rounded class="green home_block">
+ {#home.welcome_messages.{$context.random_welcome_message}}
+ </site:rounded>
+ </tpl:template>
+</tpl:container>
Please sign in to comment.
Something went wrong with that request. Please try again.