@param \Slashworks\AppBundle\Model\RemoteApp $oRemoteApp

@return \Symfony\Component\Form\Form
323443
private function createEditForm(RemoteApp $oRemoteApp)
        {

            $form = $this->createForm(new RemoteAppType(), $oRemoteApp, array(
                'action' => $this->generateUrl('remote_app_update', array('id' => $oRemoteApp->getId())),
                'method' => 'PUT',
            ));

            $form->add('submit', 'submit', array('label' => 'Update'));

            return $form;
        }
526483
private function _saveResponse($aResponse, $oRemoteApp)
        {

            // get model by app-type
            $sClassName      = '\Slashworks\AppBundle\Model\RemoteHistory' . ucfirst($oRemoteApp->getType());
            $sQueryClassName = '\Slashworks\AppBundle\Model\RemoteHistory' . ucfirst($oRemoteApp->getType() . 'Query');

            // if class exists, proceed...
            if (class_exists($sClassName)) {
                // find histories for remote-app
                $aHistories = $sQueryClassName::create()->findByRemoteAppId($oRemoteApp->getId());

                // create new history-entry
                $oRemoteHistoryClass = new $sClassName();
                $oRemoteHistoryClass->setRemoteApp($oRemoteApp);
                $oRemoteHistoryClass->setData($aResponse);

                // convert created class to array for comparsion
                $aNewHistory               = $oRemoteHistoryClass->toArray();
                $aNewHistory['Extensions'] = $aNewHistory['Extensions']->getArrayCopy();
                if (is_object($aNewHistory['Log'])) {
                    $aNewHistory['Log'] = $aNewHistory['Log']->getArrayCopy();
                } else {
                    $aNewHistory['Log'] = array();
                }
                unset($aNewHistory['Id']);


                // interate old histories and convert to array for comparsion
                foreach ($aHistories as $oHistory) {
                    $aHistory               = $oHistory->toArray();
                    $aHistory['Extensions'] = $aHistory['Extensions']->getArrayCopy();
                    if (is_object($aHistory['Log'])) {
                        $aHistory['Log'] = $aHistory['Log']->getArrayCopy();
                    } else {
                        $aHistory['Log'] = array();
                    }

                    unset($aHistory['Id']);

                    // if api-call was not successful, send notifiations if configured
                    if ($aResponse['statuscode'] != 200) {
                        if ($oRemoteApp->checkNotificationSetting("NotificationError")) {
                            $this->_sendErrorNotification($oRemoteApp, $aResponse);
                        }
                    } else {
                        // if api-call was successful, compare old and new history and send differences to user
                        $aNew = $this->arrayRecursiveDiff($aNewHistory, $aHistory);
                        // diff exists?
                        if (!empty($aNew) && $oRemoteApp->checkNotificationSetting("NotificationChange")) {
                            $aOld = $this->arrayRecursiveDiff($aHistory, $aNewHistory);
                            $this->_sendNotification(array(
                                                         'old' => $aOld,
                                                         'new' => $aNew
                                                     ), $oRemoteApp, $aNewHistory);
                        }
                    }
                    // delete old history
                    $oHistory->delete();
                }

                // save created history
                $oRemoteHistoryClass->save();
                $oRemoteApp->setLastRun(time());
                $oRemoteApp->save();

            } else {
                $this->getContainer()->get('logger')->error('Class \'' . $sClassName . '\' not found... ', array("Method"    => __METHOD__,
                                                                                                                                         "RemoteApp" => $oRemoteApp->getName(),
                                                                                                                                         "RemoteURL" => $oRemoteApp->getFullApiUrl()
                ));
                throw new \Exception('Class \'' . $sClassName . '\' not found... ');
            }
        }
