本文整理汇总了PHP中FormUtil::newForm方法的典型用法代码示例。如果您正苦于以下问题:PHP FormUtil::newForm方法的具体用法?PHP FormUtil::newForm怎么用?PHP FormUtil::newForm使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FormUtil
的用法示例。
在下文中一共展示了FormUtil::newForm方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: edit
/**
* This method provides a generic handling of all edit requests.
*
* @param string $ot Treated object type.
* @param string $tpl Name of alternative template (for alternative display options, feeds and xml output)
* @param boolean $raw Optional way to display a template instead of fetching it (needed for standalone output)
*
* @return mixed Output.
*/
public function edit()
{
$id = $this->request->query->filter('id', 0);
if ($id > 0) {
$url = ModUtil::url($this->name, 'user', 'view');
return System::redirect($url);
}
$controllerHelper = new Reviews_Util_Controller($this->serviceManager);
// parameter specifying which type of objects we are treating
$objectType = $this->request->query->filter('ot', 'review', FILTER_SANITIZE_STRING);
$utilArgs = array('controller' => 'user', 'action' => 'edit');
if (!in_array($objectType, $controllerHelper->getObjectTypes('controllerAction', $utilArgs))) {
$objectType = $controllerHelper->getDefaultObjectType('controllerAction', $utilArgs);
}
$this->throwForbiddenUnless(SecurityUtil::checkPermission($this->name . ':' . ucwords($objectType) . ':', '::', ACCESS_EDIT), LogUtil::getErrorMsgPermission());
// create new Form reference
$view = FormUtil::newForm($this->name, $this);
// build form handler class name
$handlerClass = $this->name . '_Form_Handler_User_' . ucfirst($objectType) . '_Edit';
// determine the output template
$viewHelper = new Reviews_Util_View($this->serviceManager);
$template = $viewHelper->getViewTemplate($this->view, 'user', $objectType, 'edit', array());
// execute form using supplied template and page event handler
return $view->execute($template, new $handlerClass());
}
示例2: configure
/**
* Configuration screen.
*
* @return string Plugin configuration output.
*/
public function configure()
{
// Create form
$form = FormUtil::newForm($this->pluginName, $this);
$form->setCompileId($this->pluginName);
return $form->execute('configure.tpl', new Scribite_FormHandler_ModifyEditor());
}
示例3: modifyconfig
public function modifyconfig()
{
$this->throwForbiddenUnless(SecurityUtil::checkPermission('Scribite::', '::', ACCESS_ADMIN), LogUtil::getErrorMsgPermission());
// Create form
$form = FormUtil::newForm('Scribite', $this);
return $form->execute('admin/modifyconfig.tpl', new Scribite_FormHandler_ModifyConfig());
}
示例4: main
/**
* Main Admin function
*/
public function main()
{
if (!SecurityUtil::checkPermission('BBSmile::', '::', ACCESS_ADMIN)) {
return LogUtil::registerPermissionError(System::getHomepageUrl());
}
$form = FormUtil::newForm('BBSmile', $this);
return $form->execute('admin/modifyconfig.tpl', new BBSmile_Form_Handler_Admin_ModifyConfig());
}
示例5: edit
/**
* Create or edit record.
*
* @return string|boolean Output.
*/
public function edit()
{
if (!SecurityUtil::checkPermission('ExampleDoctrine::', '::', ACCESS_ADD)) {
return LogUtil::registerPermissionError(ModUtil::url('ExampleDoctrine', 'user', 'main'));
}
$form = FormUtil::newForm('ExampleDoctrine', $this);
return $form->execute('exampledoctrine_user_edit.tpl', new ExampleDoctrine_Handler_Edit());
}
示例6: testconfig
/**
* This function displays a form to sent a test mail
* @return string HTML string
*/
public function testconfig()
{
$this->throwForbiddenUnless(SecurityUtil::checkPermission('Mailer::', '::', ACCESS_ADMIN));
$form = FormUtil::newForm('Mailer', $this);
return $form->execute('mailer_admin_testconfig.tpl', new Mailer_Form_Handler_TestConfig());
}
示例7: getVideos
/**
* This method takes care of the application configuration.
*
* @return string Output
*/
public function getVideos()
{
// DEBUG: permission check aspect starts
$this->throwForbiddenUnless(SecurityUtil::checkPermission('MUVideo::', '::', ACCESS_EDIT));
// DEBUG: permission check aspect ends
// parameter specifying which type of objects we are treating
$objectType = isset($args['ot']) && !empty($args['ot']) ? $args['ot'] : $this->request->getGet()->filter('ot', 'collection', FILTER_SANITIZE_STRING);
$utilArgs = array('controller' => 'user', 'action' => 'getVideos');
if (!in_array($objectType, MUVideo_Util_Controller::getObjectTypes('controllerAction', $utilArgs))) {
$objectType = MUVideo_Util_Controller::getDefaultObjectType('controllerAction', $utilArgs);
}
// create new Form reference
$view = FormUtil::newForm($this->name, $this);
// build form handler class name
$handlerClass = 'MUVideo_Form_Handler_' . ucfirst($objectType) . '_GetVideos';
// determine the output template
$viewHelper = new MUVideo_Util_View($this->serviceManager);
$template = $viewHelper->getViewTemplate($this->view, $objectType, 'getVideos', array());
// execute form using supplied template and page event handler
return $view->execute($template, new $handlerClass());
}
示例8: modifyconfig
/**
* modify the configuration
*
* @author J?rg Napp, Frank Schummertz
* @return output The modify config page.
*/
public function modifyconfig()
{
if (!SecurityUtil::checkPermission('Avatar::', '::', ACCESS_ADMIN)) {
return LogUtil::registerPermissionError();
}
// Create output object
$avatarform = FormUtil::newForm('Avatar', $this);
// Return the output that has been generated by this function
return $avatarform->execute('Avatar_admin_modifyconfig.htm', new Avatar_Form_Handler_Admin_ModifyConfig());
}
示例9: modify
/**
* Modify a comment
*
* This is a standard function that is called whenever an comment owner
* wishes to modify a comment
*
* @param tid the id of the comment to be modified
* @return string the modification page
*/
public function modify($args)
{
// get our input
$id = isset($args['id']) ? $args['id'] : FormUtil::getPassedValue('id', null, 'GETPOST');
// Security check
$securityCheck = ModUtil::apiFunc('EZComments', 'user', 'checkPermission', array('module' => '', 'objectid' => '', 'commentid' => $id, 'level' => ACCESS_EDIT));
if (!$securityCheck) {
$redirect = base64_decode(FormUtil::getPassedValue('redirect'));
if (!isset($redirect)) {
$redirect = System::getHomepageUrl();
}
return LogUtil::registerPermissionError($redirect);
}
// Create Form output object
$render = FormUtil::newForm('EZComments', $this);
// Return the output that has been generated by this function
return $render->execute("ezcomments_user_modify.tpl", new EZComments_Form_Handler_User_Modify());
}
示例10: edit
/**
* This method provides a generic handling of all edit requests.
*
* @param string $ot Treated object type.
* @param string $tpl Name of alternative template (for alternative display options, feeds and xml output)
* @param boolean $raw Optional way to display a template instead of fetching it (needed for standalone output)
* @return mixed Output.
*/
public function edit($args)
{
// DEBUG: permission check aspect starts
$this->throwForbiddenUnless(SecurityUtil::checkPermission('MUBoard::', '::', ACCESS_EDIT));
// DEBUG: permission check aspect ends
// parameter specifying which type of objects we are treating
$objectType = isset($args['ot']) && !empty($args['ot']) ? $args['ot'] : $this->request->getGet()->filter('ot', 'category', FILTER_SANITIZE_STRING);
$utilArgs = array('controller' => 'user', 'action' => 'edit');
if (!in_array($objectType, MUBoard_Util_Controller::getObjectTypes('controllerAction', $utilArgs))) {
$objectType = MUBoard_Util_Controller::getDefaultObjectType('controllerAction', $utilArgs);
}
// create new Form reference
$view = FormUtil::newForm($this->name, $this);
// build form handler class name
$handlerClass = 'MUBoard_Form_Handler_User_' . ucfirst($objectType) . '_Edit';
// execute form using supplied template and page event handler
return $view->execute('user/' . $objectType . '/edit.tpl', new $handlerClass());
}
示例11: config
/**
* This method takes care of the application configuration.
*
* @return string Output
*/
public function config()
{
$this->throwForbiddenUnless(SecurityUtil::checkPermission($this->name . '::', '::', ACCESS_ADMIN));
// Create new Form reference
$view = FormUtil::newForm($this->name, $this);
// Execute form using supplied template and page event handler
return $view->execute('admin/config.tpl', new MUBoard_Form_Handler_Admin_Config());
}
示例12: deletedpages
/**
* Restore deleted pages
* @param <type> $args
* @return <type>
*/
public function deletedpages($args)
{
$view = FormUtil::newForm('Content', $this);
return $view->execute('admin/deletedpages.tpl', new Content_Form_Handler_Admin_DeletedPages($args));
}
示例13: modifyconfig
/**
* Modify configuration
*
* This is a standard function to modify the configuration parameters of the
* module
*
* @return string The configuration page
*/
public function modifyconfig()
{
// Security check
if (!SecurityUtil::checkPermission('EZComments::', '::', ACCESS_ADMIN)) {
return LogUtil::registerPermissionError();
}
// Create Form output object
$render = FormUtil::newForm('EZComments', $this);
// Return the output that has been generated by this function
return $render->execute('ezcomments_admin_modifyconfig.tpl', new EZComments_Form_Handler_Admin_ModifyConfig());
}
示例14: edit
/**
* This method provides a handling of edit requests.
*
* @param string $tpl Name of alternative template (to be used instead of the default template).
* @param boolean $raw Optional way to display a template instead of fetching it (required for standalone output).
*
* @return mixed Output.
*/
public function edit()
{
$legacyControllerType = $this->request->query->filter('lct', 'user', FILTER_SANITIZE_STRING);
System::queryStringSetVar('type', $legacyControllerType);
$this->request->query->set('type', $legacyControllerType);
$controllerHelper = new MUVideo_Util_Controller($this->serviceManager);
// parameter specifying which type of objects we are treating
$objectType = 'movie';
$utilArgs = array('controller' => 'movie', 'action' => 'edit');
$permLevel = $legacyControllerType == 'admin' ? ACCESS_ADMIN : ACCESS_EDIT;
$this->throwForbiddenUnless(SecurityUtil::checkPermission($this->name . ':' . ucfirst($objectType) . ':', '::', $permLevel), LogUtil::getErrorMsgPermission());
// create new Form reference
$view = FormUtil::newForm($this->name, $this);
// build form handler class name
$handlerClass = $this->name . '_Form_Handler_Movie_Edit';
// determine the output template
$viewHelper = new MUVideo_Util_View($this->serviceManager);
$template = $viewHelper->getViewTemplate($this->view, $objectType, 'edit', array());
// execute form using supplied template and page event handler
return $view->execute($template, new $handlerClass());
}