Esempio n. 1
0
File: Prompt.php Progetto: cwcw/cms
 /**
  *
  */
 public function getModalWindowData(Zend_Controller_Request_Abstract $request)
 {
     $customerPrompts = array();
     if (!SwIRS_Web_Request::isSuperAdmin($request)) {
         $customerAccountId = $request->getParam('CustomerAccountId');
         $customerPrompts = Streamwide_Web_Model::call('Prompt.GetByCustomer', array($customerAccountId));
     }
     $standardPrompts = Streamwide_Web_Model::call('Prompt.GetByCustomer', array(null));
     return array('CustomerPrompts' => $customerPrompts, 'StandardPrompts' => $standardPrompts);
 }
Esempio n. 2
0
 /**
  * Dashboard, the home for this web application
  *
  * @return void
  */
 public function dashboardAction()
 {
     Streamwide_Web_Log::debug('rendering the dashboard');
     $request = $this->getRequest();
     $viewDatas = array();
     $viewDatas['IsSuperAdmin'] = SwIRS_Web_Request::isSuperAdmin($request);
     if (!SwIRS_Web_Request::isSuperAdmin($request) && !SwIRS_Web_Request::isVisitor($request)) {
         $viewDatas['TreeLists'] = Streamwide_Web_Model::call('Tree.GetLastModified', array(false));
     }
     $this->view->assign($viewDatas);
 }
Esempio n. 3
0
 /**
  *
  */
 public function init()
 {
     // disable layout for ajax
     if ($this->_request->isXmlHttpRequest()) {
         $this->view->layout()->disableLayout();
     }
     $request = $this->getRequest();
     if (SwIRS_Web_Request::isSuperAdmin($request)) {
         $request->setParam('CustomerAccountId', null);
         // global resource has customer account id null
     }
 }
Esempio n. 4
0
 /**
  * Initialization
  *
  * @return void
  */
 public function init()
 {
     // disable layout for ajax
     if ($this->getRequest()->isXmlHttpRequest()) {
         $this->view->layout()->disableLayout();
     }
     $request = $this->getRequest();
     $customerAccountId = $request->getParam('CustomerAccountId');
     if (SwIRS_Web_Request::isSuperAdmin($request)) {
         $this->_isSuperAdmin = true;
         $this->_apiMaps = array('Query' => 'Tree.GetTemplatesByLabelPart', 'Count' => 'Tree.CountTemplates', 'GetAll' => 'Tree.GetTemplates');
     }
 }
Esempio n. 5
0
 /**
  * update an admin user
  * Actual update
  * ----------------
  * <request>
  * Act
  * UserId
  * Name
  * EmailAddress
  * Password
  * AssignedProfileId
  * AssignedCustomerAccountId
  * IsLocked
  * 
  * <view-assign>
  * Result
  * User = array(
  *     UserId
  *     Name
  *     EmailAddress
  *     Password
  *     TemporaryPassword
  *     ProfileId
  *     ProfileLabel
  *     ParentUserId
  *     ParentUserName
  *     CustomerAccountId
  *     CustomerAccountName
  *     IsLocked
  *     AgentParametersId
  *     AgentParameters => array(
  *         PhoneNumber
  *         DisponibilityTime
  *         UnlimitedDisponibility
  *     )
  * )
  * 
  * Modal Window
  * ------------------
  * <request>
  * UserId
  * CustomerAccountId
  * 
  * <view-assign>
  * User = array(
  *     UserId
  *     Name
  *     EmailAddress
  *     Password
  *     TemporaryPassword
  *     ProfileId
  *     ProfileLabel
  *     ParentUserId
  *     ParentUserName
  *     CustomerAccountId
  *     CustomerAccountName
  *     IsLocked
  *     AgentParametersId
  *     AgentParameters => array(
  *         PhoneNumber
  *         DisponibilityTime
  *         UnlimitedDisponibility
  *     )
  * )
  * Profiles =array(
  *   array(
  *     ProfileId
  *     Label
  *     SuperAdmin
  *     AdminUsers
  *     AdminTrees
  *     AdminResources
  *     AdminStats
  *     AgentCapability
  *     )
  * )
  * CustomerAccounts = array(
  *     array(
  *         CustomerAccountId
  *         CustomerAccountName
  *         .......
  *     )
  * )
  */
 public function updateAction()
 {
     $request = $this->getRequest();
     $act = $request->getParam('Act');
     $userId = $request->getParam('UserId');
     if ('update' == $act) {
         Streamwide_Web_Log::debug('update a user actual');
         $defaults = array('UserId' => $userId, 'Name' => null, 'EmailAddress' => null, 'Password' => null, 'IsLocked' => null);
         $user = SwIRS_Web_Request::getParam($request, $defaults);
         $user['CustomerAccountId'] = $request->getParam('AssignedCustomerAccountId');
         $user['ProfileId'] = $request->getParam('AssignedProfileId');
         $result = Streamwide_Web_Model::call('User.Update', array($user));
         Streamwide_Web_Log::debug("user {$userId} is updated");
         $this->view->assign('Result', $result);
         $this->getHelper('viewRenderer')->direct('update-ack');
     } else {
         Streamwide_Web_Log::debug("update user modal window");
         $profiles = Streamwide_Web_Model::call('User.GetProfiles', array());
         $customerAccounts = array();
         if (SwIRS_Web_Request::isSuperAdmin($request)) {
             $customerAccounts = Streamwide_Web_Model::call('Customer.GetAll', array());
             $profiles = $this->_restrict($profiles, array('AgentCapability' => 1));
         } else {
             $customerAccountId = $request->getParam('CustomerAccountId');
             $customerAccount = Streamwide_Web_Model::call('Customer.GetById', array($customerAccountId));
             $customerAccounts = array($customerAccount);
             $profiles = $this->_restrict($profiles, array('AgentCapability' => 1, 'SuperAdmin' => 1));
         }
         $this->view->assign(array('Profiles' => $profiles, 'CustomerAccounts' => $customerAccounts));
     }
     $user = Streamwide_Web_Model::call('User.GetById', array($userId));
     $this->view->assign('User', $user);
 }
