jreklund / php4dvd

php4dvd is an open source php/mysql powered movie database. Catalog your video collection with ease. Automatic update of information and images.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

New Select

GoldMnaPro2014 opened this issue · comments

How to add a menu similar to the category, but only with the year?

You will need to modify multiple files:
includes/movie.search.inc.php

  • Get all distinct years and assign it just like getCategories()
  • Get it using $_GET like line 109
  • Validate it like like line 127
  • Add a new variable to all $moviedm->search

lib/db/Movies.class.php

  • Create a getYears()
  • Modify search()

includes/export.inc.php

  • Add a new variable to $moviedm->search

includes/movie.autoupdate.inc.php

  • Add a new variable to $moviedm->search

tpl/default/movies/collection/sidebar.html

  • Replicate Categories

tpl/default/javascripts/src/php4dvd.collection.js
tpl/default/javascripts/src/php4dvd.js

  • Replicate Categories
  • Compress your new code and add it into tpl/default/javascripts/php4dvd.collection.min.js

PS. You can just search for 2017 and it will find all movies from that year. Or that got 2017 in the description.

I did all this before you sent it to me, but that's the problem, it displays the list and when I select the year, it does not look for it and even the URL does not seem to me.

I'm afraid you did something wrong then. Without code, I cannot help you.

Here are all the files that I edited: https://yadi.sk/d/Ghu2LbPyWhJ9XA

I don't really know where to start. You literally tared the code apart. I can't even test it...

includes/movie.search.inc.php

  • OK: Get all distinct years and assign it just like getCategories()
  • Not done Get it using $_GET like line 109
  • Not done Validate it like like line 127
  • Not done Add a new variable to all $moviedm->search

lib/db/Movies.class.php

  • N/A Create a getYears()
    • Haven't tested it, but there are no new lines. You can use use SELECT DISTINCT instead
  • Maybe Modify search()
    • You have added $year, but are passing in as $format from other files.
    • You don't need '%'.$year.'%'. It can be just $year. It will always just be 2017.

includes/export.inc.php

  • N/A Add a new variable to $moviedm->search

includes/movie.autoupdate.inc.php

  • N/A Add a new variable to $moviedm->search

tpl/default/movies/collection/sidebar.html

  • WHAT? Replicate Categories
    • You changed it out completely. It's not even using the js files anymore. It will just open that url (if it even does that). And later call on search() but as you didn't modify it. It won't send anything to the server.
    • It will be the same as searching for 2017.
      • Same goes for everything else you added.

tpl/default/javascripts/src/php4dvd.collection.js
tpl/default/javascripts/src/php4dvd.js

  • WHAT? Replicate Categories
    • Search() are no longer being used. That's how it pushes to the server what you have selected.
  • Compress your new code and add it into tpl/default/javascripts/php4dvd.collection.min.js
    description.

Can you show it how everything should be?

You can have a look on how I added "media types"/format. It will be similar.

876f398
0c70247