def_order_by = 'added DESC'; $DB_List->insertColLast('added', array( 'title'=>'Received', 'order_by'=>'added', 'width'=>80, 'tpl'=>DB_LIST_CELL_DATE, 'date_format' => '%b %e, %Y', 'params'=>array('added'), )); $DB_List->insertColLast('from', array( 'title'=>'From', 'order_by'=>'', 'width'=>250, 'tpl'=>BASE_PATH . '/app/SponsorApplication/tpl/from.tpl', 'params'=>array('contact', 'company'), )); $DB_List->insertColLast('contact', array( 'title'=>'Contact Information', 'order_by'=>'', 'width'=>250, 'tpl'=>BASE_PATH . '/app/SponsorApplication/tpl/contact.tpl', 'params'=>array('phone', 'email'), )); $DB_List->insertColLast('options', array( 'title'=>'Options', 'tpl'=>DB_LIST_CELL_EDIT_DEL, 'edit_link'=>BASE_URL.'/'.CURR_PAGE.'?action=edit&id=', 'edit_title' => 'View Application', 'del_link'=>BASE_URL.'/'.CURR_PAGE.'?action=del&id=', 'params'=>array('id'), 'width'=>120, )); $DB_List->bind(); return true; } function addLink() { return false; } function _bindFormFields($form) { $form->addElement('text', 'company', 'Company Name', array('style' => 'width:550px;')); $form->addElement('text', 'contact', 'Contact Name', array('style' => 'width:550px;')); $form->addElement('extended_text', 'phone', 'Phone Number', array('style' => 'width:370px;'), null, '  Format should be: (xxx) xxx-xxxx'); $form->addElement('text', 'email', 'Email', array('style' => 'width:550px;')); $form->addElement('textarea', 'comments', 'Comments', array('style' => 'width:550px;height:200px;')); $form->addRuleRequired(array('company', 'contact')); $this->formAddPhoneRule($form, 'phone'); $form->addRuleEx(array('email'), ' is wrong', 'email'); $form->addFormRule(array($this, 'validateForm')); return $form; } function validateForm($data) { $error = array(); if (empty($data['phone']) && empty($data['email'])) { $error['phone'] = 'Please enter Phone Number or Email'; } return (empty($error) ? true : $error); } function doEdit() { $this->DBObj->initFromDB(); $form = $this->_getEditForm(); $form->setDefaults($this->DBObj->getData()); $form->getElement('phone')->_after_text = ''; $form->freeze(); $form->setCancelType(null); $form->setSubmitTitle('Back'); $form->exec(); } function doUpdate() { $this->doBack(); return true; } }