Files
Chamilo/plugin/lti_provider/src/Form/FrmAdd.php
T
Xes 73154ae174
Behat tests 1.11.x 🐞 / PHP 7.4 Test on ubuntu-latest (push) Canceled after 0s
PHP-CS-Fixer / composer_install (7.4) (push) Canceled after 0s
Chamilo 1.11.40 (ZIP oficial v1.11.40)
Fuente: https://github.com/chamilo/chamilo-lms/releases/download/v1.11.40/chamilo-1.11.40.zip
sha256: 1cf4bf2cc7bae1ef1a1eff643235db1d552f78ddf4b6dd1e2d2dac9868679439
Snapshot independiente (rama huerfana); diffable vs 1.11.38. vendor incluido.
2026-08-06 17:59:45 +02:00

89 lines
2.6 KiB
PHP

<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\PluginBundle\LtiProvider\Form;
use Chamilo\PluginBundle\Entity\LtiProvider\Platform;
use FormValidator;
use LtiProviderPlugin;
/**
* Class FrmAdd.
*/
class FrmAdd extends FormValidator
{
/**
* @var Platform|null
*/
private $platform;
/**
* FrmAdd constructor.
*/
public function __construct(
string $name,
array $attributes = [],
Platform $platform = null
) {
parent::__construct($name, 'POST', '', '', $attributes, self::LAYOUT_HORIZONTAL);
$this->platform = $platform;
}
/**
* Build the form.
*/
public function build(): void
{
$plugin = LtiProviderPlugin::create();
$this->addHeader($plugin->get_lang('ConnectionDetails'));
$this->addText('issuer', $plugin->get_lang('PlatformName'));
$this->addUrl('auth_login_url', $plugin->get_lang('AuthLoginUrl'));
$this->addUrl('auth_token_url', $plugin->get_lang('AuthTokenUrl'));
$this->addUrl('key_set_url', $plugin->get_lang('KeySetUrl'));
$this->addText('client_id', $plugin->get_lang('ClientId'));
$this->addText('deployment_id', $plugin->get_lang('DeploymentId'));
$this->addText('kid', $plugin->get_lang('KeyId'), false);
$this->addRadio(
'tool_type',
get_lang('ToolProvider'),
[
'quiz' => $plugin->get_lang('Quizzes'),
'lp' => $plugin->get_lang('Learnpaths'),
],
[
'onclick' => 'selectToolProvider(this.value)',
]
);
$this->addElement('html', $plugin->getLearnPathsSelect());
$this->addElement('html', $plugin->getQuizzesSelect());
$this->addButtonCreate($plugin->get_lang('AddPlatform'));
$this->applyFilter('__ALL__', 'trim');
}
public function setDefaultValues(): void
{
$defaults = [];
if (!$this->platform) {
$this->platform = new Platform();
}
$defaults['issuer'] = $this->platform->getIssuer();
$defaults['auth_login_url'] = $this->platform->getAuthLoginUrl();
$defaults['auth_token_url'] = $this->platform->getAuthTokenUrl();
$defaults['key_set_url'] = $this->platform->getKeySetUrl();
$defaults['client_id'] = $this->platform->getClientId();
$defaults['deployment_id'] = $this->platform->getDeploymentId();
$defaults['kid'] = $this->platform->getKid();
$defaults['tool_type'] = 'quiz';
$this->setDefaults($defaults);
}
}