mirror of
https://github.com/humhub/humhub.git
synced 2025-02-24 03:06:04 +01:00
adding activities
This commit is contained in:
parent
3ee9cfb6e5
commit
dc9bbb163d
57
protected/humhub/modules/space/activities/SpaceArchieved.php
Normal file
57
protected/humhub/modules/space/activities/SpaceArchieved.php
Normal file
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @link https://www.humhub.org/
|
||||
* @copyright Copyright (c) 2017 HumHub GmbH & Co. KG
|
||||
* @license https://www.humhub.com/licences
|
||||
*/
|
||||
|
||||
namespace humhub\modules\space\activities;
|
||||
|
||||
use Yii;
|
||||
use humhub\modules\activity\components\BaseActivity;
|
||||
use humhub\modules\activity\interfaces\ConfigurableActivityInterface;
|
||||
|
||||
/**
|
||||
* Description of MemberAdded
|
||||
*
|
||||
* @author luke
|
||||
*/
|
||||
class SpaceArchieved extends BaseActivity implements ConfigurableActivityInterface
|
||||
{
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public $viewName = "spaceArchieved";
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public $moduleId = "space";
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
$this->visibility = \humhub\modules\content\models\Content::VISIBILITY_PRIVATE;
|
||||
parent::init();
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function getTitle()
|
||||
{
|
||||
return Yii::t('SpaceModule.activities', 'Space has been archieved');
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function getDescription()
|
||||
{
|
||||
return Yii::t('SpaceModule.activities', 'Whenever a space is archieved.');
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @link https://www.humhub.org/
|
||||
* @copyright Copyright (c) 2017 HumHub GmbH & Co. KG
|
||||
* @license https://www.humhub.com/licences
|
||||
*/
|
||||
|
||||
namespace humhub\modules\space\activities;
|
||||
|
||||
use Yii;
|
||||
use humhub\modules\activity\components\BaseActivity;
|
||||
use humhub\modules\activity\interfaces\ConfigurableActivityInterface;
|
||||
|
||||
/**
|
||||
* Description of MemberAdded
|
||||
*
|
||||
* @author luke
|
||||
*/
|
||||
class SpaceUnArchieved extends BaseActivity implements ConfigurableActivityInterface
|
||||
{
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public $viewName = "spaceUnArchieved";
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public $moduleId = "space";
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
$this->visibility = \humhub\modules\content\models\Content::VISIBILITY_PRIVATE;
|
||||
parent::init();
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function getTitle()
|
||||
{
|
||||
return Yii::t('SpaceModule.activities', 'Space has been unarchieved');
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function getDescription()
|
||||
{
|
||||
return Yii::t('SpaceModule.activities', 'Whenever a space is unarchieved.');
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use humhub\libs\Helpers;
|
||||
|
||||
echo Yii::t('ActivityModule.views_activities_ActivitySpaceMemberAdded', "%spaceName% has been archived", array(
|
||||
'%spaceName%' => '<strong>' . Html::encode(Helpers::truncateText($source->name, 40)) . '</strong>'
|
||||
));
|
||||
|
||||
?>
|
||||
<br/>
|
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use humhub\libs\Helpers;
|
||||
|
||||
echo Yii::t('ActivityModule.views_activities_ActivitySpaceMemberAdded', "%spaceName% has been archived", array(
|
||||
'%spaceName%' => '<strong>' . Html::encode(Helpers::truncateText($source->name, 40)) . '</strong>'
|
||||
));
|
||||
|
||||
?>
|
||||
<br/>
|
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use humhub\libs\Helpers;
|
||||
|
||||
echo Yii::t('ActivityModule.views_activities_ActivitySpaceMemberAdded', "%spaceName% has been archived", array(
|
||||
'%spaceName%' => '<strong>' . Html::encode(Helpers::truncateText($source->name, 40)) . '</strong>'
|
||||
));
|
||||
|
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use humhub\libs\Helpers;
|
||||
use humhub\modules\content\components\ContentContainerController;
|
||||
|
||||
echo Yii::t('ActivityModule.views_activities_ActivitySpaceMemberAdded', "%spaceName% has been unarchived", array(
|
||||
'%spaceName%' => '<strong>' . Html::encode(Helpers::truncateText($source->name, 40)) . '</strong>'
|
||||
));
|
||||
|
@ -16,6 +16,8 @@ use humhub\modules\space\widgets\Menu;
|
||||
use humhub\modules\space\widgets\Chooser;
|
||||
use humhub\modules\space\modules\manage\components\Controller;
|
||||
use humhub\modules\space\modules\manage\models\DeleteForm;
|
||||
use humhub\modules\space\activities\SpaceArchieved;
|
||||
use humhub\modules\space\activities\SpaceUnArchieved;
|
||||
|
||||
/**
|
||||
* Default space admin action
|
||||
@ -84,6 +86,9 @@ class DefaultController extends Controller
|
||||
$space = $this->getSpace();
|
||||
$space->archive();
|
||||
|
||||
// Create Activity
|
||||
SpaceArchieved::instance()->from($space)->about($space->owner)->save();
|
||||
|
||||
if (Yii::$app->request->isAjax) {
|
||||
Yii::$app->response->format = 'json';
|
||||
return [
|
||||
@ -103,6 +108,9 @@ class DefaultController extends Controller
|
||||
$space = $this->getSpace();
|
||||
$space->unarchive();
|
||||
|
||||
// Create Activity
|
||||
SpaceUnArchieved::instance()->from($space)->about($space->owner)->save();
|
||||
|
||||
if (Yii::$app->request->isAjax) {
|
||||
Yii::$app->response->format = 'json';
|
||||
return [
|
||||
|
Loading…
x
Reference in New Issue
Block a user