dcblogdev / dcblogcomments

2 stars 0 forks source link

jquery-fullcalender-with-php-and-mysql #6

Open utterances-bot opened 4 years ago

utterances-bot commented 4 years ago

jQuery Fullcalender with PHP and MySQL - DC Blog | Development Tutorials

I'm a big fan of fullcalendar.io the latest version is quite a bit different from earlie...

https://dcblog.dev/jquery-fullcalender-with-php-and-mysql

pipiscrew commented 4 years ago

ref - https://github.com/pipiscrew/fullcalendar-php-example

dcblogdev commented 4 years ago

?

pipiscrew commented 4 years ago

same components on older version, I post as reply to your blog, didnt know that will come here.. please proceed w/ close..

dcblogdev commented 4 years ago

you're is using an older version so I don't understand why just post a link and nothing else?

yours is using version v3 mine is version v4.4 the underlining API is different what used to work no longer works with the new version. That was why I wrote this tutorial.

917364825 commented 4 years ago

Dear dcblogdev, I would like to ask a question about 'How can i use pgsql instead of Mysql in your demo tutorial?'

Thanks for teaching me, and i look forward to hearing from you.

iz1kbp commented 3 years ago

Sorry for my poor English and...ignorance! I do not know wath is PDO Wrapper...I have search into many blog but I do not understand the way to install the package.I've copyed all files to my server, configure the sql access, but have the error unable locate vendor/autoload.php. Pls can you give me the complete folder or show me the way to install?thank's in adavance. Mario

dcblogdev commented 3 years ago

no worries the PDO wrapper is a package that is installed by composer so to install you open the project in terminal/command line and then type composer install this will then generate the vendor folder and the autoloader.

dcblogdev commented 3 years ago

Dear dcblogdev, I would like to ask a question about 'How can i use pgsql instead of Mysql in your demo tutorial?'

Thanks for teaching me, and i look forward to hearing from you.

Have you tried settings passing pssql to the connection ie:

use Dcblogdev\PdoWrapper\Database;

// make a connection to mysql here
$options = [
    //required
    'username' => '',
    'database' => '',
    //optional
    'password' => '',
    'type' => 'pssql',
    'charset' => 'utf8',
    'host' => 'localhost',
    'port' => '3309'
];

$db = new Database($options);
iz1kbp commented 3 years ago

dcblogdev thank you. Solved :I've installed xampp and download composer. It was a little hard for me, due my poor experience in these operation. first question : when I create an event, the TIME dropdown menu is visible only on click.I can't select the time but I can edit in time box. second question : is it possible disable the ADD and DELETE command to prevent accidental or unauthorized edit ? es: the index.pxp is used by the administrator and a similar file, but without tje ADD and DELETE button (es user.php) is user by the user only to display calendar and event (without login or similar...only different file). Thank's in advance Mario

iz1kbp commented 3 years ago

sorry again...is possible change languages?

dcblogdev commented 3 years ago

1) The time is populated by the dropdown it can't be written on the popup this is a limitation of the https://trentrichardson.com/examples/timepicker/ plugin.

2) you could edit the buttons and modals inside index.php based on the role but that's outside the scope of this demo.

3) not currently there is no localisation built in

iz1kbp commented 3 years ago

OK, Thank's again! Have a nice day! Mario

dillo83 commented 3 years ago

Hi thank you for your work. Is it possible to evitate the composer step and have already the file ready?

dcblogdev commented 3 years ago

I highly recommend using composer, it handles the autoloading of classes you would avoid this by downloading the PDO wrapper from https://github.com/dcblogdev/pdo-wrapper/blob/master/src/Database.php and include the file in config.php manually using a require() call.

dillo83 commented 3 years ago

i'ask because on server i'v no access to terminal to run composer (or maybe i dont know how to do it..)

dcblogdev commented 3 years ago

You could run composer locally then FTP the files up, I think you can do the above steps either way as composer is used for autoloading the database class.

dillo83 commented 3 years ago

thank you i did it and worked!, is it possible to add resources too? (for example name of persons to have the planning\shift?) so everyday have more column for persons on calendar that can have events

