public function doInsert() { global $baseDir; $movies_array = JSONParser::parseJSON($baseDir . '\\mysite\\inTheatre.json'); //9 items for ($i = 0; $i < count($movies_array); $i++) { $movie = Movie::create(); $movie = $movies_array[$i]; $movie->MovieListPageID = $this->ID; $movie->write(); } return $this->redirectBack(); }
/** * Gets the default and possible locales of the shop. */ private static function load() { // if request method is blocked if (!RESTClient::setRequestMethod("GET")) { return; } $content = JSONParser::parseJSON(RESTClient::send(self::RESTPATH)); // if respond is empty if (InputValidator::isEmpty($content)) { return; } // if there is no default AND items element if (!array_key_exists("default", $content) || !array_key_exists("items", $content)) { Logger::error("Respond for " . self::RESTPATH . " can not be interpreted."); return; } // reset values self::resetValues(); // save the default localization self::$DEFAULT = $content["default"]; // parse the possible localizations self::$ITEMS = $content["items"]; }