571312
protected function createComponentAddForm() : Form
    {
        $roles = UserAuthorizator::ALL_ROLE_KEYS;

        $disabled = !$this->presenter->user->isAllowed(UserAuthorizator::RES_ADD_FORM);

        $form = new Form;

        $form->addText('email')
            ->addRule(Form::EMAIL, 'E-mail je v neplatném formátu.')
            ->setRequired('E-mail je povinný.')
            ->setDisabled($disabled);

        $form->addText('password')
            ->setDisabled();

        $form->addSelect('role', NULL, $roles)
            ->setRequired('Uživatelská role je povinná.')
            ->setDisabled($disabled);

        $form->addSelect('status', NULL, UserAuthorizator::ALL_STATUS_KEYS)
            ->setRequired('Uživatelský status je povinný.')
            ->setDisabled($disabled);

        $form->addText('phone')
            ->setRequired(FALSE)
            ->setDisabled($disabled);

        $form->addText('firstName')
            ->setRequired(FALSE)
            ->setDisabled($disabled);

        $form->addText('lastName')
            ->setRequired(FALSE)
            ->setDisabled($disabled);

        $form->addSubmit('save');


        // Pouze admin může někomu přidat admin práva
        if(!$disabled && !$this->presenter->user->isAllowed(UserAuthorizator::RES_EDIT_ADMINS))
        {
            $key = array_search(UserAuthorizator::ROLE_ADMIN, $roles);
            $form['role']->setDisabled([$key]);
        }


        $form->onValidate[] = function (Form $form) { $this->validate($form); };
        $form->onSuccess[] = function (Form $form) { $this->success($form); };

        return $form;
    }
104694
protected function getTransactionFromRequest(TPkgShopPaymentIPNRequest $oRequest)
    {
        $payload = $oRequest->getRequestPayload();

        /** @var $localIdObject IAmazonReferenceId */
        $localIdObject = $payload['amazonLocalReferenceId'];

        $transactionId = $localIdObject->getTransactionId();

        if (null === $transactionId) {
            throw new AmazonIPNTransactionException(AmazonIPNTransactionException::ERROR_NO_TRANSACTION,
                'there was no transaction connected to the IPN even thought that was expected', array('request' => $oRequest));
        }

        $transaction = \TdbPkgShopPaymentTransaction::GetNewInstance();
        if (false === $transaction->Load($transactionId)) {
            throw new AmazonIPNTransactionException(AmazonIPNTransactionException::ERROR_TRANSACTION_NOT_FOUND,
                'transaction id connected to the IPN is not in the database!', array(
                    'request' => $oRequest,
                    'transactionId' => $transactionId,
                ));
        }

        if ($transaction->fieldShopOrderId !== $oRequest->getOrder()->id) {
            throw new AmazonIPNTransactionException(AmazonIPNTransactionException::ERROR_TRANSACTION_DOES_NOT_MATCH_ORDER,
                'transaction found for the IPN is connected to another order!', array(
                    'request' => $oRequest,
                    'transaction' => $transaction,
                ));
        }

        return $transaction;
    }
331529
public function defaultEditAction(Application $app, Request $request, $id)
    {
        return $this->getEditForm($app, $request, $id);
    }
965849
public function indexDataAction(Request $request)
        {

            $aRemoteApps = RemoteAppQuery::create()->find();
            $sResult     = $this->renderView('SlashworksAppBundle:RemoteApp:data.json.twig', array(
                'entities' => $aRemoteApps,
            ));

            $response = new Response($sResult);
            $response->headers->set('Content-Type', 'application/json');

            return $response;

        }
