User guide for scheduler ?

Hello,

  1. I have found a problem in my solution, check my configuration file in the attachment. Note that i have created new variable $section_key = $fieldName."_".$j; and replaced all occurrences of $fieldName.“_”.$j with it. Also there are screenshots how it works locally.

  2. As another option - it’s possible to improve your solution.

$this->scheduler->event->attach("afterProcessing", Array($this, "after_set_event_user"));

This function (after_set_event_user) will be called after information is inserted in the DB. You can as well add you code there and it will be called automatically each time.

Best regards,
Ilya
dhtmlxSchedulerConfigurator.ZIP (90.7 KB)

Thanks for all your help ilya .
After all that the people I am doing this for like the idea of the techs not being able to see the jobs until they click the button …Arghhh!! lol
So I am keeping the button that doesnt allow the techs to see the jobs until the admin pushes it
( The sql php file ) .
But its good to know for future reference . I have this bookmarked in case I need to do it again :smiley:
Once again
Thanks for all your help !

Ok The way I had it was not working correctly so I am trying to get your edit down ilya .

Not working . My dht config file is attached to this post
these are my screenshots of everything



Do you think you could take a look for me?
BTW Im running in private mode so shouldnt your second edit be under the private instead of public?

Alls I want is the admin to create the events and then the techs to become the creator for that event.

At the moment admin is USER 62
as you can see nothings changing . So I haven’t edited your file correctly
The techs USER ID’s and field designation are

Alan: USER 63 - techs_2
Mark: USER 64 - techs_1
Stuart: USER 65 - techs_0
Simon: USER 67 - techs_3
Giani: USER 68 - techs_4
Bernie: USER 75 - techs_5

So again , I need USER 62 to create the event ( Which is admin ) or anyone for that matter
Then by reading the ‘techs’ field from the database assigning a USER ID to the USER Column from that field

eg. admin = 62 submits event ,
upon save the php file reads the ‘techs’ field in the database and changes event_user ( user column )
to respective tech .

IE Alan :user would change from 62 ( admin ) to 63 ( alan )

Can you take a look and see what i’m doing wrong?
Thanks in advance :smiley:


Edit :-
Can’t I just hardcode this ?:-

$fields .= ',rec_type,event_pid,event_length,user'; if (($this->settings['privatemode'] == 'on')&&($usertype != "superadministrator")) { $this->scheduler->event->attach("beforeRender", Array($this, "private_remove_updated")); $query = "SELECT event_id,".$fields.",user FROM `".$this->prefix.$this->tableEventsRec."` WHERE `user`='".($this->userid)."' OR `event_pid`!=0"; $this->scheduler->render_sql($query,"event_id", $fields); } else { $this->scheduler->render_table($this->prefix.$this->tableEventsRec,"event_id",$fields); }
dhtmlxSchedulerConfigurator.zip (10.3 KB)

Lines 1012-1013 in your code

a) now you can custom user settings only for insert operation if you want to have it applied for all types of operation - move next two lines

$user_id = substr($action->get_value(‘techs’), 7); // tsection_80, we are taking only 80 part
$action->set_value(“user”, $user_id);

above

if ($status == “inserted”) {

b)
I’m not quite sure about purpose of
if(substr($action->get_value(‘techs’), 0, 1) == ‘a’) // key is ‘tsection_40’
if you need the userid changing logic for all “tech” values - just remove it

c)
$user_id = substr($action->get_value(‘techs’), 7);

if you will not use above “a” check , 7 need to be changed to 6

Thanks for the reply Stanislav :smiley:
Ok i now have these 2 bits of code
Line 312

[code] //$fieldString .= ‘{key:"’.$section_key.‘“, label:”’.$field[‘options’][$j][‘name’].‘"},’;

                    $section_key = $fieldName."_".$j;
                    if($fieldName == 'techs') {
                        $section_name = $field['options'][$j]['name'];
                        switch ($section_name) {
                        case 'stuart':
                            $section_key = 'techs_0'; 
                            break;
                        case 'mark':
                            $section_key = 'techs_1';
                            break;
                        case 'alan':
                            $section_key = 'techs_2';
                            break;
						case 'simon':
                            $section_key = 'techs_3'; 
                            break;
                        case 'giani':
                            $section_key = 'techs_4';
                            break;
                        case 'bernie':
                            $section_key = 'techs_5';
                            break;
                        }
                    }[/code]

and line 1008

public function set_event_user($action) { $status = $action->get_status(); $user_id = substr($action->get_value('techs'), 6); $user_id = $this->userid; if ($status == "inserted") { $action->set_value("user", $user_id); } else { if ($this->settings["privatemode"] == "ext") { $user_id = $this->userid; if ($user != $this->userid) { $action->error(); } } }

Still not changing the user column in the database from 62 to the assigned tech eg. tech_1 = user 64 ( mark )
I am running in private mode so shouldn’t that be moved under?
attached is my edited file .
and yes I just want anything any SUPERADMIN creates to be assigned to the user it is created for
so if they put an event in marks field he becomes the user for that event in the database
same with the rest ( stuart , alan etc )
dhtmlxSchedulerConfigurator.zip (10.2 KB)

Anyone help? Kinda stuck here :frowning:

After applying above changes are you resaving configuration from admin part?
The code at line 312 is related to the config parsing and may be triggered only during configuration saving.

How did you go with the files I sent you Stanislav?
Was it what you wanted?