mirror of
https://github.com/Mibew/mibew.git
synced 2025-04-07 08:40:11 +03:00
Create separate function for enable/disable operators
This commit is contained in:
parent
38769615ac
commit
b7bf41a191
@ -172,11 +172,7 @@ class ManagementController extends AbstractController
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Disable the operator
|
// Disable the operator
|
||||||
$db = Database::getInstance();
|
disable_operator($operator_id);
|
||||||
$db->query(
|
|
||||||
"update {operator} set idisabled = ? where operatorid = ?",
|
|
||||||
array('1', $operator_id)
|
|
||||||
);
|
|
||||||
|
|
||||||
// Redirect the current operator to the page with operators list
|
// Redirect the current operator to the page with operators list
|
||||||
return $this->redirect($this->generateUrl('operators'));
|
return $this->redirect($this->generateUrl('operators'));
|
||||||
@ -200,11 +196,7 @@ class ManagementController extends AbstractController
|
|||||||
throw new NotFoundException('The operator is not found.');
|
throw new NotFoundException('The operator is not found.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$db = Database::getInstance();
|
enable_operator($operator_id);
|
||||||
$db->query(
|
|
||||||
"update {operator} set idisabled = ? where operatorid = ?",
|
|
||||||
array('0', $operator_id)
|
|
||||||
);
|
|
||||||
|
|
||||||
// Redirect the current operator to the page with operators list
|
// Redirect the current operator to the page with operators list
|
||||||
return $this->redirect($this->generateUrl('operators'));
|
return $this->redirect($this->generateUrl('operators'));
|
||||||
|
@ -766,3 +766,29 @@ function update_operator_groups($operator_id, $new_value)
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Makes an operator disabled.
|
||||||
|
*
|
||||||
|
* @param int $operator_id ID of the operator to disable.
|
||||||
|
*/
|
||||||
|
function disable_operator($operator_id)
|
||||||
|
{
|
||||||
|
Database::getInstance()->query(
|
||||||
|
'UPDATE {operator} SET idisabled = ? WHERE operatorid = ?',
|
||||||
|
array('1', $operator_id)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Makes an operator enabled.
|
||||||
|
*
|
||||||
|
* @param int $operator_id ID of the operator to enable.
|
||||||
|
*/
|
||||||
|
function enable_operator($operator_id)
|
||||||
|
{
|
||||||
|
Database::getInstance()->query(
|
||||||
|
'UPDATE {operator} SET idisabled = ? WHERE operatorid = ?',
|
||||||
|
array('0', $operator_id)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user