Пример #1
0
 /**
  * @return void
  */
 public function baseInit()
 {
     $model = new Wsclient();
     $result = $model->fetchAll($model->select()->order('client_name'))->toArray();
     $clients = array(0 => '');
     foreach ($result as $val) {
         $clients[$val['id']] = $val['client_name'];
     }
     $this->addElement('select', 'public_ws_client_id', array('label' => 'Klient', 'multiOptions' => $clients));
     $model = new Wsservice();
     $result = $model->fetchAll($model->select()->order('service_name'))->toArray();
     $services = array(0 => '');
     foreach ($result as $val) {
         $services[$val['id']] = $val['service_name'];
     }
     $this->addElement('select', 'public_ws_service_id', array('label' => 'Usługa', 'multiOptions' => $services));
     $this->addElement('text', 'ip', array('label' => 'Adres IP'));
     $this->addElement('text', 'function_name', array('label' => 'Funkcja'));
     $this->addElement('text', 'function_revision', array('label' => 'Rewizja'));
     $this->addElement('select', 'priority', array('label' => 'Kody odpowiedzi', 'multiOptions' => $this->addClearStart(array(200, 401, 402, 405, 406, 407, 410, 415, 416, 420, 421, 422, 423, 424, 425, 430, 431, 432, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 450, 451, 452, 453, 501, 510, 511, 512, 520))));
     $this->datetimee(false, 'created_at_from', 'Data od', false);
     $this->datetimee(false, 'created_at_to', 'Data do', false);
     $this->search();
     $this->reset();
 }
Пример #2
0
 /**
  * zwraca tablice ip z wszystkich rekordów klienta
  *   
  * @param integer $id
  * @return array
  */
 public function getIpListByClientId($id)
 {
     $clientModel = new Wsclient();
     $clientRow = $clientModel->findOne($id);
     if (null === $clientRow) {
         throw new Exception("Client Row with id = {$id} not found!");
     }
     $wsIpRows = $clientRow->findManyToManyRowset('WsSaveIp', 'WsClientHasWsSaveip');
     return $wsIpRows;
 }
Пример #3
0
 protected function updateWsClientaction()
 {
     $sql = 'SELECT id,login,first_name,surname,email from "user" where ws_client_id is null';
     $model = new User();
     $u = $model->getAdapter()->query($sql);
     $users = $u->fetchAll();
     foreach ($users as $user) {
         $values = array();
         $clientModel = new Wsclient();
         $clientData = array('client_name' => $user['login'], 'pm_name' => $user['first_name'] . ' ' . $user['surname'], 'pm_email' => $user['email'], 'ip_address' => array());
         $newClient = $clientModel->createRow($clientData);
         $values['ws_client_id'] = $newClient->save();
         $row = $model->findOne($user['id']);
         $row->setFromArray($values);
         $row->save();
     }
 }
Пример #4
0
 /**
  * @return void
  */
 public function baseInit()
 {
     $dict = new Base_Dictionary();
     $model = new Wsclient();
     $result = $model->fetchAll($model->select()->order('client_name'))->toArray();
     foreach ($result as $val) {
         $clients[$val['id']] = $val['client_name'];
     }
     $this->addElement('select', 'ws_client_id', array('label' => 'Klient', 'multiOptions' => $this->addClearStart($clients)));
     $this->addElement('select', 'ws_service_id', array('label' => 'Usługa', 'multiOptions' => $this->addClearStart($dict->setSource(new WsServiceMail(), array(), 'id', 'id', array('smtp_login'))->getDictionary())));
     $activeOptions = array(1 => 'Aktywny', 2 => 'Nieaktywny');
     $this->addElement('select', 'is_active', array('label' => 'Aktywność', 'multiOptions' => $this->addClearStart($activeOptions)));
     $this->datetimee(false, 'created_at_from', 'Data od');
     $this->datetimee(false, 'created_at_to', 'Data do');
     $this->search();
     $this->cancel(false, 'cancel', 'Clear');
     //        $this->reset();
 }
Пример #5
0
 /**
  * Pobranie instacji Klienta na podstawie id użytkownika (potrzebne dla wywołań via CLI)
  * @param integer $idUser
  * @return Logic_Client
  * @throws Logic_Exception
  */
 public static function getInstanceByClient($clientId)
 {
     $user = new Logic_User();
     $clientId = $user->getAssignetWsClientId($idUser);
     if (null === $clientId) {
         throw new Logic_Exception("User with ID={$idUser} does not have any Client assigned!");
     }
     $client = new Wsclient();
     $clientRow = $client->getClient($clientId);
     if (null === $clientRow) {
         throw new Logic_Exception("Client with ID={$clientId} is not present or it has been ghosted!");
     }
     return self::getInstance(null, $clientRow->id);
 }