} ?> <!-- share button --> <?php if (conf('site.common.shareButton.isEnabled', 'page') && check_public_flag($album_image->public_flag)) { echo render('_parts/services/share', array('text' => $album_image->name ?: $album_image->album->name)); } ?> </div><!-- .comment_info --> <div id="comment_list"> <?php echo render('_parts/comment/list', array('parent' => $album_image, 'list' => $comments, 'next_id' => $comment_next_id, 'delete_uri' => 'album/image/comment/api/delete.json', 'counter_selector' => '#comment_count_' . $album_image->id, 'list_more_box_attrs' => array('data-uri' => 'album/image/comment/api/list/' . $album_image->id . '.json', 'data-template' => '#comment-template'), 'like_api_uri_prefix' => 'album/image/comment', 'liked_ids' => $liked_ids)); ?> </div> <?php if (Auth::check()) { echo render('_parts/comment/post', array('id' => $album_image->id, 'size' => 'M', 'textarea_attrs' => array('id' => 'textarea_comment_' . $album_image->id), 'button_attrs' => array('data-post_uri' => 'album/image/comment/api/create/' . $album_image->id . '.json', 'data-get_uri' => 'album/image/comment/api/list/' . $album_image->id . '.json', 'data-list' => '#comment_list', 'data-template' => '#comment-template', 'data-counter' => '#comment_count_' . $album_image->id))); } ?> <?php if (is_enabled_map('image/detail', 'album')) { echo render('_parts/map/detail', array('auther_member_id' => $album_image->album->member_id, 'locations' => $locations, 'save_uri' => \Album\Site_Util::get_save_location_api_uri($album_image->id), 'markers' => $locations ? Site_Util::get_map_markers($locations) : array(), 'marker_template' => '#map-marker-image-template', 'marker_images' => array('uri' => img_uri($album_image->get_image(), 'M'), 'alt' => $album_image->name))); } ?>
<?php if (Auth::check()) { ?> <small><?php echo Html::anchor('album/image/' . $album_image->id . '?write_comment=1#comments', 'コメントする'); ?> </small> <?php } ?> </div><!-- comment_info --> <?php // like_count_and_link if (conf('like.isEnabled')) { $data_like_link = array('id' => $album_image->id, 'post_uri' => \Album\Site_Util::get_like_api_uri($album_image->id), 'get_member_uri' => \Site_Util::get_api_uri_get_liked_members('album/image', $album_image->id), 'count_attr' => array('class' => 'unset_like_count'), 'count' => $album_image->like_count, 'is_liked' => isset($liked_album_image_ids) && in_array($album_image->id, $liked_album_image_ids)); echo render('_parts/like/count_and_link_execute', $data_like_link); } ?> </div><!-- article --> <?php } ?> <?php $dropdown_btn_group_attr = array('id' => 'btn_dropdown_' . $album_image->id, 'class' => array('dropdown', 'boxBtn')); $get_uri = sprintf('album/image/api/menu/%d.html', $album_image->id); $dropdown_btn_attr = array('class' => 'js-dropdown_content_menu', 'data-uri' => sprintf('album/image/api/menu/%d.html', $album_image->id), 'data-member_id' => $album_image->album->member_id, 'data-menu' => '#menu_' . $album_image->id, 'data-loaded' => 0); $menus = array(array('icon_term' => 'site.show_detail', 'href' => 'album/image/' . $album_image->id)); echo btn_dropdown('noterm.dropdown', $menus, false, 'xs', null, true, $dropdown_btn_group_attr, $dropdown_btn_attr, false);
/** * 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'])); } }
/** * Create timeline * * @access public * @param int $parent_id target parent id * @return Response(json) * @throws Exception in Controller_Base::controller_common_api * @see Controller_Base::controller_common_api */ public function post_create() { $this->controller_common_api(function () { $this->response_body['errors']['message_default'] = term('timeline') . 'の' . term('form.post') . 'に失敗しました。'; $moved_files = array(); $album_image_ids = array(); $timeline = Model_Timeline::forge(); $val = \Validation::forge(); $val->add_model($timeline); if (!$val->run()) { throw new \ValidationFailedException($val->show_errors()); } $post = $val->validated(); $file_tmps = \Site_FileTmp::get_file_tmps_and_check_filesize($this->u->id, $this->u->filesize_total); if (!strlen($post['body']) && !$file_tmps) { throw new \ValidationFailedException('Data is empty.'); } $type_key = 'normal'; $album_id = (int) \Input::post('album_id', 0); if ($file_tmps && $album_id) { $album = \Album\Model_Album::check_authority($album_id, $this->u->id); if (\Album\Site_Util::check_album_disabled_to_update($album->foreign_table, true)) { throw new \ValidationFailedException('Album id is invalid.'); } $type_key = 'album_image'; } try { \DB::start_transaction(); if ($file_tmps) { if (!$album_id) { $type_key = 'album_image_timeline'; $album_id = \Album\Model_Album::get_id_for_foreign_table($this->u->id, 'timeline'); } list($moved_files, $album_image_ids) = \Site_FileTmp::save_images($file_tmps, $album_id, 'album_id', 'album_image', $post['public_flag']); } else { $album_id = null; } $timeline = \Timeline\Site_Model::save_timeline($this->u->id, $post['public_flag'], $type_key, $album_id, null, $post['body'], $timeline, $album_image_ids); \DB::commit_transaction(); // thumbnail 作成 & tmp_file thumbnail 削除 \Site_FileTmp::make_and_remove_thumbnails($moved_files); } catch (\Exception $e) { if (\DB::in_transaction()) { \DB::rollback_transaction(); } if ($moved_files) { \Site_FileTmp::move_files_to_tmp_dir($moved_files); } throw $e; } $data = array('id' => $timeline->id, 'message' => term('timeline') . 'を' . term('form.post') . 'しました。'); if (conf('service.facebook.shareDialog.myhome.autoPopupAfterCreated')) { $link = \Uri::create(Site_Util::get_detail_uri($timeline->id, $timeline->type)); $data['shareFacebook'] = array('obj' => array('link' => $link)); if ($album_image_ids && ($album_image = \Album\Model_AlbumImage::find($album_image_ids[0]))) { $data['shareFacebook']['obj']['picture'] = \Site_Util::get_media_uri(img_uri($album_image->file_name, 'thumbnail'), true); } } $this->set_response_body_api($data); }); }
/** * Api delete common controller * * @access protected * @param string $table Delete target table * @param int $id Delete target record's id * @param string $method Excecuting method name * @param string $content_name Delete target content name for message * @return Response(json) */ protected function api_delete_common($table, $id = null, $method = null, $content_name = '') { $this->controller_common_api(function () use($table, $id, $method, $content_name) { if (!$method) { $method = 'delete'; } $id = intval(\Input::post('id') ?: $id); $model = Site_Model::get_model_name($table); $obj = $model::check_authority($id, IS_ADMIN ? 0 : $this->u->id); if (is_enabled('album') && $table == 'album') { if ($result = \Album\Site_Util::check_album_disabled_to_update($obj->foreign_table)) { throw new \DisableToUpdateException($result['message']); } } \DB::start_transaction(); if ($table == 'timeline') { $result = \Timeline\Site_Model::delete_timeline($obj, $this->u->id); } else { $result = $obj->{$method}(); } \DB::commit_transaction(); $target_conntent_name = $content_name ?: Site_Model::get_content_name($table); $data = array('result' => (bool) $result, 'message' => sprintf('%s%sしました。', $target_conntent_name ? $target_conntent_name . 'を' : '', term('form.delete'))); $this->set_response_body_api($data); }); }
?> "> <div class="imgBox" id="imgBox_<?php echo $album->id; ?> "> <div class="content"><?php echo img(\Album\Model_AlbumImage::get_album_cover_filename($album->cover_album_image_id, $album->id, $access_from), 'M', 'album/' . $album->id); ?> </div> <h5><?php echo Html::anchor('album/' . $album->id, strim($album->name, \Config::get('album.articles.trim_width.name'))); ?> </h5> <?php $disable_to_update = \Album\Site_Util::check_album_disabled_to_update($album->foreign_table); if (!empty($is_member_page)) { ?> <div class="date_box"> <small><?php echo site_get_time($album->created_at); ?> </small> <?php $is_mycontents = Auth::check() && $u->id == $album->member_id; echo render('_parts/public_flag_selecter', array('model' => 'album', 'id' => $album->id, 'public_flag' => $album->public_flag, 'is_mycontents' => $is_mycontents, 'view_icon_only' => true, 'disabled_to_update' => $disable_to_update, 'have_children_public_flag' => true, 'child_model' => 'album_image')); ?> </div><!-- date_box --> <?php } else { echo render('_parts/member_contents_box', array('member' => $album->member, 'id' => $album->id, 'public_flag' => $album->public_flag, 'public_flag_view_icon_only' => true, 'public_flag_disabled_to_update' => $disable_to_update, 'have_children_public_flag' => true, 'model' => 'album', 'date' => array('datetime' => $album->created_at), 'child_model' => 'album_image'));
/** * Album slide * * @access public * @params integer * @return Response */ public function action_slide($id = null) { $album = Model_Album::check_authority($id, null, 'member'); $disabled_to_update = \Album\Site_Util::check_album_disabled_to_update($album->foreign_table); $data = array('content_id' => $id, 'body' => $album->body); $this->set_title_and_breadcrumbs(sprintf('%sの%s', $album->name, term('album_image')), array('/album/' . $id => $album->name), $album->member, 'album'); $this->template->subtitle = \View::forge('_parts/detail_subtitle', array('album' => $album, 'disabled_to_update' => $disabled_to_update)); $this->template->post_footer = \View::forge('_parts/slide_footer', array('is_desc' => true)); $this->template->content = \View::forge('_parts/slide', $data); }
/** * Get edit menu common api controller * * @access protected * @param string $table target table * @param int $id target record id * @param bool $is_watch_target if true,add menu to watch * @param string $parent_selector_prefix use to define delete target * @param string $member_related related table for get member_id * @return Response (html) * @throws Exception in Controller_Base::controller_common_api * @see Controller_Base::controller_common_api */ protected function api_get_menu_common($table, $id, $is_watch_target = false, $parent_selector_prefix = null, $member_related = null) { $this->api_accept_formats = 'html'; $this->controller_common_api(function () use($id, $table, $is_watch_target, $parent_selector_prefix, $member_related) { $id = (int) $id; $is_detail = (bool) \Input::get('is_detail', 0); $model = Site_Model::get_model_name($table); $obj = $model::check_authority($id); $member_id = $member_related ? $obj->{$member_related}->member_id : $obj->member_id; $this->check_browse_authority($obj->public_flag, $member_id); $is_enabled_to_edit = true; if (is_enabled('album') && $table == 'album' && \Album\Site_Util::check_album_disabled_to_update($obj->foreign_table, true)) { $is_enabled_to_edit = false; } $menus = array(); if ($member_id == $this->u->id) { if (is_enabled('album') && $table == 'album_image') { if ($add_menu = \Album\Site_Util::get_album_image_edit_menu($obj, $this->u->file_name)) { $menus += $add_menu; } } if (is_enabled('note') && $table == 'note' && !$obj->is_published) { $menus[] = array('icon_term' => 'form.do_publish', 'attr' => array('class' => 'js-simplePost', 'data-uri' => Site_Util::get_action_uri($table, $id, 'publish'), 'data-msg' => term('form.publish') . 'しますか?')); } if ($is_enabled_to_edit) { $edit_uri = $table == 'timeline' ? \Timeline\Site_Util::get_edit_action_uri($obj) : Site_Util::get_action_uri($table, $id, 'edit'); if ($edit_uri) { $menus[] = array('href' => $edit_uri, 'icon_term' => 'form.do_edit'); } $delete_api_uri = $table == 'timeline' ? \Timeline\Site_Util::get_delete_api_uri($obj) : Site_Util::get_action_uri($table, $id, 'delete', 'json'); $menus[] = array('icon_term' => 'form.do_delete', 'attr' => array('class' => $is_detail ? 'js-simplePost' : 'js-ajax-delete', 'data-uri' => $is_detail ? Site_Util::get_action_uri($table, $id, 'delete') : $delete_api_uri, 'data-msg' => term('form.delete') . 'します。よろしいですか。', 'data-parent' => sprintf('#%s%d', $parent_selector_prefix ?: 'article_', $id))); } // add divider. if (!$is_detail && $menus) { array_unshift($menus, array('tag' => 'divider')); } } else { if (is_enabled('notice') && $is_watch_target) { if ($table == 'timeline') { list($foreign_table, $foreign_id_prop) = \Timeline\Site_Util::get_member_watch_content_info4timeline_type($obj->type); $is_watched = \Notice\Model_MemberWatchContent::get_one4foreign_data_and_member_id($foreign_table, $obj->{$foreign_id_prop}, $this->u->id); $api_uri = \Timeline\Site_Util::get_member_watch_content_api_uri($obj); } else { $is_watched = \Notice\Model_MemberWatchContent::get_one4foreign_data_and_member_id($table, $id, $this->u->id); $api_uri = sprintf('member/notice/api/update_watch_status/%s/%d', $table, $id); } $menus[] = array('icon_term' => $is_watched ? 'form.do_unwatch' : 'form.do_watch', 'attr' => array('class' => 'js-update_toggle', 'data-uri' => $api_uri)); } if ($table == 'timeline' && conf('articleUnfollow.isEnabled', 'timeline')) { $is_followed = (bool) \Timeline\Model_MemberFollowTimeline::get4timeline_id_and_member_id($obj->id, $this->u->id); $menus[] = array('icon_term' => $is_followed ? 'followed' : 'do_follow', 'attr' => array('class' => 'js-update_toggle', 'data-uri' => sprintf('timeline/api/update_follow_status/%d.json', $obj->id))); } } $this->set_response_body_api(array('menus' => $menus, 'is_ajax_loaded' => true), '_parts/dropdown_menu'); }); }
<?php $date = isset($album_image->shot_at) ? $album_image->shot_at : $album_image->created_at; echo render('_parts/member_contents_box', array('member' => $album_image->album->member, 'id' => $album_image->id, 'public_flag' => $album_image->public_flag, 'public_flag_disabled_to_update' => \Album\Site_Util::check_album_disabled_to_update($album_image->album->foreign_table), 'model' => 'album_image', 'date' => array('datetime' => $date, 'label' => term('site.shot')))); ?> <?php $dropdown_btn_group_attr = array('id' => 'btn_dropdown_' . $album_image->id, 'class' => array('dropdown', 'boxBtn', 'edit')); $get_uri = sprintf('album/image/api/menu/%d.html', $album_image->id); $dropdown_btn_attr = array('class' => 'js-dropdown_content_menu', 'data-uri' => sprintf('album/image/api/menu/%d.html?is_detail=1', $album_image->id), 'data-member_id' => $album_image->album->member_id, 'data-menu' => '#menu_' . $album_image->id, 'data-loaded' => 0); $menus = array(); echo btn_dropdown('noterm.dropdown', $menus, false, 'xs', null, true, $dropdown_btn_group_attr, $dropdown_btn_attr, false);
<?php $label_col_size = 3; ?> <div class="well"> <?php echo form_open(true); ?> <?php echo form_input($val, 'name', isset($album_image) ? $album_image->name : '', 12, $label_col_size); if (!\Album\Site_Util::check_album_disabled_to_update($album_image->album->foreign_table, true)) { ?> <?php echo form_public_flag($val, isset($album_image) ? $album_image->public_flag : null, false, $label_col_size); ?> <?php echo Form::hidden('original_public_flag', isset($album_image) ? $album_image->public_flag : null); } ?> <?php echo form_input_datetime($val, 'shot_at_time', isset($album_image) ? check_and_get_datatime($album_image->shot_at, 'datetime_minutes') : '', null, 6, $label_col_size); if (is_enabled_map('image/edit', 'album')) { ?> <?php echo form_map($val, null, $location, $label_col_size); } ?> <?php echo form_button('form.do_edit', 'submit', null, null, $label_col_size); ?> </div><!-- well -->