Try using the postSaveHook method which allows the controller to access model data after it has been saved.
public function postSaveHook($model, $validData)
$item = $model->getItem();
$my_new_group_id = $item->get('id');
$row contains inserted data with PK. So $row->id is id of the saved data.
So you can do
public static function CreateMail($userid, $title, $state = 1)
$maildata['userid'] = $userid;
$maildata['title'] = $title;
$maildata['state'] = $state;
Class JTable is created to work strictly on database object. Table object should create,modify,delete,check data in database. It can be used in many models, helpers, modules. Single model some times have to use multiple tables and it can happen in many models. If you use JTable you don't have to rewrite SQL in every model just to retrieve or modify a single ...
I assume you have 2 tables and you want to display a list of items from table 1 but add also some data from table 2 (like the total sum) for each item.
If you want to use default Joomla functionality you have to get the total sum in your list query for the first table. This can be done with the help of subselects (MySQL subqueries). You won't be able to use ...
You can just execute it in the same way than a simple query.
$row = $db->loadObject();
Of course, it would be very difficult to translate the SQL statement to build it with Query API $query->select(...)->from(...).
It is better to just handle the query with a big string, avoiding PHP performance bottlenecks.
The filter fields list is a configuration option for ordering purposes, it's a white list of field names that are permitted for usage in queries, so apparently you can use a.field1 for instance as query specific.
So in your view, you write something like this:
<?php echo JHtml::_('grid.sort', 'COM_MYCOMPONENT_NAME', 'name', $listDirn, $listOrder); ?>
Even though this is an old post. I wanted to post one of the solutions that helped me.
$groupModel = JModelLegacy::getInstance( 'Group', 'UsersModel' );
$groupId = $groupModel->getState('group.id');
I don't see where in your code you are outputting the object that you mentioned, normally the query produced by getListQuery should result in an array. I'm presuming that object is an example of one that might be contained within the array?
If so then I would replace your group concat as follows
In the most generic way, you can write a query to load the articles in a list. Or, you can work with the article model.
You can check how it works in a content module or in content component:
// Get an instance of the generic articles model
$model = JModelLegacy::getInstance('Articles', '...
By default, each http request is independent. You have to send all parameters again in each call.
Alternatively, if your client can keep session cookies, then you can store server-side variables in user session to keep an state between http requests.
$session = JFactory::getSession();
$session = JFactory::getSession();
It appears you are submitting the from without executing the validation. Using jQuery, you could listen for the form submit event, check validation and submit the form if it passes.
At the top of your PHP file add the following to load the jQuery library:
Add the below JS to the page inside a script tag:
I suspect in the context this is being used, you might want to put ignore_request to true?
I believe ContentModelArticles::getItems calls ContentModelArticles::populateState (through ContentModelArticles::getListQuery which in turn call ContentModelArticles::getState) which in turn run the code
$value = $app->input->get('limit', $app->get('...
GROUP_CONCAT is a performance killer. Not to mention that in your query it is possible that it will join rows before it will filter them. So will waste a lot of memory and cpu time on bigger data sets.
I would remove this:
$query->select('GROUP_CONCAT(cast(concat(tma.filename,\', \',tma.filepath)AS char) SEPARATOR \', \') AS attachments')
On Linux the best you can do is work out the last modified time of a certain file by using filetime (http://php.net/filemtime).
So to work out the Joomla installation date you could run filetime on a file that is not likely to have been edited /components/index.html.
You could use the same principle for extensions by doing :