Megasenna module

@dan I’m developing a module, with lottery results here in Brazil. It will be a free module and I will make it available here in the community.

Well, it will bring the lottery results as shown in the image below:

The only difficulty I have is regarding the issue of adding the module to the layout, it has this option that when you click it goes to a sub menu with just a search bar, the ideal would be to be able to drag and drop it into the layout as it is in the webpage module. Currently the comparison my module is like the clock, where you click and display the clocks I want so you can drag someone. Here is my xml:

<module>
    <id>xibosignage-megasena</id>
    <name>Mega-Sena Results</name>
    <icon>fa fa-sitemap</icon>
    <author>Seu Nome</author>
    <description>Displays the latest Mega-Sena lottery results</description>
    <class>\Xibo\Custom\MegaSenaDataProvider</class>
    <type>megasena</type>
    <dataType>lottery</dataType>
    <schemaVersion>1</schemaVersion>
    <assignable>1</assignable>
    <regionSpecific>1</regionSpecific>
    <renderAs>html</renderAs>
    <defaultDuration>60</defaultDuration>
    <settings></settings>
    <properties></properties>
    <preview></preview>
    <stencil>
      <hbs><![CDATA[
   <style>
        body {
            font-family: Arial, sans-serif;
            margin: 0;
            padding: 0;
        }
        /* Estilo para a navbar */
       
        .content-mega {
2 Likes

I made the API available on Github: GitHub - henriquelucas/Modulo-Mega-Senna-Xibo

Great to see someone making use of the new module system - I hope it was easy to understand?

Your use case is interesting - because your module has a dataType the system expects there to either be Elements or Static Templates to choose from, which I can see that you have in your repository. I don’t think we currently have a way for a “widget with data” to be added it one go, as we’ve assumed there will be multiple options.

@maurofmf perhaps something for us to consider?

2 Likes

@dan After making the corrections, I understood how it worked better, I confess that I was a little lost. Because the module is free, I believe it will help many users in Brazil, feel free to integrate it into Xibo officially if you wish.

1 Like

@dan Now there is an issue that I noticed.
I have the: Title, body, date. As elements, but if you try to create an element called winner it even appears as an element, but when dragging and dropping it does not bring data. I saw that exiter o data.body do I need to do something else in this part of the template so that it brings the data from the provider? or am I limited to using these tags like body, data, etc. I didn’t find anything in the documentation regarding this.

Have you defined your lottery data type?

@Nadz when you get a moment do you think you can provide some guidance here?

I did the following:

  <template>
        <id>lottery_vencedor</id>
        <extends override="text" with="data.vencedor" escapeHtml="false">text</extends>
        <title>Vencedores</title>
        <type>element</type>
        <dataType>lottery</dataType>
        <icon>fa-solid fa-trophy</icon>
        <canRotate>true</canRotate>
        <startWidth>500</startWidth>
        <startHeight>100</startHeight>
    </template>

and in my data provider:

 // Adicionando os dados ao provider
            $dataProvider->addItem([
                'subject' => 'Número do Concurso - ' . $numeroConcurso,
                'vencedor' => '01 ganhador',
                'body' => $dezenasHtml . $valorAcumuladoHtml,  // Concatenando as dezenas com os dados do prêmio
                'date' => Carbon::now(),
                'createdAt' => Carbon::now(),
            ]);

When I drag the element to the layout, the data does not appear: Ganhador 01

The issue with the elements has now been resolved, thank you for your support. @dan

2 Likes

Olá, Henrique!

Eu também explorei outros formatos de loterias para o meu Xibo e obtive ótimos resultados. Desenvolvi um script em PHP para extrair e tratar os dados, e depois os puxava no Xibo usando JSON e também RSS.

Acredito que, no seu caso, uma solução seria criar uma saída no formato adequado para usar no Dataset do Xibo, aproveitando o Feed.

Crie ele com diversos elementos que você mesmo pode escolher o que quer que apareça no layout, como, por exemplo: número do sorteio, números sorteados das dezenas, valor acumulado e muito mais.

No entanto, o grande problema é que o módulo não está atualizando automaticamente. Depois que o layout é montado e salvo, ele não atualiza automaticamente; é necessário ficar abrindo e salvando o layout para que essas alterações aconteçam. Se possível, faça um teste com ele no seu CMS e verifique se atualiza automaticamente. Desconfio que possa ser um problema do meu CMS, já que a tarefa de Widget Sync no meu CMS não está funcionando como deveria.