4
0

update 2023-07-27 10:22:24

This commit is contained in:
Robot 2023-07-27 10:22:24 +02:00
parent a89438dc3b
commit 0565e907db
Signed by: Robot
GPG Key ID: 14DECD44E7E1BB95
3 changed files with 141 additions and 3 deletions

View File

@ -20,9 +20,11 @@ class Linker << (F,LightGreen) >> #Green {
+ share() : bool + share() : bool
+ get() : ?string + get() : ?string
+ active(bool $setup = true) : ?string + active(bool $setup = true) : ?string
+ activeDetails(bool $setup = true) : ?array
+ valid(string $linker) : bool + valid(string $linker) : bool
+ trigger(string $linker) : bool + trigger(string $linker) : bool
+ set(string $linker) : bool + set(string $linker) : bool
+ setName(string $name) : ?array
+ access(string $linker, string $pass, ...) : ?array + access(string $linker, string $pass, ...) : ?array
- hasAccess(string $linker, string $pass) : bool - hasAccess(string $linker, string $pass) : bool
- getPassGuid(string $linker, string $pass) : ?string - getPassGuid(string $linker, string $pass) : ?string
@ -64,27 +66,41 @@ note left of Linker::active
return: ?string return: ?string
end note end note
note right of Linker::valid note right of Linker::activeDetails
Get active Linker details
since: 2.0.1
return: ?array
end note
note left of Linker::valid
Check if a Linker is valid active linker Check if a Linker is valid active linker
since: 2.0.1 since: 2.0.1
return: bool return: bool
end note end note
note left of Linker::trigger note right of Linker::trigger
The Share His Word Trigger The Share His Word Trigger
since: 2.0.1 since: 2.0.1
return: bool return: bool
end note end note
note right of Linker::set note left of Linker::set
Set Active Linker Set Active Linker
since: 2.0.1 since: 2.0.1
return: bool return: bool
end note end note
note right of Linker::setName
Set a linker name
since: 2.0.1
return: ?array
end note
note left of Linker::access note left of Linker::access
Set Access Set Access

View File

@ -149,6 +149,33 @@ final class Linker
return null; return null;
} }
/**
* Get active Linker details
*
* @param bool $setup The setup switch
*
* @return array|null Linker details
* @since 2.0.1
**/
public function activeDetails(bool $setup = true): ?array
{
if (($linker = $this->active($setup)) !== null)
{
// check if this is a valid linker (already set)
if (($name = $this->load->value(
['guid' => $linker, 'published' => 1],
'name', 'linker'
)) !== null)
{
return ['guid' => $linker, 'name' => $name, 'share' => $this->share()];
}
return ['guid' => $linker, 'name' => null, 'share' => $this->share()];
}
return null;
}
/** /**
* Check if a Linker is valid active linker * Check if a Linker is valid active linker
* *
@ -211,6 +238,40 @@ final class Linker
return true; return true;
} }
/**
* Set a linker name
*
* @param string $name The linker name
*
* @return array|null Array on success
* @since 2.0.1
**/
public function setName(string $name): ?array
{
// make sure the linker has access
if (($linker = $this->get()) === null)
{
return [
'error' => Text::_("COM_GETBIBLE_WITHOUT_SELECTING_THE_CORRECT_FAVOURITE_VERSE_YOU_CANT_PERFORM_THE_INITIAL_ACTION"),
'access_required' => true
];
}
// get details of the linker
if (!$this->update->value($name, 'name', $linker, 'guid', 'linker'))
{
return [
'error' => Text::_('COM_GETBIBLE_THE_NAME_COULD_NOT_BE_UPDATED')
];
}
return [
'guid' => $linker,
'name' => $name,
'success' => Text::_('COM_GETBIBLE_THE_NAME_HAS_BEEN_UPDATED')
];
}
/** /**
* Set Access * Set Access
* *

View File

@ -119,6 +119,33 @@
return null; return null;
} }
/**
* Get active Linker details
*
* @param bool $setup The setup switch
*
* @return array|null Linker details
* @since 2.0.1
**/
public function activeDetails(bool $setup = true): ?array
{
if (($linker = $this->active($setup)) !== null)
{
// check if this is a valid linker (already set)
if (($name = $this->load->value(
['guid' => $linker, 'published' => 1],
'name', 'linker'
)) !== null)
{
return ['guid' => $linker, 'name' => $name, 'share' => $this->share()];
}
return ['guid' => $linker, 'name' => null, 'share' => $this->share()];
}
return null;
}
/** /**
* Check if a Linker is valid active linker * Check if a Linker is valid active linker
* *
@ -181,6 +208,40 @@
return true; return true;
} }
/**
* Set a linker name
*
* @param string $name The linker name
*
* @return array|null Array on success
* @since 2.0.1
**/
public function setName(string $name): ?array
{
// make sure the linker has access
if (($linker = $this->get()) === null)
{
return [
'error' => Text::_("Without selecting the correct favourite verse, you can't perform the initial action."),
'access_required' => true
];
}
// get details of the linker
if (!$this->update->value($name, 'name', $linker, 'guid', 'linker'))
{
return [
'error' => Text::_('The name could not be updated.')
];
}
return [
'guid' => $linker,
'name' => $name,
'success' => Text::_('The name has been updated.')
];
}
/** /**
* Set Access * Set Access
* *