<script>
YAHOO.util.Event.onDOMReady(function () {
    COMMID.loader.insert(
        // "connection" is required by COMMID.personalInfo.edit()
        ["connection"],
        null
    );
});
</script>
<div id="article">
    <div id="generalTab" class="dataSection">
        <div class="formHeader">
            <h2><?php echo $this->translate('Personal Info') ?></h2>
        </div>
        <div style="margin:10px 0">
            <em><?php echo $this->translate('This information will be used to automatically populate registration fields to any OpenID transaction that requires so') ?></em>
        </div>
        <? $i= 0; foreach ($this->profiles as $profile): ?>
            <? $i++ ?>
            <div id="personalInfo" style="position:relative; margin-bottom:15px; padding:20px; border:1px solid #999; -moz-border-radius:10px; -webkit-border-radius:10px">
                <div style="position:absolute; right:10px; top:10px">
                    <a href="<?= $this->base ?>/users/personalinfo/edit/profile/<?= $profile->id ?>">
                        <?= $this->translate('Edit profile') ?>
                    </a>
                    <? if ($i > 1 || count($this->profiles) > 1): ?>
                        <form id="deleteprofile_<?= $profile->id ?>" method="post" action="<?= $this->base ?>/users/personalinfo/delete">
                            <input type="hidden" name="profile" value="<?= $profile->id ?>" />
                            <a href="#" onclick="COMMID.personalInfo.erase(<?= $profile->id ?>); return false;">
                                <?= $this->translate('Delete profile') ?>
                            </a>
                        </form>
                    <? endif ?>
                </div>
                <div class="formGrid">
                    <div class="yui-gf">
                        <div class="yui-u first">
                            <?= $this->translate('Profile Name') ?>:
                        </div>
                        <div class="yui-u">
                            <?= $profile->name ?>
                        </div>
                    </div>
                    <?php foreach ($profile->getFields() as $field): ?>
                        <div class="yui-gf">
                            <div class="yui-u first">
                                <?= $this->translate($field->name) ?>:
                            </div>
                            <div class="yui-u">
                                <?= (!$field->value)? $this->translate('Not Entered') : $field->value  ?>
                            </div>
                        </div>
                    <?php endforeach ?>
                </div>
            </div>
        <? endforeach ?>
        <div style="text-align:right; margin-top:20px">
            <a href="<?= $this->base ?>/users/personalinfo/edit"><?= $this->translate('Add another profile') ?></a>
        </div>
    </div>
</div>
