PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, March 3, 2022

[FIXED] Yii changing functionality of fullcalendar-scheduler

 March 03, 2022     fullcalendar-scheduler, yii     No comments   

Issue

I'am using fullcalendarscheduler widget posted on github by Edofre im my yii2 project. Is there any way i could change predefined rooms displayed in the table into a data from the database.

How it looks now:

'resources'         => [
        ['id' => 'a', 'title' => 'Auditorium A'],
        ['id' => 'b', 'title' => 'Auditorium B', 'eventColor' => 'green'],
        ['id' => 'c', 'title' => 'Auditorium C', 'eventColor' => 'orange'],
        [
            'id'       => 'd', 'title' => 'Auditorium D',
            'children' => [
                ['id' => 'd1', 'title' => 'Room D1'],
                ['id' => 'd2', 'title' => 'Room D2'],
            ],
        ],
        ['id' => 'e', 'title' => 'Auditorium E'],

    ],

How i could imagine this would work:

'resources' => [
    foreach ($rooms as $key) {
        ['id' => $rooms[$key]->id, 'title' => $rooms[$key]->room],
    }
],

Edit: I have learned that i can return data using function:

$model = Workers::findAll(['user_id' => 16]);
         $table=[];
         foreach ($model as $key) {
             $work = new Resource(["id" => "a", "title" => $key->imie]);
             $table = $work;
         }

        return [
                $table,
            ];
        }

But its only displaying the last record from the table. What should i do to display entire table with $table variable?


Solution

$model = Workers::findAll(['user_id' => 16]);
         $table=[];
         foreach ($model as $key) {
             $table[] = ["id" => "a", "title" => $key->imie];
         }

        return $table;
        //return [$table];

try these returns



Answered By - Vandro.nds
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing