Fullcalendar put image in different sql

0

I have a calendar of API FullCalendar , it pulls events from the database, so quiet, it pulls right, but for every sql , because the information is from several different tables, I would like a different image. That's the way it is today:

  

PHP

$sql = "SELECT id, title, descricao, start, end, color FROM events where responsavel like '%".$LOG_NOME."%'";
//$sql .= ";";
$sql2 = "SELECT TA_ID as id, TA_TAREFA as title, TA_DESCRICAO as descricao, TA_PRAZO as start, TA_PRAZO as end, color FROM db_tarefas WHERE TA_SOLICITADO like '%".$LOG_NOME."%' AND (TA_STATUS = 'NOVA' OR TA_STATUS = 'EM ANDAMENTO')";
//$sql .= ";";
//var_dump($sql);
//echo '<tr><td> '. $FET_ASSISTENCIA["AS_EQUIPE_VIATURA"] . '</td> <td>' . $FET_ASSISTENCIA["AS_EQUIPE_SOCORRISTA"] .'</td><td>'. $FET_ASSISTENCIA["AS_EQUIPE_ENFERMAGEM"] .'</td><td>' . $FET_ASSISTENCIA["AS_EQUIPE_MEDICO"] . '</td>';
$sql3 = "SELECT AS_EQUIPE_VIATURA as viatura, AS_EQUIPE_MEDICO as medico, AS_EQUIPE_SOCORRISTA as socorrista, AS_EQUIPE_ENFERMEIRO as enfermagem, AS_SERVICO_TIPO as tipo, AS_SERVICO_TIPO as tipoS,  AS_ID as id, AS_EMPRESA_NOME as title, AS_PACIENTE_NOME as descricao, AS_EVENTO_FINAL as start, AS_EVENTO_FINAL as end, '#696969' as color FROM db_assistencias WHERE AS_EVENTO_FINAL is not null AND AS_EVENTO_FINAL != '0000-00-00 00:00:00' AND AS_EXCLUIDO='' ";

$sql4 = "SELECT lans_id as id, lans_id_funcionario as title, lans_id_funcionario as funcionario, lans_id_funcionario as descricao, lans_id_dia as start, lans_id_dia as end, '#696985' as color, extra_subs as extra, lans_valor as valor FROM db_lancamento_substituto WHERE extra_subs = 'SIM'  AND lans_id_dia is not null AND lans_id_dia != '0000-00-00 00:00:00' ";

$req = $bdd->prepare($sql);
$req->execute();

$events = $req->fetchAll();

//segundo sql
$req2 = $bdd->prepare($sql2);
$req2->execute();
$events2 = $req2->fetchAll();

$req3 = $bdd->prepare($sql3);
$req3->execute();
$events3 = $req3->fetchAll();

$req4 = $bdd->prepare($sql4);
$req4->execute();
$events4 = $req4->fetchAll();

foreach ($events2 as $event2) {
	//$event2['start'] = new DateTime($event2['start']);      
	//$event2['end'] = new DateTime($event2['end']);
	//var_dump($event2['end']);
	array_push($events, $event2);
}

foreach ($events4 as $event4) {
	if($event4['extra'] == 'SIM'){
		if($event4['valor'] == "")
			$event4['color'] = '#FF00FF';
	}
	array_push($events, $event4);
}

foreach ($events3 as $event3) {
	if(($event3['tipo'] == 'EVENTOS') || ($event3['tipoS'] == 'EVENTOS')){
		if($event3['enfermagem'] == "")
			$event3['color'] = '#FF0000';
		if($event3['socorrista'] == "")
			$event3['color'] = '#FF0000';
		if($event3['viatura'] == "")
			$event3['color'] = '#FF0000';
		$viatura = explode("-",$event3['viatura']);
	 	$SQL_VIATURA = $mysqli->query("SELECT * FROM db_viaturas where VT_ID = '". $viatura[0] ."'");
	 	$FET_VIATURA = mysqli_fetch_array($SQL_VIATURA);	 		
	 	if($FET_VIATURA['VT_TIPO'] == "USA"){
	 		if($event3['medico'] == "")
				$event3['color'] = '#FF0000';
	 	}	 
	}
	array_push($events, $event3);
}

And here's where I switch to the image:

eventRender: function(event, element) {
                if(event.color == "#FF0000") {
                    $(element).find('.fc-content').html('<center><img width="30px" src="../img/vermelha.png" />');
                }else{
                    $(element).find('.fc-content').html('<center><img width="30px" src="../img/cinza.png" />');
                }
                if(event.color == "#FF00FF"){
                    $(element).find('.fc-content').html('<center><img width="30px" src="../img/carinhacinza.png" />');
                }else{
                    $(element).find('.fc-content').html('<center><img width="30px" src="../img/carinhavermelha.png" />');
                }

                element[0].style['cssText'] = "background-color: rgba(255, 255, 0, 0); border-color: rgba(0, 0, 0, 0);";
                $(element).tooltip({title: event.title});

            },

The problem is that it only pulls the first if , and does not pull apart, every if .

  

On day 12 he should appear the second IF that are the little faces

Any suggestions? Thanks.

    
asked by anonymous 13.01.2017 / 17:02

0 answers