public function processRegistrationAction() { $updateFileId = (int) $this->_getParam('updateFileId'); $data = array(); $users = array(); $xml = new SimpleXMLElement('<clearhealth/>'); $xml->addChild('apiKey', Zend_Registry::get('config')->healthcloud->apiKey); $xml->addChild('authorizingUserId', (int) Zend_Auth::getInstance()->getIdentity()->personId); $xml->addChild('authorizingUser', Zend_Auth::getInstance()->getIdentity()->username); foreach (User::listActiveUsers() as $user) { $xmlUser = $xml->addChild('user'); $xmlUser->addChild('userId', (int) $user->personId); $xmlUser->addChild('username', (string) $user->username); } $ch = curl_init(); $url = Zend_Registry::get('config')->healthcloud->updateServerUrl . '/activate-users'; curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $xml->asXML()); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); try { $response = curl_exec($ch); if (curl_errno($ch)) { throw new Exception(curl_error($ch)); } curl_close($ch); trigger_error($response); $responseXml = new SimpleXMLElement($response); if ($responseXml->error) { throw new Exception((string) $responseXml->error->errorMsg, (string) $responseXml->error->errorCode); } $data['data'] = (string) $responseXml->response; $updateFile = new UpdateFile(); $updateFile->updateFileId = $updateFileId; $updateFile->populate(); $updateFile->install(); } catch (Exception $e) { $error = $e->getMessage(); trigger_error($error); $data['error'] = $error; } $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json'); $json->suppressExit = true; $json->direct($data); }
public function processDeleteAction() { $param = $this->_getParam('id'); $ids = explode(',', $param); $ret = false; foreach ($ids as $updateFileId) { if (!$updateFileId > 0) { continue; } $ret = true; $updateFile = new UpdateFile(); $updateFile->updateFileId = (int) $updateFileId; $updateFile->populate(); if (!strlen($updateFile->version) > 0) { continue; } //$updateFile->active = 0; $updateFile->setPersistMode(WebVista_Model_ORM::DELETE); $updateFile->persist(); } $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json'); $json->suppressExit = true; $json->direct($ret); }
public function viewDetailsAction() { $updateFileId = (int) $this->_getParam('updateFileId'); $updateFile = new UpdateFile(); $updateFile->updateFileId = $updateFileId; $updateFile->populate(); $alterTable = new AlterTable(); $this->view->name = $updateFile->channel . ': ' . $updateFile->name; $this->view->data = $alterTable->generateChanges($updateFile->data); $this->render('view-details'); }