<?php
class Department
{
//манагеры
public $ma1;
public $ma2;
public $ma3;
//маркетологи
public $mar1;
public $mar2;
public $mar3;
//аналисты
public $an1;
public $an2;
public $an3;
//инженеры
public $eng1;
public $eng2;
public $eng3;
public $head;
public $name;
function __construct($name)
{
$this->name = $name;
}
function totalEmployee()
{
$total = 0;
$total = $this->ma1 + $this->ma2 + $this->ma3 + $this->mar1 + $this->mar2 + $this->mar3 + $this->an1 + $this->an2 + $this->an3 + $this->eng1 + $this->eng2 + $this->eng3 + 1;
return $total;
}
}
function dataFill($department)
{
$var = new Department($department['name']);
$var->ma1 = $department['ma1'];
$var->ma2 = $department['ma2'];
$var->ma3 = $department['ma3'];
$var->mar1 = $department['mar1'];
$var->mar2 = $department['mar2'];
$var->mar3 = $department['mar3'];
$var->eng1 = $department['eng1'];
$var->eng2 = $department['eng2'];
$var->eng3 = $department['eng3'];
$var->an1 = $department['an1'];
$var->an2 = $department['an2'];
$var->an3 = $department['an3'];
$var->head = $department['head'];
return $var;
}
//название отдела
$department['name'] = "Департамент продаж";
//Менеджеры каждого ранга
$department['ma1'] = 9;
$department['ma2'] = 3;
$department['ma3'] = 2;
//маркетологи каждого ранга
$department['mar1'] = 2;
$department['mar2'] = 0;
$department['mar3'] = 0;
//инженеры каждого ранга
$department['eng1'] = 0;
$department['eng2'] = 0;
$department['eng3'] = 0;
//аналитики каждого ранга
$department['an1'] = 0;
$department['an2'] = 0;
$department['an3'] = 0;
//должность руководителя
$department['head'] = 'ma2';