Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

View::isDisabled(), View::getRenderLevel(), View::getDisabledLevels() #1322

Merged
merged 1 commit into from Oct 2, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions ext/mvc/view.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,16 @@ PHP_METHOD(Phalcon_Mvc_View, setBasePath){
RETURN_THISW();
}

/**
* Return the current render level
*
* @return int
*/
PHP_METHOD(Phalcon_Mvc_View, getRenderLevel) {

RETURN_MEMBER(getThis(), "_renderLevel");
}

/**
* Sets the render level for the view
*
Expand Down Expand Up @@ -286,6 +296,16 @@ PHP_METHOD(Phalcon_Mvc_View, disableLevel){
RETURN_THISW();
}

/**
* Returns an array with disabled render levels
*
* @return array
*/
PHP_METHOD(Phalcon_Mvc_View, getDisabledLevels) {

RETURN_MEMBER(getThis(), "_disabledLevels");
}

/**
* Sets default view name. Must be a file without extension in the views directory
*
Expand Down Expand Up @@ -1713,6 +1733,17 @@ PHP_METHOD(Phalcon_Mvc_View, enable){
RETURN_THISW();
}

/**
* Whether automatic rendering is enabled
*
* @return bool
*/
PHP_METHOD(Phalcon_Mvc_View, isDisabled){

RETURN_MEMBER(this_ptr, "_disabled");
}


/**
* Resets the view component to its factory default values
*
Expand Down
8 changes: 7 additions & 1 deletion ext/mvc/view.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ PHP_METHOD(Phalcon_Mvc_View, getLayoutsDir);
PHP_METHOD(Phalcon_Mvc_View, setPartialsDir);
PHP_METHOD(Phalcon_Mvc_View, getPartialsDir);
PHP_METHOD(Phalcon_Mvc_View, setBasePath);
PHP_METHOD(Phalcon_Mvc_View, getRenderLevel);
PHP_METHOD(Phalcon_Mvc_View, setRenderLevel);
PHP_METHOD(Phalcon_Mvc_View, disableLevel);
PHP_METHOD(Phalcon_Mvc_View, getDisabledLevels);
PHP_METHOD(Phalcon_Mvc_View, setMainView);
PHP_METHOD(Phalcon_Mvc_View, getMainView);
PHP_METHOD(Phalcon_Mvc_View, setLayout);
Expand Down Expand Up @@ -65,6 +67,7 @@ PHP_METHOD(Phalcon_Mvc_View, getContent);
PHP_METHOD(Phalcon_Mvc_View, getActiveRenderPath);
PHP_METHOD(Phalcon_Mvc_View, disable);
PHP_METHOD(Phalcon_Mvc_View, enable);
PHP_METHOD(Phalcon_Mvc_View, isDisabled);
PHP_METHOD(Phalcon_Mvc_View, reset);
PHP_METHOD(Phalcon_Mvc_View, __set);
PHP_METHOD(Phalcon_Mvc_View, __get);
Expand Down Expand Up @@ -185,8 +188,10 @@ PHALCON_INIT_FUNCS(phalcon_mvc_view_method_entry){
PHP_ME(Phalcon_Mvc_View, setPartialsDir, arginfo_phalcon_mvc_view_setpartialsdir, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Mvc_View, getPartialsDir, NULL, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Mvc_View, setBasePath, arginfo_phalcon_mvc_view_setbasepath, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Mvc_View, getRenderLevel, NULL, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Mvc_View, setRenderLevel, arginfo_phalcon_mvc_view_setrenderlevel, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Mvc_View, disableLevel, arginfo_phalcon_mvc_view_disablelevel, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Mvc_View, disableLevel, arginfo_phalcon_mvc_view_disablelevel, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Mvc_View, getDisabledLevels, NULL, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Mvc_View, setMainView, arginfo_phalcon_mvc_view_setmainview, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Mvc_View, getMainView, NULL, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Mvc_View, setLayout, arginfo_phalcon_mvc_view_setlayout, ZEND_ACC_PUBLIC)
Expand Down Expand Up @@ -221,6 +226,7 @@ PHALCON_INIT_FUNCS(phalcon_mvc_view_method_entry){
PHP_ME(Phalcon_Mvc_View, getActiveRenderPath, NULL, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Mvc_View, disable, NULL, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Mvc_View, enable, NULL, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Mvc_View, isDisabled, NULL, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Mvc_View, reset, NULL, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Mvc_View, __set, arginfo_phalcon_mvc_view___set, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Mvc_View, __get, arginfo_phalcon_mvc_view___get, ZEND_ACC_PUBLIC)
Expand Down
14 changes: 14 additions & 0 deletions ext/mvc/viewinterface.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@ PHALCON_DOC_METHOD(Phalcon_Mvc_ViewInterface, getPartialsDir);
*/
PHALCON_DOC_METHOD(Phalcon_Mvc_ViewInterface, setBasePath);

/**
* Gets the render level for the view
*
* @return string
*/
PHALCON_DOC_METHOD(Phalcon_Mvc_ViewInterface, getRenderLevel);

/**
* Sets the render level for the view
*
Expand Down Expand Up @@ -285,3 +292,10 @@ PHALCON_DOC_METHOD(Phalcon_Mvc_ViewInterface, enable);
*/
PHALCON_DOC_METHOD(Phalcon_Mvc_ViewInterface, reset);


/**
* Whether the automatic rendering is disabled
*
* @return bool
*/
PHALCON_DOC_METHOD(Phalcon_Mvc_ViewInterface, isDisabled);
2 changes: 2 additions & 0 deletions ext/mvc/viewinterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ PHALCON_INIT_FUNCS(phalcon_mvc_viewinterface_method_entry){
PHP_ABSTRACT_ME(Phalcon_Mvc_ViewInterface, setPartialsDir, arginfo_phalcon_mvc_viewinterface_setpartialsdir)
PHP_ABSTRACT_ME(Phalcon_Mvc_ViewInterface, getPartialsDir, NULL)
PHP_ABSTRACT_ME(Phalcon_Mvc_ViewInterface, setBasePath, arginfo_phalcon_mvc_viewinterface_setbasepath)
PHP_ABSTRACT_ME(Phalcon_Mvc_ViewInterface, getRenderLevel, NULL)
PHP_ABSTRACT_ME(Phalcon_Mvc_ViewInterface, setRenderLevel, arginfo_phalcon_mvc_viewinterface_setrenderlevel)
PHP_ABSTRACT_ME(Phalcon_Mvc_ViewInterface, setMainView, arginfo_phalcon_mvc_viewinterface_setmainview)
PHP_ABSTRACT_ME(Phalcon_Mvc_ViewInterface, getMainView, NULL)
Expand Down Expand Up @@ -130,6 +131,7 @@ PHALCON_INIT_FUNCS(phalcon_mvc_viewinterface_method_entry){
PHP_ABSTRACT_ME(Phalcon_Mvc_ViewInterface, disable, NULL)
PHP_ABSTRACT_ME(Phalcon_Mvc_ViewInterface, enable, NULL)
PHP_ABSTRACT_ME(Phalcon_Mvc_ViewInterface, reset, NULL)
PHP_ABSTRACT_ME(Phalcon_Mvc_ViewInterface, isDisabled, NULL)
PHP_FE_END
};