AutorÃa | Ultima modificación | Ver Log |
<?php
declare(strict_types=1);
namespace LeadersLinked\Form\Microlearning;
use Laminas\Form\Form;
use Laminas\Db\Adapter\AdapterInterface;
use Laminas\Log\LoggerInterface;
use LeadersLinked\Mapper\CompanySizeMapper;
use LeadersLinked\Mapper\IndustryMapper;
use LeadersLinked\Model\Feed;
use LeadersLinked\Model\MicrolearningTopic;
use LeadersLinked\Model\MicrolearningCapsule;
use LeadersLinked\Model\Company;
class CapsuleEditForm extends Form
{
public function __construct($internal = false)
{
parent::__construct();
$this->setInputFilter(new CapsuleEditFilter());
$this->add([
'name' => 'name',
'type' => \Laminas\Form\Element\Textarea::class,
'attributes' => [
'id' => 'name',
]
]);
$this->add([
'name' => 'description',
'type' => \Laminas\Form\Element\Textarea::class,
'attributes' => [
'id' => 'description',
]
]);
$this->add([
'name' => 'order',
'type' => \Laminas\Form\Element\Text::class,
'attributes' => [
'id' => 'order',
],
]);
$this->add([
'name' => 'file',
'type' => \Laminas\Form\Element\Hidden::class,
'attributes' => [
'id' => 'file',
]
]);
$this->add([
'name' => 'marketplace',
'type' => \Laminas\Form\Element\Hidden::class,
'attributes' => [
'id' => 'marketplace',
]
]);
$this->add([
'name' => 'status',
'type' => \Laminas\Form\Element\Select::class,
'options' => [
'empty_option' => 'LABEL_STATUS',
'value_options' => [
MicrolearningCapsule::STATUS_ACTIVE => 'LABEL_ACTIVE',
MicrolearningCapsule::STATUS_INACTIVE => 'LABEL_INACTIVE',
],
],
'attributes' => [
'id' => 'status',
]
]);
if($internal == Company::INTERNAL_YES) {
$value_options = [
MicrolearningCapsule::PRIVACY_PRIVATE => 'LABEL_PRIVATE',
MicrolearningCapsule::PRIVACY_PUBLIC => 'LABEL_PUBLIC',
];
} else {
$value_options = [
MicrolearningCapsule::PRIVACY_PRIVATE => 'LABEL_PRIVATE',
];
}
$this->add([
'name' => 'privacy',
'type' => \Laminas\Form\Element\Select::class,
'options' => [
'empty_option' => 'LABEL_PRIVACY',
'value_options' => $value_options,
],
'attributes' => [
'id' => 'privacy',
]
]);
if($internal == Company::INTERNAL_YES) {
$value_options = [
MicrolearningCapsule::TYPE_FREE => 'LABEL_FREE',
MicrolearningCapsule::TYPE_SELLING => 'LABEL_SELLING',
MicrolearningCapsule::TYPE_PRIVATE => 'LABEL_PRIVATE',
];
} else {
$value_options = [
MicrolearningCapsule::TYPE_PRIVATE => 'LABEL_PRIVATE',
];
}
$this->add([
'name' => 'type',
'type' => \Laminas\Form\Element\Select::class,
'options' => [
'empty_option' => 'LABEL_TYPE',
'value_options' => $value_options,
],
'attributes' => [
'id' => 'type',
]
]);
$this->add([
'name' => 'cost',
'type' => \Laminas\Form\Element\Text::class,
'attributes' => [
'id' => 'cost',
],
]);
}
}