public function genXML() { $archivos = $this->files[$this->contentId]; $nombres = array(); foreach ($archivos as $i => $ruta) { $tmp = explode("/", $ruta); $tmp = $tmp[count($tmp) - 1]; $nombres[$i] = $tmp; } $binarios = implode("<br>", $nombres); $modelos = ""; $modelos_mig_str = ""; $modelos_mig = array(); foreach ($archivos as $i => $arch) { $ids_celulares = getAllModels($this->dbc, $arch); // echo "Cantidad de modelos compatibles: " . count($ids_celulares); foreach ($ids_celulares as $idC) { $modelo_mig = getSuggestedMigModelById($idC); if (!empty($modelo_mig)) { $modelos_mig[] = array("Binary" => $nombres[$i], "Compatible Devices" => $modelo_mig); // $modelos_mig_str = implode("\n", $modelos_mig); } } } $modelos_mig_str = $modelos_mig; //implode("<br>", $modelos_mig); /* $this->arrayDatos = array("CP Name" => "Wazzup_cp", "Date of Ingest" => date("d.m.Y"), "Zip Filename" => "", "Product Type" => "mgdGame", "ProviderGivenContentID" => $this->contentId, "Content Title" => $this->name, "Keywords" => implode("<br/>", $keywords), "Website Category" => $this->webCat, "Short Description (Abstract)" => $this->shortDescription, "Length of short description" => "", //dejar vacio "Creator" => $this->provider, "Genres" => "{$this->tag}", "Binary" => $modelos_mig_str, "Compatible Devices" => $modelos_mig_str, "Thumbnail" => '<img src="'.$this->preview_uri.'"/>', "Preview" => "", "Mexico" => "", "Colombia" => "X", "Ecuador" => "X", "Panama" => "X", "Peru" => "X", "Argentina" => "", "Paraguay" => "", "Uruguay" => "", "Brasil" => "", "Chile" => "", "Guatemala" => "", "El Salvador" => "", "Honduras" => "", "Nicaragua" => "", "Puerto Rico" => "", "República Dominicana" => "", "Jamaica" => "", "CP Revenue Share Mexico" => "", "CP Revenue Share Colombia" => "40", "CP Revenue Share Ecuador" => "40", "CP Revenue Share Panama" => "40", "CP Revenue Share Peru" => "40", "CP Revenue Share Argentina" => "", "CP Revenue Share Paraguay" => "", "CP Revenue Share Uruguay" => "", "CP Revenue Share Brasil" => "", "CP Revenue Share Chile" => "", "CP Revenue Share Guatemala" => "", "CP Revenue Share El Salvador" => "", "CP Revenue Share Honduras" => "", "CP Revenue Share Nicaragua" => "", "CP Revenue Share Puerto Rico" => "", "CP Revenue Share República Dominicana" => "", "CP Revenue Share Jamaica" => "", "Precio México (Pesos)" => "", "Precio Colombia (Pesos Colombianos)" => "4310", "Precio Ecuador (Dólar)" => "2,9", "Precio Panama (Dólar)" => "3,1", "Precio Peru (Sol)" => "7,56", "Precio Argentina (Pesos)" => "", "Precio Paraguay (Guaraní)" => "", "Precio Uruguay (Pesos uruguayos)" => "", "Precio Brasil (R$)" => "", "Precio Chile (Pesos chilenos)" => "", "Precio Guatemala (Quetzales)" => "", "Precio El Salvador (Colón)" => "", "Precio Honduras (El Lempira)" => "", "Precio Nicaragua (Córdoba)" => "", "Precio Puerto Rico (Dólar)" => "", "Precio República Dominicana (RD$)" => "", "Precio Jamaica (J$)" => "", "Successfully Ingested" => "", "Ingestion Errors" => "");*/ $this->arrayDatos = array("Content Title" => $this->title, "Website Category" => $this->webCat, "Genres" => $this->tag, "Short Description" => $this->shortDescription, "Creator" => $this->artist . $this->marca . $this->festivo); $this->arrayDevicesCompatibles = array("Binary" => $modelos_mig_str, "Compatible Devices" => $modelos_mig_str); //var_dump($this->arrayDevicesCompatibles); $this->addLog("<" . __LINE__ . "> " . __METHOD__); $this->addLog("Generando XML para {$this->contentId}"); if (!is_numeric($this->contentId) || $this->contentId <= 0) { $this->genException("CRIT", __LINE__, __METHOD__, ": content_id no valido"); } $carriers = explode(",", CARRIERS); $langs = explode(",", LANGS); $xmlstr = XML_HEADER . "\n" . '<mgdGamesProduct xmlns="http://www.qpass.net/telcel/mgdGames" xmlns:qpass="******" xmlns:jcr="http://www.jcp.org/jcr/1.0">' . "\n"; // TAG:MERCHANT foreach ($this->merchants as $merchant) { $carrier = $this->obtainCarrier($merchant); $xmlstr .= "\t<qpass:merchant>{$carrier}</qpass:merchant>\r\n"; } $rating = $this->adult == "true" ? "18+" : $this->rating; $xmlstr .= <<<XML \t<qpass:rating> \t\t<qpass:scheme>Mexico</qpass:scheme> \t\t<qpass:value>{$this->rating}</qpass:value> \t\t<qpass:comment>Comment</qpass:comment> \t</qpass:rating> XML; $xmlstr .= "\n\t<providerGivenContentId>{$this->uniqueId}</providerGivenContentId>\n"; // TAG:TITLE foreach ($this->langs as $lang) { if (mustTranslateToEN($lang) === TRUE) { $xmlstr .= "\t<title qpass:lang=\"{$this->obtainLang($lang)}\">{$this->title}</title>\r\n"; } else { $xmlstr .= "\t<title qpass:lang=\"{$this->obtainLang($lang)}\">{$this->title}</title>\r\n"; } } $xmlstr .= "\t<genres>{$this->tag}</genres>\n"; $xmlstr .= "\t<subgenres1>{$this->subTag}</subgenres1>\n"; $xmlstr .= "\t<creators>wazzup</creators>\n"; $xmlstr .= "\t<publisher>wazzup</publisher>\n"; $xmlstr .= "\t<language>{$this->language}</language>\n"; // TAG:KEYWORDS foreach ($this->langs as $lang) { foreach ($this->keywords as $keyword) { if (!empty($keyword)) { if (mustTranslateToEN($lang) === TRUE) { $xmlstr .= "\t<keywords qpass:lang=\"{$this->obtainLang($lang)}\">{$keyword}</keywords>\r\n"; } else { $xmlstr .= "\t<keywords qpass:lang=\"{$this->obtainLang($lang)}\">{$keyword}</keywords>\r\n"; } } } } // TAG:SHORTDESCRIPTION foreach ($this->langs as $lang) { if (mustTranslateToEN($lang) === TRUE) { $xmlstr .= "\t<shortDescription qpass:lang=\"{$this->obtainLang($lang)}\">{$this->shortDescription}</shortDescription>\r\n"; } else { $xmlstr .= "\t<shortDescription qpass:lang=\"{$this->obtainLang($lang)}\">{$this->shortDescription}</shortDescription>\r\n"; } } // TAG:LONGDESCRIPTION foreach ($this->langs as $lang) { if (mustTranslateToEN($lang) === TRUE) { $xmlstr .= "\t<longDescription qpass:lang=\"{$this->obtainLang($lang)}\">{$this->longDescription}</longDescription>\r\n"; } else { $xmlstr .= "\t<longDescription qpass:lang=\"{$this->obtainLang($lang)}\">{$this->longDescription}</longDescription>\r\n"; } } $xmlstr .= "\t<categoryLevel>{$this->catLvl}</categoryLevel>\n"; $curdate = date("d-M-Y"); $xmlstr .= "\t<creationDate>{$curdate}</creationDate>\n"; $xmlstr .= "\t<releaseDate>{$curdate}</releaseDate>\n"; $xmlstr .= "\t<websiteCategory>{$this->webCat}</websiteCategory>\n"; $name = $this->getThumbnailFilename(); // $this->arrayDatos["Thumbnail"] = '<img src="'.$this->getDirToWrite()."/".$name.'"/>'; $xmlstr .= <<<XML \t<thumbnail> \t\t<thumbnailResource> \t\t\t<qpass:resourceFilename>{$name}</qpass:resourceFilename> \t\t\t<qpass:mimeType>image/gif</qpass:mimeType> \t\t</thumbnailResource> \t</thumbnail> XML; $name = $this->getPreviewFilename(); $xmlstr .= "\n\t<previewImage>\n"; $xmlstr .= <<<XML \t\t<previewGifResource> \t\t\t<qpass:resourceFilename>{$name}</qpass:resourceFilename> \t\t\t<qpass:mimeType>image/gif</qpass:mimeType> \t\t</previewGifResource> \t</previewImage> XML; $xmlstr .= "\n\t<premium>\n"; $xmlstr .= "%%PREMIUM%%"; $xmlstr .= "\t</premium>"; /* $filename = $this->getContentFilename(); $xmlstr .= "\n\t<premium>"; foreach ($this->availableContent as $size => $available) { if ($available) { $size = strtoupper($size); $thisfile = str_replace("%RESOLUTION%", $size, $filename); $xmlstr .=<<<XML <jarResource> <qpass:resourceFilename>{$thisfile}</qpass:resourceFilename> <qpass:mimeType>image/gif</qpass:mimeType> <qpass:resourceFilename>{$thisfile}</qpass:resourceFilename> <qpass:descriptorFilename>{$thisfile}.jad</qpass:descriptorFilename> <qpass:mimeType>application/java-archive</qpass:mimeType> <qpass:deviceId>samsung_sgh_e496_ver1</qpass:deviceId> </jarResource> XML; } } $xmlstr .= "\t</premium>\n"; */ $xmlstr .= "</mgdGamesProduct>"; $this->addLog("XML Generado:\n" . $xml); return $xmlstr; }
$game->loadContent($contentId); } catch (Exception $e) { $log .= "loadContent: " . $e->getMessage() . "\n"; } try { $content_downloaded = FALSE; $game->setTag($catdrutt); // descargo contenido por FTP $log .= "\tdescargando contenido {$contentId}...\n"; $i = 0; $conectado = FALSE; foreach ($juegos as $archivo) { $content_downloaded = getFtpFiles($archivo); if ($content_downloaded === TRUE) { echo "({$contentId}) Armando lista de devices para {$archivo} <br/>"; $models = getAllModels($dbc, $archivo); echo "({$contentId}) Generando XML variants... <br/>"; $newCompatElement = generateVariantXml($dbc, $contentId, $archivo, $uniqueId, $models, $xml); if ($newCompatElement === FALSE) { echo "({$contentId}) - could not generate variant for <b>{$modelId}</b> <br/>"; //---------------------------------------------------------------------------- // new v1.4: delete jad/jars (by kmS) // borra jad/jar descargado previamente si no existen devices compatibles // lease: no manda en el zip archivos jad/jar a los que no se hace referencia // en el xml //---------------------------------------------------------------------------- echo "Devices not Found for archivo={$archivo}!<br/>"; echo "Cleaning not used jad/jar files...<br/>"; $info = pathinfo($archivo); $toJad = $info['basename']; $del1 = TMP_DIR_JG . "/" . $toJad;