MySQL Organisation Strategy for Multi-user with 100% customization - php

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

Related

How To Break Up Company Website Into Groups To Manage Their Content

I've been looking around and not finding any good answers. I work at a small company. They have a quick information website for internal users. It needs updating but here is the situation. I want each group to be able to manage their own page/s contents. For instance HR to manage their documents, another group to manage the phone directory,etc. I don't want them all to have to be trained or take training on any extensive software. It doesn't even have to have a lot of features probably. I've been looking at possibly Joomla as our group already knows PHP, Apache, etc. But haven't really got a good feel if I can break the content up and assign certain areas to certain groups inside of it so they only have access to change their own content only.
Right now all of it's on one page and grew out of hand before I got here to 2 page list of items without a collapsible menu. I do like that some areas all they have to do is drop files on a file share to update their items. I may keep part of that, just break it up into separate pages instead of showing each in one single frame in the middle as you click on the menu item. Since most of it is documents it's not all that bad.
Anyway looking for someone that's already been down this road and has a feeling for what I'm trying to do and how to go about it.
BTW prefer something open source if adding on any product to what we have.
Joomla since version 1.6 has fine grained access control that you can customise your self. Normally what I would do is create a user group for each of your groups. THen create a category tree for that group to make and manage their articles. Then for each of these categories give members of the group permission to create, edit, delete or whatever you want them to have.
THere is a lot of documentation out there on how to do this. (Some by me :)) Just search for Joomla ACL or Joomla Access Control.
If you have using joomla, you have the choice to edit your mysql database, there are two tables you need to edit, one is users, the other is usergroup_map. Each group should have a group ID and its own permission. After you create a page, just assign the permission to the page. If you have more than 6 groups, you might also need to edit usergroup table to add more group ID

How to let registered uses edit / maintain own lists in Joomla 2.5

I am trying to do something like this in Joomla 2.5:
http://jsfiddle.net/Lt2EJ/
This is a NON FUNCTIONAL mockup of course, but in a nutshell, each registered user
needs to be able to maintain a list of items that they have in their collection.
For each item added, the user would select the pattern of the item then write a short
description of the item and then click the Add (+) button.
Their list would then update with the latest item(s) they've added.
They should also be able to delete / edit items in their list.
The real kicker is that each user should ONLY be able to see and edit their own items.
What is the easiest way to accomplish this?
Many thanks!
Cynthia
you could link it with mysql database connected with database userids for each user to add/pull content (may have to put this in a module/ for joomla) , this link might offer some tips: http://www.alfystudio.com/tutorials/56-creating-and-configuring-basic-joomla-module.html

What database tables do I have to edit to get a product to show up in a Ubercart store?

I am trying to create a ubercart module which automatically updates product listings. I thought that I just needed to edit these tables
uc_products
uc_product_classes
uc_product_features
The problem is no matter what I put in these tables, no products are listed in the Ubercart store.
What other tables do I need to update to do this? Or what steps do I need to take to get this module to add and/or update the products viewed in the web page? I would love it if someone could show me how to do it without resorting to SQL.
In Drupal 6, products are referenced to nodes. You might look at the feeds or node import module for automated product listing updates/creation.
It seems there are a lot more tables to alter before it will show in the Ubercart store. However I don't think you need uc_product_features.
These tables are
node
node_type
node_revisions
uc_products
uc_product_classes
They must belong to a class defined in uc_product_classes and node_type.
node_revisions is what is displayed in the store front and node.staus must be set to 1. It is the publish variable.
Also
node.nid must equal mode_revision.nid
and
node_revsion.vid must equal mode.vid
otherwise in the store front listing for that item will be
"n/a"
And while it didn't tell me all I needed, I found the following site to be informative.
http://tiger-fish.com/blog/drupal-6-turning-existing-node-type-ubercart-product

Regionalizing content display to users with matching region in profile

The requirement is to display all public content and all content that has been restricted to the viewer's region.
Currently this is being accomplished by producing two views in blocks on a standard page. One view is set up to display all news articles that do not have a "N" in a "restrict to region" field. Another view is set up to display all news articles that have a "Y" in a "restrict to region" field AND uses php code in a contextual filter to add the condition that the "region" field in the news article matches the "region" field in the user profile. Stacking these views in the content field of a standard page results in a page that returns all news articles that are not restricted AND all news articles that are restricted to the user's region.
Undesirable complications of this strategy include separate pagination and the necessity of creating multiple views to extend the functionality to additional content types or to expand to cities or states.
Can you think of a way to apply the complex filter on a single view so as to avoid the need for presenting a separate unrestricted view followed by a view restricted to records who's region matches the viewer's region?
Or to apply the filter as a permission on fields?
Thanks n advance,
It's quite simple you're using the wrong tool for the job.
PHP is not your tool of choice for this, you should be using the SQL directly.
$q="SELECT *
FROM
articles
WHERE
limited_to_region=0
UNION
SELECT
a.*
FROM
articles a
INNER JOIN
regions r
ON
a.rid=r.id
AND
r.id='".$_SESSION["user"]["region"]."';";
(I don't know your datamodel, you could/should have a relation item in between etc. but this best practice is far from the norm so ...)
This way your filtering and all that is transparent to your front end anyway, faster, limitless AND does not waste time/bandwidth transferring unneeded information.
add another column at your table [articles, news] in database for tags (text-type)[few tags can be set, split them by comma], then create another table that contains tags, give id of those tags to your articles/news. you can filter this content by finding users location by IP-Address, or setting an cookie if you know somehow where user is coming from.
Hope you're using Location for profiles and articles.
It sounds like to do want to mix these two result sets into one item list.
Back in the day it would be Views Union
Believe Ovideiu is correct about Views OR being the most modern solution to this. Its says dev, but folks use it in production.
If you don't have to combine the two set you could use Views Exclude Previous to take care of your duplicate items.
Unfortunately, when I've done this in the past we've had to create our own custom (yet cached) output solutions because we could control the query. But you can still use drupal queries and node_loads to make use of templates, etc.

Magento - Multi-domain & Filters

We're looking to build in a filter to our Magento site with drop down choices for the first two options, a selection box for price plus a colour chooser.
Firstly how easy is it to fetch the info for the first two dropdowns from the database so the first box is populated with the first category then the second box populated with the choices for that particular category? (and then change if someone changes the first selection)
Secondly how easy is it to set up a separate filter for each site so it only fetches info for the corresponding store and doesn't show products from other stores?
The filter will only have to show the products when you press a 'find' button so I guess it's a case of building up the search query?
Thoughts and ideas on this would be great, only been working with Magento for a month so still not sure of it's full capabilities.
Thanks
For the second part Magento already shows only products relevant to a given store. When you set up the stores (in System > Store Management) you have the option of giving it a unique "root category". Creating root categories is easy, in Catalog > Manage Categories.
The first part requires some programming work. From your previous questions it looks like you have a good understanding of Javascript so AJAX is not a problem. I don't know how familiar you might be with PHP, listing products will require you create a new module, with it's own controller, that forms a collection from the selected category. Collections make their own queries so you don't need to write a lick of SQL, and they have functions for exporting as JSON or XML so you don't need to write that either. For an experienced programmer it would take almost no time at all.

Categories