Example #1
0
 public function render(Varien_Object $row)
 {
     $configuration = array();
     if ($row->getType() == Xtento_OrderExport_Model_Destination::TYPE_LOCAL) {
         $configuration['directory'] = $row->getPath();
     }
     if ($row->getType() == Xtento_OrderExport_Model_Destination::TYPE_FTP || $row->getType() == Xtento_OrderExport_Model_Destination::TYPE_SFTP) {
         $configuration['server'] = $row->getHostname() . ':' . $row->getPort();
         $configuration['username'] = $row->getUsername();
         $configuration['path'] = $row->getPath();
     }
     if ($row->getType() == Xtento_OrderExport_Model_Destination::TYPE_EMAIL) {
         $configuration['from'] = $row->getEmailSender();
         $configuration['to'] = $row->getEmailRecipient();
         $configuration['subject'] = $row->getEmailSubject();
     }
     if ($row->getType() == Xtento_OrderExport_Model_Destination::TYPE_CUSTOM) {
         $configuration['class'] = $row->getCustomClass();
     }
     if ($row->getType() == Xtento_OrderExport_Model_Destination::TYPE_WEBSERVICE) {
         $configuration['class'] = 'Webservice';
         $configuration['function'] = $row->getCustomFunction();
     }
     if (!empty($configuration)) {
         $configurationHtml = '';
         foreach ($configuration as $key => $value) {
             $configurationHtml .= Mage::helper('xtento_orderexport')->__(ucfirst($key)) . ': <i>' . Mage::helper('xtcore/core')->escapeHtml($value) . '</i><br/>';
         }
         return $configurationHtml;
     } else {
         return '---';
     }
 }
 /**
  * Initializes service from gateway
  * @param Varien_Object $gateway Object with all connection params
  * @return
  */
 public function initFromVarienObject(Varien_Object $gateway)
 {
     $this->setType($gateway->getProtocol())->setHost($gateway->getHost())->setLogin($gateway->getLogin())->setPassword($gateway->getPassword())->setPort($gateway->getPort())->setSecure($this->_getGatewaySecure($gateway));
     $instanceConstructor = $this->_getConnectionConstructor();
     try {
         // Try to connect
         $this->setInstance(new $instanceConstructor($this->_getConnectionParams()));
     } catch (Zend_Mail_Protocol_Exception $e) {
         $this->log($e->getMessage());
         return $e->getMessage();
     }
     return true;
 }
Example #3
0
 /**
  * Check configuration data by contacting FACT-Finder servers.
  *
  * @param array $configData
  *
  * @return array
  */
 public function checkConfigData($configData)
 {
     $dataArray = $this->_getCompleteFieldsetData($configData);
     $data = new Varien_Object($dataArray);
     $errors = array();
     if (stripos($data->getAddress(), 'http://') === 0 || strpos($data->getAddress(), '/') !== false) {
         $errors[] = Mage::helper('factfinder')->__('The server name should contain only the IP address or the domain - no "http://" or any slashes!');
     } elseif (!is_numeric($data->getPort())) {
         $errors[] = Mage::helper('factfinder')->__('The value for "port" must be an integer!');
     } elseif (intval($data->getPort()) < 80) {
         //is there any http port lower 80?
         $errors[] = Mage::helper('factfinder')->__('The value for "port" must be an integer greater or equals 80!');
     }
     if ($data->getAuthPassword() != '' && $data->getAuthUser() == '') {
         $errors[] = Mage::helper('factfinder')->__('A user name must be provided if a password is to be used.');
     }
     if (count($errors) == 0) {
         $checkStatusHandler = Mage::getSingleton('factfinder/handler_status', $dataArray);
         if (!$checkStatusHandler->checkStatus()) {
             $errors = $checkStatusHandler->getErrorMessages();
         }
     }
     return $errors;
 }