46 lines
1.1 KiB
PHP
46 lines
1.1 KiB
PHP
<?php
|
|
|
|
class WorkerPermission extends mfBaseModel {
|
|
public $isAdmin = false;
|
|
public $isEmployee = false;
|
|
public $isTechnician = false;
|
|
public $isPreorderfront = false;
|
|
public $isPreorderaddressreporting = false;
|
|
public $isPreorderlogistics = false;
|
|
|
|
public function loadByUserId($userid) {
|
|
$res = $this->db->select($this->table,"*","worker_id=$userid");
|
|
if($this->db->num_rows($res)) {
|
|
$data = $this->db->fetch_object($res);
|
|
$this->load($data);
|
|
} else {
|
|
$this->worker_id = $userid;
|
|
$this->admin = 'false';
|
|
$this->save();
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
protected function afterLoad() {
|
|
if($this->admin == 'true') {
|
|
$this->isAdmin = true;
|
|
}
|
|
if($this->employee == 'true') {
|
|
$this->isEmployee = true;
|
|
}
|
|
if($this->technician == 'true') {
|
|
$this->isTechnician = true;
|
|
}
|
|
if($this->preorderfront == 'true') {
|
|
$this->isPreorderfront= true;
|
|
}
|
|
if($this->preorderaddressreporting == 'true') {
|
|
$this->isPreorderaddressreporting= true;
|
|
}
|
|
if($this->preorderlogistics == 'true') {
|
|
$this->isPreorderlogistics = true;
|
|
}
|
|
}
|
|
|
|
} |