mirror of
https://github.com/humhub/humhub.git
synced 2025-01-17 22:28:51 +01:00
Changes to the module system
This commit is contained in:
parent
78360b7824
commit
d3c8fb44c2
@ -26,11 +26,13 @@ Yii::import('application.extensions.migrate-command.EMigrateCommand');
|
||||
* @package humhub.commands
|
||||
* @since 0.5
|
||||
*/
|
||||
class ZMigrateCommand extends EMigrateCommand {
|
||||
class ZMigrateCommand extends EMigrateCommand
|
||||
{
|
||||
|
||||
public $migrationTable = 'migration';
|
||||
|
||||
public static function AutoMigrate() {
|
||||
public static function AutoMigrate()
|
||||
{
|
||||
|
||||
|
||||
/** $commandPath = Yii::app()->getBasePath() . DIRECTORY_SEPARATOR . 'commands';
|
||||
@ -52,7 +54,8 @@ class ZMigrateCommand extends EMigrateCommand {
|
||||
return htmlentities(ob_get_clean(), null, Yii::app()->charset);
|
||||
}
|
||||
|
||||
public function init() {
|
||||
public function init()
|
||||
{
|
||||
|
||||
print "Flushing Caches....\n";
|
||||
Yii::app()->cache->flush();
|
||||
@ -60,11 +63,14 @@ class ZMigrateCommand extends EMigrateCommand {
|
||||
|
||||
print "Autodetecting Modules....\n";
|
||||
|
||||
|
||||
|
||||
|
||||
$modulePaths = array();
|
||||
foreach (Yii::app()->moduleManager->getRegisteredModules() as $moduleId => $moduleInfo) {
|
||||
foreach (Yii::app()->moduleManager->getInstalledModules(true, true) as $moduleId => $classAlias) {
|
||||
|
||||
// Convert path.to.example.ExampleModule to path.to.example.migrations
|
||||
$path = explode(".", $moduleInfo['class']);
|
||||
$path = explode(".", $classAlias);
|
||||
array_pop($path);
|
||||
$path[] = $this->migrationSubPath;
|
||||
$migrationPath = implode(".", $path);
|
||||
@ -77,7 +83,8 @@ class ZMigrateCommand extends EMigrateCommand {
|
||||
$this->modulePaths = $modulePaths;
|
||||
}
|
||||
|
||||
protected function instantiateMigration($class) {
|
||||
protected function instantiateMigration($class)
|
||||
{
|
||||
|
||||
$migration = new $class;
|
||||
$migration->setDbConnection($this->getDbConnection());
|
||||
@ -88,7 +95,8 @@ class ZMigrateCommand extends EMigrateCommand {
|
||||
return $migration;
|
||||
}
|
||||
|
||||
public function run($args) {
|
||||
public function run($args)
|
||||
{
|
||||
|
||||
$exitCode = parent::run($args);
|
||||
|
||||
@ -96,7 +104,8 @@ class ZMigrateCommand extends EMigrateCommand {
|
||||
ModuleManager::flushCache();
|
||||
}
|
||||
|
||||
protected function getTemplate() {
|
||||
protected function getTemplate()
|
||||
{
|
||||
if ($this->templateFile !== null) {
|
||||
return parent::getTemplate();
|
||||
} else {
|
||||
|
248
protected/components/HWebModule.php
Normal file
248
protected/components/HWebModule.php
Normal file
@ -0,0 +1,248 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* HumHub
|
||||
* Copyright © 2014 The HumHub Project
|
||||
*
|
||||
* The texts of the GNU Affero General Public License with an additional
|
||||
* permission and of our proprietary license can be found at and
|
||||
* in the LICENSE file you have received along with this program.
|
||||
*
|
||||
* According to our dual licensing model, this program can be used either
|
||||
* under the terms of the GNU Affero General Public License, version 3,
|
||||
* or under a proprietary license.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Base Class for Modules / Extensions
|
||||
*
|
||||
* @author luke
|
||||
*/
|
||||
class HWebModule extends CWebModule
|
||||
{
|
||||
|
||||
/**
|
||||
* Loaded Module JSON File
|
||||
*
|
||||
* @var Array
|
||||
*/
|
||||
private $_moduleInfo = null;
|
||||
|
||||
public function preinit()
|
||||
{
|
||||
$this->attachBehaviors($this->behaviors());
|
||||
|
||||
parent::preinit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add behaviors to this module
|
||||
*
|
||||
* You may want to enable one of these behavior to alos make this module
|
||||
* available on space and/or user context.
|
||||
*
|
||||
* See related behaviors classes for more details.
|
||||
*
|
||||
* @return Array
|
||||
*/
|
||||
public function behaviors()
|
||||
{
|
||||
return array(
|
||||
/*
|
||||
'SpaceModuleBehavior' => array(
|
||||
'class' => 'application.modules_core.space.SpaceModuleBehavior',
|
||||
),
|
||||
|
||||
'UserModuleBehavior' => array(
|
||||
'class' => 'application.modules_core.user.UserModuleBehavior',
|
||||
),
|
||||
*/
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns modules name provided by module.json file
|
||||
*
|
||||
* @return string Description
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
$info = $this->getModuleInfo();
|
||||
|
||||
if ($info['name']) {
|
||||
return $info['name'];
|
||||
}
|
||||
|
||||
return $this->getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns modules description provided by module.json file
|
||||
*
|
||||
* @return string Description
|
||||
*/
|
||||
public function getDescription()
|
||||
{
|
||||
$info = $this->getModuleInfo();
|
||||
|
||||
if ($info['description']) {
|
||||
return $info['description'];
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns modules version number provided by module.json file
|
||||
*
|
||||
* @return string Version Number
|
||||
*/
|
||||
public function getVersion()
|
||||
{
|
||||
$info = $this->getModuleInfo();
|
||||
|
||||
if ($info['version']) {
|
||||
return $info['version'];
|
||||
}
|
||||
|
||||
return "1.0";
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns image url for this module
|
||||
*
|
||||
* @return String Image Url
|
||||
*/
|
||||
public function getImage()
|
||||
{
|
||||
return Yii::app()->baseUrl . '/uploads/profile_image/default_module.jpg';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns URL of configuration controller for this module.
|
||||
*
|
||||
* You may overwrite this method to provide advanced module configuration
|
||||
* possibilities.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getConfigUrl()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether this module is enabled or not
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isEnabled()
|
||||
{
|
||||
return Yii::app()->moduleManager->isEnabled($this->getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables this module
|
||||
*/
|
||||
public function enable()
|
||||
{
|
||||
if (!$this->isEnabled()) {
|
||||
|
||||
$moduleEnabled = ModuleEnabled::model()->findByPk($this->getId());
|
||||
if ($moduleEnabled == null) {
|
||||
|
||||
$moduleEnabled = new ModuleEnabled();
|
||||
$moduleEnabled->module_id = $this->getId();
|
||||
$moduleEnabled->save();
|
||||
|
||||
// Auto Migrate (add module database changes)
|
||||
Yii::import('application.commands.shell.ZMigrateCommand');
|
||||
$migrate = ZMigrateCommand::AutoMigrate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @todo also disable it on all spaces/users
|
||||
*/
|
||||
public function disable()
|
||||
{
|
||||
if ($this->isEnabled()) {
|
||||
$moduleEnabled = ModuleEnabled::model()->findByPk($this->getId());
|
||||
if ($moduleEnabled != null) {
|
||||
$moduleEnabled->delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads module.json which contains basic module informations and
|
||||
* returns it as array
|
||||
*
|
||||
* @return Array module.json content
|
||||
*/
|
||||
protected function getModuleInfo()
|
||||
{
|
||||
if ($this->_moduleInfo != null) {
|
||||
return $this->_moduleInfo;
|
||||
}
|
||||
|
||||
$moduleJson = file_get_contents($this->getPath() . DIRECTORY_SEPARATOR . 'module.json');
|
||||
return CJSON::decode($moduleJson);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns Base Path of Module
|
||||
*/
|
||||
public function getPath()
|
||||
{
|
||||
$reflection = new ReflectionClass($this);
|
||||
return dirname($reflection->getFileName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Uninstalls a module
|
||||
*
|
||||
* Removes module folder from system.
|
||||
* You may overwrite this method to add more cleanup stuff.
|
||||
*/
|
||||
public function uninstall()
|
||||
{
|
||||
|
||||
if ($this->isEnabled()) {
|
||||
$this->disable();
|
||||
}
|
||||
|
||||
$this->removeModuleFolder();
|
||||
}
|
||||
|
||||
/**
|
||||
* Installs a module
|
||||
*/
|
||||
public function install()
|
||||
{
|
||||
print "Install called" . $this->getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes module folder in case of uninstall or update
|
||||
*/
|
||||
protected function removeModuleFolder()
|
||||
{
|
||||
|
||||
$moduleBackupFolder = Yii::app()->getRuntimePath() . DIRECTORY_SEPARATOR . 'module_backups';
|
||||
if (!is_dir($moduleBackupFolder)) {
|
||||
mkdir($moduleBackupFolder);
|
||||
}
|
||||
|
||||
$backupFolderName = $moduleBackupFolder . DIRECTORY_SEPARATOR . $this->getId() . "_" . time();
|
||||
rename($this->getPath(), $backupFolderName);
|
||||
}
|
||||
|
||||
}
|
@ -19,156 +19,134 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* ModuleManager allows dynamic enabling/disabling of application modules.
|
||||
*
|
||||
* Each module has a autostart.php which can register the module.
|
||||
*
|
||||
* Modules must register with a module definition, which holds all relevant
|
||||
* information about it.
|
||||
*
|
||||
* Module Definition Array:
|
||||
* id => mymodule (also folder name under /modules/...)
|
||||
* title => My Module
|
||||
* icon => cssClass
|
||||
* description => someText (For Admin Manage Modules)
|
||||
* isSpaceModule => true/FALSE (Is a workspace module)
|
||||
* isCoreModule => true/FALSE (Is core module, always enabled)
|
||||
* configRoute => 'mymodule/configure' (Configuration URL for SuperAdmin)
|
||||
*
|
||||
* @todo cache enabled modules - problem module manager started before caching
|
||||
*
|
||||
* @package humhub.components
|
||||
* @since 0.5
|
||||
* Module Manager
|
||||
*
|
||||
* - Starts module autostart files
|
||||
* - Handles enabled modules
|
||||
* - Modules autostarts.php registers to it for events & co
|
||||
*
|
||||
*/
|
||||
class ModuleManager extends CApplicationComponent {
|
||||
class ModuleManager extends CApplicationComponent
|
||||
{
|
||||
|
||||
const AUTOSTART_CACHE_FILE_NAME = "cache_autostart.php";
|
||||
|
||||
/**
|
||||
* @var Array of all registered module definitions
|
||||
* List of all enabled module ids
|
||||
*
|
||||
* @var Array
|
||||
*/
|
||||
public $registeredModules;
|
||||
private $enabledModules = array();
|
||||
|
||||
/**
|
||||
* @var Array of enabled module ids.
|
||||
* Array of installed modules populated on autostart.php register
|
||||
*
|
||||
* @var Array moduleId => moduleClass
|
||||
*/
|
||||
public $enabledModules;
|
||||
private $installedModules = array();
|
||||
|
||||
/**
|
||||
* @var Array of registered content model classes.
|
||||
* Initializes the module manager
|
||||
*/
|
||||
public $registeredContentModels = array();
|
||||
|
||||
/**
|
||||
* Initializes the application component.
|
||||
* This should also should check which module is enabled
|
||||
*/
|
||||
public function init() {
|
||||
public function init()
|
||||
{
|
||||
|
||||
parent::init();
|
||||
|
||||
if (Yii::app()->params['installed'])
|
||||
$this->loadEnabledModules();
|
||||
if (Yii::app()->params['installed']) {
|
||||
|
||||
// Load all enabled modules
|
||||
$cacheId = "enabledModules";
|
||||
$cacheValue = Yii::app()->cache->get($cacheId);
|
||||
|
||||
if ($cacheValue === false || !is_array($cacheValue)) {
|
||||
|
||||
foreach (ModuleEnabled::model()->findAll() as $em) {
|
||||
$this->enabledModules[] = $em->module_id;
|
||||
}
|
||||
|
||||
Yii::app()->cache->set($cacheId, $this->enabledModules, HSetting::Get('expireTime', 'cache'));
|
||||
} else {
|
||||
$this->enabledModules = $cacheValue;
|
||||
}
|
||||
}
|
||||
|
||||
// Intercept this controller
|
||||
Yii::app()->interceptor->intercept($this);
|
||||
}
|
||||
|
||||
public function start() {
|
||||
|
||||
$this->executeAutoloaders();
|
||||
#print "start";
|
||||
#die();
|
||||
}
|
||||
|
||||
/**
|
||||
* Searches and executes all module autoloaders.
|
||||
*
|
||||
* The module autoloaders are stored in a file "autostart.php" which can be
|
||||
* placed in the root directory of the module.
|
||||
*
|
||||
* @todo Caching autostarts
|
||||
* @todo Remove rendundant code
|
||||
* Starts module manager which executes all enabled autoloaders
|
||||
*/
|
||||
private function executeAutoloaders() {
|
||||
|
||||
public function start()
|
||||
{
|
||||
$cacheEnabled = (get_class(Yii::app()->cache) != 'CDummyCache');
|
||||
|
||||
$cacheFileName = Yii::app()->getRuntimePath() . DIRECTORY_SEPARATOR . self::AUTOSTART_CACHE_FILE_NAME;
|
||||
|
||||
// Fastlane, when cache enabled and cachefile exists
|
||||
if ($cacheEnabled && file_exists($cacheFileName)) {
|
||||
require_once($cacheFileName);
|
||||
return;
|
||||
}
|
||||
|
||||
$fileNames = array();
|
||||
$autostartFiles = array();
|
||||
|
||||
// Looking up 3rd party modules
|
||||
/*
|
||||
// Recursively collect all module_core autostarts
|
||||
$modulesCorePath = Yii::app()->getBasePath() . DIRECTORY_SEPARATOR . 'modules_core';
|
||||
$modules = scandir($modulesCorePath);
|
||||
foreach ($modules as $moduleId) {
|
||||
$autostartFiles[] = $modulesCorePath . DIRECTORY_SEPARATOR . $moduleId . DIRECTORY_SEPARATOR . 'autostart.php';
|
||||
}
|
||||
|
||||
// Collect autostarts of enabled modules
|
||||
$modulesCustomPath = Yii::app()->getBasePath() . DIRECTORY_SEPARATOR . 'modules';
|
||||
foreach ($this->enabledModules as $moduleId) {
|
||||
$autostartFiles[] = $modulesCustomPath . DIRECTORY_SEPARATOR . $moduleId . DIRECTORY_SEPARATOR . 'autostart.php';
|
||||
}
|
||||
*/
|
||||
|
||||
// Recursively collect all moodules / modules_core autostarts
|
||||
$modulesPaths = array(Yii::app()->getBasePath() . DIRECTORY_SEPARATOR . 'modules', Yii::app()->getBasePath() . DIRECTORY_SEPARATOR . 'modules_core');
|
||||
foreach ($modulesPaths as $modulePath) {
|
||||
$modules = scandir($modulePath);
|
||||
foreach ($modules as $moduleId) {
|
||||
$autostartFiles[] = $modulePath . DIRECTORY_SEPARATOR . $moduleId . DIRECTORY_SEPARATOR . 'autostart.php';
|
||||
}
|
||||
}
|
||||
|
||||
// Execute Autoloaders in each modules paths
|
||||
foreach ($modulesPaths as $modulesPath) {
|
||||
// Execute (and cache) found autostarts
|
||||
$cacheFileContent = "";
|
||||
foreach ($autostartFiles as $autoloadFile) {
|
||||
if (is_file($autoloadFile)) {
|
||||
|
||||
// Scan Modules
|
||||
$modules = scandir($modulesPath);
|
||||
foreach ($modules as $module) {
|
||||
if ($module == '.' || $module == '..')
|
||||
continue;
|
||||
require_once($autoloadFile);
|
||||
|
||||
$moduleDir = $modulesPath . DIRECTORY_SEPARATOR . $module . DIRECTORY_SEPARATOR;
|
||||
|
||||
if (is_dir($moduleDir) && is_file($moduleDir . 'autostart.php')) {
|
||||
|
||||
// Store Filename to Cache Content
|
||||
$fileNames[] = $moduleDir . 'autostart.php';
|
||||
|
||||
// Execute Autoloader
|
||||
require_once($moduleDir . 'autostart.php');
|
||||
// Cache content of autostart file
|
||||
if ($cacheEnabled) {
|
||||
$cacheFileContent .= file_get_contents($autoloadFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($cacheEnabled) {
|
||||
// Created a cache file which contains all autoloaders
|
||||
$content = "";
|
||||
foreach ($fileNames as $fileName) {
|
||||
$content .= file_get_contents($fileName);
|
||||
}
|
||||
file_put_contents($cacheFileName, $content);
|
||||
file_put_contents($cacheFileName, $cacheFileContent);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads all enabled modules from the database. (Cached)
|
||||
* Flushes Module Managers Cache
|
||||
*/
|
||||
private function loadEnabledModules() {
|
||||
public static function flushCache()
|
||||
{
|
||||
|
||||
$cacheId = "enabledModules";
|
||||
$cacheValue = Yii::app()->cache->get($cacheId);
|
||||
|
||||
if ($cacheValue === false || !is_array($cacheValue)) {
|
||||
|
||||
$enabledModules = array();
|
||||
foreach (ModuleEnabled::model()->findAll() as $em) {
|
||||
$enabledModules[$em->module_id] = $em->module_id;
|
||||
}
|
||||
Yii::app()->cache->set($cacheId, $enabledModules, HSetting::Get('expireTime', 'cache'));
|
||||
$this->enabledModules = $enabledModules;
|
||||
} else {
|
||||
$this->enabledModules = $cacheValue;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Flushes Module Managers cache
|
||||
*/
|
||||
public static function flushCache() {
|
||||
|
||||
// Autoloader Cache File
|
||||
// Delete Autoloader Cache File
|
||||
$cacheFileName = Yii::app()->getRuntimePath() . DIRECTORY_SEPARATOR . self::AUTOSTART_CACHE_FILE_NAME;
|
||||
if (file_exists($cacheFileName)) {
|
||||
unlink($cacheFileName);
|
||||
}
|
||||
|
||||
// Delete Enabled Modules List
|
||||
$cacheId = "enabledModules";
|
||||
Yii::app()->cache->delete($cacheId);
|
||||
}
|
||||
@ -176,243 +154,145 @@ class ModuleManager extends CApplicationComponent {
|
||||
/**
|
||||
* Registers a module
|
||||
* This is usally called in the autostart file of the module.
|
||||
*
|
||||
* - id
|
||||
* - class Module Base Class
|
||||
* - import Global Module Imports
|
||||
* - events Events to catch
|
||||
*
|
||||
* - isCoreModule Core Modules only
|
||||
*
|
||||
* @param Array $definition
|
||||
*/
|
||||
public function register($definition) {
|
||||
$id = $definition['id'];
|
||||
public function register($definition)
|
||||
{
|
||||
|
||||
if (!isset($definition['isSpaceModule']))
|
||||
$definition['isSpaceModule'] = false;
|
||||
if (!isset($definition['class']) || !isset($definition['id'])) {
|
||||
throw new Exception("Register Module needs module Id and Class!");
|
||||
}
|
||||
|
||||
if (!isset($definition['isCoreModule']))
|
||||
$definition['isCoreModule'] = false;
|
||||
$isCoreModule = (isset($definition['isCoreModule']) && $definition['isCoreModule']);
|
||||
|
||||
if (!isset($definition['configRoute']))
|
||||
$definition['configRoute'] = '';
|
||||
$this->installedModules[$definition['id']] = $definition['class'];
|
||||
|
||||
if (!isset($definition['spaceConfigRoute']))
|
||||
$definition['spaceConfigRoute'] = '';
|
||||
// Not enabled and no core module
|
||||
if (!$isCoreModule && !in_array($definition['id'], $this->enabledModules)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Register Yii Module
|
||||
Yii::app()->setModules(array(
|
||||
$definition['id'] => array(
|
||||
'class' => $definition['class']
|
||||
),
|
||||
));
|
||||
|
||||
$this->registeredModules[$id] = $definition;
|
||||
// Set Imports
|
||||
if (isset($definition['import'])) {
|
||||
Yii::app()->setImport($definition['import']);
|
||||
}
|
||||
|
||||
// Check if module is enabled
|
||||
if (Yii::app()->moduleManager->isEnabled($id)) {
|
||||
|
||||
// Register Yii Module
|
||||
if (isset($definition['class'])) {
|
||||
Yii::app()->setModules(array(
|
||||
$id => array(
|
||||
'class' => $definition['class']
|
||||
),
|
||||
));
|
||||
}
|
||||
|
||||
// Set Imports
|
||||
if (isset($definition['import'])) {
|
||||
Yii::app()->setImport($definition['import']);
|
||||
}
|
||||
|
||||
// Register Event Handlers
|
||||
if (isset($definition['events'])) {
|
||||
foreach ($definition['events'] as $event) {
|
||||
Yii::app()->interceptor->preattachEventHandler(
|
||||
$event['class'], $event['event'], $event['callback']
|
||||
);
|
||||
}
|
||||
// Register Event Handlers
|
||||
if (isset($definition['events'])) {
|
||||
foreach ($definition['events'] as $event) {
|
||||
Yii::app()->interceptor->preattachEventHandler(
|
||||
$event['class'], $event['event'], $event['callback']
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a module is enabled or not.
|
||||
*
|
||||
* @param type $moduleId
|
||||
* @return boolean
|
||||
* Returns Module Base Class of installed module neither when not enabled.
|
||||
*
|
||||
* @param String $id Module Id
|
||||
* @return HWebModule
|
||||
*/
|
||||
public function isEnabled($moduleId) {
|
||||
public function getModule($id)
|
||||
{
|
||||
|
||||
$definition = $this->getDefinition($moduleId);
|
||||
|
||||
if ($definition['isCoreModule'])
|
||||
return true;
|
||||
|
||||
// Core installed yet?
|
||||
if (!Yii::app()->params['installed'])
|
||||
return false;
|
||||
|
||||
if (in_array($moduleId, $this->enabledModules)) {
|
||||
return true;
|
||||
// When enabled, returned it directly
|
||||
if (Yii::app()->getModule($id) != null) {
|
||||
return Yii::app()->getModule($id);
|
||||
}
|
||||
|
||||
#$moduleEnabled = ModuleEnabled::model()->findByPk($moduleId);
|
||||
#if ($moduleEnabled != null) {
|
||||
# return true;
|
||||
#}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array with all registered modules
|
||||
* This contains all enabled & disabled modules.
|
||||
* Key is the moduleId and value is the module definition
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function getRegisteredModules() {
|
||||
return $this->registeredModules;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array with enabled modules
|
||||
* Key of the array is the module id and value is the module definition.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getEnabledModules() {
|
||||
|
||||
$enabledModules = array();
|
||||
|
||||
foreach ($this->getRegisteredModules() as $moduleId => $definition) {
|
||||
if ($this->isEnabled($moduleId)) {
|
||||
$enabledModules[$moduleId] = $definition;
|
||||
}
|
||||
// Not enabled, but installed - create it
|
||||
if (isset($this->installedModules[$id])) {
|
||||
$class = $this->installedModules[$id];
|
||||
return Yii::createComponent($class, $id, null);
|
||||
}
|
||||
|
||||
return $enabledModules;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables a module by given module id.
|
||||
*
|
||||
* @param String $id
|
||||
*/
|
||||
public function enable($id) {
|
||||
|
||||
$definition = $this->getDefinition($id);
|
||||
if ($definition != null) {
|
||||
|
||||
// Core Modules doesn´t need to enabled
|
||||
if (!$definition['isCoreModule']) {
|
||||
|
||||
$moduleEnabled = ModuleEnabled::model()->findByPk($id);
|
||||
if ($moduleEnabled == null) {
|
||||
|
||||
$moduleEnabled = new ModuleEnabled();
|
||||
$moduleEnabled->module_id = $id;
|
||||
$moduleEnabled->save();
|
||||
|
||||
// Auto Migrate (add module database changes)
|
||||
Yii::import('application.commands.shell.ZMigrateCommand');
|
||||
$migrate = ZMigrateCommand::AutoMigrate();
|
||||
|
||||
// Fire Event Disabled Event
|
||||
if ($this->hasEventHandler('onEnable'))
|
||||
$this->onEnable(new CEvent($this, $id));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ModuleManager::flushCache();
|
||||
}
|
||||
|
||||
/**
|
||||
* Disables a active module by given module id
|
||||
*
|
||||
* @param String $id
|
||||
*/
|
||||
public function disable($id) {
|
||||
|
||||
$definition = $this->getDefinition($id);
|
||||
if ($definition != null) {
|
||||
|
||||
// Core Modules couldn´t disabled
|
||||
if (!$definition['isCoreModule']) {
|
||||
|
||||
if (isset($definition['userModules']) && is_array($definition['userModules'])) {
|
||||
$modulesToDisable = array_keys($definition['userModules']);
|
||||
foreach (User::model()->findAll() as $user) {
|
||||
foreach ($modulesToDisable as $userModuleId) {
|
||||
if ($user->isModuleEnabled($userModuleId))
|
||||
$user->uninstallModule($userModuleId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($definition['spaceModules']) && is_array($definition['spaceModules'])) {
|
||||
$modulesToDisable = array_keys($definition['spaceModules']);
|
||||
foreach (Space::model()->findAll() as $space) {
|
||||
foreach ($modulesToDisable as $spaceModuleId) {
|
||||
if ($space->isModuleEnabled($spaceModuleId))
|
||||
$space->uninstallModule($spaceModuleId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get Enabled Module Record
|
||||
$moduleEnabled = ModuleEnabled::model()->findByPk($id);
|
||||
if ($moduleEnabled != null)
|
||||
$moduleEnabled->delete();
|
||||
|
||||
// Fire Event Disabled Event
|
||||
if ($this->hasEventHandler('onDisable'))
|
||||
$this->onDisable(new CEvent($this, $id));
|
||||
}
|
||||
}
|
||||
ModuleManager::flushCache();
|
||||
}
|
||||
|
||||
/**
|
||||
* This event is raised after disabling a module
|
||||
*
|
||||
* @param CEvent $event the event parameter
|
||||
* @see disable
|
||||
*/
|
||||
public function onDisable($event) {
|
||||
$this->raiseEvent('onDisable', $event);
|
||||
}
|
||||
|
||||
/**
|
||||
* This event is raised after enabling a module
|
||||
*
|
||||
* @param CEvent $event the event parameter
|
||||
* @see enable
|
||||
*/
|
||||
public function onEnable($event) {
|
||||
$this->raiseEvent('onEnable', $event);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the definition array of a registered module
|
||||
*
|
||||
* @param type $id
|
||||
* @return null
|
||||
*/
|
||||
public function getDefinition($id) {
|
||||
if (isset($this->registeredModules[$id]))
|
||||
return $this->registeredModules[$id];
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a new Content Model
|
||||
*
|
||||
* @param String $className
|
||||
* Returns a list of all installed modules
|
||||
*
|
||||
* @param boolean $includeCoreModules include also core modules
|
||||
* @param boolean $returnClassName instead of instance
|
||||
* @return Array of installed Modules
|
||||
*/
|
||||
public function registerContentModel($className) {
|
||||
$this->registeredContentModels[] = $className;
|
||||
public function getInstalledModules($includeCoreModules = false, $returnClassName = false)
|
||||
{
|
||||
|
||||
$installed = array();
|
||||
foreach ($this->installedModules as $moduleId => $className) {
|
||||
|
||||
if (!$includeCoreModules && strpos($className, 'application.modules_core') !== false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($returnClassName) {
|
||||
$installed[] = $className;
|
||||
} else {
|
||||
$module = $this->getModule($moduleId);
|
||||
|
||||
if ($module != null) {
|
||||
$installed[$moduleId] = $module;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $installed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of all registered content models
|
||||
*
|
||||
* @return Array
|
||||
* Returns a list of all enabled modules
|
||||
*/
|
||||
public function getContentModels() {
|
||||
return $this->registeredContentModels;
|
||||
public function getEnabledModules()
|
||||
{
|
||||
|
||||
$modules = array();
|
||||
foreach ($this->enabledModules as $moduleId) {
|
||||
$module = $this->getModule($moduleId);
|
||||
if ($module != null) {
|
||||
$modules[] = $module;
|
||||
}
|
||||
}
|
||||
|
||||
return $modules;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a module is enabled.
|
||||
*
|
||||
* @param String $moduleId
|
||||
* @return boolean
|
||||
*/
|
||||
public function isEnabled($moduleId)
|
||||
{
|
||||
return (in_array($moduleId, $this->enabledModules));
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a module id is installed.
|
||||
*
|
||||
* @param String $moduleId
|
||||
* @return boolean
|
||||
*/
|
||||
public function isInstalled($moduleId)
|
||||
{
|
||||
return (array_key_exists($moduleId, $this->installedModules));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -6,9 +6,11 @@
|
||||
* @package humhub.modules.mail
|
||||
* @since 0.5
|
||||
*/
|
||||
class MailModule extends CWebModule {
|
||||
class MailModule extends HWebModule
|
||||
{
|
||||
|
||||
public function init() {
|
||||
public function init()
|
||||
{
|
||||
|
||||
$this->setImport(array(
|
||||
'mail.models.*',
|
||||
@ -23,7 +25,8 @@ class MailModule extends CWebModule {
|
||||
*
|
||||
* @param type $event
|
||||
*/
|
||||
public static function onUserDelete($event) {
|
||||
public static function onUserDelete($event)
|
||||
{
|
||||
|
||||
Yii::import('application.modules.mail.models.*');
|
||||
|
||||
@ -45,7 +48,8 @@ class MailModule extends CWebModule {
|
||||
*
|
||||
* @param type $event
|
||||
*/
|
||||
public static function onIntegrityCheck($event) {
|
||||
public static function onIntegrityCheck($event)
|
||||
{
|
||||
|
||||
$integrityChecker = $event->sender;
|
||||
#$integrityChecker->showTestHeadline("Validating Mail Module (" . Message::model()->count() . " entries)");
|
||||
@ -57,26 +61,21 @@ class MailModule extends CWebModule {
|
||||
*
|
||||
* @param type $event
|
||||
*/
|
||||
public static function onTopMenuInit($event) {
|
||||
public static function onTopMenuInit($event)
|
||||
{
|
||||
|
||||
// Is Module enabled on this workspace?
|
||||
if (Yii::app()->moduleManager->isEnabled('mail')) {
|
||||
$event->sender->addItem(array(
|
||||
'label' => Yii::t('MailModule.base', 'Messages'),
|
||||
'url' => Yii::app()->createUrl('//mail/mail/index', array()),
|
||||
'icon' => 'mail',
|
||||
'isActive' => (Yii::app()->controller->module && Yii::app()->controller->module->id == 'mail'),
|
||||
'sortOrder' => 300,
|
||||
));
|
||||
}
|
||||
$event->sender->addItem(array(
|
||||
'label' => Yii::t('MailModule.base', 'Messages'),
|
||||
'url' => Yii::app()->createUrl('//mail/mail/index', array()),
|
||||
'icon' => 'mail',
|
||||
'isActive' => (Yii::app()->controller->module && Yii::app()->controller->module->id == 'mail'),
|
||||
'sortOrder' => 300,
|
||||
));
|
||||
}
|
||||
|
||||
public static function onNotificationAddonInit($event) {
|
||||
|
||||
// Is Module enabled on this workspace?
|
||||
if (Yii::app()->moduleManager->isEnabled('mail')) {
|
||||
$event->sender->addWidget('application.modules.mail.widgets.MailNotificationWidget', array(), array('sortOrder' => 90));
|
||||
}
|
||||
public static function onNotificationAddonInit($event)
|
||||
{
|
||||
$event->sender->addWidget('application.modules.mail.widgets.MailNotificationWidget', array(), array('sortOrder' => 90));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
Yii::app()->moduleManager->register(array(
|
||||
'id' => 'mail',
|
||||
'title' => Yii::t('MailModule.base', 'Mail'),
|
||||
'description' => Yii::t('MailModule.base', 'Adds the mailing core module.'),
|
||||
'class' => 'application.modules.mail.MailModule',
|
||||
'import' => array(
|
||||
'application.modules.mail.*',
|
||||
|
10
protected/modules/mail/module.json
Normal file
10
protected/modules/mail/module.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"id": "mail",
|
||||
"name": "Mail",
|
||||
"description": "Simple user to user mailing system",
|
||||
"keywords": ["mail", "messaging", "communication"],
|
||||
"version": "0.4",
|
||||
"humhub": {
|
||||
"minVersion": "0.5"
|
||||
}
|
||||
}
|
@ -9,12 +9,14 @@
|
||||
* @since 0.5
|
||||
* @author Luke
|
||||
*/
|
||||
class PollsModule extends CWebModule {
|
||||
class PollsModule extends HWebModule
|
||||
{
|
||||
|
||||
/**
|
||||
* Inits the Module
|
||||
*/
|
||||
public function init() {
|
||||
public function init()
|
||||
{
|
||||
|
||||
$this->setImport(array(
|
||||
'polls.models.*',
|
||||
@ -22,13 +24,24 @@ class PollsModule extends CWebModule {
|
||||
));
|
||||
}
|
||||
|
||||
public function behaviors()
|
||||
{
|
||||
|
||||
return array(
|
||||
'SpaceModuleBehavior' => array(
|
||||
'class' => 'application.modules_core.space.SpaceModuleBehavior',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* On build of a Space Navigation, check if this module is enabled.
|
||||
* When enabled add a menu item
|
||||
*
|
||||
* @param type $event
|
||||
*/
|
||||
public static function onSpaceMenuInit($event) {
|
||||
public static function onSpaceMenuInit($event)
|
||||
{
|
||||
|
||||
$space = Yii::app()->getController()->getSpace();
|
||||
|
||||
@ -48,7 +61,8 @@ class PollsModule extends CWebModule {
|
||||
*
|
||||
* @param type $event
|
||||
*/
|
||||
public static function onUserDelete($event) {
|
||||
public static function onUserDelete($event)
|
||||
{
|
||||
|
||||
foreach (Content::model()->findAllByAttributes(array('user_id' => $event->sender->id, 'object_model' => 'Poll')) as $content) {
|
||||
$content->delete();
|
||||
@ -66,7 +80,8 @@ class PollsModule extends CWebModule {
|
||||
*
|
||||
* @param type $event
|
||||
*/
|
||||
public static function onSpaceDelete($event) {
|
||||
public static function onSpaceDelete($event)
|
||||
{
|
||||
foreach (Content::model()->findAllByAttributes(array('space_id' => $event->sender->id, 'object_model' => 'Poll')) as $content) {
|
||||
$content->delete();
|
||||
}
|
||||
@ -78,7 +93,8 @@ class PollsModule extends CWebModule {
|
||||
*
|
||||
* @param type $event
|
||||
*/
|
||||
public static function onSpaceUninstallModule($event) {
|
||||
public static function onSpaceUninstallModule($event)
|
||||
{
|
||||
if ($event->params == 'polls') {
|
||||
foreach (Content::model()->findAllByAttributes(array('space_id' => $event->sender->id, 'object_model' => 'Poll')) as $content) {
|
||||
$content->delete();
|
||||
@ -92,7 +108,8 @@ class PollsModule extends CWebModule {
|
||||
*
|
||||
* @param type $event
|
||||
*/
|
||||
public static function onDisableModule($event) {
|
||||
public static function onDisableModule($event)
|
||||
{
|
||||
if ($event->params == 'polls') {
|
||||
|
||||
foreach (Content::model()->findAllByAttributes(array('object_model' => 'Poll')) as $content) {
|
||||
@ -106,10 +123,11 @@ class PollsModule extends CWebModule {
|
||||
*
|
||||
* @param type $event
|
||||
*/
|
||||
public static function onIntegrityCheck($event) {
|
||||
public static function onIntegrityCheck($event)
|
||||
{
|
||||
|
||||
$integrityChecker = $event->sender;
|
||||
$integrityChecker->showTestHeadline("Validating Polls Module (" . Poll::model()->count() . " entries)");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -3,8 +3,6 @@
|
||||
Yii::app()->moduleManager->register(array(
|
||||
'id' => 'polls',
|
||||
'class' => 'application.modules.polls.PollsModule',
|
||||
'title' => Yii::t('PollsModule.base', 'Polls'),
|
||||
'description' => Yii::t('PollsModule.base', 'Adds polling features to spaces.'),
|
||||
'import' => array(
|
||||
'application.modules.polls.models.*',
|
||||
'application.modules.polls.behaviors.*',
|
||||
@ -20,12 +18,5 @@ Yii::app()->moduleManager->register(array(
|
||||
array('class' => 'ModuleManager', 'event' => 'onDisable', 'callback' => array('PollsModule', 'onDisableModule')),
|
||||
array('class' => 'IntegrityChecker', 'event' => 'onRun', 'callback' => array('PollsModule', 'onIntegrityCheck')),
|
||||
),
|
||||
'spaceModules' => array(
|
||||
'polls' => array(
|
||||
'title' => Yii::t('PollsModule.base', 'Polls'),
|
||||
'description' => Yii::t('PollsModule.base', 'Adds polling features to your space.'),
|
||||
),
|
||||
),
|
||||
'contentModels' => array('Poll'),
|
||||
));
|
||||
?>
|
10
protected/modules/polls/module.json
Normal file
10
protected/modules/polls/module.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"id": "polls",
|
||||
"name": "Polling",
|
||||
"description": "Simple polling system",
|
||||
"keywords": ["poll", "votes"],
|
||||
"version": "0.5",
|
||||
"humhub": {
|
||||
"minVersion": "0.5"
|
||||
}
|
||||
}
|
@ -1,11 +1,13 @@
|
||||
<?php
|
||||
|
||||
class TasksModule extends CWebModule {
|
||||
class TasksModule extends HWebModule
|
||||
{
|
||||
|
||||
/**
|
||||
* Inits the Module
|
||||
*/
|
||||
public function init() {
|
||||
public function init()
|
||||
{
|
||||
$this->setImport(array(
|
||||
'tasks.*',
|
||||
'tasks.models.*',
|
||||
@ -14,12 +16,23 @@ class TasksModule extends CWebModule {
|
||||
));
|
||||
}
|
||||
|
||||
public function behaviors()
|
||||
{
|
||||
|
||||
return array(
|
||||
'SpaceModuleBehavior' => array(
|
||||
'class' => 'application.modules_core.space.SpaceModuleBehavior',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* On User delete, also delete all tasks
|
||||
*
|
||||
* @param type $event
|
||||
*/
|
||||
public static function onUserDelete($event) {
|
||||
public static function onUserDelete($event)
|
||||
{
|
||||
|
||||
foreach (Content::model()->findAllByAttributes(array('created_by' => $event->sender->id, 'object_model' => 'Task')) as $content) {
|
||||
$content->delete();
|
||||
@ -44,7 +57,8 @@ class TasksModule extends CWebModule {
|
||||
*
|
||||
* @param type $event
|
||||
*/
|
||||
public static function onSpaceDelete($event) {
|
||||
public static function onSpaceDelete($event)
|
||||
{
|
||||
foreach (Content::model()->findAllByAttributes(array('space_id' => $event->sender->id, 'object_model' => 'Task')) as $content) {
|
||||
$content->delete();
|
||||
}
|
||||
@ -56,10 +70,11 @@ class TasksModule extends CWebModule {
|
||||
*
|
||||
* @param type $event
|
||||
*/
|
||||
public static function onSpaceMenuInit($event) {
|
||||
public static function onSpaceMenuInit($event)
|
||||
{
|
||||
|
||||
$space = Yii::app()->getController()->getSpace();
|
||||
|
||||
|
||||
// Is Module enabled on this workspace?
|
||||
if ($space->isModuleEnabled('tasks')) {
|
||||
$event->sender->addItem(array(
|
||||
@ -77,7 +92,8 @@ class TasksModule extends CWebModule {
|
||||
*
|
||||
* @param type $event
|
||||
*/
|
||||
public static function onSpaceUninstallModule($event) {
|
||||
public static function onSpaceUninstallModule($event)
|
||||
{
|
||||
if ($event->params == 'tasks') {
|
||||
foreach (Content::model()->findAllByAttributes(array('space_id' => $event->sender->id, 'object_model' => 'Task')) as $content) {
|
||||
$content->delete();
|
||||
@ -91,7 +107,8 @@ class TasksModule extends CWebModule {
|
||||
*
|
||||
* @param type $event
|
||||
*/
|
||||
public static function onDisableModule($event) {
|
||||
public static function onDisableModule($event)
|
||||
{
|
||||
if ($event->params == 'tasks') {
|
||||
foreach (Content::model()->findAllByAttributes(array('object_model' => 'Task')) as $content) {
|
||||
$content->delete();
|
||||
@ -104,10 +121,11 @@ class TasksModule extends CWebModule {
|
||||
*
|
||||
* @param type $event
|
||||
*/
|
||||
public static function onIntegrityCheck($event) {
|
||||
public static function onIntegrityCheck($event)
|
||||
{
|
||||
|
||||
$integrityChecker = $event->sender;
|
||||
$integrityChecker->showTestHeadline("Validating Tasks Module (" . Task::model()->count() . " entries)");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -3,8 +3,6 @@
|
||||
Yii::app()->moduleManager->register(array(
|
||||
'id' => 'tasks',
|
||||
'class' => 'application.modules.tasks.TasksModule',
|
||||
'title' => Yii::t('TasksModule.base', 'Tasks'),
|
||||
'description' => Yii::t('TasksModule.base', 'Adds a taskmanager to your spaces. With this module you can create and assign tasks to users in spaces.'),
|
||||
'import' => array(
|
||||
'application.modules.tasks.*',
|
||||
'application.modules.tasks.models.*',
|
||||
@ -19,12 +17,5 @@ Yii::app()->moduleManager->register(array(
|
||||
array('class' => 'ModuleManager', 'event' => 'onDisable', 'callback' => array('TasksModule', 'onDisableModule')),
|
||||
array('class' => 'IntegrityChecker', 'event' => 'onRun', 'callback' => array('TasksModule', 'onIntegrityCheck')),
|
||||
),
|
||||
'spaceModules' => array(
|
||||
'tasks' => array(
|
||||
'title' => Yii::t('TasksModule.base', 'Tasks'),
|
||||
'description' => Yii::t('TasksModule.base', 'Adds a taskmanager to your spaces. With this module you can create and assign tasks to users in spaces.'),
|
||||
),
|
||||
),
|
||||
'contentModels' => array('Task'),
|
||||
));
|
||||
?>
|
11
protected/modules/tasks/module.json
Normal file
11
protected/modules/tasks/module.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"id": "tasks",
|
||||
"name": "Tasks",
|
||||
"description": "Adds a taskmanager to your spaces. With this module you can create and assign tasks to users in spaces.",
|
||||
"keywords": ["task", "todo"],
|
||||
"version": "0.9",
|
||||
"humhub": {
|
||||
"minVersion": "0.5",
|
||||
"maxVersion": "0.7"
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
class YiiGiiModule extends CWebModule {
|
||||
class YiiGiiModule extends HWebModule {
|
||||
|
||||
public function init() {
|
||||
$this->setImport(array(
|
||||
|
11
protected/modules/yiigii/module.json
Normal file
11
protected/modules/yiigii/module.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"id": "yiigii",
|
||||
"name": "Yii Gii Integration",
|
||||
"description": "Integrates Yii Code Generator",
|
||||
"keywords": ["yii", "gii", "development"],
|
||||
"version": "0.9",
|
||||
"humhub": {
|
||||
"minVersion": "0.5",
|
||||
"maxVersion": "0.7"
|
||||
}
|
||||
}
|
@ -7,7 +7,7 @@
|
||||
* @package humhub.modules_core.activity
|
||||
* @since 0.5
|
||||
*/
|
||||
class ActivityModule extends CWebModule {
|
||||
class ActivityModule extends HWebModule {
|
||||
|
||||
/**
|
||||
* Inits the activity module
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
Yii::app()->moduleManager->register(array(
|
||||
'id' => 'activity',
|
||||
'title' => Yii::t('ActivityModule.base', 'Activities'),
|
||||
'description' => Yii::t('ActivityModule.base', 'Adds the activities core module.'),
|
||||
'class' => 'application.modules_core.activity.ActivityModule',
|
||||
'isCoreModule' => true,
|
||||
'import' => array(
|
||||
@ -18,6 +16,5 @@ Yii::app()->moduleManager->register(array(
|
||||
array('class' => 'HActiveRecord', 'event' => 'onBeforeDelete', 'callback' => array('ActivityModule', 'onActiveRecordDelete')),
|
||||
array('class' => 'IntegrityChecker', 'event' => 'onRun', 'callback' => array('ActivityModule', 'onIntegrityCheck')),
|
||||
),
|
||||
'contentModels' => array('Activity'),
|
||||
));
|
||||
?>
|
9
protected/modules_core/activity/module.json
Normal file
9
protected/modules_core/activity/module.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"id": "activity",
|
||||
"name": "Activity",
|
||||
"description": "Activity Core",
|
||||
"keywords": [
|
||||
"core"
|
||||
],
|
||||
"version": "1.0"
|
||||
}
|
@ -4,7 +4,7 @@
|
||||
* @package humhub.modules_core.admin
|
||||
* @since 0.5
|
||||
*/
|
||||
class AdminModule extends CWebModule {
|
||||
class AdminModule extends HWebModule {
|
||||
|
||||
public function init() {
|
||||
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
Yii::app()->moduleManager->register(array(
|
||||
'id' => 'admin',
|
||||
'title' => Yii::t('AdminModule.base', 'Admin'),
|
||||
'description' => Yii::t('AdminModule.base', 'Provides general admin functions.'),
|
||||
'class' => 'application.modules_core.admin.AdminModule',
|
||||
'isCoreModule' => true,
|
||||
'import' => array(
|
||||
|
9
protected/modules_core/admin/module.json
Normal file
9
protected/modules_core/admin/module.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"id": "admin",
|
||||
"name": "Admin",
|
||||
"description": "Admin Core",
|
||||
"keywords": [
|
||||
"core"
|
||||
],
|
||||
"version": "1.0"
|
||||
}
|
@ -6,7 +6,7 @@
|
||||
* @package humhub.modules_core.comment
|
||||
* @since 0.5
|
||||
*/
|
||||
class CommentModule extends CWebModule
|
||||
class CommentModule extends HWebModule
|
||||
{
|
||||
|
||||
/**
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
Yii::app()->moduleManager->register(array(
|
||||
'id' => 'comment',
|
||||
'title' => Yii::t('CommentModule.base', 'Comments'),
|
||||
'description' => Yii::t('CommentModule.base', 'Comments core module.'),
|
||||
'class' => 'application.modules_core.comment.CommentModule',
|
||||
'isCoreModule' => true,
|
||||
'import' => array(
|
||||
|
9
protected/modules_core/comment/module.json
Normal file
9
protected/modules_core/comment/module.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"id": "comment",
|
||||
"name": "Comment",
|
||||
"description": "Comments Core",
|
||||
"keywords": [
|
||||
"core"
|
||||
],
|
||||
"version": "1.0"
|
||||
}
|
@ -6,12 +6,14 @@
|
||||
* @package humhub.modules_core.dashboard
|
||||
* @since 0.5
|
||||
*/
|
||||
class DashboardModule extends CWebModule {
|
||||
class DashboardModule extends HWebModule
|
||||
{
|
||||
|
||||
/**
|
||||
* Inits the Module
|
||||
*/
|
||||
public function init() {
|
||||
public function init()
|
||||
{
|
||||
|
||||
$this->setImport(array(
|
||||
));
|
||||
@ -23,17 +25,16 @@ class DashboardModule extends CWebModule {
|
||||
*
|
||||
* @param type $event
|
||||
*/
|
||||
public static function onTopMenuInit($event) {
|
||||
public static function onTopMenuInit($event)
|
||||
{
|
||||
|
||||
// Is Module enabled on this workspace?
|
||||
if (Yii::app()->moduleManager->isEnabled('dashboard')) {
|
||||
$event->sender->addItem(array(
|
||||
'label' => Yii::t('DashboardModule.base', 'Dashboard'),
|
||||
'url' => Yii::app()->createUrl('//dashboard/dashboard'),
|
||||
'sortOrder' => 100,
|
||||
'isActive' => (Yii::app()->controller->module && Yii::app()->controller->module->id == 'dashboard'),
|
||||
));
|
||||
}
|
||||
$event->sender->addItem(array(
|
||||
'label' => Yii::t('DashboardModule.base', 'Dashboard'),
|
||||
'url' => Yii::app()->createUrl('//dashboard/dashboard'),
|
||||
'sortOrder' => 100,
|
||||
'isActive' => (Yii::app()->controller->module && Yii::app()->controller->module->id == 'dashboard'),
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
Yii::app()->moduleManager->register(array(
|
||||
'id' => 'dashboard',
|
||||
'title' => Yii::t('DashboardModule.base', 'Dashboard'),
|
||||
'description' => Yii::t('DashboardModule.base', 'Dashboard at main navigation.'),
|
||||
'class' => 'application.modules_core.dashboard.DashboardModule',
|
||||
'isCoreModule' => true,
|
||||
'import' => array(
|
||||
|
9
protected/modules_core/dashboard/module.json
Normal file
9
protected/modules_core/dashboard/module.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"id": "dashboard",
|
||||
"name": "Dashboard",
|
||||
"description": "Dashboard Core",
|
||||
"keywords": [
|
||||
"core"
|
||||
],
|
||||
"version": "1.0"
|
||||
}
|
@ -9,12 +9,14 @@
|
||||
* @package humhub.modules_core.directory
|
||||
* @since 0.5
|
||||
*/
|
||||
class DirectoryModule extends CWebModule {
|
||||
class DirectoryModule extends HWebModule
|
||||
{
|
||||
|
||||
/**
|
||||
* Inits the Module
|
||||
*/
|
||||
public function init() {
|
||||
public function init()
|
||||
{
|
||||
|
||||
$this->setImport(array(
|
||||
));
|
||||
@ -26,17 +28,15 @@ class DirectoryModule extends CWebModule {
|
||||
*
|
||||
* @param type $event
|
||||
*/
|
||||
public static function onTopMenuInit($event) {
|
||||
public static function onTopMenuInit($event)
|
||||
{
|
||||
|
||||
// Is Module enabled on this workspace?
|
||||
if (Yii::app()->moduleManager->isEnabled('directory')) {
|
||||
$event->sender->addItem(array(
|
||||
'label' => Yii::t('DirectoryModule.base', 'Directory'),
|
||||
'url' => Yii::app()->createUrl('//directory/directory'),
|
||||
'sortOrder' => 400,
|
||||
'isActive' => (Yii::app()->controller->module && Yii::app()->controller->module->id == 'directory'),
|
||||
));
|
||||
}
|
||||
$event->sender->addItem(array(
|
||||
'label' => Yii::t('DirectoryModule.base', 'Directory'),
|
||||
'url' => Yii::app()->createUrl('//directory/directory'),
|
||||
'sortOrder' => 400,
|
||||
'isActive' => (Yii::app()->controller->module && Yii::app()->controller->module->id == 'directory'),
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
Yii::app()->moduleManager->register(array(
|
||||
'id' => 'directory',
|
||||
'title' => Yii::t('DirectoryModule.base', 'Directory'),
|
||||
'description' => Yii::t('DirectoryModule.base', 'Adds an directory to the main navigation.'),
|
||||
'class' => 'application.modules_core.directory.DirectoryModule',
|
||||
'isCoreModule' => true,
|
||||
'import' => array(
|
||||
|
9
protected/modules_core/directory/module.json
Normal file
9
protected/modules_core/directory/module.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"id": "directory",
|
||||
"name": "Directory",
|
||||
"description": "Directory Core",
|
||||
"keywords": [
|
||||
"core"
|
||||
],
|
||||
"version": "1.0"
|
||||
}
|
@ -6,7 +6,7 @@
|
||||
* @package humhub.modules_core.file
|
||||
* @since 0.5
|
||||
*/
|
||||
class FileModule extends CWebModule {
|
||||
class FileModule extends HWebModule {
|
||||
|
||||
/**
|
||||
* Inits the Module
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
Yii::app()->moduleManager->register(array(
|
||||
'id' => 'file',
|
||||
'title' => Yii::t('FileModule.base', 'File'),
|
||||
'description' => Yii::t('FileModule.base', 'Files core module.'),
|
||||
'class' => 'application.modules_core.file.FileModule',
|
||||
'isCoreModule' => true,
|
||||
'import' => array(
|
||||
|
@ -44,6 +44,7 @@ class FileController extends Controller {
|
||||
foreach (CUploadedFile::getInstancesByName('files') as $cFile) {
|
||||
$files[] = $this->handleFileUpload($cFile);
|
||||
}
|
||||
|
||||
|
||||
return $this->renderJson(array('files' => $files));
|
||||
}
|
||||
|
9
protected/modules_core/file/module.json
Normal file
9
protected/modules_core/file/module.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"id": "file",
|
||||
"name": "File",
|
||||
"description": "File Core",
|
||||
"keywords": [
|
||||
"core"
|
||||
],
|
||||
"version": "1.0"
|
||||
}
|
@ -24,7 +24,7 @@
|
||||
* @package humhub.modules_core.installer
|
||||
* @since 0.5
|
||||
*/
|
||||
class InstallerModule extends CWebModule {
|
||||
class InstallerModule extends HWebModule {
|
||||
|
||||
public function init() {
|
||||
$this->setLayoutPath(Yii::getPathOfAlias('installer.views'));
|
||||
|
@ -4,8 +4,6 @@
|
||||
if (!Yii::app()->params['installed']) {
|
||||
Yii::app()->moduleManager->register(array(
|
||||
'id' => 'installer',
|
||||
'title' => Yii::t('InstallerModule.base', 'Installer'),
|
||||
'description' => Yii::t('InstallerModule.base', 'Initial Installer.'),
|
||||
'class' => 'application.modules_core.installer.InstallerModule',
|
||||
'isCoreModule' => true,
|
||||
));
|
||||
|
9
protected/modules_core/installer/module.json
Normal file
9
protected/modules_core/installer/module.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"id": "installer",
|
||||
"name": "Installer",
|
||||
"description": "Installer Core",
|
||||
"keywords": [
|
||||
"core"
|
||||
],
|
||||
"version": "1.0"
|
||||
}
|
@ -7,9 +7,11 @@
|
||||
* @package humhub.modules_core.like
|
||||
* @since 0.5
|
||||
*/
|
||||
class LikeModule extends CWebModule {
|
||||
class LikeModule extends HWebModule
|
||||
{
|
||||
|
||||
public function init() {
|
||||
public function init()
|
||||
{
|
||||
// import the module-level models and components
|
||||
$this->setImport(array(
|
||||
'like.models.*',
|
||||
@ -17,21 +19,13 @@ class LikeModule extends CWebModule {
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Install some event listeners for the module
|
||||
*/
|
||||
public static function install() {
|
||||
|
||||
// Install Event Handler & Behaviors
|
||||
Yii::app()->interceptor->preattachEventHandler('User', 'onBeforeDelete', array('LikeInterceptor', 'onUserDelete'));
|
||||
}
|
||||
|
||||
/**
|
||||
* On User delete, also delete all comments
|
||||
*
|
||||
* @param type $event
|
||||
*/
|
||||
public static function onUserDelete($event) {
|
||||
public static function onUserDelete($event)
|
||||
{
|
||||
|
||||
foreach (Like::model()->findAllByAttributes(array('created_by' => $event->sender->id)) as $like) {
|
||||
$like->delete();
|
||||
@ -43,7 +37,8 @@ class LikeModule extends CWebModule {
|
||||
/**
|
||||
* On delete of a content object, also delete all corresponding likes
|
||||
*/
|
||||
public static function onContentDelete($event) {
|
||||
public static function onContentDelete($event)
|
||||
{
|
||||
|
||||
foreach (Like::model()->findAllByAttributes(array('object_id' => $event->sender->id, 'object_model' => get_class($event->sender))) as $like) {
|
||||
$like->delete();
|
||||
@ -54,7 +49,8 @@ class LikeModule extends CWebModule {
|
||||
* On delete of a content addon object, e.g. a comment
|
||||
* also delete all likes
|
||||
*/
|
||||
public static function onContentAddonDelete($event) {
|
||||
public static function onContentAddonDelete($event)
|
||||
{
|
||||
|
||||
foreach (Like::model()->findAllByAttributes(array('object_id' => $event->sender->id, 'object_model' => get_class($event->sender))) as $like) {
|
||||
$like->delete();
|
||||
@ -66,10 +62,11 @@ class LikeModule extends CWebModule {
|
||||
*
|
||||
* @param type $event
|
||||
*/
|
||||
public static function onIntegrityCheck($event) {
|
||||
public static function onIntegrityCheck($event)
|
||||
{
|
||||
|
||||
$integrityChecker = $event->sender;
|
||||
$integrityChecker->showTestHeadline("Validating Like Module (".Like::model()->count()." entries)");
|
||||
$integrityChecker->showTestHeadline("Validating Like Module (" . Like::model()->count() . " entries)");
|
||||
|
||||
foreach (Like::model()->findAll() as $l) {
|
||||
if ($l->source === null) {
|
||||
@ -85,7 +82,8 @@ class LikeModule extends CWebModule {
|
||||
*
|
||||
* @param type $event
|
||||
*/
|
||||
public static function onWallEntryLinksInit($event) {
|
||||
public static function onWallEntryLinksInit($event)
|
||||
{
|
||||
|
||||
$event->sender->addWidget('application.modules_core.like.widgets.LikeLinkWidget', array('object' => $event->sender->object), array('sortOrder' => 10));
|
||||
}
|
||||
@ -95,8 +93,9 @@ class LikeModule extends CWebModule {
|
||||
*
|
||||
* @param type $event
|
||||
*/
|
||||
public static function onWallEntryAddonInit($event) {
|
||||
|
||||
public static function onWallEntryAddonInit($event)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
Yii::app()->moduleManager->register(array(
|
||||
'id' => 'like',
|
||||
'title' => Yii::t('LikeModule.base', 'Likes'),
|
||||
'description' => Yii::t('LikeModule.base', 'Likes core module.'),
|
||||
'class' => 'application.modules_core.like.LikeModule',
|
||||
'isCoreModule' => true,
|
||||
'import' => array(
|
||||
|
9
protected/modules_core/like/module.json
Normal file
9
protected/modules_core/like/module.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"id": "like",
|
||||
"name": "Like",
|
||||
"description": "Like Core",
|
||||
"keywords": [
|
||||
"core"
|
||||
],
|
||||
"version": "1.0"
|
||||
}
|
@ -6,7 +6,7 @@
|
||||
* @package humhub.modules_core.notification
|
||||
* @since 0.5
|
||||
*/
|
||||
class NotificationModule extends CWebModule {
|
||||
class NotificationModule extends HWebModule {
|
||||
|
||||
public function init() {
|
||||
$this->setImport(array(
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
Yii::app()->moduleManager->register(array(
|
||||
'id' => 'notification',
|
||||
'title' => Yii::t('NotificationModule.base', 'Notification'),
|
||||
'description' => Yii::t('FeedbackModule.base', 'Basic subsystem for notifications.'),
|
||||
'class' => 'application.modules_core.notification.NotificationModule',
|
||||
'isCoreModule' => true,
|
||||
'import' => array(
|
||||
|
9
protected/modules_core/notification/module.json
Normal file
9
protected/modules_core/notification/module.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"id": "notification",
|
||||
"name": "Notifications",
|
||||
"description": "Notification Core",
|
||||
"keywords": [
|
||||
"core"
|
||||
],
|
||||
"version": "1.0"
|
||||
}
|
@ -4,7 +4,7 @@
|
||||
* @package humhub.modules_core.post
|
||||
* @since 0.5
|
||||
*/
|
||||
class PostModule extends CWebModule {
|
||||
class PostModule extends HWebModule {
|
||||
|
||||
public function init() {
|
||||
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
Yii::app()->moduleManager->register(array(
|
||||
'id' => 'post',
|
||||
'title' => Yii::t('PostModule.base', 'Post'),
|
||||
'description' => Yii::t('PostModule.base', 'Basic subsystem for workspace/user post.'),
|
||||
'class' => 'application.modules_core.post.PostModule',
|
||||
'isCoreModule' => true,
|
||||
'import' => array(
|
||||
|
9
protected/modules_core/post/module.json
Normal file
9
protected/modules_core/post/module.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"id": "post",
|
||||
"name": "Post",
|
||||
"description": "Post Core",
|
||||
"keywords": [
|
||||
"core"
|
||||
],
|
||||
"version": "1.0"
|
||||
}
|
@ -7,7 +7,7 @@
|
||||
* @package humhub.modules_core.space
|
||||
* @since 0.5
|
||||
*/
|
||||
class SpaceModule extends CWebModule {
|
||||
class SpaceModule extends HWebModule {
|
||||
|
||||
public function init() {
|
||||
$this->setImport(array(
|
||||
|
87
protected/modules_core/space/SpaceModuleBehavior.php
Normal file
87
protected/modules_core/space/SpaceModuleBehavior.php
Normal file
@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* HumHub
|
||||
* Copyright © 2014 The HumHub Project
|
||||
*
|
||||
* The texts of the GNU Affero General Public License with an additional
|
||||
* permission and of our proprietary license can be found at and
|
||||
* in the LICENSE file you have received along with this program.
|
||||
*
|
||||
* According to our dual licensing model, this program can be used either
|
||||
* under the terms of the GNU Affero General Public License, version 3,
|
||||
* or under a proprietary license.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* This behavior should attached to a HWebModule when it provides a space module.
|
||||
*
|
||||
* @author luke
|
||||
*/
|
||||
class SpaceModuleBehavior extends CBehavior
|
||||
{
|
||||
|
||||
/**
|
||||
* Returns current space by context
|
||||
*
|
||||
* @return Space
|
||||
*/
|
||||
public function getSpace()
|
||||
{
|
||||
return Yii::app()->getController()->getSpace();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if this module is enabled on given space.
|
||||
*
|
||||
* @param Space $space
|
||||
* @return boolean
|
||||
*/
|
||||
public function isSpaceModuleEnabled(Space $space = null)
|
||||
{
|
||||
if ($space == null) {
|
||||
$space = $this->getSpace();
|
||||
}
|
||||
|
||||
return $space->isModuleEnabled($this->getOwner()->getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns module name for spaces of your module.
|
||||
* You may want to overwrite it in your module.
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
public function getSpaceModuleName()
|
||||
{
|
||||
return $this->getOwner()->getName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns module description for spaces of your module.
|
||||
* You may want to overwrite it in your module.
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
public function getSpaceModuleDescription()
|
||||
{
|
||||
return $this->getOwner()->getDescription();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns module config url for spaces of your module.
|
||||
* You may want to overwrite it in your module.
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
public function getSpaceModuleConfigUrl(Space $space)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
@ -2,8 +2,6 @@
|
||||
|
||||
Yii::app()->moduleManager->register(array(
|
||||
'id' => 'space',
|
||||
'title' => Yii::t('SpaceModule.base', 'Spaces'),
|
||||
'description' => Yii::t('SpaceModule.base', 'Spaces core'),
|
||||
'class' => 'application.modules_core.space.SpaceModule',
|
||||
'import' => array(
|
||||
'application.modules_core.space.widgets.*',
|
||||
|
@ -32,7 +32,8 @@
|
||||
* @package humhub.modules_core.space.models
|
||||
* @since 0.5
|
||||
*/
|
||||
class Space extends HActiveRecordContentContainer implements ISearchable {
|
||||
class Space extends HActiveRecordContentContainer implements ISearchable
|
||||
{
|
||||
|
||||
// Join Policies
|
||||
const JOIN_POLICY_NONE = 0; // No Self Join Possible
|
||||
@ -54,7 +55,8 @@ class Space extends HActiveRecordContentContainer implements ISearchable {
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function behaviors() {
|
||||
public function behaviors()
|
||||
{
|
||||
return array(
|
||||
'HGuidBehavior' => array(
|
||||
'class' => 'application.behaviors.HGuidBehavior',
|
||||
@ -67,21 +69,24 @@ class Space extends HActiveRecordContentContainer implements ISearchable {
|
||||
* @param string $className active record class name.
|
||||
* @return Space the static model class
|
||||
*/
|
||||
public static function model($className = __CLASS__) {
|
||||
public static function model($className = __CLASS__)
|
||||
{
|
||||
return parent::model($className);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string the associated database table name
|
||||
*/
|
||||
public function tableName() {
|
||||
public function tableName()
|
||||
{
|
||||
return 'space';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array validation rules for model attributes.
|
||||
*/
|
||||
public function rules() {
|
||||
public function rules()
|
||||
{
|
||||
|
||||
$rules = array();
|
||||
|
||||
@ -124,7 +129,8 @@ class Space extends HActiveRecordContentContainer implements ISearchable {
|
||||
/**
|
||||
* @return array relational rules.
|
||||
*/
|
||||
public function relations() {
|
||||
public function relations()
|
||||
{
|
||||
// NOTE: you may need to adjust the relation name and the related
|
||||
// class name for the relations automatically generated below.
|
||||
return array(
|
||||
@ -154,7 +160,8 @@ class Space extends HActiveRecordContentContainer implements ISearchable {
|
||||
/**
|
||||
* @return array customized attribute labels (name=>label)
|
||||
*/
|
||||
public function attributeLabels() {
|
||||
public function attributeLabels()
|
||||
{
|
||||
return array(
|
||||
'id' => 'ID',
|
||||
'wall_id' => 'Wall',
|
||||
@ -178,7 +185,8 @@ class Space extends HActiveRecordContentContainer implements ISearchable {
|
||||
* Scopes
|
||||
*
|
||||
*/
|
||||
public function scopes() {
|
||||
public function scopes()
|
||||
{
|
||||
return array(
|
||||
// Coming soon
|
||||
'active' => array(
|
||||
@ -200,7 +208,8 @@ class Space extends HActiveRecordContentContainer implements ISearchable {
|
||||
* @param type $limit
|
||||
* @return User
|
||||
*/
|
||||
public function recently($limit = 10) {
|
||||
public function recently($limit = 10)
|
||||
{
|
||||
$this->getDbCriteria()->mergeWith(array(
|
||||
'order' => 'created_at DESC',
|
||||
'limit' => $limit,
|
||||
@ -212,7 +221,8 @@ class Space extends HActiveRecordContentContainer implements ISearchable {
|
||||
* Retrieves a list of models based on the current search/filter conditions.
|
||||
* @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
|
||||
*/
|
||||
public function search() {
|
||||
public function search()
|
||||
{
|
||||
$criteria = new CDbCriteria;
|
||||
$criteria->compare('id', $this->id);
|
||||
$criteria->compare('wall_id', $this->wall_id);
|
||||
@ -238,7 +248,8 @@ class Space extends HActiveRecordContentContainer implements ISearchable {
|
||||
/**
|
||||
* After Save Addons
|
||||
*/
|
||||
protected function afterSave() {
|
||||
protected function afterSave()
|
||||
{
|
||||
|
||||
// Try To Delete Search Model
|
||||
HSearch::getInstance()->deleteModel($this);
|
||||
@ -254,13 +265,14 @@ class Space extends HActiveRecordContentContainer implements ISearchable {
|
||||
/**
|
||||
* Before deletion of a Space
|
||||
*/
|
||||
protected function beforeDelete() {
|
||||
protected function beforeDelete()
|
||||
{
|
||||
if (parent::beforeDelete()) {
|
||||
|
||||
foreach (SpaceSetting::model()->findAllByAttributes(array('space_id'=>$this->id)) as $spaceSetting) {
|
||||
foreach (SpaceSetting::model()->findAllByAttributes(array('space_id' => $this->id)) as $spaceSetting) {
|
||||
$spaceSetting->delete();
|
||||
}
|
||||
|
||||
|
||||
HSearch::getInstance()->deleteModel($this);
|
||||
return true;
|
||||
}
|
||||
@ -270,7 +282,8 @@ class Space extends HActiveRecordContentContainer implements ISearchable {
|
||||
* Delete a Space
|
||||
*
|
||||
*/
|
||||
public function delete() {
|
||||
public function delete()
|
||||
{
|
||||
|
||||
$this->getProfileImage()->delete();
|
||||
|
||||
@ -314,7 +327,8 @@ class Space extends HActiveRecordContentContainer implements ISearchable {
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function insert($attributes = null) {
|
||||
public function insert($attributes = null)
|
||||
{
|
||||
|
||||
if (parent::insert($attributes)) {
|
||||
|
||||
@ -340,7 +354,8 @@ class Space extends HActiveRecordContentContainer implements ISearchable {
|
||||
*
|
||||
* @param $userId User Id of User
|
||||
*/
|
||||
public function isFollowedBy($userId = "") {
|
||||
public function isFollowedBy($userId = "")
|
||||
{
|
||||
// Take current userid if none is given
|
||||
if ($userId == "")
|
||||
$userId = Yii::app()->user->id;
|
||||
@ -358,7 +373,8 @@ class Space extends HActiveRecordContentContainer implements ISearchable {
|
||||
*
|
||||
* @param $userId User Id of User
|
||||
*/
|
||||
public function canJoin($userId = "") {
|
||||
public function canJoin($userId = "")
|
||||
{
|
||||
// Take current userid if none is given
|
||||
if ($userId == "")
|
||||
$userId = Yii::app()->user->id;
|
||||
@ -379,7 +395,8 @@ class Space extends HActiveRecordContentContainer implements ISearchable {
|
||||
*
|
||||
* @param $userId User Id of User
|
||||
*/
|
||||
public function canJoinFree($userId = "") {
|
||||
public function canJoinFree($userId = "")
|
||||
{
|
||||
// Take current userid if none is given
|
||||
if ($userId == "")
|
||||
$userId = Yii::app()->user->id;
|
||||
@ -401,7 +418,8 @@ class Space extends HActiveRecordContentContainer implements ISearchable {
|
||||
* @param type $userId
|
||||
* @return type
|
||||
*/
|
||||
public function canWrite($userId = "") {
|
||||
public function canWrite($userId = "")
|
||||
{
|
||||
|
||||
// No writes allowed for archived workspaces
|
||||
if ($this->status == Space::STATUS_ARCHIVED)
|
||||
@ -424,7 +442,8 @@ class Space extends HActiveRecordContentContainer implements ISearchable {
|
||||
* @param type $userId
|
||||
* @return type
|
||||
*/
|
||||
public function isMember($userId = "") {
|
||||
public function isMember($userId = "")
|
||||
{
|
||||
|
||||
// Take current userid if none is given
|
||||
if ($userId == "")
|
||||
@ -446,7 +465,8 @@ class Space extends HActiveRecordContentContainer implements ISearchable {
|
||||
* @param type $userId
|
||||
* @return type
|
||||
*/
|
||||
public function isAdmin($userId = "") {
|
||||
public function isAdmin($userId = "")
|
||||
{
|
||||
|
||||
if ($userId == 0)
|
||||
$userId = Yii::app()->user->id;
|
||||
@ -471,7 +491,8 @@ class Space extends HActiveRecordContentContainer implements ISearchable {
|
||||
* @param type $userId
|
||||
* @return type
|
||||
*/
|
||||
public function setOwner($userId = "") {
|
||||
public function setOwner($userId = "")
|
||||
{
|
||||
|
||||
if ($userId == 0)
|
||||
$userId = Yii::app()->user->id;
|
||||
@ -489,7 +510,8 @@ class Space extends HActiveRecordContentContainer implements ISearchable {
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function getOwner() {
|
||||
public function getOwner()
|
||||
{
|
||||
|
||||
$user = User::model()->findByPk($this->created_by);
|
||||
return $user;
|
||||
@ -501,7 +523,8 @@ class Space extends HActiveRecordContentContainer implements ISearchable {
|
||||
* @param type $userId
|
||||
* @return type
|
||||
*/
|
||||
public function setAdmin($userId = "") {
|
||||
public function setAdmin($userId = "")
|
||||
{
|
||||
|
||||
if ($userId == 0)
|
||||
$userId = Yii::app()->user->id;
|
||||
@ -521,7 +544,8 @@ class Space extends HActiveRecordContentContainer implements ISearchable {
|
||||
* @param type $userId
|
||||
* @return type
|
||||
*/
|
||||
public function canInvite($userId = "") {
|
||||
public function canInvite($userId = "")
|
||||
{
|
||||
|
||||
if ($userId == 0)
|
||||
$userId = Yii::app()->user->id;
|
||||
@ -545,7 +569,8 @@ class Space extends HActiveRecordContentContainer implements ISearchable {
|
||||
* @param type $userId
|
||||
* @return type
|
||||
*/
|
||||
public function canShare($userId = "") {
|
||||
public function canShare($userId = "")
|
||||
{
|
||||
|
||||
// There is no visibility for guests, so sharing is useless anyway.
|
||||
if ($this->visibility != Space::VISIBILITY_ALL)
|
||||
@ -567,7 +592,8 @@ class Space extends HActiveRecordContentContainer implements ISearchable {
|
||||
*
|
||||
* If none Record is found, null is given
|
||||
*/
|
||||
public function getMembership($userId = "") {
|
||||
public function getMembership($userId = "")
|
||||
{
|
||||
if ($userId == "")
|
||||
$userId = Yii::app()->user->id;
|
||||
|
||||
@ -586,7 +612,8 @@ class Space extends HActiveRecordContentContainer implements ISearchable {
|
||||
/**
|
||||
* Is given User owner of this Space
|
||||
*/
|
||||
public function isOwner($userId = "") {
|
||||
public function isOwner($userId = "")
|
||||
{
|
||||
if ($userId == "")
|
||||
$userId = Yii::app()->user->id;
|
||||
|
||||
@ -602,7 +629,8 @@ class Space extends HActiveRecordContentContainer implements ISearchable {
|
||||
*
|
||||
* @param $userId UserId of User to Remove
|
||||
*/
|
||||
public function removeMember($userId = "") {
|
||||
public function removeMember($userId = "")
|
||||
{
|
||||
|
||||
if ($userId == "")
|
||||
$userId = Yii::app()->user->id;
|
||||
@ -656,7 +684,8 @@ class Space extends HActiveRecordContentContainer implements ISearchable {
|
||||
*
|
||||
* @param type $userId
|
||||
*/
|
||||
public function addMember($userId) {
|
||||
public function addMember($userId)
|
||||
{
|
||||
|
||||
$user = User::model()->findByPk($userId);
|
||||
|
||||
@ -718,7 +747,8 @@ class Space extends HActiveRecordContentContainer implements ISearchable {
|
||||
* @param type $userId
|
||||
* @param type $originatorUserId
|
||||
*/
|
||||
public function inviteMember($userId, $originatorUserId) {
|
||||
public function inviteMember($userId, $originatorUserId)
|
||||
{
|
||||
|
||||
$membership = $this->getMembership($userId);
|
||||
|
||||
@ -765,7 +795,8 @@ class Space extends HActiveRecordContentContainer implements ISearchable {
|
||||
* @param type $email
|
||||
* @param type $originatorUserId
|
||||
*/
|
||||
public function inviteMemberByEMail($email, $originatorUserId) {
|
||||
public function inviteMemberByEMail($email, $originatorUserId)
|
||||
{
|
||||
|
||||
// Invalid E-Mail
|
||||
$validator = new CEmailValidator;
|
||||
@ -808,7 +839,8 @@ class Space extends HActiveRecordContentContainer implements ISearchable {
|
||||
* @param type $userId
|
||||
* @param type $message
|
||||
*/
|
||||
public function requestMembership($userId, $message = "") {
|
||||
public function requestMembership($userId, $message = "")
|
||||
{
|
||||
|
||||
// Add Membership
|
||||
$membership = new SpaceMembership;
|
||||
@ -828,7 +860,8 @@ class Space extends HActiveRecordContentContainer implements ISearchable {
|
||||
* Checks if there is already a wall created for this workspace.
|
||||
* If not, a new wall will be created and automatically assigned.
|
||||
*/
|
||||
public function checkWall() {
|
||||
public function checkWall()
|
||||
{
|
||||
|
||||
// Check if wall exists
|
||||
if ($this->wall == null) {
|
||||
@ -856,7 +889,8 @@ class Space extends HActiveRecordContentContainer implements ISearchable {
|
||||
*
|
||||
* @return Array
|
||||
*/
|
||||
public function getSearchAttributes() {
|
||||
public function getSearchAttributes()
|
||||
{
|
||||
|
||||
return array(
|
||||
// Assignment
|
||||
@ -876,14 +910,16 @@ class Space extends HActiveRecordContentContainer implements ISearchable {
|
||||
/**
|
||||
* Returns the Search Result Output
|
||||
*/
|
||||
public function getSearchResult() {
|
||||
public function getSearchResult()
|
||||
{
|
||||
return Yii::app()->getController()->widget('application.modules_core.space.widgets.SpaceSearchResultWidget', array('space' => $this), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Admins of this Space
|
||||
*/
|
||||
public function getAdmins() {
|
||||
public function getAdmins()
|
||||
{
|
||||
|
||||
$admins = array();
|
||||
|
||||
@ -900,7 +936,8 @@ class Space extends HActiveRecordContentContainer implements ISearchable {
|
||||
* Counts all Content Items related to this workspace except of Activities.
|
||||
* Additonally Comments (normally ContentAddon) will be included.
|
||||
*/
|
||||
public function countItems() {
|
||||
public function countItems()
|
||||
{
|
||||
|
||||
$count = 0;
|
||||
$count += Content::model()->countByAttributes(array('space_id' => $this->id), 'object_model != :activityModel', array(':activityModel' => 'Activity'));
|
||||
@ -914,7 +951,8 @@ class Space extends HActiveRecordContentContainer implements ISearchable {
|
||||
*
|
||||
* @return Integer
|
||||
*/
|
||||
public function countPosts() {
|
||||
public function countPosts()
|
||||
{
|
||||
/*
|
||||
$criteria = new CDbCriteria();
|
||||
$criteria->condition = "content.space_id=:space_id";
|
||||
@ -927,7 +965,8 @@ class Space extends HActiveRecordContentContainer implements ISearchable {
|
||||
/**
|
||||
* Sets Comments Count for this workspace
|
||||
*/
|
||||
public function getCommentCount() {
|
||||
public function getCommentCount()
|
||||
{
|
||||
$cacheId = "workspaceCommentCount_" . $this->id;
|
||||
$cacheValue = Yii::app()->cache->get($cacheId);
|
||||
|
||||
@ -943,7 +982,8 @@ class Space extends HActiveRecordContentContainer implements ISearchable {
|
||||
/**
|
||||
* Returns an array with assigned Tags
|
||||
*/
|
||||
public function getTags() {
|
||||
public function getTags()
|
||||
{
|
||||
|
||||
// split tags string into individual tags
|
||||
return preg_split("/[;,# ]+/", $this->tags);
|
||||
@ -952,7 +992,8 @@ class Space extends HActiveRecordContentContainer implements ISearchable {
|
||||
/**
|
||||
* Archive this Space
|
||||
*/
|
||||
public function archive() {
|
||||
public function archive()
|
||||
{
|
||||
$this->status = self::STATUS_ARCHIVED;
|
||||
$this->save();
|
||||
}
|
||||
@ -960,7 +1001,8 @@ class Space extends HActiveRecordContentContainer implements ISearchable {
|
||||
/**
|
||||
* Unarchive this Space
|
||||
*/
|
||||
public function unarchive() {
|
||||
public function unarchive()
|
||||
{
|
||||
$this->status = self::STATUS_ENABLED;
|
||||
$this->save();
|
||||
}
|
||||
@ -971,32 +1013,29 @@ class Space extends HActiveRecordContentContainer implements ISearchable {
|
||||
* @param array $parameters
|
||||
* @return string url
|
||||
*/
|
||||
public function getUrl($parameters = array()) {
|
||||
public function getUrl($parameters = array())
|
||||
{
|
||||
$parameters['sguid'] = $this->guid;
|
||||
return Yii::app()->createUrl('//space/space', $parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of available workspace modules
|
||||
* Collects a list of all modules which are available for this space
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getAvailableModules() {
|
||||
public function getAvailableModules()
|
||||
{
|
||||
|
||||
$availableModules = array();
|
||||
$modules = array();
|
||||
|
||||
// Loop over all enabled modules
|
||||
foreach (Yii::app()->moduleManager->getEnabledModules() as $moduleId => $definition) {
|
||||
|
||||
if (isset($definition['spaceModules']) && is_array($definition['spaceModules'])) {
|
||||
|
||||
foreach ($definition['spaceModules'] as $moduleId => $moduleInfo) {
|
||||
$availableModules[$moduleId] = $moduleInfo;
|
||||
}
|
||||
foreach (Yii::app()->moduleManager->getEnabledModules() as $moduleId => $module) {
|
||||
if (array_key_exists('SpaceModuleBehavior', $module->behaviors())) {
|
||||
$modules[$module->getId()] = $module;
|
||||
}
|
||||
}
|
||||
|
||||
return $availableModules;
|
||||
return $modules;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1004,7 +1043,8 @@ class Space extends HActiveRecordContentContainer implements ISearchable {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getEnabledModules() {
|
||||
public function getEnabledModules()
|
||||
{
|
||||
|
||||
$modules = array();
|
||||
foreach (SpaceApplicationModule::model()->findAllByAttributes(array('space_id' => $this->id)) as $SpaceModule) {
|
||||
@ -1014,6 +1054,7 @@ class Space extends HActiveRecordContentContainer implements ISearchable {
|
||||
$modules[] = $moduleId;
|
||||
}
|
||||
}
|
||||
|
||||
return $modules;
|
||||
}
|
||||
|
||||
@ -1022,7 +1063,8 @@ class Space extends HActiveRecordContentContainer implements ISearchable {
|
||||
*
|
||||
* @param type $moduleId
|
||||
*/
|
||||
public function isModuleEnabled($moduleId) {
|
||||
public function isModuleEnabled($moduleId)
|
||||
{
|
||||
|
||||
// Not enabled globally
|
||||
if (!array_key_exists($moduleId, $this->getAvailableModules())) {
|
||||
@ -1041,7 +1083,8 @@ class Space extends HActiveRecordContentContainer implements ISearchable {
|
||||
/**
|
||||
* Installs a Module
|
||||
*/
|
||||
public function installModule($moduleId) {
|
||||
public function installModule($moduleId)
|
||||
{
|
||||
|
||||
// Not enabled globally
|
||||
if (!array_key_exists($moduleId, $this->getAvailableModules())) {
|
||||
@ -1068,14 +1111,16 @@ class Space extends HActiveRecordContentContainer implements ISearchable {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function onInstallModule($event) {
|
||||
public function onInstallModule($event)
|
||||
{
|
||||
$this->raiseEvent('onInstallModule', $event);
|
||||
}
|
||||
|
||||
/**
|
||||
* Uninstalls a Module
|
||||
*/
|
||||
public function uninstallModule($moduleId) {
|
||||
public function uninstallModule($moduleId)
|
||||
{
|
||||
|
||||
// Not enabled globally
|
||||
if (!array_key_exists($moduleId, $this->getAvailableModules())) {
|
||||
@ -1098,7 +1143,8 @@ class Space extends HActiveRecordContentContainer implements ISearchable {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function onUninstallModule($event) {
|
||||
public function onUninstallModule($event)
|
||||
{
|
||||
$this->raiseEvent('onUninstallModule', $event);
|
||||
}
|
||||
|
||||
|
9
protected/modules_core/space/module.json
Normal file
9
protected/modules_core/space/module.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"id": "space",
|
||||
"name": "Space",
|
||||
"description": "Space Core",
|
||||
"keywords": [
|
||||
"core"
|
||||
],
|
||||
"version": "1.0"
|
||||
}
|
@ -6,27 +6,27 @@
|
||||
<?php echo Yii::t('SpaceModule.base', 'Enhance this space with modules.'); ?><br>
|
||||
|
||||
|
||||
<?php foreach ($this->getSpace()->getAvailableModules() as $moduleId => $moduleInfo): ?>
|
||||
<?php foreach ($this->getSpace()->getAvailableModules() as $moduleId => $module): ?>
|
||||
<div class="media">
|
||||
<img class="media-object img-rounded pull-left" data-src="holder.js/64x64" alt="64x64"
|
||||
style="width: 64px; height: 64px;"
|
||||
src="<?php echo Yii::app()->baseUrl; ?>/uploads/profile_image/default_module.jpg">
|
||||
|
||||
<div class="media-body">
|
||||
<h4 class="media-heading"><?php echo $moduleInfo['title']; ?>
|
||||
<h4 class="media-heading"><?php echo $module->getSpaceModuleName(); ?>
|
||||
<?php if ($this->getSpace()->isModuleEnabled($moduleId)) : ?>
|
||||
<small><span class="label label-success"><?php echo Yii::t('SpaceModule.base', 'Activated'); ?></span></small>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
</h4>
|
||||
|
||||
<p><?php echo $moduleInfo['description']; ?></p>
|
||||
<p><?php echo $module->getSpaceModuleDescription(); ?></p>
|
||||
<?php if ($this->getSpace()->isModuleEnabled($moduleId)) : ?>
|
||||
<?php echo CHtml::link(Yii::t('base', 'Disable'), array('//space/admin/disableModule', 'moduleId' => $moduleId, 'sguid' => $this->getSpace()->guid), array('class' => 'btn btn-sm btn-primary', 'onClick' => 'return moduleDisableWarning()')); ?>
|
||||
|
||||
<?php if (isset($moduleInfo['configRoute'])) : ?>
|
||||
<?php if ($module->getSpaceModuleConfigUrl($this->getSpace()) != "") : ?>
|
||||
<?php
|
||||
echo CHtml::link(
|
||||
Yii::t('SpaceModule.base', 'Configure'), $this->createUrl($moduleInfo['configRoute'], array('sguid' => $this->getSpace()->guid)), array('class' => 'btn btn-default')
|
||||
Yii::t('SpaceModule.base', 'Configure'), $module->getSpaceModuleConfigUrl($this->getSpace()), array('class' => 'btn btn-default')
|
||||
);
|
||||
?>
|
||||
<?php endif; ?>
|
||||
|
@ -6,7 +6,7 @@
|
||||
* @since 0.5
|
||||
* @author Luke
|
||||
*/
|
||||
class UserModule extends CWebModule {
|
||||
class UserModule extends HWebModule {
|
||||
|
||||
public function init() {
|
||||
$this->setImport(array(
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
Yii::app()->moduleManager->register(array(
|
||||
'id' => 'user',
|
||||
'title' => Yii::t('UserModule.base', 'User'),
|
||||
'description' => Yii::t('SpaceModule.base', 'Users core'),
|
||||
'class' => 'application.modules_core.user.UserModule',
|
||||
'isCoreModule' => true,
|
||||
'import' => array(
|
||||
|
@ -24,9 +24,11 @@
|
||||
* @package humhub.modules_core.user.controllers
|
||||
* @since 0.5
|
||||
*/
|
||||
class AuthController extends Controller {
|
||||
class AuthController extends Controller
|
||||
{
|
||||
|
||||
public function actions() {
|
||||
public function actions()
|
||||
{
|
||||
return array(
|
||||
// captcha action renders the CAPTCHA image displayed on the password recovery page
|
||||
'captcha' => array(
|
||||
@ -39,7 +41,8 @@ class AuthController extends Controller {
|
||||
/**
|
||||
* Displays the login page
|
||||
*/
|
||||
public function actionLogin() {
|
||||
public function actionLogin()
|
||||
{
|
||||
|
||||
// If user is already logged in, redirect him to the dashboard
|
||||
if (!Yii::app()->user->isGuest) {
|
||||
@ -58,7 +61,7 @@ class AuthController extends Controller {
|
||||
$model = new AccountLoginForm;
|
||||
|
||||
//TODO: Solve this via events!
|
||||
if (Yii::app()->moduleManager->isEnabled('zsso')) {
|
||||
if (Yii::app()->getModule('zsso') != null) {
|
||||
ZSsoModule::beforeActionLogin();
|
||||
}
|
||||
|
||||
@ -130,7 +133,8 @@ class AuthController extends Controller {
|
||||
*
|
||||
* @todo check local auth_mode
|
||||
*/
|
||||
public function actionRecoverPassword() {
|
||||
public function actionRecoverPassword()
|
||||
{
|
||||
|
||||
// Disable Sublayout
|
||||
$this->subLayout = "";
|
||||
@ -169,7 +173,8 @@ class AuthController extends Controller {
|
||||
*
|
||||
* This action is called after e-mail validation.
|
||||
*/
|
||||
public function actionCreateAccount() {
|
||||
public function actionCreateAccount()
|
||||
{
|
||||
|
||||
$_POST = Yii::app()->input->stripClean($_POST);
|
||||
|
||||
@ -212,7 +217,7 @@ class AuthController extends Controller {
|
||||
'type' => (HSetting::Get('defaultUserGroup', 'authentication_internal')) ? 'hidden' : 'dropdownlist',
|
||||
'class' => 'form-control',
|
||||
'items' => CHtml::listData($groupModels, 'id', 'name'),
|
||||
'value' => (HSetting::Get('defaultUserGroup', 'authentication_internal')) ? HSetting::Get('defaultUserGroup', 'authentication_internal') : '',
|
||||
'value' => (HSetting::Get('defaultUserGroup', 'authentication_internal')) ? HSetting::Get('defaultUserGroup', 'authentication_internal') : '',
|
||||
),
|
||||
),
|
||||
);
|
||||
@ -287,7 +292,8 @@ class AuthController extends Controller {
|
||||
* Logouts a User
|
||||
*
|
||||
*/
|
||||
public function actionLogout() {
|
||||
public function actionLogout()
|
||||
{
|
||||
|
||||
Yii::app()->user->logout();
|
||||
|
||||
@ -302,7 +308,8 @@ class AuthController extends Controller {
|
||||
*
|
||||
* Can also used as a kind of keep alive.
|
||||
*/
|
||||
public function actionCheckSessionState() {
|
||||
public function actionCheckSessionState()
|
||||
{
|
||||
$out = array();
|
||||
$out['loggedIn'] = false;
|
||||
|
||||
@ -318,7 +325,8 @@ class AuthController extends Controller {
|
||||
* Allows third party applications to convert a valid sessionId
|
||||
* into a username.
|
||||
*/
|
||||
public function actionGetSessionUserJson() {
|
||||
public function actionGetSessionUserJson()
|
||||
{
|
||||
|
||||
$sessionId = Yii::app()->request->getQuery('sessionId');
|
||||
|
||||
|
9
protected/modules_core/user/module.json
Normal file
9
protected/modules_core/user/module.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"id": "user",
|
||||
"name": "User",
|
||||
"description": "User Core",
|
||||
"keywords": [
|
||||
"core"
|
||||
],
|
||||
"version": "1.0"
|
||||
}
|
@ -10,7 +10,7 @@
|
||||
* @since 0.5
|
||||
* @author Luke
|
||||
*/
|
||||
class WallModule extends CWebModule {
|
||||
class WallModule extends HWebModule {
|
||||
|
||||
/**
|
||||
* Inits the wall module
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
Yii::app()->moduleManager->register(array(
|
||||
'id' => 'wall',
|
||||
'title' => Yii::t('WallModule.base', 'Wall'),
|
||||
'description' => Yii::t('WallModule.base', 'Adds the wall/streaming core module.'),
|
||||
'class' => 'application.modules_core.wall.WallModule',
|
||||
'import' => array(
|
||||
'application.modules_core.wall.*',
|
||||
|
9
protected/modules_core/wall/module.json
Normal file
9
protected/modules_core/wall/module.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"id": "wall",
|
||||
"name": "Wall",
|
||||
"description": "Wall Core",
|
||||
"keywords": [
|
||||
"core"
|
||||
],
|
||||
"version": "1.0"
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user