PageRenderTime 41ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/atk4/lib/Page.php

https://github.com/intuititve/lostandfound
PHP | 69 lines | 36 code | 2 blank | 31 comment | 7 complexity | eae2fde268ce3f89304bf8d1a583f89d MD5 | raw file
Possible License(s): AGPL-3.0
  1. <?php
  2. /***********************************************************
  3. ..
  4. Reference:
  5. http://agiletoolkit.org/doc/ref
  6. **ATK4*****************************************************
  7. This file is part of Agile Toolkit 4
  8. http://agiletoolkit.org
  9. (c) 2008-2011 Agile Technologies Ireland Limited
  10. Distributed under Affero General Public License v3
  11. If you are using this file in YOUR web software, you
  12. must make your make source code for YOUR web software
  13. public.
  14. See LICENSE.txt for more information
  15. You can obtain non-public copy of Agile Toolkit 4 at
  16. http://agiletoolkit.org/commercial
  17. *****************************************************ATK4**/
  18. /**
  19. * This is the description for the Class
  20. *
  21. * @author Romans <romans@adevel.com>
  22. * @copyright See file COPYING
  23. * @version $Id$
  24. */
  25. class Page extends AbstractView {
  26. protected $title='Page';
  27. public $default_exception='Exception_ForUser';
  28. function init(){
  29. $this->api->page_object=$this;
  30. if($this->owner!=$this->api && !($this->owner instanceof BasicAuth)){
  31. throw $this->exception('Do not add page manually. Page is automatically initialized by the Application class')
  32. ->addMoreInfo('owner',$this->owner->name)
  33. ->addMoreInfo('api',$this->api->name)
  34. ;
  35. }
  36. if(isset($_GET['cut_page']) && !isset($_GET['cut_object']) && !isset($_GET['cut_region']))
  37. $_GET['cut_object']=$this->short_name;
  38. $this->template->trySet('_page',$this->short_name);
  39. if(method_exists($this,get_class($this))){
  40. throw $this->exception('Your sub-page name matches your page cass name. PHP will assume that your method is constructor')
  41. ->addMoreInfo('method and class',get_class($this))
  42. ;
  43. }
  44. parent::init();
  45. }
  46. function defaultTemplate(){
  47. if(isset($_GET['cut_page']))return array('page');
  48. $page_name='page/'.strtolower($this->short_name);
  49. // See if we can locate the page
  50. try{
  51. $p=$this->api->locate('templates',$page_name.'.html');
  52. }catch(PathFinder_Exception $e){
  53. return array('page');
  54. }
  55. return array($page_name,'_top');
  56. }
  57. function getTitle(){
  58. return $this->title;
  59. }
  60. }