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


PHP JUDirectoryHelper::getCategoryTree方法代码示例

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


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

示例1: getInput

 protected function getInput()
 {
     $app = JFactory::getApplication();
     $modId = $app->input->getInt('id', 0);
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $query->select('user_id');
     $query->from('#__judirectory_moderators');
     $query->where('id =' . $modId);
     $db->setQuery($query);
     $query = $db->getQuery(true);
     $query->select('cat_id');
     $query->from('#__judirectory_moderators_xref');
     $query->where('mod_id = ' . $modId);
     $db->setQuery($query);
     $categoryIdsAssignedMod = $db->loadColumn();
     $html = "<div id=\"moderator-assign\" class=\"moderator-assign pull-left\">";
     $select_cat_class = 'select-cat';
     $html .= '<div class="btn-group pull-left">';
     $html .= '<button type="button" class="btn btn-mini" onclick="jQuery(\'.' . $select_cat_class . '\').each(function(el) { jQuery(this).prop(\'checked\', !jQuery(this).is(\':checked\')); });">' . JText::_('JGLOBAL_SELECTION_INVERT') . '</button>';
     $html .= '<button type="button" class="btn btn-mini" onclick="jQuery(\'.' . $select_cat_class . '\').each(function(el) { jQuery(this).prop(\'checked\', false); });">' . JText::_('JGLOBAL_SELECTION_NONE') . '</button>';
     $html .= '<button type="button" class="btn btn-mini" onclick="jQuery(\'.' . $select_cat_class . '\').each(function(el) { jQuery(this).prop(\'checked\', true); });">' . JText::_('JGLOBAL_SELECTION_ALL') . '</button>';
     $html .= '</div>';
     $categoryTree = JUDirectoryHelper::getCategoryTree();
     $html .= "<ul id=\"" . $this->id . "\" class=\"nav\">";
     foreach ($categoryTree as $category) {
         $html .= "<li>";
         if (in_array($category->id, $categoryIdsAssignedMod)) {
             if (!in_array($category->id, $categoryIdsAssignedMod)) {
                 $html .= "<input id=\"catid-" . $category->id . "\" disabled type=\"checkbox\" value=\"" . $category->id . "\" name=\"jform[assigntocats][]\"/>";
             } else {
                 $html .= "<input id=\"catid-" . $category->id . "\" class=\"" . $select_cat_class . "\" checked type=\"checkbox\" value=\"" . $category->id . "\" name=\"jform[assigntocats][]\"/>";
             }
         } else {
             $html .= "<input id=\"catid-" . $category->id . "\" class=\"" . $select_cat_class . "\" type=\"checkbox\" value=\"" . $category->id . "\" name=\"jform[assigntocats][]\"/>";
         }
         $html .= "<label for=\"catid-" . $category->id . "\">" . str_repeat('<span class="gi">|—</span>', $category->level) . "<a href='index.php?option=com_judirectory&task=category.edit&id=" . $category->id . "'>" . $category->title . "</a></label>";
         $html .= "</li>";
     }
     $html .= "</ul>";
     $html .= "</div>";
     if ($modId != 0) {
         return $html;
     } else {
         $html = "<div id=\"moderator-assign\" class=\"moderator-assign pull-left\">";
         $html .= JText::_('COM_JUDIRECTORY_PLEASE_SELECT_USER_BEFORE_SELECT_CATEGORY');
         $html .= "</div>";
         return $html;
     }
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:50,代码来源:categorytreemoderator.php

示例2: getInput

 protected function getInput()
 {
     $fieldgroup_id = $this->form->getValue('id');
     $rootCategory = JUDirectoryFrontHelperCategory::getRootCategory();
     $categoryTree = JUDirectoryHelper::getCategoryTree($rootCategory->id);
     $html = "<div id=\"categoriestoassignfieldgroup\" class=\"categoriestoassignfieldgroup\">";
     if ($this->form->getValue('id') == 1) {
         $html .= '<input type="text" class="readonly" readonly="readonly" value="' . JText::_('JALL') . '"/>';
     } else {
         $select_cat_class = 'select-cat';
         $html .= '<div class="btn-group pull-left">';
         $html .= '<button type="button" class="btn btn-mini" onclick="jQuery(\'.' . $select_cat_class . '\').each(function(el) { jQuery(this).prop(\'checked\', !jQuery(this).is(\':checked\')); });">' . JText::_('JGLOBAL_SELECTION_INVERT') . '</button>';
         $html .= '<button type="button" class="btn btn-mini" onclick="jQuery(\'.' . $select_cat_class . '\').each(function(el) { jQuery(this).prop(\'checked\', false); });">' . JText::_('JGLOBAL_SELECTION_NONE') . '</button>';
         $html .= '<button type="button" class="btn btn-mini" onclick="jQuery(\'.' . $select_cat_class . '\').each(function(el) {  jQuery(this).prop(\'checked\', true); });">' . JText::_('JGLOBAL_SELECTION_ALL') . '</button>';
         $html .= '</div>';
         $html .= "<ul id=\"" . $this->id . "\" class=\"nav\">";
         $html .= "<li>";
         $html .= "<input id=\"catid-" . $rootCategory->id . "\" type=\"checkbox\" value=\"" . $rootCategory->id . "\" disabled=\"true\" />";
         $html .= "<label for=\"catid-" . $rootCategory->id . "\">" . str_repeat('<span class="gi">|—</span>', $rootCategory->level) . $rootCategory->title . "</label>";
         $html .= "</li>";
         foreach ($categoryTree as $category) {
             if ($category->id == $rootCategory->id) {
                 continue;
             }
             $link_edit_fieldgroup = '';
             $html .= "<li>";
             if ($category->selected_fieldgroup == -1 && $category->fieldgroup_id > 0) {
                 $html .= "<span class=\"inherited-value\"  title=\"" . JText::_("COM_JUDIRECTORY_INHERIT") . "\">" . JText::_('COM_JUDIRECTORY_INHERIT') . "</span>";
             } elseif ($category->fieldgroup_id == $fieldgroup_id) {
                 $html .= "<input class =\"" . $select_cat_class . "\" id=\"catid-" . $category->id . "\" type=\"checkbox\" value=\"" . $category->id . "\" checked=\"checked\" name=\"" . $this->name . "[]\"/>";
             } elseif ($category->fieldgroup_id > 0) {
                 $link_edit_fieldgroup = "<span><a href=\"index.php?option=com_judirectory&task=fieldgroup.edit&id=" . $category->fieldgroup_id . "\" title=\"" . $this->getFieldGroupName($category->fieldgroup_id) . "\" >[" . $this->getFieldGroupName($category->fieldgroup_id) . "]</a></span>";
                 $html .= "<input id=\"catid-" . $category->id . "\" type=\"checkbox\" checked=\"checked\" value=\"" . $category->id . "\" disabled=\"true\" />";
             } else {
                 $html .= "<input class =\"" . $select_cat_class . "\" id=\"catid-" . $category->id . "\" type=\"checkbox\" value=\"" . $category->id . "\" name=\"" . $this->name . "[]\"/>";
             }
             $html .= "<label for=\"catid-" . $category->id . "\">" . str_repeat('<span class="gi">|—</span>', $category->level) . $category->title . "</label>";
             $html .= $link_edit_fieldgroup;
             $html .= "</li>";
         }
         $html .= "</ul>";
     }
     $html .= "</div>";
     return $html;
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:45,代码来源:categoriestoassignfieldgroup.php

示例3: getInput

 protected function getInput()
 {
     $db = JFactory::getDbo();
     $app = JFactory::getApplication();
     $style_id = $app->input->getInt('id', 0);
     $db->setQuery("SELECT id FROM #__judirectory_categories WHERE style_id = " . $style_id);
     $catIds = $db->loadColumn();
     $rootCategory = JUDirectoryFrontHelperCategory::getRootCategory();
     $categoryTree = JUDirectoryHelper::getCategoryTree($rootCategory->id);
     $html = "<div id=\"categoriestoassignstyle\" class=\"categoriestoassignstyle\">";
     $select_cat_class = 'select-cat';
     $html .= '<div class="btn-group pull-left">';
     $html .= '<button type="button" class="btn btn-mini" onclick="jQuery(\'.' . $select_cat_class . '\').each(function(el) { jQuery(this).prop(\'checked\', !jQuery(this).is(\':checked\')); });">' . JText::_('JGLOBAL_SELECTION_INVERT') . '</button>';
     $html .= '<button type="button" class="btn btn-mini" onclick="jQuery(\'.' . $select_cat_class . '\').each(function(el) { jQuery(this).prop(\'checked\', false); });">' . JText::_('JGLOBAL_SELECTION_NONE') . '</button>';
     $html .= '<button type="button" class="btn btn-mini" onclick="jQuery(\'.' . $select_cat_class . '\').each(function(el) {  jQuery(this).prop(\'checked\', true); });">' . JText::_('JGLOBAL_SELECTION_ALL') . '</button>';
     $html .= '</div>';
     $html .= "<ul class=\"nav\" id=\"" . $this->id . "\">";
     foreach ($categoryTree as $category) {
         $html .= "<li>";
         $cat_style_id = "";
         if ($category->id == 1) {
             $cat_style_id = $category->style_id;
             $inherit = "";
         } elseif ($category->style_id == $style_id) {
             $html .= "<input class =\"" . $select_cat_class . "\" id=\"catid-" . $category->id . "\" type='checkbox' name='" . $this->name . "[]' value = '" . $category->id . "' checked>";
             $cat_style_id = $style_id;
             $inherit = "";
         } elseif ($category->style_id == -1) {
             $html .= "<input class =\"" . $select_cat_class . "\" id=\"catid-" . $category->id . "\" type='checkbox' name='" . $this->name . "[]' value = '" . $category->id . "'";
             $db->setQuery("SELECT id FROM #__judirectory_categories WHERE lft <" . $category->lft . " AND rgt > " . $category->rgt);
             $parentCatIds = $db->loadColumn();
             $parentCatIds = array_reverse($parentCatIds);
             if (is_array($catIds) && !empty($catIds)) {
                 foreach ($parentCatIds as $parentCatId) {
                     if (in_array($parentCatId, $catIds)) {
                         $html .= " checked";
                     }
                 }
             }
             $html .= ">";
             foreach ($parentCatIds as $parentCatId) {
                 $styleId = $this->getStyleIdByCategoryId($parentCatId);
                 if ($styleId > -1 || $styleId == -2) {
                     $cat_style_id = $styleId;
                     break;
                 }
             }
             $inherit = "<span class=\"inherited-value\" title=\"" . JText::_("COM_JUDIRECTORY_INHERIT") . "\">" . JText::_("COM_JUDIRECTORY_INHERIT") . "</span>";
         } elseif ($category->style_id == -2) {
             $html .= "<input type='checkbox' name='" . $this->name . "[]' value = '" . $category->id . "'>";
             $inherit = "";
             $db->setQuery("SELECT id FROM #__judirectory_template_styles WHERE home = 1");
             $cat_style_id = $db->loadResult();
         } else {
             $html .= "<input class =\"" . $select_cat_class . "\" id=\"catid-" . $category->id . "\" type='checkbox' name='" . $this->name . "[]' value = '" . $category->id . "' />";
             $inherit = "";
             $cat_style_id = $category->style_id;
         }
         if ($cat_style_id == -2) {
             $style_title = $this->getStyleTitle(0, true);
         } else {
             $style_title = $this->getStyleTitle($cat_style_id);
         }
         $style_title = $style_title ? " [" . $style_title . "] " : "";
         $html .= "<label for=\"catid-" . $category->id . "\">" . str_repeat('<span class="gi">|—</span>', $category->level);
         if ($category->id == 1) {
             $html .= $category->title;
         } else {
             $html .= "<a href=\"" . JRoute::_('index.php?option=com_judirectory&task=category.edit&id=' . $category->id) . "\">" . $category->title . "</a>";
         }
         $html .= " <span class=\"style-title\">" . $style_title . "</span>" . $inherit . "</label>";
         $html .= "</li>";
     }
     $html .= "</ul>";
     $html .= "</div>";
     return $html;
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:77,代码来源:categoriestoassignstyle.php

示例4: getFieldGroupsByCatIds

 public static function getFieldGroupsByCatIds($catIds, $search_sub_categories = false)
 {
     if (!$catIds) {
         return null;
     }
     $field_groups = array();
     foreach ($catIds as $catId) {
         if ($search_sub_categories) {
             $categoryTree = JUDirectoryHelper::getCategoryTree($catId, true, true);
             foreach ($categoryTree as $sub_category) {
                 if ($sub_category->fieldgroup_id > 0) {
                     $field_groups[] = $sub_category->fieldgroup_id;
                 }
             }
         } else {
             $catObj = JUDirectoryHelper::getCategoryById($catId);
             $field_groups[] = $catObj->fieldgroup_id ? $catObj->fieldgroup_id : 1;
         }
     }
     $field_groups = array_unique($field_groups);
     if ($field_groups) {
         return implode(",", $field_groups);
     } else {
         return null;
     }
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:26,代码来源:judirectory.php


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