<?php
namespace wcf\system\form\element;
+use wcf\system\exception\SystemException;
/**
* Provides a checkbox form element.
* @category Community Framework
*/
class MultipleSelectionFormElement extends AbstractNamedFormElement {
+ /**
+ * @see wcf\system\form\element\AbstractNamedFormElement::setValue()
+ */
+ public function setValue($value) {
+ if (!is_array($value)) {
+ parent::setValue($value);
+ }
+ else {
+ $this->value = array_map(array('wcf\util\StringUtil', 'trim'), $value);
+ }
+ }
+
/**
* @see wcf\system\form\IFormElement::getHTML()
*/
*/
protected function promptPackageDir() {
if (!PackageInstallationFormManager::findForm($this->queue, 'packageDir')) {
+
$container = new container\GroupFormElementContainer();
$packageDir = new element\TextInputFormElement($container);
$packageDir->setName('packageDir');
protected function promptOptionalPackages(array $packages) {
if (!PackageInstallationFormManager::findForm($this->queue, 'optionalPackages')) {
$container = new container\MultipleSelectionFormElementContainer();
+ $container->setName('optionalPackages');
foreach ($packages as $package) {
$optionalPackage = new element\MultipleSelectionFormElement($container);
+ $optionalPackage->setName('optionalPackages');
$optionalPackage->setLabel($package['packageName']);
$optionalPackage->setValue($package['package']);
$document->handleRequest();
$packages = $document->getValue('optionalPackages');
+ if (!empty($packages)) {
+ foreach ($packages as $package) {
+ // haha, this is going to be mad
+
+ }
+ }
die('<pre>'.print_r($packages, true));
}
}