364816
function _doCapt($oID, $captureType = 'Complete', $amt = 0, $currency = 'USD', $note = '') {
    global $db, $doPayPal, $messageStack;
    $doPayPal = $this->paypal_init();

    //@TODO: Read current order status and determine best status to set this to
    $new_order_status = (int)MODULE_PAYMENT_PAYPALDP_ORDER_STATUS_ID;

    $orig_order_amount = 0;
    $doPayPal = $this->paypal_init();
    $proceedToCapture = false;
    $captureNote = strip_tags(zen_db_input($_POST['captnote']));
    if (isset($_POST['captfullconfirm']) && $_POST['captfullconfirm'] == 'on') {
      $proceedToCapture = true;
    } else {
      $messageStack->add_session(MODULE_PAYMENT_PAYPALDP_TEXT_CAPTURE_FULL_CONFIRM_ERROR, 'error');
    }
    if (isset($_POST['captfinal']) && $_POST['captfinal'] == 'on') {
      $captureType = 'Complete';
    } else {
      $captureType = 'NotComplete';
    }
    if (isset($_POST['btndocapture']) && $_POST['btndocapture'] == MODULE_PAYMENT_PAYPAL_ENTRY_CAPTURE_BUTTON_TEXT_FULL) {
      $captureAmt = (float)$_POST['captamt'];
      if ($captureAmt == 0) {
        $messageStack->add_session(MODULE_PAYMENT_PAYPALDP_TEXT_INVALID_CAPTURE_AMOUNT, 'error');
        $proceedToCapture = false;
      }
    }
    // look up history on this order from PayPal table
    $sql = "select * from " . TABLE_PAYPAL . " where order_id = :orderID  AND parent_txn_id = '' ";
    $sql = $db->bindVars($sql, ':orderID', $oID, 'integer');
    $zc_ppHist = $db->Execute($sql);
    if ($zc_ppHist->RecordCount() == 0) return false;
    $txnID = $zc_ppHist->fields['txn_id'];
    /**
     * Submit capture request to PayPal
     */
    if ($proceedToCapture) {
      $response = $doPayPal->DoCapture($txnID, $captureAmt, $currency, $captureType, '', $captureNote);
      $error = $this->_errorHandler($response, 'DoCapture');
      $new_order_status = ($new_order_status > 0 ? $new_order_status : 1);
      if (!$error) {
        if (isset($response['PNREF'])) {
          if (!isset($response['AMT'])) $response['AMT'] = $captureAmt;
          if (!isset($response['ORDERTIME'])) $response['ORDERTIME'] = date("M-d-Y h:i:s");
        }
        // Success, so save the results
        $sql_data_array = array('orders_id' => (int)$oID,
                                'orders_status_id' => (int)$new_order_status,
                                'date_added' => 'now()',
                                'comments' => 'FUNDS COLLECTED. Trans ID: ' . urldecode($response['TRANSACTIONID']) . $response['PNREF']. "\n" . ' Amount: ' . urldecode($response['AMT']) . ' ' . $currency . "\n" . 'Time: ' . urldecode($response['ORDERTIME']) . "\n" . (isset($response['RECEIPTID']) ? 'Receipt ID: ' . urldecode($response['RECEIPTID']) : 'Auth Code: ' . $response['AUTHCODE']) . (isset($response['PPREF']) ? "\nPPRef: " . $response['PPREF'] : '') . "\n" . $captureNote,
                                'customer_notified' => 0
                             );
        zen_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);
        $db->Execute("update " . TABLE_ORDERS  . "
                      set orders_status = '" . (int)$new_order_status . "'
                      where orders_id = '" . (int)$oID . "'");
        $messageStack->add_session(sprintf(MODULE_PAYMENT_PAYPALDP_TEXT_CAPT_INITIATED, urldecode($response['AMT']), urldecode($response['RECEIPTID'] . $response['AUTHCODE']). $response['PNREF']), 'success');
        return true;
      }
    }
  }
464637
public static function create(Application $app, ReceiverInterface $receiver, EmitterInterface $emitter = null, $message = null, $url = null, \DateTime $expiration = null)
    {
        $mail = new static($app, $receiver, $emitter, $message);
        $mail->setButtonUrl($url);
        $mail->setExpiration($expiration);

        return $mail;
    }
574109
public function buildForm($id = '', $action = '', $async = false, $fileUpload = false, $attributes = [])
    {
        // Create form control
        $form = new Form($this->getHTMLDocument(), $this, $attributes);
        $form->build($id, $action, $async, $fileUpload);

        return $form;
    }
