update 2023-07-22 06:43:38
This commit is contained in:
parent
fd5ed98921
commit
23415d4813
@ -17,8 +17,8 @@ class Tagged << (F,LightGreen) >> #Green {
|
||||
# Linker $linker
|
||||
+ __construct(Load $load, Insert $insert, ...)
|
||||
+ set(string $translation, int $book, ...) : ?array
|
||||
+ delete(string $tag) : bool
|
||||
- get(string $linker, string $translation, ...) : ?object
|
||||
+ delete(string $tag) : ?array
|
||||
- get(string $linker, int $book, ...) : ?object
|
||||
- create(string $linker, string $translation, ...) : bool
|
||||
}
|
||||
|
||||
@ -52,7 +52,7 @@ note right of Tagged::delete
|
||||
Delete a tagged verse
|
||||
|
||||
since: 2.0.1
|
||||
return: bool
|
||||
return: ?array
|
||||
end note
|
||||
|
||||
note right of Tagged::get
|
||||
@ -63,7 +63,6 @@ note right of Tagged::get
|
||||
|
||||
arguments:
|
||||
string $linker
|
||||
string $translation
|
||||
int $book
|
||||
int $chapter
|
||||
int $verse
|
||||
|
@ -62,10 +62,10 @@ final class Tagged
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param Load $load The load object.
|
||||
* @param Insert $insert The insert object.
|
||||
* @param Update $update The update object.
|
||||
* @param Linker $linker The linker object.
|
||||
* @param Load $load The load object.
|
||||
* @param Insert $insert The insert object.
|
||||
* @param Update $update The update object.
|
||||
* @param Linker $linker The linker object.
|
||||
*
|
||||
* @since 2.0.1
|
||||
*/
|
||||
@ -120,7 +120,7 @@ final class Tagged
|
||||
}
|
||||
|
||||
// get tag if it exist
|
||||
if (($_tag = $this->get($linker, $translation, $book, $chapter, $verse, $tag)) !== null)
|
||||
if (($_tag = $this->get($linker, $book, $chapter, $verse, $tag)) !== null)
|
||||
{
|
||||
// publish if not published
|
||||
if ($_tag->published != 1 && !$this->update->value(1, 'published', $_tag->id, 'id', 'tagged_verse'))
|
||||
@ -148,33 +148,42 @@ final class Tagged
|
||||
/**
|
||||
* Delete a tagged verse
|
||||
*
|
||||
* @param string $tag The tagged verse GUID value
|
||||
* @param string $tag The tagged verse GUID value
|
||||
*
|
||||
* @return bool True on success
|
||||
* @return array|null True on success
|
||||
* @since 2.0.1
|
||||
**/
|
||||
public function delete(string $tag): bool
|
||||
public function delete(
|
||||
string $tag
|
||||
): ?array
|
||||
{
|
||||
// make sure the linker has access
|
||||
if (($linker = $this->linker->get()) === null)
|
||||
{
|
||||
return false;
|
||||
return [
|
||||
'error' => Text::_('COM_GETBIBLE_YOU_DO_NOT_HAVE_ACCESS_TO_PERFORM_THIS_ACTION'),
|
||||
'access_required' => true
|
||||
];
|
||||
}
|
||||
|
||||
// make sure the linker has access to delete this tag
|
||||
if (($id = $this->load->value(['guid' => $tag, 'linker' => $linker], 'id', 'tagged_verse')) !== null && $id > 0)
|
||||
if (($id = $this->load->value(['linker' => $linker, 'guid' => $tag], 'id', 'tagged_verse')) !== null && $id > 0
|
||||
&& $this->update->value(-2, 'published', $id, 'id', 'tagged_verse'))
|
||||
{
|
||||
return $this->update->value(-2, 'published', $id, 'id', 'tagged_verse');
|
||||
return [
|
||||
'success' => Text::_('COM_GETBIBLE_THE_TAG_WAS_SUCCESSFULLY_REMOVED_FROM_THE_VERSE')
|
||||
];
|
||||
}
|
||||
|
||||
return false;
|
||||
return [
|
||||
'error' => Text::_('COM_GETBIBLE_THE_TAG_COULD_NOT_BE_REMOVED')
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a tagged verse
|
||||
*
|
||||
* @param string $linker The linker GUID value
|
||||
* @param string $translation The translation in which the note is made
|
||||
* @param int $book The book in which the note is made
|
||||
* @param int $chapter The chapter in which the note is made
|
||||
* @param int $verse The verse where the note is made
|
||||
@ -185,7 +194,6 @@ final class Tagged
|
||||
**/
|
||||
private function get(
|
||||
string $linker,
|
||||
string $translation,
|
||||
int $book,
|
||||
int $chapter,
|
||||
int $verse,
|
||||
@ -195,7 +203,6 @@ final class Tagged
|
||||
// get tag if it exist
|
||||
if (($_tag = $this->load->item([
|
||||
'linker' => $linker,
|
||||
'translation' => $translation,
|
||||
'book_nr' => $book,
|
||||
'chapter' => $chapter,
|
||||
'verse' => $verse,
|
||||
@ -241,7 +248,7 @@ final class Tagged
|
||||
'tag' => $tag,
|
||||
'access' => 0,
|
||||
'linker' => $linker,
|
||||
'translation' => $translation,
|
||||
'abbreviation' => $translation,
|
||||
'book_nr' => $book,
|
||||
'chapter' => $chapter,
|
||||
'verse' => $verse,
|
||||
|
@ -33,10 +33,10 @@
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param Load $load The load object.
|
||||
* @param Insert $insert The insert object.
|
||||
* @param Update $update The update object.
|
||||
* @param Linker $linker The linker object.
|
||||
* @param Load $load The load object.
|
||||
* @param Insert $insert The insert object.
|
||||
* @param Update $update The update object.
|
||||
* @param Linker $linker The linker object.
|
||||
*
|
||||
* @since 2.0.1
|
||||
*/
|
||||
@ -91,7 +91,7 @@
|
||||
}
|
||||
|
||||
// get tag if it exist
|
||||
if (($_tag = $this->get($linker, $translation, $book, $chapter, $verse, $tag)) !== null)
|
||||
if (($_tag = $this->get($linker, $book, $chapter, $verse, $tag)) !== null)
|
||||
{
|
||||
// publish if not published
|
||||
if ($_tag->published != 1 && !$this->update->value(1, 'published', $_tag->id, 'id', 'tagged_verse'))
|
||||
@ -119,33 +119,42 @@
|
||||
/**
|
||||
* Delete a tagged verse
|
||||
*
|
||||
* @param string $tag The tagged verse GUID value
|
||||
* @param string $tag The tagged verse GUID value
|
||||
*
|
||||
* @return bool True on success
|
||||
* @return array|null True on success
|
||||
* @since 2.0.1
|
||||
**/
|
||||
public function delete(string $tag): bool
|
||||
public function delete(
|
||||
string $tag
|
||||
): ?array
|
||||
{
|
||||
// make sure the linker has access
|
||||
if (($linker = $this->linker->get()) === null)
|
||||
{
|
||||
return false;
|
||||
return [
|
||||
'error' => Text::_('You do not have access to perform this action'),
|
||||
'access_required' => true
|
||||
];
|
||||
}
|
||||
|
||||
// make sure the linker has access to delete this tag
|
||||
if (($id = $this->load->value(['guid' => $tag, 'linker' => $linker], 'id', 'tagged_verse')) !== null && $id > 0)
|
||||
if (($id = $this->load->value(['linker' => $linker, 'guid' => $tag], 'id', 'tagged_verse')) !== null && $id > 0
|
||||
&& $this->update->value(-2, 'published', $id, 'id', 'tagged_verse'))
|
||||
{
|
||||
return $this->update->value(-2, 'published', $id, 'id', 'tagged_verse');
|
||||
return [
|
||||
'success' => Text::_('The tag was successfully removed from the verse.')
|
||||
];
|
||||
}
|
||||
|
||||
return false;
|
||||
return [
|
||||
'error' => Text::_('The tag could not be removed')
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a tagged verse
|
||||
*
|
||||
* @param string $linker The linker GUID value
|
||||
* @param string $translation The translation in which the note is made
|
||||
* @param int $book The book in which the note is made
|
||||
* @param int $chapter The chapter in which the note is made
|
||||
* @param int $verse The verse where the note is made
|
||||
@ -156,7 +165,6 @@
|
||||
**/
|
||||
private function get(
|
||||
string $linker,
|
||||
string $translation,
|
||||
int $book,
|
||||
int $chapter,
|
||||
int $verse,
|
||||
@ -166,7 +174,6 @@
|
||||
// get tag if it exist
|
||||
if (($_tag = $this->load->item([
|
||||
'linker' => $linker,
|
||||
'translation' => $translation,
|
||||
'book_nr' => $book,
|
||||
'chapter' => $chapter,
|
||||
'verse' => $verse,
|
||||
@ -212,7 +219,7 @@
|
||||
'tag' => $tag,
|
||||
'access' => 0,
|
||||
'linker' => $linker,
|
||||
'translation' => $translation,
|
||||
'abbreviation' => $translation,
|
||||
'book_nr' => $book,
|
||||
'chapter' => $chapter,
|
||||
'verse' => $verse,
|
||||
|
Loading…
x
Reference in New Issue
Block a user