Skip to content

Commit

Permalink
get ready for translations
Browse files Browse the repository at this point in the history
  • Loading branch information
Praesidiarius committed Jan 28, 2020
1 parent c05953e commit bcb33fa
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 16 deletions.
11 changes: 11 additions & 0 deletions docs/book/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,17 @@ Add them to ./public/vendor
| +-- filepond-plugin-image-preview.js
```

* [Summernote 0.8.15](https://github.com/summernote/summernote/releases)
> Texteditor
```
.
+-- summernote
| +-- summernote-bs4.min.js
| +-- summernote-bs4.min.css
| +-- lang
| +-- font
```

* [Select2 4.0.x](https://github.com/select2/select2/releases)
> For all Select und Multiselect Fields
```
Expand Down
11 changes: 5 additions & 6 deletions module/Application/src/Controller/CoreController.php
Original file line number Diff line number Diff line change
Expand Up @@ -483,13 +483,12 @@ protected function parseFormData(array $aRawData) {
foreach($aRawData[$sKey] as $iData) {
# If not numberic - its a new dataset
if(!is_numeric($iData)) {
# check if table connection already exists
if(!array_key_exists($oField->tbl_cached_name,CoreController::$aCoreTables)) {
CoreController::$aCoreTables[$oField->tbl_cached_name] = CoreController::$oServiceManager->get($oField->tbl_class);
}
$oTblEntity = CoreController::$oServiceManager->get($oField->tbl_class);
# check if addMinimal exists on TableModel
if(method_exists(CoreController::$aCoreTables[$oField->tbl_cached_name],'addMinimal')) {
$iNewEntryID = CoreController::$aCoreTables[$oField->tbl_cached_name]->addMinimal($iData,$this->sSingleForm,$oField->fieldkey);
if(method_exists($oTblEntity,'addMinimal')) {
echo 'tbl:'.$oField->tbl_cached_name;
$iNewEntryID = $oTblEntity->addMinimal($iData,$this->sSingleForm,$oField->fieldkey);
echo 'id:'.$iNewEntryID.'#';
# Save New Entry
$aNewData[] = $iNewEntryID;
}
Expand Down
2 changes: 2 additions & 0 deletions module/Application/view/layout/layout-default.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ use Application\Controller\CoreController;
<!-- Le styles -->
<?= $this->headLink(['rel' => 'shortcut icon', 'type' => 'image/vnd.microsoft.icon', 'href' => $this->basePath() . '/img/favicon.ico'])
->prependStylesheet($this->basePath('css/style.css'))
->prependStylesheet($this->basePath('vendor/summernote/summernote-bs4.min.css'))
->prependStylesheet($this->basePath('vendor/fontawesome/css/all.min.css'))
->prependStylesheet($this->basePath('vendor/filepond/filepond.css'))
->prependStylesheet($this->basePath('vendor/apexcharts/css/apexcharts.css'))
Expand All @@ -31,6 +32,7 @@ use Application\Controller\CoreController;
<?= $this->inlineScript()
->prependFile($this->basePath('js/plc-message.js'))
->prependFile($this->basePath('js/listener.js'))
->prependFile($this->basePath('vendor/summernote/summernote-bs4.min.js'))
->prependFile($this->basePath('vendor/apexcharts/apexcharts.min.js'))
->prependFile($this->basePath('vendor/jquery-ui/jquery-ui.min.js'))
->prependFile($this->basePath('vendor/select2/js/select2.full.min.js'))
Expand Down
6 changes: 3 additions & 3 deletions module/Application/view/partial/basicformfield.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ switch($oField->type) {
* Textarea
*/
case 'textarea': ?>
<textarea class="form-control" name="<?=$this->sFormName?>_<?=$oField->fieldkey?>"<?=$sExtraAttributes?> ><?=(isset($this->oItem)) ? $this->oItem->getTextField($oField->fieldkey) : ''?></textarea>
<textarea class="form-control plcnote" rows="10" name="<?=$this->sFormName?>_<?=$oField->fieldkey?>"<?=$sExtraAttributes?> ><?=(isset($this->oItem)) ? $this->oItem->getTextField($oField->fieldkey) : ''?></textarea>
<?php
break;
/**
Expand Down Expand Up @@ -106,7 +106,7 @@ switch($oField->type) {
<?php if($oField->allow_clear == 1) { ?>
allowClear: true,
<?php }?>
placeholder: '<?=$oField->label?>'
placeholder: '<?=$this->translate($oField->label)?>'
});
</script>
<?php
Expand Down Expand Up @@ -145,7 +145,7 @@ switch($oField->type) {
<?php if($oField->allow_clear == 1) { ?>
allowClear: true,
<?php }?>
placeholder: '<?=$oField->label?>'
placeholder: '<?=$this->translate($oField->label)?>'
});
<?php
# Add selected items to multiselect
Expand Down
9 changes: 8 additions & 1 deletion module/Application/view/partial/basicformfields.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ if(array_key_exists($this->sTab,$this->layout()->aFormFieldsByTab)) {
<div class="form-group <?=$oField->class?>">
<?php if($oField->type != 'partial') { ?>
<label class="plcViewFormLabel" for="<?=$this->sFormName?>_<?=$oField->fieldkey?>">
<?=$oField->label?>
<?=$this->translate($oField->label)?>
</label><br/>
<?php } ?>
<?= $this->partial('partial/basicformfield', ['sFormName'=>$this->sFormName,'oField'=>$oField,'oItem'=>$this->oItem]); ?>
Expand All @@ -18,3 +18,10 @@ if(array_key_exists($this->sTab,$this->layout()->aFormFieldsByTab)) {
}
}
?>
<script>
$(document).ready(function() {
$('.plcnote').summernote({
height: 150
});
});
</script>
2 changes: 1 addition & 1 deletion module/Application/view/partial/basictabs.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
foreach($this->layout()->aTabs as $oTab) { ?>
<li class="nav-item">
<a class="nav-link<?=($iTabCount == 1) ? ' active' : ''?>" id="<?=$oTab->Tab_ID?>-tab" data-toggle="tab" href="#<?=$oTab->Tab_ID?>" role="tab" aria-controls="<?=$oTab->Tab_ID?>" aria-selected="<?=($iTabCount == 1) ? 'true' : 'false'?>">
<i class="<?=$oTab->icon?>"></i> <?=$oTab->title?><br /><small><?=$oTab->subtitle?></small>
<i class="<?=$oTab->icon?>"></i> <?=$this->translate($oTab->title)?><br /><small><?=$this->translate($oTab->subtitle)?></small>
</a>
</li>
<?php
Expand Down
2 changes: 1 addition & 1 deletion module/Application/view/partial/breadcrumb.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ if(count($this->aButtons) > 0) {
$sFinalHref = str_replace(['##ID##'],[$iItemID],$oBtn->href); ?>

<a href="<?=$sFinalHref?>" title="<?=$oBtn->title?>" class="btn btn-<?=$oBtn->class?>">
<?=$oBtn->label?>
<?=$this->translate($oBtn->label)?>
</a>
<?php
}
Expand Down
2 changes: 1 addition & 1 deletion module/Application/view/partial/indextable.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/
foreach($this->layout()->aIndexColumns as $oCol) { ?>
<th id="<?=$this->sTableName?>_<?=$oCol->fieldkey?>" style="width:<?=$oCol->width?>;">
<?=$oCol->label?> <i class="fas fa-arrows-alt-h plc-index-table-column-sort" style="color:grey;"></i>
<?=$this->translate($oCol->label)?> <i class="fas fa-arrows-alt-h plc-index-table-column-sort" style="color:grey;"></i>
</th>
<?php } ?>
</tr>
Expand Down
4 changes: 2 additions & 2 deletions module/Application/view/partial/viewformfield.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ switch($oField->type) {
break;
case 'select':
if($this->oItem->getSelectFieldID($oField->fieldkey) != 0) {
echo $this->oItem->getSelectField($oField->fieldkey)->getLabel();
echo $this->translate($this->oItem->getSelectField($oField->fieldkey)->getLabel());
} else {
echo '-';
}
break;
case 'multiselect':
if(count($this->oItem->getMultiSelectFieldIDs($oField->fieldkey)) != 0) {
foreach($this->oItem->getMultiSelectField($oField->fieldkey) as $oItem) {
echo $oItem->text.', ';
echo $this->translate($oItem->text).', ';
}
} else {
echo '-';
Expand Down
2 changes: 1 addition & 1 deletion module/Application/view/partial/viewformfields.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ if(array_key_exists($this->sTab,$this->layout()->aFormFieldsByTab)) {
<div class="form-group <?=$oField->class?>">
<?php if($oField->type != 'partial' && $oField->type != 'gallery') { ?>
<label class="plcViewFormLabel" for="<?=$this->sFormName?>_<?=$oField->fieldkey?>">
<?=$oField->label?>
<?=$this->translate($oField->label)?>
</label><br/>
<?php } ?>
<?= $this->partial('partial/viewformfield', ['sFormName'=>$this->sFormName,'oField'=>$oField,'oItem'=>$this->oItem]); ?>
Expand Down

0 comments on commit bcb33fa

Please sign in to comment.