Example #1
0
 public function SelectCountry($where = '', $all = '')
 {
     if ($where) {
         $where = 'where ' . $where;
     }
     return create_select_options($this->db->query("SELECT id_country as id, country as el FROM country {$where} order by el"), $all);
 }
Example #2
0
 public function SelectBlog($where = '', $all = '')
 {
     if ($where) {
         $where = 'where ' . $where;
     }
     return create_select_options($this->db->query("SELECT id_blog as id, title_es as el FROM blog {$where} order by el"), $all);
 }
Example #3
0
 public function SelectArticleType($where = '', $all = '')
 {
     if ($where) {
         $where = 'where ' . $where;
     }
     return create_select_options($this->db->query("SELECT id_type as id, type as el FROM article_type {$where} order by id"), $all);
 }
Example #4
0
 public function SelectTags($where = '', $all = '')
 {
     if ($where) {
         $where = 'where ' . $where;
     }
     return create_select_options($this->db->query("SELECT id_tag as id, tag_es as el FROM tag {$where} order by el"), $all);
 }
Example #5
0
 public function SelectProjectTickets($all = '')
 {
     return create_select_options($this->db->query("SELECT p.id_project as id, \n    CONCAT(c.client, ' - ', p.project) as el \n    FROM {$this->dbglobal}project p\n    left join {$this->dbglobal}client c on c.id_client = p.id_client\n    left join {$this->dbglobal}project_company s on s.id_project = p.id_project\n    where (s.id_company = '{$this->MApp->user->company}' OR p.id_project = '{$this->MApp->project}') AND (p.finish = '0' OR p.id_project = '{$this->MApp->project}')\n    order by el"), $all);
 }
Example #6
0
 public function BrandsSelect($id = 0, $all = '')
 {
     if ($id) {
         $sql = "select id_brand as id, brand as el from brand where id_category = '{$id}' and active = '1' order by el";
     } else {
         $sql = "select id_brand as id, brand as el from brand where active = '1' order by el";
     }
     return create_select_options($this->db->query($sql), $all);
 }
Example #7
0
 public function SelectTrialState($where = '', $all = '')
 {
     if ($where) {
         $where = 'where ' . $where;
     }
     return create_select_options($this->db->query("SELECT id_state as id, state as el FROM trial_state {$where} order by el"), $all);
 }
Example #8
0
 public function SelectBook($id = 0)
 {
     return create_select_options($this->db->query("SELECT n.id_book as id, n.title as el \n      FROM book n\n      where n.active = 1\n      order by n.date desc"));
 }
                ?>
<span class="label label-xlg label-light arrowed-in-right arrowed-in js-cls-change-text">脏标签:<?php 
                echo $qt["pointtype1"];
                ?>
</span><?php 
            }
            ?>
              <?php 
            if ($field == 'pointtype1' || $qt["smalltype"] == '0') {
                ?>
<select style="width:200px;" class="form-control js-cls-change-options" data-qid="<?php 
                echo $qt["id"];
                ?>
">
                <?php 
                echo create_select_options($qt["bigtype"]);
                ?>
              </select><?php 
            }
            ?>
              </td>
              <td><?php 
            if ($qt["ismock"] == 1) {
                ?>
<span class="label arrowed">真题</span>
                  <?php 
            } else {
                ?>
                  <span class="label label-danger arrowed">模拟</span><?php 
            }
            ?>
Example #10
0
 public function SelectSizeTypeE($where = '', $all = '')
 {
     if ($where) {
         $where = 'where ' . $where;
     }
     return create_select_options($this->db->query("SELECT id_type as id, CONCAT(type,' - ',sizes) as el FROM size_type {$where} order by num"), $all);
 }
Example #11
0
function create_select_options($options, $selected_value)
{
    $options_html = '';
    foreach ($options as $key => $name) {
        // check for optgroup
        if (is_array($name)) {
            $label = $name['optgroup'];
            unset($name['optgroup']);
            $options_html .= '<optgroup label="' . $label . '">';
            // call recursive self to create optgroup options
            $options_html .= create_select_options($name, $selected_value);
        } else {
            $options_html .= '<option value="' . $key . '"';
            if (is_array($selected_value)) {
                foreach ($selected_value as $multi_val) {
                    if ($multi_val == $key) {
                        $selected = $key;
                        $options_html .= ' selected="selected"';
                    }
                }
            }
            if ($selected_value == $key) {
                $selected = $key;
                $options_html .= ' selected="selected"';
            }
            $options_html .= '>' . $name . '</option>';
        }
        // close if optgroup
        if (is_array($name)) {
            $options_html .= '</optgroup>';
        }
    }
    return $options_html;
}