..
if ($this->_mAction == 'add_dept')
{
$department_name = $_POST['department_name'];
$department_description = $_POST['department_description'];
if ($department_name == null)
$this->mErrorMessage = 'Department name required';
if ($this->mErrorMessage == null)
{
Catalog::AddDepartment($department_name, $department_description);
header('Location: ' . $this->mLinkToDepartmentsAdmin);
}
}
// If editing an existing department ...
if ($this->_mAction == 'edit_dept')
$this->mEditItem = $this->_mActionedDepartmentId;
// If updating a department ...
if ($this->_mAction == 'update_dept')
{
$department_name = $_POST['name'];
$department_description = $_POST['description'];
CHAPTER 10 ?– CATALOG ADMINISTRATION: DEPARTMENTS AND CATEGORIES 289
if ($department_name == null)
$this->mErrorMessage = 'Department name required';
if ($this->mErrorMessage == null)
{
Catalog::UpdateDepartment($this->_mActionedDepartmentId,
$department_name, $department_description);
header('Location: ' . $this->mLinkToDepartmentsAdmin);
}
}
// If deleting a department ...
if ($this->_mAction == 'delete_dept')
{
$status = Catalog::DeleteDepartment($this->_mActionedDepartmentId);
if ($status < 0)
$this->mErrorMessage = 'Department not empty';
else
header('Location: ' . $this->mLinkToDepartmentsAdmin);
}
// If editing department's categories ...
if ($this->_mAction == 'edit_cat')
{
header('Location: ' .
Pages:
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409