public function storeValue($value) { $app = JFactory::getApplication(); if ($app->isSite()) { return true; } else { $tmpListing = JUDirectoryHelper::getTempListing($this->listing_id); if (is_object($tmpListing)) { return true; } $approveOption = $app->input->post->get("approval_option"); $approveOptionArray = array("ignore", "approve", "delete"); if (in_array($approveOption, $approveOptionArray)) { return true; } return parent::storeValue($value); } }
public function display($tpl = null) { if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode('<br />', $errors)); return false; } $this->form = $this->get('Form'); $this->item = $this->get('Item'); $this->model = $this->getModel(); $this->app = JFactory::getApplication(); $cat_id = $this->item->cat_id ? $this->item->cat_id : $this->app->input->get('cat_id'); $this->params = JUDirectoryHelper::getParams(null, $this->item->id); if ($cat_id == JUDirectoryFrontHelperCategory::getRootCategory()->id && !$this->params->get('allow_add_listing_to_root', 0)) { JError::raiseError(500, JText::_('COM_JUDIRECTORY_CAN_NOT_ADD_LISTING_TO_ROOT_CATEGORY')); return false; } if ($tempListing = JUDirectoryHelper::getTempListing($this->item->id)) { $editPendingListingLink = '<a href="index.php?option=com_judirectory&task=document.edit&approve=1&id=' . $tempListing->id . '">' . $tempListing->title . '</a>'; JError::raiseNotice('', JText::sprintf('COM_JUDIRECTORY_THIS_LISTING_HAS_PENDING_LISTING_X_PLEASE_APPROVE_PENDING_LISTING_FIRST', $editPendingListingLink)); } if ($this->item->approved < 0) { $oriListingId = abs($this->item->approved); $oriListingObj = JUDirectoryHelper::getListingById($oriListingId); $editOriDocLink = '<a href="index.php?option=com_judirectory&task=document.edit&id=' . $oriListingId . '">' . $oriListingObj->title . '</a>'; JError::raiseNotice('', JText::sprintf('COM_JUDIRECTORY_ORIGINAL_LISTING_X', $editOriDocLink)); } $this->script = $this->get('Script'); $this->plugins = $this->get('Plugins'); $this->fieldLocations = $this->get('FieldLocations'); $this->fieldsetDetails = $this->model->getCoreFields('details'); $this->fieldsetPublishing = $this->model->getCoreFields('publishing'); $this->fieldsetTemplateStyleAndLayout = $this->model->getCoreFields('template_style'); $this->fieldsetMetadata = $this->model->getCoreFields('metadata'); $this->fieldCatid = JUDirectoryFrontHelperField::getField('cat_id', $this->item); $this->fieldGallery = $this->get('GalleryField'); $this->extraFields = $this->get('ExtraFields'); $this->fieldsData = $this->app->getUserState("com_judirectory.edit.listing.fieldsdata", array()); $this->relatedListings = $this->get('RelatedListings'); $this->canDo = JUDirectoryHelper::getActions('com_judirectory', 'category', $this->item->cat_id); $this->addToolBar(); $this->setDocument(); parent::display($tpl); }
$this->addAttribute("class", "radio btn-group", "input"); $html = "<fieldset id=\"" . $this->getId() . "\" " . $this->getAttribute(null, null, "input") . ">"; foreach ($options as $key => $option) { if ($option->text == strtoupper($option->text)) { $text = JText::_($option->text); } else { $text = $option->text; } $text = htmlspecialchars($text, ENT_COMPAT, 'UTF-8'); $this->setAttribute("value", htmlspecialchars($option->value, ENT_COMPAT, 'UTF-8'), "input"); if ($option->value == $value) { $this->setAttribute("checked", "checked", "input"); } else { $this->setAttribute("checked", null, "input"); } $tmpListing = JUDirectoryHelper::getTempListing($this->listing_id); if (is_object($tmpListing)) { $this->setAttribute("disabled", "disabled", "input"); } else { $this->setAttribute("disabled", null, "input"); if (is_object($this->listing) && $this->listing->approved < 0) { $this->setAttribute("disabled", "disabled", "input"); } } $html .= "<input id=\"" . $this->getId() . $key . "\" name=\"" . $this->getName() . "\" " . $this->getAttribute(null, null, "input") . " /> <label for=\"" . $this->getId() . $key . "\">{$text}</label>"; } if (is_object($this->listing) && $this->listing->approved < 0) { $html .= "<input type=\"hidden\" name=\"" . $this->getName() . "\" value=\"" . $value . "\" />"; } $html .= "</fieldset>"; echo $html;