本文整理汇总了PHP中JModelForm类的典型用法代码示例。如果您正苦于以下问题:PHP JModelForm类的具体用法?PHP JModelForm怎么用?PHP JModelForm使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JModelForm类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testValidatePassesDataAndGroupToJform
/**
* Test JModelForm::validate
*
* @since 3.4
*
* @return void
*
* @testdox validate() passes data and group to JForm
*/
public function testValidatePassesDataAndGroupToJform()
{
$data = array("a" => "b");
$group = "groupy";
$formMock = $this->getMockBuilder('JForm')->disableOriginalConstructor()->getMock();
$formMock->expects($this->once())->method('validate')->with($data, $group)->willReturn(true);
$formMock->expects($this->once())->method('filter')->with($data)->will($this->returnArgument(0));
$this->object->validate($formMock, $data, $group);
}
示例2: __construct
public function __construct($config = array())
{
$udbPath = UserNotesHelper::userDataPath() . '/usernotes.db3';
$db = JDatabaseDriver::getInstance(array('driver' => 'sqlite', 'database' => $udbPath));
$config['dbo'] = $db;
parent::__construct($config);
}
示例3: getItem
/**
* Method to get the record form.
*
* @param string $pk Private key.
*
* @since 2.2
* @return null
*/
public function getItem($pk = null)
{
if ($item = parent::getItem($pk)) {
// Do any procesing on fields here if needed
}
return $item;
}
示例4:
function __construct()
{
parent::__construct();
$this->projectid = JRequest::getInt('p', 0);
$this->ptid = JRequest::getInt('ptid', 0);
$this->tid = JRequest::getInt('tid', 0);
}
示例5: populateState
/**
* Method to auto-populate the model state.
* Note. Calling getState in this method will result in recursion.
* @since 1.6
*/
protected function populateState()
{
parent::populateState();
$app = JFactory::getApplication("Site");
/** @var $app JApplicationSite * */
// Get the pk of the record from the request.
$value = $app->input->getInt("id");
$this->setState($this->getName() . '.id', $value);
}
示例6: __construct
public function __construct($config = array())
{
parent::__construct($config);
global $ext_name_com, $ext_prefix;
$this->ext_name_com = $ext_name_com;
$this->ext_prefix = $ext_prefix;
$this->context .= $this->getName() && ($layout = JRequest::getVar('layout', 'default')) ? '.' . $layout : '';
$this->params = JComponentHelper::getParams($this->ext_name_com);
}
示例7: populateState
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @since 1.6
*/
protected function populateState()
{
parent::populateState();
$app = JFactory::getApplication();
/** @var $app JApplicationSite */
// Load the parameters.
$value = $app->getParams($this->option);
$this->setState('params', $value);
}
示例8: getForm
/**
* Method to get a form object.
*
* @return mixed A JForm object on success, false on failure.
* @since 1.6
*/
public function getForm()
{
// Get the form.
$form = parent::getForm('application', 'com_config.application', array('array' => 'jform', 'event' => 'onPrepareForm'));
// Check for an error.
if (JError::isError($form)) {
$this->setError($form->getMessage());
return false;
}
return $form;
}
示例9: preprocessForm
protected function preprocessForm(JForm $form, $data, $group = 'contact')
{
$userParams = JComponentHelper::getParams('com_contact');
// Deal with captcha
$captcha = $userParams->get('captcha', '0');
if ($captcha === '0') {
$form->removeField('captcha');
} else {
$form->setFieldAttribute('captcha', 'plugin', $captcha);
}
parent::preprocessForm($form, $data, 'user');
}
示例10: populateState
protected function populateState()
{
$app = JFactory::getApplication();
$id = JRequest::getInt($this->pk_name);
$this->setState(strtolower($this->model_key) . '.' . $this->pk_name, $id);
$cmd = JRequest::getCmd('cmd', '');
$this->setState(strtolower($this->model_key) . '.cmd', $cmd);
// Load the parameters.
$params = $app->getParams();
$this->setState('params', $params);
parent::populateState();
}
示例11: populateState
/**
* Method to auto-populate the model state.
* Note. Calling getState in this method will result in recursion.
* @since 1.6
*/
protected function populateState()
{
parent::populateState();
$app = JFactory::getApplication();
/** @var $app JApplicationSite */
// Get the pk of the record from the request.
$value = $app->input->getInt('id');
$this->setState($this->getName() . '.id', $value);
// Load the parameters.
$params = $app->getParams();
$this->setState('params', $params);
}
示例12: getForm
/**
* Method to get the record form.
*
* @return mixed JForm object on success, false on failure.
* @since 1.6
*/
public function getForm()
{
// Get the form.
$form = parent::getForm('download', 'com_banners.download', array('array' => 'jform'));
// Check for an error.
if (JError::isError($form)) {
$this->setError($form->getMessage());
return false;
}
$form->setValue('basename', $this->getState('basename'));
$form->setValue('compressed', $this->getState('compressed'));
return $form;
}
示例13: getForm
/**
* Method to get the record form.
*
* @return mixed JForm object on success, false on failure.
*/
public function getForm()
{
// Initialise variables.
$app = JFactory::getApplication();
// Get the form.
$form = parent::getForm('config', 'com_messages.config', array('array' => 'jform', 'event' => 'onPrepareForm'));
// Check for an error.
if (JError::isError($form)) {
$this->setError($form->getMessage());
return false;
}
return $form;
}
示例14: populateState
/**
* Method to auto-populate the model state.
* Note. Calling getState in this method will result in recursion.
* @since 1.6
*/
protected function populateState()
{
parent::populateState();
$app = JFactory::getApplication("Site");
/** @var $app JApplicationSite * */
// Get the pk of the record from the request.
$value = $app->input->getInt("id");
$this->setState('item_id', $value);
$value = $app->input->getInt("comment_id");
$this->setState('comment_id', $value);
// Load the parameters.
$value = $app->getParams($this->option);
$this->setState('params', $value);
}
示例15: populateState
/**
* Method to auto-populate the model state.
* Note. Calling getState in this method will result in recursion.
* @since 1.6
*/
protected function populateState()
{
parent::populateState();
$app = JFactory::getApplication();
/** @var $app JApplicationSite */
// Get the pk of the record from the request.
$value = $app->input->getInt("id", 0);
$this->setState($this->getName() . '.id', $value);
// Get category ID
$value = $app->getUserState($this->option . ".items.catid");
$this->setState('category_id', $value);
// Load the parameters.
$value = $app->getParams($this->option);
$this->setState('params', $value);
}