function fetch_control_no_read() { $select = new database_select(); $select->from($this->name, array('id', 'title', 'style')); $select->where(array('`is_read` = ?' => 0, '`menu` = ?' => 0)); $select->order('date'); $select->limit(50); return $this->adapter->fetch_all($select); }
function fetch_list($w = array()) { $select = new database_select(); $select->from(array('i' => $this->name)); if (@(string) $w['id']) { $select->where('stitle', (string) $w['id']); } return $select; }
function fetch_role_title_by_role($rule) { $mr = new model_crole(); $select = new database_select(); $select->from(array('i' => $this->name), array('r.title')); $select->join(array('r' => $mr->name), 'r.id = i.role', ''); $select->where(array('i.parentid' => $rule)); $select->order('r.title'); $select->group('r.id'); return $this->adapter->fetch_col($select); }
function fetch_control_list($where = null, $order = null, $count = null, $offset = null) { $select = new database_select(null, $this->adapter); $select->from($this->name); if ($where) { $select->where($where); } if ($order) { $select->order($order); } if ($count) { $select->limit($count, $offset); } return $select; }
function finished_quant($oid = null, $id = null) { $select = new database_select(); $select->from(array('i' => $this->_model_order_item->name), array('quant' => '(SUM(i.quant))'))->join(array('o' => $this->_model_order->name), 'o.id = i.parentid', '')->where('o.id = ?', $oid)->group('o.id'); if ($id != null) { $select->where('i.' . $this->_field_order_item_id . ' = ?', $id); } return (int) $this->_model_order_item->adapter->fetch_one($select); }