# View para visualizar os últimos posts no dashboard
# - mural (texto)
# - fórum
# - citybook (scrap)
# - citybook (foto)
# - boas práticas
(
    SELECT
	txt.mmt_id AS id,
	txt.mmt_texto AS titulo,
	txt.mmt_insert AS 'data',
	1 AS origem_id,
	'Mural Texto' AS origem_nome
    FROM
	mod_mural_mult_texto AS txt
    WHERE (
        txt.mmt_texto IS NOT NULL AND
        txt.mmt_texto != '' AND
        txt.mmt_status = 1
    )
)
UNION ALL
(
    SELECT
	txt.mmt_id AS id,
	txt.mmt_texto AS titulo,
	txt.mmt_insert AS 'data',
	2 AS origem_id,
	'Fórum' AS origem_nome
    FROM
	mod_mural_mult_texto AS txt
    WHERE (
        txt.mmt_texto IS NOT NULL AND
        txt.mmt_texto != '' AND
        txt.mmt_status = 1
    )
)
UNION ALL
(
    SELECT
	cs.scr_id AS id,
	cs.scr_texto AS titulo,
	cs.scr_datahora AS 'data',
	3 AS origem_id,
	'Citybook (Scrap)' AS origem_nome
    FROM
	rso_scrap AS cs
    WHERE (
        cs.scr_texto IS NOT NULL AND
        cs.scr_texto != '' AND
        cs.scr_status = 1
    )
)
UNION ALL
(
    SELECT
	cf.fot_id AS id,
	cf.fot_titulo AS titulo,
	cf.fot_datahora AS 'data',
	4 AS origem_id,
	'Citybook (Foto)' AS origem_nome
    FROM
	rso_foto AS cf
    WHERE (
        cf.fot_titulo IS NOT NULL AND
        cf.fot_titulo != '' AND
        cf.fot_status = 1
    )
)
UNION ALL
(
    SELECT
	s.sta_id AS sta_id,
        s.sta_titulo AS titulo,
        s.sta_insert AS 'data',
        5 AS origem_id,
        'Boas práticas' AS origem_nome
    FROM
        mod_star AS s
    WHERE (
        s.sta_titulo IS NOT NULL AND
        s.sta_titulo != '' AND
        s.sta_status = 1
    )
);