Added browse topics call.

このコミットが含まれているのは:
テクニカル諏訪子 2018-04-10 16:08:44 +09:00
コミット 079a058b29
2個のファイルの変更103行の追加4行の削除

ファイルの表示

@ -528,7 +528,6 @@ class BoardController extends Controller {
}
public function browseForums($id, $from, $to) { // /api/rpc/board/browse/browseforums/id/from/to
// $fors = $this->getForum($id)->toArray();
$fors = $this->getForums($id);
$cols = $this->objUser->getGroupColours()->toArray();
@ -584,8 +583,108 @@ class BoardController extends Controller {
}
public function browseTopics($id, $from, $to) { // /api/rpc/board/browse/browsetopics/id/from/to
public function browseTopics($mode, $id, $from, $to) { // /api/rpc/board/browse/browsetopicsmode/id/from/to
$topsUP = $this->getTopicsUnpinned($id, $from, $to);
$topsPN = $this->getTopicsPinned($id, $from, $to);
$topsUS = $this->getTopicsUser($id, $from, $to);
$cols = $this->objUser->getGroupColours()->toArray();
$tops = null;
if ($mode === 'unpinned') {
$tops = $topsUP;
}
else if ($mode === 'pinned') {
$tops = $topsPN;
}
else if ($mode === 'user') {
$tops = $topsUS;
}
else {
return array(
'error' => 'Invalid mode.'
);
}
$res = array();
foreach($tops as $t) {
$fplp = $this->getFirstAndLastPosts($t->id);
$userFD = $fplp['first']['date'];
$userLD = $fplp['last']['date'];
$userFirst = $this->objUser->getUser($fplp['first']['uid'])->toArray();
$userLast = $this->objUser->getUser($fplp['last']['uid'])->toArray();
$showNameF = "";
$showColF = "";
$showNameL = "";
$showColL = "";
if ($userFirst[0]->display_name !== '') {
$showNameF = $userFirst[0]->display_name;
}
else {
$showNameF = $userFirst[0]->username;
}
if ($userFirst[0]->name_style !== '') {
$showColF = $userFirst[0]->name_style;
}
else {
foreach($cols as $cl) {
if ($cl->id === $userFirst[0]->perm_id) {
if ($userFirst[0]->gender === 1) $showColF = $cl->colour_m;
else if ($userFirst[0]->gender === 2) $showColF = $cl->colour_f;
else $showColF = $cl->colour_u;
}
}
}
if ($userLast[0]->display_name !== '') {
$showNameL = $userLast[0]->display_name;
}
else {
$showNameL = $userLast[0]->username;
}
if ($userLast[0]->name_style !== '') {
$showColL = $userLast[0]->name_style;
}
else {
foreach($cols as $cl) {
if ($cl->id === $userLast[0]->perm_id) {
if ($userLast[0]->gender === 1) $showColL = $cl->colour_m;
else if ($userLast[0]->gender === 2) $showColL = $cl->colour_f;
else $showColL = $cl->colour_u;
}
}
}
$catname = $this->getCategoryName($id);
// Compile.
$res[] = array(
't_id' => $t->id,
't_for_id' => $t->for_id,
't_title' => $t->title,
't_replies' => $t->replies,
't_views' => $t->views,
't_first_date' => strftime('%Y/%m/%d(%a) %H:%M:%S %Z', date($userFD)),
't_last_date' => strftime('%Y/%m/%d(%a) %H:%M:%S %Z', date($userLD)),
't_sticky' => $t->sticky,
't_lock' => $t->lock,
't_poll' => $t->poll,
't_read' => $t->read,
't_lang_id' => $t->lang_id,
'u_first_uid' => $t->started_by,
'u_last_uid' => $t->last_uid,
'u_first_name' => $showNameF,
'u_last_name' => $showNameL,
'u_first_col' => $showColF,
'u_last_col' => $showColL
);
}
return $res;
}
public function browseTopicInfo($tp, $id, $to) { // /api/rpc/board/browse/browsetopicinfo/tp/id/to

ファイルの表示

@ -56,7 +56,7 @@ Route::post('/api/rpc/board/post/undeletepost', 'BoardController@undeletePost');
Route::get('/api/rpc/board/browse/browsecategories', 'BoardController@browseCategories');
Route::get('/api/rpc/board/browse/browseforums/{id}/{from}/{to}', 'BoardController@browseForums');
Route::get('/api/rpc/board/browse/browseforuminfo/{id}/{to}', 'BoardController@browseForumInfo');
Route::get('/api/rpc/board/browse/browsetopics/{id}/{from}/{to}', 'BoardController@browseTopics');
Route::get('/api/rpc/board/browse/browsetopics{mode}/{id}/{from}/{to}', 'BoardController@browseTopics');
Route::get('/api/rpc/board/browse/browsetopicinfo/{tp}/{id}/{to}', 'BoardController@browseTopicInfo');
Route::get('/api/rpc/board/browse/browsetopicposts/{tp}/{id}/{from}/{to}', 'BoardController@browseTopicPosts');
Route::get('/api/rpc/board/browse/browsepermissions/{uid}', 'BoardController@browsePermissions');