| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- <?php
- Doo::loadCore('db/DooModel');
- class Column extends DooModel {
- public $cid;
- public $title;
- public $c_type;
- public $link;
- public $description;
- public $display;
-
- public $_table = 'sc_column';
- public $_primarykey = 'cid';
- public $_fields = array('cid', 'title', 'c_type', 'link', 'description','display');
- function getColumnById($cid = 0) {
-
- return $this->find ( array ( 'where' => 'cid=' . $cid, 'asArray' => TRUE ) );
- }
-
- function getColumnByIdList($cid = 0) {
-
- return $this->find ( array ( 'where' => 'cid in ( ' . $cid.' )', 'asArray' => TRUE ) );
- }
-
- function getColumnListByType($c_type=1){
-
- $sql = "select * from " . $this->_table . " WHERE `c_type` =" .$c_type;
- $query = Doo::db ()->query ( $sql );
-
- $result = $query->fetchAll ();
-
- return $result;
- }
-
- function getColumnList($data = array(), $condition = "", $limit = ""){
- foreach ( $data as $key => $value ) {
- if (is_numeric ( $value ))
- $condition .= " and " . $key . " = " . $value;
- else
- $condition .= " and " . $key . " like '%" . $value . "%' ";
- }
-
- $condition = ' where 1 ' . $condition . $limit;
-
- $sql = "select * from " . $this->_table . $condition;
-
- $query = Doo::db ()->query ( $sql );
-
- $result = $query->fetchAll ();
-
- return $result;
- }
-
- function deleteColumnByIdList($id){
- $id = implode ( ",", $id );
-
- $sql = "delete from " . $this->_table . " where cid in ( " . $id . " ) and c_type !=1";
-
- Doo::db ()->query ( $sql );
- }
- }
- ?>
|