コード例 #1
0
ファイル: MessageForm.php プロジェクト: rsanders16/NexusPlus
 public function configure()
 {
     $friend_array = array();
     $friends = FriendTable::getFriendsOfUid($this->uid);
     $count = 0;
     foreach ($friends as $friend) {
         $friend_array[$friend->getUid()] = $friend->getName();
         $count++;
     }
     //echo $count;
     //die;
     $this->setWidgets(array('recipients' => new sfWidgetFormChoice(array('multiple' => true, 'choices' => $friend_array)), 'subject' => new sfWidgetFormInput(), 'message' => new sfWidgetFormInput()));
     $this->setValidators(array('recipients' => new sfValidatorString(array('required' => false)), 'subject' => new sfValidatorString(array('required' => false)), 'message' => new sfValidatorString(array('required' => false))));
     $this->widgetSchema->setNameFormat('message[%s]');
 }
コード例 #2
0
 public function executeNewMessage(sfWebRequest $request)
 {
     $friend_array = array();
     if ($request->hasParameter('uid')) {
         $profile = Doctrine_Core::getTable('Profile')->findOneByUid($request->getParameter('uid'));
         $friend_array[$profile->uid] = $profile->name;
     } else {
         $friends = FriendTable::getFriendsOfUid($this->getUser()->getAttribute('id'));
         $count = 0;
         foreach ($friends as $friend) {
             $friend_array[$friend->getUid()] = $friend->getName();
             $count++;
         }
     }
     $this->form = new MessageForm($this->getUser()->getAttribute('id'));
     $this->form->setWidget('recipients', new sfWidgetFormChoice(array('multiple' => true, 'choices' => $friend_array)));
     //$this->form->setDefault('recipients', 4);
 }
コード例 #3
0
 public function getFriends()
 {
     return FriendTable::getFriendsOfUid($this->uid);
 }