jjjjjjiy commented 3 years ago

hey dcblogdev, i wanna ask, why the end date always the same with start date when making new event ?, is there a way to fix the problem ??

jjjjjjiy commented 3 years ago

hi, i wanna ask is there an option to make the event end to duration, the duration will determine how the event end date, hours, and minute

ghost commented 3 years ago

Hi! Thank you for the most useful tutorial. Is there a room for a request? The same calendar but with admin panel and member panel with login and registration page? Thank you in advance and keep up the good work! :)

dcblogdev commented 3 years ago

hey dcblogdev, i wanna ask, why the end date always the same with start date when making new event ?, is there a way to fix the problem ??

you've found a mistake I've corrected it now by going into /api/insert.php and changing line 10. I've made this change in the repo now.

dcblogdev commented 3 years ago

Hi! Thank you for the most useful tutorial. Is there a room for a request? The same calendar but with admin panel and member panel with login and registration page? Thank you in advance and keep up the good work! :)

thanks @plazast, unfortunately, that's a fair amount of work and is outside the scope of this tutorial/demo.

If I was to go to that length I would restructure the project a fair bit and use a framework like Laravel to do the authentication and then bring in the calendar that shows for people based on their user level.

If you want to have a go with something a little easier then I have a login tutorial that you may find useful https://dcblog.dev/login-and-registration-system-with-php

medbounas commented 3 years ago

Hi! Thank you for the tutorial, it works perfectly in my wamp server, but on my remote server the events calendar are not showing, any ideas ?

edgrod01 commented 3 years ago

hi! good job, i need export excel, do you know how this is possible ?

ernesttan1976 commented 3 years ago

hi dcblogdev, Thank you for this wonderful code!

I managed to install the package and included it as an iframe inside Nubuilder. However the events appear with a 12a inside it. May I know how to change that?

Ernest

ernesttan1976 commented 3 years ago

Ahhh... I realized what 12a is. it's 12am. okok

ernesttan1976 commented 3 years ago

Hi there, if I wanted to add more fields, and filter the events by those fields, how do I do this?

dcblogdev commented 3 years ago

you can add more fields to the add/edit models inside index.php and update the /api files.

The api/load.php file is used to load the events, you can alter that page. If you want to use query params then you will likely need to alter this line on calendar.js

events: url+'api/load.php',

You may want to move the contents of calendar.js into index.php then you can use PHP to alter the URL passed on conditions.

dcblogdev commented 3 years ago

@medbounas did you solve your issue?

dcblogdev commented 3 years ago

hi! good job, i need export excel, do you know how this is possible ?

Ho @edgrod01 yes here's what you can do:

edit index.php add an export link:

<a href="export.php" class="btn btn-primary">Export to CSV</a>

Create export.php:

<?php require('config.php');

/**
 * CSV export
 * @param  array  $records      array of records
 * @param  string $filename     name of the file including .csv
 * @param  array  $headerFields array of column names
 * @param  string $delimiter    set the delimiter
 * @return download             csv file
 */
function export(array $records, string $filename, array $headerFields = [], string $delimiter = ',')
{
    //set headers to download file rather than displayed
    header('Content-Type: text/csv');
    header('Content-Disposition: attachment; filename="'.$filename.'";');

    //open output
    $f = fopen('php://output', 'w');

    //check for header fields
    if (!empty($headerFields)) {
        //set column headers
        fputcsv($f, $headerFields, $delimiter);
    }

    foreach($records as $row) {
        //output each row of the data,
        fputcsv($f, array_values($row), $delimiter);
    }
}

//set filename
$filename = 'events.csv';

//set column names
$headerFields = ['id', 'title', 'start', 'end', 'backgroundColor', 'textColor'];

//create array
$records = [];

//loop through data and add to array
$result = $db->select("* FROM events ORDER BY id");
foreach($result as $row) {
    $records[] = [
        $row->id,
        $row->title,
        $row->start_event,
        $row->end_event,
        $row->color,
        $row->text_color
    ];
}

