/** * @param OrderedTable $row * @param string[] $input * @param UserTable $user * @param stdClass $model * @param PluginTable $plugin */ static function showBlogEdit($row, $input, $user, $model, $plugin) { global $_CB_framework, $_PLUGINS; cbValidator::loadValidation(); $blogMode = $plugin->params->get('blog_mode', 1); $pageTitle = $row->get('id') ? CBTxt::T('Edit Blog') : CBTxt::T('Create Blog'); $cbModerator = Application::User((int) $user->get('id'))->isGlobalModerator(); $_CB_framework->setPageTitle($pageTitle); $_CB_framework->appendPathWay(htmlspecialchars(CBTxt::T('Blogs')), $_CB_framework->userProfileUrl($row->get('user', $user->get('id')), true, 'cbblogsTab')); $_CB_framework->appendPathWay(htmlspecialchars($pageTitle), $_CB_framework->pluginClassUrl($plugin->element, true, $row->get('id') ? array('action' => 'blogs', 'func' => 'edit', 'id' => (int) $row->get('id')) : array('action' => 'blogs', 'func' => 'new'))); initToolTip(); $return = '<div class="blogEdit">' . '<form action="' . $_CB_framework->pluginClassUrl($plugin->element, true, array('action' => 'blogs', 'func' => 'save', 'id' => (int) $row->get('id'))) . '" method="post" enctype="multipart/form-data" name="blogForm" id="blogForm" class="cb_form blogForm form-auto cbValidation">' . ($pageTitle ? '<div class="blogsTitle page-header"><h3>' . $pageTitle . '</h3></div>' : null); if ($cbModerator || !$plugin->params->get('blog_approval', 0)) { $return .= '<div class="cbft_select cbtt_select form-group cb_form_line clearfix">' . '<label for="published" class="col-sm-3 control-label">' . CBTxt::Th('Published') . '</label>' . '<div class="cb_field col-sm-9">' . $input['published'] . getFieldIcons(1, 0, null, CBTxt::T('Select publish status of the blog. Unpublished blogs will not be visible to the public.')) . '</div>' . '</div>'; } if ($plugin->params->get('blog_category_config', 1) || $cbModerator) { $return .= '<div class="cbft_select cbtt_select form-group cb_form_line clearfix">' . '<label for="category" class="col-sm-3 control-label">' . CBTxt::Th('Category') . '</label>' . '<div class="cb_field col-sm-9">' . $input['category'] . getFieldIcons(1, 0, null, CBTxt::T('Select blog category. Select the category that best describes your blog.')) . '</div>' . '</div>'; } if ($plugin->params->get('blog_access_config', 1) || $cbModerator) { $return .= '<div class="cbft_select cbtt_select form-group cb_form_line clearfix">' . '<label for="access" class="col-sm-3 control-label">' . CBTxt::Th('Access') . '</label>' . '<div class="cb_field col-sm-9">' . $input['access'] . getFieldIcons(1, 0, null, CBTxt::T('Select access to blog; all groups above that level will also have access to the blog.')) . '</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::Th('Title') . '</label>' . '<div class="cb_field col-sm-9">' . $input['title'] . getFieldIcons(1, 1, null, CBTxt::T('Input blog title. This is the title that will distinguish this blog from others. Suggested to input something unique and intuitive.')) . '</div>' . '</div>'; if (in_array($blogMode, array(1, 2))) { $return .= '<div class="cbft_textarea cbtt_textarea form-group cb_form_line clearfix">' . '<label for="blog_intro" class="col-sm-3 control-label">' . ($blogMode == 1 ? CBTxt::T('Blog Intro') : CBTxt::T('Blog')) . '</label>' . '<div class="cb_field col-sm-9">' . $input['blog_intro'] . getFieldIcons(1, 0, null, CBTxt::T('Input HTML supported blog intro contents. Suggested to use minimal but well formatting for easy readability.')) . '</div>' . '</div>'; } if (in_array($blogMode, array(1, 3))) { $return .= '<div class="cbft_textarea cbtt_textarea form-group cb_form_line clearfix">' . '<label for="blog_full" class="col-sm-3 control-label">' . ($blogMode == 1 ? CBTxt::T('Blog Full') : CBTxt::T('Blog')) . '</label>' . '<div class="cb_field col-sm-9">' . $input['blog_full'] . getFieldIcons(1, 0, null, CBTxt::T('Input HTML supported blog contents. Suggested to use minimal but well formatting for easy readability.')) . '</div>' . '</div>'; } if ($cbModerator) { $return .= '<div class="cbft_text cbtt_input form-group cb_form_line clearfix">' . '<label for="user" class="col-sm-3 control-label">' . CBTxt::T('Owner') . '</label>' . '<div class="cb_field col-sm-9">' . $input['user'] . getFieldIcons(1, 1, null, CBTxt::T('Input owner of blog as single integer user_id.')) . '</div>' . '</div>'; } if ($plugin->params->get('blog_captcha', 0) && !$cbModerator) { $_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::Th('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(1, 1, null) . '</div>' . '</div>'; } } $return .= '<div class="form-group cb_form_line clearfix">' . '<div class="col-sm-offset-3 col-sm-9">' . '<input type="submit" value="' . htmlspecialchars($row->get('id') ? CBTxt::T('Update Blog') : CBTxt::T('Create Blog')) . '" class="blogsButton blogsButtonSubmit btn btn-primary"' . cbValidator::getSubmitBtnHtmlAttributes() . ' /> ' . ' <input type="button" value="' . htmlspecialchars(CBTxt::T('Cancel')) . '" class="blogsButton blogsButtonCancel btn btn-default" onclick="if ( confirm( \'' . addslashes(CBTxt::T('Are you sure you want to cancel? All unsaved data will be lost!')) . '\' ) ) { location.href = \'' . $_CB_framework->userProfileUrl($row->get('user', $user->get('id')), false, 'cbblogsTab') . '\'; }" />' . '</div>' . '</div>' . cbGetSpoofInputTag('plugin') . '</form>' . '</div>'; echo $return; }
/** * @param OrderedTable $row * @param UserTable $user * @param stdClass $model * @param PluginTable $plugin */ static function showBlog($row, $user, $model, $plugin) { global $_CB_framework; $_CB_framework->setPageTitle($row->get('title')); $_CB_framework->appendPathWay(htmlspecialchars(CBTxt::T('Blogs')), $_CB_framework->userProfileUrl($row->get('user', $user->get('id')), true, 'cbblogsTab')); $_CB_framework->appendPathWay(htmlspecialchars($row->get('title')), $_CB_framework->pluginClassUrl($plugin->element, true, array('action' => 'blogs', 'func' => 'show', 'id' => (int) $row->get('id')))); $cbUser =& CBuser::getInstance((int) $row->get('user'), false); $return = '<div class="blowShow">' . '<div class="blogsTitle page-header"><h3>' . $row->get('title') . ' <small>' . CBTxt::T('WRITTEN_BY_BLOG_AUTHOR', 'Written by [blog_author]', array('[blog_author]' => $cbUser->getField('formatname', null, 'html', 'none', 'list', 0, true))) . '</small></h3></div>' . '<div class="blogsHeader well well-sm">' . CBTxt::T('CATEGORY_CATEGORY', 'Category: [category]', array('[category]' => $row->get('category'))) . ' / ' . CBTxt::T('CREATED_CREATED', 'Created: [created]', array('[created]' => cbFormatDate($row->get('created')))) . ($row->get('modified') && $row->get('modified') != '0000-00-00 00:00:00' ? ' / ' . CBTxt::T('MODIFIED_MODIFIED', 'Modified: [modified]', array('[modified]' => cbFormatDate($row->get('modified')))) : null) . '</div>' . '<div class="blogsText">' . $row->get('blog_intro') . $row->get('blog_full') . '</div>' . '</div>'; echo $return; }
/** * @param OrderedTable $row * @param string[] $input * @param UserTable $user * @param stdClass $model * @param PluginTable $plugin */ static function showBlogEdit( $row, $input, $user, /** @noinspection PhpUnusedParameterInspection */ $model, $plugin ) { global $_CB_framework, $_PLUGINS, $_LANG; cbValidator::loadValidation(); $blogMode = $plugin->params->get( 'hangout_mode', 1 ); $pageTitle = ( $row->get( 'id' ) ? $_LANG['Edit Hangout'] : $_LANG['Create Hangout'] ); $cbModerator = Application::User( (int) $user->get( 'id' ) )->isGlobalModerator(); $_CB_framework->setPageTitle( $pageTitle ); $_CB_framework->appendPathWay( htmlspecialchars( $_LANG['Hangout'] ), $_CB_framework->userProfileUrl( $row->get( 'user', $user->get( 'id' ) ), true, 'cbhangoutTab' ) ); $_CB_framework->appendPathWay( htmlspecialchars( $pageTitle ), $_CB_framework->pluginClassUrl( $plugin->element, true, ( $row->get( 'id' ) ? array( 'action' => 'hangout', 'func' => 'edit', 'id' => (int) $row->get( 'id' ) ) : array( 'action' => 'hangout', 'func' => 'new' ) ) ) ); initToolTip(); $return = '<div class="blogEdit">' . '<form action="' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'hangout', 'func' => 'save', 'id' => (int) $row->get( 'id' ) ) ) . '" method="post" enctype="multipart/form-data" name="blogForm" id="blogForm" class="cb_form blogForm form-auto cbValidation">' . ( $pageTitle ? '<div class="blogsTitle page-header"><h3>' . $pageTitle . '</h3></div>' : null ); if ( $cbModerator || ( ! $plugin->params->get( 'hangout_approval', 0 ) ) ) { $return .= '<div class="cbft_select cbtt_select form-group cb_form_line clearfix">' . '<label for="published" class="col-sm-3 control-label">' . CBTxt::Th( 'Published' ) . '</label>' . '<div class="cb_field col-sm-9">' . $input['published'] . getFieldIcons( 1, 0, null, '' ) . '</div>' . '</div>'; } if ( $plugin->params->get( 'hangout_category_config', 1 ) || $cbModerator ) { $return .= '<div class="cbft_select cbtt_select form-group cb_form_line clearfix">' . '<label for="category" class="col-sm-3 control-label">' . CBTxt::Th( 'Category' ) . '</label>' . '<div class="cb_field col-sm-9">' . $input['category'] . getFieldIcons( 1, 0, null, '' ) . '</div>' . '</div>'; } if ( $plugin->params->get( 'hangout_access_config', 1 ) || $cbModerator ) { $return .= '<div class="cbft_select cbtt_select form-group cb_form_line clearfix">' . '<label for="access" class="col-sm-3 control-label">' . CBTxt::Th( 'Access' ) . '</label>' . '<div class="cb_field col-sm-9">' . $input['access'] . getFieldIcons( 1, 0, null, '' ) . '</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::Th( 'Title' ) . '</label>' . '<div class="cb_field col-sm-9">' . $input['title'] . getFieldIcons( 1, 1, null, '' ) . '</div>' . '</div>'; if ( in_array( $blogMode, array( 1, 2 ) ) ) { $return .= '<div class="cbft_textarea cbtt_textarea form-group cb_form_line clearfix">' . '<label for="hangout_intro" class="col-sm-3 control-label">' . ( $blogMode == 1 ? $_LANG['Text intro'] : $_LANG['Text intro'] ) . '</label>' . '<div class="cb_field col-sm-9">' . $input['hangout_intro'] . getFieldIcons( 1, 0, null, '' ) . '</div>' . '</div>'; } if ( in_array( $blogMode, array( 1, 3 ) ) ) { $return .= '<div class="cbft_textarea cbtt_textarea form-group cb_form_line clearfix">' . '<label for="hangout_full" class="col-sm-3 control-label">' . ( $blogMode == 1 ? $_LANG['Text full'] : $_LANG['Text full'] ) . '</label>' . '<div class="cb_field col-sm-9">' . $input['hangout_full'] . getFieldIcons( 1, 0, null, '' ) . '</div>' . '</div>'; $return .= '<div class="cbft_text cbtt_input form-group cb_form_line clearfix">' . '<label for="title" class="col-sm-3 control-label">' . $_LANG['Price'] . '</label>' . '<div class="cb_field col-sm-9">' . $input['price'] . getFieldIcons( 1, 0, null, $_LANG['Input price'] ) . '</div>' . '</div>'; } if ( $cbModerator ) { $return .= '<div class="cbft_text cbtt_input form-group cb_form_line clearfix">' . '<label for="user" class="col-sm-3 control-label">' . CBTxt::T( 'Owner' ) . '</label>' . '<div class="cb_field col-sm-9">' . $input['user'] . getFieldIcons( 1, 1, null, '' ) . '</div>' . '</div>'; } if ( $plugin->params->get( 'hangout_captcha', 0 ) && ( ! $cbModerator ) ) { $_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::Th( '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( 1, 1, null ) . '</div>' . '</div>'; } } $return .= '<div class="form-group cb_form_line clearfix">' . '<div class="col-sm-offset-3 col-sm-9">' . '<input type="submit" value="' . htmlspecialchars( ( $row->get( 'id' ) ? $_LANG["Update Hangout"] : $_LANG["Create Hangout"] ) ) . '" class="blogsButton blogsButtonSubmit btn btn-primary"' . cbValidator::getSubmitBtnHtmlAttributes() . ' /> ' . ' <input type="button" value="' . htmlspecialchars( CBTxt::T( 'Cancel' ) ) . '" class="blogsButton blogsButtonCancel btn btn-default" onclick="if ( confirm( \'' . addslashes( CBTxt::T( 'Are you sure you want to cancel? All unsaved data will be lost!' ) ) . '\' ) ) { location.href = \'' . $_CB_framework->userProfileUrl( $row->get( 'user', $user->get( 'id' ) ), false, 'cbhangoutTab' ) . '\'; }" />' . '</div>' . '</div>' . cbGetSpoofInputTag( 'plugin' ) . '</form>' . '</div>'; echo $return; }
/** * @param OrderedTable $row * @param UserTable $user * @param stdClass $model * @param PluginTable $plugin */ static function showconsultation( $row, $user, /** @noinspection PhpUnusedParameterInspection */ $model, $plugin, $bids ) { global $_CB_framework; $_CB_framework->setPageTitle( $row->get( 'title' ) ); $_CB_framework->appendPathWay( htmlspecialchars( CBTxt::T( 'consultations' ) ), $_CB_framework->userProfileUrl( $row->get( 'user', $user->get( 'id' ) ), true, 'cbconsultationsTab' ) ); $_CB_framework->appendPathWay( htmlspecialchars( $row->get( 'title' ) ), $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'consultations', 'func' => 'show', 'id' => (int) $row->get( 'id' ) ) ) ); $cbUser =& CBuser::getInstance( (int) $row->get( 'user' ), false ); $return = '<div class="blowShow">' . '<div class="consultationsTitle page-header"><h3>' . $row->get( 'title' ) . ' <small>' . CBTxt::T( 'WRITTEN_BY_consultation_AUTHOR', 'Written by [consultation_author]', array( '[consultation_author]' => $cbUser->getField( 'formatname', null, 'html', 'none', 'list', 0, true ) ) ) . '</small></h3></div>' . '<div class="consultationsHeader well well-sm">' . CBTxt::T( 'CATEGORY_CATEGORY', 'Category: [category]', array( '[category]' => $row->get( 'category' ) ) ) . ' / ' . CBTxt::T( 'CREATED_CREATED', 'Created: [created]', array( '[created]' => cbFormatDate( $row->get( 'created' ) ) ) ) . ( $row->get( 'modified' ) && ( $row->get( 'modified' ) != '0000-00-00 00:00:00' ) ? ' / ' . CBTxt::T( 'MODIFIED_MODIFIED', 'Modified: [modified]', array( '[modified]' => cbFormatDate( $row->get( 'modified' ) ) ) ) : null ) . '</div>' . '<div class="consultationsText">' . $row->get( 'consultation_intro' ) . $row->get( 'consultation_full' ) . '</div>' . '</div>'; if($bids!=null){ $return .= '<script > window.___gcfg = { lang: \'ru\', parsetags: \'onload\' }; </script> <script src="https://apis.google.com/js/platform.js" async defer></script> '; $return .= '<h2>Ставки</h2>'; if(empty($bids)){ $return .= "Нет ставок"; }else{ $return .= '<table cellspacing="5" class="consultationsContainer table table-hover table-responsive">'; $return .= '<tr><th>Дата</th><th>Пользователь</th><th>e-mail</th><th>Цена</th><th></th></tr>'; foreach($bids as $key=>$value){ $return .='<tr>'; $return .= '<td>'.$value->bid_date.'</td>'; $return .= '<td>'.$value->name.'</td>'; $return .= '<td>'.$value->email.'</td>'; $return .= '<td>$'.$value->bid_price.'</td>'; $return .= '<td>'; if($key==0){ //Old version was using Goolge Hangouts for communications. //$return .= '<g:hangout render="createhangout" hangout_type="normal" topic="'.addslashes($row->get('title')).'" // invites="[{ id : \''.$value->email.'\', invite_type : \'EMAIL\' }]"> // </g:hangout>'; //New version is using CloudInterpreter $return .= '<a target="_blank" href="http://dev.cloudinterpreter.com:8901/'.md5($row->get('id')).'"><button class="btn btn-success">Начать консультацию</button></a>'; } $return .= '</td>'; $return .='</tr>'; } $return .= '</table>'; } } echo $return; }
/** * @param OrderedTable $row * @param UserTable $user * @param stdClass $model * @param PluginTable $plugin */ static function showBlog( $row, $user, /** @noinspection PhpUnusedParameterInspection */ $model, $plugin, $usrs) { global $_CB_framework, $_LANG; $_CB_framework->setPageTitle( $row->get( 'title' ) ); $_CB_framework->appendPathWay( htmlspecialchars( $_LANG['Hangout'] ), $_CB_framework->userProfileUrl( $row->get( 'user', $user->get( 'id' ) ), true, 'cbhangoutTab' ) ); $_CB_framework->appendPathWay( htmlspecialchars( $row->get( 'title' ) ), $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'hangout', 'func' => 'show', 'id' => (int) $row->get( 'id' ) ) ) ); $cbUser =& CBuser::getInstance( (int) $row->get( 'user' ), false ); $join_button = ''; if($row->get( 'user' ) == $user->get( 'id' )){ $emails_str = ''; $subscrStr = ''; if($usrs){ $subscrStr .= '<div>' . $_LANG['Subscribers'] . ':<br />'; $usrCount = 0; foreach ($usrs as $value) { $cbUserObj =& CBuser::getInstance( (int) $value, false ); $email = CBuser::getUserDataInstance($value)->get('email'); if($email){ if($usrCount > 0){ $emails_str .= ','; $subscrStr .= ', '; } $subscrStr .= $cbUserObj->getField( 'formatname', null, 'html', 'none', 'list', 0, true ); $subscrStr .= ' ('.$email.')'; $emails_str .= '{ id : \''.$email.'\', invite_type : \'EMAIL\' }'; $usrCount ++; } } $subscrStr .= '</div>'; } $curlang = $_CB_framework->getCfg( 'lang' ) == 'russian' ? 'ru' : 'en'; $join_button = '<script >' .'window.___gcfg = {' .'lang: \''.$curlang.'\',' .'parsetags: \'onload\'' .'};' .'</script>' .'<script src="https://apis.google.com/js/platform.js" async defer></script>' //.'<style>.begin_conf{cursor:pointer; border:1px solid #333; display:inline-block; }</style>' .'<span class="begin_conf"><g:hangout render="createhangout" hangout_type="onair" topic="'.$row->get( 'title' ).'" invites="['.$emails_str.']"> </g:hangout></span>'.$subscrStr; }elseif($user->get( 'id' )){ if($row->price > 0){ $link = '#'; $link_text = $_LANG['Pay']." ".$row->price; }else{ $link = cbSef( 'index.php?option=com_comprofiler&view=pluginclass&plugin=cbhangout&action=hangout&func=joinconf&id=' . (int) $row->id, true ); $link_text = $_LANG['Join']; } if(count($usrs) && in_array($user->get( 'id' ), $usrs)){ $join_button = $_LANG['You allready joined conference']; }else{ $join_button = '<a href="'.$link.'" /><input type="button" value="'.$link_text.'" class="btn btn-primary"/></a>'; } }else{ $reg_link = $_CB_framework->viewUrl( 'registers', true, null, 'html', 0 ); $join_button = $_LANG['Need to register'] .'- <a href="'.$reg_link.'">' .$_LANG['Register'] .'</a>'; } $return = '<div class="blowShow">' . '<div class="blogsTitle page-header"><h3>' . $row->get( 'title' ) . ' <small>' . CBTxt::T( 'WRITTEN_BY_BLOG_AUTHOR', 'Written by [blog_author]', array( '[blog_author]' => $cbUser->getField( 'formatname', null, 'html', 'none', 'list', 0, true ) ) ) . '</small></h3></div>' . '<div class="blogsHeader well well-sm">' . CBTxt::T( 'CATEGORY_CATEGORY', 'Category: [category]', array( '[category]' => $row->get( 'category' ) ) ) . ' / ' . CBTxt::T( 'CREATED_CREATED', 'Created: [created]', array( '[created]' => cbFormatDate( $row->get( 'created' ) ) ) ) . ( $row->get( 'modified' ) && ( $row->get( 'modified' ) != '0000-00-00 00:00:00' ) ? ' / ' . CBTxt::T( 'MODIFIED_MODIFIED', 'Modified: [modified]', array( '[modified]' => cbFormatDate( $row->get( 'modified' ) ) ) ) : null ) . ' / ' . $_LANG['Price'] . ' : ' .$row->get( 'price' ) . '</div>' . '<div class="blogsText">' . $row->get( 'hangout_intro' ) . $row->get( 'hangout_full' ) . '</div>' . '</div>' . '<div>' . $join_button . '</div>'; echo $return; }