1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12:
13: class Hermes_Form_Deliverable_ClientSelector extends Horde_Form
14: {
15: public function __construct(&$vars)
16: {
17: parent::Horde_Form($vars, _("Select Client"));
18: $action = &Horde_Form_Action::factory('submit');
19: list($clienttype, $clientparams) = $this->getClientType();
20:
21: $cli = &$this->addVariable(_("Client"), 'client_id', $clienttype, true, false, null, $clientparams);
22: $cli->setAction($action);
23: $this->setButtons(_("Edit Deliverables"));
24: }
25:
26: public function getClientType()
27: {
28: try {
29: $clients = Hermes::listClients();
30: } catch (Hermes_Exception $e) {
31: return array('invalid', array(sprintf(_("An error occurred listing clients: %s"),
32: $clients->getMessage())));
33: }
34: if (count($clients)) {
35: return array('enum', array($clients));
36: } else {
37: return array('invalid', array(_("There are no clients which you have access to.")));
38: }
39: }
40:
41: }