PermissionsTableForm.class.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. /**
  3. * PermissionsTable form.
  4. *
  5. * @package usic
  6. * @subpackage form
  7. * @author Your name here
  8. * @version SVN: $Id: sfPropelFormTemplate.php 10377 2008-07-21 07:10:32Z dwhittle $
  9. */
  10. include sfConfig::get('sf_lib_dir').'/utilities.php';
  11. class PermissionsTableForm extends BasePermissionsTableForm
  12. {
  13. public function configure()
  14. {
  15. // $gids = PermissionsTablePeer::getGids();
  16. $gids = getGroups();
  17. $this->widgetSchema['gid'] = new sfWidgetFormChoice( array('choices' => $gids ) );
  18. $this->validatorSchema['gid'] = new sfValidatorChoice( array('choices' => array_keys($gids), 'required' => true) );
  19. $modes = PermissionsTablePeer::getModes();
  20. $this->widgetSchema['mode'] = new sfWidgetFormChoice( array('choices' => array_combine($modes, $modes)) );
  21. $this->validatorSchema['mode'] = new sfValidatorChoice( array('choices' => $modes, 'required' => true) );
  22. $this->validatorSchema['change_at']->setOption('required', false);
  23. $this->validatorSchema['change_login']->setOption('required', false);
  24. }
  25. protected function doSave($con = null)
  26. {
  27. $this->values['change_login'] = sfContext::getInstance()->getUser()->getAttribute('login');
  28. return parent::doSave($con);
  29. }
  30. }