gh-60 language translation component added, basic implementation
This commit is contained in:
@ -11,7 +11,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.4.2
|
||||
@build 3rd April, 2017
|
||||
@build 5th April, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage ajax.php
|
||||
@ -1055,5 +1055,225 @@ class ComponentbuilderModelAjax extends JModelList
|
||||
return $field;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Used in language_translation
|
||||
protected $functionArray = array(
|
||||
'translation' => 'checkString',
|
||||
'language' => 'getLanguageName');
|
||||
|
||||
protected function checkString($header, $value)
|
||||
{
|
||||
return $value;
|
||||
}
|
||||
|
||||
protected function getLanguageName($header, $value)
|
||||
{
|
||||
if ($name = ComponentbuilderHelper::getVar($header, $value, 'langtag', 'name'))
|
||||
{
|
||||
return $name . ' (' . $value . ')';
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
protected function setAutoLangZero()
|
||||
{
|
||||
// set the headers
|
||||
$headers = array(
|
||||
'translation' => JText::_('COM_COMPONENTBUILDER_TRANSLATION'),
|
||||
'language' => JText::_('COM_COMPONENTBUILDER_LANGUAGE')
|
||||
);
|
||||
// loop the array
|
||||
foreach ($headers as $key => $lang)
|
||||
{
|
||||
$this->setLanguage($key,$lang);
|
||||
}
|
||||
}
|
||||
|
||||
protected $languageArray = array();
|
||||
|
||||
protected function setLanguage($key,$lang)
|
||||
{
|
||||
$this->languageArray[$key] = $lang;
|
||||
}
|
||||
|
||||
public function getLanguage()
|
||||
{
|
||||
// return the language string that were set
|
||||
return $this->languageArray;
|
||||
}
|
||||
|
||||
protected function autoLoader()
|
||||
{
|
||||
$functions = range(0,10);
|
||||
foreach ($functions as $function)
|
||||
{
|
||||
$function = 'setAutoLang'.ComponentbuilderHelper::safeString($function, 'f');
|
||||
if (method_exists($this, $function))
|
||||
{
|
||||
$this->{$function}();
|
||||
}
|
||||
}
|
||||
foreach ($functions as $function)
|
||||
{
|
||||
$function = 'setAutoFunc'.ComponentbuilderHelper::safeString($function, 'f');
|
||||
if (method_exists($this, $function))
|
||||
{
|
||||
$this->{$function}();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function getBuildTable($idName, $oject)
|
||||
{
|
||||
if (ComponentbuilderHelper::checkJson($oject) && ComponentbuilderHelper::checkString($idName))
|
||||
{
|
||||
$array = json_decode($oject, true);
|
||||
if (ComponentbuilderHelper::checkArray($array))
|
||||
{
|
||||
// make sure we run the autoloader to insure all is set
|
||||
$this->autoLoader();
|
||||
// set the target headers
|
||||
$targetHeaders = $this->getLanguage();
|
||||
// start table build
|
||||
$table = '<table id="table_'.$idName.'" class="uk-table" style="margin: 5px 0 20px;"><thead><tr>';
|
||||
$rows = array();
|
||||
foreach ($array as $header => $values)
|
||||
{
|
||||
if (ComponentbuilderHelper::checkArray($values))
|
||||
{
|
||||
$targetHeader = (isset($targetHeaders[$header])) ? $targetHeaders[$header] : ComponentbuilderHelper::safeString($header, 'W');
|
||||
$table .= '<th style="padding: 10px; text-align: center; border: 1px solid rgb(221, 221, 221);" scope="col">'.$targetHeader.'</th>';
|
||||
|
||||
foreach ($values as $nr => $value)
|
||||
{
|
||||
// set the value for the row
|
||||
$this->setRows($nr, $this->setValue($header, $value), $rows);
|
||||
}
|
||||
}
|
||||
}
|
||||
// close header start body
|
||||
$table .= '</tr></thead><tbody>';
|
||||
// add rows to table
|
||||
if (ComponentbuilderHelper::checkArray($rows))
|
||||
{
|
||||
foreach ($rows as $row)
|
||||
{
|
||||
$table .= '<tr>'.$row.'</tr>';
|
||||
}
|
||||
}
|
||||
// close the body and table
|
||||
$table .= '</tbody></table>';
|
||||
// return the table
|
||||
return $table;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected function setValue($header, $value)
|
||||
{
|
||||
if (array_key_exists($header, $this->functionArray) && method_exists($this, $this->functionArray[$header]))
|
||||
{
|
||||
$value = $this->{$this->functionArray[$header]}($header, $value);
|
||||
}
|
||||
// if no value are set
|
||||
if (!ComponentbuilderHelper::checkString($value))
|
||||
{
|
||||
$value = '-';
|
||||
}
|
||||
// make total stand out
|
||||
if ('total' == $header)
|
||||
{
|
||||
$value = '<b>'.$value.'</b>';
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
protected function setRows($nr, $value, &$rows)
|
||||
{
|
||||
// build rows
|
||||
if (!isset($rows[$nr]))
|
||||
{
|
||||
$rows[$nr] = '<td style="padding: 10px; text-align: center; border: 1px solid rgb(221, 221, 221);">'.$value.'</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$rows[$nr] .= '<td style="padding: 10px; text-align: center; border: 1px solid rgb(221, 221, 221);">'.$value.'</td>';
|
||||
}
|
||||
}
|
||||
|
||||
protected $viewid = array();
|
||||
|
||||
protected function getViewID($call = 'table')
|
||||
{
|
||||
if (!isset($this->viewid[$call]))
|
||||
{
|
||||
// get the vdm key
|
||||
$jinput = JFactory::getApplication()->input;
|
||||
$vdm = $jinput->get('vdm', null, 'WORD');
|
||||
if ($vdm)
|
||||
{
|
||||
if ($view = ComponentbuilderHelper::get($vdm))
|
||||
{
|
||||
$current = (array) explode('__', $view);
|
||||
if (ComponentbuilderHelper::checkString($current[0]) && isset($current[1]) && is_numeric($current[1]))
|
||||
{
|
||||
// get the view name & id
|
||||
$this->viewid[$call] = array(
|
||||
'a_id' => (int) $current[1],
|
||||
'a_view' => $current[0]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isset($this->viewid[$call]))
|
||||
{
|
||||
return $this->viewid[$call];
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected $buttonArray = array(
|
||||
'language' => true);
|
||||
|
||||
public function getButton($type)
|
||||
{
|
||||
if (isset($this->buttonArray[$type]))
|
||||
{
|
||||
$user = JFactory::getUser();
|
||||
// only add if user allowed to create
|
||||
if ($user->authorise($type.'.create', 'com_componentbuilder'))
|
||||
{
|
||||
// get the input from url
|
||||
$jinput = JFactory::getApplication()->input;
|
||||
// get the view name & id
|
||||
$values = $this->getViewID();
|
||||
// check if new item
|
||||
$ref = '';
|
||||
if (!is_null($values['a_id']) && $values['a_id'] > 0 && strlen($values['a_view']))
|
||||
{
|
||||
// only load referal if not new item.
|
||||
$ref = '&ref=' . $values['a_view'] . '&refid=' . $values['a_id'];
|
||||
}
|
||||
// build the button
|
||||
$button = '<div class="control-group">
|
||||
<div class="control-label">
|
||||
<label>' . ucwords($type) . '</label>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<a class="btn btn-success vdm-button-new" onclick="UIkit.modal.confirm(\''.JText::_('COM_COMPONENTBUILDER_ALL_UNSAVED_WORK_WILL_BE_LOST_ARE_YOU_SURE_YOU_WANT_TO_CONTINUE').'\', function(){ window.location.href = \'index.php?option=com_componentbuilder&view='.$type.'&layout=edit'.$ref.'\' })" href="javascript:void(0)" >
|
||||
<span class="icon-new icon-white"></span>
|
||||
' . JText::_('COM_COMPONENTBUILDER_NEW') . '
|
||||
</a>
|
||||
</div>
|
||||
</div>';
|
||||
// return the button attached to input field
|
||||
return $button;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.4.2
|
||||
@build 3rd April, 2017
|
||||
@build 5th April, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage componentbuilder.php
|
||||
@ -43,7 +43,7 @@ class ComponentbuilderModelComponentbuilder extends JModelList
|
||||
$icons = array();
|
||||
// view groups array
|
||||
$viewGroups = array(
|
||||
'main' => array('png.compiler', 'png.joomla_component.add', 'png.joomla_components', 'png.admin_view.add', 'png.admin_views', 'png.custom_admin_view.add', 'png.custom_admin_views', 'png.site_view.add', 'png.site_views', 'png.template.add', 'png.templates', 'png.layout.add', 'png.layouts', 'png.dynamic_get.add', 'png.dynamic_gets', 'png.custom_codes', 'png.snippet.add', 'png.snippets', 'png.field.add', 'png.fields', 'png.fields.catid', 'png.fieldtype.add', 'png.fieldtypes', 'png.fieldtypes.catid', 'png.language_placeholder.add', 'png.language_placeholders', 'png.help_document.add', 'png.help_documents')
|
||||
'main' => array('png.compiler', 'png.joomla_component.add', 'png.joomla_components', 'png.admin_view.add', 'png.admin_views', 'png.custom_admin_view.add', 'png.custom_admin_views', 'png.site_view.add', 'png.site_views', 'png.template.add', 'png.templates', 'png.layout.add', 'png.layouts', 'png.dynamic_get.add', 'png.dynamic_gets', 'png.custom_codes', 'png.snippet.add', 'png.snippets', 'png.field.add', 'png.fields', 'png.fields.catid', 'png.fieldtype.add', 'png.fieldtypes', 'png.fieldtypes.catid', 'png.language_translations', 'png.help_document.add', 'png.help_documents')
|
||||
);
|
||||
// view access array
|
||||
$viewAccess = array(
|
||||
@ -107,12 +107,11 @@ class ComponentbuilderModelComponentbuilder extends JModelList
|
||||
'fieldtypes.submenu' => 'fieldtype.submenu',
|
||||
'fieldtypes.dashboard_list' => 'fieldtype.dashboard_list',
|
||||
'fieldtype.dashboard_add' => 'fieldtype.dashboard_add',
|
||||
'language_placeholder.create' => 'language_placeholder.create',
|
||||
'language_placeholders.access' => 'language_placeholder.access',
|
||||
'language_placeholder.access' => 'language_placeholder.access',
|
||||
'language_placeholders.submenu' => 'language_placeholder.submenu',
|
||||
'language_placeholders.dashboard_list' => 'language_placeholder.dashboard_list',
|
||||
'language_placeholder.dashboard_add' => 'language_placeholder.dashboard_add',
|
||||
'language_translation.create' => 'language_translation.create',
|
||||
'language_translations.access' => 'language_translation.access',
|
||||
'language_translation.access' => 'language_translation.access',
|
||||
'language_translations.submenu' => 'language_translation.submenu',
|
||||
'language_translations.dashboard_list' => 'language_translation.dashboard_list',
|
||||
'language.create' => 'language.create',
|
||||
'languages.access' => 'language.access',
|
||||
'language.access' => 'language.access',
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 81 of this MVC
|
||||
@build 1st March, 2017
|
||||
@version @update number 82 of this MVC
|
||||
@build 3rd April, 2017
|
||||
@created 11th October, 2016
|
||||
@package Component Builder
|
||||
@subpackage custom_code.php
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 81 of this MVC
|
||||
@build 1st March, 2017
|
||||
@version @update number 82 of this MVC
|
||||
@build 3rd April, 2017
|
||||
@created 11th October, 2016
|
||||
@package Component Builder
|
||||
@subpackage custom_codes.php
|
||||
@ -280,7 +280,7 @@ class ComponentbuilderModelCustom_codes extends JModelList
|
||||
else
|
||||
{
|
||||
$search = $db->quote('%' . $db->escape($search) . '%');
|
||||
$query->where('(a.component LIKE '.$search.' OR g.system_name LIKE '.$search.' OR a.path LIKE '.$search.' OR a.comment_type LIKE '.$search.' OR a.system_name LIKE '.$search.' OR a.function_name LIKE '.$search.')');
|
||||
$query->where('(a.component LIKE '.$search.' OR g.system_name LIKE '.$search.' OR a.path LIKE '.$search.' OR a.comment_type LIKE '.$search.' OR a.function_name LIKE '.$search.' OR a.system_name LIKE '.$search.')');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.4.2
|
||||
@build 3rd April, 2017
|
||||
@build 5th April, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage adminviewfolderlist.php
|
||||
|
@ -11,7 +11,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.4.2
|
||||
@build 3rd April, 2017
|
||||
@build 5th April, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage adminviews.php
|
||||
|
@ -11,7 +11,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.4.2
|
||||
@build 3rd April, 2017
|
||||
@build 5th April, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage articles.php
|
||||
|
@ -11,7 +11,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.4.2
|
||||
@build 3rd April, 2017
|
||||
@build 5th April, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage component.php
|
||||
|
@ -11,7 +11,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.4.2
|
||||
@build 3rd April, 2017
|
||||
@build 5th April, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage components.php
|
||||
|
@ -11,7 +11,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.4.2
|
||||
@build 3rd April, 2017
|
||||
@build 5th April, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage customadminviews.php
|
||||
|
@ -11,7 +11,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.4.2
|
||||
@build 3rd April, 2017
|
||||
@build 5th April, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage customfilelist.php
|
||||
|
@ -11,7 +11,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.4.2
|
||||
@build 3rd April, 2017
|
||||
@build 5th April, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage customfolderlist.php
|
||||
|
@ -11,7 +11,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.4.2
|
||||
@build 3rd April, 2017
|
||||
@build 5th April, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage customgets.php
|
||||
|
@ -11,7 +11,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.4.2
|
||||
@build 3rd April, 2017
|
||||
@build 5th April, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage dbtables.php
|
||||
|
@ -11,7 +11,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.4.2
|
||||
@build 3rd April, 2017
|
||||
@build 5th April, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage dynamicget.php
|
||||
|
@ -11,7 +11,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.4.2
|
||||
@build 3rd April, 2017
|
||||
@build 5th April, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage dynamicgets.php
|
||||
|
@ -11,7 +11,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.4.2
|
||||
@build 3rd April, 2017
|
||||
@build 5th April, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage fields.php
|
||||
|
@ -11,7 +11,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.4.2
|
||||
@build 3rd April, 2017
|
||||
@build 5th April, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage fieldsmulti.php
|
||||
|
@ -11,7 +11,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.4.2
|
||||
@build 3rd April, 2017
|
||||
@build 5th April, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage fieldtypes.php
|
||||
|
171
admin/models/fields/lang.php
Normal file
171
admin/models/fields/lang.php
Normal file
@ -0,0 +1,171 @@
|
||||
<?php
|
||||
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
|
||||
__ __ _ _____ _ _ __ __ _ _ _
|
||||
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
|
||||
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
|
||||
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
|
||||
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
|
||||
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
|
||||
| |
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.4.2
|
||||
@build 5th April, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage lang.php
|
||||
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
Builds Complex Joomla Components
|
||||
|
||||
/-----------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// import the list field type
|
||||
jimport('joomla.form.helper');
|
||||
JFormHelper::loadFieldClass('list');
|
||||
|
||||
/**
|
||||
* Lang Form Field class for the Componentbuilder component
|
||||
*/
|
||||
class JFormFieldLang extends JFormFieldList
|
||||
{
|
||||
/**
|
||||
* The lang field type.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'lang';
|
||||
/**
|
||||
* Override to add new button
|
||||
*
|
||||
* @return string The field input markup.
|
||||
*
|
||||
* @since 3.2
|
||||
*/
|
||||
protected function getInput()
|
||||
{
|
||||
// see if we should add buttons
|
||||
$setButton = $this->getAttribute('button');
|
||||
// get html
|
||||
$html = parent::getInput();
|
||||
// if true set button
|
||||
if ($setButton === 'true')
|
||||
{
|
||||
$button = array();
|
||||
$script = array();
|
||||
$buttonName = $this->getAttribute('name');
|
||||
// get the input from url
|
||||
$app = JFactory::getApplication();
|
||||
$jinput = $app->input;
|
||||
// get the view name & id
|
||||
$values = $jinput->getArray(array(
|
||||
'id' => 'int',
|
||||
'view' => 'word'
|
||||
));
|
||||
// check if new item
|
||||
$ref = '';
|
||||
$refJ = '';
|
||||
if (!is_null($values['id']) && strlen($values['view']))
|
||||
{
|
||||
// only load referal if not new item.
|
||||
$ref = '&ref=' . $values['view'] . '&refid=' . $values['id'];
|
||||
$refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
|
||||
}
|
||||
$user = JFactory::getUser();
|
||||
// only add if user allowed to create language
|
||||
if ($user->authorise('language.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
{
|
||||
// build Create button
|
||||
$buttonNamee = trim($buttonName);
|
||||
$buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
|
||||
$buttonNamee = ucfirst(strtolower($buttonNamee));
|
||||
$button[] = '<a id="'.$buttonName.'Create" class="btn btn-small btn-success hasTooltip" title="'.JText::sprintf('COM_COMPONENTBUILDER_CREATE_NEW_S', $buttonNamee).'" style="border-radius: 0px 4px 4px 0px; padding: 4px 4px 4px 7px;"
|
||||
href="index.php?option=com_componentbuilder&view=language&layout=edit'.$ref.'" >
|
||||
<span class="icon-new icon-white"></span></a>';
|
||||
}
|
||||
// only add if user allowed to edit language
|
||||
if (($buttonName === 'language' || $buttonName === 'languages') && $user->authorise('language.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
{
|
||||
// build edit button
|
||||
$buttonNamee = trim($buttonName);
|
||||
$buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
|
||||
$buttonNamee = ucfirst(strtolower($buttonNamee));
|
||||
$button[] = '<a id="'.$buttonName.'Edit" class="btn btn-small hasTooltip" title="'.JText::sprintf('COM_COMPONENTBUILDER_EDIT_S', $buttonNamee).'" style="display: none; padding: 4px 4px 4px 7px;" href="#" >
|
||||
<span class="icon-edit"></span></a>';
|
||||
// build script
|
||||
$script[] = "
|
||||
jQuery(document).ready(function() {
|
||||
jQuery('#adminForm').on('change', '#jform_".$buttonName."',function (e) {
|
||||
e.preventDefault();
|
||||
var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
|
||||
".$buttonName."Button(".$buttonName."Value);
|
||||
});
|
||||
var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
|
||||
".$buttonName."Button(".$buttonName."Value);
|
||||
});
|
||||
function ".$buttonName."Button(value) {
|
||||
if (value > 0) {
|
||||
// hide the create button
|
||||
jQuery('#".$buttonName."Create').hide();
|
||||
// show edit button
|
||||
jQuery('#".$buttonName."Edit').show();
|
||||
var url = 'index.php?option=com_componentbuilder&view=languages&task=language.edit&id='+value+'".$refJ."';
|
||||
jQuery('#".$buttonName."Edit').attr('href', url);
|
||||
} else {
|
||||
// show the create button
|
||||
jQuery('#".$buttonName."Create').show();
|
||||
// hide edit button
|
||||
jQuery('#".$buttonName."Edit').hide();
|
||||
}
|
||||
}";
|
||||
}
|
||||
// check if button was created for language field.
|
||||
if (is_array($button) && count($button) > 0)
|
||||
{
|
||||
// Load the needed script.
|
||||
$document = JFactory::getDocument();
|
||||
$document->addScriptDeclaration(implode(' ',$script));
|
||||
// return the button attached to input field.
|
||||
return '<div class="input-append">' .$html . implode('',$button).'</div>';
|
||||
}
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get a list of options for a list input.
|
||||
*
|
||||
* @return array An array of JHtml options.
|
||||
*/
|
||||
public function getOptions()
|
||||
{
|
||||
$db = JFactory::getDBO();
|
||||
$query = $db->getQuery(true);
|
||||
$query->select($db->quoteName(array('a.langtag','a.name'),array('langtag','language_name')));
|
||||
$query->from($db->quoteName('#__componentbuilder_language', 'a'));
|
||||
$query->where($db->quoteName('a.published') . ' >= 1');
|
||||
$query->order('a.langtag ASC');
|
||||
$db->setQuery((string)$query);
|
||||
$items = $db->loadObjectList();
|
||||
$options = array();
|
||||
if ($items)
|
||||
{
|
||||
$options[] = JHtml::_('select.option', '', 'Select an option');
|
||||
foreach($items as $item)
|
||||
{
|
||||
$options[] = JHtml::_('select.option', $item->langtag, $item->language_name . ' (' .$item->langtag.')');
|
||||
}
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
}
|
@ -11,7 +11,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.4.2
|
||||
@build 3rd April, 2017
|
||||
@build 5th April, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage maingets.php
|
||||
|
@ -11,7 +11,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.4.2
|
||||
@build 3rd April, 2017
|
||||
@build 5th April, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage siteviewfolderlist.php
|
||||
|
@ -11,7 +11,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.4.2
|
||||
@build 3rd April, 2017
|
||||
@build 5th April, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage siteviews.php
|
||||
|
@ -11,7 +11,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.4.2
|
||||
@build 3rd April, 2017
|
||||
@build 5th April, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage snippets.php
|
||||
|
@ -9,8 +9,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 81 of this MVC
|
||||
@build 1st March, 2017
|
||||
@version @update number 82 of this MVC
|
||||
@build 3rd April, 2017
|
||||
@created 11th October, 2016
|
||||
@package Component Builder
|
||||
@subpackage custom_code.js
|
||||
|
@ -159,43 +159,33 @@
|
||||
<option value="2">
|
||||
COM_COMPONENTBUILDER_CUSTOM_CODE_HTML</option>
|
||||
</field>
|
||||
<!-- System_name Field. Type: Text. (joomla) -->
|
||||
<!-- Hashtarget Field. Type: Text. (joomla) -->
|
||||
<field
|
||||
type="text"
|
||||
name="system_name"
|
||||
label="COM_COMPONENTBUILDER_CUSTOM_CODE_SYSTEM_NAME_LABEL"
|
||||
size="10"
|
||||
maxlength="50"
|
||||
description="COM_COMPONENTBUILDER_CUSTOM_CODE_SYSTEM_NAME_DESCRIPTION"
|
||||
name="hashtarget"
|
||||
label="COM_COMPONENTBUILDER_CUSTOM_CODE_HASHTARGET_LABEL"
|
||||
size="50"
|
||||
maxlength="150"
|
||||
description="COM_COMPONENTBUILDER_CUSTOM_CODE_HASHTARGET_DESCRIPTION"
|
||||
class="text_area"
|
||||
readonly="true"
|
||||
filter="STRING"
|
||||
message="Error! Please add some text here."
|
||||
hint="COM_COMPONENTBUILDER_CUSTOM_CODE_SYSTEM_NAME_HINT"
|
||||
hint="COM_COMPONENTBUILDER_CUSTOM_CODE_HASHTARGET_HINT"
|
||||
/>
|
||||
<!-- Function_name Field. Type: Text. (joomla) -->
|
||||
<!-- Code Field. Type: Textarea. (joomla) -->
|
||||
<field
|
||||
type="text"
|
||||
name="function_name"
|
||||
label="COM_COMPONENTBUILDER_CUSTOM_CODE_FUNCTION_NAME_LABEL"
|
||||
size="40"
|
||||
description="COM_COMPONENTBUILDER_CUSTOM_CODE_FUNCTION_NAME_DESCRIPTION"
|
||||
class="input-large-text"
|
||||
type="textarea"
|
||||
name="code"
|
||||
label="COM_COMPONENTBUILDER_CUSTOM_CODE_CODE_LABEL"
|
||||
rows="30"
|
||||
cols="15"
|
||||
description="COM_COMPONENTBUILDER_CUSTOM_CODE_CODE_DESCRIPTION"
|
||||
class="text_area span12"
|
||||
filter="raw"
|
||||
hint="COM_COMPONENTBUILDER_CUSTOM_CODE_CODE_HINT"
|
||||
required="true"
|
||||
/>
|
||||
<!-- From_line Field. Type: Text. (joomla) -->
|
||||
<field
|
||||
type="text"
|
||||
name="from_line"
|
||||
label="COM_COMPONENTBUILDER_CUSTOM_CODE_FROM_LINE_LABEL"
|
||||
size="10"
|
||||
maxlength="50"
|
||||
description="COM_COMPONENTBUILDER_CUSTOM_CODE_FROM_LINE_DESCRIPTION"
|
||||
class="text_area"
|
||||
filter="FLOAT"
|
||||
message="Error! Please add amount paid here."
|
||||
hint="COM_COMPONENTBUILDER_CUSTOM_CODE_FROM_LINE_HINT"
|
||||
onchange="if(!jQuery(this).val().match(/^\d+$/)){jQuery(this).val('')};"
|
||||
/>
|
||||
<!-- Hashendtarget Field. Type: Text. (joomla) -->
|
||||
<field
|
||||
type="text"
|
||||
@ -210,25 +200,6 @@
|
||||
message="Error! Please add some text here."
|
||||
hint="COM_COMPONENTBUILDER_CUSTOM_CODE_HASHENDTARGET_HINT"
|
||||
/>
|
||||
<!-- Not_required Field. Type: Hidden. (joomla) -->
|
||||
<field
|
||||
type="hidden"
|
||||
name="not_required"
|
||||
default="[]"
|
||||
/>
|
||||
<!-- Code Field. Type: Textarea. (joomla) -->
|
||||
<field
|
||||
type="textarea"
|
||||
name="code"
|
||||
label="COM_COMPONENTBUILDER_CUSTOM_CODE_CODE_LABEL"
|
||||
rows="30"
|
||||
cols="15"
|
||||
description="COM_COMPONENTBUILDER_CUSTOM_CODE_CODE_DESCRIPTION"
|
||||
class="text_area span12"
|
||||
filter="raw"
|
||||
hint="COM_COMPONENTBUILDER_CUSTOM_CODE_CODE_HINT"
|
||||
required="true"
|
||||
/>
|
||||
<!-- To_line Field. Type: Text. (joomla) -->
|
||||
<field
|
||||
type="text"
|
||||
@ -243,24 +214,53 @@
|
||||
hint="COM_COMPONENTBUILDER_CUSTOM_CODE_TO_LINE_HINT"
|
||||
onchange="if(!jQuery(this).val().match(/^\d+$/)){jQuery(this).val('')};"
|
||||
/>
|
||||
<!-- Hashtarget Field. Type: Text. (joomla) -->
|
||||
<!-- Function_name Field. Type: Text. (joomla) -->
|
||||
<field
|
||||
type="text"
|
||||
name="hashtarget"
|
||||
label="COM_COMPONENTBUILDER_CUSTOM_CODE_HASHTARGET_LABEL"
|
||||
size="50"
|
||||
maxlength="150"
|
||||
description="COM_COMPONENTBUILDER_CUSTOM_CODE_HASHTARGET_DESCRIPTION"
|
||||
name="function_name"
|
||||
label="COM_COMPONENTBUILDER_CUSTOM_CODE_FUNCTION_NAME_LABEL"
|
||||
size="40"
|
||||
description="COM_COMPONENTBUILDER_CUSTOM_CODE_FUNCTION_NAME_DESCRIPTION"
|
||||
class="input-large-text"
|
||||
required="true"
|
||||
/>
|
||||
<!-- Note_placeholders_explained Field. Type: Note. A None Database Field. (joomla) -->
|
||||
<field type="note" name="note_placeholders_explained" label="COM_COMPONENTBUILDER_CUSTOM_CODE_NOTE_PLACEHOLDERS_EXPLAINED_LABEL" description="COM_COMPONENTBUILDER_CUSTOM_CODE_NOTE_PLACEHOLDERS_EXPLAINED_DESCRIPTION" heading="h4" class="note_placeholders_explained" />
|
||||
<!-- From_line Field. Type: Text. (joomla) -->
|
||||
<field
|
||||
type="text"
|
||||
name="from_line"
|
||||
label="COM_COMPONENTBUILDER_CUSTOM_CODE_FROM_LINE_LABEL"
|
||||
size="10"
|
||||
maxlength="50"
|
||||
description="COM_COMPONENTBUILDER_CUSTOM_CODE_FROM_LINE_DESCRIPTION"
|
||||
class="text_area"
|
||||
filter="FLOAT"
|
||||
message="Error! Please add amount paid here."
|
||||
hint="COM_COMPONENTBUILDER_CUSTOM_CODE_FROM_LINE_HINT"
|
||||
onchange="if(!jQuery(this).val().match(/^\d+$/)){jQuery(this).val('')};"
|
||||
/>
|
||||
<!-- System_name Field. Type: Text. (joomla) -->
|
||||
<field
|
||||
type="text"
|
||||
name="system_name"
|
||||
label="COM_COMPONENTBUILDER_CUSTOM_CODE_SYSTEM_NAME_LABEL"
|
||||
size="10"
|
||||
maxlength="50"
|
||||
description="COM_COMPONENTBUILDER_CUSTOM_CODE_SYSTEM_NAME_DESCRIPTION"
|
||||
class="text_area"
|
||||
readonly="true"
|
||||
filter="STRING"
|
||||
message="Error! Please add some text here."
|
||||
hint="COM_COMPONENTBUILDER_CUSTOM_CODE_HASHTARGET_HINT"
|
||||
hint="COM_COMPONENTBUILDER_CUSTOM_CODE_SYSTEM_NAME_HINT"
|
||||
/>
|
||||
<!-- Note_jcb_placeholder Field. Type: Note. A None Database Field. (joomla) -->
|
||||
<field type="note" name="note_jcb_placeholder" label="COM_COMPONENTBUILDER_CUSTOM_CODE_NOTE_JCB_PLACEHOLDER_LABEL" description="COM_COMPONENTBUILDER_CUSTOM_CODE_NOTE_JCB_PLACEHOLDER_DESCRIPTION" heading="h4" class="span12 note_jcb_placeholder" />
|
||||
<!-- Note_placeholders_explained Field. Type: Note. A None Database Field. (joomla) -->
|
||||
<field type="note" name="note_placeholders_explained" label="COM_COMPONENTBUILDER_CUSTOM_CODE_NOTE_PLACEHOLDERS_EXPLAINED_LABEL" description="COM_COMPONENTBUILDER_CUSTOM_CODE_NOTE_PLACEHOLDERS_EXPLAINED_DESCRIPTION" heading="h4" class="note_placeholders_explained" />
|
||||
<!-- Not_required Field. Type: Hidden. (joomla) -->
|
||||
<field
|
||||
type="hidden"
|
||||
name="not_required"
|
||||
default="[]"
|
||||
/>
|
||||
</fieldset>
|
||||
|
||||
<!-- Access Control Fields. -->
|
||||
|
@ -9,8 +9,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 311 of this MVC
|
||||
@build 1st April, 2017
|
||||
@version @update number 314 of this MVC
|
||||
@build 5th April, 2017
|
||||
@created 6th May, 2015
|
||||
@package Component Builder
|
||||
@subpackage joomla_component.js
|
||||
|
@ -1,25 +0,0 @@
|
||||
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
|
||||
__ __ _ _____ _ _ __ __ _ _ _
|
||||
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
|
||||
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
|
||||
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
|
||||
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
|
||||
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
|
||||
| |
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 8 of this MVC
|
||||
@build 3rd April, 2017
|
||||
@created 3rd April, 2017
|
||||
@package Component Builder
|
||||
@subpackage language_placeholder.js
|
||||
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
Builds Complex Joomla Components
|
||||
|
||||
/-----------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
|
84
admin/models/forms/language_translation.js
Normal file
84
admin/models/forms/language_translation.js
Normal file
@ -0,0 +1,84 @@
|
||||
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
|
||||
__ __ _ _____ _ _ __ __ _ _ _
|
||||
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
|
||||
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
|
||||
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
|
||||
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
|
||||
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
|
||||
| |
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 28 of this MVC
|
||||
@build 5th April, 2017
|
||||
@created 3rd April, 2017
|
||||
@package Component Builder
|
||||
@subpackage language_translation.js
|
||||
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
Builds Complex Joomla Components
|
||||
|
||||
/-----------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
|
||||
jQuery(document).ready(function($)
|
||||
{
|
||||
// build table of translations
|
||||
var translation = encodeURIComponent(jQuery('#jform_translation').val());
|
||||
if (translation) {
|
||||
getBuildTable(translation,'jform_translation');
|
||||
}
|
||||
// set button to add more languages
|
||||
addButton('language','components');
|
||||
});
|
||||
|
||||
function getBuildTable_server(string, idName){
|
||||
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getBuildTable&format=json&vdm="+vastDevMod);
|
||||
if(token.length > 0 && string.length > 0 && idName.length > 0){
|
||||
var request = 'token='+token+'&idName='+idName+'&object='+string;
|
||||
}
|
||||
return jQuery.ajax({
|
||||
type: 'GET',
|
||||
url: getUrl,
|
||||
dataType: 'jsonp',
|
||||
data: request,
|
||||
jsonp: 'callback'
|
||||
});
|
||||
}
|
||||
function getBuildTable(string, idName){
|
||||
getBuildTable_server(string, idName).done(function(result) {
|
||||
jQuery('#table_'+idName).remove();
|
||||
if(result){
|
||||
addData(result, '#'+idName);
|
||||
}
|
||||
})
|
||||
}
|
||||
function addData(result, where){
|
||||
jQuery(where).closest('.control-group').parent().append(result);
|
||||
}
|
||||
function addButton_server(type){
|
||||
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getButton&format=json&vdm="+vastDevMod);
|
||||
if(token.length > 0 && type.length > 0){
|
||||
var request = 'token='+token+'&type='+type;
|
||||
}
|
||||
return jQuery.ajax({
|
||||
type: 'GET',
|
||||
url: getUrl,
|
||||
dataType: 'jsonp',
|
||||
data: request,
|
||||
jsonp: 'callback'
|
||||
});
|
||||
}
|
||||
function addButton(type, where){
|
||||
addButton_server(type).done(function(result) {
|
||||
if(result){
|
||||
setButton(result, '#jform_'+where);
|
||||
}
|
||||
});
|
||||
}
|
||||
function setButton(result, where){
|
||||
jQuery(where).closest('.control-group').append(result);
|
||||
}
|
@ -16,8 +16,8 @@
|
||||
<field
|
||||
name="created"
|
||||
type="calendar"
|
||||
label="COM_COMPONENTBUILDER_LANGUAGE_PLACEHOLDER_CREATED_DATE_LABEL"
|
||||
description="COM_COMPONENTBUILDER_LANGUAGE_PLACEHOLDER_CREATED_DATE_DESC"
|
||||
label="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATION_CREATED_DATE_LABEL"
|
||||
description="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATION_CREATED_DATE_DESC"
|
||||
size="22"
|
||||
|
||||
format="%Y-%m-%d %H:%M:%S"
|
||||
@ -27,9 +27,9 @@
|
||||
<field
|
||||
name="created_by"
|
||||
type="user"
|
||||
label="COM_COMPONENTBUILDER_LANGUAGE_PLACEHOLDER_CREATED_BY_LABEL"
|
||||
label="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATION_CREATED_BY_LABEL"
|
||||
|
||||
description="COM_COMPONENTBUILDER_LANGUAGE_PLACEHOLDER_CREATED_BY_DESC"
|
||||
description="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATION_CREATED_BY_DESC"
|
||||
/>
|
||||
<!-- Published Field. Type: List (joomla) -->
|
||||
<field name="published" type="list" label="JSTATUS"
|
||||
@ -47,12 +47,12 @@
|
||||
</field>
|
||||
<!-- Date Modified Field. Type: Calendar (joomla) -->
|
||||
<field name="modified" type="calendar" class="readonly"
|
||||
label="COM_COMPONENTBUILDER_LANGUAGE_PLACEHOLDER_MODIFIED_DATE_LABEL" description="COM_COMPONENTBUILDER_LANGUAGE_PLACEHOLDER_MODIFIED_DATE_DESC"
|
||||
label="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATION_MODIFIED_DATE_LABEL" description="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATION_MODIFIED_DATE_DESC"
|
||||
size="22" readonly="true" format="%Y-%m-%d %H:%M:%S" filter="user_utc" />
|
||||
<!-- User Modified Field. Type: User (joomla) -->
|
||||
<field name="modified_by" type="user"
|
||||
label="COM_COMPONENTBUILDER_LANGUAGE_PLACEHOLDER_MODIFIED_BY_LABEL"
|
||||
description="COM_COMPONENTBUILDER_LANGUAGE_PLACEHOLDER_MODIFIED_BY_DESC"
|
||||
label="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATION_MODIFIED_BY_LABEL"
|
||||
description="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATION_MODIFIED_BY_DESC"
|
||||
class="readonly"
|
||||
readonly="true"
|
||||
filter="unset"
|
||||
@ -71,7 +71,7 @@
|
||||
name="ordering"
|
||||
type="number"
|
||||
class="inputbox validate-ordering"
|
||||
label="COM_COMPONENTBUILDER_LANGUAGE_PLACEHOLDER_ORDERING_LABEL"
|
||||
label="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATION_ORDERING_LABEL"
|
||||
description=""
|
||||
default="0"
|
||||
size="6"
|
||||
@ -83,33 +83,32 @@
|
||||
name="version"
|
||||
type="text"
|
||||
class="readonly"
|
||||
label="COM_COMPONENTBUILDER_LANGUAGE_PLACEHOLDER_VERSION_LABEL"
|
||||
description="COM_COMPONENTBUILDER_LANGUAGE_PLACEHOLDER_VERSION_DESC"
|
||||
label="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATION_VERSION_LABEL"
|
||||
description="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATION_VERSION_DESC"
|
||||
size="6"
|
||||
readonly="true"
|
||||
filter="unset"
|
||||
/>
|
||||
<!-- Dynamic Fields. -->
|
||||
<!-- Placeholder Field. Type: Text. (joomla) -->
|
||||
<!-- Entranslation Field. Type: Textarea. (joomla) -->
|
||||
<field
|
||||
type="text"
|
||||
name="placeholder"
|
||||
label="COM_COMPONENTBUILDER_LANGUAGE_PLACEHOLDER_PLACEHOLDER_LABEL"
|
||||
size="100"
|
||||
maxlength="150"
|
||||
description="COM_COMPONENTBUILDER_LANGUAGE_PLACEHOLDER_PLACEHOLDER_DESCRIPTION"
|
||||
class="text_area"
|
||||
type="textarea"
|
||||
name="entranslation"
|
||||
label="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATION_ENTRANSLATION_LABEL"
|
||||
rows="4"
|
||||
cols="5"
|
||||
description="JFIELD_TITLE_DESC"
|
||||
class="text_area span12"
|
||||
filter="STRING"
|
||||
hint="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATION_ENTRANSLATION_HINT"
|
||||
readonly="true"
|
||||
disabled="true"
|
||||
filter="STRING"
|
||||
message="Error! Please add some text here."
|
||||
hint="COM_COMPONENTBUILDER_LANGUAGE_PLACEHOLDER_PLACEHOLDER_HINT"
|
||||
/>
|
||||
<!-- Components Field. Type: Components. (custom) -->
|
||||
<field
|
||||
type="components"
|
||||
name="components"
|
||||
label="COM_COMPONENTBUILDER_LANGUAGE_PLACEHOLDER_COMPONENTS_LABEL"
|
||||
label="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATION_COMPONENTS_LABEL"
|
||||
class="list_class"
|
||||
multiple="true"
|
||||
default="0"
|
||||
@ -120,34 +119,32 @@
|
||||
<field
|
||||
type="repeatable"
|
||||
name="translation"
|
||||
label="COM_COMPONENTBUILDER_LANGUAGE_PLACEHOLDER_TRANSLATION_LABEL"
|
||||
description="COM_COMPONENTBUILDER_LANGUAGE_PLACEHOLDER_TRANSLATION_DESCRIPTION"
|
||||
label="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATION_TRANSLATION_LABEL"
|
||||
description="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATION_TRANSLATION_DESCRIPTION"
|
||||
id="translation"
|
||||
class="translations"
|
||||
select="COM_COMPONENTBUILDER_LANGUAGE_PLACEHOLDER_TRANSLATION_SELECT"
|
||||
select="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATION_TRANSLATION_SELECT"
|
||||
icon="list"
|
||||
maximum="50">
|
||||
<fields name="translation_fields" label="">
|
||||
<fieldset hidden="true" name="translation_modal" repeat="true">
|
||||
<!-- Translation Field. Type: Text. (joomla) -->
|
||||
<!-- Translation Field. Type: Textarea. (joomla) -->
|
||||
<field
|
||||
type="text"
|
||||
type="textarea"
|
||||
name="translation"
|
||||
label="COM_COMPONENTBUILDER_LANGUAGE_PLACEHOLDER_TRANSLATION_LABEL"
|
||||
size="100"
|
||||
maxlength="150"
|
||||
class="text_area"
|
||||
required="false"
|
||||
label="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATION_TRANSLATION_LABEL"
|
||||
rows="4"
|
||||
cols="5"
|
||||
class="text_area span12"
|
||||
filter="STRING"
|
||||
message="Error! Please add translated string here."
|
||||
hint="COM_COMPONENTBUILDER_LANGUAGE_PLACEHOLDER_TRANSLATION_HINT"
|
||||
hint="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATION_TRANSLATION_HINT"
|
||||
required="false"
|
||||
/>
|
||||
<!-- Language Field. Type: Language. (joomla) -->
|
||||
<!-- Language Field. Type: Lang. (custom) -->
|
||||
<field
|
||||
custom="Array"
|
||||
type="language"
|
||||
type="lang"
|
||||
name="language"
|
||||
label="COM_COMPONENTBUILDER_LANGUAGE_PLACEHOLDER_LANGUAGE_LABEL"
|
||||
label="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATION_LANGUAGE_LABEL"
|
||||
class="list_class"
|
||||
multiple="false"
|
||||
default="0"
|
||||
@ -171,13 +168,13 @@
|
||||
<field
|
||||
name="rules"
|
||||
type="rules"
|
||||
label="Permissions in relation to this language_placeholder"
|
||||
label="Permissions in relation to this language_translation"
|
||||
translate_label="false"
|
||||
filter="rules"
|
||||
validate="rules"
|
||||
class="inputbox"
|
||||
component="com_componentbuilder"
|
||||
section="language_placeholder"
|
||||
section="language_translation"
|
||||
/>
|
||||
</fieldset>
|
||||
</form>
|
@ -11,7 +11,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.4.2
|
||||
@build 3rd April, 2017
|
||||
@build 5th April, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage import.php
|
||||
|
@ -11,7 +11,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.4.2
|
||||
@build 3rd April, 2017
|
||||
@build 5th April, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage import_joomla_components.php
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 311 of this MVC
|
||||
@build 1st April, 2017
|
||||
@version @update number 314 of this MVC
|
||||
@build 5th April, 2017
|
||||
@created 6th May, 2015
|
||||
@package Component Builder
|
||||
@subpackage joomla_component.php
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 311 of this MVC
|
||||
@build 1st April, 2017
|
||||
@version @update number 314 of this MVC
|
||||
@build 5th April, 2017
|
||||
@created 6th May, 2015
|
||||
@package Component Builder
|
||||
@subpackage joomla_components.php
|
||||
@ -101,7 +101,7 @@ class ComponentbuilderModelJoomla_components extends JModelList
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
// Select some fields
|
||||
$query->select($db->quoteName('a.*'));
|
||||
$query->select(array('a.*'));
|
||||
|
||||
// From the componentbuilder_joomla_component table
|
||||
$query->from($db->quoteName('#__componentbuilder_joomla_component', 'a'));
|
||||
@ -459,7 +459,7 @@ class ComponentbuilderModelJoomla_components extends JModelList
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
// Select some fields
|
||||
$query->select($db->quoteName('a.*'));
|
||||
$query->select(array('a.*'));
|
||||
|
||||
// From the componentbuilder_ANY table
|
||||
$query->from($db->quoteName('#__componentbuilder_'. $table, 'a'));
|
||||
|
@ -10,11 +10,11 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 8 of this MVC
|
||||
@build 3rd April, 2017
|
||||
@version @update number 28 of this MVC
|
||||
@build 5th April, 2017
|
||||
@created 3rd April, 2017
|
||||
@package Component Builder
|
||||
@subpackage language_placeholder.php
|
||||
@subpackage language_translation.php
|
||||
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
@ -32,9 +32,9 @@ use Joomla\Registry\Registry;
|
||||
jimport('joomla.application.component.modeladmin');
|
||||
|
||||
/**
|
||||
* Componentbuilder Language_placeholder Model
|
||||
* Componentbuilder Language_translation Model
|
||||
*/
|
||||
class ComponentbuilderModelLanguage_placeholder extends JModelAdmin
|
||||
class ComponentbuilderModelLanguage_translation extends JModelAdmin
|
||||
{
|
||||
/**
|
||||
* @var string The prefix to use with controller messages.
|
||||
@ -48,7 +48,7 @@ class ComponentbuilderModelLanguage_placeholder extends JModelAdmin
|
||||
* @var string
|
||||
* @since 3.2
|
||||
*/
|
||||
public $typeAlias = 'com_componentbuilder.language_placeholder';
|
||||
public $typeAlias = 'com_componentbuilder.language_translation';
|
||||
|
||||
/**
|
||||
* Returns a Table object, always creating it
|
||||
@ -61,9 +61,14 @@ class ComponentbuilderModelLanguage_placeholder extends JModelAdmin
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getTable($type = 'language_placeholder', $prefix = 'ComponentbuilderTable', $config = array())
|
||||
public function getTable($type = 'language_translation', $prefix = 'ComponentbuilderTable', $config = array())
|
||||
{
|
||||
return JTable::getInstance($type, $prefix, $config);
|
||||
}
|
||||
|
||||
public function getVDM()
|
||||
{
|
||||
return $this->vastDevMod;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -99,12 +104,33 @@ class ComponentbuilderModelLanguage_placeholder extends JModelAdmin
|
||||
{
|
||||
// JSON Decode components.
|
||||
$item->components = json_decode($item->components);
|
||||
}
|
||||
|
||||
|
||||
if (empty($item->id))
|
||||
{
|
||||
$id = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
$id = $item->id;
|
||||
}
|
||||
// set the id and view name to session
|
||||
if ($vdm = ComponentbuilderHelper::get('language_placeholder__'.$id))
|
||||
{
|
||||
$this->vastDevMod = $vdm;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->vastDevMod = ComponentbuilderHelper::randomkey(50);
|
||||
ComponentbuilderHelper::set($this->vastDevMod, 'language_placeholder__'.$id);
|
||||
ComponentbuilderHelper::set('language_placeholder__'.$id, $this->vastDevMod);
|
||||
}
|
||||
|
||||
if (!empty($item->id))
|
||||
{
|
||||
$item->tags = new JHelperTags;
|
||||
$item->tags->getTagIds($item->id, 'com_componentbuilder.language_placeholder');
|
||||
$item->tags->getTagIds($item->id, 'com_componentbuilder.language_translation');
|
||||
}
|
||||
}
|
||||
|
||||
@ -124,7 +150,7 @@ class ComponentbuilderModelLanguage_placeholder extends JModelAdmin
|
||||
public function getForm($data = array(), $loadData = true)
|
||||
{
|
||||
// Get the form.
|
||||
$form = $this->loadForm('com_componentbuilder.language_placeholder', 'language_placeholder', array('control' => 'jform', 'load_data' => $loadData));
|
||||
$form = $this->loadForm('com_componentbuilder.language_translation', 'language_translation', array('control' => 'jform', 'load_data' => $loadData));
|
||||
|
||||
if (empty($form))
|
||||
{
|
||||
@ -148,8 +174,8 @@ class ComponentbuilderModelLanguage_placeholder extends JModelAdmin
|
||||
|
||||
// Check for existing item.
|
||||
// Modify the form based on Edit State access controls.
|
||||
if ($id != 0 && (!$user->authorise('language_placeholder.edit.state', 'com_componentbuilder.language_placeholder.' . (int) $id))
|
||||
|| ($id == 0 && !$user->authorise('language_placeholder.edit.state', 'com_componentbuilder')))
|
||||
if ($id != 0 && (!$user->authorise('language_translation.edit.state', 'com_componentbuilder.language_translation.' . (int) $id))
|
||||
|| ($id == 0 && !$user->authorise('language_translation.edit.state', 'com_componentbuilder')))
|
||||
{
|
||||
// Disable fields for display.
|
||||
$form->setFieldAttribute('ordering', 'disabled', 'true');
|
||||
@ -206,7 +232,7 @@ class ComponentbuilderModelLanguage_placeholder extends JModelAdmin
|
||||
*/
|
||||
public function getScript()
|
||||
{
|
||||
return 'administrator/components/com_componentbuilder/models/forms/language_placeholder.js';
|
||||
return 'administrator/components/com_componentbuilder/models/forms/language_translation.js';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -229,7 +255,7 @@ class ComponentbuilderModelLanguage_placeholder extends JModelAdmin
|
||||
|
||||
$user = JFactory::getUser();
|
||||
// The record has been set. Check the record permissions.
|
||||
return $user->authorise('language_placeholder.delete', 'com_componentbuilder.language_placeholder.' . (int) $record->id);
|
||||
return $user->authorise('language_translation.delete', 'com_componentbuilder.language_translation.' . (int) $record->id);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -251,14 +277,14 @@ class ComponentbuilderModelLanguage_placeholder extends JModelAdmin
|
||||
if ($recordId)
|
||||
{
|
||||
// The record has been set. Check the record permissions.
|
||||
$permission = $user->authorise('language_placeholder.edit.state', 'com_componentbuilder.language_placeholder.' . (int) $recordId);
|
||||
$permission = $user->authorise('language_translation.edit.state', 'com_componentbuilder.language_translation.' . (int) $recordId);
|
||||
if (!$permission && !is_null($permission))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// In the absense of better information, revert to the component permissions.
|
||||
return $user->authorise('language_placeholder.edit.state', 'com_componentbuilder');
|
||||
return $user->authorise('language_translation.edit.state', 'com_componentbuilder');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -275,7 +301,7 @@ class ComponentbuilderModelLanguage_placeholder extends JModelAdmin
|
||||
// Check specific edit permission then general edit permission.
|
||||
$user = JFactory::getUser();
|
||||
|
||||
return $user->authorise('language_placeholder.edit', 'com_componentbuilder.language_placeholder.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('language_placeholder.edit', 'com_componentbuilder');
|
||||
return $user->authorise('language_translation.edit', 'com_componentbuilder.language_translation.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('language_translation.edit', 'com_componentbuilder');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -316,7 +342,7 @@ class ComponentbuilderModelLanguage_placeholder extends JModelAdmin
|
||||
$db = JFactory::getDbo();
|
||||
$query = $db->getQuery(true)
|
||||
->select('MAX(ordering)')
|
||||
->from($db->quoteName('#__componentbuilder_language_placeholder'));
|
||||
->from($db->quoteName('#__componentbuilder_language_translation'));
|
||||
$db->setQuery($query);
|
||||
$max = $db->loadResult();
|
||||
|
||||
@ -346,7 +372,7 @@ class ComponentbuilderModelLanguage_placeholder extends JModelAdmin
|
||||
protected function loadFormData()
|
||||
{
|
||||
// Check the session for previously entered form data.
|
||||
$data = JFactory::getApplication()->getUserState('com_componentbuilder.edit.language_placeholder.data', array());
|
||||
$data = JFactory::getApplication()->getUserState('com_componentbuilder.edit.language_translation.data', array());
|
||||
|
||||
if (empty($data))
|
||||
{
|
||||
@ -444,7 +470,7 @@ class ComponentbuilderModelLanguage_placeholder extends JModelAdmin
|
||||
$this->tableClassName = get_class($this->table);
|
||||
$this->contentType = new JUcmType;
|
||||
$this->type = $this->contentType->getTypeByTable($this->tableClassName);
|
||||
$this->canDo = ComponentbuilderHelper::getActions('language_placeholder');
|
||||
$this->canDo = ComponentbuilderHelper::getActions('language_translation');
|
||||
$this->batchSet = true;
|
||||
|
||||
if (!$this->canDo->get('core.batch'))
|
||||
@ -524,10 +550,10 @@ class ComponentbuilderModelLanguage_placeholder extends JModelAdmin
|
||||
$this->tableClassName = get_class($this->table);
|
||||
$this->contentType = new JUcmType;
|
||||
$this->type = $this->contentType->getTypeByTable($this->tableClassName);
|
||||
$this->canDo = ComponentbuilderHelper::getActions('language_placeholder');
|
||||
$this->canDo = ComponentbuilderHelper::getActions('language_translation');
|
||||
}
|
||||
|
||||
if (!$this->canDo->get('language_placeholder.create') && !$this->canDo->get('language_placeholder.batch'))
|
||||
if (!$this->canDo->get('language_translation.create') && !$this->canDo->get('language_translation.batch'))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -542,7 +568,7 @@ class ComponentbuilderModelLanguage_placeholder extends JModelAdmin
|
||||
{
|
||||
$values['published'] = 0;
|
||||
}
|
||||
elseif (isset($values['published']) && !$this->canDo->get('language_placeholder.edit.state'))
|
||||
elseif (isset($values['published']) && !$this->canDo->get('language_translation.edit.state'))
|
||||
{
|
||||
$values['published'] = 0;
|
||||
}
|
||||
@ -559,7 +585,7 @@ class ComponentbuilderModelLanguage_placeholder extends JModelAdmin
|
||||
|
||||
// only allow copy if user may edit this item.
|
||||
|
||||
if (!$this->user->authorise('language_placeholder.edit', $contexts[$pk]))
|
||||
if (!$this->user->authorise('language_translation.edit', $contexts[$pk]))
|
||||
|
||||
{
|
||||
|
||||
@ -589,7 +615,7 @@ class ComponentbuilderModelLanguage_placeholder extends JModelAdmin
|
||||
}
|
||||
}
|
||||
|
||||
$this->table->placeholder = $this->generateUniqe('placeholder',$this->table->placeholder);
|
||||
$this->table->entranslation = $this->generateUniqe('entranslation',$this->table->entranslation);
|
||||
|
||||
// insert all set values
|
||||
if (ComponentbuilderHelper::checkArray($values))
|
||||
@ -673,17 +699,17 @@ class ComponentbuilderModelLanguage_placeholder extends JModelAdmin
|
||||
$this->tableClassName = get_class($this->table);
|
||||
$this->contentType = new JUcmType;
|
||||
$this->type = $this->contentType->getTypeByTable($this->tableClassName);
|
||||
$this->canDo = ComponentbuilderHelper::getActions('language_placeholder');
|
||||
$this->canDo = ComponentbuilderHelper::getActions('language_translation');
|
||||
}
|
||||
|
||||
if (!$this->canDo->get('language_placeholder.edit') && !$this->canDo->get('language_placeholder.batch'))
|
||||
if (!$this->canDo->get('language_translation.edit') && !$this->canDo->get('language_translation.batch'))
|
||||
{
|
||||
$this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT'));
|
||||
return false;
|
||||
}
|
||||
|
||||
// make sure published only updates if user has the permission.
|
||||
if (isset($values['published']) && !$this->canDo->get('language_placeholder.edit.state'))
|
||||
if (isset($values['published']) && !$this->canDo->get('language_translation.edit.state'))
|
||||
{
|
||||
unset($values['published']);
|
||||
}
|
||||
@ -693,7 +719,7 @@ class ComponentbuilderModelLanguage_placeholder extends JModelAdmin
|
||||
// Parent exists so we proceed
|
||||
foreach ($pks as $pk)
|
||||
{
|
||||
if (!$this->user->authorise('language_placeholder.edit', $contexts[$pk]))
|
||||
if (!$this->user->authorise('language_translation.edit', $contexts[$pk]))
|
||||
{
|
||||
$this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT'));
|
||||
|
@ -10,11 +10,11 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 8 of this MVC
|
||||
@build 3rd April, 2017
|
||||
@version @update number 28 of this MVC
|
||||
@build 5th April, 2017
|
||||
@created 3rd April, 2017
|
||||
@package Component Builder
|
||||
@subpackage language_placeholders.php
|
||||
@subpackage language_translations.php
|
||||
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
@ -30,9 +30,9 @@ defined('_JEXEC') or die('Restricted access');
|
||||
jimport('joomla.application.component.modellist');
|
||||
|
||||
/**
|
||||
* Language_placeholders Model
|
||||
* Language_translations Model
|
||||
*/
|
||||
class ComponentbuilderModelLanguage_placeholders extends JModelList
|
||||
class ComponentbuilderModelLanguage_translations extends JModelList
|
||||
{
|
||||
public function __construct($config = array())
|
||||
{
|
||||
@ -44,7 +44,7 @@ class ComponentbuilderModelLanguage_placeholders extends JModelList
|
||||
'a.ordering','ordering',
|
||||
'a.created_by','created_by',
|
||||
'a.modified_by','modified_by',
|
||||
'a.placeholder','placeholder'
|
||||
'a.entranslation','entranslation'
|
||||
);
|
||||
}
|
||||
|
||||
@ -65,8 +65,8 @@ class ComponentbuilderModelLanguage_placeholders extends JModelList
|
||||
{
|
||||
$this->context .= '.' . $layout;
|
||||
}
|
||||
$placeholder = $this->getUserStateFromRequest($this->context . '.filter.placeholder', 'filter_placeholder');
|
||||
$this->setState('filter.placeholder', $placeholder);
|
||||
$entranslation = $this->getUserStateFromRequest($this->context . '.filter.entranslation', 'filter_entranslation');
|
||||
$this->setState('filter.entranslation', $entranslation);
|
||||
|
||||
$sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int');
|
||||
$this->setState('filter.sorting', $sorting);
|
||||
@ -110,7 +110,7 @@ class ComponentbuilderModelLanguage_placeholders extends JModelList
|
||||
$user = JFactory::getUser();
|
||||
foreach ($items as $nr => &$item)
|
||||
{
|
||||
$access = ($user->authorise('language_placeholder.access', 'com_componentbuilder.language_placeholder.' . (int) $item->id) && $user->authorise('language_placeholder.access', 'com_componentbuilder'));
|
||||
$access = ($user->authorise('language_translation.access', 'com_componentbuilder.language_translation.' . (int) $item->id) && $user->authorise('language_translation.access', 'com_componentbuilder'));
|
||||
if (!$access)
|
||||
{
|
||||
unset($items[$nr]);
|
||||
@ -118,7 +118,7 @@ class ComponentbuilderModelLanguage_placeholders extends JModelList
|
||||
}
|
||||
|
||||
// convert components
|
||||
$item->components = ComponentbuilderHelper::jsonToString($item->components, ', ', 'components');
|
||||
$item->components = ComponentbuilderHelper::jsonToString($item->components, ', ', 'joomla_component');
|
||||
}
|
||||
}
|
||||
|
||||
@ -143,11 +143,7 @@ class ComponentbuilderModelLanguage_placeholders extends JModelList
|
||||
$query->select('a.*');
|
||||
|
||||
// From the componentbuilder_item table
|
||||
$query->from($db->quoteName('#__componentbuilder_language_placeholder', 'a'));
|
||||
|
||||
// From the componentbuilder_joomla_component table.
|
||||
$query->select($db->quoteName('g.system_name','components_system_name'));
|
||||
$query->join('LEFT', $db->quoteName('#__componentbuilder_joomla_component', 'g') . ' ON (' . $db->quoteName('a.components') . ' = ' . $db->quoteName('g.id') . ')');
|
||||
$query->from($db->quoteName('#__componentbuilder_language_translation', 'a'));
|
||||
|
||||
// Filter by published state
|
||||
$published = $this->getState('filter.published');
|
||||
@ -185,7 +181,7 @@ class ComponentbuilderModelLanguage_placeholders extends JModelList
|
||||
else
|
||||
{
|
||||
$search = $db->quote('%' . $db->escape($search) . '%');
|
||||
$query->where('(a.placeholder LIKE '.$search.' OR a.components LIKE '.$search.' OR g.system_name LIKE '.$search.')');
|
||||
$query->where('(a.entranslation LIKE '.$search.' OR a.components LIKE '.$search.' OR g.system_name LIKE '.$search.')');
|
||||
}
|
||||
}
|
||||
|
||||
@ -222,8 +218,8 @@ class ComponentbuilderModelLanguage_placeholders extends JModelList
|
||||
// Select some fields
|
||||
$query->select('a.*');
|
||||
|
||||
// From the componentbuilder_language_placeholder table
|
||||
$query->from($db->quoteName('#__componentbuilder_language_placeholder', 'a'));
|
||||
// From the componentbuilder_language_translation table
|
||||
$query->from($db->quoteName('#__componentbuilder_language_translation', 'a'));
|
||||
$query->where('a.id IN (' . implode(',',$pks) . ')');
|
||||
// Implement View Level Access
|
||||
if (!$user->authorise('core.options', 'com_componentbuilder'))
|
||||
@ -249,7 +245,7 @@ class ComponentbuilderModelLanguage_placeholders extends JModelList
|
||||
$user = JFactory::getUser();
|
||||
foreach ($items as $nr => &$item)
|
||||
{
|
||||
$access = ($user->authorise('language_placeholder.access', 'com_componentbuilder.language_placeholder.' . (int) $item->id) && $user->authorise('language_placeholder.access', 'com_componentbuilder'));
|
||||
$access = ($user->authorise('language_translation.access', 'com_componentbuilder.language_translation.' . (int) $item->id) && $user->authorise('language_translation.access', 'com_componentbuilder'));
|
||||
if (!$access)
|
||||
{
|
||||
unset($items[$nr]);
|
||||
@ -284,7 +280,7 @@ class ComponentbuilderModelLanguage_placeholders extends JModelList
|
||||
// Get a db connection.
|
||||
$db = JFactory::getDbo();
|
||||
// get the columns
|
||||
$columns = $db->getTableColumns("#__componentbuilder_language_placeholder");
|
||||
$columns = $db->getTableColumns("#__componentbuilder_language_translation");
|
||||
if (ComponentbuilderHelper::checkArray($columns))
|
||||
{
|
||||
// remove the headers you don't import/export.
|
||||
@ -316,7 +312,7 @@ class ComponentbuilderModelLanguage_placeholders extends JModelList
|
||||
$id .= ':' . $this->getState('filter.ordering');
|
||||
$id .= ':' . $this->getState('filter.created_by');
|
||||
$id .= ':' . $this->getState('filter.modified_by');
|
||||
$id .= ':' . $this->getState('filter.placeholder');
|
||||
$id .= ':' . $this->getState('filter.entranslation');
|
||||
|
||||
return parent::getStoreId($id);
|
||||
}
|
||||
@ -340,7 +336,7 @@ class ComponentbuilderModelLanguage_placeholders extends JModelList
|
||||
// reset query
|
||||
$query = $db->getQuery(true);
|
||||
$query->select('*');
|
||||
$query->from($db->quoteName('#__componentbuilder_language_placeholder'));
|
||||
$query->from($db->quoteName('#__componentbuilder_language_translation'));
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
if ($db->getNumRows())
|
||||
@ -363,7 +359,7 @@ class ComponentbuilderModelLanguage_placeholders extends JModelList
|
||||
);
|
||||
|
||||
// Check table
|
||||
$query->update($db->quoteName('#__componentbuilder_language_placeholder'))->set($fields)->where($conditions);
|
||||
$query->update($db->quoteName('#__componentbuilder_language_translation'))->set($fields)->where($conditions);
|
||||
|
||||
$db->setQuery($query);
|
||||
|
Reference in New Issue
Block a user