Prev | Current Page 452 | Next

Emilian Balanescu and Cristian Darie

"Beginning PHP and MySQL E-Commerce: From Novice to Professional, Second Edition"

This makes the Edit button show up if the user is an administrator.
/* If CategoryId is in the query string we save it
(casting it to integer to protect against invalid values) */
if (isset ($_GET['CategoryId']))
$this->_mCategoryId = (int)$_GET['CategoryId'];
// Show Edit button if the user is administrator
if (!(isset ($_SESSION['admin_logged'])) ||
$_SESSION['admin_logged'] != true)
$this->mShowEditButton = false;
else
$this->mShowEditButton = true;
}
5. Still in presentation/department.php, add the following highlighted piece of code at the end of the
init() method:
// If visiting a category ...
if (isset ($this->_mCategoryId))
{
$category_details =
Catalog::GetCategoryDetails($this->_mCategoryId);
$this->mName = $this->mName . ' » ' .
$category_details['name'];
$this->mDescription = $category_details['description'];
CHAPTER 11 ?–  CATALOG ADMINISTRATION: PRODUCTS AND ATTRIBUTES 353
$this->mEditActionTarget =
Link::ToDepartmentCategoriesAdmin($this->_mDepartmentId);
$this->mEditAction = 'edit_cat_' . $this->_mCategoryId;
$this->mEditButtonCaption = 'Edit Category Details';
}
else
{
$this->mEditActionTarget = Link::ToDepartmentsAdmin();
$this->mEditAction = 'edit_dept_' . $this->_mDepartmentId;
$this->mEditButtonCaption = 'Edit Department Details';
}
}
}
?>
6. Add the following piece of code to presentation/templates/product.


Pages:
440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464
Pozycjonowanie kontrola dostępu nieruchomości kielce noclegi darłowo ogrody