//send params to csv
export($records, $filename, $headerFields);

This will export all events in the database.

papyana commented 3 years ago

@dcblogdev Thank you for your work. I have implemented it with success on a project of mine. I've made a page that shows the detalis (lots of!) for each event. What should I do to add a button on the modal form to simply open said page with the event id as a querystring? Thanks in advance! :-)

mistert209 commented 3 years ago

Hello, could you allso explain how I can chenge the locale to dutch?

I have tried adding it to "calendar" in calendar.js, but I think I did something wrong: var calendar = new FullCalendar.Calendar(calendarEl, { locale: 'nl', plugins: ['interaction', 'dayGrid', 'timeGrid', 'list'], ..... ....

Thanks

mistert209 commented 3 years ago

Nevermind my question, adding it to the calander as I did is correct. I needed to include the locales file to the page :(

papyana commented 3 years ago

Nevermind, @dcblogdev. I solved it another way!

MBilal5494 commented 3 years ago

I have Insert More details in my SQL Database using this project. but do not know how to display more parameters on calendar. can you please guide.

zenemy commented 3 years ago

is it possible to use oracle database?

AlexisBalderas27 commented 3 years ago

Hi @dcblogdev, i wanna ask if it's possible make the week view as default view, 'cause I try to make a binnacle per week, so only I need that, if it's possible and u wanna help I'll be very grateful. Thanks a lot!

dcblogdev commented 3 years ago

is it possible to use oracle database?

PDO supports oracle so yes I believe so

$connect = new PDO('oci:dbname=//localhost:1521/xe/ORCL, 'username', 'password');
dcblogdev commented 3 years ago

Hi @dcblogdev, i wanna ask if it's possible make the week view as default view, 'cause I try to make a binnacle per week, so only I need that, if it's possible and u wanna help I'll be very grateful. Thanks a lot!

Yes you can add a default view to the javascript:

defaultView: 'dayGridWeek',

More details https://fullcalendar.io/docs/v4/defaultView

AlexisBalderas27 commented 3 years ago

@dcblogdev thanks a lot! it was the answer, you're amazing dude!.

greetings from Mexico!

zenemy commented 3 years ago

thanks a lot! may I ask again, can I use mysqli instead of pdo ??

zenemy commented 3 years ago

Nevermind, fixed it already. You're the best dcblogdev!

dcblogdev commented 3 years ago

thanks a lot! may I ask again, can I use mysqli instead of pdo ??

Yes you would just need to change the config file and the php files in the api folder if I remember correctly

locationweb commented 3 years ago

Good evening I work on the project jquery-fullcalender-with-php-and-mysql When I execute the command I always get this error:

C:\wamp64\www\agenda>composer install 'composer' is not recognized as an internal order or external, an executable program or a batch file.

I am under wampserver Could you give me a solution Thank you again for your work Stéphane(belgium)

dcblogdev commented 3 years ago

this means you don't have composer installed, Composer is used to install dependencies you can install composer from their website https://getcomposer.org/

isfun42ofus commented 3 years ago

I uploaded files from git and i get the calendaer and add event button but when i save it doesnt do anything ?? changed config to connect to db already. any ideas ?

svan1812 commented 3 years ago

Hello , I'm trying to add users like this: Friday 02/12 user1 | user2 7am | 8am | What parameters should I use to add users? How to adapt the json data? I can't find any information about this problem thank you in advance Stephane

SourabhKanth commented 3 years ago

Hi,

I'm not able to connect to DB using below from config.php: $db = Database::get($username, $password, $database, $host);

I have other projects in the same server where I use below to connect to DB, which works fine. $db = new mysqli($host, $username, $password, $database);

Request you to please tell me if there is any alternative for "Database::get".

dcblogdev commented 3 years ago

Database::get uses PDO, so PDO should be available on your server otherwise you can use your mysqli implementation and adjust the API PHP files to use mysqli calls instead

dandrimontp commented 3 years ago

Hello, Could you tell me how change the langage ? I have tried to add in the index.php but it does not work for me. REGARDS.