Esempio n. 1
0
 public static function getAllByPopular()
 {
     //		$sql = "select * from ".self::$tablename;
     $sql = "select *,count(*) as total from " . self::$tablename . " group by channel_id limit 10";
     $query = Executor::doit($sql);
     return Model::many($query[0], new FollowerData());
 }
Esempio n. 2
0
 public static function one_object($sql)
 {
     $query = Executor::doit($sql);
     $cnt = 0;
     $found = null;
     $data = null;
     while ($r = $query[0]->fetch_object()) {
         $data = $r;
         $found = $data;
         break;
     }
     return $found;
 }
Esempio n. 3
0
 public static function getByName($name)
 {
     $sql = "select * from " . self::$tablename . " where name=\"{$name}\"";
     $query = Executor::doit($sql);
     $found = null;
     $data = new StatusData();
     while ($r = $query->fetch_array()) {
         $data->id = $r['id'];
         $data->name = $r['name'];
         $found = $data;
         break;
     }
     return $found;
 }
Esempio n. 4
0
 public static function getAll()
 {
     $sql = "select * from " . self::$tablename;
     $query = Executor::doit($sql);
     $array = array();
     $cnt = 0;
     while ($r = $query->fetch_array()) {
         $array[$cnt] = new UserTypeData();
         $array[$cnt]->id = $r['id'];
         $array[$cnt]->name = $r['name'];
         $cnt++;
     }
     return $array;
 }
Esempio n. 5
0
 public static function getLike($q)
 {
     $sql = "select * from " . self::$tablename . " where name like '%{$q}%'";
     $query = Executor::doit($sql);
     $array = array();
     $cnt = 0;
     while ($r = $query[0]->fetch_array()) {
         $array[$cnt] = new BoxData();
         $array[$cnt]->id = $r['id'];
         $array[$cnt]->created_at = $r['created_at'];
         $cnt++;
     }
     return $array;
 }
Esempio n. 6
0
 public static function getAll()
 {
     $sql = "select * from " . self::$tablename . " order by created_at desc";
     $query = Executor::doit($sql);
     $array = array();
     $cnt = 0;
     while ($r = $query[0]->fetch_array()) {
         $array[$cnt] = new OperationTypeData();
         $array[$cnt]->id = $r['id'];
         $array[$cnt]->name = $r['name'];
         $cnt++;
     }
     return $array;
 }
Esempio n. 7
0
 public static function getAll()
 {
     $sql = "select * from " . self::$tablename . " order by created_at desc";
     $query = Executor::doit($sql);
     $array = array();
     $cnt = 0;
     while ($r = $query->fetch_array()) {
         $array[$cnt] = new AlbumImageData();
         $array[$cnt]->album_id = $r['album_id'];
         $array[$cnt]->image_id = $r['image_id'];
         $array[$cnt]->created_at = $r['created_at'];
         $cnt++;
     }
     return $array;
 }
Esempio n. 8
0
 public static function getAll()
 {
     $sql = "select * from " . self::$tablename . "";
     $query = Executor::doit($sql);
     $array = array();
     $cnt = 0;
     while ($r = $query[0]->fetch_array()) {
         $array[$cnt] = new ThemeData();
         $array[$cnt]->id = $r['id'];
         $array[$cnt]->name = $r['name'];
         $array[$cnt]->header_background_color = $r['header_background_color'];
         $array[$cnt]->header_text_color = $r['header_text_color'];
         $array[$cnt]->body_background_color = $r['body_background_color'];
         $array[$cnt]->body_text_color = $r['body_text_color'];
         $cnt++;
     }
     return $array;
 }
Esempio n. 9
0
 public static function getAllBySlideId($slide_id)
 {
     $sql = "select * from " . self::$tablename . " where slide_id={$slide_id} order by created_at desc";
     $query = Executor::doit($sql);
     $array = array();
     $cnt = 0;
     while ($r = $query[0]->fetch_array()) {
         $array[$cnt] = new LoveData();
         $array[$cnt]->id = $r['id'];
         $array[$cnt]->slide_id = $r['slide_id'];
         $array[$cnt]->user_id = $r['user_id'];
         $array[$cnt]->created_at = $r['created_at'];
         $cnt++;
     }
     return $array;
 }
Esempio n. 10
0
 public static function getAll()
 {
     $sql = "select * from " . self::$tablename . " order by created_at desc";
     $query = Executor::doit($sql);
     $array = array();
     $cnt = 0;
     while ($r = $query->fetch_array()) {
         $array[$cnt] = new AlbumData();
         $array[$cnt]->id = $r['id'];
         $array[$cnt]->name = $r['name'];
         $array[$cnt]->title = $r['title'];
         $array[$cnt]->description = $r['description'];
         $array[$cnt]->tags = $r['tags'];
         $array[$cnt]->channel_id = $r['channel_id'];
         $array[$cnt]->category_id = $r['category_id'];
         $array[$cnt]->privacy_id = $r['privacy_id'];
         $array[$cnt]->created_at = $r['created_at'];
         $cnt++;
     }
     return $array;
 }
