Yii2 framework with dhtmlxScheduler error

Hi,

I’ve been using Yii2 Advanced Template with DHTMLx Scheduler and MySQL.
I’ve have been following this blog post but using Yii2 versus Yii.

dhtmlx.com/blog/dhtmlxconnec … -with-yii/

So far the Scheduler is displaying properly on a static page in the frontend, but I am getting this error when saving an event.

Not Found (#404): Unable to resolve the request: site/Scheduler_data

View:
…/frontend/views/site/scheduler.php

[code]

<?php use yii\helpers\Html; use yii\helpers\Url ?>
 
 
[/code]

SiteController.php

<?php
namespace frontend\controllers;

use frontend\models\AccountActivation;
use frontend\models\PasswordResetRequestForm;
use frontend\models\ResetPasswordForm;
use frontend\models\SignupForm;
use frontend\models\ContactForm;
use common\models\LoginForm;
use common\models\Setting;
use yii\helpers\Html;
use yii\helpers\Url;
use yii\base\InvalidParamException;
use yii\web\BadRequestHttpException;
use yii\web\Controller;
use yii\filters\VerbFilter;
use yii\filters\AccessControl;
use Yii;

require_once(__DIR__."../../../../dhtmlx/connector/scheduler_connector.php");
require_once(__DIR__."../../../../dhtmlx/connector/db_phpyii.php");

/**
 * -----------------------------------------------------------------------------
 * Site controller.
 * It is responsible for displaying static pages, logging users in and out,
 * signup and account activation, password reset.
 * -----------------------------------------------------------------------------
 */
class SiteController extends Controller
{

....

     public function actionIndex()
     {
              return $this->render('index');
     }

       public function actionScheduler()
       {
               return $this->render('scheduler');
       }

       public function actionScheduler_data()
       {
                $scheduler = new SchedulerConnector(Events::model(), "PHPYii");
                $scheduler->enable_log("text.log");
                $scheduler->configure("-", "event_id", "start_date, end_date, event_name");
                return $scheduler->render();
       }

....
}

Model:
Events.php generated with gii
…/frontend/models/Events.php

<?php

namespace frontend\models;

use Yii;

/**
 * This is the model class for table "events".
 *
 * @property integer $event_id
 * @property string $start_date
 * @property string $end_date
 * @property string $event_name
 */
class Events extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'events';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['start_date', 'end_date', 'event_name'], 'required'],
            [['start_date', 'end_date'], 'safe'],
            [['event_name'], 'string', 'max' => 255]
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'event_id' => 'Event ID',
            'start_date' => 'Start Date',
            'end_date' => 'End Date',
            'event_name' => 'Event Name',
        ];
    }
}

Is there anything I am missing in the above.
The Yii debugger displays:

Name	Value
Route	'site/scheduler'
Action	'frontend\\controllers\\SiteController::actionScheduler()'

I truly appreciate this forum’s knowledge and experience.
It may be my lack of understanding in configuring Yii, PHP, and DHTMLX.
Thanks in advance for any guidance.

Hello,

I think you should read this.
Standard Yii urls look like “/index.php?r=post/view”.
Your link should be baseurl + “/index.php?r=site/scheduler_data” (except if you’re using PrettyUrl, then your custom rules apply).
Either way you should generate the Url with “echo Url::to([‘site/scheduler_data’]);”

Loewi

PS: Sorry for my bad english.