'doEdit', 'update' => 'doUpdate', 'verify' => 'doVerify', 'new' => 'doNew', 'insert' => 'doInsert', ); function initAction() { if (empty($this->action)) { if (isset($_REQUEST['action']) && !empty($_REQUEST['action'])) { $this->action= $_REQUEST['action']; } else { $this->action = $this->defaultAction; } } if (key_exists($this->action, $this->actions)){ $this->actionMethod = $this->actions[$this->action]; } else { $this->action = key($this->actions); $this->actionMethod = current($this->actions); } if ($this->isXmlHttpRequest()) { $this->actionMethod .= 'Ajax'; } } function exec(&$Doc) { $this->Doc = &$Doc; $this->DBObj = SiteMap::getObj('DuesCalculator/DuesCalculator.php'); $this->initAction(); if (method_exists($this, $this->actionMethod)) { $function = $this->actionMethod; $this->$function(); } else { exit; } } function formAddRuleNumeric(&$form, $elementName, $ruleMessagePrefix, $ruleMessagePostfix = ' is in wrong format') { $form->addRule($elementName, $ruleMessagePrefix.$form->getElement($elementName)->getLabel().$ruleMessagePostfix, 'numeric'); $form->addRule($elementName, $ruleMessagePrefix.$form->getElement($elementName)->getLabel().$ruleMessagePostfix, 'numeric', null, 'client'); } function formAddMonthSection(&$form, $sectionName, $sectionTitle) { $form->addElement('header', 'header_'.$sectionName, $sectionTitle); $form->addElement('text', $sectionName.'[total]', 'Total Annual Cost'); $this->formAddRuleNumeric($form, $sectionName.'[total]', $sectionTitle.'. '); $monthList = array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'); foreach ($monthList as $monthIndex => $monthTitle) { $form->addElement('text', $sectionName.'['.($monthIndex + 1).']', $monthTitle.' Cost'); $this->formAddRuleNumeric($form, $sectionName.'['.($monthIndex + 1).']', $sectionTitle.'. '); } } function _bindFormFields($form) { $this->formAddMonthSection($form, 'primary', 'MNCAR PRIMARY DUES'); $this->formAddMonthSection($form, 'secondary', 'MNCAR SECONDARY DUES'); $this->formAddMonthSection($form, 'affiliate', 'MNCAR AFFILIATE DUES'); $form->addElement('header', 'header_exchange_initiation_costs', 'EXCHANGE INITIATION COSTS'); $form->addElement('text', 'company_initiation_fee', 'Company Initiation Fee'); $this->formAddRuleNumeric($form, 'company_initiation_fee', 'EXCHANGE INITIATION COSTS. '); //$form->addElement('text', 'location_initiation_fee', 'Location Initiation Fee'); //$this->formAddRuleNumeric($form, 'location_initiation_fee', 'EXCHANGE INITIATION COSTS. '); $form->addElement('header', 'header_exchange_dues_for_members', 'EXCHANGE DUES FOR MEMBERS (1st User)'); $form->addElement('text', 'mncar[cost_for_the_entrie_quater]', 'Cost For The Entire Quarter'); $this->formAddRuleNumeric($form, 'mncar[cost_for_the_entrie_quater]', 'EXCHANGE DUES FOR MEMBERS (1st User). '); $form->addElement('text', 'mncar[prorated_cost_for_months_2_and_3]', 'Pro-rated cost for months 2 & 3'); $this->formAddRuleNumeric($form, 'mncar[prorated_cost_for_months_2_and_3]', 'EXCHANGE DUES FOR MEMBERS (1st User). '); $form->addElement('text', 'mncar[prorated_cost_for_month_3]', 'Pro-rated cost for Month 3'); $this->formAddRuleNumeric($form, 'mncar[prorated_cost_for_month_3]', 'EXCHANGE DUES FOR MEMBERS (1st User). '); $form->addElement('header', 'header_exchange_dues_for_nonmembers', 'EXCHANGE DUES FOR NON-MEMBERS (1st User)'); $form->addElement('text', 'nonmncar[cost_for_the_entrie_quater]', 'Cost For The Entire Quarter'); $this->formAddRuleNumeric($form, 'nonmncar[cost_for_the_entrie_quater]', 'EXCHANGE DUES FOR NON-MEMBERS (1st User). '); $form->addElement('text', 'nonmncar[prorated_cost_for_months_2_and_3]', 'Pro-rated cost for months 2 & 3'); $this->formAddRuleNumeric($form, 'nonmncar[prorated_cost_for_months_2_and_3]', 'EXCHANGE DUES FOR NON-MEMBERS (1st User). '); $form->addElement('text', 'nonmncar[prorated_cost_for_month_3]', 'Pro-rated cost for Month 3'); $this->formAddRuleNumeric($form, 'nonmncar[prorated_cost_for_month_3]', 'EXCHANGE DUES FOR NON-MEMBERS (1st User). '); $form->addElement('header', 'header_exchange_dues_for_members2', 'EXCHANGE DUES FOR MEMBERS (Add\'t User)'); $form->addElement('text', 'mncar2[cost_for_the_entrie_quater]', 'Cost For The Entire Quarter'); $this->formAddRuleNumeric($form, 'mncar2[cost_for_the_entrie_quater]', 'EXCHANGE DUES FOR MEMBERS (Add\'t User). '); $form->addElement('text', 'mncar2[prorated_cost_for_months_2_and_3]', 'Pro-rated cost for months 2 & 3'); $this->formAddRuleNumeric($form, 'mncar2[prorated_cost_for_months_2_and_3]', 'EXCHANGE DUES FOR MEMBERS (Add\'t User). '); $form->addElement('text', 'mncar2[prorated_cost_for_month_3]', 'Pro-rated cost for Month 3'); $this->formAddRuleNumeric($form, 'mncar2[prorated_cost_for_month_3]', 'EXCHANGE DUES FOR MEMBERS (Add\'t User). '); $form->addElement('header', 'header_exchange_dues_for_nonmembers2', 'EXCHANGE DUES FOR NON-MEMBERS (Add\'t User)'); $form->addElement('text', 'nonmncar2[cost_for_the_entrie_quater]', 'Cost For The Entire Quarter'); $this->formAddRuleNumeric($form, 'nonmncar2[cost_for_the_entrie_quater]', 'EXCHANGE DUES FOR NON-MEMBERS (Add\'t User). '); $form->addElement('text', 'nonmncar2[prorated_cost_for_months_2_and_3]', 'Pro-rated cost for months 2 & 3'); $this->formAddRuleNumeric($form, 'nonmncar2[prorated_cost_for_months_2_and_3]', 'EXCHANGE DUES FOR NON-MEMBERS (Add\'t User). '); $form->addElement('text', 'nonmncar2[prorated_cost_for_month_3]', 'Pro-rated cost for Month 3'); $this->formAddRuleNumeric($form, 'nonmncar2[prorated_cost_for_month_3]', 'EXCHANGE DUES FOR NON-MEMBERS (Add\'t User). '); $form->addElement('header', 'header_submit_grp', ''); return $form; } function _bindFormFields2($form) { $data = $this->DBObj->getFromDB(0); if (!is_array($data) || empty($data)) { return false; } $form->addElement('static', 'static_title', ' ', '