|
Posted by tatsudoshi on 10/17/06 06:42
This is a snip of the code from my controller. Each page has a pagecode,
from which I select a case in a switch structur. On Kurv page, it checks to
see if the object is set, and if, gets the array from the object, otherwise
it creates the array and handles all the array related things. At the end of
the case it does this snip shown.
What it is suppose to do is first check if the useraccount can order the
item the user is trying to order.
That it check to see if the object is set, this time to either add the
array, with the new item or create a Kurv object.
I save all objects in SESSION.
if($wrong_user_account) {
$output = <<<hds
<div id='generic-content'>
<p>Denne type abonnement, kan ikke bestilles med denne konto.</p>
</div
hds;
$obj_kurv_go = new GenericOutput($output);
}
elseif(isset($this->obj_kurv)) {
$this->obj_kurv->setArray($array);
if(array_key_exists("action", $_GET) && $_GET["action"] !=
"add_to_basket"
|| array_key_exists("tilbud_id", $_GET))
$this->obj_kurv->storeLinkBack($_SERVER["HTTP_REFERER"]);
$obj_kurv_go = $this->obj_kurv;
}
else {
$link_to_basket = $this->readPage(array("mapr" => "byCode",
"sql_id" => "p_kurv_liste"))->getPageId();
$link_to_bestil = $this->readPage(array("mapr" => "byCode",
"sql_id" => "p_bestil_1"))->getPageId();
$link_to_telecare = $this->readPage(array("mapr" => "byCode",
"sql_id" => "p_telecare"))->getPageId();
$this->obj_kurv = new Kurv($array, $link_to_basket);
$this->obj_kurv->storeLinkBack($_SERVER["HTTP_REFERER"]);
$this->obj_kurv->storeLinkToBestil($link_to_bestil);
$this->obj_kurv->storeLinkToTelecare($link_to_telecare);
$obj_kurv_go = $this->obj_kurv;
}
}
$contents["gen_out"] = array($obj_kurv_go);
Navigation:
[Reply to this message]
|