xoops forums

Forum Index


Board index » All Posts (brutalicuss)




brutalicuss

Not too shy to talk
Posted on: 2015/6/30 18:30
brutalicuss
brutalicuss (Show more)
Not too shy to talk
Posts: 128
Since: 2012/6/9 1
#21

Re: Rating system in publisher module

Everything working just perfect!

The only thing you must change:

in xoops_version.php
this line: _MI_PUBLISHER_ORDERBY_HITS => 'hits',
must be: _MI_PUBLISHER_ORDERBY_HITS => 'counter',

thats all

10x again Mamba, now its much better, im sure that the users will like it :))


ps: If you want you can change block name from "recent item list" to some other like "sorting item list" in exmp


brutalicuss

Not too shy to talk
Posted on: 2015/6/30 10:59
brutalicuss
brutalicuss (Show more)
Not too shy to talk
Posts: 128
Since: 2012/6/9 1
#22

Re: Rating system in publisher module

Its fantastic :)

My project is still on localhost and I testing in old (my) publisher version and the new (master) both, and working fine. But I have also changes in .html (visualization)
Of course, I will test the new one also. First on localhost and than on web, and and will post here soon :)

10x Mamba :)


brutalicuss

Not too shy to talk
Posted on: 2015/6/28 9:40
brutalicuss
brutalicuss (Show more)
Not too shy to talk
Posts: 128
Since: 2012/6/9 1
#23

Re: Images width

tray in .css
img {max-width: 100%;height: auto;width: auto \9;}
if not, set for your content
.item img {max-width: 500px;height: auto;width: auto \9;}


brutalicuss

Not too shy to talk
Posted on: 2015/6/26 15:50
brutalicuss
brutalicuss (Show more)
Not too shy to talk
Posts: 128
Since: 2012/6/9 1
#24

Re: Rating system in publisher module

ops :)

for
xoops_version.php

replace
$modversion['config'][] = array(
    
'name'        => 'format_order_by',
    
'title'       => '_MI_PUBLISHER_ORDERBY',
    
'description' => '_MI_PUBLISHER_ORDERBYDSC',
    
'formtype'    => 'select',
    
'valuetype'   => 'text',
    
'options'     => array(
        
_MI_PUBLISHER_ORDERBY_TITLE  => 'title',
        
_MI_PUBLISHER_ORDERBY_DATE   => 'date',
        
_MI_PUBLISHER_ORDERBY_WEIGHT => 'weight'),
    
'default'     => 'date',
    
'category'    => 'format'
);


with
$modversion['config'][] = array(
    
'name'        => 'format_order_by',
    
'title'       => '_MI_PUBLISHER_ORDERBY',
    
'description' => '_MI_PUBLISHER_ORDERBYDSC',
    
'formtype'    => 'select',
    
'valuetype'   => 'text',
    
'options'     => array(
        
_MI_PUBLISHER_ORDERBY_TITLE  => 'title',
        
_MI_PUBLISHER_ORDERBY_DATE   => 'date',
        
_MI_PUBLISHER_ORDERBY_RATING => 'rating',
        
_MI_PUBLISHER_ORDERBY_VOTES  => 'votes',
        
_MI_PUBLISHER_ORDERBY_COMMENTS  => 'comments',
        
_MI_PUBLISHER_ORDERBY_WEIGHT => 'weight'),
    
'default'     => 'date',
    
'category'    => 'format'
);



for older ver of publisher
include/functions.php

this:
function publisherGetOrderBy($sort)
must be:
function publisher_GetOrderBy($sort)


brutalicuss

Not too shy to talk
Posted on: 2015/6/26 9:46
brutalicuss
brutalicuss (Show more)
Not too shy to talk
Posts: 128
Since: 2012/6/9 1
#25

Re: Rating system in publisher module

lol I did it

But this is not professional work and I think shouldnt use in official ver.
This is only for who wants to have all sorting option like me.

language/english/modinfo.php
add bellow:
define("_MI_PUBLISHER_ORDERBY_RATING","Rating DESC");
define("_MI_PUBLISHER_ORDERBY_VOTES","Votes DESC");
define("_MI_PUBLISHER_ORDERBY_COMMENTS","COMMENTS DESC");


xoops_version.php

replace:
$modversion['config'][$i]['options'] = array(_MI_PUBLISHER_PUBLISHED => _PUBLISHER_STATUS_PUBLISHED,
                                             
_MI_PUBLISHER_OFFLINE => _PUBLISHER_STATUS_OFFLINE,
                                             
_MI_PUBLISHER_SUBMITTED => _PUBLISHER_STATUS_SUBMITTED,
                                             
_MI_PUBLISHER_REJECTED => _PUBLISHER_STATUS_REJECTED);


