Hi, I've created function like this:
function genForm($iId) {
$aForm = array(
'form_attrs' =>array(
'name' => 'add_friend_to_event',
'action' => '',
'method' => 'post',
),
'params' => array (
'db' => array(
'table' => 'events_users',
'key' => 'id',
'submit_name' => 'submit_form',
),
),
'inputs' => array(
'nickname' => array(
'type' => 'text',
'name' => 'id_participant',
'db' => array(
'pass' => 'text'
),
),
'hidden' => array(
'type' => 'hidden',
'name' => 'id_event',
'values' => $iId,
),
'submit' => array(
'type' => 'submit',
'name' => 'submit_form',
'value' => _t('_Submit'),
'colspan' => true,
)
)
);
return $aForm;
}
And I've got a loop foreach like this:
foreach ($aEvents as $sKey => $aRow) { // add human readable values to the resulted array
$iId = $aEvents[$sKey]['Id'] = $aRow['Id'];//$form = array ()form arrays itd type hidden value = aevents[idevents]
$aEvents[$sKey]['Subject'] = $aRow['Subject'];
$aEvents[$sKey]['Description'] = $aRow['Description'];
$aEvents[$sKey]['Location'] = $aRow['Location'];
$sStartTime = ($aEvents[$sKey]['StartTime'] = $aRow['StartTime']);
$sEndTime = ($aEvents[$sKey]['EndTime'] = $aRow['EndTime']);
$iIsAllDayEvent = ($aEvents[$sKey['IsAllDayEvent']] = $aRow['IsAllDayEvent']);
$addFriend = $this->genForm($iId);
bx_import ('BxTemplFormView'); // import forms class
$oForm = new BxTemplFormView ($addFriend); // create foprms class
$oForm->initChecker(); // init form checker
$form = $oForm -> getCode();
}
In aVars I've got
$aVars = array (
'history',
'bx_repeat:posts' => $aEvents,
'form' => $form,
);
And in edit.html I've got this:
<tbody>
<bx_repeat:posts>
<tr>
<td>__Id__</td>
<td>__Subject__</td>
<td>__Description__</td>
<td>__Location__</td>
<td>__StartTime__</td>
<td>__EndTime__</td>
<td>__form__</td>
</tr>
</bx_repeat:posts>
</tbody>
</table>
I've got a problem, beacause I want to put to form id of each event, ad then user who want to add a friend to event type his name and then, after submit function put into database two values: id_user and id_event, but I have no idea how to do this. Can you help me?