Skip to content

Commit

Permalink
Dev: Two attributes on each row (CPDB)
Browse files Browse the repository at this point in the history
  • Loading branch information
olleharstedt committed Sep 26, 2016
1 parent c4af27e commit c193db3
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 14 deletions.
3 changes: 2 additions & 1 deletion application/controllers/admin/participantsaction.php
Expand Up @@ -448,8 +448,8 @@ public function openeditparticipant()
$model = new Participant;
$operationType = "add";
}
//Generate HTML for extra Attributes

//Generate HTML for extra Attributes
$extraAttributes = array();
foreach($model->allExtraAttributes as $name => $extraAttribute) {
$value = $model->getParticipantAttribute("", $extraAttribute['attribute_id']);
Expand All @@ -462,6 +462,7 @@ public function openeditparticipant()

$extraAttributes[$name] = $extraAttribute;
}

$aData = array(
'model' => $model,
'editType' => $operationType,
Expand Down
Expand Up @@ -53,7 +53,13 @@
</div>
</div>
<legend><?php eT("Custom attributes"); ?></legend>
<?php foreach($extraAttributes as $name => $attribute): ?>
<?php $i = 0; foreach($extraAttributes as $attribute): $i++; ?>

<!-- Two inputs on each row -->
<?php if ($i % 2 == 0): ?>
<div class='form-group'>
<?php endif; ?>

<?php switch ($attribute['attribute_type']):

// Text box
Expand All @@ -72,6 +78,12 @@
<?php break; ?>

<?php endswitch; ?>

<!-- Close form-group div -->
<?php if ($i % 2 == 0): ?>
</div>
<?php endif; ?>

<?php endforeach; ?>
</div>
<div class="modal-footer">
Expand Down
@@ -1,7 +1,6 @@
<div class="form-horizontal form-group">
<label class="col-sm-4 control-label" for="datepickerInputField_[<?php echo $name; ?>]"><?php echo $defaultname; ?></label>
<label class="col-sm-2 control-label" for="datepickerInputField_[<?php echo $name; ?>]"><?php echo $defaultname; ?></label>
<div>
<div class='col-sm-8'>
<div class='col-sm-4'>
<input class="form-control" name="datepickerInputField_<?php echo $name; ?>" id="datepickerInputField_<?php echo $name; ?>" type="text" value="<?php echo $value; ?>">
<input name="Attributes[<?php echo $name; ?>]" id="Attributes_<?php echo $name; ?>" type="hidden" value="<?php echo $value; ?>">
<script type="text/javascript">
Expand All @@ -14,4 +13,3 @@
</script>
</div>
</div>
</div>
@@ -1,7 +1,6 @@
<div class="form-horizontal form-group">
<label class="col-sm-4 control-label" for="datepickerInputField_[<?php echo $name; ?>]"><?php echo $defaultname; ?></label>
<label class="col-sm-2 control-label" for="datepickerInputField_[<?php echo $name; ?>]"><?php echo $defaultname; ?></label>
<div>
<div class='col-sm-8'>
<div class='col-sm-4'>
<select class="form-control" name="Attributes[<?php echo $name; ?>]" id="Attributes_<?php echo $name; ?>">
<option></option> <!-- Nothing selected -->
<?php foreach ($options as $option): ?>
Expand All @@ -15,4 +14,3 @@
</select>
</div>
</div>
</div>
@@ -1,8 +1,6 @@
<div class="form-group">
<label class="col-sm-4 control-label" for="Attributes[<?php echo $name; ?>]"><?php echo $defaultname; ?></label>
<label class="col-sm-2 control-label" for="Attributes[<?php echo $name; ?>]"><?php echo $defaultname; ?></label>
<div>
<div class='col-sm-8'>
<div class='col-sm-4'>
<input class="form-control" name="Attributes[<?php echo $name; ?>]" id="Attributes_<?php echo $name; ?>" type="text" maxlength="254" value="<?php echo $value; ?>">
</div>
</div>
</div>

0 comments on commit c193db3

Please sign in to comment.