Esempio n. 1
0
 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 = JUDownloadHelper::getParams(null, $this->item->id);
     if ($cat_id == JUDownloadFrontHelperCategory::getRootCategory()->id && !$this->params->get('allow_add_doc_to_root', 0)) {
         JError::raiseError(500, JText::_('COM_JUDOWNLOAD_CAN_NOT_ADD_DOCUMENT_TO_ROOT_CATEGORY'));
         return false;
     }
     if ($tempDocument = JUDownloadHelper::getTempDocument($this->item->id)) {
         $editPendingDocLink = '<a href="index.php?option=com_judownload&task=document.edit&approve=1&id=' . $tempDocument->id . '">' . $tempDocument->title . '</a>';
         JError::raiseNotice('', JText::sprintf('COM_JUDOWNLOAD_THIS_DOCUMENT_HAS_PENDING_DOCUMENT_X_PLEASE_APPROVE_PENDING_DOCUMENT_FIRST', $editPendingDocLink));
     }
     if ($this->item->approved < 0) {
         $oriDocId = abs($this->item->approved);
         $oriDocObj = JUDownloadHelper::getDocumentById($oriDocId);
         $editOriDocLink = '<a href="index.php?option=com_judownload&task=document.edit&id=' . $oriDocId . '">' . $oriDocObj->title . '</a>';
         JError::raiseNotice('', JText::sprintf('COM_JUDOWNLOAD_ORIGINAL_DOCUMENT_X', $editOriDocLink));
     }
     $this->script = $this->get('Script');
     $this->plugins = $this->get('Plugins');
     $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 = JUDownloadFrontHelperField::getField('cat_id', $this->item);
     $this->fieldGallery = JUDownloadFrontHelperField::getField('gallery', $this->item);
     $this->files = $this->get('Files');
     $this->changeLogs = $this->get('ChangeLogs');
     $this->versions = $this->get('Versions');
     $this->extraFields = $this->get('ExtraFields');
     $this->fieldsData = $this->app->getUserState("com_judownload.edit.document.fieldsdata", array());
     $this->relatedDocuments = $this->get('RelatedDocuments');
     $this->canDo = JUDownloadHelper::getActions('com_judownload', 'category', $this->item->cat_id);
     $this->addToolBar();
     $this->setDocument();
     parent::display($tpl);
 }
Esempio n. 2
0
	public function storeValue($value, $type = 'default', $inputData = null)
	{
		$app = JFactory::getApplication();
		if ($app->isSite())
		{
			
			return true;
		}
		else
		{
			
			$tmpDoc = JUDownloadHelper::getTempDocument($this->doc_id);
			if (is_object($tmpDoc))
			{
				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, $type, $inputData);
		}
	}
Esempio n. 3
0
		}
		$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");
		}

		
		$tmpDoc = JUDownloadHelper::getTempDocument($this->doc_id);
		if (is_object($tmpDoc))
		{
			$this->setAttribute("disabled", "disabled", "input");
		}
		else
		{
			$this->setAttribute("disabled", null, "input");
			if (is_object($this->doc) && $this->doc->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>";
	}