Cześć, mam pewien problem, który jest pewnie banalny do rozwiązania ale nie umiem tego sam znaleźć.
Mam taki kodzik:
protected function manage()
{
$skins = [1 => '', 2 => ''];
$formChar = new \IPS\Helpers\Form( 'form', 'report_submit' );
$formChar->addHeader(\IPS\Member::loggedIn()->language()->addToStack( 'gamecp_createchar_header_1' ));
$formChar->add( new \IPS\Helpers\Form\Text( \IPS\Member::loggedIn()->language()->addToStack( 'gamecp_createchar_text_1'), NULL, FALSE,
array( 'options' => array( 'minLength' => 2, 'maxLength' => 20 )), NULL, NULL, NULL, 'imie' ) );
$formChar->add( new \IPS\Helpers\Form\Text( \IPS\Member::loggedIn()->language()->addToStack( 'gamecp_createchar_text_2'), NULL, FALSE,
array( 'options' => array( 'minLength' => 2, 'maxLength' => 20 )), NULL, NULL, NULL, 'nazwisko' ) );
$formChar->add( new \IPS\Helpers\Form\Number( \IPS\Member::loggedIn()->language()->addToStack( 'gamecp_createchar_text_3'), NULL, FALSE,
array( 'options' => array( 'min' => 5, 'max' => 100 )), NULL, NULL, NULL, 'wiek' ) );
$formChar->add(new \IPS\Helpers\Form\TextArea(\IPS\Member::loggedIn()->language()->addToStack( 'gamecp_createchar_text_5'), NULL, FALSE,
array( 'options' => array( 'minLength' => 40,
'maxLength' => 300,
'disabled' => FALSE,
'placeholder' => NULL,
'nullLang' => NULL,
'tags' => array(),
'rows' => NULL,
'class' => 'ipsField_codeInput')), NULL, NULL, NULL, 'desc' ));
foreach ( \IPS\Db::i()->select( '*', 'rp_skins') as $row) {
$skins[$row['sex']] .= '<img src=\'skiny/Skin_' .$row['id'] . '.png\' class=\'skinItem\' id=\'s' . $row['id'] . '\' alt=\'\' /> ';
}
$formChar->addHeader('Ubrania i płeć');
$formChar->add( new \IPS\Helpers\Form\Select( \IPS\Member::loggedIn()->language()->addToStack( 'gamecp_createchar_text_4'), NULL, FALSE,
array( 'options' => array( 0 => '---', 1 => 'Mężczyzna', 2 => 'Kobieta' )), NULL, NULL, \IPS\Theme::i()->getTemplate( 'main' )->skinForm($skins), 'plec' ) );
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack( 'gamecp_title' );
$formChar->addMessage('Ubrania wyświetlą się po wybraniu płci postaci.');
$formChar->class = 'ipsForm_horizontal';
if ( $values = $formChar->values() )
{
/*\IPS\Db::i()->insert( 'rp_characters', array('name' => $values['elInput_imie']
);*/
$formChar->addMessage('asdfasdf '.\IPS\Request::i()->elInput_imie);
}
// This is the default method if no 'do' parameter is specified
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'main' )->createCharacter($formChar);
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'skins.js', 'gamecp', 'interface' ) );
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'front_createCharacter.js', 'gamecp' ) );
}
I problem jest w tym, że gdy chce pobrać dane za pomocą Request to nie wyświetla się nic(wpisuje imie oraz elInput_imie, z pola id="" w HTML) oraz, gdy używam $values to zwraca mi, że nie potrafi znaleźć takich indexów. Ktoś wie jak to naprawić? Po plikach IPS'u nie mogę się połapać jak pobierają te dane z formularzy.