Esempio n. 11
0
 public static function getAllByUserId($user_id)
 {
     $sql = "select * from " . self::$tablename . " where user_id={$user_id} order by created_at desc";
     $query = Executor::doit($sql);
     $array = array();
     $cnt = 0;
     while ($r = $query[0]->fetch_array()) {
         $array[$cnt] = new ProductData();
         $array[$cnt]->id = $r['id'];
         $array[$cnt]->name = $r['name'];
         $array[$cnt]->price_in = $r['price_in'];
         $array[$cnt]->price_out = $r['price_out'];
         $array[$cnt]->presentation = $r['presentation'];
         $array[$cnt]->unit = $r['unit'];
         $array[$cnt]->user_id = $r['user_id'];
         $array[$cnt]->created_at = $r['created_at'];
         $cnt++;
     }
     return $array;
 }
Esempio n. 12
0
 public static function getLike($q)
 {
     $sql = "select * from " . self::$tablename . " inner join profile on (user.id=profile.user_id) where name like '%{$q}%' or lastname like '%{$q}%' ";
     $query = Executor::doit($sql);
     return Model::many($query[0], new UserData());
 }
Esempio n. 13
0
 public static function getAll()
 {
     $sql = "select * from " . self::$tablename;
     $query = Executor::doit($sql);
     return Model::one($query[0], new NotificationTypeData());
 }
Esempio n. 14
0
 public static function getLike($q)
 {
     $sql = "select * from " . self::$tablename . " where title like '%{$q}%' or content like '%{$q}%'";
     $query = Executor::doit($sql);
     $array = array();
     $cnt = 0;
     while ($r = $query[0]->fetch_array()) {
         $array[$cnt] = new PostData();
         $array[$cnt]->id = $r['id'];
         $array[$cnt]->title = $r['title'];
         $array[$cnt]->content = $r['content'];
         $array[$cnt]->image = $r['image'];
         $array[$cnt]->is_public = $r['is_public'];
         $array[$cnt]->user_id = $r['user_id'];
         $array[$cnt]->created_at = $r['created_at'];
         $cnt++;
     }
     return $array;
 }
Esempio n. 15
0
 public static function getLast5ByChannelId($channel_id)
 {
     $sql = "select * from " . self::$tablename . " where channel_id={$channel_id} order by created_at desc limit 5";
     $query = Executor::doit($sql);
     return Model::many($query[0], new NotificationData());
 }
Esempio n. 16
0
 public static function getAllAppliedByPage($start_from, $limit)
 {
     $sql = "select * from " . self::$tablename . " where id<={$start_from} and is_applied=1 limit {$limit}";
     $query = Executor::doit($sql);
     $array = array();
     $cnt = 0;
     while ($r = $query[0]->fetch_array()) {
         $array[$cnt] = new SellData();
         $array[$cnt]->id = $r['id'];
         $array[$cnt]->mesero_id = $r['mesero_id'];
         $array[$cnt]->cajero_id = $r['cajero_id'];
         $array[$cnt]->mesa = $r['mesa'];
         $array[$cnt]->is_applied = $r['is_applied'];
         $array[$cnt]->created_at = $r['created_at'];
         $cnt++;
     }
     return $array;
 }
Esempio n. 17
0
 public static function getInputByProductIdCutIdYesF($product_id, $cut_id)
 {
     $sql = "select * from " . self::$tablename . " where product_id={$product_id} and cut_id={$cut_id} and operation_type_id=1 order by created_at desc";
     $query = Executor::doit($sql);
     return Model::many($query[0], new OperationData());
 }
Esempio n. 18
0
 public static function getInputByProductIdCutIdNoF($product_id, $cut_id)
 {
     $sql = "select * from " . self::$tablename . " where product_id={$product_id} and cut_id={$cut_id} and is_oficial=0 and operation_type_id=1 order by created_at desc";
     $query = Executor::doit($sql);
     $array = array();
     $cnt = 0;
     while ($r = $query[0]->fetch_array()) {
         $array[$cnt] = new OperationData();
         $array[$cnt]->id = $r['id'];
         $array[$cnt]->product_id = $r['product_id'];
         $array[$cnt]->q = $r['q'];
         $array[$cnt]->is_oficial = $r['is_oficial'];
         $array[$cnt]->cut_id = $r['cut_id'];
         $array[$cnt]->operation_type_id = $r['operation_type_id'];
         $array[$cnt]->created_at = $r['created_at'];
         $cnt++;
     }
     return $array;
 }
