/** * action delete * * @param \GK\Stdapp\Domain\Model\CustomerSubtype $customerSubtype * @return void */ public function deleteAction(\GK\Stdapp\Domain\Model\CustomerSubtype $customerSubtype) { $this->customerSubtypeRepository->remove($customerSubtype); $this->flashMessageContainer->add('Your CustomerSubtype was removed.'); $this->redirect('list'); }
/** * action config * * @param string $identifier * @param string $token * @return string */ public function configAction($identifier, $token = NULL) { $configs = array(); $customer = $this->customerRepository->findOneByIdentifier($identifier); if ($customer == NULL) { die("Customer not eligible"); } $this->portalUserRepository = $this->objectManager->get('\\GK\\Stdapp\\Domain\\Repository\\PortalUserRepository'); $portalUser = $this->portalUserRepository->findOneByCustomer($customer); if ($token != NULL) { $this->updateSubscriber($customer, $token); } $configs['version'] = $this->settings['version']; //'0.2' $configs['status'] = $customer->getStatus(); $configs['offerEmail'] = $customer->getEnquiryEmail(); //'*****@*****.**'; $configs['senderEmail'] = $this->settings['senderEmail']; $configs['longitude'] = $customer->getLongitude(); $configs['latitude'] = $customer->getLatitude(); $configs['txtColorHeader'] = $customer->getTxtColorHeader(); $configs['txtTransparencyHeader'] = $customer->getTxtTransparencyHeader(); $configs['baseURL'] = $this->settings['baseUrl'] . $this->settings['uploadPath'] . strtoupper($identifier) . '/'; $configs['smtpServer'] = $this->settings['smtpServer']; $configs['smtpUsername'] = $this->settings['smtpUsername']; $configs['smtpPassword'] = $this->settings['smtpPassword']; //"Aw5FUw4OBkI=" $configs['langDefault'] = $customer->getDefaultLanguage()->getUid(); $configs['name'] = $portalUser->getCompany(); $configs['address'] = $portalUser->getAddress(); $configs['zip'] = $portalUser->getZip(); $configs['city'] = $portalUser->getCity(); $configs['telephone'] = $portalUser->getTelephone(); $configs['fax'] = $portalUser->getFax(); $configs['mailbox'] = $customer->getContactEmail(); $configs['hrNumber'] = $customer->getHrNumber(); $configs['www'] = $portalUser->getWww(); $langs = array(); foreach ($customer->getLanguages() as $language) { $langs[] = array('uid' => $language->getUid(), 'code' => $language->getCode(), 'name' => $language->getTitle()); } $configs['language'] = $langs; $itemNames = array(); foreach ($customer->getTypenames() as $typename) { $lang = $typename->getSysLanguageUid(); $itemNames[$lang != NULL ? $lang->getUid() : $configs['langDefault']][$typename->getType()->getUid()] = $typename->getName(); } $configs['itemName'] = $itemNames; $setups = array(); foreach ($this->customerSubtypeRepository->findForApi($identifier)->toArray() as $config) { $resourceType = $config->getResourceType(); $typeUid = $resourceType->getUid(); $subtype = $config->getSubtype(); switch ($subtype) { case 0: $data = str_replace(array('{name}', '{address}', '{zip}', '{city}', '{telephone}', '{fax}', '{mailbox}', '{hr_number}', '{www}', '{baseurl}'), array($configs['name'], $configs['address'], $configs['zip'], $configs['city'], $configs['telephone'], $configs['fax'], $configs['mailbox'], $configs['hrNumber'], $configs['www'], $this->settings['baseUrl']), $config->getData()); break; case 1: // if no resources, switch to default if ($resourceType->getAction() == "resource" && $this->resourceRepository->countForApi($identifier, $typeUid) == 0) { $data = str_replace(array('{name}', '{address}', '{zip}', '{city}', '{telephone}', '{fax}', '{mailbox}', '{hr_number}', '{www}', '{baseurl}'), array($configs['name'], $configs['address'], $configs['zip'], $configs['city'], $configs['telephone'], $configs['fax'], $configs['mailbox'], $configs['hrNumber'], $configs['www'], $this->settings['baseUrl']), $config->getData()); $subtype = 0; } else { $data = $this->settings['baseUrl'] . '/' . $resourceType->getAction() . '/' . $identifier . '/' . $typeUid; } break; case 2: $data = str_replace('{baseurl}', $this->settings['baseUrl'], $config->getUrl()); break; } $setups[] = array('type' => $typeUid, 'subtype' => $subtype, 'data' => $data); } $configs['setup'] = $setups; $subjects = array(); foreach ($this->resourceRepository->findByType(9, $customer)->toArray() as $subject) { $lang = $subject->getSysLanguageUid(); $subjects[$lang != NULL ? $lang->getUid() : $configs['langDefault']][] = array('uid' => $subject->getUid(), 'title' => $subject->getTitle()); } $configs['offerSubject'] = $subjects; $contactSubmitMsg = array(); foreach ($this->resourceRepository->findByType(10, $customer)->toArray() as $subject) { $lang = $subject->getSysLanguageUid(); $contactSubmitMsg[$lang != NULL ? $lang->getUid() : $configs['langDefault']][] = array('uid' => $subject->getUid(), 'title' => $subject->getTitle(), 'content' => $subject->getContent()); } $configs['contactSubmitMsg'] = $contactSubmitMsg; $offerSubmitMsg = array(); foreach ($this->resourceRepository->findByType(11, $customer)->toArray() as $subject) { $lang = $subject->getSysLanguageUid(); $offerSubmitMsg[$lang != NULL ? $lang->getUid() : $configs['langDefault']][] = array('uid' => $subject->getUid(), 'title' => $subject->getTitle(), 'content' => $subject->getContent()); } $configs['offerSubmitMsg'] = $offerSubmitMsg; return json_encode($configs); }