Example #1
0
 protected function _initForm()
 {
     $form = new Varien_Data_Form();
     $fieldset = $form->addFieldset('aw_hdu3_department_agent_form', array('legend' => $this->__('Admin Permissions')));
     $departmentOptionValues = AW_Helpdesk3_Model_Source_Department::toOptionArray(Mage::registry('current_department')->getId());
     unset($departmentOptionValues[0]);
     $fieldset->addField('department_ids', 'multiselect', array('label' => $this->__('Allowed for Departments'), 'name' => 'permission[department_ids]', 'values' => $departmentOptionValues, 'note' => $this->__('All members of selected departments can view and edit tickets of this department' . ' regardless of other "Admin Permissions" settings')));
     $fieldset->addField('admin_role_ids', 'multiselect', array('label' => $this->__('Allowed for Roles'), 'name' => 'permission[admin_role_ids]', 'values' => Mage::getModel('admin/roles')->getCollection()->toOptionArray(), 'note' => $this->__('All members of selected roles can view and edit tickets of this department' . ' regardless of other "Admin Permissions" settings')));
     $permissionData = Mage::registry('current_department')->getData('permission');
     if (null === $permissionData) {
         $permissionData = Mage::registry('current_department')->getPermission()->getData();
     }
     $form->setValues($permissionData);
     $this->setForm($form);
 }
Example #2
0
 protected function _prepareForm()
 {
     $form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getUrl('*/*/saveNewPost'), 'method' => 'post', 'enctype' => 'multipart/form-data'));
     $form->setUseContainer(true);
     $this->setForm($form);
     $fieldset = $form->addFieldset('aw_hdu3_ticket_new_form', array('legend' => $this->__('Ticket Information')));
     $fieldset->addField('title', 'text', array('name' => 'title', 'label' => $this->__('Subject'), 'required' => true));
     $fieldset->addField('store_ids', 'select', array('name' => 'store_id', 'label' => $this->__('Store ID'), 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, false), 'required' => true));
     $fieldset->addField('department_id', 'select', array('name' => 'department_id', 'label' => $this->__('Department'), 'values' => AW_Helpdesk3_Model_Source_Department::toOptionArray(), 'required' => true));
     $fieldset->addField('status_id', 'select', array('name' => 'status_id', 'label' => $this->__('Status'), 'values' => AW_Helpdesk3_Model_Source_Ticket_Status::toOptionArray(), 'required' => true));
     $fieldset->addField('priority_id', 'select', array('name' => 'priority_id', 'label' => $this->__('Priority'), 'values' => AW_Helpdesk3_Model_Source_Ticket_Priority::toOptionArray(), 'required' => true, 'value' => AW_Helpdesk3_Model_Source_Ticket_Priority::TODO_VALUE));
     $departmentCollection = Mage::getModel('aw_hdu3/department')->getCollection()->addNotDeletedFilter();
     $_dependBlock = $this->getLayout()->createBlock('adminhtml/widget_form_element_dependence');
     $_dependBlock->addFieldMap($form->getHtmlIdPrefix() . 'department_id', 'department_id');
     foreach ($departmentCollection as $department) {
         $fieldset->addField('department_agent_id' . $department->getId(), 'select', array('name' => 'department_agent_id' . $department->getId(), 'label' => $this->__('Agent'), 'values' => $department->getAgentCollection()->addActiveFilter()->toOptionArray()));
         $_dependBlock->addFieldMap($form->getHtmlIdPrefix() . 'department_agent_id' . $department->getId(), 'department_agent_id' . $department->getId())->addFieldDependence('department_agent_id' . $department->getId(), 'department_id', $department->getId());
     }
     $fieldset->addType('customer', 'AW_Helpdesk3_Block_Adminhtml_Ticket_New_Form_Customer');
     $fieldset->addField('customer_email', 'customer', array('label' => $this->__('Customer Email'), 'name' => 'customer_email', 'class' => 'validate-email', 'required' => true));
     $fieldset->addField('customer_name', 'text', array('label' => $this->__('Customer Name'), 'name' => 'customer_name', 'required' => true, 'value' => $this->getRequest()->getParam('customer_name')));
     $fieldset->addField('order_increment_id', 'hidden', array('name' => 'order_increment_id', 'value' => $this->getRequest()->getParam('order_increment_id')));
     $fieldset->addField('return_customer_id', 'hidden', array('name' => 'return_customer_id', 'value' => $this->getRequest()->getParam('return_customer_id')));
     $templateCollection = Mage::getModel('aw_hdu3/template')->getCollection()->addActiveFilter()->toOptionHash();
     $fieldset->addField('quick_response', 'select', array('label' => $this->__('Use Quick Response'), 'name' => 'quick_response', 'values' => $templateCollection, 'after_element_html' => $this->_prepareObserver() . $this->_getApplyQuickResponseButton()->toHtml()));
     $fieldset->addField('awhdu3_content_state', 'hidden', array('name' => 'awhdu3_content_state', 'value' => Mage::getSingleton('adminhtml/session')->getEditorState() ? Mage::getSingleton('adminhtml/session')->getEditorState() : 'show'));
     $fieldset->addField('awhdu3_content', 'editor', array('label' => $this->__('Message'), 'name' => 'content', 'style' => 'width:500px; height:400px;', 'config' => $this->_getWysiwygConfig(), 'required' => true, 'after_element_html' => $this->_showHideObserver()));
     $fieldset->addType('multiattach', 'AW_Helpdesk3_Block_Adminhtml_Ticket_Edit_Form_Reply_Multiattach');
     $fieldset->addField('attach', 'multiattach', array('label' => $this->__('Attach File(s)'), 'name' => 'attach[]', 'multiple' => true));
     $departmentId = Mage::helper('aw_hdu3/config')->getDefaultDepartmentId();
     $departmentModel = Mage::getModel('aw_hdu3/department');
     $departmentModel->load($departmentId);
     if ($departmentModel->getId() && $departmentModel->isEnabled()) {
         $form->addValues(array('department_id' => $departmentId));
     }
     $this->setChild('form_after', $_dependBlock);
     return parent::_prepareForm();
 }
Example #3
0
 /**
  * @return array
  */
 public function getDepartmentOptionList()
 {
     return AW_Helpdesk3_Model_Source_Department::toOptionArrayForStoreId();
 }