/** * */ public function getParameters(Zend_Controller_Request_Abstract $request) { $nodeId = $request->getParam('NodeId'); Streamwide_Web_Log::debug("get " . $this->_type . " node parameters by node id {$nodeId}"); $node = Streamwide_Web_Model::call('Node.GetById', array($nodeId)); $nodeParameter = Streamwide_Web_Model::call('Link.GetNodeParameter', array($nodeId)); return array('Node' => $node, 'NodeParameter' => $nodeParameter); }
/** * list all trunks */ public function listAction() { $request = $this->getRequest(); $labelPart = $request->getParam('ResourceKeyWord'); $pagination['CurrentPage'] = $request->getParam('CurrentPage', SwIRS_Web_Request::CURRENT_PAGE); $pagination['ItemsPerPage'] = $request->getParam('ItemsPerPage', SwIRS_Web_Request::ITEMS_PER_PAGE); $pagination['ItemsTotal'] = 0; $trunkRoutes = array(); if (strlen($labelPart)) { $trunkRoutes = Streamwide_Web_Model::call('TrunkRoute.GetByLabelPart', array($labelPart, $pagination['CurrentPage'], $pagination['ItemsPerPage'])); $pagination['ItemsTotal'] = Streamwide_Web_Model::call('TrunkRoute.Count', array($labelPart)); } else { $pagination['ItemsTotal'] = Streamwide_Web_Model::call('TrunkRoute.Count', array()); $trunkRoutes = Streamwide_Web_Model::call('TrunkRoute.GetAll', array($pagination['CurrentPage'], $pagination['ItemsPerPage'])); } $this->view->assign(array('TrunkRoutes' => $trunkRoutes, 'Pagination' => $pagination)); }
/** * Defined by Zend_Application_Resource_Resource * * @return Zend_XmlRpc_Client * @throws Streamwide_Exception when application module directory invalid, throw * Streamwide_Exception */ public function init() { $this->getBootstrap()->bootstrap('FrontController'); $front = $this->getBootstrap()->getResource('FrontController'); $modulesDirectory = dirname($front->getModuleDirectory()); //modules directory $this->_options['introspection'] = array(); try { $dir = new DirectoryIterator($modulesDirectory); } catch (Exception $e) { throw new Streamwide_Exception("Directory {$modulesDirectory} not readable"); } foreach ($dir as $file) { if ($file->isDot() || !$file->isDir()) { continue; } $module = $file->getFilename(); // Don't use SCCS directories as modules if (preg_match('/^[^a-z]/i', $module) || 'CVS' == $module) { continue; } $moduleConfig = $file->getPathname() . $this->_config; $introspection = $this->_getIntrospection($moduleConfig); $this->_options['introspection'] = array_merge($this->_options['introspection'], $introspection); } if (empty($this->_options['introspection'])) { unset($this->_options['introspection']); } $client = $this->getWebserviceClient(); if ($this->_options['model']) { Streamwide_Web_Model::setModel($client); } else { $stub = $this->_options['stub']; if (!empty($stub)) { Streamwide_Web_Model::setModel(new Streamwide_Web_Model_Stub($stub)); } } return $client; }
/** * Reset, handling the operator reset their password * * --------------------//Actual Reset * <request> * 'Username' //string * <view-assign> * 'Result' //string 'OK' while succeed * * @return void */ public function resetAction() { $this->getHelper('ViewRenderer')->setNoRender(); $this->getHelper('Layout')->disableLayout(); $request = $this->getRequest(); if ($request->isPost()) { $username = $request->getParam("Username"); Streamwide_Web_Log::debug("reset user {$username}"); $result = Streamwide_Web_Model::call('User.Reset', array($username)); $this->view->assign('Result', $result); $this->getHelper('viewRenderer')->render('reset-ack'); } }
/** * */ public function exportAction() { $this->view->layout()->disableLayout(); $this->getHelper('viewRenderer')->setNoRender(); $request = $this->getRequest(); $customerAccountId = $request->getParam('CustomerAccountId'); $act = $request->getParam('Act'); if ('export' == $act) { Streamwide_Web_Log::debug("export {$customerAccountId} admin file"); $fileContent = Streamwide_Web_Model::call('User.Export', array($customerAccountId)); $fileContent = base64_decode($fileContent); $response = $this->getResponse(); $response->clearAllHeaders(); $response->clearBody(); $fileName = 'F-' . time(); $response->setHeader('Content-Type', 'application/octet-stream')->setHeader('Content-Disposition', "attachment;filename={$fileName}.csv")->setHeader('Content-Length', strlen($fileContent)); $response->setBody($fileContent); } else { Streamwide_Web_Log::debug('export admin file'); } }
/** * FailoverContactIdA * FailoverContactIdB */ public function swaprankAction() { $request = $this->getRequest(); $failoverContactIdA = $request->getParam('FailoverContactIdA'); $failoverContactIdB = $request->getParam('FailoverContactIdB'); $result = Streamwide_Web_Model::call('Outgoing.SwapFailoverContacts', array($failoverContactIdA, $failoverContactIdB)); }
/** * allocated tree management */ public function allocatedtreeAction() { $request = $this->getRequest(); $premiumNumberGroupId = $request->getParam('PremiumNumberGroupId'); $routingPlanId = $request->getParam('RoutingPlanId'); $treeId = $request->getParam('TreeId'); $startDatetime = $request->getParam('StartDatetime'); $endDatetime = $request->getParam('EndDatetime'); $act = $request->getParam('Act'); switch ($act) { case 'add': $routingPlanId = Streamwide_Web_Model::call('PremiumNumberGroup.AddAllocatedTree', array(array('PremiumNumberGroupId' => $premiumNumberGroupId, 'TreeId' => $treeId, 'StartDatetime' => $startDatetime, 'EndDatetime' => $endDatetime))); Streamwide_Web_Log::debug("routing plan {$routingPlanId} added"); $this->view->assign(array('RoutingPlanId' => $routingPlanId)); $this->getHelper('viewRenderer')->direct('allocated-tree-add-ack'); break; case 'update': $result = Streamwide_Web_Model::call('PremiumNumberGroup.UpdateAllocatedTree', array(array('RoutingPlanId' => $routingPlanId, 'TreeId' => $treeId, 'StartSecond' => $startSecond, 'EndSecond' => $endSecond))); Streamwide_Web_Log::debug("routing plan {$routingPlanId} updated"); $this->view->assign(array('Result' => $result)); $this->getHelper('viewRenderer')->direct('allocated-tree-update-ack'); break; case 'delete': $result = Streamwide_Web_Model::call('PremiumNumberGroup.RemoveAllocatedTree', array($routingPlanId)); Streamwide_Web_Log::debug("routing plan {$routingPlanId} deleted"); $this->view->assign(array('Result' => $result)); $this->getHelper('viewRenderer')->direct('allocated-tree-delete-ack'); break; default: break; } }
/** * listen media * <request> * PromptId * * <view-assign> */ public function playAction() { // Always disable the layout and viewRenderer $this->view->layout()->disableLayout(); $this->getHelper('viewRenderer')->setNoRender(); Streamwide_Web_Log::debug("listen prompt {$promptId}"); $request = $this->getRequest(); $promptId = $request->getParam('PromptId'); $prompt = Streamwide_Web_Model::call('Prompt.GetById', array($promptId)); $promptContent = base64_decode($prompt['PromptContent']); $response = $this->getResponse(); $response->clearAllHeaders(); $response->clearBody(); $response->setHeader('Content-Type', 'audio/mpeg')->setHeader('Content-Length', strlen($promptContent)); $response->setBody($promptContent); }
/** * */ public function recipientsAction() { $request = $this->getRequest(); $act = $this->getParam('Act'); $recipients = $request->getParam('Recipients'); if ('add' == $act) { $result = Streamwide_Web_Model::call('Report.AddRecipients', array($recipients)); } else { $result = Streamwide_Web_Model::call('Report.RemoveRecipients', array($recipients)); } $this->view->assign('Result', $result); }
/** * */ public function nextAction() { $request = $this->getRequest(); $nodeOutputId = $request->getParam('NodeOutputId'); $nextNodeId = $request->getParam('NextNodeId'); $nodeOutput = array('NodeOutputId' => $nodeOutputId, 'NextNodeId' => $nextNodeId); $result = Streamwide_Web_Model::call('NodeOutput.Update', array($nodeOutput)); Streamwide_Web_Log::debug("assign node {$nextNodeId} as the next of the node output {$nodeOutputId}"); }
/** * delete a customer * Actual delete * ------------- * <request> * Act * CurrentPage * ItemsPerPage * * CustomerAccountIds = array($CustomerAccountId) * CustomerAccountNames = array($CustomerAccountName) * * <view-assign> * DeletedCustomerAccounts * * Pagination = array ( * CurrentPage => * ItemsPerPage => * ) * Modal window * ------------- * <request> * CustomerAccountIds = array($CustomerAccountId) * CustomerAccountNames = array($CustomerAccountName) * * <view-assign> * DeletedCustomerAccounts */ public function deleteAction() { $request = $this->getRequest(); $act = $request->getParam('Act'); $customerAccountIds = $request->getParam('CustomerAccountIds'); $customerAccountNames = $request->getParam('CustomerAccountNames'); $deleted = implode(',', $customerAccountNames); if ('delete' == $act) { Streamwide_Web_Log::debug('delete customer actual'); $pagination['CurrentPage'] = $request->getParam('CurrentPage', SwIRS_Web_Request::CURRENT_PAGE); $pagination['ItemsPerPage'] = $request->getParam('ItemsPerPage', SwIRS_Web_Request::ITEMS_PER_PAGE); foreach ($customerAccountIds as $customerAccountId) { $result = Streamwide_Web_Model::call('Customer.Delete', array($customerAccountId)); } Streamwide_Web_Log::debug("deleted customer {$deleted}"); $this->view->assign(array('DeletedCustomerAccounts' => $deleted, 'Pagination' => $pagination)); $this->getHelper('viewRenderer')->direct('delete-ack'); } else { Streamwide_Web_Log::debug('delete customer modal window'); $this->view->assign('DeletedCustomerAccounts', $deleted); } }
/** * frequency management */ public function frequencyAction() { $request = $this->_request; $periodFrequencyId = $request->getParam('PeriodFrequencyId'); $periodId = $request->getParam('PeriodId'); $startSecond = $request->getParam('StartSecond'); $endSecond = $request->getParam('EndSecond'); $act = $request->getParam('Act'); switch ($act) { case 'add': $periodFrequencyId = Streamwide_Web_Model::call('Calendar.AddPeriodFrequency', array(array('PeriodId' => $periodId, 'StartSecond' => $startSecond, 'EndSecond' => $endSecond))); Streamwide_Web_Log::debug("period frequency {$periodFrequencyId} is created"); $this->view->assign(array('PeriodFrequencyId' => $periodFrequencyId)); $this->getHelper('viewRenderer')->direct('frequency-add-ack'); break; case 'update': Streamwide_Web_Log::debug("update a period frequency {$periodFrequencyId} actual"); $result = Streamwide_Web_Model::call('Calendar.UpdatePeriodFrequency', array(array('PeriodFrequencyId' => $periodFrequencyId, 'StartSecond' => $startSecond, 'EndSecond' => $endSecond))); $this->view->assign('Result', $result); $this->getHelper('viewRenderer')->direct('frequency-update-ack'); break; case 'delete': $result = Streamwide_Web_Model::call('Calendar.DeletePeriodFrequency', array($periodFrequencyId)); Streamwide_Web_Log::debug("period frequency {$periodFrequencyId} is deleted"); $this->view->assign('Result', $result); $this->getHelper('viewRenderer')->direct('frequency-delete-ack'); break; default: break; } }
/** * */ public function deleteOutput($nodeOutput) { Streamwide_Web_Log::debug("node output " . $nodeOutput['NodeOutputId'] . " is deleted"); $nodeOutputId = $nodeOutput['NodeOutputId']; $result = Streamwide_Web_Model::call('NodeOutput.Delete', array($nodeOutputId)); return $reslut; }
/** * Update a new group. */ public function editgroupAction() { $request = $this->getRequest(); $OriginGroupId = $this->getParam('OriginGroupId'); $OriginGroupName = $this->getParam('OriginGroupName'); Streamwide_Web_Model::call('Origin.UpdateGroup', array($OriginGroupId, $OriginGroupName)); }
/** * import blacklistNumber */ public function importAction() { $this->view->layout()->disableLayout(); $request = $this->getRequest(); $act = $request->getParam('Act'); $customerUserId = $request->getParam('CustomerUserId'); $customerAccountId = $request->getParam('CustomerAccountId'); if ('import' == $act) { if (isset($_FILES['Filedata'])) { Streamwide_Web_Log::debug("import blacklist file" . $_FILES['Filedata']['name']); $fileContent = file_get_contents($_FILES['Filedata']['tmp_name']); $importJobId = Streamwide_Web_Model::call('Blacklist.Import', array($customerUserId, $customerAccountId, base64_encode($fileContent))); $this->view->assign(array('ImportJobId' => $importJobId, 'CustomerUserId' => $customerUserId, 'CustomerAccountId' => $customerAccountId)); $this->getHelper('viewRenderer')->direct('import-ack'); } else { //do nothing } } else { Streamwide_Web_Log::debug('import blacklist file'); $this->getHelper('viewRenderer')->setNoRender(); } }
/** * live statistic for agentgroup * Actual Statistic * -------------- * <request> * Act * AgentGroupId * AgentNamePart * CurrentPage * ItemsPerPage * * <view-assign> * Statistics = array( * array( * Name * UserId * OnlineStatus * CallsTaken * AvilabilityStatus * Timestamp * ) * ) * Pagination = array( * CurrentPage * ItemsPerPage * ItemsTotal * ) * * Modal Window * -------------- * <request> * AgentId * <view-assign> * AgentGroups = array( * array ( * AgentGroupId * AgentGroupName * ) * ) * */ public function statisticsAction() { $request = $this->getRequest(); $act = $request->getParam('Act'); if ('statistics' == $act) { $agentGroupId = $request->getParam('AgentGroupId'); Streamwide_Web_Log::debug("list agent group {$agentGroupId} statistics"); $pagination['CurrentPage'] = $request->getParam('CurrentPage', SwIRS_Web_Request::CURRENT_PAGE); $pagination['ItemsPerPage'] = $request->getParam('ItemsPerPage', SwIRS_Web_Request::ITEMS_PER_PAGE); $pagination['ItemsTotal'] = 0; $agentNamePart = $request->getParam('AgentNamePart', ''); $agentNamePart = trim($agentNamePart); $statistics = array(); if (strlen($agentNamePart) > 0) { $statistics = Streamwide_Web_Model::call('AgentGroup.GetStatisticsByAgentNamePart', array($agentGroupId, $agentNamePart, $pagination['CurrentPage'], $pagination['ItemsPerPage'])); $pagination['ItemsTotal'] = Streamwide_Web_Model::call('AgentGroup.CountAgents', array($agentGroupId, $agentNamePart)); } else { $statistics = Streamwide_Web_Model::call('AgentGroup.GetStatistics', array($agentGroupId, $pagination['CurrentPage'], $pagination['ItemsPerPage'])); $pagination['ItemsTotal'] = Streamwide_Web_Model::call('AgentGroup.CountAgents', array($agentGroupId)); } $this->view->assign(array('Statistics' => $statistics, 'Pagination' => $pagination)); $this->getHelper('viewRenderer')->direct('statistics-ack'); } else { $agentId = $request->getParam('AgentId'); Streamwide_Web_Log::debug("list agent groups whose supervisor is {$agentId}"); $agentGroups = Streamwide_Web_Model::call('AgentGroup.GetGroupsBySupervisor', array($agentId)); $this->view->assign('AgentGroups', $agentGroups); } }
/** * Rendering the routing tree building tool * * -------------- //Actual Page * <request> * 'TreeId' //numberic * <view-assign> * 'NodeTypes' //struct $id => $label * 'CurrentTreeId' //numberic * 'CurrentTreeInfo' //struct * 'RootTreeInfo' //struct * 'SubTreeLists' //array(struct) * 'TreeNodes' //struct $nodeId => $nodeInfo * * @return void */ public function builderAction() { // set another layout for builder $this->getHelper('Layout')->setLayout('tree'); $request = $this->getRequest(); $treeId = $request->getParam('TreeId'); $nodeId = $request->getParam('NodeId'); if ($request->getParam('IsBuilding')) { if (is_null($nodeId) || in_array($nodeId, self::$_renderedNodeIds)) { Streamwide_Web_Log::debug('Rendering Stoped because NextNodeId is null or rendered.'); $this->getHelper('ViewRenderer')->setNoRender(); } else { Streamwide_Web_Log::debug('Rendering Tree Node on NodeId: ' . $nodeId); $this->view->assign(array('CurrentNodeId' => $nodeId, 'RenderedNodeIds' => self::$_renderedNodeIds)); $this->getHelper('ViewRenderer')->direct('building'); self::$_renderedNodeIds[] = $nodeId; } } else { Streamwide_Web_Log::debug('Rendering Routing Tree on TreeId: ' . $treeId); $nodeTypes = SwIRS_Web_Node_Abstract::getNodeTypes(); $currentTreeInfo = Streamwide_Web_Model::call('Tree.GetById', array($treeId)); $rootTreeId = $currentTreeInfo['ParentTreeId'] ? $currentTreeInfo['ParentTreeId'] : $treeId; $subTreeLists = Streamwide_Web_Model::call('Tree.GetSubTrees', array($rootTreeId)); $rootTreeInfo = $currentTreeInfo; if ($rootTreeId != $treeId) { $rootTreeInfo = Streamwide_Web_Model::call('Tree.GetById', array($rootTreeId)); } $treeNodes = Streamwide_Web_Model::call('Tree.GetNodes', array($treeId)); $treeNodes = $this->_formatTreeNodes($treeNodes); $this->view->assign(array('NodeTypes' => $nodeTypes, 'CurrentTreeId' => $treeId, 'CurrentTreeInfo' => $currentTreeInfo, 'RootTreeInfo' => $rootTreeInfo, 'SubTreeLists' => $subTreeLists, 'TreeNodes' => $treeNodes)); } }
/** * */ public function getParameters(Zend_Controller_Request_Abstract $request) { $nodeId = $request->getParam('NodeId'); Streamwide_Web_Log::debug("get " . $this->_type . " node parameters by node id {$nodeId}"); $node = Streamwide_Web_Model::call('Node.GetById', array($nodeId)); $nodeParameter = Streamwide_Web_Model::call('Outgoing.GetNodeParameter', array($nodeId)); $failoverContacts = Streamwide_Web_Model::call('Outgoing.GetFailoverContacts', array($nodeParameter['NodeParamOutgoingId'])); return array('Node' => $node, 'NodeParameter' => $nodeParameter, 'FailoverContacts' => $failoverContacts); }
/** * remove trunk from trunkgroup * <request> * TrunkGroupId * TrunkIds = array($TrunkId) * <view-assign> * Result */ public function deletetrunkAction() { $request = $this->getRequest(); $trunkGroupId = $request->getParam('TrunkGroupId'); $trunkIds = $request->getParam('TrunkIds'); $result = Streamwide_Web_Model::call('TrunkGroup.RemoveTrunks', array($trunkGroupId, $trunkIds)); $this->view->assign('Result', $result); }
/** * Set the available model instance to execute the call() * * @param Streamwide_Web_Model_Interface $model * * @return void */ public static function setModel(Streamwide_Web_Model_Interface $model) { self::$_model = $model; }
/** * delete a originGroup * Actual delete * ------------- * <request> * Act * CurrentPage * ItemsPerPage * * OriginGroupIds = array($OriginGroupId) * OriginGroupLabels = array($OriginGroupLabel) * <view-assign> * * DeletedOriginGroups * Pagination = array ( * CurrentPage => * ItemsPerPage => * ) * Modal window * ------------- * <request> * OriginGroupIds = array($OriginGroupId) * OriginGroupLabels = array($OriginGroupLabel) * * <view-assign> * DeletedOriginGroups */ public function deleteAction() { $request = $this->getRequest(); $act = $request->getParam('Act'); $originGroupIds = $request->getParam('OriginGroupIds'); $originGroupLabels = $request->getParam('OriginGroupLabels'); $deleted = implode(',', $originGroupLabels); if ('delete' == $act) { $pagination['CurrentPage'] = $request->getParam('CurrentPage', SwIRS_Web_Request::CURRENT_PAGE); $pagination['ItemsPerPage'] = $request->getParam('ItemsPerPage', SwIRS_Web_Request::ITEMS_PER_PAGE); foreach ($originGroupIds as $originGroupId) { $result = Streamwide_Web_Model::call('Origin.RemoveGroup', array($originGroupId)); } Streamwide_Web_Log::debug("deleted originGroup {$deleted}"); $this->view->assign(array('DeletedOriginGroups' => $deleted, 'Pagination' => $pagination)); $this->getHelper('viewRenderer')->direct('delete-ack'); } else { $this->view->assign('DeletedOriginGroups', $deleted); } }
/** * delete a premium number * Actual delete * ------------- * <request> * Act * CurrentPage * ItemsPerPage * * PremiumNumberIds = array($PremiumNumberId) * PremiumNumberUis = array($PremiumNumberUi) * * <view-assign> * DeletedPremiumNumberUis * Pagination = array ( * CurrentPage => * ItemsPerPage => * ) * * Modal window * ------------- * <request> * PremiumNumberIds = array($PremiumNumberId) * PremiumNumberUis = array($PremiumNumberUi) * * <view-assign> * DeletedPremiumNumberUis */ public function deleteAction() { $request = $this->getRequest(); $act = $request->getParam('Act'); $premiumNumberIds = $request->getParam('PremiumNumberIds'); $premiumNumberUis = $request->getParam('PremiumNumberUis'); $deleted = implode(',', $premiumNumberUis); if ('delete' == $act) { $pagination['CurrentPage'] = $request->getParam('CurrentPage', SwIRS_Web_Request::CURRENT_PAGE); $pagination['ItemsPerPage'] = $request->getParam('ItemsPerPage', SwIRS_Web_Request::ITEMS_PER_PAGE); foreach ($premiumNumberIds as $premiumNumberId) { $result = Streamwide_Web_Model::call('PremiumNumber.Delete', array($premiumNumberId)); } Streamwide_Web_Log::debug("deleted premium number {$deleted}"); $this->view->assign(array('DeletedPremiumNumberUis' => $deleted, 'CustomerAccountId' => $request->getParam('CustomerAccountId'), 'Pagination' => $pagination)); $this->getHelper('viewRenderer')->direct('delete-ack'); } else { $this->view->assign('DeletedPremiumNumberUis', $deleted); } }