I'm trying to use Elgg as a starting point for a certain type of social media website. One of the main things I'd like to do is allow users to create events and then display all the events in a sortable table (sortable by different attributes given to the event during the creation like date and title). For the event creation aspect, I'm using the plugin Event Manager.
I'm assuming the best way to do this is to pull the event data from where ever it is stored and put it into an HTML table (I'm using the jQuery TableSorter code). Can anyone give me a good idea of where and how to start doing this?
The biggest problem I'm having is finding where the event data is stored in MySQL.
For the database organisation and model, read:
http://docs.elgg.org/wiki/Engine/DataModel
http://docs.elgg.org/wiki/DatabaseSchema
For fetching the data, consider using:
http://reference.elgg.org/1.8/engine_2lib_2metadata_8php.html#aec4b6f0b9565e3554acb9b39ef34a2ac
With options order_by and order_by_metadata for chosen information.
Related
I'm building a CRM and I have a list of customers.
When I create a customer, I usually insert it as a draft as soon as the user clicks on "Insert button". Why? Because I want the user to be able to insert photos and documents on the insertion form. This way, I have the customer ID already and I can process the upload using that ID.
The problem here is that we can have multiple drafts at a certain moment.
My question is: is there any better method to do this? Without creating the draft? For instance, using a temp folder where the photos and documents are temporarily saved?
EDIT:
the issue woth having multiple drafts is that at certain point will may have a lot of trash.
I mean, this works for me ok? And it's a solution I have, I just wanted to know if there's a better solution instead of using drafts.
It depends on what exactly you are using to save the customer in the database.
If you are using an ORM such as Eloquent or Doctrine you just need to have the correct relationships between Entities and you won't need to save the Customer as draft, you can just flush all of the information at once.
If you aren't using an ORM, you can still do it in one request, just insert the Customer record first and get the last inserted ID , for example if using PDO, you can use PDO::lastInsertId https://www.php.net/manual/en/pdo.lastinsertid.php .
After you have the ID just set it to the other columns where you need it.
I have a PHP Bootstrap web page. At load time, I generate all JSON events properties using PHP doing a MySQL query and then the fullcalendar is displayed after.
This fullcalendar contains different kinds of calendar events (each calendar event being a table with different columns) and when eventclick() is raised, I display a modal bootstrap form showing the event details. The event modal is different based on an event property type. Doing this allows me to edit via
a form each calendar event, update the DB and refresh the fullcalendar after.
I tried initially to load all different events details (and therefore all table columns) into the fullcalendar but now, of course, there is a performance impact (on page load).
Is there a way to load a minimal set of calendar event properties (date and event title), show the fullcalendar and based on eventclick() retrieve additional database details before displaying the modal and allow the end user to edit the form? (the form processing after is, of course, usual PHP/MySQL code).
Thanks a lot
I have planned to create tables for dynamic datafields. My concept is to store a dynamic form data inside tables(MySQL). The user can select any number of fields(datatypes) from form.The form is a dynamic form one seen in here . How can we design dB in order to save user's data dynamically?
Can you not just allow for fields within the database to be null. That way when you save the form if any fields have not been filled it doesn't throw an error
Seems, you need to implement EAV data model wiki link Also, there are some ready solutions
some project on github
EAV behaviour on bakery, also one of project from github
expandable behaviour
I'm trying to create a Survey builder wizard that would be embedded in the website.
Users will be able to create their own surveys by dragging and dropping appropriate form elements such as checkboxes, radiobuttons etc
Once the user creates his survey br dragging and dropping the appropriate form elements such as radiocontrol, checkboxes - He should be able to save the created survey and publish it.
While going about doing this I came up with the following questions:
I could build my own drag and drop form building wizard - but is there any open source plugin/code out there so that i dont need to reinvent the wheel ?
How the should the form structure be saved ?
Should the form elements with the associated text be saved in a database (mysql) and rebuilt on the fly when someone accesses the survey link on the mobile ?
Should I be looking at XML/JSON to store the html form structure
Would appreciate any help !
Here is one that we're using now to put a form builder on our client's website.
http://www.botsko.net/blog/2009/04/07/jquery-form-builder-plugin/
The form can be serialized to both JSON and XML.
You can use jQuery UI for the drag and drop operations. I would make use the grid functionality provided.
To save the form I'd make standardized representations of the elements in a JSON format and save those.
This representation should include the left and top css attributes (for positioning) and a subset of styles and attributes which your users can assign their input fields.
Just for completeness
At the time I posted the question, this was not available or else I would have opted for this to build the front end :
http://getfuelux.com/formbuilder.html
i got a form (using form api and drupal_Get form ) and i got a form with 50 fields and some of them are non frequently chaning data like hobbies, year of birth , city/country etc...
i currently do just them in array in file and put them in #options=>$array ... is that the fastest way to save resources? or should i use taxonomy/variable_set/database query/block/node or whatever?
variable_get/variable_Set : Is generally used to store admin preferences for the site. If these are user specific I don't think it's a good idea to save them using variable_set
taxonomy : Can also be used for populating the values of
drop-downs, that is for options in the listing. In your case create a vocabulary
called hobbies and add
swimming,reading,drupaling as terms.
Then use the content-taxonomy
to use taxonomy terms as drop downs using CCK moudule.
nodes : Anything that is user
specific should go in as nodes. And
any content that can be created by
the users should also go in as nodes.
For administering forms you can use variable_set/variable_get.
But for your task it seems like that users enter their bio, so in this case you should store each form submission to new "row", as you do now for file (wonder why you don't use DB storing).