Beispiel #1
0
 protected function _prepareForm()
 {
     $form = new Varien_Data_Form();
     $this->setForm($form);
     $fieldset = $form->addFieldset("helpdesk_form", array("legend" => Mage::helper("helpdesk")->__("Ticket Options")));
     $fieldset->addField("ticket_id", "hidden", array("label" => Mage::helper("helpdesk")->__("Ticket Id"), "name" => "ticket_id"));
     $fieldset->addField("category_id", "select", array("label" => Mage::helper("helpdesk")->__("Category"), "name" => "category_id", 'values' => Mage::helper('helpdesk')->getHelpdesk()));
     $fieldset->addField("title", "text", array("label" => Mage::helper("helpdesk")->__("Title"), "name" => "title"));
     /*	$fieldset->addField("store_id", "text", array(
     			"label" => Mage::helper("helpdesk")->__("Store View"),
     			"name" => "store_id",
     			));*/
     if (!Mage::app()->isSingleStoreMode()) {
         $fieldset->addField('store_id', 'select', array('label' => Mage::helper('helpdesk')->__('Store View'), 'required' => false, 'name' => 'store_id', 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(), 'value' => 'store_id'));
     } else {
         $fieldset->addField('store_id', 'hidden', array('name' => 'store_id', 'value' => Mage::app()->getStore(true)->getId()));
     }
     $dateFormatIso = Mage::app()->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
     $fieldset->addField('created_at', 'hidden', array('label' => Mage::helper('helpdesk')->__('Created At'), 'name' => 'created_at', 'time' => true, 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'format' => $dateFormatIso));
     $dateFormatIso = Mage::app()->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
     $fieldset->addField('last_reply', 'hidden', array('label' => Mage::helper('helpdesk')->__('Last Reply'), 'name' => 'last_reply', 'time' => true, 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'format' => $dateFormatIso));
     $dateFormatIso = Mage::app()->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
     $fieldset->addField('last_customer_reply', 'hidden', array('label' => Mage::helper('helpdesk')->__('Last Customer Reply'), 'name' => 'last_customer_reply', 'time' => true, 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'format' => $dateFormatIso));
     $dateFormatIso = Mage::app()->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
     $fieldset->addField('last_department_reply', 'hidden', array('label' => Mage::helper('helpdesk')->__('Last Department Reply'), 'name' => 'last_department_reply', 'time' => true, 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'format' => $dateFormatIso));
     /*	 $fieldset->addField('category', 'select', array(
     				'label'     => Mage::helper('helpdesk')->__('Category'),
     				'values'   => HD_Helpdesk_Block_Adminhtml_Ticket_Grid::getValueArray7(),
     				'name' => 'category',
     				));  */
     if ($this->getRequest()->getParam('customer_id')) {
         if ($customer = Mage::getModel('customer/customer')->load($this->getRequest()->getParam('customer_id'))) {
             $fieldset->addField("email", "text", array("label" => Mage::helper("helpdesk")->__("Email"), "value" => $customer->getEmail(), "name" => "email"));
         }
     } else {
         $fieldset->addField("email", "text", array("label" => Mage::helper("helpdesk")->__("Email"), "name" => "email"));
     }
     $fieldset->addField('lock', 'select', array('label' => Mage::helper('helpdesk')->__('Lock'), 'values' => MG_Helpdesk_Block_Adminhtml_Ticket_Grid::getValueArray10(), 'name' => 'lock'));
     $fieldset->addField('status', 'select', array('label' => Mage::helper('helpdesk')->__('Status'), 'values' => MG_Helpdesk_Block_Adminhtml_Ticket_Grid::getValueArray11(), 'name' => 'status'));
     $fieldset->addField('priority', 'select', array('label' => Mage::helper('helpdesk')->__('Priority'), 'values' => MG_Helpdesk_Block_Adminhtml_Ticket_Grid::getValueArray12(), 'name' => 'priority'));
     $fieldset->addField("message", "editor", array("label" => Mage::helper("helpdesk")->__("Message"), "name" => "message", 'style' => 'height:15em', 'config' => Mage::getSingleton('cms/wysiwyg_config')->getConfig(), 'wysiwyg' => true, 'required' => false));
     /*	$fieldset->addField("viewed", "text", array(
     			"label" => Mage::helper("helpdesk")->__("Viewed"),
     			"name" => "viewed",
     			));*/
     if (!$this->getRequest()->getParam('customer_id')) {
         if (Mage::getSingleton("adminhtml/session")->getTicketData()) {
             $form->setValues(Mage::getSingleton("adminhtml/session")->getTicketData());
             Mage::getSingleton("adminhtml/session")->setTicketData(null);
         } elseif (Mage::registry("ticket_data")) {
             $form->setValues(Mage::registry("ticket_data")->getData());
         }
     }
     return parent::_prepareForm();
 }
Beispiel #2
0
 public static function getValueArray12()
 {
     $data_array = array();
     foreach (MG_Helpdesk_Block_Adminhtml_Ticket_Grid::getOptionArray12() as $k => $v) {
         $data_array[] = array('value' => $k, 'label' => $v);
     }
     return $data_array;
 }