ここの情報は古いです。ご理解頂いた上でお取り扱いください。

Changeset 7930


Ignore:
Timestamp:
Aug 6, 2008, 5:58:57 PM (14 years ago)
Author:
ebihara
Message:

#2884:プロフィール選択肢の追加がおこなえるようにした

Location:
OpenPNE3/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • OpenPNE3/trunk/apps/pc_backend/modules/profile/actions/actions.class.php

    r7929 r7930  
    2525        $this->option_form[$value->getId()][$option->getId()] = new ProfileOptionForm(ProfileOptionPeer::retrieveByPk($option->getId()));
    2626      }
     27      $newProfileOption = new ProfileOption();
     28      $newProfileOption->setProfileId($value->getId());
     29      $this->option_form[$value->getId()][] = new ProfileOptionForm($newProfileOption);
    2730    }
    2831  }
  • OpenPNE3/trunk/apps/pc_backend/modules/profile/templates/listSuccess.php

    r7929 r7930  
    3939<h3>プロフィール選択肢一覧</h3>
    4040<?php foreach ($profiles as $value): ?>
    41 <?php if ($value->countProfileOptions()) : ?>
     41<?php if ($value->getFormType() == 'radio' || $value->getFormType() == 'checkbox' || $value->getFormType() == 'select') : ?>
    4242
    4343<h4><?php echo $value->getCaption() ?></h4>
     
    4949<th colspan="2">操作</th>
    5050</tr></thead>
    51 <?php foreach ($value->getProfileOptions() as $option) : ?>
    52 <form action="<?php echo url_for('profile/editOption?id=' . $option->getId()) ?>" method="post">
     51<?php foreach ($option_form[$value->getId()] as $form) : ?>
     52<form action="<?php echo url_for('profile/editOption?id=' . $form->getObject()->getId()) ?>" method="post">
    5353<tr>
    54 <td><?php echo $option->getId() ?></td>
     54<td><?php echo ($form->getObject()->isNew() ? '-' : $form->getObject()->getId()) ?></td>
    5555<td>
    56 <?php echo $option_form[$value->getId()][$option->getId()]['ja_JP']['value']->render() ?>
     56<?php echo $form['ja_JP']['value']->render() ?>
    5757</td>
    5858<td>
    59 <?php echo $option_form[$value->getId()][$option->getId()]['sort_order']->render() ?>
     59<?php echo $form['sort_order']->render() ?>
    6060</td>
     61<?php if ($form->getObject()->isNew()) : ?>
     62<td colspan="2">
     63<?php echo $form['profile_id']->render() ?>
     64<input type="submit" value="項目追加" />
     65</td>
     66</form>
     67<?php else : ?>
    6168<td>
    62 <?php echo $option_form[$value->getId()][$option->getId()]['id']->render() ?>
     69<?php echo $form['id']->render() ?>
     70<?php echo $form['profile_id']->render() ?>
    6371<input type="submit" value="変更" />
    6472</td>
    6573</form>
    6674<td>
    67 <form action="<?php echo url_for('profile/deleteOption?id=' . $option->getId()) ?>" method="post">
     75<?php echo $form['id']->render() ?>
     76<?php echo $form['profile_id']->render() ?>
     77<form action="<?php echo url_for('profile/deleteOption?id=' . $form->getObject()->getId()) ?>" method="post">
    6878<input type="submit" value="削除" />
    6979</form>
    7080</td>
     81<?php endif; ?>
    7182</tr>
    7283<?php endforeach; ?>
  • OpenPNE3/trunk/lib/form/ProfileOptionForm.class.php

    r7928 r7930  
    1919    $this->setWidgets(array(
    2020      'id'         => new sfWidgetFormInputHidden(),
     21      'profile_id'         => new sfWidgetFormInputHidden(),
    2122      'sort_order' => new sfWidgetFormInput($options),
    2223    ));
     
    2425    $this->setValidators(array(
    2526      'id'         => new sfValidatorPropelChoice(array('model' => 'ProfileOption', 'column' => 'id', 'required' => false)),
     27      'profile_id'         => new sfValidatorPropelChoice(array('model' => 'Profile', 'column' => 'id', 'required' => true)),
    2628      'sort_order' => new sfValidatorInteger(array('required' => false)),
    2729    ));
Note: See TracChangeset for help on using the changeset viewer.