use of forpdateam.ru.forpda.api.news.models.Material in project ForPDA by RadiationX.
the class NewsApi method parseMaterials.
private void parseMaterials(ArrayList<Material> materials, String sourceMaterials) {
if (sourceMaterials == null)
return;
Matcher matcher = materialsPattern.matcher(sourceMaterials);
while (matcher.find()) {
Material material = new Material();
material.setImageUrl(matcher.group(1));
material.setId(Integer.parseInt(matcher.group(2)));
material.setTitle(ApiUtils.fromHtml(matcher.group(3)));
materials.add(material);
}
}
use of forpdateam.ru.forpda.api.news.models.Material in project ForPDA by RadiationX.
the class NewsRx method transform.
public static DetailsPage transform(DetailsPage page) throws Exception {
MiniTemplator t = App.get().getTemplate(App.TEMPLATE_NEWS);
App.setTemplateResStrings(t);
t.setVariableOpt("style_type", App.get().getCssStyleType());
t.setVariableOpt("details_title", ApiUtils.htmlEncode(page.getTitle()));
t.setVariableOpt("details_content", page.getHtml());
for (Material material : page.getMaterials()) {
t.setVariableOpt("material_id", material.getId());
t.setVariableOpt("material_image", material.getImageUrl());
t.setVariableOpt("material_title", material.getTitle());
t.addBlockOpt("material");
}
page.setHtml(t.generateOutput());
t.reset();
return page;
}
Aggregations