PDA

View Full Version : Make default settings in calendar view "All Companies" and "All Events"


jman1ac
05-10-11, 02:45 AM
I am new to PHP and want to change the select array in the calendar view to default of "All Companies" and "All Events". Can someone please help me with this?

CURRENT CODE USING ARRAY:

require_once($AppUI->getModuleClass('companies'));
require_once($AppUI->getModuleClass('tasks'));

// retrieve any state parameters
if (isset($_REQUEST['company_id'])) {
$AppUI->setState('CalIdxCompany', intval($_REQUEST['company_id']));
}
$company_id = $AppUI->getState('CalIdxCompany', 0);

// Using simplified set/get semantics. Doesn't need as much code in the module.
$event_filter = $AppUI->checkPrefState('CalIdxFilter', @$_REQUEST['event_filter'],
'EVENTFILTER', 'my');

// get the passed timestamp (today if none)
$ctoday = new CDate();
$today = $ctoday->format(FMT_TIMESTAMP_DATE);
$date = dPgetParam($_GET, 'date', $today);

// get the list of visible companies
$company = new CCompany();
$companies = $company->getAllowedRecords($AppUI->user_id, 'company_id,company_name',
'company_name');
$companies = arrayMerge(array('0'=>$AppUI->_('All')), $companies);

#echo '<pre>';print_r($events);echo '</pre>';
// setup the title block
$titleBlock = new CTitleBlock('Monthly Calendar', 'myevo-appointments.png', $m, "$m.$a");
$titleBlock->addCell($AppUI->_('Company').':');
$titleBlock->addCell(arraySelect($companies, 'company_id',
'onchange="javascript:document.pickCompany.submit()" class="text"',
$company_id), '',
('<form action="' . $_SERVER['REQUEST_URI']
. '" method="post" name="pickCompany">'), '<form>');

$titleBlock->addCell($AppUI->_('Event Filter') . ':');
$titleBlock->addCell(arraySelect($event_filter_list, 'event_filter',
'onchange="javascript:document.pickFilter.submit()" class="text"',
$event_filter, true), '',
('<form action="' . $_SERVER['REQUEST_URI']
. '" method="post" name="pickFilter">'), '</form>');
$titleBlock->show();
?>

jman1ac
05-10-11, 09:04 AM
I can change the value selected by the array but that alone will not change the global states for "Company" and "Event Filter"