public function actionGetfollowerpost() { $check_post = 0; $id = $_POST['id']; $follow = new Follow(); $follow->studentID = $id; $model = array(); $model = Follow::findAll(['studentID' => $id]); $status = array(); $statuss = array(); if ($model == Null) { $status["status"] = "faild"; $statuss["status"] = "null"; } else { $status["status"] = "ok"; $statuss["status"] = "ok"; for ($j = 0; $j < sizeof($model); $j++) { $status["follower"][$j] = $model[$j]->staffID; } $i = 0; $m = 0; $k = 0; for ($i = 0; $i < sizeof($model); $i++) { $staff_id = $model[$i]->staffID; $posts = array(); $posts = Post::findAll(['owner' => $staff_id]); if ($posts == Null) { //$statuss["status"]="faild"; $check_post++; } else { $status["status"] = "ok"; $statuss["status"] = "ok"; for ($m = 0; $m < sizeof($posts); $m++) { $name = ""; $statuss["content"][$k] = $posts[$m]->content; //=$posts[$m] ->content; $statuss["owner"][$k] = $posts[$m]->owner; $name = StaffController::GetStaffName($statuss["owner"][$k]); $statuss["name"][$k] = $name; $statuss["time"][$k] = $posts[$m]->time; $k++; } //$k += sizeof($posts); } } } if ($check_post == sizeof($model)) { $statuss["post"] = "null"; } else { $statuss["post"] = "full"; } return json_encode($statuss); }