Displaying content on left, right and top section of node view/edit
From Achievo/ATK Wiki
|
ATK Howto: Displaying content on left, right and top section of node view/edit
|
There are times that the interface of the view and/or edit mode of a node needs to be customized to display content. Some of the content may be quick menus related to the record or simple instructions or checklists on how the user should deal with the record.
For those painful moments, this documentation may assist.
To add content to either the left, right or top of a view or edit mode of a node follow these instructions:
Within your node define the following functions:
1. editPage()
// this function is called when editing an individual record // any information here will be displayed on the footer section of the edited record page function editPage(&$handler, $record, $locked=false) { return $this->detailPageFooter($handler, $record, $locked); }
2. viewPage()
// this function is called when viewing an individual record // any information here will be displayed on the footer section of the viewed record page function viewPage(&$handler, $record, $locked=false) { return $this->detailPageFooter($handler, $record, $locked,"view"); }
3. detailPageFooter()
// this is a custom helper function for editPage and viewPage // you can consolidate operations here unless you need to display different information // when editing and viewing the record // the information will be displayed on the footer page when editing or viewing an individual record function detailPageFooter(&$handler, $record, $locked=false, $mode="edit") { if($mode == "view"){ $page = $handler->viewPage($record, $locked); }else{// edit $page = $handler->editPage($record, $locked); } // this is where the content positioning takes place $page = "<table> <tr valign=top><td colspan=3>".$this->get_top_content()."</td></tr> <tr valign=top><td>".$this->get_left_content()."<td>$page<td>".$this->get_right_content()."</tr> </table>"; return $page; } // end function
4. get_left_content()
// custom function to acquire content for left section node function get_left_content(){ $original[] = href(dispatch_url($this->module.".".$this->node, "admin"),"New Document", SESSION_NESTED); $original[] = href(dispatch_url($this->module.".".$this->node, "admin"),"New Note", SESSION_NESTED); $original[] = href(dispatch_url($this->module.".".$this->node, "admin"),"New Order", SESSION_NESTED); $content = implode(" <br><br> ", $original). "<table width=200><tr><td><hr>".str_repeat("wow ", 100)."</tr></table>"; $title = "Quick Menu"; $data_info = $this->getUi()->renderBox(array('title' => $title, 'content' => $content)); return $data_info; }// end function
5. get_right_content()
// custom function to acquire content for right section node function get_right_content(){ $original[] = href(dispatch_url($this->module.".".$this->node, "admin"),"Adding new Employees", SESSION_NESTED); $original[] = href(dispatch_url($this->module.".".$this->node, "admin"),"Creating employee notes", SESSION_NESTED); $original[] = href(dispatch_url($this->module.".".$this->node, "admin"),"Entering employee orders", SESSION_NESTED); $content = implode(" <br><br> ", $original). "<table width=200><tr><td><hr>".str_repeat("help ", 100)."</tr></table>"; $title = "Help"; $data_info = $this->getUi()->renderBox(array('title' => $title, 'content' => $content)); return $data_info; }// end function
6. get_top_content()
// custom function to acquire content for top section node function get_top_content(){ $original[] = href(dispatch_url($this->module.".".$this->node, "admin"),"Adding new Employees", SESSION_NESTED); $original[] = href(dispatch_url($this->module.".".$this->node, "admin"),"Creating employee notes", SESSION_NESTED); $original[] = href(dispatch_url($this->module.".".$this->node, "admin"),"Entering employee orders", SESSION_NESTED); $content = implode(" | ", $original).str_repeat(" menu | ", 17); $title = "Navigation"; $data_info = $this->getUi()->renderBox(array('title' => $title, 'content' => $content)); return $data_info; }// end function
There you have it. Below is a screenshot of what the above code generated for me:
File:Http://garidigital.com/dev/atk/atk view edit with side top content.jpg