예제 #1
0
 private function read_collection()
 {
     if (static::STRICT === 'MEDIUM') {
         $like = mb_substr(implode('%', preg_split('//u', $_GET['searchValue'])), 1);
     } else {
         if (static::STRICT === 'LESS' or count(static::$SEARCH) > 1) {
             $like = implode('%', preg_split('//u', $_GET['searchValue']));
         } else {
             if (static::STRICT === 'STRICT') {
                 $like = $_GET['searchValue'] . '%';
             } else {
                 if (static::STRICT === 'FULL') {
                     $like = $_GET['searchValue'];
                 } else {
                     $like = '%';
                 }
             }
         }
     }
     $where = static::$SEARCH[0] . $this->like . "'{$like}'";
     for ($i = 1; $i < count(static::$SEARCH); $i++) {
         $where .= " or " . static::$SEARCH[$i] . $this->like . "'{$like}'";
     }
     if (isset($_GET['filter'])) {
         $where = "({$where})";
         foreach ($_GET['filter'] as $key => $value) {
             $where .= " and \"{$key}\"='" . escape_string($value) . "'";
         }
     }
     parent::_read_collection(array(static::ID, static::DISPLAY_LIST, static::DISPLAY_VALUE), true, implode(',', static::$SEARCH), $where, $_GET['limit'], ($_GET['limit'] - 1) * $_GET['page'], 'backbone:combobox:item:undefined');
 }