Não consigo apresentar Informações do Funcionario na tela
Ola galera preciso de uma ajuda tenho esse código abaixo em MVC e queria que Amostra- se na Visão Funcionario as seguintes informações do Funcionário:
codigo do Funcionário: 1000;
Setor: T.I; <--- tenho que saber qual o setor que este funcionário vai ser cadastrado
Nome: Fabio;
O problema que não aparece nada na tela quando eu associo a id_setor da classe setor na classe funcionário para saber qual o setor o funcionário faz parte.
Como faço para aparecer estas informações
<?php
---- CLASSES ----
class Setor {
private $id_setor;
private $desc;
function getId_setor() {
return $this->id_setor;
}
function getDesc() {
return $this->desc;
}
function setId_setor($id_setor) {
$this->id_setor = $id_setor;
}
function setDesc($desc) {
$this->desc = $desc;
}
public function imprimirSetor() {
echo $this->getId_setor() . " - ";
echo $this->getDesc();
}
}
<?php
class Funcionario {
private $id_func;
private $id_s;
private $nomeF;
private $setor;
function getId_func() {
return $this->id_func;
}
function getId_s() {
return $this->id_s;
}
function getNomeF() {
return $this->nomeF;
}
function getSetor() {
return $this->setor;
}
function setId_func($id_func) {
$this->id_func = $id_func;
}
function setId_s($id_s) {
$this->id_s = $id_s;
}
function setNomeF($nomeF) {
$this->nomeF = $nomeF;
}
function setSetor($setor) {
$this->setor = $setor;
}
public function ImprimirFunc(){
echo $this->getId_func();
echo $this->getSetor();
echo $this->getNomeF();
}
}
--- CONTROLE ---
<?php
include_once '../modelo/Setor.php';
class controleSetor extends Setor{
public function CtlReceberSetor(){
$this->setId_setor(1);
$this->setDesc('T.I');
return $this->imprimirSetor();
}
}
<?php
include_once '../modelo/Setor.php';
include_once '../modelo/Funcionario.php';
class controleFunc extends Funcionario {
private $s;
public function CtlReceberFunc() {
$this->s = new Setor();
$this->setId_func(1000);
// aqui chama informações do SETOR para imprimir na tela.
$this->setNomeF('Fabio');
}
}
---- VISÃO SETOR ------
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Imprime Setor:</title>
</head>
<body>
<?php
include_once '../controle/controleSetor.php';
$vs = new controleSetor();
$vs->CtlReceberSetor();
?>
<table>
<td><a href="../index.php"><button type="submit">Voltar:</button></a></td>
</table>
</body>
</html>
--- VISÃO FUNCIONÁRIO -----
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Imprime Funcionário:</title>
</head>
<body>
<?php
include_once '../controle/controleFunc.php';
$vf = new controleFunc();
$vf->CtlReceberFunc();
?>
<table>
<td><a href="../index.php"><button type="submit">Voltar:</button></a></td>
</table>
</body>
</html>Discussão (3)
Carregando comentários...