public static String[] getAllCourses(String company_id) {
    List<String> lsAllCourse = new ArrayList<String>();

    for (Item topItem : Item.getTopItems()) {
      java.util.List<Item> lsItem = topItem.getChildren();
      for (Item item : lsItem) {
        if (JUtil.convertNull(item.getCompany_id()).length() > 0
            && !item.getCompany_id().equals(company_id)) continue;

        lsAllCourse.add(item.getItem_name());
      }
    }
    String[] arrAllCourse = new String[lsAllCourse.size()];
    lsAllCourse.toArray(arrAllCourse);

    return arrAllCourse;
  }
  /**
   * 生产checkbox html代码
   *
   * @param chkName checkbox 名字
   * @param checkedValues 以,分隔
   * @param lineValues 一行显示多少个checkbox 0所有
   * @return
   */
  public static String getCheckHtml(
      String company_id, String chkName, List<String> lsChkValues, int lineValues) {
    int showValues = 0; // 已经显示checkbox 数量 断行后 重新计数
    int width = 110;
    String item_id = null;
    String item_name = null;
    StringBuffer buf = new StringBuffer(64);

    buf.append(
        "<table cellspacing='1' cellpadding='2' border='0' class='TblClass' style='width:100%'>\r\n");
    for (Item topItem : Item.getTopItems()) {
      showValues = 0;
      width = 110;
      if (topItem.getItem_state() == 0) continue;

      if (topItem.getItem_id().equals("3")) {
        // continue;
      }

      if (topItem.getItem_id().equals("4") && !company_id.equals("xt_qd")) continue;

      if (topItem.getItem_id().equals("5") && !company_id.equals("xt_kpl")) continue;

      if (topItem.getItem_id().equals("6") && !company_id.equals("xt_sz")) continue;

      if (topItem.getItem_code().equals("PERSONAL")) {
        if (company_id.equals("xiaen")) {
          topItem = Item.getItemByCode("PERSONAL.JF");
        } else {
          topItem = Item.getItemByCode("PERSONAL.CGKS");
        }
      }
      if (topItem.getItem_code().equals("PERSONAL.JF")
          || topItem.getItem_code().equals("PERSONAL.CGKS")
          || topItem.getItem_code().equals("PERSONAL")) {
        int rowIndex = 1;
        buf.append(
            "<tr height='25px'><td align=\"right\" class=\"DetailBar\" width=80 rowspan="
                + topItem.getChildren().size()
                + ">"
                + topItem.getItem_name()
                + "</td>\r\n");
        for (Item item1 : topItem.getChildren()) {
          if (item1.getItem_state() == 0) continue;

          if (rowIndex == 1) {
            buf.append("<td align='right' class='DetailBar'>" + item1.getItem_name() + "</td>\r\n");
          } else {
            buf.append(
                "<tr><td align='right' class='DetailBar'>" + item1.getItem_name() + "</td>\r\n");
          }

          java.util.List<Item> lsItem = item1.getChildren();
          buf.append("<td class='DetailBar' style='width:560px'>");

          for (Item item : lsItem) {
            boolean bChecked = false;
            if (item.getItem_state() == 0) continue;

            item_id = item.getItem_id();
            item_name = item.getItem_name();
            for (int idx = 0; lsChkValues != null && idx < lsChkValues.size(); idx++) {
              String val = lsChkValues.get(idx);
              if (val.equals(item_id)) {
                bChecked = true;
                lsChkValues.remove(idx);
                break;
              }
            }
            buf.append(
                "  <span style=\"width:"
                    + width
                    + "px\"><input type='checkbox' name='"
                    + chkName
                    + "' showName='"
                    + item_name
                    + "' value='"
                    + item_id
                    + "'");
            if (bChecked) buf.append(" checked");
            buf.append(">" + item_name + "</input></span>");
            showValues++;
            if (lineValues > 0 && showValues == lineValues) {
              buf.append("<br>");
              showValues = 0;
            }
          }
          buf.append("</td></tr>\r\n");
          rowIndex++;
        }

      } else {
        boolean has_child = false;
        java.util.List<Item> lsItem = topItem.getChildren();
        for (Item item : lsItem) {
          if (!topItem.getItem_id().equals("3")) {
            has_child = true;
            break;
          }
          if (JUtil.convertNull(item.getCompany_id()).length() > 0
              && item.getCompany_id().equals(company_id)) {
            has_child = true;
            break;
          }
        }

        if (has_child) {
          buf.append(
              "<tr><td align=\"right\" class=\"DetailBar\" width=80>"
                  + topItem.getItem_name()
                  + "</td>\r\n");
          buf.append("<td class=\"DetailBar\" colspan=2>");
          for (Item item : lsItem) {
            boolean bChecked = false;
            item_id = item.getItem_id();
            item_name = item.getItem_name();

            if (JUtil.convertNull(item.getCompany_id()).length() > 0
                && !item.getCompany_id().equals(company_id)) continue;
            for (int idx = 0; lsChkValues != null && idx < lsChkValues.size(); idx++) {
              String val = lsChkValues.get(idx);
              if (val.equals(item_id)) {
                bChecked = true;
                lsChkValues.remove(idx);
                break;
              }
            }
            buf.append(
                "  <span style=\"width:"
                    + width
                    + "px\"><input type='checkbox' name='"
                    + chkName
                    + "' value='"
                    + item_id
                    + "'");
            if (bChecked) buf.append(" checked");
            buf.append(">" + item_name + "</input></span>");
            showValues++;
            if (lineValues > 0 && showValues == lineValues) {
              buf.append("<br>");
              showValues = 0;
            }
          }
          buf.append("</td></tr>\r\n");
        }
      }
    }
    buf.append("</table>");
    /*
    for(int i=0; ls!=null&&i< ls.size(); i++)
    {
    	String szCourse = ls.get(i);
    	if( szCourse.length() ==0) continue;

    	buf.append("  <input type='checkbox' name='" + chkName + "' value='" + szCourse+ "'" );
    	buf.append(" checked>" + szCourse + "</input>");

    	showValues ++;
    	if( lineValues >0 && showValues  == lineValues){buf.append("<br>"); showValues =0;}
    }*/

    return buf.toString();
  }