ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
ilCtrlExistingPath Class Reference

Class ilCtrlExistingPath. More...

+ Inheritance diagram for ilCtrlExistingPath:
+ Collaboration diagram for ilCtrlExistingPath:

Public Member Functions

 __construct (ilCtrlStructureInterface $structure, string $cid_path)
 ilCtrlExistingPath Constructor More...
 
- Public Member Functions inherited from ilCtrlAbstractPath
 __construct (ilCtrlStructureInterface $structure)
 ilCtrlAbstractPath Constructor More...
 
 getCidPath ()
 @inheritDoc More...
 
 getCurrentCid ()
 @inheritDoc More...
 
 getNextCid (string $current_class)
 @inheritDoc More...
 
 getCidPaths (int $order=SORT_DESC)
 @inheritDoc More...
 
 getCidArray (int $order=SORT_DESC)
 @inheritDoc More...
 
 getBaseClass ()
 @inheritDoc More...
 
 getException ()
 @inheritDoc More...
 
 getCidPath ()
 Returns the CID path for the target class of the current instance. More...
 
 getCurrentCid ()
 Returns the CID that must currently be processed. More...
 
 getNextCid (string $current_class)
 Returns the next CID that must be processed. More...
 
 getCidPaths (int $order=SORT_DESC)
 Returns all individual paths for each cid position for the given direction. More...
 
 getCidArray (int $order=SORT_DESC)
 Returns all cid's from the current path in the provided directory/order. More...
 
 getBaseClass ()
 Returns the baseclass of the current cid path. More...
 
 getException ()
 Returns the exception produced during the path-finding- process. More...
 

Protected Member Functions

 ensureValidCidPath ()
 Ensures each consecutive pair of CIDs must have a valid parent–child relationship. More...
 
- Protected Member Functions inherited from ilCtrlAbstractPath
 getPathToRelatedClassInContext (ilCtrlContextInterface $context, string $target_class)
 Returns the path to a class within the given contexts current path that has a relation to the given target. More...
 
 isClassChildOf (string $child_class, string $parent_class)
 Returns whether the given target class is a child of the other given class. More...
 
 isClassParentOf (string $parent_class, string $child_class)
 Returns whether the given target class is a parent of the other given class. More...
 
 appendCid (string $cid, ?string $path=null)
 Helper function to add CIDs to a given path. More...
 

Additional Inherited Members

- Data Fields inherited from ilCtrlPathInterface
const CID_PATH_SEPARATOR = '.'
 
- Protected Attributes inherited from ilCtrlAbstractPath
ilCtrlStructureInterface $structure
 
ilCtrlException $exception = null
 
string $cid_path = null
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilCtrlExistingPath::__construct ( ilCtrlStructureInterface  $structure,
string  $cid_path 
)

ilCtrlExistingPath Constructor

Parameters
ilCtrlStructureInterface$structure
string$cid_path

Definition at line 34 of file class.ilCtrlExistingPath.php.

35 {
37
38 $this->cid_path = $cid_path;
39 $this->ensureValidCidPath();
40 }
ilCtrlStructureInterface $structure
ensureValidCidPath()
Ensures each consecutive pair of CIDs must have a valid parent–child relationship.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References ilCtrlAbstractPath\$cid_path, ilCtrlAbstractPath\$structure, ILIAS\GlobalScreen\Provider\__construct(), and ensureValidCidPath().

+ Here is the call graph for this function:

Member Function Documentation

◆ ensureValidCidPath()

ilCtrlExistingPath::ensureValidCidPath ( )
protected

Ensures each consecutive pair of CIDs must have a valid parent–child relationship.

CID-paths with <= 1 CID are to be considered valid.

Definition at line 46 of file class.ilCtrlExistingPath.php.

46 : void
47 {
48 $cid_array = $this->getCidArray(SORT_ASC);
49 $cid_count = count($cid_array);
50 if ($cid_count <= 1) {
51 return;
52 }
53 for ($current = 0, $max = ($cid_count - 1); $current < $max; $current++) {
54 $parent_cid = $cid_array[$current];
55 $child_cid = $cid_array[$current + 1];
56 $child_class = $this->structure->getClassNameByCid($child_cid);
57 $allowed_children = $this->structure->getChildrenByCid($parent_cid) ?? [];
58 if (null === $child_class || !in_array($child_class, $allowed_children, true)) {
59 throw new RuntimeException('ilCtrl: invalid ' . ilCtrlInterface::PARAM_CID_PATH . ' parameter requested.');
60 }
61 }
62 }
getCidArray(int $order=SORT_DESC)
@inheritDoc

References ilCtrlAbstractPath\getCidArray(), and ilCtrlInterface\PARAM_CID_PATH.

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

The documentation for this class was generated from the following file: