case 'all': default: $song_list_type = 'all'; break; } $song_god_obj = new LMSongGod(); if (isset($_GET['search_query']) && !empty($_GET['search_query'])) { $song_list = $song_god_obj->search($_GET['search_query']); } else { $song_list = $song_god_obj->getList($song_list_type, $offset, $length); } require SITE_ROOT."/ajax-action/SongActionView/song-list.php"; unset($song_god_obj); ?> </tbody> </table> <?php if (!isset($_GET['search_query']) || empty($_GET['search_query'])) { ?> <div id="song-show-more" class="show-more margin-top-1">
/** * Dispatch get actions * * @param array $segments Method segments indicate action and resource * * @return void */ public function restGet($segments) { $action_id = $segments[0]; switch ($action_id) { case 'get-song-audio-td': $validate_song_id = LMValidateHelper::validateNoEmpty($_GET['song_id']); if (!$validate_song_id) { $type = 'not_exist_value'; $parameter = array("none" => "none"); $error_messanger = new LMErrorMessenger($type, $parameter); $error_messanger->printErrorJSON(); unset($error_messanger); } else { $song_id = $_GET['song_id']; require SITE_ROOT . "/ajax-action/SongActionView/song-audio-td.php"; } break; case 'song-list': $offset = $_GET['offset']; if (!LMValidateHelper::validateNoEmpty($offset)) { $offset = 0; } $length = $_GET['length']; if (!LMValidateHelper::validateNoEmpty($length)) { $length = 33; } switch ($_GET['song_list_type']) { case 'audio': $song_list_type = 'audio'; break; case 'no-audio': $song_list_type = 'no-audio'; break; case 'all': default: $song_list_type = 'all'; break; } $song_god_obj = new LMSongGod(); $song_list = $song_god_obj->getList($song_list_type, $offset, $length); require SITE_ROOT . "/ajax-action/SongActionView/song-list.php"; unset($song_god_obj); break; default: $type = 'page_not_found'; $parameter = array("none" => "none"); $error_messanger = new LMErrorMessenger($type, $parameter); $error_messanger->printErrorJSON(); unset($error_messanger); break; } }