Display principal parts on public dictionary
This commit is contained in:
parent
e103420245
commit
8cc3b469f9
|
@ -186,6 +186,8 @@ export function renderWords() {
|
||||||
: originalWord.etymology.join(', '),
|
: originalWord.etymology.join(', '),
|
||||||
related: typeof originalWord.related === 'undefined' || originalWord.related.length < 1 ? null
|
related: typeof originalWord.related === 'undefined' || originalWord.related.length < 1 ? null
|
||||||
: originalWord.related.join(', '),
|
: originalWord.related.join(', '),
|
||||||
|
principalParts: typeof originalWord.principalParts === 'undefined' || originalWord.principalParts.length < 1 ? null
|
||||||
|
: originalWord.principalParts.join(', '),
|
||||||
wordId: originalWord.wordId,
|
wordId: originalWord.wordId,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -197,6 +199,7 @@ export function renderWords() {
|
||||||
wordsHTML += `<article class="entry" id="${word.wordId}">
|
wordsHTML += `<article class="entry" id="${word.wordId}">
|
||||||
<header>
|
<header>
|
||||||
<h4 class="word"><span class="orthographic-translation">${word.name}</span>${homonymnNumber > 0 ? ' <sub>' + homonymnNumber.toString() + '</sub>' : ''}</h4>
|
<h4 class="word"><span class="orthographic-translation">${word.name}</span>${homonymnNumber > 0 ? ' <sub>' + homonymnNumber.toString() + '</sub>' : ''}</h4>
|
||||||
|
${word.principalParts === null ? '' : `<span class="principalParts">(${word.principalParts})</span>`}
|
||||||
<span class="pronunciation">${word.pronunciation}</span>
|
<span class="pronunciation">${word.pronunciation}</span>
|
||||||
<span class="part-of-speech">${word.partOfSpeech}</span>
|
<span class="part-of-speech">${word.partOfSpeech}</span>
|
||||||
<a href="${shareLink}" target="_blank" class="small button word-option-button" title="Link to Word">➦</a>
|
<a href="${shareLink}" target="_blank" class="small button word-option-button" title="Link to Word">➦</a>
|
||||||
|
|
|
@ -107,6 +107,12 @@ class PublicDictionary {
|
||||||
}, explode(',', $row['related']));
|
}, explode(',', $row['related']));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!is_null($row['principal_parts'])) {
|
||||||
|
if (strlen($row['principal_parts']) > 0) {
|
||||||
|
$word['principalParts'] = explode(',', $row['principal_parts']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $word;
|
return $word;
|
||||||
}, $this->sortWords($words));
|
}, $this->sortWords($words));
|
||||||
|
@ -117,7 +123,7 @@ class PublicDictionary {
|
||||||
|
|
||||||
public function getSpecificPublicDictionaryWord ($dictionary, $word) {
|
public function getSpecificPublicDictionaryWord ($dictionary, $word) {
|
||||||
if (is_numeric($dictionary) && is_numeric($word)) {
|
if (is_numeric($dictionary) && is_numeric($word)) {
|
||||||
$query = "SELECT words.*, wa.etymology, wa.related FROM words
|
$query = "SELECT words.*, wa.etymology, wa.related, wa.principal_parts FROM words
|
||||||
LEFT JOIN words_advanced wa ON wa.dictionary = words.dictionary AND wa.word_id = words.word_id
|
LEFT JOIN words_advanced wa ON wa.dictionary = words.dictionary AND wa.word_id = words.word_id
|
||||||
JOIN dictionaries ON dictionaries.id = words.dictionary
|
JOIN dictionaries ON dictionaries.id = words.dictionary
|
||||||
WHERE words.dictionary=? AND words.word_id=? AND dictionaries.is_public=1";
|
WHERE words.dictionary=? AND words.word_id=? AND dictionaries.is_public=1";
|
||||||
|
@ -150,6 +156,12 @@ class PublicDictionary {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!is_null($result['principal_parts'])) {
|
||||||
|
if (strlen($result['principal_parts']) > 0) {
|
||||||
|
$word['principalParts'] = explode(',', $result['principal_parts']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $word;
|
return $word;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -158,7 +170,7 @@ class PublicDictionary {
|
||||||
|
|
||||||
private function getWordsAsEntered() {
|
private function getWordsAsEntered() {
|
||||||
if (!isset($this->original_words)) {
|
if (!isset($this->original_words)) {
|
||||||
$query = "SELECT words.*, wa.etymology, wa.related FROM words
|
$query = "SELECT words.*, wa.etymology, wa.related, wa.principal_parts FROM words
|
||||||
LEFT JOIN words_advanced wa ON wa.dictionary = words.dictionary AND wa.word_id = words.word_id
|
LEFT JOIN words_advanced wa ON wa.dictionary = words.dictionary AND wa.word_id = words.word_id
|
||||||
JOIN dictionaries ON dictionaries.id = words.dictionary
|
JOIN dictionaries ON dictionaries.id = words.dictionary
|
||||||
WHERE words.dictionary=? AND is_public=1";
|
WHERE words.dictionary=? AND is_public=1";
|
||||||
|
|
Loading…
Reference in New Issue