Пример #1
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;
 }
Пример #2
0
 public function exportAllNew()
 {
     $filename = "export.arff";
     $handle = fopen($filename, 'w+');
     $text = "@relation 'price'\n@attribute y {-1,1}\n@attribute x0 numeric\n@data\n\n";
     $array = array(array());
     foreach (\MkmScraper\Card::where("rarity", "Mythic")->get() as $card) {
         $date = "2015-09-03";
         while ($date < "2015-12-10") {
             $row = array();
             //$objects['sell'][]=array($dateexp[0], $dateexp[1],$dateexp[2],\MkmScraper\GraphPrice::getPriceWeek($date,$this));
             //$objects['art'][]=array($dateexp[0], $dateexp[1],$dateexp[2],\MkmScraper\Article::getArticlesWeek($date,$this));
             $articles = \MkmScraper\Article::getDiffWeek(date("Y-m-d", strtotime($date) + 21 * 24 * 60 * 60), $card);
             if ($articles > 0) {
                 $row[] = \MkmScraper\DecklistAppearance::tournamentDiffLastWeek($date, $card);
                 $row[] = \MkmScraper\GraphPrice::getPriceDiffWeekBoolean($date, $card);
                 $row[] = $articles;
                 $array[] = $row;
             }
             //$objects['art'][]=array($dateexp[0], $dateexp[1],$dateexp[2],\MkmScraper\Article::getDiffWeek($date,$this));
             $date = date("Y-m-d", strtotime($date) + 7 * 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'));
 }
Пример #3
0
 public static function getDiffWeekBoolean($date, $card)
 {
     return Article::getDiffWeek($date, $card) > 0 ? "1" : "-1";
 }