1: <?php
2:
3: /**
4: * Orchestra: A minimalist object-oriented superset for WordPress using Phalcon.
5: *
6: * This source file is subject to the MIT license that is bundled
7: * with this package in the file LICENSE and is available through
8: * the world-wide-web at the following URI:
9: * http://opensource.org/licenses/MIT
10: *
11: * @copyright Akufen Atelier Creatif
12: * @author Nicholas Charbonneau <nicholas@akufen.ca>
13: * @license http://opensource.org/licenses/MIT
14: * @version 0.1.3
15: * @link https://github.com/akufenstudio/orchestra
16: */
17:
18: namespace Akufen\Orchestra\Mvc;
19:
20: use Akufen\Orchestra\Mvc\Models\Posts;
21:
22: /**
23: * Akufen\Orchestra\Mvc\Controller
24: *
25: * A base controller for the application.
26: *
27: * @uses \Phalcon\Mvc\Controller
28: * @package Mvc
29: */
30: class Controller extends \Phalcon\Mvc\Controller
31: {
32: /**
33: * Initialization function for the controller.
34: *
35: * @return void
36: */
37: protected function initialize()
38: {
39: global $post;
40:
41: // Create a post model for controller use
42: if (isset($post)) {
43: $this->post = new Posts();
44: $this->post->fromObject($post);
45: }
46: }
47:
48: /**
49: * Renders a template as our main content.
50: *
51: * @param String $template The relative path to the template.
52: * @param Array $params The parameters to pass to the view.
53: * @retun void
54: */
55: protected function render($template, array $params = array())
56: {
57: // Render a template as our main content
58: $this->view->content = $this->view->getPartial(
59: $template,
60: $params
61: );
62: }
63: }
64: