/** * Album detail * * @access public * @params integer * @return Response */ public function action_detail($id = null) { $id = (int) $id; $album = Model_Album::check_authority($id, null, 'member'); $this->check_browse_authority($album->public_flag, $album->member_id); // 既読処理 if (\Auth::check()) { $this->change_notice_status2read($this->u->id, 'album', $id); } $disabled_to_update = \Album\Site_Util::check_album_disabled_to_update($album->foreign_table); list($limit, $page) = $this->common_get_pager_list_params(\Config::get('articles.limit'), \Config::get('articles.limit_max')); $data = Model_AlbumImage::get_pager_list(array('related' => array('album'), 'where' => \Site_Model::get_where_params4list(0, \Auth::check() ? $this->u->id : 0, $this->check_is_mypage($album->member_id), array(array('album_id', $id))), 'limit' => $limit, 'order_by' => array('id' => 'desc')), $page); if (\Config::get('album.display_setting.detail.display_upload_form') && !$disabled_to_update && \Auth::check() && $album->member_id == $this->u->id) { $data['val'] = self::get_validation_public_flag(); } $data['id'] = $id; $data['album'] = $album; $data['is_member_page'] = true; $data['disabled_to_update'] = $disabled_to_update; $data['liked_album_image_ids'] = conf('like.isEnabled') && \Auth::check() ? \Site_Model::get_liked_ids('album_image', $this->u->id, $data['list']) : array(); $this->set_title_and_breadcrumbs($album->name, null, $album->member, 'album', null, false, false, array('title' => $album->name, 'description' => $album->body, 'image' => \Site_Util::get_image_uri4image_list($data['list'], 'ai', 'raw'))); $this->template->subtitle = \View::forge('_parts/detail_subtitle', array('album' => $album, 'disabled_to_update' => $disabled_to_update)); $this->template->post_footer = \View::forge('_parts/detail_footer'); $this->template->post_footer = \View::forge('_parts/detail_footer', array('is_mypage' => check_uid($album->member_id))); $this->template->content = \View::forge('detail', $data); }
/** * Thread detail * * @access public * @params integer * @return Response */ public function action_detail($id = null) { $thread_id = (int) $id; $thread = Model_Thread::check_authority($thread_id); $this->check_browse_authority($thread->public_flag, $thread->member_id); // 既読処理 if (\Auth::check()) { $this->change_notice_status2read($this->u->id, 'thread', $id); } // thread_image $images = Model_ThreadImage::get4thread_id($thread_id); // thread_comment $default_params = array('latest' => 1); list($limit, $is_latest, $is_desc, $since_id, $max_id) = $this->common_get_list_params($default_params, conf('view_params_default.detail.comment.limit_max')); list($list, $next_id, $all_comment_count) = Model_ThreadComment::get_list(array('thread_id' => $thread_id), $limit, $is_latest, $is_desc, $since_id, $max_id, null, false, true); // thread_like $is_liked_self = \Auth::check() ? Model_ThreadLike::check_liked($id, $this->u->id) : false; $title = array('name' => $thread->title); $header_info = array(); $ogp_infos = array('title' => $thread->title, 'description' => $thread->body); if ($images) { $ogp_infos['image'] = \Site_Util::get_image_uri4image_list($images, 't', 'raw'); } $this->set_title_and_breadcrumbs($title, array('thread' => term('thread', 'site.list')), null, 'thread', $header_info, false, false, $ogp_infos); $this->template->subtitle = \View::forge('_parts/detail_subtitle', array('thread' => $thread)); $this->template->post_footer = \View::forge('_parts/comment/handlebars_template'); $data = array('thread' => $thread, 'images' => $images, 'comments' => $list, 'all_comment_count' => $all_comment_count, 'comment_next_id' => $next_id, 'is_liked_self' => $is_liked_self, 'liked_ids' => conf('like.isEnabled') && \Auth::check() && $list ? \Site_Model::get_liked_ids('thread_comment', $this->u->id, $list) : array()); $this->template->content = \View::forge('detail', $data); }
public static function setup_timeline($member_id, $body = null) { if (is_null($body)) { $body = 'This is test.'; } return Site_Model::save_timeline($member_id, FBD_PUBLIC_FLAG_ALL, 'normal', null, null, $body); }
/** * Site index * * @access public * @return Response */ public function action_index() { $data = array(); if (Config::get('page.site.index.timeline.isEnabled') && is_enabled('timeline')) { $data['timelines'] = \Timeline\Site_Util::get_list4view(\Auth::check() ? $this->u->id : 0, 0, false, null, $this->common_get_list_params(array('desc' => 1, 'latest' => 1, 'limit' => Config::get('page.site.index.timeline.list.limit')), Config::get('page.site.index.timeline.list.limit_max'), true)); $data['timelines']['see_more_link'] = array('uri' => 'timeline'); //$this->template->post_footer = \View::forge('timeline::_parts/load_timelines'); } if (Config::get('page.site.index.news.isEnabled') && is_enabled('news')) { list($limit, $page) = $this->common_get_pager_list_params(\Config::get('page.site.index.news.list.limit'), \Config::get('page.site.index.news.list.limit_max')); $data['news_list'] = \News\Site_Model::get_list($limit, $page, \Auth::check()); $data['news_list']['see_more_link'] = array('uri' => 'news'); } if (Config::get('page.site.index.albumImage.isEnabled') && is_enabled('album')) { list($limit, $page) = $this->common_get_pager_list_params(\Config::get('page.site.index.albumImage.list.limit'), \Config::get('page.site.index.albumImage.list.limit_max')); $data['album_images'] = \Album\Model_AlbumImage::get_pager_list(array('related' => array('album'), 'where' => \Site_Model::get_where_params4list(0, \Auth::check() ? $this->u->id : 0), 'order_by' => array('id' => 'desc'), 'limit' => $limit), $page); $data['album_images']['liked_album_image_ids'] = conf('like.isEnabled') && \Auth::check() ? \Site_Model::get_liked_ids('album_image', $this->u->id, $data['album_images']['list']) : array(); $data['album_images']['column_count'] = \Config::get('page.site.index.albumImage.list.column_count'); //$this->template->post_footer = \View::forge('image/_parts/list_footer'); } $this->template->post_footer = \View::forge('site/_parts/index_footer'); if (conf('site.index.slide.isEnabled', 'page')) { if (conf('site.index.slide.recentAlbumImage.isEnabled', 'page')) { $images = \Album\Site_Util::get_top_slide_image_uris(); } else { $images = Config::get('page.site.index.slide.images'); } $this->template->post_header_content = View::forge('site/_parts/slide', array('image_uris' => $images)); } $this->set_title_and_breadcrumbs('', null, null, null, null, true, true); $this->template->content = View::forge('site/index', $data); if (!empty($data['news_list']['list'])) { $this->template->content->set_safe('html_bodys', \News\Site_Model::convert_raw_bodys($data['news_list']['list'])); } }
/** * Get list by member * * @access public * @param int $member_id target member_id * @return Response (html) * @throws Exception in Controller_Base::controller_common_api * @see Controller_Base::controller_common_api */ public function get_member($member_id = null) { $this->api_accept_formats = array('html'); $this->controller_common_api(function () use($member_id) { $member_id = \Input::get('member_id', 0) ?: $member_id; list($is_mypage, $member) = $member_id ? $this->check_auth_and_is_mypage($member_id, true) : array(null, false); list($limit, $page) = $this->common_get_pager_list_params(conf('articles.limit', 'album'), conf('articles.limit_max', 'album')); $data = Site_Model::get_album_images($limit, $page, get_uid(), $member, $is_mypage, null, $this->format != 'html'); $data['liked_album_image_ids'] = conf('like.isEnabled') && \Auth::check() ? \Site_Model::get_liked_ids('album_image', $this->u->id, $data['list']) : array(); if ($this->format == 'html') { if ($member) { $data['member'] = $member; } } else { $list_array = array(); foreach ($data['list'] as $key => $obj) { $row = $obj->to_array(); $row['album']['member'] = \Model_Member::get_one_basic4id($obj->album->member_id); $list_array[] = $row; } // json response $data = $list_array; } $this->set_response_body_api($data, $this->format == 'html' ? 'image/_parts/list' : null); }); }
public function update($set) { $site = Site_Model::get(); $this->db->where('site_id', $site['site_id']); $result = $this->db->update('site', $set); return count($result) > 0 ? TRUE : FALSE; }
/** * Update watch status * * @access public * @param string $foreign_table target related table * @param int $foreign_id target related table id * @return Response (json) * @throws Exception in Controller_Base::controller_common_api * @see Controller_Base::controller_common_api */ public function post_update_watch_status($foreign_table = null, $foreign_id = null) { $this->controller_common_api(function () use($foreign_table, $foreign_id) { if (!is_enabled('notice')) { throw new \HttpNotFoundException(); } if (\Input::post('foreign_table')) { $foreign_table = \Input::post('foreign_table'); } $foreign_id = intval(\Input::post('foreign_id') ?: $foreign_id); if (!$foreign_table || !$foreign_id) { throw new \HttpNotFoundException(); } if (!in_array($foreign_table, Site_Util::get_accept_foreign_tables())) { throw new \HttpNotFoundException(); } $this->response_body['errors']['message_default'] = term('form.watch') . '状態の変更に失敗しました。'; $model = \Site_Model::get_model_name($foreign_table); $foreign_obj = $model::check_authority($foreign_id); $member_id = $foreign_table == 'album_image' ? $foreign_obj->album->member_id : $foreign_obj->member_id; $this->check_browse_authority($foreign_obj->public_flag, $member_id); if ($member_id == $this->u->id) { throw new \HttpBadRequestException(); } \DB::start_transaction(); $is_registerd = (bool) Model_MemberWatchContent::change_registered_status4unique_key(array('foreign_table' => $foreign_table, 'foreign_id' => $foreign_id, 'member_id' => $this->u->id)); \DB::commit_transaction(); $data = array('result' => $is_registerd, 'message' => $is_registerd ? term('form.watch') . '対象に追加しました。' : term('form.watch') . 'を解除しました。', 'html' => icon_label($is_registerd ? 'form.do_unwatch' : 'form.do_watch', 'both', false)); $this->set_response_body_api($data); }); }
public static function delete4foreign_table_and_foreign_ids($foreign_table, $foreign_ids) { $objs = self::get4foreign_table_and_foreign_ids($foreign_table, $foreign_ids); foreach ($objs as $obj) { Site_Model::delete_timeline($obj, $obj->member_id); } }
protected function update_sort_order() { if (!($ids = \Util_Array::cast_values(explode(',', \Input::post('ids')), 'int', true))) { throw new \HttpInvalidInputException('Invalid input data.'); } return \Site_Model::update_sort_order($ids, \News\Model_NewsCategory::forge()); }
private function execute($obj) { $models = \Site_Model::get4relation($this->_model_to, $this->_conditions, $obj); foreach ($models as $model) { $model->delete(); } }
/** * The index action. * * @access public * @return void */ public function action_index() { $data = array(); list($data['list'], $data['pagination']) = \Site_Model::get_pagenation_list('content_page'); $this->set_title_and_breadcrumbs(term('content.page', 'site.management'), array('admin/content' => term('site.content', 'site.management'))); $this->template->subtitle = \View::forge('_parts/subtitle_edit', array('uri' => 'admin/content/page/create')); $this->template->content = \View::forge('content/page/list', $data); }
/** * The index action. * * @access public * @return void */ public function action_index() { $data = array(); list($data['list'], $data['pagination']) = \Site_Model::get_pagenation_list('member'); $this->template->layout = 'wide'; $this->set_title_and_breadcrumbs(term('member.view', 'site.management')); $this->template->content = \View::forge('member/list', $data); }
private static function delete_member_watch_content($obj, $conditions) { if (!($member_watch_contents = \Site_Model::get4relation('\\Notice\\Model_MemberWatchContent', $conditions, $obj))) { return false; } foreach ($member_watch_contents as $member_watch_content) { $member_watch_content->delete(); } }
/** * Get thread list * * @access public * @return Response (html) * @throws Exception in Controller_Base::controller_common_api * @see Controller_Base::controller_common_api */ public function get_list() { $this->api_accept_formats = 'html'; $this->controller_common_api(function () { list($limit, $page) = $this->common_get_pager_list_params(); $data = Site_Model::get_list($limit, $page, get_uid()); $this->set_response_body_api($data, '_parts/list'); }); }
public static function save_comment($parent_table, $parent_id, $member_id, $body = null) { $model = Site_Model::get_model_name($parent_table . '_comment'); $parent_id_prop = $parent_table . '_id'; if (is_null($body)) { $body = 'This is test comment.'; } $comment = $model::forge(array('body' => $body, $parent_id_prop => $parent_id, 'member_id' => $member_id)); $comment->save(); return $comment; }
protected function get_timeline(\Orm\Model $obj) { $query = \Timeline\Model_Timeline::query(); foreach ($this->_timeline_relations as $property_to => $froms) { foreach ($froms as $value_from => $type) { $value = \Site_Model::get_value_for_observer_setting($obj, $value_from, $type); $query = $query->where($property_to, $value); } } return $query->get_one(); }
/** * Get note list by member * * @access public * @param int $member_id * @return Response (html) * @throws Exception in Controller_Base::controller_common_api * @see Controller_Base::controller_common_api */ public function get_member($member_id = null) { $this->api_accept_formats = 'html'; $this->controller_common_api(function () use($member_id) { $member_id = (int) $member_id; list($is_mypage, $member) = $member_id ? $this->check_auth_and_is_mypage($member_id, true) : array(null, false); list($limit, $page) = $this->common_get_pager_list_params(); $is_draft = $is_mypage ? \Util_string::cast_bool_int(\Input::get('is_draft', 0)) : 0; $data = Site_Model::get_list($limit, $page, \Auth::check() ? $this->u->id : 0, $member, $is_mypage, $is_draft); $this->set_response_body_api($data, '_parts/list'); }); }
/** * The index action. * * @access public * @return void */ public function action_index() { $is_draft = \Input::get('is_draft', 0); $is_published = \Util_toolkit::reverse_bool($is_draft, true); $data = array(); $data['is_draft'] = $is_draft; list($data['list'], $data['pagination']) = \Site_Model::get_pagenation_list('news', array('related' => 'news_category')); $this->template->layout = 'wide'; $this->set_title_and_breadcrumbs(term('news.view', 'site.management')); $this->template->subtitle = \View::forge('news/_parts/list_subtitle'); $this->template->content = \View::forge('news/list', $data); }
private function set_optional_value($self_obj) { if (empty($this->_optional_updates)) { return; } foreach ($this->_optional_updates as $property_to => $froms) { foreach ($froms as $value_from => $type) { $value = \Site_Model::get_value_for_observer_setting($self_obj, $value_from, $type); $this->update_model->{$property_to} = $value; } } }
public static function get_model_field($table, $column, $label = '', $delete_rules = array()) { $model = Site_Model::get_model_name($table); $obj = $model::forge(); $props = $obj::get_property($column, $delete_rules); if (!$props || empty($props['form'])) { throw new \InvalidArgumentException('Second parameter is invalid.'); } if (!$label) { $label = !empty($props['label']) ? $props['label'] : ''; } return array('label' => $label, 'attributes' => $props['form'], 'rules' => !empty($props['validation']) ? Util_Array::convert_for_callback($props['validation']) : array()); }
private function execute($obj) { $models = \Site_Model::get4relation($this->_model_to, $this->_conditions, $obj); foreach ($models as $model) { //$expr = \DB::expr(sprintf('CASE WHEN `%s` -1 < 0 THEN 0 ELSE `%s` - 1 END', $this->_update_property, $this->_update_property)); //$model->{$this->_update_property} = $expr; $model->{$this->_update_property} = $model->{$this->_update_property} - 1; if ($model->{$this->_update_property} < 0) { $model->{$this->_update_property} = 0; } $model->save(); } }
private function execute($obj) { $models = \Site_Model::get4relation($this->_model_to, $this->_conditions, $obj); foreach ($models as $model) { $params = array(); if (!empty($this->_execute_func['params'])) { foreach ($this->_execute_func['params'] as $value_from => $type) { $params[] = \Site_Model::get_value_for_observer_setting($model, $value_from, $type); } } call_user_func_array($this->_execute_func['method'], $params); } }
public static function get_list($limit, $page = 1, $self_member_id = 0, $target_member_obj = null, $is_mypage = false, $is_draft = 0) { if ($target_member_obj && !$target_member_obj instanceof \Model_Member) { throw new InvalidArgumentException('forth parameter is invalid.'); } $is_published = \Util_toolkit::reverse_bool($is_draft, true); $data = Model_Note::get_pager_list(array('related' => 'member', 'where' => \Site_Model::get_where_params4list($target_member_obj ? $target_member_obj->id : 0, $self_member_id ?: 0, $is_mypage, array(array('is_published', $is_published))), 'limit' => $limit, 'order_by' => array('created_at' => 'desc')), $page); $data['is_draft'] = $is_draft; $data['member'] = $target_member_obj; $data['is_mypage'] = $is_mypage; $data['liked_note_ids'] = conf('like.isEnabled') && $self_member_id ? \Site_Model::get_liked_ids('note', $self_member_id, $data['list']) : array(); return $data; }
/** * News tag * * @access public * @return Response */ public function action_tag($tag_string = null) { $tags = \Site_Util::validate_tags($tag_string); if (!$tags || !($ids = \News\Model_NewsTag::get_news_ids4tags($tags))) { throw new \HttpNotFoundException(); } list($limit, $page) = $this->common_get_pager_list_params(); $data = Site_Model::get_list($limit, $page, \Auth::check(), null, $ids); $data['tag_string'] = implode(', ', $tags); $this->set_title_and_breadcrumbs(sprintf('%s: %s', term('site.tag'), implode(', ', $tags)), array('news/list' => term('site.latest', 'news.view', 'site.list'))); $this->template->post_footer = \View::forge('_parts/list_footer'); $this->template->content = \View::forge('_parts/list', $data); $this->template->content->set_safe('html_bodys', Site_Model::convert_raw_bodys($data['list'])); }
public static function save_images($file_tmps, $parent_id, $parent_id_field, $related_table, $public_flag = null, $type = 'img') { if (!in_array($type, array('img', 'file'))) { throw new InvalidArgumentException('Parameter type is invalid.'); } $moved_files = array(); $related_table_ids = array(); if (!$file_tmps) { return array($moved_files, $related_table_ids); } $model = Site_Model::get_model_name($related_table); $related_table_obj = $model::forge(); if (!($file_cate = $related_table_obj->get_image_prefix())) { throw new \InvalidArgumentException('Parameter $related_table is invalid.'); } $new_filepath_prefix = Site_Upload::get_filepath_prefix($file_cate, $parent_id); $new_filename_prefix = Site_Upload::convert_filepath2filename($new_filepath_prefix); $is_save_storage = conf('upload.storageType') != 'normal'; if (!$is_save_storage) { $new_file_dir = Site_Upload::get_uploaded_path('raw', 'img', true, false, $new_filepath_prefix); if (!Site_Upload::check_and_make_uploaded_dir($new_file_dir, conf('upload.check_and_make_dir_level'), conf('upload.mkdir_mode'))) { throw newFuelException('Failed to make save dirs.'); } } foreach ($file_tmps as $id => $file_tmp) { $old_file_path = Site_Upload::get_uploaded_file_path($file_tmp->name, 'raw', 'img', true); $moved_files[$file_tmp->id] = array('from' => $old_file_path); if (!$is_save_storage) { $new_file_path = $new_file_dir . $file_tmp->name; Util_file::move($old_file_path, $new_file_path); $moved_files[$file_tmp->id]['to'] = $new_file_path; $moved_files[$file_tmp->id]['filepath_prefix'] = $new_filepath_prefix; } if ($type == 'img') { $moved_files[$file_tmp->id]['from_thumbnail'] = Site_Upload::get_uploaded_file_path($file_tmp->name, 'thumbnail', 'img', true); } $file = Model_File::move_from_file_tmp($file_tmp, $new_filename_prefix, $type); $related_table_obj = $model::forge(); $related_table_obj->{$parent_id_field} = $parent_id; $related_table_obj->file_name = $file->name; $related_table_obj->name = $file_tmp->description; $related_table_obj->shot_at = !empty($file->shot_at) ? $file->shot_at : date('Y-m-d H:i:s'); if (!is_null($public_flag)) { $related_table_obj->public_flag = $public_flag; } $related_table_obj->save(); $related_table_ids[] = $related_table_obj->id; } return array($moved_files, $related_table_ids); }
/** * Get note list * * @access public * @return Response (html) * @throws Exception in Controller_Base::controller_common_api * @see Controller_Base::controller_common_api */ public function get_list() { $this->api_accept_formats = 'html'; $this->controller_common_api(function () { $category_name = \Input::get('category'); $news_category = $category_name ? Model_NewsCategory::get4name($category_name) : null; $tag_string = \Input::get('tag'); $tags = \Site_Util::validate_tags($tag_string); $ids = $tags ? Model_NewsTag::get_news_ids4tags($tags) : array(); list($limit, $page) = $this->common_get_pager_list_params(); $data = Site_Model::get_list($limit, $page, \Auth::check(), $news_category ? $news_category->id : 0, $ids); $data['category_name'] = $category_name; $data['tag_string'] = implode(', ', $tags); $this->set_response_body_api($data, '_parts/list', array('html_bodys' => Site_Model::convert_raw_bodys($data['list']))); }); }
public static function check_and_create($foreign_table, $foreign_id, $type) { $since_datetime = \Date::forge(strtotime('-' . \Config::get('notice.periode_to_update.default')))->format('mysql'); if (!($obj = self::get_last4foreign_data($foreign_table, $foreign_id, $type, $since_datetime))) { $obj = self::forge(array('foreign_table' => $foreign_table, 'foreign_id' => $foreign_id, 'type' => $type, 'body' => Site_Util::get_notice_body($foreign_table, $type))); if (!in_array($foreign_table, Site_Util::get_accept_parent_tables()) && ($parent_table = \Site_Model::get_parent_table($foreign_table))) { $obj->parent_table = $parent_table; $foreign_obj_name = \Site_Model::get_model_name($foreign_table); $foreign_obj = $foreign_obj_name::find($foreign_id); $parent_id_prop = $parent_table . '_id'; $obj->parent_id = $foreign_obj->{$parent_id_prop}; } $obj->save(); } return $obj; }
public static function get_album_images($limit, $page = 1, $self_member_id = 0, $target_member_obj = null, $is_mypage = false, $params = array(), $is_return_array = false, $is_asc = false) { if (!is_array($params)) { $params = (array) $params; } if ($target_member_obj && !$target_member_obj instanceof \Model_Member) { throw new InvalidArgumentException('parameter target_member_obj is invalid.'); } if (!empty($params['select']) && !\DBUtil::field_exists('album_image', $params['select'])) { throw new \ValidationFailedException(); } $params = array_merge($params, array('where' => \Site_Model::get_where_params4list($target_member_obj ? $target_member_obj->id : 0, $self_member_id ?: 0, $is_mypage, !empty($params['where']) ? $params['where'] : array(), $target_member_obj ? 'album.member_id' : 'member_id'), 'limit' => $limit, 'order_by' => array('id' => $is_asc ? 'asc' : 'desc'))); if ($target_member_obj) { $params['related'] = array('album'); } $data = Model_AlbumImage::get_pager_list($params, $page, $is_return_array); $data['liked_album_image_ids'] = conf('like.isEnabled') && $self_member_id ? \Site_Model::get_liked_ids('album_image', $self_member_id, $data['list']) : array(); return $data; }
private function execute($obj) { $models = \Site_Model::get4relation($this->_model_to, $this->_conditions, $obj); foreach ($models as $model) { foreach ($this->_update_properties as $property_to => $froms) { if (!is_array($froms)) { $model->{$froms} = $obj->{$froms}; } else { foreach ($froms as $value_from => $type) { $value = \Site_Model::get_value_for_observer_setting($obj, $value_from, $type); $model->{$property_to} = $value; } } } if (!$model->is_changed()) { continue; } $model->save(); } }
/** * Get list by member * * @access public * @param int $member_id * @return Response (html) * @throws Exception in Controller_Base::controller_common_api * @see Controller_Base::controller_common_api */ public function get_member($member_id = null) { $this->api_accept_formats = array('json', 'html'); $this->controller_common_api(function () use($member_id) { list($is_mypage, $member) = $member_id ? $this->check_auth_and_is_mypage($member_id, true) : array(null, false); list($limit, $page) = $this->common_get_pager_list_params(conf('articles.limit', 'album'), conf('articles.limit_max', 'album')); $params = array(); if ($select = (array) \Input::get('cols')) { $params['select'] = $select; } if ($limit = \Input::get('limit')) { $params['limit'] = $limit; } if (\Input::get('no_relateds')) { $params['where'] = array(array('foreign_table', '')); } $data = Site_Model::get_albums($limit, $page, \Auth::check() ? $this->u->id : 0, $member, $is_mypage, $params, $this->format == 'json'); $this->set_response_body_api($data, $this->format == 'html' ? '_parts/list' : null); }); }