本文整理汇总了PHP中RSFormProHelper::canEdit方法的典型用法代码示例。如果您正苦于以下问题:PHP RSFormProHelper::canEdit方法的具体用法?PHP RSFormProHelper::canEdit怎么用?PHP RSFormProHelper::canEdit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RSFormProHelper
的用法示例。
在下文中一共展示了RSFormProHelper::canEdit方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
public function save()
{
$app = JFactory::getApplication();
$formId = $app->input->getInt('formId', 0);
$id = $app->input->getInt('id', 0);
$task = $this->getTask();
// Get the model
$model = $this->getModel('directory');
// Save
if (RSFormProHelper::canEdit($formId, $id)) {
if ($model->save()) {
$this->setMessage(JText::_('RSFP_SUBM_DIR_SAVE_OK'));
if ($task == 'apply') {
$this->setRedirect(JRoute::_('index.php?option=com_rsform&view=directory&layout=edit&id=' . $id, false));
} else {
$this->setRedirect(JRoute::_('index.php?option=com_rsform&view=directory', false));
}
} else {
$app->enqueueMessage(JText::_('RSFP_SUBM_DIR_SAVE_ERROR'), 'error');
JRequest::setVar('view', 'directory');
JRequest::setVar('layout', 'edit');
JRequest::setVar('id', $id);
parent::display();
}
} else {
$this->setMessage(JText::_('JERROR_ALERTNOAUTHOR'), 'error');
$this->setRedirect(JRoute::_('index.php?option=com_rsform&view=directory', false));
}
}
示例2: display
public function display($tpl = null)
{
$this->app = JFactory::getApplication();
$this->doc = JFactory::getDocument();
$this->document =& $this->doc;
$this->params = $this->app->getParams('com_rsform');
$this->layout = $this->getLayout();
$this->directory = $this->get('Directory');
$this->tooltipClass = RSFormProHelper::getTooltipClass();
if ($this->layout == 'view') {
$this->doc->addStyleSheet(JURI::root(true) . '/components/com_rsform/assets/css/directory.css');
$this->template = $this->get('template');
$this->canEdit = RSFormProHelper::canEdit($this->params->get('formId'), $this->app->input->getInt('id', 0));
$this->id = $this->app->input->getInt('id', 0);
// Add custom CSS and JS
if ($this->directory->JS) {
$this->doc->addCustomTag($this->directory->JS);
}
if ($this->directory->CSS) {
$this->doc->addCustomTag($this->directory->CSS);
}
// Add pathway
$this->app->getPathway()->addItem(JText::_('RSFP_SUBM_DIR_VIEW'), '');
} elseif ($this->layout == 'edit') {
if (RSFormProHelper::canEdit($this->params->get('formId'), $this->app->input->getInt('id', 0))) {
$this->doc->addStyleSheet(JURI::root(true) . '/components/com_rsform/assets/css/directory.css');
$this->fields = $this->get('EditFields');
} else {
$this->app->redirect(JURI::root());
}
// Add pathway
$this->app->getPathway()->addItem(JText::_('RSFP_SUBM_DIR_EDIT'), '');
} else {
$this->search = $this->get('Search');
$this->items = $this->get('Items');
$this->uploadFields = $this->get('uploadFields');
$this->multipleFields = $this->get('multipleFields');
$this->unescapedFields = array_merge($this->multipleFields, $this->uploadFields);
$this->fields = $this->get('Fields');
$this->headers = RSFormProHelper::getDirectoryStaticHeaders();
$this->hasDetailFields = $this->hasDetailFields();
$this->hasSearchFields = $this->hasSearchFields();
$this->viewableFields = $this->getViewableFields();
$this->pagination = $this->get('Pagination');
$this->filter_search = $this->get('Search');
$this->filter_order = $this->get('ListOrder');
$this->filter_order_Dir = $this->get('ListDirn');
// Add custom CSS and JS
if ($this->directory->JS) {
$this->doc->addCustomTag($this->directory->JS);
}
if ($this->directory->CSS) {
$this->doc->addCustomTag($this->directory->CSS);
}
}
if ($this->params->get('robots')) {
$this->document->setMetadata('robots', $this->params->get('robots'));
}
if ($this->params->get('menu-meta_description')) {
$this->document->setDescription($this->params->get('menu-meta_description'));
}
if ($this->params->get('menu-meta_keywords')) {
$this->document->setMetadata('keywords', $this->params->get('menu-meta_keywords'));
}
$title = $this->params->get('page_title', '');
if (empty($title)) {
$title = JFactory::getConfig()->get('sitename');
} elseif (JFactory::getConfig()->get('sitename_pagetitles', 0) == 1) {
$title = JText::sprintf('JPAGETITLE', JFactory::getConfig()->get('sitename'), $title);
} elseif (JFactory::getConfig()->get('sitename_pagetitles', 0) == 2) {
$title = JText::sprintf('JPAGETITLE', $title, JFactory::getConfig()->get('sitename'));
}
$this->document->setTitle($title);
parent::display($tpl);
}
示例3:
echo RSFormProHelper::getTooltipText(JText::_('RSFP_SUBM_DIR_VIEW'));
?>
" href="<?php
echo JRoute::_('index.php?option=com_rsform&view=directory&layout=view&id=' . $item->SubmissionId);
?>
">
<img src="<?php
echo JURI::root() . 'components/com_rsform/assets/images/view.png';
?>
" alt="" />
</a>
<?php
}
?>
<?php
if (RSFormProHelper::canEdit($this->params->get('formId'), $item->SubmissionId)) {
?>
<a class="<?php
echo $this->tooltipClass;
?>
directoryEdit" title="<?php
echo RSFormProHelper::getTooltipText(JText::_('RSFP_SUBM_DIR_EDIT'));
?>
" href="<?php
echo JRoute::_('index.php?option=com_rsform&&view=directory&layout=edit&id=' . $item->SubmissionId);
?>
">
<img src="<?php
echo JURI::root() . 'components/com_rsform/assets/images/edit.png';
?>
" alt="" />