htmlspecialchars_decode(
Link::ToDepartmentCategoriesAdmin(
$this->_mActionedDepartmentId)));
exit();
}
// Load the list of departments
$this->mDepartments = Catalog::GetDepartmentsWithDescriptions();
$this->mDepartmentsCount = count($this->mDepartments);
}
}
?>
3. Open presentation/link.php, and add the following method at the end of Link class:
// Create link to the departments administration page
public static function ToDepartmentsAdmin()
{
return self::ToAdmin('Page=Departments');
}
CHAPTER 10 ?– CATALOG ADMINISTRATION: DEPARTMENTS AND CATEGORIES 290
4. Modify the init() method of the StoreAdmin class located in presentation/store_admin.php file
to load the newly created admin_departments componentized template:
// If logging out ...
if (isset ($_GET['Page']) && ($_GET['Page'] == 'Logout'))
{
unset($_SESSION['admin_logged']);
header('Location: ' . Link::ToAdmin());
exit();
}
// If Page is not explicitly set, assume the Departments page
$admin_page = isset ($_GET['Page']) ? $_GET['Page'] : 'Departments';
// Choose what admin page to load ...
if ($admin_page == 'Departments')
$this->mContentsCell = 'admin_departments.tpl';
}
}
}
?>
How It Works: The admin_departments Componentized Template
You wrote a lot of code in this exercise, and you still can??™t test anything! This is one of the tough parts of creating
the UI first.
Pages:
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410