예제 #1
0
        ?>
						<?php 
    }
    ?>
						<p class="<?php 
    echo JUDownloadHelper::isJoomla3x() ? "small" : "smallsub";
    ?>
"><?php 
    echo JText::sprintf('JGLOBAL_LIST_ALIAS', $this->escape($item->alias));
    ?>
</p>
					</td>

					<td>
						<?php 
    echo JUDownloadHelper::generateCategoryPath($item->parent_id, " > ", true, true);
    ?>
					</td>
					<td>
						<?php 
    echo $item->access;
    ?>
					</td>
					<td>
						<?php 
    echo '<a href="index.php?option=com_judownload&task=fieldgroup.edit&id=' . $item->fieldgroup_id . '">' . $item->fieldgroup_name . '</a>';
    ?>
					</td>
					<td>
						<?php 
    echo (int) $item->total_documents;
예제 #2
0
 public function docChangeCategory()
 {
     $app = JFactory::getApplication();
     if ($app->input->get('action', '') == 'update-maincat') {
         $ori_cat_id = $app->input->getInt('ori_cat_id', 0);
         $ori_cat = JUDownloadHelper::getCategoryById($ori_cat_id);
         $data['ori_field_group_id'] = 0;
         $data['new_field_group_id'] = 0;
         $data['new_field_group_name'] = "";
         $data['path'] = "";
         if ($ori_cat) {
             $data['ori_field_group_id'] = $ori_cat->fieldgroup_id;
         }
         $new_cat_id = $app->input->getInt('new_cat_id', 0);
         $rootCat = JUDownloadFrontHelperCategory::getRootCategory();
         $params = JUDownloadHelper::getParams();
         if ($rootCat->id == $new_cat_id && !$params->get('allow_add_doc_to_root', 0)) {
             return "";
         }
         $new_cat = JUDownloadHelper::getCategoryById($new_cat_id);
         if ($new_cat) {
             $db = JFactory::getDbo();
             $query = "SELECT id, name FROM #__judownload_fields_groups WHERE id = " . $new_cat->fieldgroup_id . " AND published = 1";
             $db->setQuery($query);
             $fieldgroup = $db->loadObject();
             if ($fieldgroup) {
                 $data['new_field_group_id'] = $fieldgroup->id;
                 $data['new_field_group_name'] = $fieldgroup->name;
             }
             $data['path'] = JUDownloadHelper::generateCategoryPath($new_cat_id);
         }
         if ($data['ori_field_group_id'] != $data['new_field_group_id']) {
             $data['msg_field_group'] = JText::_('COM_JUDOWNLOAD_CHANGE_MAIN_CATEGORY_CAUSE_CHANGE_FIELD_GROUP_WARNING');
         }
         $documentId = $app->input->getInt('id', 0);
         $data['message_style'] = JText::_('COM_JUDOWNLOAD_INHERIT');
         if ($documentId) {
             $documentObject = JUDownloadHelper::getDocumentById($documentId);
             if ($documentObject->style_id == -1) {
                 $oldStyleObject = JUDownloadFrontHelperTemplate::getTemplateStyleOfCategory($documentId->cat_id);
                 $newStyleObject = JUDownloadFrontHelperTemplate::getTemplateStyleOfCategory($new_cat->id);
                 if ($oldStyleObject->template_id != $newStyleObject->template_id) {
                     $data['msg_style'] = JText::_('COM_JUDOWNLOAD_CHANGE_MAIN_CATEGORY_CAUSE_CHANGE_TEMPLATE_WARNING');
                 }
             }
             $newTemplateStyleObject = JUDownloadFrontHelperTemplate::getTemplateStyleOfCategory($new_cat->id);
             $data['message_style'] = JText::_('COM_JUDOWNLOAD_INHERIT') . ' (' . $newTemplateStyleObject->title . ' [' . $newTemplateStyleObject->template_title . ' ]' . ')';
         }
         return json_encode($data);
     } elseif ($app->input->getInt('action', '') == 'insert_secondary_cat') {
         $cat_id_str = $app->input->get('secondary_cat_id', '', 'string');
         $html = '';
         if (!empty($cat_id_str)) {
             $cat_id_arr = explode(",", $cat_id_str);
             foreach ($cat_id_arr as $key => $cat_id) {
                 $html .= "<li id=\"cat-" . $cat_id . "\"><a class=\"drag-icon\"></a><span>" . JUDownloadHelper::generateCategoryPath($cat_id) . "</span><a href=\"#\" onclick=\"return false\" class=\"remove-secondary-cat\" ><i class=\"icon-minus fa fa-minus-circle\"></i> " . JText::_('COM_JUDOWNLOAD_REMOVE') . "</a></li>";
             }
         }
         return $html;
     }
 }
