echo $item->title; ?> <?php } ?> <p class="<?php echo JUDirectoryHelper::isJoomla3x() ? "small" : "smallsub"; ?> "><?php echo JText::sprintf('JGLOBAL_LIST_ALIAS', $this->escape($item->alias)); ?> </p> </td> <td> <?php echo JUDirectoryHelper::generateCategoryPath($item->category_id, " > ", true, true); ?> </td> <td> <?php echo JHtml::_('jgrid.published', $item->published, $i, 'listings.', $canChange, 'cb', $item->publish_up, $item->publish_down); ?> </td> <td> <?php echo JHtml::_('judirectoryadministrator.featured', $item->featured, $i, $canChange); ?> </td> <td> <?php echo $item->access_title;
<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 JUDirectoryHelper::generateCategoryPath($cat_id, "li", true, false); ?> <div class="list-item"> <form action="<?php echo JRoute::_('index.php?option=com_judirectory&view=listcats&cat_id=' . $cat_id); ?> " method="post" name="adminForm" id="adminForm"> <?php echo $this->loadTemplate('categories'); if ($this->allowAddListing) { echo $this->loadTemplate('listings'); } ?>
$html .= '<li id="cat-' . $secondaryCatId . '"><a class="drag-icon"></a><span>' . JUDirectoryHelper::generateCategoryPath($secondaryCatId) . '</span> <a href="#" onclick="return false" class="remove-secondary-cat" ><i class="icon-minus fa fa-minus-circle"></i> ' . JText::_('COM_JUDIRECTORY_REMOVE') . '</a></li>'; } } } $html .= "</ul>"; if (!$disabled) { if ($app->isSite()) { if (isset($listingObject->approved) && $listingObject->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_JUDIRECTORY_CHANGE_CATEGORIES') . "</a>"; } } else { $html .= "<a href='#' class='change_categories' onclick='return false;'><i class='icon-folder fa fa-folder-open'></i> " . JText::_('COM_JUDIRECTORY_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">' . JUDirectoryHelper::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', '', $this->getId()); } 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', '', $this->getId()); } $html .= '<div class="cat_action clearfix">'; if ($app->isSite()) { if (isset($listingObject->approved) && $listingObject->approved <= 0 || $params->get('can_change_main_category', 1)) { $html .= '<button class="btn btn-mini btn-primary update-main-cat">' . JText::_('COM_JUDIRECTORY_UPDATE_CATEGORY') . '</button>'; }
public function listingChangeCategory() { $app = JFactory::getApplication(); if ($app->input->get('action', '') == 'update-maincat') { $ori_cat_id = $app->input->getInt('ori_cat_id', 0); $ori_cat = JUDirectoryHelper::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 = JUDirectoryFrontHelperCategory::getRootCategory(); $params = JUDirectoryHelper::getParams(); if ($rootCat->id == $new_cat_id && !$params->get('allow_add_listing_to_root', 0)) { return ""; } $new_cat = JUDirectoryHelper::getCategoryById($new_cat_id); if ($new_cat) { $db = JFactory::getDbo(); $query = "SELECT id, name FROM #__judirectory_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'] = JUDirectoryHelper::generateCategoryPath($new_cat_id); } if ($data['ori_field_group_id'] != $data['new_field_group_id']) { $data['msg_field_group'] = JText::_('COM_JUDIRECTORY_CHANGE_MAIN_CATEGORY_CAUSE_CHANGE_FIELD_GROUP_WARNING'); } $listingId = $app->input->getInt('id', 0); $data['message_style'] = JText::_('COM_JUDIRECTORY_INHERIT'); if ($listingId) { $listingObject = JUDirectoryHelper::getListingById($listingId); if ($listingObject->style_id == -1) { $oldStyleObject = JUDirectoryFrontHelperTemplate::getTemplateStyleOfCategory($listingId->cat_id); $newStyleObject = JUDirectoryFrontHelperTemplate::getTemplateStyleOfCategory($new_cat->id); if ($oldStyleObject->template_id != $newStyleObject->template_id) { $data['msg_style'] = JText::_('COM_JUDIRECTORY_CHANGE_MAIN_CATEGORY_CAUSE_CHANGE_TEMPLATE_WARNING'); } } $newTemplateStyleObject = JUDirectoryFrontHelperTemplate::getTemplateStyleOfCategory($new_cat->id); $data['message_style'] = JText::_('COM_JUDIRECTORY_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>" . JUDirectoryHelper::generateCategoryPath($cat_id) . "</span><a href=\"#\" onclick=\"return false\" class=\"remove-secondary-cat\" ><i class=\"icon-minus fa fa-minus-circle\"></i> " . JText::_('COM_JUDIRECTORY_REMOVE') . "</a></li>"; } } return $html; } }
} ?> </td> <?php foreach ($this->model->fields_use as $field) { echo '<td>'; switch ($field->field_name) { case "title": if (!$item->main) { $main_cat_id = JUDirectoryHelper::getListingById($item->id)->cat_id; ?> <a href="<?php echo JRoute::_('index.php?option=com_judirectory&view=listcats&cat_id=' . $main_cat_id); ?> "><?php echo JUDirectoryHelper::generateCategoryPath($main_cat_id); ?> </a> > <?php } if ($item->checked_out) { echo JHtml::_('jgrid.checkedout', $i, $item->checked_out_name, $item->checked_out_time, 'listings.', $canCheckin || $user->authorise('core.manage', 'com_checkin'), 'listing'); } if ($canEdit || $canEditOwn) { ?> <a href="<?php echo JRoute::_('index.php?option=com_judirectory&task=listing.edit&id=' . $item->id); ?> "> <?php echo $item->title;
protected function getInput() { $document = JFactory::getDocument(); $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('cat_id_related'); $query->from('#__judirectory_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_judirectory&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_JUDIRECTORY_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_JUDIRECTORY_REMOVE') . '</a></li>").appendTo(".category_list"); }else{ has_element.push(selectedText); } }); if(has_element.length == 1){ alert("' . JText::_('COM_JUDIRECTORY_CATEGORY_X_ALREADY_EXISTED') . '".replace("%s", has_element[0])); }else if(has_element.length > 1){ alert("' . JText::_('COM_JUDIRECTORY_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 = JUDirectoryHelper::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_JUDIRECTORY_REMOVE') . '</a>'; $html .= "</li>"; } } $html .= '</ul>'; $catId = $this->form->getValue('id', 0); $catParentId = !$catId ? JUDirectoryFrontHelperCategory::getRootCategory()->id : JUDirectoryHelper::getCategoryByID($catId)->parent_id; $query = $db->getQuery(true); $query->SELECT('title, id, published, parent_id'); $query->FROM('#__judirectory_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 = JUDirectoryHelper::getCategoryByID($catParentId); array_unshift($categoryList, JHtml::_('select.option', $catParent->parent_id, JText::_('COM_JUDIRECTORY_BACK_TO_PARENT_CATEGORY'), 'id', 'title')); } $html .= "<a href='#' class='change_categories' onclick='return false;'><i class=\"icon-folder\"></i> " . JText::_('COM_JUDIRECTORY_ADD_RELATED_CATEGORIES') . "</a>"; $html .= '<div class="category_selection" style="display: none;">'; $html .= '<div class="active_pathway">' . JUDirectoryHelper::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_JUDIRECTORY_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; }