Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions components/ILIAS/Component/src/Activities/Activity.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@
namespace ILIAS\Component\Activities;

use ILIAS\Component\Dependencies\Name;
use ILIAS\UI\Component\Input\Control\Form\FormInput;
use ILIAS\Data\Result;
use ILIAS\Data\Text;
use ILIAS\Data\Description;
use ILIAS\UI\Component\Input\Container\Form\FormInput;
use ILIAS\UI\Component\Input\Factory as InputFactory;
use ILIAS\UI\Component\Input\Field\Factory as FieldFactory;

/**
* An Activity is an action on the domain layer action of a component.
Expand All @@ -46,7 +48,7 @@ public function getType(): ActivityType;

public function getDescription(): Text\SimpleDocumentMarkdown;

public function getInputDescription(): FormInput; // might better be ILIAS/UI/Input/Input, but we would need to promote many properties there before.
public function getInputDescription(FieldFactory $f): FormInput; // might better be ILIAS/UI/Input/Input, but we would need to promote many properties there before.

public function getOutputDescription(Description\Factory $f): Description\Description;

Expand Down Expand Up @@ -76,5 +78,5 @@ public function perform(mixed $parameters): mixed;
* is allowed to perform the action as requested and, if so, then attempts to
* performs it. Wraps the result and possible errors in the `Result` type.
*/
public function maybePerformAs(int $usr_id, array $raw_parameters): Result;
public function maybePerformAs(InputFactory $input_factory, int $usr_id, array $raw_parameters): Result;
}
60 changes: 60 additions & 0 deletions components/ILIAS/Component/src/Activities/ObjectActivity.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?php

/**
* This file is part of ILIAS, a powerful learning management system
* published by ILIAS open source e-Learning e.V.
*
* ILIAS is licensed with the GPL-3.0,
* see https://www.gnu.org/licenses/gpl-3.0.en.html
* You should have received a copy of said license along with the
* source code, too.
*
* If this is not the case or you just want to try ILIAS, you'll find
* us at:
* https://www.ilias.de
* https://github.com/ILIAS-eLearning
*
*********************************************************************/

declare(strict_types=1);

namespace ILIAS\Component\Activities;

use ILIAS\UI\Component\Input\Container\Form\FormInput;
use ILIAS\UI\Component\Input\Field\Factory as FieldFactory;
use ILIAS\UI\Component\Input\Input;

/**
* An Activity that refers to a certain object in the system. This also is a
* generic interface but a subset of inputs is fixed.
*
* This does not necessarily need to refer to an ilObject, but can also be used
* to refer to any objects internal to a given component, such as questions,
* memberships or certain results.
*/
interface ObjectActivity extends Activity
{
/**
* @inheritdoc
*
* For an ObjectActivity, this needs to return an input with one field named
* "id" that can accept a string value.
*/
public function getInputDescription(FieldFactory $f): FormInput;

/**
* Works just like `getInputDescription` but checks if that description
* matches the spec.
*
* @throws \LogicException if there is no "id" field in the Input.
*/
public function getCheckedInputDescription(FieldFactory $f): Input;

/**
* To allow consumers to build an understanding of internal object structure of
* a component, an ObjectActivity needs to tell a "type" of object it touches.
*
* The type should be a short alphanumeric string.
*/
public function getTargetType(): string;
}
4 changes: 3 additions & 1 deletion components/ILIAS/Component/src/Activities/Repository.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@

namespace ILIAS\Component\Activities;

use ILIAS\Data\Range;

interface Repository
{
/**
* Get all activities where the name matches the provided regexp.
*
* @param string $name_matcher as preg_match can understand
* @return Iterator<string, Activity> where keys are the name
* @return \Iterator<string, Activity> where keys are the name
*/
public function getActivitiesByName(string $name_matcher, ?ActivityType $type = null, ?Range $range = null): \Iterator;
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

namespace ILIAS\Component\Activities;

use ILIAS\Data\Range;

class StaticRepository implements Repository
{
protected array $activities = [];
Expand Down
12 changes: 7 additions & 5 deletions components/ILIAS/Setup/src/Activities/GetStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@

namespace ILIAS\Setup\Activities;

use ILIAS\Component\Dependencies\Name;
use ILIAS\UI\Component\Input\Control\Form\FormInput;
use ILIAS\Data\Result;
use ILIAS\Data\Text;
use ILIAS\Data\Description;
use ILIAS\UI\Component\Input\Container\Form\FormInput;
use ILIAS\UI\Component\Input\Factory as InputFactory;
use ILIAS\UI\Component\Input\Field\Factory as FieldFactory;

/**
* This is a stub...
Expand All @@ -34,11 +36,11 @@ public function getDescription(): Text\SimpleDocumentMarkdown
{
}

public function getInputDescription(): \ILIAS\UI\Component\Input\Control\Form\FormInput
public function getInputDescription(FieldFactory $f): FormInput
{
}

public function getOutputDescription(\ILIAS\Data\Description\Factory $f): \ILIAS\Data\Description\Description
public function getOutputDescription(Description\Factory $f): Description\Description
{
}

Expand All @@ -50,7 +52,7 @@ public function perform(mixed $parameters): mixed
{
}

public function maybePerformAs(int $usr_id, array $raw_parameters): Result
public function maybePerformAs(InputFactory $input_factory, int $usr_id, array $raw_parameters): Result
{
}
}
Loading