Subversion Repositories PHPX

Rev

Rev 52 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 52 Rev 70
Line 42... Line 42...
42
   *   Resource path of the template for the view.  The default
42
   *   Resource path of the template for the view.  The default
43
   *   is to <code>null</code> (no template).
43
   *   is to <code>null</code> (no template).
44
   *
44
   *
45
   * @see View::__construct()
45
   * @see View::__construct()
46
   */
46
   */
47
  protected function __construct($viewClass = 'View', $template = null)
47
  protected function __construct ($viewClass = 'View', $template = null)
48
  {
48
  {
49
    $this->_view = new $viewClass($template);
49
    $this->_view = new $viewClass($template);
50
50
51
    Application::getInstance()->setCurrentController($this);
51
    Application::getInstance()->setCurrentController($this);
52
52
Line 71... Line 71...
71
71
72
    $this->$actionMethod();
72
    $this->$actionMethod();
73
  }
73
  }
74
74
75
  /**
75
  /**
76
   * Assigns a value to a template variable (after this,
-
 
77
   * <var>$value</var> is available through
-
 
78
   * <code>$this-><var>$name</var></code> in the view's template).
-
 
79
   * <code>Controller</code>s should call this method instead of
-
 
80
   * {@link View::assign()}.
-
 
81
   *
-
 
82
   * @param string $name
-
 
83
   *   Variable name
76
   * (non-PHPDoc)
84
   * @param mixed $value
-
 
85
   *   Variable value
-
 
86
   * @param bool $encodeHTML
-
 
87
   *   If <code>true</code>, replace all potentially conflicting
-
 
88
   *   characters in <var>$value</var> with their HTML entity
-
 
89
   *   references.  The default is <code>false</code>.
-
 
90
   * @return mixed The assigned value (after possible HTML encoding)
-
 
91
   * @see View::encodeHTML()
77
   * @see View::assign()
92
   */
78
   */
93
  protected function assign($name, $value, $encodeHTML = false)
79
  protected function assign ($name, $value, $encodeHTML = false)
94
  {
80
  {
95
    return $this->_view->assign($name, $value, $encodeHTML);
81
    return $this->_view->assign($name, $value, $encodeHTML);
96
  }
82
  }
97
83
98
  /**
84
  /**
-
 
85
   * (non-PHPDoc)
-
 
86
   * @see View::addStylesheet()
-
 
87
   */
-
 
88
  protected function addStylesheet ($uri, $key = null)
-
 
89
  {
-
 
90
    return $this->_view->addStylesheet($uri, $key);
-
 
91
  }
-
 
92
-
 
93
  /**
-
 
94
   * (non-PHPDoc)
-
 
95
   * @see View::addSscript()
-
 
96
   */
-
 
97
  protected function addScript ($uri, $key = null)
-
 
98
  {
-
 
99
    return $this->_view->addScript ($uri, $key);
-
 
100
  }
-
 
101
-
 
102
  /**
99
   * Renders the {@link View} associated with this controller
103
   * Renders the {@link View} associated with this controller
100
   * by including the <code>View</code>'s template.
104
   * by including the <code>View</code>'s template.
101
   * <code>Controller</code>s should call this method instead of
105
   * <code>Controller</code>s should call this method instead of
102
   * <code>View::render()</code>.
106
   * <code>View::render()</code>.
103
   *
107
   *
Line 105... Line 109...
105
   *   Optional alternative template resource path.
109
   *   Optional alternative template resource path.
106
   *   If not provided, the default template (the
110
   *   If not provided, the default template (the
107
   *   <code>View</code>'s <code>$template</code> property)
111
   *   <code>View</code>'s <code>$template</code> property)
108
   *   will be used.
112
   *   will be used.
109
   */
113
   */
110
  public function render($template = null, $content = null)
114
  public function render ($template = null, $content = null)
111
  {
115
  {
112
    $this->_view->render($template, $content);
116
    $this->_view->render($template, $content);
113
  }
117
  }
114
}
118
}
115
119