/** * render frontend event activity * * @param CB\Plugin\Activity\Table\ActivityTable $row * @param string $title * @param string $message * @param CB\Plugin\Activity\Activity $stream * @param VideoTable $video * @param cbgjVideoPlugin $plugin * @return string */ static function showVideoActivity( $row, &$title, &$message, $stream, $video, $plugin ) { global $_CB_framework; $title = CBTxt::T( 'GROUP_VIDEO_ACTIVITY_TITLE', 'published a video in [group]', array( '[group]' => '<strong><a href="' . $_CB_framework->pluginClassUrl( $plugin->_gjPlugin->element, true, array( 'action' => 'groups', 'func' => 'show', 'id' => (int) $video->group()->get( 'id' ) ) ) . '">' . htmlspecialchars( CBTxt::T( $video->group()->get( 'name' ) ) ) . '</a></strong>' ) ); $return = '<div class="gjVideoActivity">' . '<div class="gjGroupVideoRow gjContainerBox img-thumbnail">' . '<div class="gjContainerBoxHeader">' . '<video width="640" height="360" style="width: 100%; height: 100%;" src="' . htmlspecialchars( $video->get( 'url' ) ) . '" type="' . htmlspecialchars( $video->mimeType() ) . '" controls="controls" preload="none" class="streamItemVideo gjVideoPlayer"></video>' . '</div>' . '<div class="gjContainerBoxBody text-left">' . '<div class="gjContainerBoxTitle">' . '<strong>' . '<a href="' . htmlspecialchars( $video->get( 'url' ) ) . '" target="_blank" rel="nofollow">' . htmlspecialchars( ( $video->get( 'title' ) ? $video->get( 'title' ) : $video->name() ) ) . '</a>' . '</strong>' . '</div>'; if ( $video->get( 'caption' ) ) { $return .= '<div class="gjContainerBoxContent cbMoreLess">' . '<div class="cbMoreLessContent">' . htmlspecialchars( $video->get( 'caption' ) ) . '</div>' . '<div class="cbMoreLessOpen fade-edge hidden">' . '<a href="javascript: void(0);" class="cbMoreLessButton">' . CBTxt::T( 'See More' ) . '</a>' . '</div>' . '</div>'; } $return .= '</div>' . '</div>' . '</div>'; return $return; }
/** * render frontend video edit * * @param VideoTable $row * @param array $input * @param GroupTable $group * @param UserTable $user * @param CBplug_cbgroupjivevideo $plugin * @return string */ static function showVideoEdit( $row, $input, $group, $user, $plugin ) { global $_CB_framework, $_PLUGINS; $pageTitle = ( $row->get( 'id' ) ? CBTxt::T( 'Edit Video' ) : CBTxt::T( 'New Video' ) ); $_CB_framework->setPageTitle( $pageTitle ); cbValidator::loadValidation(); initToolTip(); $isModerator = CBGroupJive::isModerator( $user->get( 'id' ) ); $canModerate = ( CBGroupJive::getGroupStatus( $user, $group ) >= 2 ); $return = null; $_PLUGINS->trigger( 'gj_onBeforeDisplayVideoEdit', array( &$return, &$row, &$input, $group, $user ) ); $return .= '<div class="gjVideoEdit">' . '<form action="' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'video', 'func' => 'save', 'id' => (int) $row->get( 'id' ) ) ) . '" method="post" enctype="multipart/form-data" name="gjVideoEditForm" id="gjVideoEditForm" class="cb_form gjVideoEditForm form-auto cbValidation">' . ( $pageTitle ? '<div class="gjVideoEditTitle page-header"><h3>' . $pageTitle . '</h3></div>' : null ); if ( $isModerator || $canModerate || ( $row->get( 'id' ) && ( $row->get( 'published' ) != -1 ) ) || ( $group->params()->get( 'video', 1 ) != 2 ) ) { $return .= '<div class="cbft_select cbtt_select form-group cb_form_line clearfix">' . '<label for="published" class="col-sm-3 control-label">' . CBTxt::T( 'Published' ) . '</label>' . '<div class="cb_field col-sm-9">' . $input['published'] . getFieldIcons( null, 0, null, CBTxt::T( 'Select publish state of this video. Unpublished videos will not be visible to the public.' ) ) . '</div>' . '</div>'; } $return .= '<div class="cbft_text cbtt_input form-group cb_form_line clearfix">' . '<label for="title" class="col-sm-3 control-label">' . CBTxt::T( 'Title' ) . '</label>' . '<div class="cb_field col-sm-9">' . $input['title'] . getFieldIcons( null, 0, null, CBTxt::T( 'Optionally input a video title to display instead of url.' ) ) . '</div>' . '</div>'; if ( $row->get( 'id' ) && $row->exists() ) { $_CB_framework->outputCbJQuery( "$( '.gjVideoPlayer' ).mediaelementplayer();", 'media' ); $return .= '<div class="cbft_delimiter form-group cb_form_line clearfix">' . '<div class="cb_field col-sm-offset-3 col-sm-9">' . '<video width="640" height="360" style="width: 100%; height: 100%;" id="gjVideoPlayer' . (int) $row->get( 'id' ) . '" src="' . htmlspecialchars( $row->get( 'url' ) ) . '" type="' . htmlspecialchars( $row->mimeType() ) . '" controls="controls" preload="none" class="gjVideoPlayer"></video>' . '</div>' . '</div>'; } $return .= '<div class="cbft_text cbtt_input form-group cb_form_line clearfix">' . '<label for="url" class="col-sm-3 control-label">' . CBTxt::T( 'Video' ) . '</label>' . '<div class="cb_field col-sm-9">' . $input['url'] . getFieldIcons( null, ( ! $row->get( 'id' ) ? 1 : 0 ), null, CBTxt::T( 'Input the URL to the video to publish.' ) ) . ( $input['url_limits'] ? '<div class="help-block">' . $input['url_limits'] . '</div>' : null ) . '</div>' . '</div>' . '<div class="cbft_textarea cbtt_textarea form-group cb_form_line clearfix">' . '<label for="caption" class="col-sm-3 control-label">' . CBTxt::T( 'Caption' ) . '</label>' . '<div class="cb_field col-sm-9">' . $input['caption'] . getFieldIcons( null, 0, null, CBTxt::T( 'Optionally input a video caption.' ) ) . '</div>' . '</div>'; if ( $isModerator ) { $return .= '<div class="cbft_text cbtt_input form-group cb_form_line clearfix">' . '<label for="user_id" class="col-sm-3 control-label">' . CBTxt::T( 'Owner' ) . '</label>' . '<div class="cb_field col-sm-9">' . $input['user_id'] . getFieldIcons( null, 1, null, CBTxt::T( 'Input the video owner id. Video owner determines the creator of the video specified as User ID.' ) ) . '</div>' . '</div>'; } if ( ( ! $isModerator ) && $plugin->params->get( 'groups_video_captcha', 0 ) ) { $_PLUGINS->loadPluginGroup( 'user' ); $captcha = $_PLUGINS->trigger( 'onGetCaptchaHtmlElements', array( false ) ); if ( ! empty( $captcha ) ) { $captcha = $captcha[0]; $return .= '<div class="form-group cb_form_line clearfix">' . '<label class="col-sm-3 control-label">' . CBTxt::T( 'Captcha' ) . '</label>' . '<div class="cb_field col-sm-9">' . ( isset( $captcha[0] ) ? $captcha[0] : null ) . '</div>' . '</div>' . '<div class="form-group cb_form_line clearfix">' . '<div class="cb_field col-sm-offset-3 col-sm-9">' . str_replace( 'inputbox', 'form-control', ( isset( $captcha[1] ) ? $captcha[1] : null ) ) . getFieldIcons( null, 1, null ) . '</div>' . '</div>'; } } $return .= '<div class="form-group cb_form_line clearfix cbtwolines">' . '<div class="col-sm-offset-3 col-sm-9">' . '<input type="submit" value="' . htmlspecialchars( ( $row->get( 'id' ) ? CBTxt::T( 'Update Video' ) : CBTxt::T( 'Publish Video' ) ) ) . '" class="gjButton gjButtonSubmit btn btn-primary" ' . cbValidator::getSubmitBtnHtmlAttributes() . ' />' . ' <input type="button" value="' . htmlspecialchars( CBTxt::T( 'Cancel' ) ) . '" class="gjButton gjButtonCancel btn btn-default" onclick="cbjQuery.cbconfirm( \'' . addslashes( CBTxt::T( 'Are you sure you want to cancel? All unsaved data will be lost!' ) ) . '\' ).done( function() { window.location.href = \'' . $_CB_framework->pluginClassUrl( $plugin->_gjPlugin->element, false, array( 'action' => 'groups', 'func' => 'show', 'id' => (int) $group->get( 'id' ) ) ) . '\'; })" />' . '</div>' . '</div>' . ( ! $row->get( 'id' ) ? '<input type="hidden" id="group" name="group" value="' . (int) $group->get( 'id' ) . '" />' : null ) . cbGetSpoofInputTag( 'plugin' ) . '</form>' . '</div>'; $_PLUGINS->trigger( 'gj_onAfterDisplayVideoEdit', array( &$return, $row, $input, $group, $user ) ); $_CB_framework->setMenuMeta(); echo $return; }