Esempio n. 19
0
 public static function getAllByUserId($user_id)
 {
     $sql = "select * from " . self::$tablename . " where user_id={$user_id}";
     $query = Executor::doit($sql);
     $array = array();
     $cnt = 0;
     while ($r = $query[0]->fetch_array()) {
         $array[$cnt] = new InvitationData();
         $array[$cnt]->id = $r['id'];
         $array[$cnt]->the_key = $r['the_key'];
         $array[$cnt]->is_used = $r['is_used'];
         $array[$cnt]->email = $r['email'];
         $array[$cnt]->user_id = $r['user_id'];
         $array[$cnt]->created_at = $r['created_at'];
         $cnt++;
     }
     return $array;
 }
Esempio n. 20
0
 public static function getAllByUserId($user)
 {
     $sql = "select * from " . self::$tablename . " where user_id=" . $user;
     $query = Executor::doit($sql);
     return Model::many($query[0], new CommentData());
 }
Esempio n. 21
0
 public static function getAllByUserId($user_id)
 {
     $sql = "select * from " . self::$tablename . " where user_id={$user_id} order by created_at desc";
     $query = Executor::doit($sql);
     return Model::many($query[0], new ProductData());
 }
Esempio n. 22
0
 public static function getAllByPage($start_from, $limit)
 {
     $sql = "select * from " . self::$tablename . " where id>={$start_from} limit {$limit}";
     $query = Executor::doit($sql);
     $array = array();
     $cnt = 0;
     while ($r = $query[0]->fetch_array()) {
         $array[$cnt] = new CutData();
         $array[$cnt]->id = $r['id'];
         $array[$cnt]->finished_at = $r['finished_at'];
         $array[$cnt]->created_at = $r['created_at'];
         $cnt++;
     }
     return $array;
 }
Esempio n. 23
0
 public static function getAllUnActive()
 {
     $sql = "select * from " . self::$tablename . " where is_active=0";
     $query = Executor::doit($sql);
     $array = array();
     $cnt = 0;
     while ($r = $query[0]->fetch_array()) {
         $array[$cnt] = new ItemData();
         $array[$cnt]->id = $r['id'];
         $array[$cnt]->name = $r['name'];
         $cnt++;
     }
     return $array;
 }
Esempio n. 24
0
 public static function getAllLikeName($username)
 {
     $sql = "select * from " . self::$tablename . " where name like '%{$username}%'";
     $query = Executor::doit($sql);
     $array = array();
     $cnt = 0;
     while ($r = $query->fetch_array()) {
         $array[$cnt] = new UserData();
         $array[$cnt]->id = $r['id'];
         $array[$cnt]->nick = $r['nick'];
         $array[$cnt]->name = $r['name'];
         $array[$cnt]->mail = $r['mail'];
         $array[$cnt]->image = $r['image'];
         $array[$cnt]->password = $r['password'];
         $array[$cnt]->usertype_id = UserTypeData::getById($r['usertype_id']);
         $array[$cnt]->status_id = StatusData::getById($r['status_id']);
         $array[$cnt]->is_admin = $r['is_admin'];
         $array[$cnt]->is_verified = $r['is_verified'];
         $array[$cnt]->created_at = $r['created_at'];
         $cnt++;
     }
     return $array;
 }
Esempio n. 25
0
 function delete($where)
 {
     $this->sql = "delete from " . $this->tablename . " where {$where}";
     return Executor::doit($this->sql);
 }
Esempio n. 26
0
 public static function getAllByUID($author_id)
 {
     $sql = "select * from " . self::$tablename . " where author_id=" . $author_id . " order by created_at desc";
     $query = Executor::doit($sql);
     $array = array();
     $cnt = 0;
     while ($r = $query->fetch_array()) {
         $array[$cnt] = new TipData();
         $array[$cnt]->id = $r['id'];
         $array[$cnt]->title = $r['title'];
         $array[$cnt]->content = $r['content'];
         $array[$cnt]->author_id = $r['author_id'];
         $array[$cnt]->tags = $r['tags'];
         $array[$cnt]->created_at = $r['created_at'];
         $array[$cnt]->is_public = $r['is_public'];
         $cnt++;
     }
     return $array;
 }
Esempio n. 27
0
 public static function getLike($q)
 {
     $sql = "select * from " . self::$tablename . " where name like '%{$q}%'";
     $query = Executor::doit($sql);
     return Model::many($query[0], new BlockData());
 }
Esempio n. 28
0
 public static function getAllAppliedByPage($start_from, $limit)
 {
     $sql = "select * from " . self::$tablename . " where id<={$start_from} and is_applied=1 limit {$limit}";
     $query = Executor::doit($sql);
     return Model::many($query[0], new SellData());
 }
Esempio n. 29
0
 public static function getPublics()
 {
     $sql = "select * from " . self::$tablename . " where is_public=1";
     $query = Executor::doit($sql);
     return Model::many($query[0], new StatusData());
 }
Esempio n. 30
0
 public static function getAllByUID($uid)
 {
     $sql = "select * from " . self::$tablename . " where user_id={$uid}";
     $query = Executor::doit($sql);
     return Model::many($query[0], new ChannelData());
 }