public static function getPanel() { if( !Authorization::isAuthorized() ) return; $panelStyles = API::parseStylesFile(CUSTOMPATH.DS."Global.views"); $paneltpl = $panelStyles["VeronicaAdminPanel"][2]; $menuItemtpl = $panelStyles["VeronicaMenuListItem"][2]; $controllers = Api::getCustom("Controller"); $modeles = Api::getCustom("Model"); $user = Authorization::getCurrentUser(); $userpanel = ViewHandler::wrap("CurrentUser", $user[0]); $paneltpl = str_replace("<? echo \$USERPANEL;?>", $userpanel, $paneltpl); $list = ""; foreach ($controllers as $controller){ if($controller::$inAdminPanel){ $l = str_replace("<? echo \$ADDCLICKHANDLER;?>", "Controller.add('".$controller::$name."');", $menuItemtpl); $l = str_replace("<? echo \$CLICKHANDLER;?>", "Controller.openDashboard('".$controller::$name."');", $l); $l = str_replace("<? echo \$COUNT;?>", "Controller.openDashboard('".$controller::$name."');", $l); $list .= str_replace("<? echo \$ALIAS;?>", $controller::$alias, $l); } } $paneltpl = str_replace("<? echo \$MENULIST;?>", $list, $paneltpl); return $paneltpl; }
public static function getForm( $args ) { if( count($args) != 1 ) return false; if( $args[0] == null ){ $item = ModelHandler::getEmptyItem("Users"); //l($item); }else{ $item = ModelHandler::get("Users", $args); $item = $item[0]; } $form = ViewHandler::wrap("Form", $item); return $form; }
public static function entry($args) { if( count($args) > 1 ) echo 404; else{ $post = ModelHandler::get("Posts", array($args[0])); $post = $post[0]; $content = ViewHandler::wrap("post", $post); $tpl = new TPL(); $tpl->assign("content",$content); $tpl->draw("main"); } }