Lab Meeting
admin | IMS28 Apr 2010
This lab was similar to the last lab, in that, we just were focusing on our own modules. I was working through my way through the XML creation, and to say the least, it was tedious.
$authorizedTag=Ocelot_Core::$doc->createElement("Authorized");
$authorizedTag->appendChild(Ocelot_Core::$doc->createTextNode(1));
$this->TeamManagementXML->appendChild($authorizedTag);
$this->ObjectXML=Ocelot_Core::$doc->createElement("Object");
$this->ObjectXML->setAttribute("Name",$this->object);
$this->ObjectXML->setAttribute("Action",$action);
$this->TeamManagementXML->appendChild($this->ObjectXML);
I had these lines in my run function, and I figure out what the above lines do, and write in the new way.
My new lines are:
$authorizedTag = $this->core->createTagInside($this->getXml(), 'Authorized');
$objectTag = $this->core->createTagInside($this->getXml(), 'Object');
$objectTag->setAttribute('Name', $this->object);
$objectTag->setAttribute('Action', $action);
They look much cleaner, and I am much happier with the way these lines look.
Next I modified the controlPanel function from looking like:
$CPXML=Ocelot_Core::$doc->createElement("ControlPanel");
$CPXML->setAttribute("Module",$this->name);
$CPTXML=Ocelot_Core::$doc->createElement("Title");
$CPCXML=Ocelot_Core::$doc->createElement("Content");
$CPTXML->appendChild(Ocelot_Core::$doc->createTextNode("TeamManagement"));
$CPXML->appendChild($CPTXML);
$this->TeamManagementXML->appendChild($CPXML);
to
Ocelot_Module::addLink('TeamManagement','Team','List', 'Teams');
Ocelot_Module::addLink('TeamManagement','Sponsor','List', 'Sponsors');
Ocelot_Module::addLink('TeamManagement','PartnerList','', 'Partners');
Ocelot_Module::addLink('TeamManagement','MentorList','', 'Mentors');
Ocelot_Module::addLink('TeamManagement','AdvisorSponsor','List', 'Advisor Sponsors');
which looks much cleaner and doesn’t deal with any XML creation. I clicked on one the List teams link, and boom! I got an exception (No surprise there).
Next I took a look at function Team() and I had to change all the old gets to the new get.
$partnerAdd = $this->data->get("btnTeamPartnerAdd", true, "_POST");
$mentorAdd = $this->data->get("btnTeamMentorAdd", true, "_POST");
$sponsorAdd = $this->data->get("btnTeamSponorAdd", true, "_POST");
$tasadd = $this->data->get("btnTASAdd", true, "_POST");
This is what I got.
I even had to change the breadcrumbs in the Team() function to look like this:
$this->core->OcelotAddBreadCrumb("List Teams","Modules_TeamManagement", "Team/List");
I had gotten rid of the fatal errors in PHP, now had exceptions. Now I tried to figure out where the control flow goes after the Team() function without any success. This was a good lab, I figured out lot of things to work out.