Info.php #1

  • //
  • guest/
  • perforce_software/
  • chronicle/
  • main/
  • application/
  • system/
  • models/
  • Info.php
  • View
  • Commits
  • Open Download .zip Download (1 KB)
<?php
/**
 * Implements collection of system information for display.
 *
 * @copyright   2011 Perforce Software. All rights reserved.
 * @license     Please see LICENSE.txt in top-level folder of this distribution.
 * @version     <release>/<patch>
 */
class System_Model_Info extends P4Cms_Model
{
    protected static $_fields = array(
        'title',
        'content',
        'order'
    );

    /**
     * Set the default view, then call parent as PHP does not let you reference
     * constants while declaring class member variables.
     *
     * @param array $values     Values to set for this model.
     */
    public function __construct($values = null)
    {
        static::$_fields['view'] = array(
            'default' => APPLICATION_PATH . '/system/views/scripts/default-info.phtml'
        );

        parent::__construct($values);
    }

    /**
     * Allows specific view scripts for different types of information by
     * setting the view script path and name off of the provided (or default)
     * view script for the object.
     *
     * @param  string $view     The view to render for this model.
     * @return string           The rendered view.
     */
    public function render($view)
    {
        $view = clone $view;

        $view->setScriptPath(dirname($this->getValue('view')));
        $view->content = $this->getValue('content');

        return $view->render(basename($this->getValue('view')));
    }
}
# Change User Description Committed
#1 16170 perforce_software Move Chronicle files to follow new path scheme for branching.
//guest/perforce_software/chronicle/application/system/models/Info.php
#1 8972 Matt Attaway Initial add of the Chronicle source code