Page 1 of 1

how to know which page called the widget

Posted: Wed Mar 30, 2016 9:16 pm
by joshsard
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?