예제 #3
0
    protected function getInput()
    {
        $document = JFactory::getDocument();
        $db = JFactory::getDbo();
        $query = $db->getQuery(true);
        $query->select('cat_id_related');
        $query->from('#__judownload_categories_relations');
        $query->where('cat_id = ' . (int) $this->form->getValue('id'));
        $query->order("ordering ASC");
        $db->setQuery($query);
        $relcategories = $db->loadColumn();
        $script = '
		jQuery(document).ready(function($){
			$(".category_list").dragsort({ dragSelector: "li", dragEnd: saveOrder, placeHolderTemplate: "<li class=\'placeHolder\'></li>", dragSelectorExclude: "input, textarea, span, a.removeitem"});

            function saveOrder() {
                var data = $("#gallery li").map(function() { return $(this).data("itemid"); }).get();
            };

			$(".category_list").on("click","a.removeitem", function(event){
				event.preventDefault();
				$(this).closest("li").remove();
			});

			$(".browse_cat").bind("dblclick",function(){
				var id = $(this).find("option:selected").val();
				$.ajax({
			  		type: "POST",
			  		url:"index.php?option=com_judownload&task=categories.loadcategories",
			  		data: {id : id, type : "category"}
				}).done(function(data){
					data = $.parseJSON(data);
					$(".browse_cat").html(data.html);
					$(".active_pathway").html(data.path);
				});
			});

			$(".change_categories").click(function(){
				$(".category_selection").slideToggle(400);
			});

			$("#add_related_categories").click(function(event){
    			event.preventDefault();
    			var has_element = [];
				var current_cat = ' . JFactory::getApplication()->input->get('id', 0) . ';
				$.each( $("option:selected",".browse_cat"), function(key, value ) {
					if($(this).data("noselect")){
						return;
					}

					var selectedValue = $(this).val();
					var selectedText = $(this).text();

  					if(current_cat == selectedValue){
						alert("' . JText::_('COM_JUDOWNLOAD_CAN_NOT_ADD_CATEGORY_ITSELF_AS_RELATED_CATEGORY') . '");
						return;
					}
  					if($(".category_list > li[id=\'category-"+selectedValue+"\']").length <= 0){
  						var path = $(".active_pathway").text() + " > " + selectedText;
  						$("<li id=\\"category-"+selectedValue+"\\"><a class=\\"drag-icon\\"></a><span>"+path+"</span><input type=\\"hidden\\" name=\\"relcategories[]\\" value=\\""+selectedValue+"\\" /> <a href=\\"#\\" class=\\"removeitem\\" ><i class=\\"icon-minus\\"></i> ' . JText::_('COM_JUDOWNLOAD_REMOVE') . '</a></li>").appendTo(".category_list");
   					}else{
  						has_element.push(selectedText);
  					}
				});

                if(has_element.length == 1){
                    alert("' . JText::_('COM_JUDOWNLOAD_CATEGORY_X_ALREADY_EXISTED') . '".replace("%s", has_element[0]));
				}else if(has_element.length > 1){
				    alert("' . JText::_('COM_JUDOWNLOAD_CATEGORIES_X_ALREADY_EXISTED') . '".replace("%s", has_element.join(", ")));
				}
				return false;
			});
		});';
        $document->addScriptDeclaration($script);
        $html = "";
        $html .= "<div class=\"categories\">";
        $html .= "<ul class=\"category_list nav clearfix\">";
        if ($relcategories) {
            foreach ($relcategories as $key => $relcategory) {
                $path = JUDownloadHelper::generateCategoryPath($relcategory);
                $html .= '<li id="category-' . $relcategory . '">';
                $html .= '<a class="drag-icon"></a>';
                $html .= '<span>' . $path . '</span>';
                $html .= '<input type="hidden" name="relcategories[]" value="' . $relcategory . '" />';
                $html .= '<a class="removeitem" href="#"><i class="icon-minus"></i> ' . JText::_('COM_JUDOWNLOAD_REMOVE') . '</a>';
                $html .= "</li>";
            }
        }
        $html .= '</ul>';
        $catId = $this->form->getValue('id', 0);
        $catParentId = !$catId ? JUDownloadFrontHelperCategory::getRootCategory()->id : JUDownloadHelper::getCategoryByID($catId)->parent_id;
        $query = $db->getQuery(true);
        $query->SELECT('title, id, published, parent_id');
        $query->FROM('#__judownload_categories');
        $query->WHERE('parent_id = ' . $catParentId);
        $query->ORDER('lft');
        $db->setQuery($query);
        $categoryList = $db->loadObjectList();
        foreach ($categoryList as $key => $cat) {
            if ($cat->published != 1) {
                $cat->title = "[" . $cat->title . "]";
            }
        }
        if ($catParentId != 0) {
            $catParent = JUDownloadHelper::getCategoryByID($catParentId);
            array_unshift($categoryList, JHtml::_('select.option', $catParent->parent_id, JText::_('COM_JUDOWNLOAD_BACK_TO_PARENT_CATEGORY'), 'id', 'title'));
        }
        $html .= "<a href='#' class='change_categories' onclick='return false;'><i class=\"icon-folder\"></i> " . JText::_('COM_JUDOWNLOAD_ADD_RELATED_CATEGORIES') . "</a>";
        $html .= '<div class="category_selection" style="display: none;">';
        $html .= '<div class="active_pathway">' . JUDownloadHelper::generateCategoryPath($catParentId, 'li') . '</div>';
        $html .= JHtml::_('select.genericlist', $categoryList, 'browse_cat', 'class="inputbox browse_cat" multiple="multiple" size="8"', 'id', 'title', '', "");
        $html .= '<div class="cat_action clearfix">';
        $html .= "<button id='add_related_categories' class='btn btn-mini btn-primary'>" . JText::_('COM_JUDOWNLOAD_ADD_RELATED_CATEGORIES') . "</button>";
        $html .= "<input type='hidden' name='cat_id_related' id='cat_id_related' value='" . $this->value . "' />";
        $html .= "</div>";
        $html .= "</div>";
        $html .= '</div>';
        return $html;
    }
예제 #4
0
    }
    ?>
				</td>
				<?php 
    foreach ($this->model->fields_use as $field) {
        echo '<td>';
        switch ($field->field_name) {
            case "title":
                if (!$item->main) {
                    $main_cat_id = JUDownloadHelper::getDocumentById($item->id)->cat_id;
                    ?>
								<a href="<?php 
                    echo JRoute::_('index.php?option=com_judownload&view=listcats&cat_id=' . $main_cat_id);
                    ?>
"><?php 
                    echo JUDownloadHelper::generateCategoryPath($main_cat_id);
                    ?>
 </a> >
							<?php 
                }
                if ($item->checked_out) {
                    echo JHtml::_('jgrid.checkedout', $i, $item->checked_out_name, $item->checked_out_time, 'documents.', $canCheckin || $user->authorise('core.manage', 'com_checkin'), 'doc');
                }
                if ($canEdit || $canEditOwn) {
                    ?>
								<a href="<?php 
                    echo JRoute::_('index.php?option=com_judownload&amp;task=document.edit&amp;id=' . $item->id);
                    ?>
">
									<?php 
                    echo $item->title;
예제 #5
0
	if ($app->isSite())
	{
		if ((isset($documentObject->approved) && $documentObject->approved <= 0) || $params->get('can_change_secondary_categories', 1) || $params->get('can_change_main_category', 1))
		{
			$html .= "<a href='#' class='change_categories' onclick='return false;'><i class='icon-folder fa fa-folder-open'></i> " . JText::_('COM_JUDOWNLOAD_CHANGE_CATEGORIES') . "</a>";
		}
	}
	else
	{
		$html .= "<a href='#' class='change_categories' onclick='return false;'><i class='icon-folder fa fa-folder-open'></i> " . JText::_('COM_JUDOWNLOAD_CHANGE_CATEGORIES') . "</a>";
	}

	$html .= '<div class="category_selection" style="display: none;">';
	if ($this->params->get('cat_selection_mode', 'all') == 'drilldown')
	{
		$html .= '<div class="active_pathway">' . JUDownloadHelper::generateCategoryPath($mainCategory->parent_id, 'li') . '</div>';
	}
	$html .= '<input type="hidden" name="' . $this->getName() . '[main]" class="validate-numeric required" id="input-main-cat" value="' . $mainCategory->id . '" />';
	$html .= '<input type="hidden" name="' . $this->getName() . '[secondary]" id="input-secondary-cats" value="' . $secondaryCatIdsStr . '" />';

	
	if ($this->params->get('cat_selection_mode', 'all') == 'all')
	{
		$allCategoryOptions = $this->getAllCategoryOptions();
		$html .= JHtml::_('select.genericlist', $allCategoryOptions, 'browse_cat', 'class="browse_cat" multiple="multiple" size="10"', 'id', 'title', '');
	}
	
	else
	{
		$childCategoryOptions = $this->getChildCategoryOptions($mainCategory->parent_id);
		$html .= JHtml::_('select.genericlist', $childCategoryOptions, 'browse_cat', 'class="browse_cat category_drilldown" multiple="multiple" size="10"', 'id', 'title', '');
예제 #6
0
	<div id="iframe-help"></div>

	<div id="splitterContainer">
		<div id="leftPane">
			<div class="inner-pane">
				<?php 
echo $this->loadTemplate('left');
?>
			</div>
		</div>

		<div id="rightPane">
			<div class="inner-pane">
				<?php 
echo JUDownloadHelper::generateCategoryPath($cat_id, "li", true, false);
?>

				<div class="list-item">
					<form
						action="<?php 
echo JRoute::_('index.php?option=com_judownload&view=listcats&cat_id=' . $cat_id);
?>
"
						method="post" name="adminForm" id="adminForm">
						<?php 
echo $this->loadTemplate('categories');
if ($this->allowAddDoc) {
    echo $this->loadTemplate('documents');
}
?>