/**
  * Function to add the form elements
  * 
  * @access protected
  */
 protected function createFormElements()
 {
     $this->add('hidden', 'id', ts('RuleId'), array('id' => 'ruleId'));
     if ($this->_action != CRM_Core_Action::DELETE) {
         $this->add('text', 'rule_label', ts('Name'), array('size' => CRM_Utils_Type::HUGE), TRUE);
         $this->add('checkbox', 'rule_is_active', ts('Enabled'));
         $this->add('text', 'rule_created_date', ts('Created Date'));
         $this->add('text', 'rule_created_contact', ts('Created By'));
         $eventList = array(' - select - ') + CRM_Civirules_Utils::buildEventList();
         asort($eventList);
         $this->add('select', 'rule_event_select', ts('Select Event'), $eventList);
         if ($this->_action == CRM_Core_Action::UPDATE) {
             $this->createUpdateFormElements();
         }
     }
     if ($this->_action == CRM_Core_Action::ADD) {
         $this->addButtons(array(array('type' => 'next', 'name' => ts('Next'), 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'))));
     } elseif ($this->_action == CRM_Core_Action::DELETE) {
         $this->addButtons(array(array('type' => 'next', 'name' => ts('Delete'), 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'))));
     } else {
         $this->addButtons(array(array('type' => 'next', 'name' => ts('Save'), 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'))));
     }
 }