/** * Sets up the fixture. * This method is called before a test is executed. * * @access protected */ protected function setUp() { $this->_backends['Asterisk_Context'] = Voipmanager_Controller_Asterisk_Context::getInstance(); $this->_backends['Asterisk_Meetme'] = Voipmanager_Controller_Asterisk_Meetme::getInstance(); $this->_backends['Asterisk_SipPeer'] = Voipmanager_Controller_Asterisk_SipPeer::getInstance(); $this->_backends['Asterisk_Voicemail'] = Voipmanager_Controller_Asterisk_Voicemail::getInstance(); $this->_backends['Snom_Line'] = Voipmanager_Controller_Snom_Line::getInstance(); $this->_backends['Snom_Location'] = Voipmanager_Controller_Snom_Location::getInstance(); $this->_backends['Snom_Phone'] = Voipmanager_Controller_Snom_Phone::getInstance(); $this->_backends['Snom_Setting'] = Voipmanager_Controller_Snom_Setting::getInstance(); $this->_backends['Snom_Software'] = Voipmanager_Controller_Snom_Software::getInstance(); $this->_backends['Snom_Template'] = Voipmanager_Controller_Snom_Template::getInstance(); }
/** * create a phone with a line for the current user */ protected function _createSnomPhone() { $testLocation = $this->_getSnomLocation(); $returnedLocation = Voipmanager_Controller_Snom_Location::getInstance()->create($testLocation); $testTemplate = $this->_getSnomTemplate(); $returnedTemplate = Voipmanager_Controller_Snom_Template::getInstance()->create($testTemplate); $rights = new Tinebase_Record_RecordSet('Voipmanager_Model_Snom_PhoneRight', array(array('account_id' => Tinebase_Core::getUser()->getId(), 'account_type' => Tinebase_Acl_Rights::ACCOUNT_TYPE_USER, 'read_right' => TRUE, 'write_right' => TRUE, 'dial_right' => TRUE))); $sipPeer = Voipmanager_Controller_Asterisk_SipPeer::getInstance()->create($this->_getAsteriskSipPeer()); $lines = new Tinebase_Record_RecordSet('Voipmanager_Model_Snom_Line', array(array('asteriskline_id' => $sipPeer->getId(), 'linenumber' => 1, 'lineactive' => 1, 'idletext' => 'idle'))); $settings = new Voipmanager_Model_Snom_PhoneSettings(array('web_language' => 'English')); $this->_phone = Voipmanager_Controller_Snom_Phone::getInstance()->create(new Voipmanager_Model_Snom_Phone(array('description' => 'Created by Tine 2.0 DEMO DATA', 'macaddress' => substr(Tinebase_Record_Abstract::generateUID(), 0, 12), 'location_id' => $returnedLocation['id'], 'template_id' => $returnedTemplate['id'], 'current_model' => 'snom300', 'redirect_event' => 'none', 'http_client_info_sent' => '1', 'http_client_user' => Tinebase_Record_Abstract::generateUID(), 'http_client_pass' => Tinebase_Record_Abstract::generateUID(), 'rights' => $rights, 'lines' => $lines, 'settings' => $settings))); }
/** * delete multiple locations * * @param array $ids list of locationId's to delete * @return array */ public function deleteSnomLocations($ids) { return $this->_delete($ids, Voipmanager_Controller_Snom_Location::getInstance()); }
/** * create edit location dialog * * @param int $locationId * @todo catch permission denied exceptions only * */ public function editSnomLocation($locationId = NULL) { if (!empty($locationId)) { $location = Voipmanager_Controller_Snom_Location::getInstance()->get($locationId); } else { $location = new Voipmanager_Model_Snom_Location(array('webserver_type' => 'http', 'http_port' => 80, 'https_port' => 443)); } // encode the location array $encodedLocation = Zend_Json::encode($location->toArray()); $view = new Zend_View(); $view->setScriptPath('Tinebase/views'); $view->title = "edit snom location data"; $view->jsExecute = 'Tine.Voipmanager.Snom.Location.EditDialog.display(' . $encodedLocation . ');'; header('Content-Type: text/html; charset=utf-8'); echo $view->render('jsclient.php'); }