923684
private function mapsController($controller, $uriapp = NULL, $method = NULL, $parentController = NULL){
        $httpMethod= isset($controller['httpMethod']) ? $controller['httpMethod'] : '*';
        if($parentController != NULL){
            $controller['url']= rtrim($parentController['url'], '/') . '/' . ltrim($controller['url'], '/');
        }
        $maps= UrlUri::mapsActualUrl($controller['url'], $uriapp) && UrlUri::mapsActualMethod($httpMethod, $method);
        if($maps){
            $mapController= array(
                'url' => $controller['url'],
                'httpMethod' => $httpMethod,
                'location' => isset($controller['location']) ? $controller['location'] : NULL,
                'namespace' => isset($controller['namespace']) ? $controller['namespace'] : NULL,
                'class' => isset($controller['class']) ? $controller['class'] : $parentController['class'],
                'method' => isset($controller['method']) ? $controller['method'] : NULL,
                'properties' => isset($controller['properties']) ? $controller['properties'] : array(),
                'middlewares' => isset($controller['middlewares']) ? $controller['middlewares'] : []
            );
            if($parentController != NULL){
                if(! isset($controller['class'])){
                    $mapController['location']= isset($parentController['location']) ? $parentController['location'] : NULL;
                    $mapController['namespace']= isset($parentController['namespace']) ? $parentController['namespace'] : NULL;
                }
                if(isset($parentController['properties'])){
                    $mapController['properties']= array_merge($parentController['properties'], $mapController['properties']);
                }
                if(isset($parentController['middlewares'])){
                    $mapController['middlewares'] = array_merge($parentController['middlewares'], $mapController['middlewares']);
                }
            }
            
            return $mapController;
        }else{
            return NULL;
        }
    }
474157
protected function searchSubmittedForm(WebRequest $request, Response $response)
    {
        $this->verifyLayout();
        
        $form = null;
        foreach ($this->layout->getChildrenByType('\\Zepi\\Web\\UserInterface\\Form\\Form', true) as $availableForm) {
            $availableForm->processFormData($request, $response);
        
            if ($availableForm->isSubmitted()) {
                $form = $availableForm;
                break;
            }
        }
        
        return $form;
    }
1038253
protected function createComponentPrimaryForm() : Form
    {
        $indexingTypes = [
            Primary::INDEXING_TYPE_INDEX_FOLLOW     => 'Indexovat, následovat odkazy',
            Primary::INDEXING_TYPE_INDEX_NOFOLLOW   => 'Indexovat, nenásledovat odkazy',
            Primary::INDEXING_TYPE_NOINDEX_FOLLOW   => 'Neindexovat, následovat odkazy',
            Primary::INDEXING_TYPE_NOINDEX_NOFOLLOW => 'Neindexovat, nenásledovat odkazy'
        ];

        $canonicalTypes = [
            0 => 'Stránka není kanonická',
            1 => 'Stránka je kanonická'
        ];


        $form = new Form;

        $form->addText('title')
            ->setRequired('Titulek stránky je povinný.')
            ->addRule(Form::MIN_LENGTH, 'Minimální délka názvu stránky jsou %d znaky.', 3)
            ->addRule(Form::MAX_LENGTH, 'Maximální délka názvu stránky je %d znaků.', 100);

        $form->addText('description')
            ->setRequired(FALSE)
            ->addRule(Form::MIN_LENGTH, 'Minimální délka popisu stránky jsou %d znaky.', 3)
            ->addRule(Form::MAX_LENGTH, 'Maximální délka popisu stránky je %d znaků.', 200);

        $form->addSelect('indexingType', NULL, $indexingTypes)
            ->setRequired('Typ indexace je povinný.');

        $form->addSelect('isCanonical', NULL, $canonicalTypes)
            ->setRequired('Typ kanonizace je povinný.');

        $form->addSubmit('save');


        $onPagePrimary = $this->activePage->getPrimary();

        if ($onPagePrimary)
        {
            $form->setDefaults([
                'title' => $onPagePrimary->getTitle(),
                'description' => $onPagePrimary->getDescription(),
                'indexingType' => $onPagePrimary->getIndexingType(),
                'isCanonical' => (int) $onPagePrimary->getCanonical()
            ]);
        }


        $form->onValidate[] = function (Form $form) { $this->validate($form); };
        $form->onSuccess[] = function (Form $form) { $this->success($form); };


        if (!$this->presenter->user->isAllowed(OnPageAuthorizator::RES_PRIMARY))
        {
            $this->setDisabledForm($form);
        }

        return $form;
    }