Esempio n. 6
0
 /**
  *
  */
 public function getModalWindowData(Zend_Controller_Request_Abstract $request)
 {
     $customerPrompts = array();
     $agentGroups = array();
     $contacts = array();
     if (!SwIRS_Web_Request::isSuperAdmin($request)) {
         $customerAccountId = $request->getParam('CustomerAccountId');
         $customerPrompts = Streamwide_Web_Model::call('Prompt.GetByCustomer', array($customerAccountId));
         $agentGroups = Streamwide_Web_Model::call('Agentgroup.GetByCustomer', array($customerAccountId));
         $contacts = Streamwide_Web_Model::call('Contact.GetByCustomer', array($customerAccountId));
     }
     $standardPrompts = Streamwide_Web_Model::call('Prompt.GetByCustomer', array(null));
     $destinationTypes = Streamwide_Web_Model::call('Outgoing.GetDestinationTypes', array());
     return array('CustomerPrompts' => $customerPrompts, 'StandardPrompts' => $standardPrompts, 'DestinationTypes' => $destinationTypes, 'AgentGroups' => $agentGroups, 'Contacts' => $contacts);
 }
Esempio n. 7
0
 /**
  * update a premium number
  *
  * Actual update
  * -------------
  * <request>
  * Act
  * PremiumNumberId
  * MaxCallDuration
  * StaticContactId
  * StaticContactPhone
  *
  * <view-assign>
  * Result
  * PremiumNumber = array(
  *     PremiumNumberId
  *     PremiumNumber
  *     PremiumNumberUi
  *     PremiumNumberGroupId
  *     PremiumNumberGroupName
  *     CustomerAccountId
  *     CustomerAccountName
  *     MaxCallDuration
  *     StaticContactId
  *     StaticContactName
  *     StaticContactPhoneNumber
  *     CreationDateTime
  *     SolutionId
  *     SolutionTypeId
  *     SolutionType
  *     TemplateTreeId
  *     TemplateTreeLabel
  * )
  *
  * Modal window
  * -------------
  * <request>
  * PremiumNumberId
  * <view-assign>
  * PremiumNumber = array(
  *     PremiumNumberId
  *     PremiumNumber
  *     PremiumNumberUi
  *     PremiumNumberGroupId
  *     PremiumNumberGroupName
  *     CustomerAccountId
  *     CustomerAccountName
  *     MaxCallDuration
  *     StaticContactId
  *     StaticContactName
  *     StaticContactPhoneNumber
  *     CreationDateTime
  *     SolutionId
  *     SolutionTypeId
  *     SolutionType
  *     TemplateTreeId
  *     TemplateTreeLabel
  * )
  */
 public function updateAction()
 {
     $request = $this->getRequest();
     $act = $request->getParam('Act');
     $premiumNumberId = $request->getParam('PremiumNumberId');
     if ('update' == $act) {
         Streamwide_Web_Log::debug("update premium number {$premiumNumberId} actual");
         $defaults = array('MaxCallDuration' => null, 'StaticContactId' => null, 'StaticContactPhone' => null);
         $premiumNumber = SwIRS_Web_Request::getParam($request, $defaults);
         if (!empty($premiumNumber)) {
             $premiumNumber['PremiumNumberId'] = $premiumNumberId;
             $result = Streamwide_Web_Model::call('PremiumNumber.Update', array($premiumNumber));
             $this->view->assign('Result', $result);
         }
         $this->getHelper('viewRenderer')->direct('update-ack');
     }
     $premiumNumber = Streamwide_Web_Model::call('PremiumNumber.GetById', array($premiumNumberId));
     $this->view->assign('PremiumNumber', $premiumNumber);
     $isSuperAdmin = true;
     if (!SwIRS_Web_Request::isSuperAdmin($request)) {
         $isSuperAdmin = false;
         $this->getHelper('viewRenderer')->direct('update-redirect');
         //update redirect number view for static solution
     }
     //update max call duraion view for super admin
 }