views/merging/_public_version_content.php
Rama main · réplica de lectura del repositorio original.
<?php
use app\models\db\Motion;
use app\models\mergeAmendments\Draft;
use app\models\sectionTypes\ISectionType;
use app\models\sectionTypes\SectionLanguageMode;
use app\models\sectionTypes\TextSimple;
use app\components\Html;
/**
* @var Motion $motion
* @var Draft $draft
*/
$changesets = [];
// All languages: merging amendments into the motion must handle every language section.
foreach ($motion->getSortedSections(false, false, SectionLanguageMode::AllLanguages) as $section) {
$type = $section->getSettings();
if ($type->type === ISectionType::TYPE_TITLE) {
$content = ($draft->sections[$section->sectionId] ?? '');
$htmlId = 'sections_' . $type->id;
echo '<div class="form-group paragraph" id="section_holder_' . $type->id . '">';
echo '<label for="' . $htmlId . '">' . Html::encode($type->title) . '</label>';
echo '<div class="text motionTextFormattings textOrig ICE-Tracking';
if ($section->getSettings()->fixedWidth) {
echo ' fixedWidthFont';
}
echo '" id="' . $htmlId . '">' . Html::encode($content);
echo '</div></div>';
} elseif ($type->type === ISectionType::TYPE_TEXT_SIMPLE) {
/** @var TextSimple $simpleSection */
$simpleSection = $section->getSectionType();
$htmlId = 'sections_' . $type->id;
echo '<div class="form-group paragraph" id="section_holder_' . $type->id . '">';
echo '<label for="' . $htmlId . '">' . Html::encode($type->title) . '</label>';
echo '<div class="text motionTextFormattings textOrig ICE-Tracking';
if ($section->getSettings()->fixedWidth) {
echo ' fixedWidthFont';
}
echo '" id="' . $htmlId . '">';
$paragraphs = [];
foreach ($section->getTextParagraphLines() as $para) {
$paragraphs[] = $draft->paragraphs[$section->sectionId . '_' . $para->paragraphWithLineSplit]->text;
}
echo implode("\n", $paragraphs);
echo '</div></div>';
} else {
// @TODO Support drafts
echo $section->getSectionType()->getSimple(false);
}
}