I hope I´m right in this section. Since my searches didn`t give a answer I am able to understand , hopefully somebody is able to help me and make me understand how this works.
I made a new Componente in wich one can add User and Categories. Since this categories differ from the ones joomla provides, i made a new table called component_category (component is not the real name, i don`t want to write it here).
In addition I´ve got a table in wich i store the added user called component (name of the component). So now there are two tables.
My problem is, I want to show in the default view of the Component add-task, a dropdown list or select, in wich all the usere stored in the databse are selectable. This is needed since I want one of those user to be responsible for this category.
The first problem is, how do I display such a select-box with the surname and prename out of the table for the user. And the second problem is, how do i store the selected user in the category table as prename, surname and his user-id?
What i already did:
Model category:
Code: Select all
function _buildQuery()
{
$query = ' SELECT prename, surname FROM #__component ';
return $query;
}
function &getUser()
{
// Load the data
if (empty( $this->_data ))
{
$query = $this->_buildQuery();
$this->_user = $this->_getList( $query );
}
return $this->_user;
}
view.html.php of category:
Code: Select all
$user =& $this->get('User');
Now I found something with wich probably i can do that, but I actually don`t know how:
$lists['user'] = JHTML::_('select.genericlist', $user , 'cid', 'class="inputbox" size="1"','cid', 'name', $category->user);
$this->assignRef('lists', $lists);
with the $category->user, I tried to store the selected item in the table component_category as user but nothing happens.
when i try to display the whole thing in the default.php with:
<?php echo $lists['user']; ?>
nothing happens.
Maybe somebody can tell me the whole way I have to do this.
Greetings,
jmul