Exemplo n.º 1
0
 function getList($cols, $filter = '', $start = 0, $limit = 20, $orderType = null)
 {
     $rows = parent::getList($cols, $filter, $start, $limit, $orderType);
     foreach ($rows as $k => $v) {
         $rows[$k]['name'] .= ' ' . stripslashes($v['pdt_desc']);
     }
     return $rows;
 }
Exemplo n.º 2
0
 function getList($cols, $filter = '', $start = 0, $limit = 20, &$count, $orderType = null)
 {
     return parent::getList(str_replace('roles', 'op_id as roles', $cols), $filter, $start, $limit, $count, $orderType);
 }
Exemplo n.º 3
0
 function getList($Cols, $filter, $nStart = 0, $nLimit = null, &$count, $orderByType)
 {
     $attr_id = "";
     $searchcountd = 0;
     if (!strstr('member_id', $Cols)) {
         $Cols .= ',member_id ';
     }
     //处理单个搜索
     if (is_array($filter)) {
         foreach ($filter as $k => $v) {
             $searchtmpdate = explode('___', $k);
             if (is_numeric($k)) {
                 $attr_id = $k;
                 $findvalue = $v;
             }
             //处理多个搜索
             if (count($searchtmpdate) == 2 && !in_array('_ANY_', $v)) {
                 $searchoption[$searchcountd]['key'] = $searchtmpdate[1];
                 $searchoption[$searchcountd]['value'] = $v;
                 $searchcountd++;
             }
         }
     }
     $tmpcols = explode(",", $Cols);
     foreach ($tmpcols as $key => $value) {
         if (strstr($value, 'attr__')) {
             $new = explode('__', $value);
             $custom[] = $new[1];
         } else {
             $nowcols[] = $value;
         }
     }
     $Cols = implode(",", $nowcols);
     if (preg_match('/__+/', $orderByType[0])) {
         $t_attr_id = explode("__", $orderByType[0]);
         $exc_sql = "SELECT a.member_id,b.value FROM sdb_members a LEFT JOIN sdb_member_mattrvalue b ON a.member_id = b.member_id WHERE b.attr_id";
         $exc_sql .= "='" . $t_attr_id[1] . "' ORDER BY b.value " . $orderByType[1];
         $tmppdata = $this->db->select($exc_sql);
         foreach ($tmppdata as $k => $v) {
             if ($v['value'] != "") {
                 $tmpmid[] = $tmppdata[$k]['member_id'];
             }
         }
         if ($orderby[1] == 'desc') {
             krsort($tmpmid);
         }
         $orderByType[0] = "FIELD(member_id," . implode(",", $tmpmid) . ")";
     }
     $list = parent::getList($Cols, $filter, $nStart, $nLimit, $count, $orderByType);
     foreach ($list as $k => $v) {
         foreach ($custom as $tk => $tv) {
             $data = $this->getattrvalue($v['member_id'], $tv);
             if (count($data <= 1)) {
                 $list[$k]['attr__' . $tv] = $data[0]['value'];
                 $selsql = "select attr_type from sdb_member_attr where attr_id = " . $tv . "";
                 $tmpdata = $this->db->select($selsql);
                 if ($tmpdata[0]['attr_type'] == 'cal' && $data[0]['value'] != "") {
                     $list[$k]['attr__' . $tv] = date('Y-m-d', $data[0]['value']);
                 }
             } else {
                 foreach ($data as $tpk => $tpv) {
                     if ($tpv['value'] != "") {
                         $list[$k]['attr__' . $tv] .= $tpv['value'] . ";";
                     }
                 }
             }
         }
     }
     //过滤自定义搜索
     if ($attr_id != '' && $findvalue != '') {
         foreach ($list as $k => $v) {
             $data = $this->getattrvalue($v['member_id'], $attr_id);
             if (!strstr($data[0]['value'], $findvalue)) {
                 $delete[] = $k;
             }
         }
         foreach ($delete as $k => $v) {
             unset($list[$v]);
         }
     }
     if (isset($searchoption)) {
         foreach ($list as $k => $v) {
             foreach ($searchoption as $tk => $tv) {
                 $tmpvalue = $tv['value'];
                 foreach ($tmpvalue as $ttk => $ttv) {
                     $countdata = $this->getallattrvalue($v['member_id'], $tv['key'], $ttv);
                     if (count($countdata) == 0) {
                         $deletenow[] = $k;
                     }
                 }
             }
         }
     }
     foreach ($deletenow as $k => $v) {
         unset($list[$v]);
     }
     return $list;
 }
Exemplo n.º 4
0
 function getList($cols, $filter = '', $start = 0, $limit = 20, $orderType = null)
 {
     if ($cols == '*') {
         $table = substr($this->tableName, 4);
         $define = (require CORE_DIR . '/schemas/' . $table . '.php');
         $keyarray = array_keys($db[$table]['columns']);
         $cols = implode(',', $keyarray);
     }
     $tmpcols = explode(',', $cols);
     $nowcols = array('member_id');
     //最少也要搜索一个member_id
     foreach ($tmpcols as $key => $value) {
         if (substr($value, 0, 6) == 'attr__') {
             $custom[] = substr($value, 6);
         } else {
             $nowcols[] = $value;
         }
     }
     if (preg_match('/__+/', $orderType[0])) {
         $t_attr_id = explode("__", $orderType[0]);
         $exc_sql = "SELECT a.member_id,b.value FROM sdb_members a LEFT JOIN sdb_member_mattrvalue b ON a.member_id = b.member_id WHERE b.attr_id";
         $exc_sql .= "='" . $t_attr_id[1] . "' ORDER BY b.value " . $orderType[1];
         $tmppdata = $this->db->select($exc_sql);
         foreach ($tmppdata as $k => $v) {
             if ($v['value'] != "") {
                 $tmpmid[] = $tmppdata[$k]['member_id'];
             }
         }
         if ($orderType[1] == 'desc') {
             krsort($tmpmid);
         }
         $orderType[0] = "FIELD(member_id," . implode(",", $tmpmid) . ")";
     }
     $cols = implode(",", $nowcols);
     $list = parent::getList($cols, $filter, $start, $limit, $orderType);
     if ($custom) {
         $map = array();
         $rows = $this->db->select('select mm.member_id,mm.value,mm.attr_id,ma.attr_type from sdb_member_mattrvalue mm left join sdb_member_attr ma on mm.attr_id = ma.attr_id where mm.attr_id in (' . implode(',', $custom) . ')');
         foreach ($rows as $r) {
             if ($r['attr_type'] == 'checkbox') {
                 $date = $this->getattrvalue($r['member_id'], $r['attr_id']);
                 $map[$r['member_id']]['attr__' . $r['attr_id']] = '';
                 foreach ($date as $k => $v) {
                     $map[$r['member_id']]['attr__' . $r['attr_id']] .= $date[$k]['value'] . ';';
                 }
             } else {
                 $map[$r['member_id']]['attr__' . $r['attr_id']] = $r['value'];
             }
         }
         foreach ($list as $k => $r) {
             if (isset($map[$r['member_id']])) {
                 $list[$k] = array_merge($r, $map[$r['member_id']]);
             }
         }
     }
     return $list;
 }