| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- <?php
- Doo::loadCore ( 'db/DooModel' );
- class Article extends DooModel {
-
- public $aid;
- public $title;
- public $content;
- public $synopsis;
- public $thum;
- public $a_type;
- public $trainingType;
- public $area;
- public $enroll;
-
- public $enroll_title;
-
- public $enroll_obj;
- public $enroll_content;
- public $enroll_fun;
- public $enroll_adrr;
- public $enroll_pay;
- public $enroll_name;
- public $enroll_downdoc;
- public $enroll_mark;
-
-
- public $attachment;
- public $cid;
- public $enroll_time;
- public $time;
- public $update_time;
-
- public $_table = 'sc_article';
- public $_primarykey = 'aid';
- public $_fields = array ('aid', 'title', 'content','synopsis','thum' ,'a_type','trainingType','area','enroll_title', 'enroll','enroll_obj','enroll_content',
- 'enroll_fun','enroll_adrr','enroll_pay','enroll_name','enroll_downdoc','enroll_mark','attachment', 'cid','enroll_time', 'time','update_time' );
-
- function getArticleById($aid = 0) {
-
- return $this->find ( array ('desc' => 'time', 'where' => 'aid=' . $aid, 'asArray' => TRUE ) );
- }
- function getArticleByTrain($trainingType=2){
- return $this->find ( array ('desc' => 'time', 'where' => 'a_type=2 and trainingType='.$trainingType, 'asArray' => TRUE ) );
-
- }
-
- function getArticleByTrainAid($aid){
- return $this->find ( array ('desc' => 'time', 'where' => 'a_type=2 and aid='.$aid, 'asArray' => TRUE ) );
- }
-
- function getArticleByCid($cid = 0,$limit) {
-
- return $this->find ( array ('desc' => 'time', 'limit'=>$limit , 'where' => 'cid=' . $cid, 'asArray' => TRUE ) );
- }
-
- function getArticleByCid3($cid = 0,$limit) {
-
- return $this->find ( array ('desc' => 'update_time', 'limit'=>$limit , 'where' => 'cid=' . $cid, 'asArray' => TRUE ) );
- }
-
- function getArticleByCid2($cid = 0,$limit) {
-
- return $this->find ( array ('desc' => 'update_time', 'limit'=>$limit , 'where' => '(cid=' . $cid .' or cid=3 or cid=7) and title !=""', 'asArray' => TRUE ) );
- }
-
- function getArticleList($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 deleteArticleByIdList($id){
- $id = implode ( ",", $id );
-
- $sql = "delete from " . $this->_table . " where aid in ( " . $id . " )";
-
- Doo::db ()->query ( $sql );
- }
- }
- ?>
|