public static function parse(\DOMElement $package)
 {
     $jq = new jQuery($package);
     $package = new static($jq->attr('package_name'));
     $package->setLinksTotal((int) $jq->attr('package_linkstotal'));
     $package->setPercent((double) $jq->attr('package_percent'));
     $package->setSize($jq->attr('package_size'));
     $package->setLoaded($jq->attr('package_loaded'));
     $files = array();
     foreach ($jq->find('file') as $file) {
         $files[] = JDownloaderFile::parse($file);
     }
     $package->setFiles($files);
     return $package;
 }
 public static function parse(\DOMElement $file)
 {
     $jq = new jQuery($file);
     $file = new static($jq->attr('file_name'));
     $file->setHoster($jq->attr('file_hoster'));
     $file->setStatus($jq->attr('file_status'));
     $file->setPercent((double) $jq->attr('file_percent'));
     $file->setSize($jq->attr('file_size'));
     $file->setLoaded($jq->attr('file_downloaded'));
     return $file;
 }
Пример #3
0
 /**
  *
  * Reihenfolge der Optionen ist wichtig
  */
 public function formSelect($html, $label, $name, $selectedValue = NULL, $options = NULL)
 {
     $select = $this->css($sel = sprintf('select[name="%s"]', $name), $html)->count(1, 'Count-Selector: ' . $sel)->hasAttribute('name', $name)->getJQuery();
     // options parsen
     $actualSelected = NULL;
     $actualOptions = array();
     foreach ($select->find('option') as $option) {
         $option = new jQuery($option);
         if ($option->attr('selected') != NULL) {
             $this->testCase->assertEmpty($actualSelected, 'Attribut "selected" ist mehrmals in <select> angegeben!');
             $actualSelected = $option->attr('value');
             // kann auch leer sein
         }
         // @TODO reread: name hier "überschreiben" okay? wiesn das in html?
         $actualOptions[$option->attr('value')] = $option->text();
     }
     if (func_num_args() >= 5) {
         $this->testCase->assertEquals($options, $actualOptions, 'Optionen stimmen nicht. (Reihenfolge relevant)');
     }
     if (func_num_args() >= 4) {
         $this->testCase->assertEquals($selectedValue, $actualSelected, 'Selected value stimmt nicht');
     }
     // label muss die id vom input haben
     if ($label != NULL) {
         $this->formLabelFor($html, $label, $select->attr('id'));
     }
 }