how to know which page called the widget

Discussion for TimeTrex open source community developers.
Post Reply
Posts: 55
Joined: Sun Feb 14, 2016 6:09 pm

how to know which page called the widget

Post by joshsard » Wed Mar 30, 2016 9:16 pm

Good morning. How do I get which form/page I am at currently in, using PhP code?

For example, I am in the Schedule View form where I want to reduce the items in the Absence Policy field dropdown (when Status=Absent). We have set Absence Policies which have names like "unauthorized leave", of course this should not be "scheduled", so it must not be visible. Then the same dropdown also shows up in the TimeSheet View form (clicked New Absence button), there I need all these items to show up in the dropdown list.

I managed to find out that APIAbsencePolicy.class.php#getAbsencePolicy gets called when I click the "Absence Policy" dropdown. So there I could "remove" some of the items from returned array BUT if only I could manage to find out which "page" I am currently in, but I do not know how to yet.

Can someone please teach me how to achieve this or if its even possible?
Initially I tried looking at the javascript files ScheduleViewController.js and TimeSheetViewController.js but I cannot seem to get where the list is stored, I only find this:

Code: Select all

		form_item_input.AComboBox( {
			api_class: (APIFactory.getAPIClass( 'APIAbsencePolicy' )),
			allow_multiple_selection: false,
			layout_name: ALayoutIDs.ABSENCES_POLICY,
			show_search_inputs: true,
			set_empty: true,
			field: 'src_object_id',
			validation_field: 'absence_policy_id'
		} );

		form_item_input.customSearchFilter = function( filter ) {
			return $this.setAbsencePolicyFilter( filter );

		this.addEditFieldToColumn( $.i18n._( 'Type' ), form_item_input, tab_punch_column1, '', null, true );
Could I directly manipulate records in the dropdown list here in the javascript?

Post Reply