Example #1
0
}
?>

            <?php 
$extraFields = $this->model->getFieldsHaveFieldClass('extra');
$fieldGroups = array();
foreach ($extraFields as $field) {
    if (isset($fieldGroups[$field->group_id])) {
        $fieldGroups[$field->group_id][] = $field;
    } else {
        $fieldGroups[$field->group_id] = array($field);
    }
}
if (!empty($fieldGroups)) {
    foreach ($fieldGroups as $groupId => $fields) {
        $group = JUDownloadFrontHelperField::getFieldGroupById($groupId);
        echo JHtml::_('bootstrap.addTab', 'csv-export', "fieldgroup-{$group->id}", $group->name);
        ?>
                <table class="table table-striped">
                    <thead>
                    <tr>
                        <th width="1%">
                            <input type="checkbox" id="<?php 
        echo $group->id;
        ?>
" sub-checkbox="group_<?php 
        echo $group->id;
        ?>
" class="field"
                                   title="<?php 
        echo JText::_('COM_JUDOWNLOAD_CHECK_ALL');
Example #2
0
 public function saveCategoryPrepareFieldGroup($pk, $newParentObject, $table, &$data)
 {
     $app = JFactory::getApplication();
     if ($pk > 0) {
         if ($data['selected_fieldgroup'] == -1) {
             if ($table->selected_fieldgroup == -1) {
                 if ($table->parent_id == $data['parent_id']) {
                     $data['fieldgroup_id'] = $table->fieldgroup_id;
                 } else {
                     $newFieldGroupId = $newParentObject->fieldgroup_id;
                     if ($table->fieldgroup_id == $newFieldGroupId) {
                         $data['fieldgroup_id'] = $table->fieldgroup_id;
                     } else {
                         if ($data['changeFieldGroupAction'] == 1) {
                             $data['fieldgroup_id'] = $table->fieldgroup_id;
                             $data['selected_fieldgroup'] = $table->fieldgroup_id;
                             $fieldGroupObject = JUDownloadFrontHelperField::getFieldGroupById($table->fieldgroup_id);
                             $app->enqueueMessage(JText::sprintf('COM_JUDOWNLOAD_INHERITED_FIELD_GROUP_HAS_BEEN_CHANGED_TO_X', $fieldGroupObject->name ? $fieldGroupObject->name : JText::_("COM_JUDOWNLOAD_NONE")), 'Notice');
                         } else {
                             $data['fieldgroup_id'] = $newParentObject->fieldgroup_id;
                         }
                     }
                 }
             } else {
                 $data['fieldgroup_id'] = $newParentObject->fieldgroup_id;
             }
         } else {
             $data['fieldgroup_id'] = $data['selected_fieldgroup'];
         }
     } else {
         if ($data['selected_fieldgroup'] == -1) {
             $data['fieldgroup_id'] = $newParentObject->fieldgroup_id;
         } else {
             $data['fieldgroup_id'] = $data['selected_fieldgroup'];
         }
     }
 }
Example #3
0
	public function canView($options = array())
	{
		$storeId = md5(__METHOD__ . "::" . $this->doc_id . "::" . $this->id . "::" . serialize($options));

		if (!isset(self::$cache[$storeId]))
		{
			
			if (!$this->isPublished())
			{
				self::$cache[$storeId] = false;

				return self::$cache[$storeId];
			}

			
			$app            = JFactory::getApplication();
			$languageFilter = $app->getLanguageFilter();
			if ($languageFilter)
			{
				$languageTag = JFactory::getLanguage()->getTag();
				if (($this->language != $languageTag && $this->language != '*' && $this->language != ''))
				{
					self::$cache[$storeId] = false;

					return self::$cache[$storeId];
				}
			}

			if ($this->doc_id)
			{
				$document_display_params = JUDownloadFrontHelperDocument::getDocumentDisplayParams($this->doc_id);
				$document_display_fields = $document_display_params->get('fields');
			}

			$options = (array) $options;

			$field_name = $this->field_name ? $this->field_name : $this->id;
			if ($this->isDetailsView($options))
			{
				
				if (isset($document_display_fields->$field_name) && isset($document_display_fields->$field_name->details_view))
				{
					if (!$document_display_fields->$field_name->details_view)
					{
						self::$cache[$storeId] = false;

						return self::$cache[$storeId];
					}
				}
				
				elseif (!$this->details_view)
				{
					self::$cache[$storeId] = false;

					return self::$cache[$storeId];
				}
			}
			else
			{
				
				if (isset($document_display_fields->$field_name) && isset($document_display_fields->$field_name->list_view))
				{
					if (!$document_display_fields->$field_name->list_view)
					{
						self::$cache[$storeId] = false;

						return self::$cache[$storeId];
					}
				}
				
				elseif (!$this->list_view)
				{
					self::$cache[$storeId] = false;

					return self::$cache[$storeId];
				}
			}

			
			if (isset($this->doc) && $this->doc->cat_id)
			{
				$params = JUDownloadHelper::getParams($this->doc->cat_id);
			}
			else
			{
				$params = JUDownloadHelper::getParams(null, $this->doc_id);
			}

			
			$show_empty_field = $params->get('show_empty_field', 0);
			if ($this->doc_id && !$show_empty_field)
			{
				$field_value = $this->value;

				if (is_null($field_value))
				{
					self::$cache[$storeId] = false;

					return self::$cache[$storeId];
				}

				if (is_string($field_value) && trim($field_value) === '')
				{
					self::$cache[$storeId] = false;

					return self::$cache[$storeId];
				}

				if (is_array($field_value) && count($field_value) == 0)
				{
					self::$cache[$storeId] = false;

					return self::$cache[$storeId];
				}
			}

			$user = JFactory::getUser();
			if ($user)
			{
				$viewLevels    = JAccess::getAuthorisedViewLevels($user->id);
				$fieldGroupObj = JUDownloadFrontHelperField::getFieldGroupById($this->group_id);
				
				if (!in_array($fieldGroupObj->access, $viewLevels))
				{
					self::$cache[$storeId] = false;

					return self::$cache[$storeId];
				}
				else
				{
					if (in_array($this->access, $viewLevels))
					{
						self::$cache[$storeId] = true;

						return self::$cache[$storeId];
					}
					else
					{
						
						if ($this->doc_id && $this->who_can_download_can_access)
						{
							$canDownloadDocument = JUDownloadFrontHelperPermission::canDownloadDocument((int) $this->doc_id, true);

							return $canDownloadDocument;
						}
					}
				}
			}

			self::$cache[$storeId] = false;

			return self::$cache[$storeId];
		}

		return self::$cache[$storeId];
	}