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


PHP JUDownloadHelper::getCategoryTree方法代码示例

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


在下文中一共展示了JUDownloadHelper::getCategoryTree方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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('#__judownload_moderators');
     $query->where('id =' . $modId);
     $db->setQuery($query);
     $query = $db->getQuery(true);
     $query->select('cat_id');
     $query->from('#__judownload_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 = JUDownloadHelper::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_judownload&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_JUDOWNLOAD_PLEASE_SELECT_USER_BEFORE_SELECT_CATEGORY');
         $html .= "</div>";
         return $html;
     }
 }
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:50,代码来源:categorytreemoderator.php

示例2: getInput

 protected function getInput()
 {
     $fieldgroup_id = $this->form->getValue('id');
     $rootCategory = JUDownloadFrontHelperCategory::getRootCategory();
     $categoryTree = JUDownloadHelper::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_JUDOWNLOAD_INHERIT") . "\">" . JText::_('COM_JUDOWNLOAD_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_judownload&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:kosmosby,项目名称:medicine-prof,代码行数:45,代码来源:categoriestoassignfieldgroup.php

示例3: _prepareQuery

 protected function _prepareQuery($fieldNames, $filter)
 {
     if (empty($fieldNames)) {
         return false;
     }
     $db = $this->getDbo();
     $fieldNames = array_map(function ($element) {
         $element = 'd.' . $element;
         return $element;
     }, $fieldNames);
     $catIds = isset($filter['csv_cat_filter']) ? $filter['csv_cat_filter'] : array();
     $rootCat = JUDownloadFrontHelperCategory::getRootCategory();
     if (count($catIds) == 1 && $catIds[0] == $rootCat->id) {
         $catIds = array();
     }
     if (isset($filter['csv_sub_cat']) && !empty($catIds)) {
         $tmp = array();
         foreach ($catIds as $catId) {
             $categoryTree = JUDownloadHelper::getCategoryTree($catId);
             foreach ($categoryTree as $category) {
                 $tmp[] = $category->id;
             }
         }
         $catIds = array_unique(array_merge($catIds, $tmp));
     }
     $tags = $filter['csv_tag_filter'];
     $tags = array_filter($tags);
     $licenses = array_filter($filter['licenses']);
     $query = $db->getQuery(true);
     $query->select(implode(',', $fieldNames))->from("#__judownload_documents AS d")->join("", "#__judownload_documents_xref AS dx ON dx.doc_id = d.id")->join("", "#__judownload_categories AS c ON dx.cat_id = c.id");
     if (!empty($catIds)) {
         $query->where("dx.cat_id IN (" . implode(',', $catIds) . ")");
     }
     if (!empty($tags)) {
         $query->join("LEFT", "#__judownload_tags_xref AS tx ON tx.doc_id = d.id");
         $query->where("tx.tag_id IN (" . implode(",", $tags) . ")");
     }
     if (!empty($filter['csv_publishing_filter'])) {
         $filterConditions = array();
         $nullDate = $db->getNullDate();
         $now = JFactory::getDate()->toSql();
         foreach ($filter['csv_publishing_filter'] as $value) {
             $condition = array();
             switch (trim($value)) {
                 case 'published':
                     $condition[] = 'd.published = 1';
                     $condition[] = '(d.publish_up = ' . $db->quote($nullDate) . ' OR d.publish_up <= ' . $db->quote($now) . ')';
                     $condition[] = '(d.publish_down = ' . $db->quote($nullDate) . ' OR d.publish_down >= ' . $db->quote($now) . ')';
                     $condition[] = 'd.approved = 1';
                     break;
                 case 'unpublished':
                     $condition[] = 'd.published = 0';
                     $condition[] = 'd.approved = 1';
                     break;
                 case 'pending':
                     $condition[] = 'd.publish_up < ' . $db->quote($now);
                     $condition[] = 'd.published = 1';
                     $condition[] = 'd.approved = 1';
                     break;
                 case 'expired':
                     $condition[] = 'd.publish_down < ' . $db->quote($now);
                     $condition[] = 'd.published = 1';
                     $condition[] = 'd.approved = 1';
                     break;
                 case 'pending_approval':
                     $condition[] = 'd.approved = 0 ';
                     break;
                 case 'approved':
                     $condition[] = 'd.approved = 1';
                     break;
             }
             if (!empty($condition)) {
                 $filterConditions[] = '( ' . implode(' AND ', $condition) . ' )';
             }
         }
         if (!empty($filterConditions)) {
             $query->where('(' . implode(' OR ', $filterConditions) . ')');
         }
     }
     $offset = JFactory::getUser()->getParam('timezone', JFactory::getConfig()->get('offset'));
     if (!empty($filter['csv_created_from_filter'])) {
         $time = JFactory::getDate($filter['csv_created_from_filter'], $offset)->toSql();
         $query->where('d.created >= ' . $db->quote($time));
     }
     if (!empty($filter['csv_created_to_filter'])) {
         $time = JFactory::getDate($filter['csv_created_to_filter'], $offset)->toSql();
         $query->where('d.created <= ' . $db->quote($time));
     }
     if (!empty($licenses)) {
         $query->where('d.license_id IN (' . implode(',', $licenses) . ')');
     }
     $query->group('d.id');
     return $query;
 }
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:94,代码来源:csvprocess.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 = JUDownloadHelper::getCategoryTree($catId, true, true);
             foreach ($categoryTree as $sub_category) {
                 if ($sub_category->fieldgroup_id > 0) {
                     $field_groups[] = $sub_category->fieldgroup_id;
                 }
             }
         } else {
             $catObj = JUDownloadHelper::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:kosmosby,项目名称:medicine-prof,代码行数:26,代码来源:judownload.php

示例5: getInput

 protected function getInput()
 {
     $db = JFactory::getDbo();
     $app = JFactory::getApplication();
     $style_id = $app->input->getInt('id', 0);
     $db->setQuery("SELECT id FROM #__judownload_categories WHERE style_id = " . $style_id);
     $catIds = $db->loadColumn();
     $rootCategory = JUDownloadFrontHelperCategory::getRootCategory();
     $categoryTree = JUDownloadHelper::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 #__judownload_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_JUDOWNLOAD_INHERIT") . "\">" . JText::_("COM_JUDOWNLOAD_INHERIT") . "</span>";
         } elseif ($category->style_id == -2) {
             $html .= "<input type='checkbox' name='" . $this->name . "[]' value = '" . $category->id . "'>";
             $inherit = "";
             $db->setQuery("SELECT id FROM #__judownload_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_judownload&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:kosmosby,项目名称:medicine-prof,代码行数:77,代码来源:categoriestoassignstyle.php


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