示例#1
0
 private function getReplyForm($ticket, $message = null, $type = 'message')
 {
     $content = '';
     $form = $this->strategy->createForm();
     if (!is_null($message) && $type == 'message') {
         if (!$this->getModule()->getConfig('does_not_quote_in_reply')) {
             $content = explode("\n", $message->content);
             $content = array_map(create_function('$v', 'return \'>\'.$v;'), $content);
             $content = "\n\n" . implode("\n", $content);
         }
     } elseif (!is_null($message) && $type == 'comment') {
         $content = $message->content;
         $form->addHidden('message_id')->setValue($this->getDi()->app->obfuscate($message->message_id));
     }
     if ($type == 'message' && defined('AM_ADMIN') && $this->getModule()->getConfig('add_signature')) {
         $content = "\n\n" . $this->expandPlaceholders($this->getModule()->getConfig('signature')) . $content;
     }
     $form->addHidden('type')->setValue($type);
     $form->addTextarea('content', array('rows' => 15, 'class' => 'no-label el-wide'))->setValue($content);
     $form->setAction($this->strategy->assembleUrl(array('page_id' => 'view', 'action' => 'reply', 'ticket' => $ticket, 'type' => $type), 'inside-pages'));
     if ($type != 'comment') {
         $this->strategy->addUpload($form);
     }
     $btns = $form->addGroup();
     $btns->setSeparator(' ');
     $btns->addSubmit('submit', array('value' => ___('Submit')));
     $btns->addInputButton('discard', array('value' => ___('Discard')));
     return $form;
 }
示例#2
0
 private function getReplyForm($ticket_id, $message = null, $type = 'message')
 {
     $content = '';
     $hiddens = '';
     if (!is_null($message) && $type == 'message') {
         $content = explode("\n", $message->content);
         $content = array_map(create_function('$v', 'return \'>\'.$v;'), $content);
         $content = "\n\n" . implode("\n", $content);
     } elseif (!is_null($message) && $type == 'comment') {
         $content = $message->content;
         $hiddens .= sprintf('<input type="hidden" name="message_id" value="%d" />', $message->message_id);
     }
     $t = new Am_View();
     $t->assign('content', $content);
     $t->assign('type', $type);
     $t->assign('hiddens', $hiddens);
     $t->assign('ticket_id', $ticket_id);
     return $t->display($this->strategy->getTemplatePath() . '/_reply-form.phtml');
 }