parent
b10d0904b2
commit
f4454b0494
@ -0,0 +1,19 @@ |
||||
<?php |
||||
|
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
class HookPortfolioCommentEdited extends HookEvent implements HookPortfolioCommentEditedEventInterface |
||||
{ |
||||
protected function __construct() |
||||
{ |
||||
parent::__construct('HookPortfolioCommentEdited'); |
||||
} |
||||
|
||||
public function notifyCommentEdited() |
||||
{ |
||||
/** @var HookPortfolioCommentEditedObserverInterface $observer */ |
||||
foreach ($this->observers as $observer) { |
||||
$observer->hookCommentEdited($this); |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,19 @@ |
||||
<?php |
||||
|
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
class HookPortfolioItemEdited extends HookEvent implements HookPortfolioItemEditedEventInterface |
||||
{ |
||||
protected function __construct() |
||||
{ |
||||
parent::__construct('HookPortfolioItemEdited'); |
||||
} |
||||
|
||||
public function notifyItemEdited() |
||||
{ |
||||
/** @var HookPortfolioItemEditedObserverInterface $observer */ |
||||
foreach ($this->observers as $observer) { |
||||
$observer->hookItemEdited($this); |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,8 @@ |
||||
<?php |
||||
|
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
interface HookPortfolioCommentEditedEventInterface extends HookEventInterface |
||||
{ |
||||
public function notifyCommentEdited(); |
||||
} |
||||
@ -0,0 +1,8 @@ |
||||
<?php |
||||
|
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
interface HookPortfolioCommentEditedObserverInterface extends HookObserverInterface |
||||
{ |
||||
public function hookCommentEdited(HookPortfolioCommentEditedEventInterface $hookEvent); |
||||
} |
||||
@ -0,0 +1,8 @@ |
||||
<?php |
||||
|
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
interface HookPortfolioItemEditedEventInterface extends HookEventInterface |
||||
{ |
||||
public function notifyItemEdited(); |
||||
} |
||||
@ -0,0 +1,8 @@ |
||||
<?php |
||||
|
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
interface HookPortfolioItemEditedObserverInterface extends HookObserverInterface |
||||
{ |
||||
public function hookItemEdited(HookPortfolioItemEditedEventInterface $hookEvent); |
||||
} |
||||
@ -0,0 +1,19 @@ |
||||
<?php |
||||
|
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
use Chamilo\CoreBundle\Entity\PortfolioComment; |
||||
use Chamilo\PluginBundle\XApi\ToolExperience\Statement\PortfolioCommentEdited; |
||||
|
||||
class XApiPortfolioCommentEditedHookObserver extends XApiActivityHookObserver implements HookPortfolioCommentEditedObserverInterface |
||||
{ |
||||
public function hookCommentEdited(HookPortfolioCommentEditedEventInterface $hookEvent) |
||||
{ |
||||
/** @var PortfolioComment $comment */ |
||||
$comment = $hookEvent->getEventData()['comment']; |
||||
|
||||
$statement = (new PortfolioCommentEdited($comment))->generate(); |
||||
|
||||
$this->saveSharedStatement($statement); |
||||
} |
||||
} |
||||
@ -0,0 +1,19 @@ |
||||
<?php |
||||
|
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
use Chamilo\CoreBundle\Entity\Portfolio; |
||||
use Chamilo\PluginBundle\XApi\ToolExperience\Statement\PortfolioItemEdited; |
||||
|
||||
class XApiPortfolioItemEditedHookObserver extends XApiActivityHookObserver implements HookPortfolioItemEditedObserverInterface |
||||
{ |
||||
public function hookItemEdited(HookPortfolioItemEditedEventInterface $hookEvent) |
||||
{ |
||||
/** @var Portfolio $item */ |
||||
$item = $hookEvent->getEventData()['item']; |
||||
|
||||
$statement = (new PortfolioItemEdited($item))->generate(); |
||||
|
||||
$this->saveSharedStatement($statement); |
||||
} |
||||
} |
||||
@ -0,0 +1,39 @@ |
||||
<?php |
||||
|
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\PluginBundle\XApi\ToolExperience\Statement; |
||||
|
||||
use Chamilo\PluginBundle\XApi\ToolExperience\Activity\PortfolioComment as PortfolioCommentActivity; |
||||
use Chamilo\PluginBundle\XApi\ToolExperience\Actor\User; |
||||
use Chamilo\PluginBundle\XApi\ToolExperience\Verb\Edited; |
||||
use Xabbuh\XApi\Model\Statement; |
||||
|
||||
class PortfolioCommentEdited extends PortfolioComment |
||||
{ |
||||
use PortfolioAttachmentsTrait; |
||||
|
||||
public function generate(): Statement |
||||
{ |
||||
$user = api_get_user_entity(api_get_user_id()); |
||||
|
||||
$actor = new User($user); |
||||
$verb = new Edited(); |
||||
$object = new PortfolioCommentActivity($this->comment); |
||||
$context = $this->generateContext(); |
||||
$attachements = $this->generateAttachmentsForComment($this->comment); |
||||
|
||||
return new Statement( |
||||
$this->generateStatementId('portfolio-comment'), |
||||
$actor->generate(), |
||||
$verb->generate(), |
||||
$object->generate(), |
||||
null, |
||||
null, |
||||
api_get_utc_datetime(null, false, true), |
||||
null, |
||||
$context, |
||||
$attachements |
||||
); |
||||
} |
||||
} |
||||
@ -0,0 +1,39 @@ |
||||
<?php |
||||
|
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\PluginBundle\XApi\ToolExperience\Statement; |
||||
|
||||
use Chamilo\PluginBundle\XApi\ToolExperience\Activity\PortfolioItem as PortfolioItemActivity; |
||||
use Chamilo\PluginBundle\XApi\ToolExperience\Actor\User; |
||||
use Chamilo\PluginBundle\XApi\ToolExperience\Verb\Edited; |
||||
use Xabbuh\XApi\Model\Statement; |
||||
|
||||
class PortfolioItemEdited extends PortfolioItem |
||||
{ |
||||
use PortfolioAttachmentsTrait; |
||||
|
||||
public function generate(): Statement |
||||
{ |
||||
$user = api_get_user_entity(api_get_user_id()); |
||||
|
||||
$actor = new User($user); |
||||
$verb = new Edited(); |
||||
$object = new PortfolioItemActivity($this->item); |
||||
$context = $this->generateContext(); |
||||
$attachements = $this->generateAttachmentsForItem($this->item); |
||||
|
||||
return new Statement( |
||||
$this->generateStatementId('portfolio-item'), |
||||
$actor->generate(), |
||||
$verb->generate(), |
||||
$object->generate(), |
||||
null, |
||||
null, |
||||
api_get_utc_datetime(null, false, true), |
||||
null, |
||||
$context, |
||||
$attachements |
||||
); |
||||
} |
||||
} |
||||
@ -0,0 +1,16 @@ |
||||
<?php |
||||
|
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\PluginBundle\XApi\ToolExperience\Verb; |
||||
|
||||
class Edited extends BaseVerb |
||||
{ |
||||
public function __construct() |
||||
{ |
||||
parent::__construct( |
||||
'http://curatr3.com/define/verb/edited', |
||||
'Edited' |
||||
); |
||||
} |
||||
} |
||||
Loading…
Reference in new issue