I'm building a "project" for school in php and
i'm here because i'm having some issues. I'll explain:
I have 4 lists of items , each one is associated with a class (that the user chose in a configuration page) which are saved in a database. Inside each list are listed the students belonging to each class.
Using the sortable jquery method i was able to make it so that i can drag a student from a class to another, that i was able to do and is working as intended.
I was satisfied with what i had so far (since this is the first time i've done something similar). However, my teacher asked me to put below those 4 lists the rest of the classes in divs or something so i could move a student from each of the 4 "important" classes listed above to one of those "lets call it other classes" making the student change class (change a field in the table students via ajax or smthing) and make it disappear from the page.
I dont know if i made myself clear because my english is not that good but i'll try to make an example.
Let's say i had 7 classes in my database. (A, B, C, D, E, F, G) and i had defined that the "main" ones are A, B, C and D. Those main classes would be in the lists at the top and the other 3 would be below the lists (the difference is that they wouldnt be lists, so they wouldnt show the associated students and if a dragged a student from any of the main lists there). Now there's the important part Lets say i drag a student from List 1 (class A) to the div below that corresponds to class E, it would change the students class to E and it would remove it from the page, or hide it, since it doesnt belong to any of the big classes anymore. This is what i cant figure out how to do
Image to help understand: http://tinypic.com/view.php?pic=mtb96s&s=8#.VYP00PlVhBc
Image link2: http://prntscr.com/7irm41
Does anyone have suggestions of how i could achieve this? I can post some code so let me know if i need to
In the query, you can use ORDER BY for the ordnung of the elements.
Figured it out!
Used the draggable!
https://jqueryui.com/draggable/
Related
I'm new to PHP.
I have a list of products in my database and I call them using:
$mysql = new MySqlManager();
$product = $mysql->getAllProducts();
Now I have two three dropdownlists: category, type, model ; of course each product belongs to one of these three categories.
What I want is that when the user selects the category (i.e. fridge, vaccum cleaner, portable devices, etc.), then a second dropdownlist appears (with or without refreshing the page, I don't care) and the user can choose between the type of product based on the category (i.e. if category was fridge, then in type you would find freezer, big fridges, small fridges, etc.). Then a third dropdownlist appears and the user can choose between the different models of types of products he chose before. I hope this explanation is clear, sorry if it is not.
Please help :)
actually no one helped me: I founded that it is possible to do it directly in PHP, with a POST method redirecting to other page and then coming back to the inital and displaying another dd list (simple if with session)
I'm working on an Yii application and I have a particular action that renders a page which is separated in 3 different sections. Let's say that the first section displays items from the database from Class A, the second displays items from Class B and the third from Class C. Each class section is in different div and each section could contain a lot of items.
My goal though is to display only 8 or 10 items per section from the respective class and then provide paginator links to navigate to the rest of the section's items. I have all the items in three different arrays and I can display them with no problems, however, without the pages functionality. In a nut shell, I need to somehow make 3 different paginators work on the same page and I have no idea how reading the yii pagination guides so any tips are more than welcome. Thank you!
I think that you had forget the pageVar in your CPagination.
My question today is how should I organize my MySQL Table to get a 100% customized menu for my different users...
Let me explain: I will have a large menu tree (like windows) that will display Categories & Items for the user. I want the user to be able to delete, add or Modify anything like: Category name, Delete category, Add item, Change item name and Delete Item.
BUT: I want to offer my different clients a starting "Base" menu with common Items and Categories when they register, but when a user modifies the category (ex: change name or delete it), I don't want his changes to interfere with the other user's Menu..
So, how should I organize my DB to handle this: at this moment, I have 2 Tables: T_categories(with parent info to structure for the tree menu) & T_items (with category_id) but I realize that I don't really know how I will be handling my queries to enable "delete or rename" for Categories and Items... Should I make unlimited tables like this??
T_user1_categories & T_user1_items
T_user2_categories & T_user2_items
and so on, but if I have 1000 users it'll not be cool =/
At this time I can only(i think) create customized items with ex: privateview_id (user id)
Also, if I build something that, when I rename a category, it create a new category with a privateview_ID, all the items that were already in it will lose their position
I'm using PHP and MySQL
If you have an idea, i will be happy to hear it!!
Thank-you!
Raphael
A menu bar is a hierarchical thing. I suggest you "build" that things using a hierarchical meta data like XML.
You can store your users, categories and items in respective tables and also create a menus table to store the menus users created.
You ill still be able to do relations between users, menus, categories and items creating relational tables.
Also a user can just move a item from a category for another, not changing your usersXcategories or usersXitems relations but just changing the XML.
I cannot say more without knowing more details but your requirements.
Well, finally i've come to conclusion that the best way will be to create a table for every users... I've read that some people have MySql databases with over 1000+ tables without any problem and going the other way would be a lot of trouble. Also, I don't plan on having 1000+ users because that custom menu is part of a "paying" option. Thank-you for your answer jean
A noob here (2-month old, literally, Drupal-PHP user)
What I am trying to accomplish:
1.1. A map that shows multiple locations as the user chooses them.
Therefore, the map can show 0-100+ of locations depending on the choice/selections that user makes
These locations will be under 1 (one) content_type (ie: business) each with unique NID
On the other word, the business location markers should be toggle on and off, individually (keeping the previous locations choices)
1.2. On the same map, the user can then choose one (or multiple) bus routes. When user chooses different bus route, the location markers (from #1.1 above) will stay on the map
Bus routes will be under another content_type with their own NID
What I had done so far:
2.1. Using OpenLayers module to create the map
2.2. Using Views module to display the map, setting up contextual filter so it can show multiple markers (reqd #1.1)
2.3. Using Views module to display the list of business locations, rewriting the outputs to it point to the URL of the view from #2.2 above
What I still CAN NOT do:
3.1. Creating a view where the list of the business locations are in the form of checkboxes, so the user can choose which locations to show (ideally it should be AJAX-y so the user does not need to press the submit button, but the map marker will toggle on-off as user checks and unchecks the location)
3.2. After #3.1 above is accomplished, do the same thing with the bus route
What I had tried so far:
4.1. Installing couple of View-helper modules, like BEF, VBO, and such
4.2. Try to create a theme the view jumpdown style plugin --> utterly fail as I do not know enough Drupal nor PHP
Can not get this to work: http://www.civicactions.com/blog/2011/apr/15/filtering_a_view_by_a_list_...
Please help:
5.1. to educate me how to create a custom Views Style Plugin (creating checkboxes)
5.2. how to pass the values (NIDs) of the checkboxes to the URL (contextual filter) dynamically
Will it be helpful if I give you the URL of the page I am trying to develop?
I am also open to use different Mapping module if that one has the feature I need
Thank you in advance,
PS: have posted this on the Drupal forum, got no answer so far
Hopefully, this link will help me convey what I am trying to do:
http://link2.cswebdevelopers.com/map-of-lm_locations
On the page above, I can choose ONE location at the time and the map will show a yellow marker. I am using Views 3 and OpenLayer modules
What I would like to do is to have the dropdown or the unordered list on the left sidebar become CHECKBOXES so the user can check and uncheck 1 or more locations and the map will show 1 or multiple markers as appropriate.
Thank you
This is a very newbie question so bear with me. I'm starting to use Yii as my first PHP framework and so far so good, the project on wich I'm learning is a simple informative webpage, but how am I supposed to handle the subpage concept under Yii? This is what I'm trying to achieve:
Home
Products
Product 1
Product 2
Contact
I have a controller for Home, Products and Contact, now I know that Yii doesn't work with subcontrollers, then how do I create a Product 1 and 2 subpages? Just a different view for each one? Through Gii? Many thanks.
You could do one of two things
You could have a generic product page that accepts a parameter to distinguish between different products (common approach). For example,
www.mysite.com/products?id=1 would show Product1's page whereas www.mysite.com/products?id=2 would show Product2's page (and if there is no id parameter in the query string, then you could just show your Product page)
And you could also have separate methods for each page. So you would have
actionProduct
actionProduct1
actionProduct2
methods in your Product controller and then you could reach your pages as
www.mysite.com/product
www.mysite.com/product1
www.mysite.com/product2