Documentation enhancements

This commit is contained in:
buddha87 2016-05-19 18:48:08 +02:00
parent 16474755c7
commit 14a219e745
12 changed files with 103 additions and 135 deletions

View File

@ -5,6 +5,7 @@ Introduction
------------
* [About HumHub](intro-index.md)
* [Licence](intro-licence.md)
* [Bundled Software](intro-bundled_software.md)
Getting Started
---------------
@ -33,22 +34,15 @@ Development
* [Notifications](dev-notifications.md)
* [Activities](dev-activities.md)
* [Streams](dev-stream.md)
* [Events](dev-module-events.md)
* [Events](dev-events.md)
* [Widgets](dev-widgets.md)
* [Internationalization](dev-module-i18n.md)
* [Models / Database](dev-module-db.md)
* [Internationalization](dev-i18n.md)
* [Models / Database](dev-db.md)
* [Search](dev-search.md)
* [Build](dev-build.md)
* [Contributions](dev-contributing.md)
Module Development
---------------------
* [Getting Started](dev-module-index.md)
* [Space/User](dev-module-spaceuser.md)
* [CronJobs](dev-module-cron.md)
* [Console](dev-module-console.md)
* [Special Topics](dev-module-special-topics.md)
* [CronJobs](dev-cron.md)
* [Settings and Configuration](dev-settings.md)
* [Console Application](dev-console.md)
* [Module Development](dev-module.md)
Theming
-------
@ -56,10 +50,3 @@ Theming
* [Getting Started](theming-index.md)
* [Update / Migrate](theming-migrate.md)
Special Topics
--------------
* [Translations](special-translations.md)
* [Bundled Software](special-bundled_software.md)

View File

@ -0,0 +1,61 @@
Console Application
=====================
## Add controller to the console application
To add a custom controller to the console application, you need to catch the [[humhub\components\console\Application::EVENT_ON_INIT]].
Example event:
```php
<?php
use humhub\components\console\Application;
return [
'id' => 'translation',
'class' => 'humhub\modules\translation\Module',
'namespace' => 'humhub\modules\translation',
'events' => array(
//...
array('class' => Application::className(), 'event' => Application::EVENT_ON_INIT, 'callback' => array('humhub\modules\translation\Module', 'onConsoleApplicationInit')),
//...
),
];
?>
```
Example callback:
```php
public static function onConsoleApplicationInit($event) {
$application = $event->sender;
$application->controllerMap['translation'] = commands\TranslationController::className();
}
```
## Integrity Checker
The integrity checker is a command which validates and if necessary repairs the application database.
If you want to add own checking methods for your module to it, you can intercept the [[humhub\controllers\IntegrityController::EVENT_ON_RUN]] event.
Example callback implementation:
```php
public static function onIntegrityCheck($event)
{
$integrityController = $event->sender;
$integrityController->showTestHeadline("Polls Module - Answers (" . PollAnswer::find()->count() . " entries)");
foreach (PollAnswer::find()->joinWith('poll')->all() as $answer) {
if ($answer->poll === null) {
if ($integrityController->showFix("Deleting poll answer id " . $answer->id . " without existing poll!")) {
$answer->delete();
}
}
}
}
```

View File

@ -60,4 +60,28 @@ class uninstall extends Migration
}
}
```
## Integrity Checker
The integrity checker is a command which validates and if necessary repairs the application database.
If you want to add own checking methods for your module to it, you can intercept the [[humhub\controllers\IntegrityController::EVENT_ON_RUN]] event.
Example callback implementation:
```php
public static function onIntegrityCheck($event)
{
$integrityController = $event->sender;
$integrityController->showTestHeadline("Polls Module - Answers (" . PollAnswer::find()->count() . " entries)");
foreach (PollAnswer::find()->joinWith('poll')->all() as $answer) {
if ($answer->poll === null) {
if ($integrityController->showFix("Deleting poll answer id " . $answer->id . " without existing poll!")) {
$answer->delete();
}
}
}
}
```

View File

@ -1,35 +0,0 @@
Console
=======
To add a custom controller to the console application, you need to catch the [[humhub\components\console\Application::EVENT_ON_INIT]].
### Example: Event
```php
<?php
use humhub\components\console\Application;
return [
'id' => 'translation',
'class' => 'humhub\modules\translation\Module',
'namespace' => 'humhub\modules\translation',
'events' => array(
//...
array('class' => Application::className(), 'event' => Application::EVENT_ON_INIT, 'callback' => array('humhub\modules\translation\Module', 'onConsoleApplicationInit')),
//...
),
];
?>
```
### Example: Callback
```php
public static function onConsoleApplicationInit($event) {
$application = $event->sender;
$application->controllerMap['translation'] = commands\TranslationController::className();
}
```

View File

@ -1,44 +0,0 @@
Space/User Modules
==================
TBD
## Enabled/Disable per Space/User
Tasks:
- Inherit your modules base class from [[\humhub\modules\content\components\ContentContainerModule]]
- Define valid container types (e.g. Space or/and User)
Example
```php
// ...
use humhub\modules\space\models\Space;
use humhub\modules\user\models\User;
// ...
class Module extends \humhub\modules\content\components\ContentContainerModule
{
// ...
/**
* @inheritdoc
*/
public function getContentContainerTypes()
{
return [
Space::className(),
User::className(),
];
}
// ...
}
```

View File

@ -1,27 +0,0 @@
Special Topics
==============
## Integrity Checker
The integrity checker is a command which validates and if necessary repairs the application database.
If you want to add own checking methods for your module to it, you can intercept the [[humhub\controllers\IntegrityController::EVENT_ON_RUN]] event.
Example callback implementation:
```php
public static function onIntegrityCheck($event)
{
$integrityController = $event->sender;
$integrityController->showTestHeadline("Polls Module - Answers (" . PollAnswer::find()->count() . " entries)");
foreach (PollAnswer::find()->joinWith('poll')->all() as $answer) {
if ($answer->poll === null) {
if ($integrityController->showFix("Deleting poll answer id " . $answer->id . " without existing poll!")) {
$answer->delete();
}
}
}
}
```

View File

@ -1,9 +1,9 @@
Settings
========
Settings and Configuration
============================
##Settings
Global Settings
---------------
### Global Settings
Example:
@ -14,8 +14,8 @@ Example:
User Settings
-------------
### User Settings
Example:
@ -26,8 +26,7 @@ Example:
Space Settings
--------------
### Space Settings
Example:
@ -35,3 +34,6 @@ Example:
$space->setSetting("someName", "someValue", "exampleModuleId");
$mySetting = $space->getSetting("someName", "exampleModuleId");
```
## Configuration
(TBD)