public function exportCardNew($id)
 {
     $filename = "export.arff";
     $handle = fopen($filename, 'w+');
     $text = "@relation 'price'\n@attribute y {-1,1}\n@attribute x0 numeric\n@attribute x1 numeric\n@attribute x2 numeric\n@attribute x3 numeric\n@attribute x4 numeric\n@attribute x5 numeric\n@attribute x6 numeric\n@attribute x7 numeric\n@attribute x8 numeric\n@attribute x9 numeric\n@data\n\n";
     $array = array(array());
     $card = \MkmScraper\Card::find($id);
     $date = "2015-09-03";
     while ($date < "2015-12-10") {
         $row = array();
         $row[] = \MkmScraper\GraphPrice::getPriceSingleWeekBoolean($date, $card);
         $row[] = \MkmScraper\DecklistAppearance::tournamentDiffLastWeek(date("Y-m-d", strtotime($date) - 0 * 24 * 60 * 60), $card);
         $row[] = \MkmScraper\DecklistAppearance::tournamentDiffLastWeek(date("Y-m-d", strtotime($date) - 7 * 24 * 60 * 60), $card);
         $row[] = \MkmScraper\Article::getDiffWeek(date("Y-m-d", strtotime($date) - 0 * 24 * 60 * 60), $card);
         $row[] = \MkmScraper\Article::getDiffWeek(date("Y-m-d", strtotime($date) - 7 * 24 * 60 * 60), $card);
         $row[] = \MkmScraper\Article::getArticlesWeek(date("Y-m-d", strtotime($date) - 0 * 24 * 60 * 60), $card);
         $row[] = \MkmScraper\Article::getDiffWeek(date("Y-m-d", strtotime($date) + 7 * 24 * 60 * 60), $card);
         $row[] = \MkmScraper\GraphPrice::pptqSeason($date);
         $row[] = $card->distanceFromRotationExp($date);
         $row[] = $card->daysFromRelease($date);
         $row[] = \MkmScraper\GraphPrice::getPriceOtherSingleWeek(date("Y-m-d", strtotime($date) - 0 * 24 * 60 * 60), $card);
         $row[] = \MkmScraper\GraphPrice::tournamentsNextWeekend($date);
         $row[] = \MkmScraper\GraphPrice::boostersOpen($date);
         $array[] = $row;
         $date = date("Y-m-d", strtotime($date) + 1 * 24 * 60 * 60);
     }
     foreach ($array as $row) {
         foreach ($row as $item) {
             $text .= $item . ",";
         }
         $text .= "\n";
     }
     file_put_contents($filename, $text);
     return \Response::download($filename, 'export.arff', array('Content-Type' => 'text/aarf'));
 }
Exemple #2
0
 public function getMovementData()
 {
     $date = "2015-09-03";
     $objects = array();
     while ($date < "2015-12-10") {
         //$object['sell']=\MkmScraper\CardPrice::getPriceWeek($date,$this);
         $object['price'] = \MkmScraper\GraphPrice::getPriceWeek($date, $this);
         $object['lowprice'] = \MkmScraper\CardPrice::getPriceWeek($date, $this);
         $object['singleprice'] = \MkmScraper\GraphPrice::getPriceSingleWeek($date, $this);
         $object['lowsingleprice'] = \MkmScraper\CardPrice::getPriceSingleWeek($date, $this);
         //$object['art']=\MkmScraper\Article::getArticlesWeek($date,$this);
         //$object['art']=\MkmScraper\Article::getArticlesWeek(date("Y-m-d",strtotime($date)+6*24*60*60),$this);
         //$object['art']=\MkmScraper\Article::getArticlesTwoWeek($date,$this);
         $object['sell'] = \MkmScraper\GraphPrice::getPriceDiffWeek($date, $this);
         $object['date'] = $date;
         //$object['sell']=\MkmScraper\CardPrice::getPriceDiffWeek($date,$this);
         //$objects['art'][]=array($dateexp[0], $dateexp[1],$dateexp[2],\MkmScraper\Article::getDiffWeek($date,$this));
         $object['arttot'] = \MkmScraper\Article::getArticlesWeek($date, $this);
         $object['art'] = \MkmScraper\Article::getDiffWeek($date, $this);
         $object['tour'] = \MkmScraper\DecklistAppearance::tournamentLastWeek($date, $this);
         $object['tourdiff'] = \MkmScraper\DecklistAppearance::tournamentDiffLastWeek(date("Y-m-d", strtotime($date) - 14 * 24 * 60 * 60), $this);
         $date = date("Y-m-d", strtotime($date) + 7 * 24 * 60 * 60);
         $objects[] = $object;
     }
     return $objects;
 }