当前位置: 首页>>代码示例>>PHP>>正文


PHP JUDownloadHelper::getDocumentSubmitType方法代码示例

本文整理汇总了PHP中JUDownloadHelper::getDocumentSubmitType方法的典型用法代码示例。如果您正苦于以下问题:PHP JUDownloadHelper::getDocumentSubmitType方法的具体用法?PHP JUDownloadHelper::getDocumentSubmitType怎么用?PHP JUDownloadHelper::getDocumentSubmitType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JUDownloadHelper的用法示例。


在下文中一共展示了JUDownloadHelper::getDocumentSubmitType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getInput

	public function getInput($fieldValue = null)
	{
		if (!$this->isPublished())
		{
			return "";
		}

		if ((JUDownloadHelper::getDocumentSubmitType($this->doc_id) == 'submit' && $this->canSubmit())
			|| (JUDownloadHelper::getDocumentSubmitType($this->doc_id) == 'edit' && $this->canEdit())
		)
		{
			$disabled = false;
		}
		else
		{
			$disabled = true;
		}

		$document = JFactory::getDocument();
		$rootCat  = JUDownloadFrontHelperCategory::getRootCategory();
		JText::script('COM_JUDOWNLOAD_TOTAL_CATS_OVER_MAXIMUM_N_CATS');
		JText::script('COM_JUDOWNLOAD_CATEGORY_X_ALREADY_EXIST');
		$app = JFactory::getApplication();
		
		if (isset($this->doc) && $this->doc->cat_id)
		{
			$params = JUDownloadHelper::getParams($this->doc->cat_id);
		}
		else
		{
			$params = JUDownloadHelper::getParams(null, $this->doc_id);
		}

		$db              = JFactory::getDbo();
		$docId           = $this->doc_id;
		$documentObject  = JUDownloadHelper::getDocumentById($docId);
		$secondaryCatIds = $secondaryCatIdsStr = "";

		
		if ($fieldValue && !empty($fieldValue['main']))
		{
			$categoryId = (int) $fieldValue['main'];
			if ($fieldValue['secondary'])
			{
				$secondaryCatIdsStr = $fieldValue['secondary'];
				$secondaryCatIds    = explode(",", $secondaryCatIdsStr);
			}
			$query = $db->getQuery(true);
			$query->select("c.id, c.parent_id");
			$query->from("#__judownload_categories AS c");
			$query->select("field_group.id AS fieldgroup_id, field_group.name AS fieldgroup_name");
			$query->join("LEFT", "#__judownload_fields_groups AS field_group ON (field_group.id = c.fieldgroup_id AND field_group.published = 1)");
			$query->where("c.id = " . $categoryId);
			$db->setQuery($query);
			$mainCategory = $db->loadObject();
		}
		
		elseif ($docId)
		{
			$categories = $this->value;
			foreach ($categories AS $category)
			{
				if ($category->main == 1)
				{
					$mainCategory = $category;

					$query = $db->getQuery(true);
					$query->select("field_group.id, field_group.name");
					$query->from("#__judownload_fields_groups AS field_group");
					$query->join("", "#__judownload_categories AS c on c.fieldgroup_id = field_group.id");
					$query->where("c.id = " . $mainCategory->id);
					$query->where("field_group.published = 1");
					$db->setQuery($query);
					$fieldGroup = $db->loadObject();
					if (is_object($fieldGroup))
					{
						$mainCategory->fieldgroup_name = $fieldGroup->name;
						$mainCategory->fieldgroup_id   = $fieldGroup->id;
					}
					else
					{
						$mainCategory->fieldgroup_name = null;
						$mainCategory->fieldgroup_id   = null;
					}
				}
				else
				{
					$secondaryCatIds[] = $category->id;
				}
			}

			if ($secondaryCatIds)
			{
				$secondaryCatIdsStr = implode(",", $secondaryCatIds);
			}
		}
		
		elseif ($app->input->getInt('cat_id'))
		{
			$categoryId   = $app->input->getInt('cat_id');
//.........这里部分代码省略.........
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:101,代码来源:core_categories.php


注:本文中的JUDownloadHelper::getDocumentSubmitType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。