Professional CodeIgniter, Thomas Myer

Chapter 9: Security and Performance
284

Here is the
edit()

function of the admin/colors controller:
function edit($id=0){
if ($this-
>
input-
>
post(`name')){
$this-
>
MColors-
>
updateColor();
$this-
>
session-
>
set_flashdata(`message','Color updated');
redirect(`admin/colors/index','refresh');
}else{
$data[`title'] = "Edit Color";
$data[`main'] = `admin_colors_edit';
$data[`color'] = $this-
>
MColors-
>
getColor($id);
if (!count($data[`color'])){
redirect(`admin/colors/index','refresh');
}
$this-
>
load-
>
vars($data);
$this-
>
load-
>
view(`dashboard');
}
}

Here is the
edit()

function of the admin/pages controller:
function edit($id=0){
if ($this-
>
input-
>
post(`name')){
$this-
>
MPages-
>
updatePage();
$this-
>
session-
>
set_flashdata(`message','Page updated');
redirect(`admin/pages/index','refresh');
}else{
$data[`title'] = "Edit Page";
$data[`main'] = `admin_pages_edit';
$data[`page'] = $this-
>
MPages-
>
getPage($id);
if (!count($data[`page'])){
redirect(`admin/pages/index','refresh');
}
$this-
>
load-
>
vars($data);
$this-
>
load-
>
view(`dashboard');
}
}

Here is the
edit()

function of the admin/products controller:
function edit($id=0){
if ($this-
>
input-
>
post(`name')){
$this-
>
MProducts-
>
updateProduct();
$this-
>
session-
>
set_flashdata(`message','Product updated');
redirect(`admin/products/index','refresh');
}else{
$data[`title'] = "Edit Product";
$data[`main'] = `admin_product_edit';
$data[`product'] = $this-
>
MProducts-
>
getProduct($id);
$data[`categories'] = $this-
>
MCats-
>
getCategoriesDropDown();
$data[`assigned_colors'] = $this-
>
MProducts-
>
getAssignedColors($id);
$data[`assigned_sizes'] = $this-
>
MProducts-
>
getAssignedSizes($id);
c09.indd 284
c09.indd 284
6/10/08 5:38:04 PM
6/10/08 5:38:04 PM


Другие страницы

 
Cкачать книги бесплатно без регистрации в электронном виде (pdf, chm, txt).Вы можете читать книги онлайн на нашем сайте литературного портала книг.Большая подборка учебников, пособий, интересных книг.Электронные книги на английском языке скачать бесплатно без смс.

OK

Loading...
...
Закрыть