���ѧۧݧ�ӧ�� �ާ֧ߧ֧էا֧� - ���֧էѧܧ�ڧ��ӧѧ�� - /var/www/dev-kft.petruch.de/classes/tooling.class.php
���ѧ٧ѧ�
<?php class Tooling { private $sql = false; function __construct() { global $sql; $this->sql = $sql; } /** * Add Tooling * @param object $p * @return boolean */ public function add($p) { $color = generateLightColor(); return $this->sql->insert('tooling', 'name,description,color,customerID,created,changed', [$p->name, $p->description, $color, $p->customerID, NOW, NOW]); } /** * Change Tooling * @param object $p * @return boolean */ public function change($p) { return $this->sql->update('tooling', 'name,description,color,changed', [$p->name, $p->description, $p->color, NOW], 'id=?', $p->toolingID); } /** * Get all Toolings * @return array */ public function getAll($productID=false,$customerID=false) { if($customerID){ return $this->sql->select('id,name,description,color', 'tooling', 'customerID = ? ORDER BY name ASC', $customerID); } if($productID){ return $this->sql->select('t.id,t.name,t.description,t.color', 'tooling t, product_tooling p','t.id = p.toolingID AND p.productID = ? ORDER BY name ASC', $productID); } return $this->sql->select('t.id,t.name,t.description,t.color,t.customerID,c.company', 'tooling t, customer c WHERE c.id = t.customerID ORDER BY name ASC'); } /** * Get Tooling by ID * @param int $toolingID * @return object */ public function getTooling($toolingID){ return $this->sql->select('id,name,description,color,customerID', 'tooling','id = ?', $toolingID, 1); } /** * Get Tooling by ID * @param int $toolingID * @return object */ public function getMachine($toolingID) { return $this->sql->select('id,machineTypeID,name,location,description,color', 'machine', 'id=?', $toolingID, 1); } /** * Get all Tollings for a specific Product * @param int $productID * @return array */ public function getTypeAllByProduct($productID) { return $this->sql->select('t.id,t.name,t.description,t.color', 'tooling t, product_tooling p','t.id = p.toolingID AND p.productID=? ORDER BY t.name ASC', $productID); } /** * Get all Toolings without existing ones for a specific Product * @param int $productID * @return array */ public function getToolingsAllWithoutExisting($productID) { return $this->sql->select('t.id,t.name', 'tooling t','t.id NOT IN (SELECT p.toolingID FROM product_tooling p WHERE p.productID=?) ORDER BY t.name ASC', $productID); } /** * Get all Machinetypes for a specific Tooling * @param int $productID * @return array */ public function getMachineTypesOfTooling($toolingID){ return $this->sql->select('t.id,t.name,t.nameShort', 'machineType t, tooling_machineType p','t.id = p.machineTypeID AND p.toolingID=? ORDER BY t.name ASC', $toolingID); } /** * Get all Machinetypes without existing ones for a specific Tooling * @param int $toolingID * @return array */ public function getMachineTypesAllWithoutExisting($toolingID) { return $this->sql->select('m.id,m.name,m.nameShort', 'machineType m','m.id NOT IN (SELECT t.machineTypeID FROM tooling_machineType t WHERE t.toolingID=?) ORDER BY m.name ASC', $toolingID); } /** * Add MachineType to Tooling * @param object $p * @return boolean */ public function addMachineType($p){ return $this->sql->insert('tooling_machineType', 'toolingID,machineTypeID,created', [$p->toolingID, $p->machineTypeID, NOW]); } /** * Delete MachineType from Tooling * @param object $p * @return boolean */ public function deleteMachineType($p){ return $this->sql->delete('tooling_machineType', 'toolingID=? AND machineTypeID=?', [$p->toolingID, $p->machineTypeID]); } /** * Get all Machines for a specific Tooling * @param int $toolingID * @return array */ public function getAvailiableMachinesByToolingAndMachineType($toolingID){ return $this->sql->select('m.id,m.name,mt.nameShort AS machineTypeNameShow', 'machine m, machineType mt, tooling_machineType t','m.machineTypeID = t.machineTypeID AND mt.id = t.machineTypeID AND t.toolingID=? ORDER BY m.name ASC', $toolingID); } } ?>
| ver. 1.4 |
Github
|
.
| PHP 8.3.33 | ���֧ߧ֧�ѧ�ڧ� ����ѧߧڧ��: 0 |
proxy
|
phpinfo
|
���ѧ����ۧܧ