本文整理汇总了PHP中JControllerForm类的典型用法代码示例。如果您正苦于以下问题:PHP JControllerForm类的具体用法?PHP JControllerForm怎么用?PHP JControllerForm使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JControllerForm类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
/**
* Save the configuration
*
* @return void
* @since 1.0
*/
function save()
{
$jform = JRequest::getVar('jform', array(), 'post', 'array');
$iid = $jform['series_id'];
$aid = $jform['automailing_id'];
$msg = false;
if (isset($jform['time_start']) && empty($jform['time_start'])) {
$err = true;
$msg = JText::_("COM_NEWSLETTER_START_TIME_IS_EMPTY");
}
// if (isset($jform['time_offset']) && empty($jform['time_offset'])) {
// $err = true;
// $msg = JText::_("COM_NEWSLETTER_TIME_OFFSET_IS_EMPTY");
// }
if (empty($err) && parent::save()) {
// Set the redirect based on the task.
switch ($this->getTask()) {
case 'save':
$this->setRedirect(JRoute::_('index.php?option=com_newsletter&view=close&tmpl=component', false));
break;
}
return true;
}
$this->setRedirect(JRoute::_('index.php?option=com_newsletter&tmpl=component&view=' . $this->view_item . $this->getRedirectToItemAppend($iid, 'series_id') . '&automailing_id=' . $aid, false), $msg);
return false;
}
示例2:
/**
* constructor (registers additional tasks to methods)
* @return void
*/
function __construct()
{
parent::__construct();
// Set reference to parameters
$this->params = JComponentHelper::getParams('com_chessvn');
//$dummy = $this->params->get('parm_text');
}
示例3: save
public function save($key = NULL, $urlVar = NULL)
{
if (!parent::save($key = NULL, $urlVar = NULL)) {
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_SAVE_FAILED', JText::_('COM_HTRAININGLOGS_PORTLET_EXISTS')));
$this->setMessage($this->getError(), 'error');
}
}
示例4: cancel
/**
* Method to cancel an edit.
*
* @param string $key The name of the primary key of the URL variable.
*
* @return boolean True if access level checks pass, false otherwise.
*/
public function cancel($key = 'id')
{
$result = parent::cancel($key);
// Redirect to the return page.
$this->setRedirect($this->getReturnPage());
return $result;
}
示例5: DisplayView
function DisplayView()
{
$submenu = JRequest::getVar('view');
// Add submenu
VideotranslationHelper::addSubmenu($submenu);
parent::display();
}
示例6: display
/**
* Proxy for getModel.
*/
function display($cachable = false, $urlparams = array())
{
$task = $_POST['task'];
if ($task == 'linksform.add' or $task == 'add' or $task == 'linksform.edit' or $task == 'edit') {
$this->setRedirect('index.php?option=com_youtubegallery&view=settings&layout=edit');
return true;
}
JRequest::setVar('view', 'settings');
JRequest::setVar('layout', 'edit');
switch (JRequest::getVar('task')) {
case 'apply':
$this->save();
break;
case 'settings.apply':
$this->save();
break;
case 'save':
$this->save();
break;
case 'settings.save':
$this->save();
break;
case 'cancel':
$this->cancel();
break;
case 'settings.cancel':
$this->cancel();
break;
default:
parent::display();
break;
}
}
示例7: __construct
public function __construct($config = array())
{
parent::__construct($config);
$this->_app = JFactory::getApplication();
$this->_input = $this->_app->input;
$this->_config = JSNConfigHelper::get();
}
示例8: array
function __construct($config = array())
{
parent::__construct($config);
// Need to set list view to plural format in legacy/controllers/form/constructor with array('/is$/i', "ises")
// Or change like here
$this->view_list = $this->view_item . "es";
}
示例9: edit
/**
* Edit document.
*/
public function edit($key = null, $urlVar = null)
{
if (JFactory::getApplication()->isSite()) {
JRequest::setVar('id', $this->getModel()->searchIdByPath(JoomDOCRequest::getPath()), 'post');
}
parent::edit();
}
示例10: save
public function save($key = null, $urlVar = null)
{
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
$app = JFactory::getApplication();
$model = $this->getModel('form');
$preconfig = $app->input->post->get('config', array(), 'array');
$task = $this->getTask();
$config = $model->store($preconfig);
$id = $config['pk'];
if ($config['validate'] == 'retry') {
parent::display();
return true;
}
if ($id) {
if ($config['stage'] > -1) {
$link = 'index.php?option=' . CCK_COM . '&view=form&type=' . $preconfig['type'] . '&id=' . $id . $this->_getRedirectQuery();
if ($config['stage'] > 0) {
$link .= '&stage=' . $config['stage'];
}
$this->setRedirect(htmlspecialchars_decode($link));
return;
}
if ($config['message_style']) {
if (isset($config['message'])) {
$msg = $config['doTranslation'] ? JText::_('COM_CCK_' . str_replace(' ', '_', trim($config['message']))) : $config['message'];
} else {
$msg = JText::_('COM_CCK_SUCCESSFULLY_SAVED');
}
$msgType = $config['message_style'];
} else {
$msg = '';
$msgType = '';
}
} else {
$msg = JText::_('JERROR_AN_ERROR_HAS_OCCURRED');
$msgType = 'error';
}
switch ($task) {
case 'apply':
$link = 'index.php?option=' . CCK_COM . '&view=form&type=' . $preconfig['type'] . '&id=' . $id . $this->_getRedirectQuery();
break;
case 'save2new':
$link = 'index.php?option=' . CCK_COM . '&view=form&type=' . $preconfig['type'] . $this->_getRedirectQuery();
break;
case 'save2view':
$location = JCckDatabase::loadResult('SELECT storage_location FROM #__cck_core WHERE id = ' . (int) $id);
$sef = 0;
$itemId2 = 0;
if ($location) {
require_once JPATH_SITE . '/plugins/cck_storage_location/' . $location . '/' . $location . '.php';
$link = JCck::callFunc_Array('plgCCK_Storage_Location' . $location, 'getRoute', array($config['pk'], $sef, $itemId2, array('type' => $config['type'])));
$link = str_replace('/administrator/', '/', $link);
break;
}
default:
$link = $this->_getRedirectQuery(true);
break;
}
$this->setRedirect(htmlspecialchars_decode($link), $msg, $msgType);
}
示例11: allowEdit
/**
* Method override to check if you can edit an existing record.
*
* @param array $data An array of input data.
* @param string $key The name of the key for the primary key.
*
* @return boolean
*/
protected function allowEdit($data = array(), $key = 'id')
{
$user = JFactory::getUser();
$uid = $user->get('id');
$id = (int) isset($data[$key]) ? $data[$key] : 0;
$owner = (int) isset($data['created_by']) ? $data['created_by'] : 0;
// Check general edit permission first.
if ($user->authorise('core.edit', 'com_pfrepo.directory.' . $id)) {
return true;
}
// Fallback on edit.own.
if ($user->authorise('core.edit.own', 'com_pfrepo.directory.' . $id)) {
// Now test the owner is the user.
if (!$owner && $id) {
$record = $this->getModel()->getItem($id);
if (empty($record)) {
return false;
}
$owner = $record->created_by;
}
if ($owner == $uid) {
return true;
}
}
// Fall back to the component permissions.
return parent::allowEdit($data, $key);
}
示例12: __construct
public function __construct($config = array())
{
parent::__construct($config);
if (JDEBUG) {
JLog::addLogger(array('text_file' => 'com_usernotes.log.php'), JLog::ALL, array('com_usernotes'));
}
}
示例13:
function __construct()
{
parent::__construct();
$this->registerTask('themeinstall', 'themeinstall');
$this->registerTask('bgimagesmall', 'bgimagesmall');
$this->registerTask('bgimagemedium', 'bgimagemedium');
}
示例14: add
public function add()
{
JRequest::setVar('view', 'template');
JRequest::setVar('layout', 'add');
JRequest::setVar('hidemainmenu', 1);
parent::display();
}
示例15: allowEdit
/**
* Method override to check if you can edit an existing record.
*
* @param array $data An array of input data.
* @param string $key The name of the key for the primary key.
*
* @return boolean
*
* @since 1.6
*/
protected function allowEdit($data = array(), $key = 'id')
{
$recordId = (int) isset($data[$key]) ? $data[$key] : 0;
$user = JFactory::getUser();
$userId = $user->get('id');
$canDo = ZhYandexMapHelper::getMarkerActions($recordId);
$canEdit = $canDo->get('core.edit');
$isEnabledEditOwn = $canDo->get('core.edit.own');
if ($canEdit || $canEditOwn) {
}
// Check general edit permission first.
if ($canEdit) {
return true;
}
// Fallback on edit.own.
// First test if the permission is available.
if ($isEnabledEditOwn) {
// Now test the owner is the user.
$ownerId = (int) isset($data['createdbyuser']) ? $data['createdbyuser'] : 0;
if (empty($ownerId) && $recordId) {
// Need to do a lookup from the model.
$record = $this->getModel()->getItem($recordId);
if (empty($record)) {
return false;
}
$ownerId = $record->createdbyuser;
}
// If the owner matches 'me' then do the test.
if ($ownerId == $userId) {
return true;
}
}
// Since there is no asset tracking, revert to the component permissions.
return parent::allowEdit($data, $key);
}