test
Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • zalchris Friend
    #1060277

    Where can i change this names of the data types?
    Look at the attached image.
    Thanks!


    1. filter
    Mr.Cat Moderator
    #1060428

    @zalchris,

    You can change by opening file

    /plugins/jamegafilter/docman/helper.php

    Go to line number 230 and add this code

    if ($icon == 'default') {
        $icon = 'Hang Khung';
    }

    Then try to index data again 🙂

    • This reply was modified 7 years, 3 months ago by  Mr.Cat.

    Wisdom is not a product of schooling but of the lifelong attempt to acquire it.

    zalchris Friend
    #1060474

    Sorry, but that doesn’t work. Attached my helper.php. Can you please add the code? Thank you!

    <?php
    /**

    class DocmanFilterHelper {
    function __construct()
    {
    $this->_db = JFactory::getDbo();
    }

    function getLangSuffix()
    {
        $langs = JFactory::getLanguage()->getKnownLanguages();
        $lang_sfx = array();
        foreach ($langs as $lang) {
            $lang_sfx[] = $lang['tag'];
        }
        return $lang_sfx;
    }
    
    function getFilterItems($catid)
    {
        $filterItems = array();
        $lang_sfx = $this->getLangSuffix();
    
        foreach ($lang_sfx AS $tag) {
            $filterItems[strtolower(str_replace('-','_',$tag))] = $this->getItemList($catid);
        }
    
        return $filterItems;
    }
    
    public function getItemList($catid)
    {
        $itemList = new stdCLass();
    
        if ($catid != '0') {
            $catsList = array($catid);
            foreach ($catsList as $cat) {
                $level = $this->getCategoryLevel($cat);
                if ($childs = $this->getChildCategories($cat, (int)$level)) {
                    foreach ($childs as $child) {
                        $catsList[] = $child;
                    }
                }
            }
        } else {
            $catsList = array();
            if ($this->getDocmanTreeCategories()) {
                foreach ($this->getDocmanTreeCategories() as $cat) {
                    $catsList[] = $cat->id;
                }
            }
        }
    
        $itemIdList = $this->getListId($catsList);
        if ($itemIdList) {
            foreach ($itemIdList as $id) {
                $property = 'item_'.$id;
                $item = $this->getItem($id, $catsList);
                if( !empty($item))
                    $itemList->{ $property } = $item;
                else
                    continue;
            }
        }
    
        return $itemList;
    }
    
    public function getItem($id, $catsList)
    {
        $baseItem = $this->getBaseItem($id);
        $itemParams = json_decode($baseItem->params);
        $desc = strip_tags($baseItem->desc);
    
        $item = new stdCLass();
        $item->id = $id;
        $item->name = $baseItem->title;
        $item->thumbnail = !empty($baseItem->image) ? $baseItem->image : '';
        $item->icon = $itemParams->icon;
        $item->isVideo = ($item->icon == 'video') ? true : false;
        $item->desc = !empty($desc) ? utf8_encode(substr($desc,0,100)).'...' : utf8_encode($desc);
        $item->created_by = $baseItem->created_by;
        $item->access = $baseItem->access;
    
        //Url and Url download.
        $alias = $id.'-'.$baseItem->slug;
        $category_slug = $this->getCategorySlug($id);
        $Itemid = $this->getItemid();
        $item->url = "index.php?option=com_docman&view=document&alias=$alias&category_slug=$category_slug&Itemid=$Itemid";
        $item->url_download = "index.php?option=com_docman&view=download&alias=$alias&category_slug=$category_slug&Itemid=$Itemid";
        $item->published_date = array (strtotime($baseItem->publish_on));
    
        // Downloads
        $item->download = ((int)$baseItem->hits < 2) ? (int)$baseItem->hits : null ;
        $item->downloads = (int)$baseItem->hits;
    
        //Attributes
        $this->attr = array();
        //Category Info
        $this->getCategoryInfo($id, $catsList);
        //Tag Info
        $this->getTagInfo($id);
        //File Type
        $this->getFileType($item->icon);
    
        $item->attr = $this->attr;
    
        return $item;
    }
    
    public function getBaseItem($id)
    {
        $query = $this->_db->getQuery(true);
        $query->select('dd.*')
            ->from('#__docman_documents as dd')
            ->where('dd.docman_document_id = ' . (int) $id);
        $this->_db->setQuery($query);
        $baseItem = $this->_db->loadObject();
    
        return $baseItem;
    }
    
    public function getListId($catids)
    {
        $query = $this->_db->getQuery(true);
        $query ->select('dd.docman_document_id as id')->from('#__docman_documents as dd')
                ->where('dd.docman_category_id IN ('.implode(',', $catids).') AND dd.enabled = "1"')
                ->order('dd.title ASC');
        $this->_db->setQuery($query);
        $listId = $this->_db->loadColumn();
    
        return $listId;
    }
    
    public function getCategorySlug($document_id)
    {
        $query = $this->_db->getQuery(true);
        $query->select('dc.slug')
                ->from('#__docman_categories as dc')
                ->join('LEFT', '#__docman_documents as dd ON dd.docman_category_id = dc.docman_category_id')
                ->where('dd.docman_document_id = '. (int) $document_id);
        $this->_db->setQuery($query);
        $slug = $this->_db->loadResult();
    
        return $slug;
    }
    
    public function getItemid()
    {
        $query = $this->_db->getQuery(true);
        $query->select('id')
                ->from('#__menu')
                ->where('link REGEXP "^(index.php.*com_docman)(&view=list|tree|document)"');
        $this->_db->setQuery($query);
    
        return $this->_db->loadResult();
    }
    
    public function getFileType($icon)
    {
        $this->attr['type']['value'][] = $icon;
        $this->attr['type']['frontend_value'][] = '<span class="k-icon-document-'.$icon.'"></span>'.' '.strtoupper($icon);
    
        return $this->attr;
    }
    
    public function getCategoryInfo($id, $catsList)
    {
        $query = $this->_db->getQuery(true);
        $query->select ('dc.docman_category_id as id, dc.title as name')
                ->from('#__docman_categories as dc')
                ->join('LEFT', '#__docman_documents as dd ON dd.docman_category_id = dc.docman_category_id')
                ->where('dd.docman_document_id = '. (int) $id);
        $this->_db->setQuery($query);
        $categories = $this->_db->loadObjectList();
    
        if ($categories) {
            foreach ($categories as $cat) {
                if (!in_array($cat->id, $catsList))
                    continue;
                $parentTree = $this->getParentList($cat->id);
                $nameTree = $cat->name;
                $this->attr['cat']['value'][] = $cat->id;
                $parenName = '';
                if ($parentTree) {
                    foreach ($parentTree as $key => $parent) {
                        $parenName .= $parent->name . ' &raquo; ';
                    }
                }
            }
            $this->attr['cat']['frontend_value'][] = $parenName . $nameTree;
        }
    
        return $this->attr;
    }
    
    public function getParentList($catid)
    {
        $query = $this->_db->getQuery(true);
        $query->select('dc.docman_category_id as id, dc.title as name')
                ->from('#__docman_category_relations as dcr')
                ->join('LEFT', '#__docman_categories as dc ON dc.docman_category_id = dcr.ancestor_id')
                ->where('dcr.descendant_id = ' . (int) $catid . ' AND dcr.descendant_id != dcr.ancestor_id')
                ->order('id AND dcr.level');
        $this->_db->setQuery($query);
        $parentCats = $this->_db->loadObjectList();
    
        return $parentCats;
    }
    
    public function getTagInfo($id) 
    {
        $query = $this->_db->getQuery(true);
        $query->select('dt.tag_id as id, dt.title as tag_name')
                ->from('#__docman_tags_relations as dtr')
                ->join('LEFT', '#__docman_tags as dt ON dt.tag_id = dtr.tag_id')
                ->join('LEFT', '#__docman_documents as dd ON dd.uuid = dtr.row')
                ->where('dd.docman_document_id = ' . (int) $id);
        $this->_db->setQuery($query);
        $tags = $this->_db->loadObjectList();
    
        if ($tags) {
            foreach ($tags as $tag) {
                $this->attr['tag']['value'][] = $tag->id;
                $this->attr['tag']['frontend_value'][] = $tag->tag_name;
            }
        }
    
        return $this->attr;
    }
    
    public function getCategoryLevel($catid)
    {
        $query = $this->_db->getQuery(true);
        $query->select('(count(drc.level) - 1) as level')
            ->from('#__docman_category_relations as drc')
            ->where('descendant_id = ' . (int) $catid);
        $this->_db->setQuery($query);
        $level = $this->_db->loadResult();
    
        return $level;
    }
    
    public function getDocmanTreeCategories() 
    {
        $items = array();
        $query = $this->_db->getQuery(true);
        $query->select('dc.docman_category_id as id, dc.title as title, count(dcr.descendant_id) - 1 as level')
            ->from('#__docman_categories as dc')
            ->join('INNER', '#__docman_category_relations as dcr ON dc.docman_category_id = dcr.descendant_id')
            ->GROUP('dc.docman_category_id')
            ->ORDER('dc.title');
        $this->_db->setQuery($query);
        $categories = $this->_db->loadObjectList();
    
        if (count($categories)) {
            foreach ($categories as $cat) {
                if ($cat->level == '0') {
                    $items[] = $cat;
                    $childs = $this->getChildCategories($cat->id, (int)$cat->level);
                    if ($childs) {
                        foreach ($childs as $child) {
                            foreach ($categories as $cat) {
                                if ($child == $cat->id) {
                                    $items[] = $cat;
                                }
                            }
                        }
                    }
                }
            }
        }
    
        return $items;
    }
    
    public function getChildCategories($catid, $level) {
        if ($level == 0)
            $level = 1;
        $query = $this->_db->getQuery(true);
        $query ->select('dc.docman_category_id as id, drc.level as level')
            ->from('#__docman_categories as dc')
            ->join('INNER', '#__docman_category_relations as drc ON dc.docman_category_id = drc.descendant_id')
            //->join('INNER', '#__docman_documents as dd ON dd.docman_category_id = dc.docman_category_id')
            ->where('drc.ancestor_id = '.(int) $catid . ' AND '.$this->_db->quoteName('drc.level').' = '. $level)
            //->group('dd.docman_category_id')
            ->order('dc.title ASC');
        $this->_db->setQuery($query);
        $cats = $this->_db->loadObjectList();
        $items = array();
    
        if ($cats) {
            foreach ($cats as $cat) {
                $items[] = $cat->id;
                if ($this->getChildCategories($cat->id, (int)$cat->level)) {
                    foreach ($this->getChildCategories($cat->id, (int)$cat->level) as $child) {
                        $items[] = $child;
                    }
                }
            }
        }
    
        return $items;
    }

    }

    • This reply was modified 7 years, 3 months ago by  zalchris.
    Mr.Cat Moderator
    #1060600

    @zalchris,

    I’ve attached the helper file, please check the attachment below.

    Extract, find and replace text "ALTER_TEXT_FOR_DEAULT" with your content. Don’t forget to back up.

    🙂

    • This reply was modified 7 years, 3 months ago by  Mr.Cat.

    1. helper.zip

    Wisdom is not a product of schooling but of the lifelong attempt to acquire it.

    zalchris Friend
    #1060775

    Thank you!
    I uploaded your file.
    But now indexing of Docman in the JA Megafilter Component is not working.

    Should i give you admin access to look closer at the problem?

    Mr.Cat Moderator
    #1060875

    @zalchris,

    Ok, please give me your admin access 🙂

    Wisdom is not a product of schooling but of the lifelong attempt to acquire it.

    zalchris Friend
    #1061011

    OK, how can i send you a private message with the access data?

    Mr.Cat Moderator
    #1061073

    @zalchris

    Please use private reply of forum. See attachment below if you don’t know how to use it.

    Regards


    1. 2017-09-08_075959

    Wisdom is not a product of schooling but of the lifelong attempt to acquire it.

    zalchris Friend
    #1061139
    This reply has been marked as private.
    Mr.Cat Moderator
    #1061143

    @zalchris,

    I’ve fixed on your site. Back up this block to if plugin got update 🙂

        public function getFileType($icon)
        {
            if ($this->checkPublished('attr.type.value')) {
                $this->attr['type']['value'] = array($icon);
                $this->attr['type']['frontend_value'] = array('<span class="k-icon-document-'.$icon.'"></span>'.' '.strtoupper($icon == 'default' ? 'DGW / 3DS' : $icon));
            }
    
            if ( $this->checkDisplayOnFO('attr.type.value')) {
                $this->attr['type']['frontend_value'] = array('<span class="k-icon-document-'.$icon.'"></span>'.' '.strtoupper($icon == 'default' ? 'DGW / 3DS' : $icon));
                $fieldconfig = $this->getFieldConfig('attr.type.value');
                $this->attr['type']['title'] = array($fieldconfig['title']);
                $this->attr['type']['type'] = $fieldconfig['type'];
            }
    
            return $this->attr;
        }

    And here is the result. https://www.selmer.at/service.html

    Regards

    Wisdom is not a product of schooling but of the lifelong attempt to acquire it.

Viewing 10 posts - 1 through 10 (of 10 total)

This topic contains 9 replies, has 2 voices, and was last updated by  Mr.Cat 7 years, 3 months ago.

We moved to new unified forum. Please post all new support queries in our New Forum