with:
$modversion['config'][] = array(
    
'name'        => 'format_order_by',
    
'title'       => '_MI_PUBLISHER_ORDERBY',
    
'description' => '_MI_PUBLISHER_ORDERBYDSC',
    
'formtype'    => 'select',
    
'valuetype'   => 'text',
    
'options'     => array(
        
_MI_PUBLISHER_ORDERBY_TITLE  => 'title',
        
_MI_PUBLISHER_ORDERBY_DATE   => 'date',
        
_MI_PUBLISHER_ORDERBY_RATING => 'rating',
        
_MI_PUBLISHER_ORDERBY_VOTES  => 'votes',
        
_MI_PUBLISHER_ORDERBY_COMMENTS  => 'comments',
        
_MI_PUBLISHER_ORDERBY_WEIGHT => 'weight'),
    
'default'     => 'date',
    
'category'    => 'format'
);



item.php

replace:
switch ($publisher->getConfig('format_order_by')) {
    case 
'title' :
        
$sort 'title';
        
$order 'ASC';
        break;

    case 
'date' :
        
$sort 'datesub';
        
$order 'DESC';
        break;

    default :
        
$sort 'weight';
        
$order 'ASC';
        break;
}


with:
switch ($publisher->getConfig('format_order_by')) {
    case 
'title':
        
$sort  'title';
        
$order 'ASC';
        break;

    case 
'date':
        
$sort  'datesub';
        
$order 'DESC';
        break;

    case 
'rating' :
        
$sort 'rating';
        
$order 'DESC';
        break;
        
    case 
'votes' :
        
$sort 'votes';
        
$order 'DESC';
        break;
        
    case 
'comments' :
        
$sort 'comments';
        
$order 'DESC';
        break;

    default :
        
$sort  'weight';
        
$order 'ASC';
        break;
}




index.php

replace:
switch ($publisher->getConfig('format_order_by')) {
        case 
'title' :
            
$sort 'title';
            
$order 'ASC';
            break;

        case 
'date' :
            
$sort 'datesub';
            
$order 'DESC';
            break;

        default :
            
$sort 'weight';
            
$order 'ASC';
            break;
    }


with:
switch ($publisher->getConfig('format_order_by')) {
        case 
'title':
            
$sort  'title';
            
$order 'ASC';
            break;

        case 
'date':
            
$sort  'datesub';
            
$order 'DESC';
            break;

        case 
'rating' :
            
$sort 'rating';
            
$order 'DESC';
            break;
            
        case 
'votes' :
            
$sort 'votes';
            
$order 'DESC';
            break;
            
        case 
'comments' :
            
$sort 'comments';
            
$order 'DESC';
            break;
        default:
            
$sort  'weight';
            
$order 'ASC';
            break;
    }



category.php

replace:
switch ($publisher->getConfig('format_order_by')) {
    case 
'title' :
        
$sort 'title';
        
$order 'ASC';
        break;

    case 
'date' :
        
$sort 'datesub';
        
$order 'DESC';
        break;

    default :
        
$sort 'weight';
        
$order 'ASC';
        break;
}


with:
switch ($publisher->getConfig('format_order_by')) {
    case 
'title' :
        
$sort  'title';
        
$order 'ASC';
        break;

    case 
'date' :
        
$sort  'datesub';
        
$order 'DESC';
        break;

    case 
'rating' :
        
$sort 'rating';
        
$order 'DESC';
        break;

    case 
'votes' :
        
$sort 'votes';
        
$order 'DESC';
        break;
            case 
'comments' :
        
$sort 'comments';
        
$order 'DESC';
        break;

    default:
        
$sort  'weight';
        
$order 'ASC';
        break;
}



BLOCKS
blocks/item_new.php

replace:
$item['title'] = $itemsObj[$i]->title();

            if (
$sort == "datesub") {
                
$item['new'] = $itemsObj[$i]->datesub();
            } elseif (
$sort == "counter") {
                
$item['new'] = $itemsObj[$i]->counter();
            } elseif (
$sort == "weight") {
                
$item['new'] = $itemsObj[$i]->weight();
            }

            
$block['newitems'][] = $item;



with:
$item['title'] = $itemsObj[$i]->title();

            if (
$sort == "datesub") {
                
$item['new'] = $itemsObj[$i]->datesub();
            } elseif (
$sort == "counter") {
                
$item['new'] = $itemsObj[$i]->counter();
            } elseif (
$sort == "weight") {
                
$item['new'] = $itemsObj[$i]->weight();
                } elseif (
$sort == "rating") {
                
$item['new'] = $itemsObj[$i]->rating();
                } elseif (
$sort == "votes") {
                
$item['new'] = $itemsObj[$i]->votes();
                }
                elseif (
$sort == "comments") {
                
$item['new'] = $itemsObj[$i]->comments();
                }
            
            
$block['newitems'][] = $item;



replace:
$orderEle->addOptionArray(array(
                                  
'datesub' => _MB_PUBLISHER_DATE,
                                  
'counter' => _MB_PUBLISHER_HITS,
                                  
'weight'  => _MB_PUBLISHER_WEIGHT,
                              ));


