/** * @param string $formXml - unknown please comment * @param unknown $handler - please comment * @param unknown $formCollection - please comment * @param unknown $fields - please comment * @param unknown $filter - please comment * @see \Base\Controller\BaseController::formServiceHelper() * @return void */ protected function formServiceHelper($formXml, $handler, $formCollection, $fields, $filter = false) { $browserTabId = $this->params()->fromPost('browserTabId', ''); $id = $this->params('id', false); $windowId = $this->params('windowId', false); $function = $this->params()->fromPost('fucntion', 'updateGridSelect'); $status = $this->params()->fromPost('label_status', false); $listFun = 'getList'; $control = ''; if ($id) { $form = file_get_contents('public/' . $formXml); $response = new Response($form); $mapping = $response->getData(); if ($filter) { $data = array('fields' => $fields, 'searchFilters' => $filter); } else { //Code added by Usman shah for status reason if (isset($status) && !empty($status)) { $control = 'status'; $data = array('fields' => array('statusReason'), 'searchFilters' => ['groupOp' => 'and', 'rules' => [['data' => $status, 'op' => 'eq', 'field' => 'id'], ['data' => 1, 'op' => 'cn', 'field' => 'reason']]]); $listFun = 'getEmbed'; //add id and name fields for dropdown $data['embedFields'] = array('id' => 'id', 'name' => 'reasonName', 'order' => 'reasonOrder'); } else { $data = array('fields' => $fields); } } $messageId = $this->_message->addAction($this->defaultQueue, $listFun, $data, $handler); $data = array('channel' => array('tab_' . $browserTabId), 'message' => array('id' => $id, 'windowId' => $windowId, 'key' => $fields[0], 'control' => $control, 'value' => $fields[1], 'pagerId' => $this->params()->fromPost('pagerId', false), 'listData_attr' => array('xpath' => '//response/action[@id="' . $messageId . '"]/data/rows')), 'jsFunction' => $function, 'jsClass' => 'baseView'); $this->_message->addAction('response', 'send', $data, 'SocketResponse'); } $this->queue($this->_message); }
/** * Edits activities of person-details * @param string $formXml forms xml * @param string $handler Model name * @param string $formCollection CollectionName * @param string $create create * @param string $tabImage Tab name * @param string $readMode readMode * @author Mudassar Ali * @return string * @see \Base\Controller\BaseController::editHelper() */ protected function editHelper($formXml, $handler, $formCollection, $create = 0, $tabImage = null, $readMode = 'getOne') { $browserTabId = $this->params()->fromPost('browserTabId', ''); $id = $this->params('id', false); $windowId = $this->params()->fromPost('windowId', false); if ($id) { $form = file_get_contents('public/' . $formXml); $response = new Response($form); if (is_array($formCollection)) { $formCollection = $formCollection[0]; } $fields = $response->getData(); if ($formCollection == 'formType') { $fields['fields']['label_lockedRecord'] = 'lockedRecord'; } $formData = array('structure' => $fields['structure']); if ($id != 'new') { $data = array('id' => $this->params('id'), 'fields' => $fields['fields'], 'structure' => $fields['structure'], 'dbRef' => isset($fields['dbRef']) ? $fields['dbRef'] : [], 'create' => $create); $messageId = $this->_message->addAction($this->defaultQueue, $readMode, $data, $handler); $formData['data_attr'] = array('xpath' => '//response/action[@id="' . $messageId . '"]/data/fields'); } else { $formData['data'] = ''; } $data = array('channel' => array('tab_' . $browserTabId), 'message' => array('windowId' => $windowId, 'template' => 'fromTemplate', 'tabData' => array('formData' => $formData, 'formXml' => $formXml, 'tabImage' => $tabImage, 'formOptions' => array('formActionAppend' => array($browserTabId, $windowId, $id)))), 'jsFunction' => 'singlePageView', 'jsClass' => 'baseView'); $this->_message->addAction('response', 'send', $data, 'SocketResponse'); $this->queue($this->_message); } }
/** * edit opportunity source * @return \Zend\Stdlib\ResponseInterface */ public function editOpportunityAction() { $this->_formXml = 'templates/opportunity/forms/singleOpportunity.xml'; $browserTabId = $this->params()->fromPost('browserTabId', ''); $id = $this->params('id', false); $parentId = $this->params()->fromPost('parentId', false); $personId = $this->params()->fromPost('personId', false); $leadId = $this->params()->fromPost('leadId', false); $windowId = $this->params()->fromPost('windowId', false); $serverFunction = $this->params()->fromPost('serverFunction'); $formCollection = $this->_formCollection; if (is_array($formCollection)) { $formCollection = $formCollection[0]; } $form = file_get_contents('public/' . $this->_formXml); $response = new Response($form); $fields = $response->getData(); if ($formCollection == 'formType') { $fields['fields']['label_lockedRecord'] = 'lockedRecord'; } $formData = array('structure' => $fields['structure']); $filter = []; // get the lead if ($id != 'new') { $data = array('propertyId' => $this->params('id'), 'property' => 'opportunity', 'fields' => array('id', 'opportunity'), 'filters' => array("_id" => $personId), 'structure' => $fields['structure'], 'dbRef' => isset($fields['dbRef']) ? $fields['dbRef'] : [], 'create' => false); $messageId = $this->_message->addAction($this->defaultQueue, 'getOne', $data, $this->_handler); $formData['data_attr'] = array('xpath' => '//response/action[@id="' . $messageId . '"]/data/fields'); } else { $formData['data'] = array('id' => $parentId); $filter = ['_MONGODB_DOLLAR_SIGN_and' => [['_id._MONGODB_DOLLAR_SIGN_id' => 'MongoId:' . $personId], ['lead.id._MONGODB_DOLLAR_SIGN_id' => 'MongoId:' . $leadId]]]; $data = array('id' => $personId, 'leadId' => $leadId, 'propertyId' => $this->params('id'), 'property' => 'opportunity', 'fields' => array('id', 'lead', 'lead.degreeType', 'lead.intake', 'lead.programme', 'lead.sourceShort'), 'filters' => $filter, 'create' => false); if ($leadId && !empty($serverFunction)) { $messageId = $this->_message->addAction($this->defaultQueue, $serverFunction, $data, $this->_handler); $formData['data_attr'] = array('xpath' => '//response/action[@id="' . $messageId . '"]/data/fields'); } } $data = array('channel' => array('tab_' . $browserTabId), 'message' => array('windowId' => $windowId, 'template' => 'fromTemplate', 'tabData' => array('formData' => $formData + ['tabId' => $browserTabId], 'formXml' => $this->_formXml, 'formOptions' => array('formActionAppend' => array($browserTabId, $windowId, $id))), 'opportunityId' => $id), 'jsFunction' => $this->params()->fromPost('jsFunction', 'singlePageView'), 'jsClass' => $this->params()->fromPost('jsClass', 'baseView')); $this->_message->addAction('response', 'send', $data, 'SocketResponse'); // render the form $this->queue($this->_message); return $this->setresponse(); }
/** * load application config data before render form. * @return string */ public function loadApplicationConfigAction() { $this->_formXml = 'templates/applicationConfig/forms/edit.xml'; $browserTabId = $this->params()->fromPost('browserTabId', ''); $id = 1; $windowId = $this->params()->fromPost('windowId', false); $formCollection = $this->_formCollection; if (is_array($formCollection)) { $formCollection = $formCollection[0]; } $form = file_get_contents('public/' . $this->_formXml); $response = new Response($form); $fields = $response->getData(); $formData = array('structure' => $fields['structure']); // get the Application Config $data = array('id' => $id, 'fields' => array('id', 'passwordResetTemplate', 'systemEmailConfig', 'systemEmailMarketingSource')); $messageId = $this->_message->addAction($this->defaultQueue, 'getOne', $data, $this->_handler); $formData['data_attr'] = array('xpath' => '//response/action[@id="' . $messageId . '"]/data/fields'); $data = array('channel' => array('tab_' . $browserTabId), 'message' => array('windowId' => $windowId, 'template' => 'fromTemplate', 'data' => array('formData' => $formData, 'formXml' => $this->_formXml, 'formOptions' => array('formActionAppend' => array($browserTabId, $windowId, $id))), 'applicationConfigId' => $id), 'jsFunction' => $this->params()->fromPost('jsFunction', 'baseView.singlePageView'), 'jsClass' => $this->params()->fromPost('jsClass', '')); $this->_message->addAction('response', 'send', $data, 'SocketResponse'); // render the form $this->queue($this->_message); return $this->setresponse(); }
/** * load action * @return \Zend\Stdlib\ResponseInterface */ public function loadAction() { // get list of leads $browserTabId = $this->params()->fromPost('browserTabId', ''); $id = $this->params('id', false); $windowId = $this->params()->fromPost('windowId', false); $goTo = $this->params()->fromPost('goTo', false); $form = file_get_contents('public/' . 'templates/opportunity/forms/edit.xml'); $response = new Response($form); $formCollection = $this->_formCollection; if (is_array($formCollection)) { $formCollection = $formCollection[0]; } $fields = $response->getData(); if ($formCollection == 'formType') { $fields['fields']['label_lockedRecord'] = 'lockedRecord'; } $data = array('id' => $this->params('id'), 'fields' => $fields['fields'], 'options' => ['display' => 1], 'create' => false); $messageId = $this->_message->addAction($this->defaultQueue, 'getOne', $data, $this->_handler); $data = array('channel' => array('tab_' . $browserTabId), 'message' => array('windowId' => $windowId, 'urlPrefix' => $this->_urlPrefix, 'goTo' => $goTo, 'personData_attr' => array('xpath' => '//response/action[@id="' . $messageId . '"]/data/fields')), 'jsFunction' => $this->params()->fromPost('jsFunction', 'personPageView'), 'jsClass' => $this->params()->fromPost('jsClass', 'baseView')); $this->_message->addAction('response', 'send', $data, 'SocketResponse'); $this->queue($this->_message); return $this->setresponse(); }
/** * edit application source * @return \Zend\Stdlib\ResponseInterface */ public function editApplicationAction() { $this->_formXml = 'templates/application/forms/singleApplication.xml'; $browserTabId = $this->params()->fromPost('browserTabId', ''); $id = $this->params('id', false); $parentId = $this->params()->fromPost('parentId', false); $windowId = $this->params()->fromPost('windowId', false); $applicationId = $this->params()->fromPost('applicationId', false); $formCollection = $this->_formCollection; if (is_array($formCollection)) { $formCollection = $formCollection[0]; } $form = file_get_contents('public/' . $this->_formXml); $response = new Response($form); $fields = $response->getData(); if ($formCollection == 'formType') { $fields['fields']['label_lockedRecord'] = 'lockedRecord'; } $formData = array('structure' => $fields['structure']); if ($id != 'new') { $data = array('propertyId' => $this->params('id'), 'property' => 'application', 'fields' => array('id', 'application'), 'structure' => $fields['structure'], 'dbRef' => isset($fields['dbRef']) ? $fields['dbRef'] : [], 'create' => false); $messageId = $this->_message->addAction($this->defaultQueue, 'getOne', $data, $this->_handler); $formData['data_attr'] = array('xpath' => '//response/action[@id="' . $messageId . '"]/data/fields'); } else { $formData['data'] = array('id' => $parentId); } $data = array('channel' => array('tab_' . $browserTabId), 'message' => array('windowId' => $windowId, 'template' => 'fromTemplate', 'tabData' => array('formData' => $formData + ['tabId' => $browserTabId], 'formXml' => $this->_formXml, 'formOptions' => array('formActionAppend' => array($browserTabId, $windowId, $id)))), 'jsFunction' => $this->params()->fromPost('jsFunction', 'moveInViewModel.personDetails.application.loadFormCallback')); $this->_message->addAction('response', 'send', $data, 'SocketResponse'); // render the form $this->queue($this->_message); return $this->setresponse(); }