public function getLatest($begin = 0, $limit = 20) { global $db; $q = "SELECT * FROM {$this->table_name} ORDER BY wall_timestamp DESC LIMIT {$begin},{$limit}"; $muridkelas = $db->query($q, 2); $newMurid = array(); $classname = get_called_class(); foreach ($muridkelas as $databasemurid) { $m = new SchoolWall(); $m->fill(toRow($databasemurid)); $newMurid[] = $m; } return $newMurid; }
public function delete() { $wid = isset($_POST['id']) ? addslashes($_POST['id']) : ''; $typ = isset($_POST['typ']) ? addslashes($_POST['typ']) : ''; if ($wid == "") { die('ID empty'); } if ($typ == '') { die('Type empty'); } $json['bool'] = 0; if ($typ == "kelas") { $wallmurid = new MuridWall(); } if ($typ == "school") { $wallmurid = new SchoolWall(); } //load $wallmurid->getByID($wid); if ($wallmurid->wall_from == Account::getMyID()) { $json['bool'] = $wallmurid->delete($wid); } else { $json['err'] = Lang::t('Not Authorize'); } die(json_encode($json)); }