Example #1
0
 /**
  * @since version 0.90
  *
  * @param $tickets_id
  * @param $action         (default 'add')
  **/
 static function getSplittedSubmitButtonHtml($tickets_id, $action = "add")
 {
     $locale = _sx('button', 'Add');
     if ($action == 'update') {
         $locale = _x('button', 'Save');
     }
     $ticket = new self();
     $ticket->getFromDB($tickets_id);
     $ticket_users = $ticket->getTicketActors();
     $actor_type = $ticket_users[Session::getLoginUserID()];
     $all_status = Ticket::getAllowedStatusArray($ticket->fields['status']);
     $html = "<div class='x-split-button' id='x-split-button'>\n               <input type='submit' value='{$locale}' name='{$action}' class='x-button x-button-main'>\n               <span class='x-button x-button-drop'>&nbsp;</span>\n               <ul class='x-button-drop-menu'>";
     foreach ($all_status as $status_key => $status_label) {
         $checked = "";
         if ($status_key == $ticket->fields['status']) {
             $checked = "checked='checked'";
         }
         $html .= "<li>";
         $html .= "<input type='radio' id='status_radio_{$status_key}' name='_status'\n                    {$checked} value='{$status_key}'>";
         $html .= "<label for='status_radio_{$status_key}'>";
         $html .= "<img src='" . Ticket::getStatusIconURL($status_key) . "' />&nbsp;";
         $html .= $status_label;
         $html .= "</label>";
         $html .= "</li>";
     }
     $html .= "</ul></div>";
     $html .= "<script type='text/javascript'>split_button();</script>";
     return $html;
 }