Esempio n. 1
0
 public static function reverse(NodeElement $buttonNode, Button $buttonObj, Elements $elements = null)
 {
     if ($buttonNode->getTagName() === 'button') {
         $buttonObj->setNode($buttonNode);
     } else {
         throw new \LogicException('tag mismatch');
     }
     $parents = $buttonObj->getParents();
     $outer = $buttonNode->getOuterHtml();
     $label = $buttonNode->getText();
     if ($label) {
         $buttonObj->setLabel($label);
     } else {
         $x = 1;
     }
     //return;
     /*     $elem = [];
             $id = $button->getAttribute('id');
     
             $html = $button->getOuterHtml();
             $test = '/<[a-z]+\s([^>]*)/';
             if (preg_match($test, $html, $matches)) {
                 preg_match_all('/([a-z]+=".*?")/', $matches[1], $attribs1);
                 $attribs = preg_split('/ /', $matches[1], null, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
                 $elem['attr'] = $attribs;
             }
     
     
             if ($button->getTagName() === 'a') {
                 $href = $button->getAttribute('href');
                 $elem['href'] = $href;
             }
     
     
             if (!$id) {
     
                 $dt = $content->find('css', 'table.table-columnfilter');
                 if ($dt) {
                     //skip datatable;
                     //continue;
                 }
     
                 $label = $button->getText();
                 $xpath = $button->getXpath();
     
                 $elem['xpath'] = $xpath;
                 $elem['label'] = $label;
             } else {
                 $label = $button->getText();
     
                 $elements['buttons'][] = ['id' => $id, 'label' => $label];
             }
     
             $elements['buttons'][] = $elem;*/
 }
Esempio n. 2
0
 public function isRegisteredButton(Button $button)
 {
     /** @var Input $registeredInput */
     foreach ($this->registeredButtons as $registeredButton) {
         if ($button->getId()) {
             /** @var Input $registeredButton */
             if ($registeredButton->getId() === $button->getId()) {
                 return true;
             }
         }
         //$x1 = $registeredButton->getXpath();
         //$x2 = $button->getXpath();
         if ($registeredButton->getXpath() === $button->getXpath()) {
             return true;
         }
         if ($registeredButton->getNode()->getOuterHtml() === $button->getNode()->getOuterHtml()) {
             return true;
         }
     }
     return false;
 }
Esempio n. 3
0
 /**
  * @param DataTable $dt
  * @param Button|Text $action
  * @param Block $codeBlock
  */
 private static function createActionTest(DataTable $dt, $action, Block $codeBlock)
 {
     $options = ['session' => '$session', 'xpath' => $action->getXpath()];
     if ($action->hasClass('ColVis_Button')) {
         if ($action->getLabel() === 'Kolumny') {
             // clear filtr
             $codeBlock->appendRenderable(new Comment('action columns: ' . $action->getLabel()));
             $codeBlock->appendRenderable(new Statement(new StaticMethodCall('parent', 'dtActionColumns', $options)));
         } else {
             $x = 1;
         }
     } elseif ($action->getLabel() === 'filtr') {
         // visible columns
         $codeBlock->appendRenderable(new Comment('action filter: ' . $action->getLabel()));
         $codeBlock->appendRenderable(new Statement(new StaticMethodCall('parent', 'dtActionFilter', $options)));
     } elseif ($action->getLabel() === 'dtsearch') {
         $codeBlock->appendRenderable(new Comment('action globalsearch: ' . $action->getLabel()));
         $codeBlock->appendRenderable(new Statement(new StaticMethodCall('parent', 'dtActionGlobalSearch', $options)));
     } else {
         $x = 1;
     }
 }