| 91 | | $q = Doctrine::getTable('sfGuardUser')->createQuery('u'); |
| 92 | | |
| 93 | | if ($candidateGroup && $sufficientGroup) |
| 94 | | { |
| 95 | | $q->leftJoin('u.groups g')->addWhere('(g.name IN (?, ?)) OR (u.is_super_admin IS TRUE)', array($candidateGroup, $sufficientGroup)); |
| 96 | | } |
| 97 | | $this->setWidget('author_id', |
| 98 | | new sfWidgetFormDoctrineChoice(array('model' => 'sfGuardUser', 'query' => $q))); |
| 99 | | $this->setValidator('author_id', |
| 100 | | new sfValidatorDoctrineChoice(array('model' => 'sfGuardUser', 'query' => $q, 'required' => false))); |
| | 86 | if($user->hasCredential('admin')) |
| | 87 | { |
| | 88 | $q = Doctrine::getTable('sfGuardUser')->createQuery('u'); |
| | 89 | |
| | 90 | if ($candidateGroup && $sufficientGroup) |
| | 91 | { |
| | 92 | $q->leftJoin('u.groups g')->addWhere('(g.name IN (?, ?)) OR (u.is_super_admin IS TRUE)', array($candidateGroup, $sufficientGroup)); |
| | 93 | } |
| | 94 | $this->setWidget('author_id', |
| | 95 | new sfWidgetFormDoctrineChoice(array('model' => 'sfGuardUser', 'query' => $q))); |
| | 96 | $this->setValidator('author_id', |
| | 97 | new sfValidatorDoctrineChoice(array('model' => 'sfGuardUser', 'query' => $q, 'required' => false))); |
| | 98 | } |
| | 99 | else |
| | 100 | { |
| | 101 | unset($this['author_id']); |
| | 102 | } |
| 108 | | // $this->widgetSchema['tags'] = new sfWidgetFormInput(array('default' => implode(', ', $this->getObject()->getTags())), array('class' => 'tag-input', 'autocomplete' => 'off')); |
| 109 | | // $this->validatorSchema['tags'] = new sfValidatorString(array('required' => false)); |
| | 110 | //$this->widgetSchema['tags'] = new sfWidgetFormInput(array('default' => implode(', ', $this->getObject()->getTags())), array('class' => 'tag-input', 'autocomplete' => 'off')); |
| | 111 | //$this->validatorSchema['tags'] = new sfValidatorString(array('required' => false)); |