1283548
public function create_scan_form($params = null)
    {
        $requestor = new Requestor($this->_apiKey);
        $url = $this->instanceUrl() . '/scan_form';

        list($response, $apiKey) = $requestor->request('post', $url, $params);

        return Util::convertToEasyPostObject($response, $apiKey);
    }
301309
public function deleteAction(Request $request, $id)
        {

            /** @var RemoteApp $oRemoteApp */
            $oRemoteApp = RemoteAppQuery::create()->findOneById($id);

            if ($oRemoteApp === null) {
                throw $this->createNotFoundException('Unable to find RemoteApp entity.');

            }

            // get history-entries for remoteapp to delete
            $aHistories = RemoteHistoryContaoQuery::create()->findByRemoteAppId($oRemoteApp->getId());
            foreach ($aHistories as $oHistory) {
                $oHistory->delete();
            }
            $oRemoteApp->delete();

            return $this->redirect($this->generateUrl('remote_app'));
        }
756899
private function createRemovePaymentForm($action, $cancelPath)
    {
        return $this
            ->createFormBuilder(null, [
                'action' => $action,
                'attr' => [
                    'class' => 'form-horizontal',
                ],
                'method' => 'POST',
                'admin_mode' => true,
                '_redirect_enabled' => true,
            ])
            ->add('confirm', 'checkbox', [
                'label' => 'ekyna_order.payment.message.remove_confirm',
                'attr' => ['align_with_widget' => true],
                'required' => true,
                'constraints' => [
                    new Constraints\True(),
                ]
            ])
            ->add('actions', 'form_actions', [
                'buttons' => [
                    'remove' => [
                        'type' => 'submit', 'options' => [
                            'button_class' => 'danger',
                            'label' => 'ekyna_core.button.remove',
                            'attr' => [
                                'icon' => 'trash',
                            ],
                        ],
                    ],
                    'cancel' => [
                        'type' => 'button', 'options' => [
                            'label' => 'ekyna_core.button.cancel',
                            'button_class' => 'default',
                            'as_link' => true,
                            'attr' => [
                                'class' => 'form-cancel-btn',
                                'icon' => 'remove',
                                'href' => $cancelPath,
                            ],
                        ],
                    ],
                ],
            ])
            ->getForm()
        ;
    }
1255393
public function frm($txt, $att = '', $a = '', $m = '', $e = '')
    {
        $attList = array();
        if (!empty($a)) {
            $attList['action'] = $a;
        }
        if (!empty($m)) {
            $attList['method'] = $m;
        }
        if (!empty($e)) {
            $attList['enctype'] = $e;
        }
        $newatt = $this->addAttributes($attList, $att);

        return $this->tag('form', $txt, $newatt);
    }
320349
private function _makeCall($oRemoteApp)
        {

            // get class
            $this->getContainer()->get('API');
            // do call
            Api::$_container = $this->getContainer();
            $aReturn = Api::call('getData', array(
                array(
                    'log'    => $oRemoteApp->getIncludelog(),
                    'format' => 'json'
                )
            ), $oRemoteApp->getFullApiUrl(), $oRemoteApp->getPublicKey(), $oRemoteApp);

            // build json response
            $sStatuscode = $aReturn['statuscode'];
            $aReturn     = json_decode($aReturn['result'], true);
            if (!isset($aReturn['status'])) {
                $aReturn['status'] = true;
            }
            $aReturn['statuscode'] = $sStatuscode;

            if($sStatuscode != 200) {
                $this->getContainer()->get('logger')->error("ERROR in ".__FILE__." on line ".__LINE__." - ".json_encode($aReturn), array("Method"    => __METHOD__,
                                                                     "RemoteApp" => $oRemoteApp->getName(),
                                                                     "RemoteURL" => $oRemoteApp->getFullApiUrl()
                ));
            }

            return $aReturn;
        }