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)); } }
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); }
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="" />