Author: jablko
Date: Tue Oct 19 16:35:08 2010
New Revision: 8315
Log:
Use symfony form to render inputs
Modified:
trunk/plugins/sfIsadPlugin/modules/sfIsadPlugin/actions/eventComponent.class.php
trunk/plugins/sfIsadPlugin/modules/sfIsadPlugin/templates/_event.php
Modified:
trunk/plugins/sfIsadPlugin/modules/sfIsadPlugin/actions/eventComponent.class.php
==============================================================================
---
trunk/plugins/sfIsadPlugin/modules/sfIsadPlugin/actions/eventComponent.class.php
Tue Oct 19 16:27:28 2010 (r8314)
+++
trunk/plugins/sfIsadPlugin/modules/sfIsadPlugin/actions/eventComponent.class.php
Tue Oct 19 16:35:08 2010 (r8315)
@@ -57,13 +57,6 @@
}
}
- public function execute($request)
- {
- parent::execute($request);
-
- $this->form->getWidgetSchema()->setNameFormat('editEvents[new][%s]');
- }
-
/**
* ISAD form only allows entering data for creation dates and creator names,
* as two separate events.
Modified: trunk/plugins/sfIsadPlugin/modules/sfIsadPlugin/templates/_event.php
==============================================================================
--- trunk/plugins/sfIsadPlugin/modules/sfIsadPlugin/templates/_event.php
Tue Oct 19 16:27:28 2010 (r8314)
+++ trunk/plugins/sfIsadPlugin/modules/sfIsadPlugin/templates/_event.php
Tue Oct 19 16:35:08 2010 (r8315)
@@ -20,33 +20,26 @@
</thead><tbody>
<?php foreach ($resource->getDates() as $i => $eventDate): ?>
+
+ <?php $form->getWidgetSchema()->setNameFormat("editEvents[$i][%s]") ?>
+
<tr class="related_obj_<?php echo $eventDate->id ?>">
<td>
<div class="animateNicely">
<input type="hidden" name="editEvents[<?php echo $i ?>][id]"
value="<?php echo $eventDate->id ?>" />
- <?php if (in_array($eventDate->typeId,
sfIsadPlugin::eventTypes())): ?>
- <select name="editEvents[<?php echo $i ?>][typeId]">
- <?php foreach (sfIsadPlugin::eventTypes() as $item): ?>
- <option value="<?php echo $item->id ?>"<?php if
($eventDate->typeId == $item->id): ?> selected="selected"<?php endif; ?>><?php
echo $item->__toString() ?></option>
- <?php endforeach; ?>
- </select>
- <?php else: ?>
- <select name="editEvents[<?php echo $i ?>][typeId]"
readonly="readonly">
- <option value="<?php echo $eventDate->type->id ?>"
selected="selected"><?php echo $eventDate->type->__toString() ?></option>
- </select>
- <?php endif; ?>
+ <?php echo $form->getWidgetSchema()->renderField('typeId',
$eventDate->typeId) ?>
</div>
</td><td>
<div class="animateNicely">
- <input name="editEvents[<?php echo $i ?>][startDate]'"
value="<?php echo Qubit::renderDate($eventDate->startDate) ?>"/>
+ <?php echo $form->getWidgetSchema()->renderField('startDate',
Qubit::renderDate($eventDate->startDate)) ?>
</div>
</td><td>
<div class="animateNicely">
- <input name="editEvents[<?php echo $i ?>][endDate]'"
value="<?php echo Qubit::renderDate($eventDate->endDate) ?>"/>
+ <?php echo $form->getWidgetSchema()->renderField('endDate',
Qubit::renderDate($eventDate->endDate)) ?>
</div>
</td><td>
<div class="animateNicely">
- <input name="editEvents[<?php echo $i ?>][dateDisplay]'"
value="<?php echo
esc_entities($eventDate->getDateDisplay(array('cultureFallback' => true))) ?>"/>
+ <?php echo $form->getWidgetSchema()->renderField('dateDisplay',
$eventDate->getDateDisplay(array('cultureFallback' => true))) ?>
</div>
</td><td style="text-align: right">
<div class="animateNicely">
@@ -54,6 +47,7 @@
</div>
</td>
</tr>
+
<?php endforeach; ?>
<tr>
--
You received this message because you are subscribed to the Google Groups
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/qubit-commits?hl=en.