Compare commits
2 Commits
7ecaa70768
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| bc4f849ff3 | |||
| a4b67569a4 |
@@ -41,6 +41,7 @@ abstract class BaseFrontPresenter extends UnsecuredPresenter
|
|||||||
|
|
||||||
protected function startup()
|
protected function startup()
|
||||||
{
|
{
|
||||||
|
|
||||||
$trs = $this->em->getRepository(Translation::class)->findBy([], ['id' => 'ASC', 'direction' => 'ASC']);
|
$trs = $this->em->getRepository(Translation::class)->findBy([], ['id' => 'ASC', 'direction' => 'ASC']);
|
||||||
$drs = $this->em->getRepository(Dictionary::class)->findPairs('id', 'name');
|
$drs = $this->em->getRepository(Dictionary::class)->findPairs('id', 'name');
|
||||||
$select = [];
|
$select = [];
|
||||||
@@ -52,12 +53,13 @@ abstract class BaseFrontPresenter extends UnsecuredPresenter
|
|||||||
$lang = mb_substr($lang1, 0, -1);
|
$lang = mb_substr($lang1, 0, -1);
|
||||||
$lang .= "o-" . $lang2;
|
$lang .= "o-" . $lang2;
|
||||||
$slug = Strings::webalize($lang);
|
$slug = Strings::webalize($lang);
|
||||||
$select[$drs[$t->getDictionary()->getId()]][$t->getId()] = $lang;
|
$select[$drs[$t->getDictionary()->id]][$t->id] = $lang;
|
||||||
$translations[$t->getId()]["slug"] = $slug;
|
$translations[$t->id]["slug"] = $slug;
|
||||||
$translations[$t->getId()]["lang"] = $lang;
|
$translations[$t->id]["lang"] = $lang;
|
||||||
$translations[$t->getId()]["t"] = $t;
|
$translations[$t->id]["t"] = $t;
|
||||||
$slugs[$slug] = $t;
|
$slugs[$slug] = $t;
|
||||||
}
|
}
|
||||||
|
$this->slug= $translations[1]["slug"];
|
||||||
$this->translations = $translations;
|
$this->translations = $translations;
|
||||||
$this->dictionaries = $drs;
|
$this->dictionaries = $drs;
|
||||||
$this->drsSelect = $select;
|
$this->drsSelect = $select;
|
||||||
|
|||||||
4
app/modules/Front/Home/@layout.latte
Normal file
4
app/modules/Front/Home/@layout.latte
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
{layout '../templates/@layout.latte'}
|
||||||
|
{block #content}
|
||||||
|
{block form}
|
||||||
|
{/block}
|
||||||
@@ -21,26 +21,6 @@ use App\Model\Database\Facade\TermFacade;
|
|||||||
final class HomePresenter extends BaseFrontPresenter
|
final class HomePresenter extends BaseFrontPresenter
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return AlesWita\Components\VisualPaginator
|
|
||||||
*/
|
|
||||||
protected function createComponentPaginator(): VisualPaginator
|
|
||||||
{
|
|
||||||
$paginator = $this->visualPaginatorFactory->create();
|
|
||||||
|
|
||||||
$paginator->ajax = false;
|
|
||||||
$paginator->canSetItemsPerPage = true;
|
|
||||||
$paginator->setItemsPerPage(100);
|
|
||||||
|
|
||||||
//$paginator->templateFile = __DIR__ . '/my_awesome_template.latte';
|
|
||||||
|
|
||||||
return $paginator;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function searchFormSucceededIpa(UI\Form $form, $values)
|
public function searchFormSucceededIpa(UI\Form $form, $values)
|
||||||
{
|
{
|
||||||
$translation = $values->translation;
|
$translation = $values->translation;
|
||||||
@@ -96,7 +76,6 @@ final class HomePresenter extends BaseFrontPresenter
|
|||||||
} else {
|
} else {
|
||||||
|
|
||||||
$id = $this['searchForm']['translation']->value;
|
$id = $this['searchForm']['translation']->value;
|
||||||
dump($id);
|
|
||||||
if (isset($this->translations[$id])) {
|
if (isset($this->translations[$id])) {
|
||||||
$t = $this->translations[$id];
|
$t = $this->translations[$id];
|
||||||
$this->redirect('Front:Home:select', $t["slug"], $this['searchForm']['string']->value);
|
$this->redirect('Front:Home:select', $t["slug"], $this['searchForm']['string']->value);
|
||||||
@@ -120,15 +99,8 @@ final class HomePresenter extends BaseFrontPresenter
|
|||||||
|
|
||||||
public function actionIpa()
|
public function actionIpa()
|
||||||
{
|
{
|
||||||
if ($this->getRequest()->isMethod('GET')) {
|
if ($this->term)
|
||||||
if ($this->term) {
|
$this->redirect('Search:ipa',$this->translation,$this->term);
|
||||||
$this['searchForm']['string']->setValue($this->term);
|
|
||||||
$result = $this->doSearch('TermsFullQuery', $this->slugs[$this->slug]->id, $this->term);
|
|
||||||
if ($result) $this->template->result = $result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$this['searchForm']->onSuccess[] = array($this, 'searchFormSucceededIpa');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function actionInteractive()
|
public function actionInteractive()
|
||||||
|
|||||||
@@ -1,104 +1 @@
|
|||||||
{block title}Slovnik{/block}
|
{block #content}
|
||||||
{block head}
|
|
||||||
<script>
|
|
||||||
$( document ).ready(function() {
|
|
||||||
$("img.ajax").on("click", function (event) {
|
|
||||||
event.preventDefault();
|
|
||||||
id = $(this).attr("data-sound-id");
|
|
||||||
var audioElement = document.createElement('audio');
|
|
||||||
audioElement.setAttribute('src', {link Home:play} + "/" + id);
|
|
||||||
console.log("Play sound:" + id);
|
|
||||||
audioElement.play();
|
|
||||||
});
|
|
||||||
|
|
||||||
$(function() {
|
|
||||||
var select_name = "string";
|
|
||||||
$("input[name=" + select_name + "]").autocomplete({
|
|
||||||
source: function( request, response ) {
|
|
||||||
$.ajax({
|
|
||||||
url: {!$presenter->link('autocomplete')},
|
|
||||||
data: {
|
|
||||||
whichData: select_name,
|
|
||||||
typedText: request.term,
|
|
||||||
translation: $("select[name=translation]").val()
|
|
||||||
},
|
|
||||||
success: function( data ) {
|
|
||||||
response( $.map( data, function( item ) {
|
|
||||||
return { label: item, value: item }
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
minLength: 3,
|
|
||||||
open: function() {
|
|
||||||
$(this).removeClass("ui-corner-all").addClass("ui-corner-top");
|
|
||||||
},
|
|
||||||
close: function() {
|
|
||||||
$(this).removeClass("ui-corner-top").addClass("ui-corner-all");
|
|
||||||
},
|
|
||||||
select: function(e, ui) {
|
|
||||||
$("#frm-searchForm-string").val(ui.item.value);
|
|
||||||
$("#frm-searchForm").submit();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
{/block}
|
|
||||||
|
|
||||||
{block content}
|
|
||||||
|
|
||||||
<div class="boxes">
|
|
||||||
{form searchForm}
|
|
||||||
<table>
|
|
||||||
<tr>
|
|
||||||
<th>{label string /}</th><th>{label translation /}</th>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>{input string}</td><td>{input translation}</td><td>{input search}</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
{ifset $result}
|
|
||||||
<table id="searchBox">
|
|
||||||
|
|
||||||
</table>
|
|
||||||
<table class="trans">
|
|
||||||
<tr>
|
|
||||||
<th>Preklad</th>
|
|
||||||
</tr>
|
|
||||||
{var $last = ''}
|
|
||||||
{foreach $result as $term}
|
|
||||||
{if ($last != $term->string1 && $last != '') }
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{/if}
|
|
||||||
{if $last != $term->string1}
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<span class="term">{$term->string1}</span>
|
|
||||||
{foreach $term->pronunciations as $pron}
|
|
||||||
<span class="ipa-{$pron->type->id}">[{$pron->ipa}]</span>
|
|
||||||
<img n:if="$pron->filename" class="sound-ipa ajax" src="/images/sound.png" alt="Prehraj" style="vertical-align: middle;" data-sound-id="{$pron->id}" ></image>
|
|
||||||
{/foreach}
|
|
||||||
<br/>
|
|
||||||
<div style="margin-left: 20px;" class="translations">
|
|
||||||
{/if}
|
|
||||||
{$last == $term->string1 && trim($last2) != '' && trim($term->string2) != '' ? ', ' : ''}{$term->string2}{**
|
|
||||||
Nutne kvoli newline
|
|
||||||
**}
|
|
||||||
{var $last = $term->string1}
|
|
||||||
{var $last2 = $term->string2}
|
|
||||||
{/foreach}
|
|
||||||
</table>
|
|
||||||
{/ifset}
|
|
||||||
{/form}
|
|
||||||
{control paginator}
|
|
||||||
</div>
|
|
||||||
{/block}
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,58 +1 @@
|
|||||||
{block title}Slovnik{/block}
|
{block #content}
|
||||||
{block head}
|
|
||||||
<script>
|
|
||||||
$( document ).ready(function() {
|
|
||||||
$("img.ajax").on("click", function (event) {
|
|
||||||
event.preventDefault();
|
|
||||||
id = $(this).attr("data-sound-id");
|
|
||||||
var audioElement = document.createElement('audio');
|
|
||||||
var link = {link Home:play 123456 };
|
|
||||||
audioElement.setAttribute('src', link.replace('123456',id));
|
|
||||||
console.log("Play sound:" + id);
|
|
||||||
audioElement.play();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
{/block}
|
|
||||||
|
|
||||||
|
|
||||||
{block content}
|
|
||||||
{block form}
|
|
||||||
|
|
||||||
{/block}
|
|
||||||
{ifset $result}
|
|
||||||
<table class="trans">
|
|
||||||
<tr>
|
|
||||||
<th>Preklad</th>
|
|
||||||
</tr>
|
|
||||||
{var $last = ''}
|
|
||||||
{foreach $result as $term}
|
|
||||||
{if ($last != $term->string1 && $last != '') }
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{/if}
|
|
||||||
{if $last != $term->string1}
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<span class="term">{$term->string1}</span>
|
|
||||||
{foreach $term->pronunciations as $pron}
|
|
||||||
<span class="ipa-{$pron->type->id}">[{$pron->ipa}]</span>
|
|
||||||
<img n:if="$pron->filename" class="sound-ipa ajax" src="/images/sound.png" alt="Prehraj" style="vertical-align: middle;" data-sound-id="{$pron->id}" ></image>
|
|
||||||
{/foreach}
|
|
||||||
<br/>
|
|
||||||
<div style="margin-left: 20px;" class="translations">
|
|
||||||
{/if}
|
|
||||||
{$last == $term->string1 && trim($last2) != '' && trim($term->string2) != '' ? ', ' : ''}{$term->string2}{**
|
|
||||||
Nutne kvoli newline
|
|
||||||
**}
|
|
||||||
{var $last = $term->string1}
|
|
||||||
{var $last2 = $term->string2}
|
|
||||||
{/foreach}
|
|
||||||
</table>
|
|
||||||
{/ifset}
|
|
||||||
{/form}
|
|
||||||
{control paginator}
|
|
||||||
</div>
|
|
||||||
{/block}
|
|
||||||
|
|
||||||
@@ -20,46 +20,65 @@ use App\Model\Database\Facade\TermFacade;
|
|||||||
|
|
||||||
class SearchPresenter extends BaseFrontPresenter
|
class SearchPresenter extends BaseFrontPresenter
|
||||||
{
|
{
|
||||||
/** @inject @var EntityManager */
|
|
||||||
public EntityManager $em;
|
|
||||||
/** @inject */
|
|
||||||
public TermFacade $termFacade;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** @persistent */
|
|
||||||
public $term;
|
|
||||||
|
|
||||||
protected function doSearch($query, $translation, $term, $clen = null, $paginate = true)
|
protected function doSearch($query, $translation, $term, $clen = null, $paginate = true)
|
||||||
{
|
{
|
||||||
$t = $this->em->getTranslationRepository()->find($translation);
|
$t = $this->em->getTranslationRepository()->find($translation);
|
||||||
|
|
||||||
if ($term) $this->term = $term;
|
if ($term) $this->term = $term;
|
||||||
if ($translation) $this->translation = $translation;
|
if ($translation) $this->translation = $translation;
|
||||||
// $this->slug = $this->translations[$translation]["slug"];
|
$this->slug = $this->translations[$translation]["slug"];
|
||||||
|
|
||||||
$this->termFacade->setDirection(1);
|
$this->termFacade->setDirection(1);
|
||||||
|
$q = $this->termFacade->findByString($term, $t->dictionary, $clen);
|
||||||
|
|
||||||
/* if ($paginate) {
|
if ($paginate) {
|
||||||
$this["paginator"]->setItemCount(500);
|
$paginator = new \Doctrine\ORM\Tools\Pagination\Paginator($q);
|
||||||
|
$count = count($paginator);
|
||||||
|
$this["paginator"]->setItemCount($count);
|
||||||
$offset = $this["paginator"]->getOffset();
|
$offset = $this["paginator"]->getOffset();
|
||||||
$itemsPerPage = $this['paginator']->getItemsPerPage();
|
$itemsPerPage = $this['paginator']->getItemsPerPage();
|
||||||
|
$q->setFirstResult($offset)->setMaxResults($itemsPerPage);
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
$q = $this->termFacade->findByString($term, $t->dictionary, $clen);
|
|
||||||
//$q->setMaxResults(500)->setFirstResult($offset)->getMaxResults($itemsPerPage);
|
|
||||||
|
|
||||||
$this->template->translation = $t;
|
$this->template->translation = $t;
|
||||||
|
|
||||||
return $q->getResult();
|
return $q->getResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function renderDefault($translation,$term,$clen,$paginate = false)
|
public function renderDefault($translation,$term,$clen = '',$paginate = true)
|
||||||
{
|
{
|
||||||
$this['searchForm']['string']->setValue($this->term);
|
$this['searchForm']['string']->setValue($this->term);
|
||||||
$this->template->result = $this->doSearch('TermQuery',$translation,$term,$clen,$paginate);
|
$this->template->result = $this->doSearch('TermQuery',$translation,$term,$clen,$paginate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function renderIpa($translation,$term,$clen='',$paginate=true)
|
||||||
|
{
|
||||||
|
$this['searchForm']['string']->setValue($this->term);
|
||||||
|
$result = $this->doSearch('TermsFullQuery', $this->slugs[$this->slug]->id, $this->term);
|
||||||
|
if ($result) $this->template->result = $result;
|
||||||
|
|
||||||
|
$this['searchForm']->onSuccess[] = array($this, 'searchFormSucceededIpa');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return AlesWita\Components\VisualPaginator
|
||||||
|
*/
|
||||||
|
protected function createComponentPaginator(): VisualPaginator
|
||||||
|
{
|
||||||
|
$paginator = $this->visualPaginatorFactory->create();
|
||||||
|
|
||||||
|
$paginator->ajax = false;
|
||||||
|
$paginator->canSetItemsPerPage = true;
|
||||||
|
$paginator->setItemsPerPage(20);
|
||||||
|
|
||||||
|
$paginator->templateFile = __DIR__.'/templates/bootstrap4.latte';
|
||||||
|
|
||||||
|
return $paginator;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
39
app/modules/Front/Search/templates/bootstrap4.latte
Normal file
39
app/modules/Front/Search/templates/bootstrap4.latte
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
{templateType AlesWita\VisualPaginator\Template}
|
||||||
|
|
||||||
|
{php $linkClass = $ajax ? 'page-link ajax' : 'page-link'}
|
||||||
|
|
||||||
|
<ul class="pagination">
|
||||||
|
<li n:class="$paginator->isFirst() ? 'page-item disabled' : 'page-item'">
|
||||||
|
<a n:href="paginate!, page => $paginator->page - 1" class="{$linkClass}">«</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
{foreach $steps as $step}
|
||||||
|
<li n:class="$step === $paginator->page ? 'page-item active' : 'page-item'">
|
||||||
|
<a n:href="paginate!, page => $step" class="{$linkClass}">{$step}</a>
|
||||||
|
</li>
|
||||||
|
{if $iterator->nextValue > $step + 1}
|
||||||
|
<li class="page-item disabled">
|
||||||
|
<span class="page-link">…</span>
|
||||||
|
</li>
|
||||||
|
{/if}
|
||||||
|
{/foreach}
|
||||||
|
|
||||||
|
<li n:class="$paginator->isLast() ? 'page-item disabled' : 'page-item'">
|
||||||
|
<a n:href="paginate!, page => $paginator->page + 1" class="{$linkClass}">»</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
{if $itemsPerPage}
|
||||||
|
{form itemsPerPage, class => $ajax ? 'form-inline ajax' : 'form-inline'}
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text" id="basic-addon1">{label itemsPerPage /}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{input itemsPerPage, class => "form-control"}
|
||||||
|
<div class="input-group-append">
|
||||||
|
{input send, class => "btn btn-outline-secondary"}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/form}
|
||||||
|
{/if}
|
||||||
@@ -56,7 +56,7 @@ $( document ).ready(function() {
|
|||||||
</tr>
|
</tr>
|
||||||
{/foreach}
|
{/foreach}
|
||||||
</table>
|
</table>
|
||||||
|
{control paginator}
|
||||||
{/ifset}
|
{/ifset}
|
||||||
</div>
|
</div>
|
||||||
{/block}
|
{/block}
|
||||||
|
|||||||
104
app/modules/Front/Search/templates/interactive.latte
Normal file
104
app/modules/Front/Search/templates/interactive.latte
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
{block title}Slovnik{/block}
|
||||||
|
{block head}
|
||||||
|
<script>
|
||||||
|
$( document ).ready(function() {
|
||||||
|
$("img.ajax").on("click", function (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
id = $(this).attr("data-sound-id");
|
||||||
|
var audioElement = document.createElement('audio');
|
||||||
|
audioElement.setAttribute('src', {link Home:play} + "/" + id);
|
||||||
|
console.log("Play sound:" + id);
|
||||||
|
audioElement.play();
|
||||||
|
});
|
||||||
|
|
||||||
|
$(function() {
|
||||||
|
var select_name = "string";
|
||||||
|
$("input[name=" + select_name + "]").autocomplete({
|
||||||
|
source: function( request, response ) {
|
||||||
|
$.ajax({
|
||||||
|
url: {!$presenter->link('autocomplete')},
|
||||||
|
data: {
|
||||||
|
whichData: select_name,
|
||||||
|
typedText: request.term,
|
||||||
|
translation: $("select[name=translation]").val()
|
||||||
|
},
|
||||||
|
success: function( data ) {
|
||||||
|
response( $.map( data, function( item ) {
|
||||||
|
return { label: item, value: item }
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
minLength: 3,
|
||||||
|
open: function() {
|
||||||
|
$(this).removeClass("ui-corner-all").addClass("ui-corner-top");
|
||||||
|
},
|
||||||
|
close: function() {
|
||||||
|
$(this).removeClass("ui-corner-top").addClass("ui-corner-all");
|
||||||
|
},
|
||||||
|
select: function(e, ui) {
|
||||||
|
$("#frm-searchForm-string").val(ui.item.value);
|
||||||
|
$("#frm-searchForm").submit();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
{/block}
|
||||||
|
|
||||||
|
{block content}
|
||||||
|
|
||||||
|
<div class="boxes">
|
||||||
|
{form searchForm}
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th>{label string /}</th><th>{label translation /}</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>{input string}</td><td>{input translation}</td><td>{input search}</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
{ifset $result}
|
||||||
|
<table id="searchBox">
|
||||||
|
|
||||||
|
</table>
|
||||||
|
<table class="trans">
|
||||||
|
<tr>
|
||||||
|
<th>Preklad</th>
|
||||||
|
</tr>
|
||||||
|
{var $last = ''}
|
||||||
|
{foreach $result as $term}
|
||||||
|
{if ($last != $term->string1 && $last != '') }
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{/if}
|
||||||
|
{if $last != $term->string1}
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<span class="term">{$term->string1}</span>
|
||||||
|
{foreach $term->pronunciations as $pron}
|
||||||
|
<span class="ipa-{$pron->type->id}">[{$pron->ipa}]</span>
|
||||||
|
<img n:if="$pron->filename" class="sound-ipa ajax" src="/images/sound.png" alt="Prehraj" style="vertical-align: middle;" data-sound-id="{$pron->id}" ></image>
|
||||||
|
{/foreach}
|
||||||
|
<br/>
|
||||||
|
<div style="margin-left: 20px;" class="translations">
|
||||||
|
{/if}
|
||||||
|
{$last == $term->string1 && trim($last2) != '' && trim($term->string2) != '' ? ', ' : ''}{$term->string2}{**
|
||||||
|
Nutne kvoli newline
|
||||||
|
**}
|
||||||
|
{var $last = $term->string1}
|
||||||
|
{var $last2 = $term->string2}
|
||||||
|
{/foreach}
|
||||||
|
</table>
|
||||||
|
{/ifset}
|
||||||
|
{/form}
|
||||||
|
{control paginator}
|
||||||
|
</div>
|
||||||
|
{/block}
|
||||||
|
|
||||||
|
|
||||||
54
app/modules/Front/Search/templates/ipa.latte
Normal file
54
app/modules/Front/Search/templates/ipa.latte
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
{block title}Slovnik{/block}
|
||||||
|
{block head}
|
||||||
|
<script>
|
||||||
|
$( document ).ready(function() {
|
||||||
|
$("img.ajax").on("click", function (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
id = $(this).attr("data-sound-id");
|
||||||
|
var audioElement = document.createElement('audio');
|
||||||
|
var link = {link Home:play 123456 };
|
||||||
|
audioElement.setAttribute('src', link.replace('123456',id));
|
||||||
|
console.log("Play sound:" + id);
|
||||||
|
audioElement.play();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
{/block}
|
||||||
|
|
||||||
|
|
||||||
|
{block content}
|
||||||
|
{ifset $result}
|
||||||
|
<table class="trans">
|
||||||
|
<tr>
|
||||||
|
<th>Preklad</th>
|
||||||
|
</tr>
|
||||||
|
{var $last = ''}
|
||||||
|
{foreach $result as $term}
|
||||||
|
{if ($last != $term->string1 && $last != '') }
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{/if}
|
||||||
|
{if $last != $term->string1}
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<span class="term">{$term->string1}</span>
|
||||||
|
{foreach $term->pronunciations as $pron}
|
||||||
|
<span class="ipa-{$pron->type->id}">[{$pron->ipa}]</span>
|
||||||
|
<img n:if="$pron->filename" class="sound-ipa ajax" src="/assets/images/sound.png" alt="Prehraj" style="vertical-align: middle;" data-sound-id="{$pron->id}" ></image>
|
||||||
|
{/foreach}
|
||||||
|
<br/>
|
||||||
|
<div style="margin-left: 20px;" class="translations">
|
||||||
|
{/if}
|
||||||
|
{$last == $term->string1 && trim($last2) != '' && trim($term->string2) != '' ? ', ' : ''}{$term->string2}{**
|
||||||
|
Nutne kvoli newline
|
||||||
|
**}
|
||||||
|
{var $last = $term->string1}
|
||||||
|
{var $last2 = $term->string2}
|
||||||
|
{/foreach}
|
||||||
|
</table>
|
||||||
|
{/ifset}
|
||||||
|
{control paginator}
|
||||||
|
</div>
|
||||||
|
{/block}
|
||||||
|
|
||||||
BIN
www/assets/images/images/sound.png
Normal file
BIN
www/assets/images/images/sound.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
BIN
www/assets/images/images/spinner.gif
Normal file
BIN
www/assets/images/images/spinner.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 737 B |
BIN
www/assets/images/images/sprites.png
Normal file
BIN
www/assets/images/images/sprites.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.7 KiB |
Reference in New Issue
Block a user