with:
$orderEle->addOptionArray(array(
                                  
'datesub' => _MB_PUBLISHER_DATE,
                                  
'counter' => _MB_PUBLISHER_HITS,
                                  
'weight'  => _MB_PUBLISHER_WEIGHT,
                                  
'rating'  => _MI_PUBLISHER_ORDERBY_RATING,
                                  
'votes'   => _MI_PUBLISHER_ORDERBY_VOTES,
                                  
'comments'   => _MI_PUBLISHER_ORDERBY_COMMENTS,
                              ));


include/functions.php

replace:
function publisherGetOrderBy($sort)
{
    if (
$sort == "datesub") {
        return 
"DESC";
    } elseif (
$sort == "counter") {
        return 
"DESC";
    } elseif (
$sort == "weight") {
        return 
"ASC";
    }

    return 
null;
}


with:
function publisherGetOrderBy($sort)
{
    if (
$sort == "datesub") {
        return 
"DESC";
    } elseif (
$sort == "counter") {
        return 
"DESC";
    } elseif (
$sort == "weight") {
        return 
"ASC";
    }
    elseif (
$sort == "votes") {
        return 
"DESC";
    }
    elseif (
$sort == "rating") {
        return 
"DESC";
    }
        elseif (
$sort == "comments") {
        return 
"DESC";
    }

    return 
null;
}



Thas all!
Working well for both: starting page and block "recent items list"
If you want to have more than one option in this block, just clone it
If you want to have these sortings on whole or many pages, just use cloned block in dummy module

10x Mamba, It would not happen without you


brutalicuss

Not too shy to talk
Posted on: 2015/6/25 18:42
brutalicuss
brutalicuss (Show more)
Not too shy to talk
Posts: 128
Since: 2012/6/9 1
#26

Re: Rating system in publisher module

Quote:

If the users want to vote for it, then they rate it, and based on the rating, the highest rated articles will come up first.


Thats I mean Mamba, users will define which article is important, and if we havent rating sort system this will be impossible, isnt it
But we must have other sorting option also, like time, hits and etc. I think it is normal for any publisher site. Just option: "show most rated", "show most visited" "votes", "comments"..etc These are just features. Good features!

As for "ASC" to "DESC" sorting I tried everything :) Something buggy, and I really cant, because im not programmer

In this context, I tried to set your fix to sort by ASC not DESC and nothing happens - order still was by DESC. You shouldnt upload this before closely testing I think


brutalicuss

Not too shy to talk
Posted on: 2015/6/25 15:17
brutalicuss
brutalicuss (Show more)
Not too shy to talk
Posts: 128
Since: 2012/6/9 1
#27

Re: Rating system in publisher module

Yes, you are right in principle - if we using publisher module for news, but if we makes article directory (in example) I think it is necessary, because you know some articles are important for the users months even years. In that case we really need of all sorting option.

Your example with extgallery and wt-download is very good, the same we have in weblinks also. Weblinks has all possible sorting option, not only in blocks (my favorite module ever)

Im already done new sorting in publisher blocks (its easy) based of your examples, BUT the sorting is not correct :) from 0 to 5, not 5 to 0. But im not programmer, just testing :)


brutalicuss

Not too shy to talk
Posted on: 2015/6/24 13:26
brutalicuss
brutalicuss (Show more)
Not too shy to talk
Posts: 128
Since: 2012/6/9 1
#28

Re: Rating system in publisher module

Yes, you are just great Mamba :))

I was adding the new lines in my files. Thats the fault !
Now, in new installation its working. And we can choose sort type of the list.

But I have still trouble (maybe personal) because I want to have more than one option for sorting, at the same time. There must be all sorting option. Now im trying to editing blocks php files to achieve this wishes :) Because after that I can clone the block and will have all sorting option :)

But if you plan to upload new publisher version and if you want this module to be just perfect, you should thinking about this option in "recent block" or some similar. Will be great to sort by all features - date/hits/rating/weight, even comments count.



brutalicuss

Not too shy to talk
Posted on: 2015/6/24 10:11
brutalicuss
brutalicuss (Show more)
Not too shy to talk
Posts: 128
Since: 2012/6/9 1
#29

Re: Rating system in publisher module

Hi Mamba! Thank you very much! Im really glad that you want to improve publisher module.

But I have still trouble with the sorting

I mean that I need to sort items by many orders like time/votes/hits/comments in recent/latest list or some other way like publisher blocks - "recent publisher items" or any other possible way

I tried with the new correction in index.php/category.php to sort items by rating/votes but its seems to not working. Still sorting only by the time.

For hits and weight we have option in one publisher block, but for new features rating and votes (guess that is comments) we havent because these new functions are not included

Maybe I dont know how to use your editing or doing something wrong, and I will be thankful if you have time to explain me


brutalicuss

Not too shy to talk
Posted on: 2015/6/22 9:37
brutalicuss
brutalicuss (Show more)
Not too shy to talk
Posts: 128
Since: 2012/6/9 1
#30

Rating system in publisher module

Hi again

Is it possible to sort items by rating?
We have option to sort by hits and time, but not by rating
There is beautiful rating system in single item, but we cant use it for items sorting

Is it possible, or this module has such option, but im blind again



TopTop
« 1 2 (3) 4 5 6 ... 10 »