本文整理汇总了PHP中CB\Database\Table\UserTable类的典型用法代码示例。如果您正苦于以下问题:PHP UserTable类的具体用法?PHP UserTable怎么用?PHP UserTable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UserTable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showAbout
/**
* prepare frontend about render
*
* @param string $return
* @param GroupTable $group
* @param string $users
* @param string $invites
* @param array $counters
* @param array $buttons
* @param array $menu
* @param cbTabs $tabs
* @param UserTable $user
* @return array|null
*/
public function showAbout( &$return, &$group, &$users, &$invites, &$counters, &$buttons, &$menu, &$tabs, $user )
{
global $_CB_framework;
if ( CBGroupJive::isModerator( $user->get( 'id' ) ) || ( ( $group->get( 'published' ) == 1 ) && ( CBGroupJive::getGroupStatus( $user, $group ) >= 3 ) ) ) {
$menu[] = '<a href="' . $_CB_framework->pluginClassUrl( $this->element, true, array( 'action' => 'about', 'func' => 'edit', 'id' => (int) $group->get( 'id' ) ) ) . '"><span class="fa fa-edit"></span> ' . CBTxt::T( 'About' ) . '</a>';
}
$about = trim( $group->params()->get( 'about_content' ) );
if ( ( ! $about ) || ( $about == '<p></p>' ) ) {
return null;
}
CBGroupJive::getTemplate( 'about', true, true, $this->element );
if ( $this->params->get( 'groups_about_substitutions', 0 ) ) {
$about = CBuser::getInstance( (int) $user->get( 'id' ), false )->replaceUserVars( $about, false, false, null, false );
}
if ( $this->params->get( 'groups_about_content_plugins', 0 ) ) {
$about = Application::Cms()->prepareHtmlContentPlugins( $about );
}
return array( 'id' => 'about',
'title' => CBTxt::T( 'About' ),
'content' => HTML_groupjiveAbout::showAbout( $about, $group, $user, $this )
);
}
示例2: showBlog
/**
* @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;
}
示例3: showconsultation
/**
* @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;
}
示例4: execute
/**
* @param cbautoactionsActionTable $trigger
* @param UserTable $user
*/
public function execute( $trigger, $user )
{
if ( ! $this->installed() ) {
if ( $trigger->getParams()->get( 'debug', false, GetterInterface::BOOLEAN ) ) {
var_dump( CBTxt::T( 'AUTO_ACTION_BLOGS_NOT_INSTALLED', ':: Action [action] :: CB Blogs is not installed', array( '[action]' => (int) $trigger->get( 'id' ) ) ) );
}
return;
}
foreach ( $trigger->getParams()->subTree( 'blog' ) as $row ) {
/** @var ParamsInterface $row */
$blog = new cbblogsBlogTable();
$owner = $row->get( 'owner', null, GetterInterface::STRING );
if ( ! $owner ) {
$owner = (int) $user->get( 'id' );
} else {
$owner = (int) $trigger->getSubstituteString( $owner );
}
if ( ! $owner ) {
if ( $trigger->getParams()->get( 'debug', false, GetterInterface::BOOLEAN ) ) {
var_dump( CBTxt::T( 'AUTO_ACTION_BLOGS_NO_OWNER', ':: Action [action] :: CB Blogs skipped due to missing owner', array( '[action]' => (int) $trigger->get( 'id' ) ) ) );
}
continue;
}
$blogData = array( 'user' => $owner,
'title' => $trigger->getSubstituteString( $row->get( 'title', null, GetterInterface::STRING ) ),
'blog_intro' => $trigger->getSubstituteString( $row->get( 'intro', null, GetterInterface::RAW ), false ),
'blog_full' => $trigger->getSubstituteString( $row->get( 'full', null, GetterInterface::RAW ), false ),
'category' => $row->get( 'category', null, GetterInterface::STRING ),
'published' => (int) $row->get( 'published', 1, GetterInterface::INT ),
'access' => (int) $row->get( 'access', 1, GetterInterface::INT )
);
if ( ! $blog->bind( $blogData ) ) {
if ( $trigger->getParams()->get( 'debug', false, GetterInterface::BOOLEAN ) ) {
var_dump( CBTxt::T( 'AUTO_ACTION_BLOGS_BIND_FAILED', ':: Action [action] :: CB Blogs failed to bind. Error: [error]', array( '[action]' => (int) $trigger->get( 'id' ), '[error]' => $blog->getError() ) ) );
}
continue;
}
if ( ! $blog->store() ) {
if ( $trigger->getParams()->get( 'debug', false, GetterInterface::BOOLEAN ) ) {
var_dump( CBTxt::T( 'AUTO_ACTION_BLOGS_FAILED', ':: Action [action] :: CB Blogs failed to save. Error: [error]', array( '[action]' => (int) $trigger->get( 'id' ), '[error]' => $blog->getError() ) ) );
}
}
}
}
示例5: execute
/**
* @param cbautoactionsActionTable $trigger
* @param UserTable $user
*/
public function execute( $trigger, $user )
{
global $_CB_PMS;
foreach ( $trigger->getParams()->subTree( 'pms' ) as $row ) {
/** @var ParamsInterface $row */
$pmFrom = $row->get( 'form', null, GetterInterface::STRING );
if ( ! $pmFrom ) {
$pmFrom = (int) $user->get( 'id' );
} else {
$pmFrom = (int) $trigger->getSubstituteString( $pmFrom );
}
if ( ! $pmFrom ) {
if ( $trigger->getParams()->get( 'debug', false, GetterInterface::BOOLEAN ) ) {
var_dump( CBTxt::T( 'AUTO_ACTION_PMS_NO_FROM', ':: Action [action] :: Private Message skipped due to missing from', array( '[action]' => (int) $trigger->get( 'id' ) ) ) );
}
continue;
}
$pmTo = $trigger->getSubstituteString( $row->get( 'to', null, GetterInterface::STRING ) );
if ( ! $pmTo ) {
if ( $trigger->getParams()->get( 'debug', false, GetterInterface::BOOLEAN ) ) {
var_dump( CBTxt::T( 'AUTO_ACTION_PMS_NO_TO', ':: Action [action] :: Private Message skipped due to missing to', array( '[action]' => (int) $trigger->get( 'id' ) ) ) );
}
continue;
}
$pmMessage = $trigger->getSubstituteString( $row->get( 'message', null, GetterInterface::RAW ), false );
if ( ! $pmMessage ) {
if ( $trigger->getParams()->get( 'debug', false, GetterInterface::BOOLEAN ) ) {
var_dump( CBTxt::T( 'AUTO_ACTION_PMS_NO_MSG', ':: Action [action] :: Private Message skipped due to missing message', array( '[action]' => (int) $trigger->get( 'id' ) ) ) );
}
continue;
}
$pmSubject = $trigger->getSubstituteString( $row->get( 'subject', null, GetterInterface::STRING ) );
$_CB_PMS->sendPMSMSG( $pmTo, $pmFrom, $pmSubject, $pmMessage, true );
}
}
示例6: getArticles
/**
* Gets articles
*
* @param int[] $paging
* @param string $where
* @param UserTable $viewer
* @param UserTable $user
* @param PluginTable $plugin
* @return Table[]
*/
public static function getArticles($paging, $where, $viewer, $user, $plugin)
{
global $_CB_database;
$categories = $plugin->params->get('article_k2_category', null);
$query = 'SELECT a.*' . ', b.' . $_CB_database->NameQuote('id') . ' AS category' . ', b.' . $_CB_database->NameQuote('name') . ' AS category_title' . ', b.' . $_CB_database->NameQuote('published') . ' AS category_published' . ', b.' . $_CB_database->NameQuote('alias') . ' AS category_alias' . "\n FROM " . $_CB_database->NameQuote('#__k2_items') . " AS a" . "\n LEFT JOIN " . $_CB_database->NameQuote('#__k2_categories') . " AS b" . ' ON b.' . $_CB_database->NameQuote('id') . ' = a.' . $_CB_database->NameQuote('catid') . "\n WHERE a." . $_CB_database->NameQuote('created_by') . " = " . (int) $user->get('id') . "\n AND a." . $_CB_database->NameQuote('published') . " = 1" . "\n AND a." . $_CB_database->NameQuote('trash') . " = 0" . "\n AND a." . $_CB_database->NameQuote('access') . " IN " . $_CB_database->safeArrayOfIntegers(Application::MyUser()->getAuthorisedViewLevels()) . "\n AND b." . $_CB_database->NameQuote('published') . " = 1" . "\n AND b." . $_CB_database->NameQuote('trash') . " = 0" . "\n AND b." . $_CB_database->NameQuote('access') . " IN " . $_CB_database->safeArrayOfIntegers(Application::MyUser()->getAuthorisedViewLevels());
if ($categories) {
$categories = explode('|*|', $categories);
cbArrayToInts($categories);
$query .= "\n AND a." . $_CB_database->NameQuote('catid') . " NOT IN ( " . implode(',', $categories) . " )";
}
$query .= $where . "\n ORDER BY a." . $_CB_database->NameQuote('created') . " DESC";
if ($paging) {
$_CB_database->setQuery($query, $paging[0], $paging[1]);
} else {
$_CB_database->setQuery($query);
}
return $_CB_database->loadObjectList(null, '\\CBLib\\Database\\Table\\Table', array(null, '#__k2_items', 'id'));
}
示例7: showBlogEdit
/**
* @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;
}
示例8: showDisable
/**
* @param int $userId
* @param UserTable $user
* @param cbPluginHandler $plugin
*/
static public function showDisable( $userId, $user, $plugin )
{
global $_CB_framework;
cbValidator::loadValidation();
$profileUrl = $_CB_framework->userProfileUrl( $user->get( 'id' ) );
$pageTitle = CBTxt::T( 'Disable My Account' );
$_CB_framework->setPageTitle( $pageTitle );
$_CB_framework->appendPathWay( htmlspecialchars( $pageTitle ), $profileUrl );
initToolTip();
$tooltip = cbTooltip( null, CBTxt::T( 'Optionally input a reason for disabling your account.' ), null, null, null, null, null, 'data-hascbtooltip="true"' );
$return = '<div class="privacyDisableAccount">'
. '<form action="' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'privacy', 'func' => 'disableuser', 'id' => (int) $userId ) ) . '" method="post" enctype="multipart/form-data" name="privacyForm" id="privacyForm" class="cb_form privacyForm form-auto cbValidation">'
. ( $pageTitle ? '<div class="privacyTitle page-header"><h3>' . $pageTitle . '</h3></div>' : null )
. '<div class="cbft_textarea cbtt_textarea form-group cb_form_line clearfix">'
. '<label for="reason" class="col-sm-3 control-label">' . CBTxt::T( 'Reason' ) . '</label>'
. '<div class="cb_field col-sm-9">'
. '<textarea id="reason" name="reason" class="form-control" cols="40" rows="5"' . ( $tooltip ? ' ' . $tooltip : null ) . '></textarea>'
. getFieldIcons( 1, 0, null, CBTxt::T( 'Optionally input a reason for disabling your account.' ) )
. '</div>'
. '</div>'
. '<div class="form-group cb_form_line clearfix">'
. '<div class="col-sm-offset-3 col-sm-9">'
. '<input type="submit" value="' . htmlspecialchars( CBTxt::T( 'Disable Account' ) ) . '" class="privacyButton privacyButtonSubmit btn btn-primary"' . cbValidator::getSubmitBtnHtmlAttributes() . ' /> '
. ' <input type="button" value="' . htmlspecialchars( CBTxt::T( 'Cancel' ) ) . '" class="privacyButton privacyButtonCancel btn btn-default" onclick="location.href = \'' . $profileUrl . '\';" />'
. '</div>'
. '</div>'
. cbGetSpoofInputTag( 'plugin' )
. '</form>'
. '</div>';
echo $return;
}
示例9: showWhitelist
/**
* @param cbantispamWhitelistTable $row
* @param array $input
* @param string $type
* @param int|string $tab
* @param UserTable $user
* @param cbPluginHandler $plugin
*/
static public function showWhitelist( $row, $input, $type, $tab, $user, $plugin )
{
global $_CB_framework;
cbValidator::loadValidation();
$name = CBuser::getInstance( (int) $user->get( 'id' ), false )->getField( 'formatname', null, 'html', 'none', 'profile', 0, true );
$pageTitle = CBTxt::T( 'WHITELIST_NAME', 'Whitelist [name]', array( '[name]' => $name ) );
$_CB_framework->setPageTitle( $pageTitle );
$_CB_framework->appendPathWay( htmlspecialchars( CBTxt::T( 'Whitelists' ) ), $_CB_framework->userProfileUrl( (int) $user->get( 'id' ), true, $tab ) );
$_CB_framework->appendPathWay( htmlspecialchars( $pageTitle ), $_CB_framework->pluginClassUrl( $plugin->element, true, ( $row->get( 'id' ) ? array( 'action' => 'whitelist', 'func' => ( $type ? $type : 'edit' ), 'id' => (int) $row->get( 'id' ), 'usr' => (int) $user->get( 'id' ) ) : array( 'action' => 'whitelist', 'func' => ( $type ? $type : 'new' ), 'usr' => (int) $user->get( 'id' ) ) ) ) );
$return = '<div class="whitelistEdit">'
. '<form action="' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'whitelist', 'func' => 'save', 'id' => (int) $row->get( 'id' ), 'usr' => (int) $user->get( 'id' ) ) ) . '" method="post" enctype="multipart/form-data" name="whitelistForm" id="whitelistForm" class="cb_form whitelistForm form-auto cbValidation">'
. ( $pageTitle ? '<div class="whitelistTitle page-header"><h3>' . $pageTitle . '</h3></div>' : null )
. '<div class="cbft_select cbtt_select form-group cb_form_line clearfix">'
. '<label for="type" class="col-sm-3 control-label">' . CBTxt::T( 'Type' ) . '</label>'
. '<div class="cb_field col-sm-9">'
. $input['type']
. getFieldIcons( 1, 1, null, CBTxt::T( 'Select the whitelist type. Type determines what value should be supplied.' ) )
. '</div>'
. '</div>'
. '<div class="cbft_text cbtt_input form-group cb_form_line clearfix">'
. '<label for="value" class="col-sm-3 control-label">' . CBTxt::T( 'Value' ) . '</label>'
. '<div class="cb_field col-sm-9">'
. $input['value']
. getFieldIcons( 1, 1, null, CBTxt::T( 'Input whitelist value in relation to the type. User type use the users user_id (e.g. 42). IP Address type use a full valid IP Address (e.g. 192.168.0.1). Email type use a fill valid email address (e.g. invalid@cb.invalid). Email Domain type use a full email address domain after @ (e.g. example.com).' ) )
. '</div>'
. '</div>'
. '<div class="cbft_textarea cbtt_textarea form-group cb_form_line clearfix">'
. '<label for="reason" class="col-sm-3 control-label">' . CBTxt::T( 'Reason' ) . '</label>'
. '<div class="cb_field col-sm-9">'
. $input['reason']
. getFieldIcons( 1, 0, null, CBTxt::T( 'Optionally input whitelist reason. Note this is for administrative purposes only.' ) )
. '</div>'
. '</div>'
. '<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 Whitelist' ) : CBTxt::T( 'Create Whitelist' ) ) ) . '" class="whitelistButton whitelistButtonSubmit btn btn-primary"' . cbValidator::getSubmitBtnHtmlAttributes() . ' /> '
. ' <input type="button" value="' . htmlspecialchars( CBTxt::T( 'Cancel' ) ) . '" class="whitelistButton whitelistButtonCancel 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( (int) $user->get( 'id' ), false, $tab ) . '\'; }" />'
. '</div>'
. '</div>'
. cbGetSpoofInputTag( 'plugin' )
. '</form>'
. '</div>';
echo $return;
}
示例10: getDocman
/**
* Gets articles
*
* @param int[] $paging
* @param string $where
* @param UserTable $viewer
* @param UserTable $user
* @param PluginTable $plugin
* @return Table[]
*/
static public function getDocman( $paging, $where, /** @noinspection PhpUnusedParameterInspection */ $viewer, $user, $plugin )
{
global $_CB_database;
$categories = $plugin->params->get( 'article_j_category', null );
$query = 'SELECT a.*'
. ', b.' . $_CB_database->NameQuote( 'docman_category_id' ) . ' AS category'
. ', b.' . $_CB_database->NameQuote( 'title' ) . ' AS category_title'
. ', b.' . $_CB_database->NameQuote( 'enabled' ) . ' AS category_published'
. ', b.' . $_CB_database->NameQuote( 'slug' ) . ' AS category_slug'
. "\n FROM " . $_CB_database->NameQuote( '#__docman_documents' ) . " AS a"
. "\n LEFT JOIN " . $_CB_database->NameQuote( '#__docman_categories' ) . " AS b"
. ' ON b.' . $_CB_database->NameQuote( 'docman_category_id' ) . ' = a.' . $_CB_database->NameQuote( 'docman_category_id' )
. "\n WHERE a." . $_CB_database->NameQuote( 'created_by' ) . " = " . (int) $user->get( 'id' )
. "\n AND a." . $_CB_database->NameQuote( 'enabled' ) . " = 1"
. "\n AND (a." . $_CB_database->NameQuote( 'access' ) . " IN " . $_CB_database->safeArrayOfIntegers( Application::MyUser()->getAuthorisedViewLevels() )
. "\n OR a." . $_CB_database->NameQuote( 'access' ) . " = -1 )"
. "\n AND b." . $_CB_database->NameQuote( 'enabled' ) . " = 1"
. "\n AND b." . $_CB_database->NameQuote( 'access' ) . " IN " . $_CB_database->safeArrayOfIntegers( Application::MyUser()->getAuthorisedViewLevels() );
if ( $categories ) {
$categories = explode( '|*|', $categories );
cbArrayToInts( $categories );
$query .= "\n AND a." . $_CB_database->NameQuote( 'catid' ) . " NOT IN ( " . implode( ',', $categories ) . " )";
}
$query .= $where
. "\n ORDER BY a." . $_CB_database->NameQuote( 'created_on' ) . " DESC";
if ( $paging ) {
$_CB_database->setQuery( $query, $paging[0], $paging[1] );
} else {
$_CB_database->setQuery( $query );
}
return $_CB_database->loadObjectList( null, '\CBLib\Database\Table\Table', array( null, '#__docman_documents', 'id' ) );
}
示例11: showGroupEdit
/**
* render frontend group edit
*
* @param GroupTable $row
* @param array $input
* @param CategoryTable $category
* @param UserTable $user
* @param CBplug_cbgroupjive $plugin
* @return string
*/
static function showGroupEdit( $row, $input, $category, $user, $plugin )
{
global $_CB_framework, $_PLUGINS;
cbValidator::loadValidation();
initToolTip();
$js = "$( '#canvas_method' ).on( 'change', function() {"
. "if ( $( this ).val() == 1 ) {"
. "$( '#gjCanvasUpload' ).removeClass( 'hidden' ).find( 'input' ).removeClass( 'cbValidationDisabled' );"
. "} else {"
. "$( '#gjCanvasUpload' ).addClass( 'hidden' ).find( 'input' ).addClass( 'cbValidationDisabled' ).val( '' );"
. "}"
. "}).change();"
. "$( '#logo_method' ).on( 'change', function() {"
. "if ( $( this ).val() == 1 ) {"
. "$( '#gjLogoUpload' ).removeClass( 'hidden' ).find( 'input' ).removeClass( 'cbValidationDisabled' );"
. "} else {"
. "$( '#gjLogoUpload' ).addClass( 'hidden' ).find( 'input' ).addClass( 'cbValidationDisabled' ).val( '' );"
. "}"
. "}).change();";
$_CB_framework->outputCbJQuery( $js );
$isModerator = CBGroupJive::isModerator( $user->get( 'id' ) );
$returnUrl = CBGroupJive::getReturn( true, true );
$return = null;
$integrations = $_PLUGINS->trigger( 'gj_onBeforeDisplayGroupEdit', array( &$return, &$row, &$input, $category, $user ) );
if ( $row->get( 'id' ) ) {
$pageTitle = CBTxt::T( 'Edit Group' );
if ( ! $returnUrl ) {
$returnUrl = $_CB_framework->pluginClassUrl( $plugin->element, false, array( 'action' => 'groups', 'func' => 'show', 'id' => (int) $row->get( 'id' ) ) );
}
} else {
$pageTitle = CBTxt::T( 'New Group' );
if ( ! $returnUrl ) {
$returnUrl = $_CB_framework->pluginClassUrl( $plugin->element, false, array( 'action' => 'categories', 'func' => 'show', 'id' => (int) $category->get( 'id' ) ) );
}
}
$_CB_framework->setPageTitle( $pageTitle );
$return .= '<div class="gjGroupEdit">'
. '<form action="' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'groups', 'func' => 'save', 'id' => (int) $row->get( 'id' ), 'return' => CBGroupJive::getReturn( true ) ) ) . '" method="post" enctype="multipart/form-data" name="gjGroupEditForm" id="gjGroupEditForm" class="cb_form gjGroupEditForm form-auto cbValidation">'
. ( $pageTitle ? '<div class="gjGroupEditTitle page-header"><h3>' . $pageTitle . '</h3></div>' : null );
if ( $isModerator || ( $row->get( 'id' ) && ( $row->get( 'published' ) != -1 ) ) || ( ! $plugin->params->get( 'groups_create_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::T( 'Published' ) . '</label>'
. '<div class="cb_field col-sm-9">'
. $input['published']
. getFieldIcons( null, 0, null, CBTxt::T( 'Select publish state of this group. Unpublished groups will not be visible to the public.' ) )
. '</div>'
. '</div>';
}
if ( $input['category'] ) {
$return .= '<div class="cbft_select cbtt_select form-group cb_form_line clearfix">'
. '<label for="category" class="col-sm-3 control-label">' . CBTxt::T( 'Category' ) . '</label>'
. '<div class="cb_field col-sm-9">'
. $input['category']
. getFieldIcons( null, 0, null, CBTxt::T( 'Select the group category. This is the category a group will belong to and decide its navigation path.' ) )
. '</div>'
. '</div>';
}
$return .= '<div class="cbft_select cbtt_select form-group cb_form_line clearfix">'
. '<label for="type" class="col-sm-3 control-label">' . CBTxt::T( 'Type' ) . '</label>'
. '<div class="cb_field col-sm-9">'
. $input['type']
. getFieldIcons( null, 0, null, CBTxt::T( 'Select the group type. Type determines the way your group is joined (e.g. Invite requires new users to be invited to join your group).' ) )
. '</div>'
. '</div>'
. '<div class="cbft_text cbtt_input form-group cb_form_line clearfix">'
. '<label for="name" class="col-sm-3 control-label">' . CBTxt::T( 'Name' ) . '</label>'
. '<div class="cb_field col-sm-9">'
. $input['name']
. getFieldIcons( null, 1, null, CBTxt::T( 'Input the group name. This is the name that will distinguish this group from others. Suggested to input something unique and intuitive.' ) )
. '</div>'
. '</div>'
. '<div class="cbft_textarea cbtt_textarea form-group cb_form_line clearfix">'
. '<label for="description" class="col-sm-3 control-label">' . CBTxt::T( 'Description' ) . '</label>'
. '<div class="cb_field col-sm-9">'
. $input['description']
. getFieldIcons( null, 0, null, CBTxt::T( 'Optionally input the group description. The group description should be short and to the point; describing what your group is all about.' ) )
. '</div>'
//.........这里部分代码省略.........
示例12: saveNotifications
/**
* save notifications
*
* @param int $id
* @param UserTable $user
*/
private function saveNotifications( $id, $user )
{
global $_CB_framework;
$row = new NotificationTable();
$isModerator = CBGroupJive::isModerator( $user->get( 'id' ) );
$group = CBGroupJive::getGroup( $id );
$row->load( array( 'user_id' => (int) $user->get( 'id' ), 'group' => (int) $group->get( 'id' ) ) );
$returnUrl = $_CB_framework->pluginClassUrl( $this->element, false, array( 'action' => 'groups', 'func' => 'show', 'id' => (int) $group->get( 'id' ) ) );
if ( ! CBGroupJive::canAccessGroup( $group, $user ) ) {
cbRedirect( $returnUrl, CBTxt::T( 'Group does not exist.' ), 'error' );
} elseif ( ! $this->params->get( 'notifications', 1 ) ) {
cbRedirect( $returnUrl, CBTxt::T( 'You do not have access to notifications in this group.' ), 'error' );
} elseif ( $row->get( 'id' ) && ( $user->get( 'id' ) != $row->get( 'user_id' ) ) ) {
cbRedirect( $returnUrl, CBTxt::T( 'You do not have sufficient permissions to edit this users notifications.' ), 'error' );
} elseif ( ! $isModerator ) {
if ( ! CBGroupJive::canCreateGroupContent( $user, $group ) ) {
cbRedirect( $returnUrl, CBTxt::T( 'You do not have sufficient permissions to notifications in this group.' ), 'error' );
}
}
$row->set( 'user_id', $row->get( 'user_id', (int) $user->get( 'id' ) ) );
$row->set( 'group', $row->get( 'group', (int) $group->get( 'id' ) ) );
foreach ( $this->getInput()->subTree( 'params' ) as $k => $v ) {
if ( is_array( $v ) || is_object( $v ) ) {
continue;
}
$k = Get::clean( $k, GetterInterface::COMMAND );
if ( $k ) {
if ( is_numeric( $v ) ) {
$v = (int) $this->input( 'post/params.' . $k, null, GetterInterface::INT );
} else {
$v = $this->input( 'post/params.' . $k, null, GetterInterface::STRING );
}
$row->params()->set( $k, $v );
}
}
$row->set( 'params', $row->params()->asJson() );
if ( $row->getError() || ( ! $row->check() ) ) {
$_CB_framework->enqueueMessage( CBTxt::T( 'GROUP_NOTIFICATIONS_FAILED_TO_SAVE', 'Notifications failed to save! Error: [error]', array( '[error]' => $row->getError() ) ), 'error' );
$this->showGroupNotifications( $id, $user );
return;
}
if ( $row->getError() || ( ! $row->store() ) ) {
$_CB_framework->enqueueMessage( CBTxt::T( 'GROUP_NOTIFICATIONS_FAILED_TO_SAVE', 'Notifications failed to save! Error: [error]', array( '[error]' => $row->getError() ) ), 'error' );
$this->showGroupNotifications( $id, $user );
return;
}
cbRedirect( $returnUrl, CBTxt::T( 'Notifications saved successfully!' ) );
}
示例13: _notifyConnectionChange
/**
* Notifies connection changes
*
* @param int $userId
* @param int $connectionId
* @param string $msg
* @param string $subject
* @param string $messageHTML
* @param string $messageText
* @param string $userMessage
* @return boolean
*/
protected function _notifyConnectionChange( $userId, $connectionId, $msg, $subject, $messageHTML, $messageText, $userMessage = null )
{
global $_CB_framework, $ueConfig;
$rowFrom = new UserTable();
$rowFrom->load( (int) $userId );
$fromName = getNameFormat( $rowFrom->name, $rowFrom->username, $ueConfig['name_format'] );
$fromURL = 'index.php?option=com_comprofiler&view=userprofile&user=' . $userId . '&tab=1' . getCBprofileItemid(true);
$fromURL = cbSef( $fromURL );
if ( strncasecmp( 'http', $fromURL, 4 ) != 0 ) {
$fromURL = $_CB_framework->getCfg( 'live_site' ) . '/' . $fromURL;
}
$subject = sprintf( $subject, $fromName );
if ( $userMessage != null ) {
$messageHTML .= sprintf( str_replace( "\n", "\n<br />", CBTxt::T( 'UE_CONNECTIONMSGPREFIX', " %s included the following personal message:\n\n%s" ) ),
htmlspecialchars( $fromName ),
'<strong>' . htmlspecialchars( $userMessage ) . '</strong>' );
$messageText .= sprintf( str_replace( "\n", "\r\n", CBTxt::T( 'UE_CONNECTIONMSGPREFIX', " %s included the following personal message:\n\n%s" ) ),
$fromName,
$userMessage );
}
$notificationMsgHTML = sprintf( $messageHTML, '<strong><a href="' . $fromURL . '">' . htmlspecialchars( $fromName ) . '</a></strong>' );
$notificationMsgText = sprintf( $messageText, $fromName );
$manageURL = 'index.php?option=com_comprofiler&view=manageconnections' . getCBprofileItemid( true );
$manageURL = cbSef( $manageURL );
if ( strncasecmp( 'http', $manageURL, 4 ) != 0 ) {
$manageURL = $_CB_framework->getCfg( 'live_site' ) . '/' . $manageURL;
}
$notificationMsgHTML = $notificationMsgHTML
. "\n<br /><br /><a href=\"" . $manageURL . '">'
. CBTxt::T( 'UE_MANAGECONNECTIONS_LINK UE_MANAGECONNECTIONS', 'Manage Connections' )
. "</a>\n";
$notificationMsgText = $notificationMsgText
. "\r\n\r\n\r\n" . $fromName . ' '
. CBTxt::T( 'CONNECTION_PROFILE UE_PROFILE', 'Profile' )
. ': '
. cbUnHtmlspecialchars( $fromURL );
$notificationMsgText = $notificationMsgText
. "\r\n\r\n"
. CBTxt::T( 'UE_MANAGECONNECTIONS_URL_LABEL UE_MANAGECONNECTIONS', 'Manage Connections' )
. ': '
. cbUnHtmlspecialchars( $manageURL )
. "\r\n";
$notificationMsgHTML = '<div style="padding: 4px; margin: 4px 3px 6px 0px; background: #C44; font-weight: bold;" class="cbNotice">'
. CBTxt::T( 'UE_SENDPMSNOTICE', 'NOTE: This is a message generated automatically by the Connections system. It has the connecting user\'s address, so you can conveniently reply if you wish to.' )
. "</div>\n\n"
. $notificationMsgHTML;
$cbNotification = new cbNotification();
$cbNotification->sendFromUser( $connectionId, $userId, $subject, $notificationMsgHTML, $notificationMsgText );
$this->_setUserMSG( $msg );
return true;
}
示例14: showPreparatyTab
/**
* Renders the Articles tab
*
* @param Table[] $rows Articles to render
* @param cbPageNav $pageNav Pagination
* @param boolean $searching Currently searching
* @param string[] $input HTML of input elements
* @param UserTable $viewer Viewing user
* @param UserTable $user Viewed user
* @param stdClass $model The model reference
* @param TabTable $tab Current Tab
* @param PluginTable $plugin Current Plugin
* @return string HTML
*/
static public function showPreparatyTab( $rows, $pageNav, $searching, $input, $viewer, $user, /** @noinspection PhpUnusedParameterInspection */ $model, $tab, /** @noinspection PhpUnusedParameterInspection */ $plugin )
{
global $_CB_framework, $_LANG;
$app =& JFactory::getApplication();
$menu = $app->getMenu();
$active = $menu->getActive();
$Itemid = $active->id;
$tabPaging = $tab->params->get( 'tab_paging', 1 );
$canSearch = ( $tab->params->get( 'tab_search', 1 ) && ( $searching || $pageNav->total ) );
$canCreate = false;
$profileOwner = ( $viewer->get( 'id' ) == $user->get( 'id' ) );
$cbModerator = Application::User( (int) $viewer->get( 'id' ) )->isGlobalModerator();
//$canPublish = ( $cbModerator || ( $profileOwner && ( ! $plugin->params->get( 'hangout_approval', 0 ) ) ) );
if ( $profileOwner ) {
if ( $cbModerator ) {
$canCreate = true;
} elseif ( $user->get( 'id' ) && Application::User( (int) $viewer->get( 'id' ) )->canViewAccessLevel( (int) $plugin->params->get( 'hangout_create_access', 2 ) ) ) {
if ( ( ! $blogLimit ) || ( $blogLimit && ( $pageNav->total < $blogLimit ) ) ) {
$canCreate = true;
}
}
}
$return = '<div class="articlesTab">'
. '<form action="' . $_CB_framework->userProfileUrl( $user->id, true, $tab->tabid ) . '" method="post" name="articleForm" id="articleForm" class="articleForm">';
if ( $canCreate ) {
$return .= '<div class="' . ( ! $canSearch ? 'col-sm-12' : 'col-sm-8' ) . ' text-left">'
. '<button type="button" onclick="location.href=\'' . ($_CB_framework->getCfg( 'live_site' ).'/index.php?option=com_flexicontent&view=item&typeid=2&task=add&Itemid='.$Itemid) . '\';" class="blogsButton blogsButtonNew btn btn-success"><span class="fa fa-plus-circle"></span> ' . $_LANG['New Preparat'] . '</button>'
. '</div>';
}
if ( $canSearch ) {
$return .= '<div class="articlesHeader row" style="margin-bottom: 10px;">'
. '<div class="col-sm-offset-8 col-sm-4 text-right">'
. '<div class="input-group">'
. '<span class="input-group-addon"><span class="fa fa-search"></span></span>'
. $input['search']
. '</div>'
. '</div>'
. '</div>';
}
$return .= '<table class="articlesContainer table table-hover table-responsive">'
. '<thead>'
. '<tr>'
. '<th style="width: 50%;" class="text-left">' . $_LANG['Preparat'] . '</th>'
. '<th style="width: 25%;" class="text-left hidden-xs">' . CBTxt::T( 'Category' ) . '</th>'
. '<th style="width: 25%;" class="text-left hidden-xs">' . CBTxt::T( 'Created' ) . '</th>'
. '<th style="width: 1%;" class="text-left hidden-xs"></th>'
. '</tr>'
. '</thead>'
. '<tbody>';
$attribs = '';
$image = FLEXI_J16GE ?
JHTML::image(FLEXI_ICONPATH.'edit.png', JText::_( 'FLEXI_EDIT' ), $attribs) :
JHTML::_('image.site', 'edit.png', FLEXI_ICONPATH, NULL, NULL, JText::_( 'FLEXI_EDIT' ), $attribs) ;
if ( $rows ) foreach ( $rows as $row ) {
$item_url = cbpreparatyModel::getUrl( $row, true, 'article' , $Itemid);
//$item_url_edit = cbpreparatyModel::getUrl( $row, true, 'article' , 445);
$link = $_CB_framework->getCfg( 'live_site' ). '/' .$item_url .(strstr($item_url, '?') ? '&' : '?'). 'task=edit';
$edit_row = $profileOwner ? '<a href="'.$link.'">'.$image.'</a> ' : '';
$return .= '<tr>'
. '<td style="width: 50%;" class="text-left">'.$edit_row.'<a href="' . cbpreparatyModel::getUrl( $row, true, 'article' ) . '">' . $row->get( 'title' ) . '</a></td>'
. '<td style="width: 25%;" class="text-left hidden-xs">' . ( $row->get( 'category' ) ? $row->get( 'category_title' ) : CBTxt::T( 'None' ) ) . '</td>'
. '<td style="width: 25%;" class="text-left hidden-xs">' . cbFormatDate( $row->get( 'created' ) ) . '</td>';
if ( ( $cbModerator || $profileOwner ) ) {
$menuItems = '<ul class="invitesMenuItems dropdown-menu" style="display: block; position: relative; margin: 0;">';
$menuItems .= '<li class="invitesMenuItem"><a href="' . $link . '"><span class="fa fa-edit"></span> ' . CBTxt::T( 'Edit' ) . '</a></li>'
. '<li class="invitesMenuItem"><a href="javascript: void(0);" onclick="if ( confirm( \'' . addslashes( CBTxt::T( 'Are you sure you want to delete this Drug?' ) ) . '\' ) ) { location.href = \'' . $_CB_framework->pluginClassUrl( $plugin->element, false, array( 'action' => 'preparaty', 'func' => 'delete', 'id' => (int) $row->get( 'id' ) ) ) . '\'; }"><span class="fa fa-trash-o"></span> ' . CBTxt::T( 'Delete' ) . '</a></li>';
$menuItems .= '</ul>';
$menuAttr = cbTooltip( 1, $menuItems, null, 'auto', null, null, null, 'class="btn btn-default btn-xs" data-cbtooltip-menu="true" data-cbtooltip-classes="qtip-nostyle"' );
//.........这里部分代码省略.........
示例15: getItems
/**
* @param string $type
* @param TabTable $tab
* @param UserTable $user
* @param UserTable $viewer
* @param bool|int $start
* @return null|string
*/
private function getItems( $type, $tab, $user, $viewer, $start = false )
{
global $_CB_framework, $_CB_database, $_PLUGINS;
/** @var Registry $params */
$params = $tab->params;
$tabPrefix = 'tab_' . (int) $tab->get( 'tabid' ) . '_';
$publishedOnly = ( ( $viewer->get( 'id' ) != $user->get( 'id' ) ) && ( ! Application::User( (int) $viewer->get( 'id' ) )->isGlobalModerator() ) );
$input = array();
// Items:
$typePrefix = $tabPrefix . $type . '_items_';
$limit = (int) $params->get( 'tab_' . $type . '_items_limit', 15 );
$limitstart = ( $start !== false ? (int) $start : $_CB_framework->getUserStateFromRequest( $typePrefix . 'limitstart{com_comprofiler}', $typePrefix . 'limitstart' ) );
$search = $_CB_framework->getUserStateFromRequest( $typePrefix . 'search{com_comprofiler}', $typePrefix . 'search' );
$where = null;
if ( $search && $params->get( 'tab_' . $type . '_items_search', 1 ) ) {
$where .= "\n AND ( " . $_CB_database->NameQuote( 'value' ) . " LIKE " . $_CB_database->Quote( '%' . $_CB_database->getEscaped( $search, true ) . '%', false )
. " OR " . $_CB_database->NameQuote( 'title' ) . " LIKE " . $_CB_database->Quote( '%' . $_CB_database->getEscaped( $search, true ) . '%', false )
. " OR " . $_CB_database->NameQuote( 'description' ) . " LIKE " . $_CB_database->Quote( '%' . $_CB_database->getEscaped( $search, true ) . '%', false ) . " )";
}
$itemsSearching = ( $where ? true : false );
$query = 'SELECT COUNT(*)'
. "\n FROM " . $_CB_database->NameQuote( '#__comprofiler_plugin_gallery_items' )
. "\n WHERE " . $_CB_database->NameQuote( 'type' ) . " = " . $_CB_database->Quote( $type )
. "\n AND " . $_CB_database->NameQuote( 'user_id' ) . " = " . (int) $user->get( 'id' )
. "\n AND " . $_CB_database->NameQuote( 'folder' ) . " = 0"
. ( $publishedOnly ? "\n AND " . $_CB_database->NameQuote( 'published' ) . " = 1" : null )
. $where;
$_CB_database->setQuery( $query );
$total = (int) $_CB_database->loadResult();
if ( $total <= $limitstart ) {
$limitstart = 0;
}
$itemsPageNav = new cbPageNav( $total, $limitstart, $limit );
$itemsPageNav->setInputNamePrefix( $typePrefix );
$orderBy = $params->get( 'tab_' . $type . '_items_orderby', 'date_desc' );
if ( ! $orderBy ) {
$orderBy = 'date_desc';
}
$orderBy = explode( '_', $orderBy );
$query = 'SELECT *'
. "\n FROM " . $_CB_database->NameQuote( '#__comprofiler_plugin_gallery_items' )
. "\n WHERE " . $_CB_database->NameQuote( 'type' ) . " = " . $_CB_database->Quote( $type )
. "\n AND " . $_CB_database->NameQuote( 'user_id' ) . " = " . (int) $user->get( 'id' )
. "\n AND " . $_CB_database->NameQuote( 'folder' ) . " = 0"
. ( $publishedOnly ? "\n AND " . $_CB_database->NameQuote( 'published' ) . " = 1" : null )
. $where
. "\n ORDER BY " . $_CB_database->NameQuote( $orderBy[0] ) . " " . strtoupper( $orderBy[1] );
if ( $params->get( 'tab_' . $type . '_items_paging', 1 ) ) {
$_CB_database->setQuery( $query, $itemsPageNav->limitstart, $itemsPageNav->limit );
} else {
$_CB_database->setQuery( $query );
}
$items = $_CB_database->loadObjectList( null, 'cbgalleryItemTable', array( $_CB_database ) );
$itemsCount = count( $items );
$_PLUGINS->trigger( 'gallery_onLoadItems', array( &$items, $user ) );
if ( $itemsCount && ( ! count( $items ) ) ) {
return $this->getItems( $type, $tab, $user, $viewer, ( $limitstart + $limit ) );
}
switch( $type ) {
case 'photos':
$placeholder = CBTxt::T( 'Search Photos...' );
break;
case 'files':
$placeholder = CBTxt::T( 'Search Files...' );
break;
case 'videos':
$placeholder = CBTxt::T( 'Search Videos...' );
break;
case 'music':
$placeholder = CBTxt::T( 'Search Music...' );
break;
default:
$placeholder = CBTxt::T( 'Search...' );
break;
}
$input['search_items'] = '<input type="text" name="' . htmlspecialchars( $typePrefix . 'search' ) . '" value="' . htmlspecialchars( $search ) . '" onchange="document.' . htmlspecialchars( $type ) . 'ItemsForm.submit();" placeholder="' . htmlspecialchars( $placeholder ) . '" class="form-control" />';
//.........这里部分代码省略.........