Added the feature to add custom Joomla fields to your components, requested in gh-247. Added plugin events to the dynamic get area. Added the script to remove field build in relation to component when component gets uninstalled. Improved the getForm method in the model to allow the passing of options to the form. Made further improvements to the implementation of the return parameter across the component redirecting behavior. Made some changes to the list layout views using the field relations area.
This commit is contained in:
@ -29,8 +29,11 @@ class ComponentbuilderModelSite_views extends JModelList
|
||||
'a.modified_by','modified_by',
|
||||
'a.system_name','system_name',
|
||||
'a.name','name',
|
||||
'a.codename','codename',
|
||||
'a.description','description'
|
||||
'a.description','description',
|
||||
'a.main_get','main_get',
|
||||
'a.context','context',
|
||||
'a.add_php_ajax','add_php_ajax',
|
||||
'a.add_custom_button','add_custom_button'
|
||||
);
|
||||
}
|
||||
|
||||
@ -57,11 +60,20 @@ class ComponentbuilderModelSite_views extends JModelList
|
||||
$name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name');
|
||||
$this->setState('filter.name', $name);
|
||||
|
||||
$codename = $this->getUserStateFromRequest($this->context . '.filter.codename', 'filter_codename');
|
||||
$this->setState('filter.codename', $codename);
|
||||
|
||||
$description = $this->getUserStateFromRequest($this->context . '.filter.description', 'filter_description');
|
||||
$this->setState('filter.description', $description);
|
||||
$this->setState('filter.description', $description);
|
||||
|
||||
$main_get = $this->getUserStateFromRequest($this->context . '.filter.main_get', 'filter_main_get');
|
||||
$this->setState('filter.main_get', $main_get);
|
||||
|
||||
$context = $this->getUserStateFromRequest($this->context . '.filter.context', 'filter_context');
|
||||
$this->setState('filter.context', $context);
|
||||
|
||||
$add_php_ajax = $this->getUserStateFromRequest($this->context . '.filter.add_php_ajax', 'filter_add_php_ajax');
|
||||
$this->setState('filter.add_php_ajax', $add_php_ajax);
|
||||
|
||||
$add_custom_button = $this->getUserStateFromRequest($this->context . '.filter.add_custom_button', 'filter_add_custom_button');
|
||||
$this->setState('filter.add_custom_button', $add_custom_button);
|
||||
|
||||
$sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int');
|
||||
$this->setState('filter.sorting', $sorting);
|
||||
@ -111,10 +123,59 @@ class ComponentbuilderModelSite_views extends JModelList
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// set selection value to a translatable value
|
||||
if (ComponentbuilderHelper::checkArray($items))
|
||||
{
|
||||
foreach ($items as $nr => &$item)
|
||||
{
|
||||
// convert add_php_ajax
|
||||
$item->add_php_ajax = $this->selectionTranslation($item->add_php_ajax, 'add_php_ajax');
|
||||
// convert add_custom_button
|
||||
$item->add_custom_button = $this->selectionTranslation($item->add_custom_button, 'add_custom_button');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// return items
|
||||
return $items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to convert selection values to translatable string.
|
||||
*
|
||||
* @return translatable string
|
||||
*/
|
||||
public function selectionTranslation($value,$name)
|
||||
{
|
||||
// Array of add_php_ajax language strings
|
||||
if ($name === 'add_php_ajax')
|
||||
{
|
||||
$add_php_ajaxArray = array(
|
||||
1 => 'COM_COMPONENTBUILDER_SITE_VIEW_YES',
|
||||
0 => 'COM_COMPONENTBUILDER_SITE_VIEW_NO'
|
||||
);
|
||||
// Now check if value is found in this array
|
||||
if (isset($add_php_ajaxArray[$value]) && ComponentbuilderHelper::checkString($add_php_ajaxArray[$value]))
|
||||
{
|
||||
return $add_php_ajaxArray[$value];
|
||||
}
|
||||
}
|
||||
// Array of add_custom_button language strings
|
||||
if ($name === 'add_custom_button')
|
||||
{
|
||||
$add_custom_buttonArray = array(
|
||||
1 => 'COM_COMPONENTBUILDER_SITE_VIEW_YES',
|
||||
0 => 'COM_COMPONENTBUILDER_SITE_VIEW_NO'
|
||||
);
|
||||
// Now check if value is found in this array
|
||||
if (isset($add_custom_buttonArray[$value]) && ComponentbuilderHelper::checkString($add_custom_buttonArray[$value]))
|
||||
{
|
||||
return $add_custom_buttonArray[$value];
|
||||
}
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -136,9 +197,9 @@ class ComponentbuilderModelSite_views extends JModelList
|
||||
// From the componentbuilder_item table
|
||||
$query->from($db->quoteName('#__componentbuilder_site_view', 'a'));
|
||||
|
||||
// From the componentbuilder_snippet table.
|
||||
$query->select($db->quoteName('g.name','snippet_name'));
|
||||
$query->join('LEFT', $db->quoteName('#__componentbuilder_snippet', 'g') . ' ON (' . $db->quoteName('a.snippet') . ' = ' . $db->quoteName('g.id') . ')');
|
||||
// From the componentbuilder_dynamic_get table.
|
||||
$query->select($db->quoteName('g.name','main_get_name'));
|
||||
$query->join('LEFT', $db->quoteName('#__componentbuilder_dynamic_get', 'g') . ' ON (' . $db->quoteName('a.main_get') . ' = ' . $db->quoteName('g.id') . ')');
|
||||
|
||||
// Filter by published state
|
||||
$published = $this->getState('filter.published');
|
||||
@ -176,10 +237,25 @@ class ComponentbuilderModelSite_views extends JModelList
|
||||
else
|
||||
{
|
||||
$search = $db->quote('%' . $db->escape($search) . '%');
|
||||
$query->where('(a.system_name LIKE '.$search.' OR a.name LIKE '.$search.' OR a.codename LIKE '.$search.' OR a.description LIKE '.$search.')');
|
||||
$query->where('(a.system_name LIKE '.$search.' OR a.name LIKE '.$search.' OR a.description LIKE '.$search.' OR a.main_get LIKE '.$search.' OR g.name LIKE '.$search.' OR a.context LIKE '.$search.' OR a.codename LIKE '.$search.')');
|
||||
}
|
||||
}
|
||||
|
||||
// Filter by main_get.
|
||||
if ($main_get = $this->getState('filter.main_get'))
|
||||
{
|
||||
$query->where('a.main_get = ' . $db->quote($db->escape($main_get)));
|
||||
}
|
||||
// Filter by Add_php_ajax.
|
||||
if ($add_php_ajax = $this->getState('filter.add_php_ajax'))
|
||||
{
|
||||
$query->where('a.add_php_ajax = ' . $db->quote($db->escape($add_php_ajax)));
|
||||
}
|
||||
// Filter by Add_custom_button.
|
||||
if ($add_custom_button = $this->getState('filter.add_custom_button'))
|
||||
{
|
||||
$query->where('a.add_custom_button = ' . $db->quote($db->escape($add_custom_button)));
|
||||
}
|
||||
|
||||
// Add the list ordering clause.
|
||||
$orderCol = $this->state->get('list.ordering', 'a.id');
|
||||
@ -247,14 +323,16 @@ class ComponentbuilderModelSite_views extends JModelList
|
||||
|
||||
// decode php_document
|
||||
$item->php_document = base64_decode($item->php_document);
|
||||
// decode php_jview
|
||||
$item->php_jview = base64_decode($item->php_jview);
|
||||
// decode default
|
||||
$item->default = base64_decode($item->default);
|
||||
// decode php_view
|
||||
$item->php_view = base64_decode($item->php_view);
|
||||
// decode default
|
||||
$item->default = base64_decode($item->default);
|
||||
// decode php_jview_display
|
||||
$item->php_jview_display = base64_decode($item->php_jview_display);
|
||||
// decode php_jview
|
||||
$item->php_jview = base64_decode($item->php_jview);
|
||||
// decode php_model
|
||||
$item->php_model = base64_decode($item->php_model);
|
||||
// decode javascript_file
|
||||
$item->javascript_file = base64_decode($item->javascript_file);
|
||||
// decode js_document
|
||||
@ -267,8 +345,6 @@ class ComponentbuilderModelSite_views extends JModelList
|
||||
$item->php_ajaxmethod = base64_decode($item->php_ajaxmethod);
|
||||
// decode php_controller
|
||||
$item->php_controller = base64_decode($item->php_controller);
|
||||
// decode php_model
|
||||
$item->php_model = base64_decode($item->php_model);
|
||||
// unset the values we don't want exported.
|
||||
unset($item->asset_id);
|
||||
unset($item->checked_out);
|
||||
@ -331,8 +407,11 @@ class ComponentbuilderModelSite_views extends JModelList
|
||||
$id .= ':' . $this->getState('filter.modified_by');
|
||||
$id .= ':' . $this->getState('filter.system_name');
|
||||
$id .= ':' . $this->getState('filter.name');
|
||||
$id .= ':' . $this->getState('filter.codename');
|
||||
$id .= ':' . $this->getState('filter.description');
|
||||
$id .= ':' . $this->getState('filter.description');
|
||||
$id .= ':' . $this->getState('filter.main_get');
|
||||
$id .= ':' . $this->getState('filter.context');
|
||||
$id .= ':' . $this->getState('filter.add_php_ajax');
|
||||
$id .= ':' . $this->getState('filter.add_custom_button');
|
||||
|
||||
return parent::getStoreId($id);
|
||||
}
|
||||
|
Reference in New Issue
Block a user