public function getListUsersForm() { $form = new Form('MailList_users', 'post', '/admin/Mail'); $form->setConstants(array('section' => 'lists')); $form->addElement('hidden', 'section'); $form->setConstants(array('action' => 'updateList')); $form->addElement('hidden', 'action'); $form->setConstants(array('listId' => $this->getId())); $form->addElement('hidden', 'listId'); $users = array(); foreach ($this->getListUsers() as $user) { $users[] = $user->getId(); } $allusers = array(); foreach (MailUser::getAllMailUsers() as $user) { $allusers[$user->getId()] = $user->__toString(); } $form->setDefaults(array('subscribers' => $users)); $ams = $form->addElement('advmultiselect', 'subscribers', null, $allusers, array('style' => 'width: 300px;', 'onblur' => 'changeCallback(this);')); $ams->setLabel(array($this->getName(), 'Available', 'Subscribed to List')); if ($form->validate() && $form->isSubmitted()) { $clean = $form->getSubmitValues(); if (isset($_REQUEST['subscribers-t'])) { foreach ($_REQUEST['subscribers-t'] as $from) { $this->removeListUser($from); } } if (isset($_REQUEST['subscribers-f'])) { foreach ($_REQUEST['subscribers-f'] as $from) { $this->addListUser($from); } } } return $form; }