PHP 클래스 VirtualPage, atk4

VirtualPage gives you a unique URL to the page where you can add objects. VirtualPage is intelligent enough to act differently depending on where you add it. This way you can create popup on page load. $vp = $this->add('VirtualPage'); $this->js(true)->univ()->frameURL('MyPopup',$vp->getURL()); $vp->set(function($vp){ $vp->add('LoremIpsum'); // <-- will appear within a frame }); Here is how you can bind it to a button or other view through JS element. Calling "bindEvent" will automatically tie in frameURL for you. $b=$page->add('Button')->set('Open popup'); $b->add('VirtualPage') ->bindEvent('My Cool Title','click') ->set(function($page){ $page->add('LoremIpsum'); }); This would add a button into a Grid which would show you row's ID. $grid->add('VirtualPage') ->addColumn('edit') ->set(function($page){ $id = $_GET[$page->short_name.'_id']; $page->add('Text')->set('ID='.$id); }); There are many other uses for VirtualPage, especially when you extract it's URL. $b = $page->add('Button')->set('Request new password'); $b->js('click')->univ()->location( $this->add('VirtualPage') ->set(function($p){ $p->add('Text')->set('Check your email for confirmation'); }) ->getURL() ); (If you do this, be mindful of stickyGET arguments and don't call from inside form's submit code
상속: extends AbstractController
파일 보기 프로젝트 열기: atk4/atk4 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$app App_Frontend
$frame_options array
$owner View | Grid
$page_class string
$page_template array | string
$type string

보호된 프로퍼티들

프로퍼티 타입 설명
$page Page

공개 메소드들

메소드 설명
addColumn ( string $name, string $title = null, array | string $buttontext = null, Grid $grid = null ) Call this if you are adding this inside a grid.
bindEvent ( string $title = '', string $event = 'click', string $selector = null ) Bind owner's event (click by default) to a JavaScript chain which would open a new frame (or dialog, depending on $type property), and execute associated code inside it.
getPage ( ) : Page Simply returns a page we can put stuff on. This page would be displayed instead of regular page, so beware.
getURL ( string $arg = 'true' ) : URL Return the URL which would trigger execution of the associated code within a separate page.
isActive ( string $mode = null ) : boolean | string Returns true if the URL is requesting the page to be shown.
set ( callable $method_or_arg, callable $method = null ) Associates code with the page. This code will be executed within a brand new page when called by URL.

메소드 상세

addColumn() 공개 메소드

Call this if you are adding this inside a grid.
public addColumn ( string $name, string $title = null, array | string $buttontext = null, Grid $grid = null )
$name string Field Name (must not contain spaces)
$title string Header for the column
$buttontext array | string Text to put on the button
$grid Grid Specify grid to use, other than $owner

bindEvent() 공개 메소드

Bind owner's event (click by default) to a JavaScript chain which would open a new frame (or dialog, depending on $type property), and execute associated code inside it.
public bindEvent ( string $title = '', string $event = 'click', string $selector = null )
$title string Title of the frame
$event string JavaScript event
$selector string Not all parent will respond to click but only a selector

getPage() 공개 메소드

Simply returns a page we can put stuff on. This page would be displayed instead of regular page, so beware.
public getPage ( ) : Page
리턴 Page page to be displayed

getURL() 공개 메소드

Return the URL which would trigger execution of the associated code within a separate page.
public getURL ( string $arg = 'true' ) : URL
$arg string Argument to pass to the page
리턴 URL

isActive() 공개 메소드

If no parameter is passed, then return active page mode.
public isActive ( string $mode = null ) : boolean | string
$mode string Optionally ask for specific mode
리턴 boolean | string

set() 공개 메소드

Associates code with the page. This code will be executed within a brand new page when called by URL.
public set ( callable $method_or_arg, callable $method = null )
$method_or_arg callable Optional argument
$method callable function($page){ .. }

프로퍼티 상세

$app 공개적으로 프로퍼티

public App_Frontend $app
리턴 App_Frontend

$frame_options 공개적으로 프로퍼티

public array $frame_options
리턴 array

$owner 공개적으로 프로퍼티

public View|Grid $owner
리턴 View | Grid

$page 보호되어 있는 프로퍼티

protected Page $page
리턴 Page

$page_class 공개적으로 프로퍼티

public string $page_class
리턴 string

$page_template 공개적으로 프로퍼티

public array|string $page_template
리턴 array | string

$type 공개적으로 프로퍼티

public string $type
리턴 string