Source for file Abstract_Page.php
Documentation is available at Abstract_Page.php
* LAIKA FRAMEWORK Release Notes:
* @filesource Abstract_Page.php
* @date 2012-05-18 21:48:04 -0400 (Fri, 18 May 2012)
* @author Leonard M. Witzel <witzel@post.harvard.edu>
* @copyright Copyright (c) 2012 Laika Soft <{@link http://oafbot.com}>
* Abstract Laika_Abstract_Page class.
* @extends Laika_Singleton
private static $instance;
public static $access_level =
'PUBLIC';
public static $access_group =
'USER';
* If method name includes 'render_' it will render a partial
* Otherwise it will echo a proprerty.
if(substr($name,0,7)==
'render_'):
$class::render(substr($name,7));
echo
$class::init()->$name;
elseif(is_array($class::init()->$name)):
$array =
$class::init()->$name;
foreach( $params as $key =>
$value)
$class::init()->$key =
$value;
if(!isset
($class::init()->component))
$class::init()->component =
"DEFAULT";
if(!isset
($class::init()->template))
$class::init()->template =
"DEFAULT";
if(!isset
($class::init()->page))
//include_once($class::add_component($component));
include_once($class::add_template($class::init()->template));
* render_component function.
include_once($class::add_component($class::init()->component));
if(self::init()->alert_type ==
'warning')
$icon =
'<span class=alert_icon >W</span>';
elseif(self::init()->alert_type ==
'success')
$icon =
'<span class=alert_icon >/</span>';
if(isset
(self::init()->alert))
echo
'<div id="alert" class="'.
self::init()->alert_type.
'">'.
$icon.
self::init()->alert.
'
<a href="javascript:;" onclick="close_alert();" class="webfont close" title="close">×</a>
* parameters passed into the method can be accessed from the called partial by
* the "$parameter" variable.
public static function render(){
echo
'<script type="text/javascript" src="'.
HTTP_ROOT.
'/js/'.
$partial.
'.js"></script>';
echo
'<link rel="stylesheet" href="'.
HTTP_ROOT.
'/stylesheets/'.
$partial.
'.css" type="text/css">';
include_once($class::add_partial($partial));
* render_foreach function.
* renders a view partial for each object in a collection
foreach($collection as $label =>
$object)
include($class::add_partial($partial));
if(file_exists(APP_VIEW_SHARED.
'partials/'.
$partial.
'.php'))
return APP_VIEW_SHARED.
'partials/'.
$partial.
'.php';
elseif(file_exists(APP_VIEW_COMPONENTS.
'partials/'.
$partial.
'.php'))
return APP_VIEW_COMPONENTS.
'partials/'.
$partial.
'.php';
include_once(APP_VIEW_LOGIC.
basename($file).
'_logic.php');
* add_component function.
* @param string $component
if($component ==
"DEFAULT")
$page_name =
str_replace('_Page',"_Component",$page_name,$count =
1);
return APP_VIEW_COMPONENTS.
$page_name.
'.php';
* @param string $template
if($template ==
"DEFAULT"):
return APP_VIEW_SHARED.
'default_template.php';
return APP_VIEW_SHARED.
$page_name.
'.php';
* Outputs javascript src includes constructed from parameters
$page =
self::init()->page;
$component =
self::init()->component;
foreach($args as $k =>
$v)
echo
'<script type="text/javascript" src="'.
HTTP_ROOT.
'/js/'.
$v.
'.js"></script>';
echo
'<script type="text/javascript" src="'.
HTTP_ROOT.
'/js/'.
$page.
'.js"></script>';
if(isset
($component) &&
$component!=
"DEFAULT")
echo
'<script type="text/javascript" src="'.
HTTP_ROOT.
"/js/$component.js".
'"></script>';
* Outputs stylesheet includes constructed from parameters
public static function styles(){
$page =
self::init()->page;
$component =
self::init()->component;
foreach($args as $k =>
$v)
echo
'<link rel="stylesheet" href="'.
HTTP_ROOT.
'/stylesheets/'.
$v.
'.css" type="text/css">';
echo
'<link rel="stylesheet" href="'.
HTTP_ROOT.
"/$v.css".
'" type="text/css">';
echo
'<link rel="stylesheet" href="'.
HTTP_ROOT.
'/stylesheets/'.
$page.
'.css" type="text/css">';
if(isset
($component) &&
$component!=
"DEFAULT")
echo
'<link rel="stylesheet" href="'.
HTTP_ROOT.
'/stylesheets/'.
$component.
'.css" type="text/css">';
foreach($args as $k =>
$v)
echo
'<link rel="stylesheet" href="'.
HTTP_ROOT.
'/stylesheets/'.
$v.
'.css" type="text/css">';
echo
'<link rel="stylesheet" href="'.
HTTP_ROOT.
"/$v.css".
'" type="text/css">';
public static function path_to($path){
* Outputs a HTML link inside a anchor tag.
* View Superclass Laika::link_to method for usage.
public static function img(){
public static function paginate($class,$limit,$params,$partial,$order=
NULL){
$c =
$class::paginate($limit,$params,$order);
$c =
$class::paginate($limit,$params);
foreach($c as $key =>
$value)
$collection[] =
$value->revive();
self::render_foreach($partial,$collection);
$_SESSION['REDIRECT'] =
$url;
Documentation generated on Sat, 19 May 2012 02:16:54 -0400 by phpDocumentor 1.4.4