/** * render frontend category message * * @param cbgjCategory $row * @param array $input * @param moscomprofilerUser $user * @param object $plugin */ static function showCategoryMessage( $row, $input, $user, $plugin ) { $row->setPathway( CBTxt::P( 'Message [groups]', array( '[groups]' => cbgjClass::getOverride( 'group', true ) ) ), cbgjClass::getPluginURL( array( 'categories', 'message', (int) $row->get( 'id' ) ) ) ); $return = '<div class="gjCategoryMessage">' . '<form action="' . cbgjClass::getPluginURL( array( 'categories', 'send', (int) $row->get( 'id' ) ) ) . '" method="post" enctype="multipart/form-data" name="gjForm" id="gjForm" class="gjForm form-horizontal">' . '<legend class="gjEditTitle">' . CBTxt::Ph( 'Message [groups]', array( '[groups]' => cbgjClass::getOverride( 'group', true ) ) ) . '</legend>' . '<div class="gjEditContentInput control-group">' . '<label class="gjEditContentInputTitle control-label">' . CBTxt::Th( 'Subject' ) . '</label>' . '<div class="gjEditContentInputField controls">' . $input['subject'] . '<span class="gjEditContentInputIcon help-inline">' . cbgjClass::getIcon( null, CBTxt::T( 'Required' ), 'icon-star' ) . cbgjClass::getIcon( CBTxt::P( 'Input [groups] message subject.', array( '[groups]' => cbgjClass::getOverride( 'group', true ) ) ) ) . '</span>' . '</div>' . '</div>' . '<div class="gjEditContentInput control-group">' . '<label class="gjEditContentInputTitle control-label">' . CBTxt::Th( 'Body' ) . '</label>' . '<div class="gjEditContentInputField controls">' . $input['body'] . '<span class="gjEditContentInputIcon help-inline">' . cbgjClass::getIcon( null, CBTxt::T( 'Required' ), 'icon-star' ) . cbgjClass::getIcon( CBTxt::P( 'Input [groups] message body.', array( '[groups]' => cbgjClass::getOverride( 'group', true ) ) ) ) . '</span>' . '</div>' . '</div>'; if ( $input['captcha'] !== false ) { $return .= '<div class="gjEditContentInput control-group">' . '<label class="gjEditContentInputTitle control-label">' . CBTxt::Th( 'Captcha' ) . '</label>' . '<div class="gjEditContentInputField controls">' . '<div style="margin-bottom: 5px;">' . $input['captcha']['code'] . '</div>' . '<div>' . $input['captcha']['input'] . '</div>' . '<span class="gjEditContentInputIcon help-inline">' . cbgjClass::getIcon( null, CBTxt::T( 'Required' ), 'icon-star' ) . '</span>' . '</div>' . '</div>'; } $return .= '<div class="gjButtonWrapper form-actions">' . '<input type="submit" value="' . htmlspecialchars( CBTxt::T( 'Send Message' ) ) . '" class="gjButton gjButtonSubmit btn btn-primary" /> ' . '<input type="button" value="' . htmlspecialchars( CBTxt::T( 'Cancel' ) ) . '" class="gjButton gjButtonCancel btn btn-mini" onclick="' . cbgjClass::getPluginURL( array( 'categories', 'show', (int) $row->get( 'id' ) ), CBTxt::T( 'Are you sure you want to cancel? All unsaved data will be lost!' ) ) . '" />' . '</div>' . cbGetSpoofInputTag( 'plugin' ) . '</form>' . '</div>'; echo $return; }
/** * render frontend overview message * * @param array $input * @param moscomprofilerUser $user * @param object $plugin */ static function showOverviewMessage( $input, $user, $plugin ) { global $_CB_framework; $generalTitle = $plugin->params->get( 'general_title', $plugin->name ); $pageTitle = CBTxt::P( 'Message [category]', array( '[category]' => cbgjClass::getOverride( 'category', true ) ) ); $_CB_framework->setPageTitle( htmlspecialchars( $pageTitle ) ); if ( $generalTitle != '' ) { $_CB_framework->appendPathWay( htmlspecialchars( CBTxt::T( $generalTitle ) ), cbgjClass::getPluginURL() ); } $_CB_framework->appendPathWay( htmlspecialchars( cbgjClass::getOverride( 'category', true ) . ' ' . cbgjClass::getOverride( 'overview' ) ), cbgjClass::getPluginURL( array( 'overview' ) ) ); $_CB_framework->appendPathWay( htmlspecialchars( $pageTitle ), cbgjClass::getPluginURL( array( 'overview', 'message' ) ) ); $return = '<div class="gjOverviewMessage">' . '<form action="' . cbgjClass::getPluginURL( array( 'overview', 'send' ) ) . '" method="post" enctype="multipart/form-data" name="gjForm" id="gjForm" class="gjForm form-horizontal">' . '<legend class="gjEditTitle">' . $pageTitle . '</legend>' . '<div class="gjEditContentInput control-group">' . '<label class="gjEditContentInputTitle control-label">' . CBTxt::Th( 'Subject' ) . '</label>' . '<div class="gjEditContentInputField controls">' . $input['subject'] . '<span class="gjEditContentInputIcon help-inline">' . cbgjClass::getIcon( null, CBTxt::T( 'Required' ), 'icon-star' ) . cbgjClass::getIcon( CBTxt::P( 'Input [categories] message subject.', array( '[categories]' => cbgjClass::getOverride( 'category', true ) ) ) ) . '</span>' . '</div>' . '</div>' . '<div class="gjEditContentInput control-group">' . '<label class="gjEditContentInputTitle control-label">' . CBTxt::Th( 'Body' ) . '</label>' . '<div class="gjEditContentInputField controls">' . $input['body'] . '<span class="gjEditContentInputIcon help-inline">' . cbgjClass::getIcon( null, CBTxt::T( 'Required' ), 'icon-star' ) . cbgjClass::getIcon( CBTxt::P( 'Input [categories] message body.', array( '[categories]' => cbgjClass::getOverride( 'category', true ) ) ) ) . '</span>' . '</div>' . '</div>' . '<div class="gjButtonWrapper form-actions">' . '<input type="submit" value="' . htmlspecialchars( CBTxt::T( 'Send Message' ) ) . '" class="gjButton gjButtonSubmit btn btn-primary" /> ' . '<input type="button" value="' . htmlspecialchars( CBTxt::T( 'Cancel' ) ) . '" class="gjButton gjButtonCancel btn btn-mini" onclick="' . cbgjClass::getPluginURL( array( 'overview' ), CBTxt::T( 'Are you sure you want to cancel? All unsaved data will be lost!' ) ) . '" />' . '</div>' . cbGetSpoofInputTag( 'plugin' ) . '</form>' . '</div>'; echo $return; }
/** * render frontend overview main * * @param object $rows * @param object $pageNav * @param moscomprofilerUser $user * @param object $plugin * @return string */ static function showOverviewMain( $rows, $pageNav, $user, $plugin ) { $authorized = cbgjClass::getAuthorization( null, null, $user ); $overviewSearch = $plugin->params->get( 'overview_search', 1 ); $overviewPaging = $plugin->params->get( 'overview_paging', 1 ); $overviewLimitbox = $plugin->params->get( 'overview_limitbox', 1 ); $categoryDescLimit = (int) $plugin->params->get( 'overview_cat_desc_limit', 150 ); $categoryApprove = $plugin->params->get( 'category_approve', 0 ); $newCategory = ( $plugin->params->get( 'overview_new_category', 0 ) && cbgjClass::hasAccess( 'cat_create', $authorized ) ); $newGroup = ( $plugin->params->get( 'overview_new_group', 0 ) && cbgjClass::hasAccess( 'grp_create', $authorized ) ); $return = null; if ( $newCategory || $newGroup ) { $return .= '<div class="gjTop gjTopCenter">' . '<div class="btn-group">' . ( $newCategory ? '<input type="button" value="' . htmlspecialchars( CBTxt::P( 'New [category]', array( '[category]' => cbgjClass::getOverride( 'category' ) ) ) ) . '" class="gjButton btn" onclick="' . cbgjClass::getPluginURL( array( 'categories', 'new' ), true ) . '" />' : null ) . ( $newGroup ? '<input type="button" value="' . htmlspecialchars( CBTxt::P( 'New [group]', array( '[group]' => cbgjClass::getOverride( 'group' ) ) ) ) . '" class="gjButton btn" onclick="' . cbgjClass::getPluginURL( array( 'groups', 'new' ), true, true, false, null, true ) . '" />' : null ) . '</div>' . '</div>'; } $return .= '<form action="' . cbgjClass::getPluginURL( array( 'overview' ) ) . '" method="post" name="gjForm" id="gjForm" class="gjForm">' . ( $overviewSearch && ( $pageNav->searching || $pageNav->total ) ? '<div class="gjTop gjTopRight">' . $pageNav->search . '</div>' : null ); if ( $rows ) foreach ( $rows as $row ) { $authorized = cbgjClass::getAuthorization( $row, null, $user ); if ( $row->get( 'published' ) == 1 ) { $state = '<div><a href="javascript: void(0);" onclick="' . cbgjClass::getPluginURL( array( 'categories', 'unpublish', (int) $row->get( 'id' ) ), CBTxt::P( 'Are you sure you want to unpublish this [category]?', array( '[category]' => cbgjClass::getOverride( 'category' ) ) ), true, false, null, true ) . '"><i class="icon-ban-circle"></i> ' . CBTxt::Th( 'Unpublish' ) . '</a></div>'; } else { $state = '<div><a href="' . cbgjClass::getPluginURL( array( 'categories', 'publish', (int) $row->get( 'id' ) ), null, true, false, null, true ) . '"><i class="icon-ok"></i> ' . CBTxt::Th( 'Publish' ) . '</a></div>'; } $canApprove = ( $categoryApprove && ( $row->get( 'published' ) == -1 ) && cbgjClass::hasAccess( 'cat_can_publish', $authorized ) ); $beforeMenu = cbgjClass::getIntegrations( 'gj_onBeforeOverviewCategoryMenu', array( $row, $user, $plugin ) ); $afterMenu = cbgjClass::getIntegrations( 'gj_onAfterOverviewCategoryMenu', array( $row, $user, $plugin ) ); $return .= '<div class="gjContent row-fluid">' . '<div class="gjContentLogo span2">' . $row->getLogo( true, true, true ) . '</div>' . '<div class="gjContentBody mini-layout span10">' . '<div class="gjContentBodyHeader row-fluid">' . '<div class="gjContentBodyTitle span9"><h5>' . $row->getName( 0, true ) . '<small> ' . cbFormatDate( $row->get( 'date' ), 1, false ) . '</small></h5></div>' . '<div class="gjContentBodyMenu span3">'; if ( $canApprove ) { $return .= '<input type="button" value="' . htmlspecialchars( CBTxt::T( 'Approve' ) ) . '" class="gjButton btn btn-mini btn-success" onclick="' . cbgjClass::getPluginURL( array( 'categories', 'publish', (int) $row->get( 'id' ) ), true, true, false, null, true ) . '" />'; } else { if ( ( $row->get( 'published' ) == 0 ) || ( ( $row->get( 'published' ) == 1 ) && ( ! cbgjClass::hasAccess( 'cat_approved', $authorized ) ) ) ) { $return .= cbgjClass::getIcon( null, CBTxt::P( 'This [category] is currently unpublished.', array( '[category]' => cbgjClass::getOverride( 'category' ) ) ), 'icon-eye-close' ); } } if ( $beforeMenu || cbgjClass::hasAccess( array( 'mod_lvl1', 'cat_can_publish' ), $authorized ) || $afterMenu ) { $menuItems = $beforeMenu . ( cbgjClass::hasAccess( 'mod_lvl1', $authorized ) ? '<div><a href="' . cbgjClass::getPluginURL( array( 'categories', 'edit', (int) $row->get( 'id' ) ), null, true, false, null, true ) . '"><i class="icon-pencil"></i> ' . CBTxt::Th( 'Edit' ) . '</a></div>' : null ) . ( ( ! $canApprove ) && cbgjClass::hasAccess( 'cat_can_publish', $authorized ) ? $state : null ) . ( cbgjClass::hasAccess( 'mod_lvl1', $authorized ) ? '<div><a href="javascript: void(0);" onclick="' . cbgjClass::getPluginURL( array( 'categories', 'delete', (int) $row->get( 'id' ) ), CBTxt::P( 'Are you sure you want to delete this [category] and all its associated [groups]?', array( '[category]' => cbgjClass::getOverride( 'category' ), '[groups]' => cbgjClass::getOverride( 'group', true ) ) ), true, false, null, true ) . '"><i class="icon-remove"></i> ' . CBTxt::Th( 'Delete' ) . '</a></div>' : null ) . $afterMenu; $return .= cbgjClass::getDropdown( $menuItems, CBTxt::Th( 'Menu' ) ); } $return .= '</div>' . '</div>' . '<div class="gjContentBodyInfo">' . ( $row->getDescription( $categoryDescLimit ) ? '<div class="well well-small">' . $row->getDescription( $categoryDescLimit ) . '</div>' : null ) . '</div>' . '<div class="gjContentDivider"></div>' . '<div class="gjContentBodyFooter">' . cbgjClass::getIntegrations( 'gj_onBeforeOverviewCategoryInfo', array( $row, $user, $plugin ), null, 'span' ) . ( ( ( ( ! $row->get( 'nested' ) ) && cbgjClass::hasAccess( 'mod_lvl1', $authorized ) ) || $row->get( 'nested' ) ) && $row->nestedCount() ? cbgjClass::getOverride( 'category', $row->nestedCount() ) . ' | ' : null ) . ( $row->groupCount() ? cbgjClass::getOverride( 'group', $row->groupCount() ) . ' | ' : null ) . implode( ', ', $row->getTypes() ) . cbgjClass::getIntegrations( 'gj_onAfterOverviewCategoryInfo', array( $row, $user, $plugin ), null, 'span' ) . '</div>' . '</div>' . '</div>'; } else { $return .= '<div class="gjContent">'; if ( $overviewSearch && $pageNav->searching ) { $return .= CBTxt::Ph( 'No [category] search results found.', array( '[category]' => cbgjClass::getOverride( 'category' ) ) ); } else { $return .= CBTxt::Ph( 'There are no [categories] available.', array( '[categories]' => cbgjClass::getOverride( 'category', true ) ) ); } $return .= '</div>'; } if ( $overviewPaging ) { $return .= '<div class="gjPaging pagination pagination-centered">' . ( $pageNav->total > $pageNav->limit ? $pageNav->pagelinks : null ) . ( ! $overviewLimitbox ? $pageNav->getLimitBox( false ) : ( $pageNav->total ? '<div class="gjPagingLimitbox">' . $pageNav->limitbox . '</div>' : null ) ) . '</div>'; } $return .= cbGetSpoofInputTag( 'plugin' ) . '</form>'; return $return; }
/** * render frontend all groups * * @param boolean $self * @param object $rows * @param object $pageNav * @param moscomprofilerUser $user * @param object $plugin * @return mixed */ static function showGroupAll( $self, $rows, $pageNav, $user, $plugin ) { global $_CB_framework, $_LANG; $generalTitle = $plugin->params->get( 'general_title', $plugin->name ); $_CB_framework->setPageTitle( cbgjClass::getOverride( 'group', true ) ); if ( $generalTitle != '' ) { $_CB_framework->appendPathWay( htmlspecialchars( CBTxt::T( $generalTitle ) ), cbgjClass::getPluginURL() ); } $_CB_framework->appendPathWay( cbgjClass::getOverride( 'group', true ), cbgjClass::getPluginURL( array( 'groups', ( $self ? 'allmy' : 'all' ) ) ) ); $groupAllSearch = $plugin->params->get( 'group_all_search', 1 ); $groupAllPaging = $plugin->params->get( 'group_all_paging', 1 ); $groupAllLimitbox = $plugin->params->get( 'group_all_limitbox', 1 ); $groupAllDescLimit = (int) $plugin->params->get( 'group_all_desc_limit', 150 ); $groupApprove = $plugin->params->get( 'group_approve', 0 ); $authorized = cbgjClass::getAuthorization( null, null, $user ); $return = '<div class="gjGroupAll">'; if ( cbgjClass::hasAccess( 'grp_create', $authorized ) ) { $return .= '<div class="gjTop gjTopCenter">' . '<input type="button" value="' . htmlspecialchars( CBTxt::P( 'New [group]', array( '[group]' => cbgjClass::getOverride( 'group' ) ) ) ) . '" class="gjButton btn" onclick="' . cbgjClass::getPluginURL( array( 'groups', 'new' ), true, true, false, null, true ) . '" />' . '</div>'; } $return .= '<form action="' . cbgjClass::getPluginURL( array( 'groups', ( $self ? 'allmy' : 'all' ) ) ) . '" method="post" name="gjForm" id="gjForm" class="gjForm">' . ( $groupAllSearch && ( $pageNav->searching || $pageNav->total ) ? '<div class="gjTop gjTopRight">' . $pageNav->search . '</div>' : null ); if ( $rows ) foreach ( $rows as $row ) { $category = $row->getCategory(); $authorized = cbgjClass::getAuthorization( $category, $row, $user ); if ( $row->get( 'published' ) == 1 ) { $state = '<div><a href="javascript: void(0);" onclick="' . cbgjClass::getPluginURL( array( 'groups', 'unpublish', (int) $category->get( 'id' ), (int) $row->get( 'id' ) ), CBTxt::P( 'Are you sure you want to unpublish this [group]?', array( '[group]' => cbgjClass::getOverride( 'group' ) ) ), true, false, null, true ) . '"><i class="icon-ban-circle"></i> ' . CBTxt::Th( 'Unpublish' ) . '</a></div>'; } else { $state = '<div><a href="' . cbgjClass::getPluginURL( array( 'groups', 'publish', (int) $category->get( 'id' ), (int) $row->get( 'id' ) ), null, true, false, null, true ) . '"><i class="icon-ok"></i> ' . CBTxt::Th( 'Publish' ) . '</a></div>'; } $canApprove = ( $groupApprove && ( $row->get( 'published' ) == -1 ) && cbgjClass::hasAccess( 'grp_can_publish', $authorized ) ); $beforeMenu = cbgjClass::getIntegrations( 'gj_onBeforeCategoryGroupMenu', array( $row, $category, $user, $plugin ) ); $afterMenu = cbgjClass::getIntegrations( 'gj_onAfterCategoryGroupMenu', array( $row, $category, $user, $plugin ) ); $return .= '<div class="gjContent row-fluid">' . '<div class="gjContentLogo span2">' . $row->getLogo( true, true, true ) . '</div>' . '<div class="gjContentBody mini-layout span10">' . '<div class="gjContentBodyHeader row-fluid">' . '<div class="gjContentBodyTitle span9"><h5>' . $row->getName( 0, true ) . '<small> ' . cbFormatDate( $row->get( 'date' ), 1, false ) . ' - ' . $category->getName( 0, true ) . ( $row->get( 'parent' ) ? ' - ' . $row->getParent()->getName( 0, true ) : null ) . '</small></h5></div>' . '<div class="gjContentBodyMenu span3">'; if ( $canApprove ) { $return .= '<input type="button" value="' . htmlspecialchars( CBTxt::T( 'Approve' ) ) . '" class="gjButton btn btn-mini btn-success" onclick="' . cbgjClass::getPluginURL( array( 'groups', 'publish', (int) $category->get( 'id' ), (int) $row->get( 'id' ) ), true, true, false, null, true ) . '" />'; } else { if ( ( $row->get( 'published' ) == 0 ) || ( ( $row->get( 'published' ) == 1 ) && ( ! cbgjClass::hasAccess( 'grp_approved', $authorized ) ) ) ) { $return .= cbgjClass::getIcon( null, CBTxt::P( 'This [group] is currently unpublished.', array( '[group]' => cbgjClass::getOverride( 'group' ) ) ), 'icon-eye-close' ); } if ( cbgjClass::hasAccess( 'grp_join', $authorized ) ) { $return .= ' <input type="button" value="' . htmlspecialchars( ( cbgjClass::hasAccess( 'grp_invited', $authorized ) ? CBTxt::T( 'Accept Invite' ) : CBTxt::T( 'Join' ) ) ) . '" class="gjButton gjButtonCancel btn btn-mini btn-success" onclick="' . cbgjClass::getPluginURL( array( 'groups', 'join', (int) $category->get( 'id' ), (int) $row->get( 'id' ) ), true, true, false, null, true ) . '" />'; } } if ( $beforeMenu || cbgjClass::hasAccess( array( 'grp_leave', 'mod_lvl2', 'mod_lvl3' ), $authorized ) || $afterMenu || ( ( ! $canApprove ) && cbgjClass::hasAccess( 'grp_can_publish', $authorized ) ) || ( $canApprove && cbgjClass::hasAccess( 'grp_join', $authorized ) ) ) { $menuItems = $beforeMenu . ( $canApprove && cbgjClass::hasAccess( 'grp_join', $authorized ) ? '<div><a href="javascript: void(0);" onclick="' . cbgjClass::getPluginURL( array( 'groups', 'join', (int) $category->get( 'id' ), (int) $row->get( 'id' ) ), null, true, false, null, true ) . '"><i class="icon-plus"></i> ' . CBTxt::Th( 'Join' ) . '</a></div>' : null ) . ( cbgjClass::hasAccess( 'grp_leave', $authorized ) ? '<div><a href="javascript: void(0);" onclick="' . cbgjClass::getPluginURL( array( 'groups', 'leave', (int) $category->get( 'id' ), (int) $row->get( 'id' ) ), CBTxt::P( 'Are you sure you want to leave this [group]?', array( '[group]' => cbgjClass::getOverride( 'group' ) ) ), true, false, null, true ) . '"><i class="icon-minus"></i> ' . CBTxt::Th( 'Leave' ) . '</a></div>' : null ) . ( cbgjClass::hasAccess( 'mod_lvl3', $authorized ) ? '<div><a href="' . cbgjClass::getPluginURL( array( 'groups', 'edit', (int) $category->get( 'id' ), (int) $row->get( 'id' ) ), null, true, false, null, true ) . '"><i class="icon-pencil"></i> ' . CBTxt::Th( 'Edit' ) . '</a></div>' : null ) . ( ( ! $canApprove ) && cbgjClass::hasAccess( 'grp_can_publish', $authorized ) ? $state : null ) . ( cbgjClass::hasAccess( 'mod_lvl2', $authorized ) ? '<div><a href="javascript: void(0);" onclick="' . cbgjClass::getPluginURL( array( 'groups', 'delete', (int) $category->get( 'id' ), (int) $row->get( 'id' ) ), CBTxt::P( 'Are you sure you want to delete this [group] and all its associated [users]?', array( '[group]' => cbgjClass::getOverride( 'group' ), '[users]' => cbgjClass::getOverride( 'user', true ) ) ), true, false, null, true ) . '"><i class="icon-remove"></i> ' . CBTxt::Th( 'Delete' ) . '</a></div>' : null ) . $afterMenu; $return .= cbgjClass::getDropdown( $menuItems, CBTxt::Th( 'Menu' ) ); } $return .= '</div>' . '</div>' . '<div class="gjContentBodyInfo">' . ( $row->getDescription( $groupAllDescLimit ) ? '<div class="well well-small">' . $row->getDescription( $groupAllDescLimit ) . '</div>' : null ) . '</div>' . '<div class="gjContentDivider"></div>' . '<div class="gjContentBodyFooter">' . cbgjClass::getIntegrations( 'gj_onBeforeCategoryGroupInfo', array( $row, $category, $user, $plugin ), null, 'span' ) . ( ( ( ( ! $row->get( 'nested' ) ) && cbgjClass::hasAccess( 'mod_lvl2', $authorized ) ) || $row->get( 'nested' ) ) && $row->nestedCount() ? cbgjClass::getOverride( 'group', $row->nestedCount() ) . ' | ' : null ) . ( $row->userCount() ? cbgjClass::getOverride( 'user', $row->userCount() ) . ' | ' : null ) . $row->getType() . cbgjClass::getIntegrations( 'gj_onAfterCategoryGroupInfo', array( $row, $category, $user, $plugin ), null, 'span' ) . '</div>' . '</div>' . '</div>'; } else { $return .= '<div class="gjContent">'; if ( $groupAllSearch && $pageNav->searching ) { $return .= CBTxt::Ph( 'No [group] search results found.', array( '[group]' => cbgjClass::getOverride( 'group' ) ) ); } else { $return .= CBTxt::Ph( 'There are no [groups] available.', array( '[groups]' => cbgjClass::getOverride( 'group', true ) ) ); } $return .= '</div>'; } if ( $groupAllPaging ) { $return .= '<div class="gjPaging pagination pagination-centered">' . ( $pageNav->total > $pageNav->limit ? $pageNav->pagelinks : null ) . ( ! $groupAllLimitbox ? $pageNav->getLimitBox( false ) : ( $pageNav->total ? '<div class="gjPagingLimitbox">' . $pageNav->limitbox . '</div>' : null ) ) . '</div>'; } $return .= cbGetSpoofInputTag( 'plugin' ) . '</form>' . '</div>'; echo $return; }
/** * render frontend invites * * @param object $rows * @param object $pageNav * @param cbgjCategory $category * @param cbgjGroup $group * @param moscomprofilerUser $user * @param object $plugin * @return string */ static function showInvites( $rows, $pageNav, $category, $group, $user, $plugin ) { global $_CB_framework; $groupInvitesSearch = ( $plugin->params->get( 'group_invites_search', 1 ) && ( $pageNav->searching || $pageNav->total ) ); $groupInvitesPaging = $plugin->params->get( 'group_invites_paging', 1 ); $groupInvitesLimitbox = $plugin->params->get( 'group_invites_limitbox', 1 ); $authorized = cbgjClass::getAuthorization( $category, $group, $user ); $groupInvitesToggle = ( $plugin->params->get( 'group_toggle', 3 ) > 1 ); $data = cbgjClass::parseParams( $_POST ); if ( $plugin->params->get( 'group_invites_list', 0 ) ) { $connections = cbgjClass::getConnectionsList( $user ); if ( $connections ) { $js = "$( '#invites_conn' ).change( function() {" . "$( '#invites_invite' ).attr( 'value', $( this ).val() ).focus().keyup();" . "$( this ).attr( 'value', '' );" . "});"; $_CB_framework->outputCbJQuery( $js ); array_unshift( $connections, moscomprofilerHTML::makeOption( '', CBTxt::T( '- Select Connection -' ) ) ); $usersList = moscomprofilerHTML::selectList( $connections, 'invites_conn', null, 'value', 'text', null, 0, false, false ); } } if ( $plugin->params->get( 'group_invites_captcha', 0 ) && ( ! cbgjClass::hasAccess( 'usr_mod', $authorized ) ) ) { $captcha = cbgjCaptcha::render(); } else { $captcha = false; } $return = '<form action="' . cbgjClass::getPluginURL( array( 'invites', 'send', (int) $category->get( 'id' ), (int) $group->get( 'id' ) ) ) . '" method="post" name="gjForm_invite" id="gjForm_invite" class="gjForm gjToggle form-horizontal">' . '<div class="gjEditContentInput control-group">' . '<label class="gjEditContentInputTitle control-label">' . CBTxt::Th( 'Invite' ) . '</label>' . '<div class="gjEditContentInputField controls">' . '<input type="text" size="35" class="input-large required" value="' . htmlspecialchars( $data->get( 'invites_invite', null ) ) . '" name="invites_invite" id="invites_invite" />' . '<span class="gjEditContentInputIcon help-inline">' . cbgjClass::getIcon( null, CBTxt::T( 'Required' ), 'icon-star' ) . cbgjClass::getIcon( CBTxt::P( 'Invite by [invite_types].', array( '[invite_types]' => implode( ', ', cbgjInvite::inviteBy() ) ) ) ) . '</span>' . '</div>' . '</div>'; if ( isset( $usersList ) ) { $return .= '<div class="gjEditContentInput control-group">' . '<label class="gjEditContentInputTitle control-label">' . CBTxt::Th( 'Connection' ) . '</label>' . '<div class="gjEditContentInputField controls">' . $usersList . '<span class="gjEditContentInputIcon help-inline">' . cbgjClass::getIcon( CBTxt::T( 'Pre-fill invite with a connection.' ) ) . '</span>' . '</div>' . '</div>'; } if ( $captcha !== false ) { $return .= '<div class="gjEditContentInput control-group">' . '<label class="gjEditContentInputTitle control-label">' . CBTxt::Th( 'Captcha' ) . '</label>' . '<div class="gjEditContentInputField controls">' . '<div style="margin-bottom: 5px;">' . $captcha['code'] . '</div>' . '<div>' . $captcha['input'] . '</div>' . '<span class="gjEditContentInputIcon help-inline">' . cbgjClass::getIcon( null, CBTxt::T( 'Required' ), 'icon-star' ) . '</span>' . '</div>' . '</div>'; } $return .= '<div class="gjButtonWrapper form-actions">' . '<input type="submit" value="' . htmlspecialchars( CBTxt::T( 'Send Invite' ) ) . '" class="gjButton gjButtonSubmit btn btn-primary" /> ' . ( $groupInvitesToggle ? '<a href="#gjInviteToggle" role="button" class="gjButton gjButtonCancel btn btn-mini gjToggleCollapse">' . CBTxt::Th( 'Cancel' ) . '</a>' : null ) . '</div>' . cbGetSpoofInputTag( 'plugin' ) . '</form>' . '<form action="' . $group->getUrl() . '" method="post" name="gjForm_invites" id="gjForm_invites" class="gjForm">'; if ( $groupInvitesToggle || $groupInvitesSearch ) { $return .= '<div class="gjTop row-fluid">' . '<div class="gjTop gjTopLeft span6">' . ( $groupInvitesToggle ? '<a href="#gjForm_invite" id="gjInviteToggle" role="button" class="gjButton btn gjToggleExpand">' . CBTxt::Th( 'New Invite' ) . '</a>' : null ) . '</div>' . '<div class="gjTop gjTopRight span6">' . ( $groupInvitesSearch ? $pageNav->search : null ) . '</div>' . '</div>'; } if ( $rows ) { $return .= '<div class="gjContent">'; foreach ( $rows as $row ) { if ( $row->get( 'user' ) ) { $userAvatar = $row->getInvitedAvatar( true ); $userName = $row->getInvitedName( true ); $userOnline = $row->getInvitedOnline(); } else { $userAvatar = '<img src="' . selectTemplate() . 'images/avatar/tnnophoto_n.png" alt="' . htmlspecialchars( $row->get( 'email' ) ) . '" title="' . htmlspecialchars( $row->get( 'email' ) ) . '" />'; $userName = '******' . htmlspecialchars( $row->get( 'email' ) ) . '">' . htmlspecialchars( $row->get( 'email' ) ) . '</a>'; $userOnline = null; } $menuItems = cbgjClass::getIntegrations( 'gj_onBeforeGroupInviteMenu', array( $row, $group, $category, $user, $plugin ) ) . '<div><a href="javascript: void(0);" onclick="' . cbgjClass::getPluginURL( array( 'invites', 'delete', (int) $category->get( 'id' ), (int) $group->get( 'id' ), (int) $row->get( 'id' ) ), CBTxt::T( 'Are you sure you want to delete this invite?' ) ) . '"><i class="icon-remove"></i> ' . CBTxt::Th( 'Delete' ) . '</a></div>' . cbgjClass::getIntegrations( 'gj_onAfterGroupInviteMenu', array( $row, $group, $category, $user, $plugin ) ); $return .= '<div class="gjContentBox mini-layout">' . '<div class="gjContentBoxRow">' . $userName . '</div>' . '<div class="gjContentBoxRow">' . $userAvatar . '</div>' . ( $userOnline ? '<div class="gjContentBoxRow">' . $userOnline . '</div>' : null ) . '<div class="gjContentBoxRow">' . cbgjClass::getIntegrations( 'gj_onBeforeGroupInviteInfo', array( $row, $group, $category, $user, $plugin ) ) . '<span title="' . cbFormatDate( $row->get( 'invited' ), 1, false ) . ( $row->isAccepted() ? ' - ' . cbFormatDate( $row->get( 'accepted' ), 1, false ) : null ) . '">' . $row->getStatus() . '</span>' . cbgjClass::getIntegrations( 'gj_onAfterGroupInviteInfo', array( $row, $group, $category, $user, $plugin ) ) . '</div>'; if ( ( ! $row->isAccepted() ) && ( $row->dateDifference() >= 5 ) ) { $return .= '<div class="gjContentBoxRow">' . '<input type="button" value="' . htmlspecialchars( CBTxt::Th( 'Resend' ) ) . '" class="gjButton btn btn-mini btn-success" onclick="' . cbgjClass::getPluginURL( array( 'invites', 'send', (int) $category->get( 'id' ), (int) $group->get( 'id' ), (int) $row->get( 'id' ) ), true ) . '" />' . '</div>'; } $return .= '<div class="gjContentBoxRow">' . cbgjClass::getDropdown( $menuItems, CBTxt::T( 'Menu' ) ) . '</div>'; $return .= '</div>'; } $return .= '</div>'; } else { $return .= '<div class="gjContent">'; if ( $groupInvitesSearch && $pageNav->searching ) { $return .= CBTxt::Th( 'No invite search results found.' ); } else { $return .= CBTxt::Th( 'There are no invites available.' ); } $return .= '</div>'; } if ( $groupInvitesPaging ) { $return .= '<div class="gjPaging pagination pagination-centered">' . ( $pageNav->total > $pageNav->limit ? $pageNav->pagelinks : null ) . ( ! $groupInvitesLimitbox ? $pageNav->getLimitBox( false ) : ( $pageNav->total ? '<div class="gjPagingLimitbox">' . $pageNav->limitbox . '</div>' : null ) ) . '</div>'; } $return .= cbGetSpoofInputTag( 'plugin' ) . '</form>'; return $return; }
/** * render frontend category edit * * @param cbgjCategory $row * @param array $input * @param moscomprofilerUser $user * @param object $plugin */ static function showCategoryEdit( $row, $input, $user, $plugin ) { $authorized = cbgjClass::getAuthorization( $row, null, $user ); $pageTitle = CBTxt::P( ( $row->get( 'id' ) ? 'Edit [category]' : 'Create [category]' ), array( '[category]' => cbgjClass::getOverride( 'category' ) ) ); $row->setPathway( $pageTitle, cbgjClass::getPluginURL( ( $row->get( 'id' ) ? array( 'categories', 'edit', (int) $row->get( 'id' ) ) : array( 'categories', 'new', (int) $row->get( 'parent' ) ) ) ) ); $tabs = new cbTabs( 0, 1 ); $onEdit = cbgjClass::getIntegrations( 'gj_onCategoryEdit', array( $tabs, $row, $user, $plugin ), null, null ); $return = '<div class="gjCategoryEdit">' . '<form action="' . cbgjClass::getPluginURL( array( 'categories', 'save', (int) $row->get( 'id' ) ), null, true, false, null, 'current' ) . '" method="post" enctype="multipart/form-data" name="gjForm" id="gjForm" class="gjForm form-horizontal">' . '<legend class="gjEditTitle">' . $pageTitle . '</legend>'; if ( cbgjClass::hasAccess( 'usr_mod', $authorized ) || $row->getParentAccess( array( 'mod_lvl1', $user ) ) ) { $return .= '<div class="gjEditContentInput control-group">' . '<label class="gjEditContentInputTitle control-label">' . CBTxt::Th( 'Published' ) . '</label>' . '<div class="gjEditContentInputField controls">' . $input['publish'] . '<span class="gjEditContentInputIcon help-inline">' . cbgjClass::getIcon( CBTxt::P( 'Select publish status of [category]. Unpublished [categories] will not be visible to the public as well as its [groups].', array( '[category]' => cbgjClass::getOverride( 'category' ), '[categories]' => cbgjClass::getOverride( 'category', true ), '[groups]' => cbgjClass::getOverride( 'group', true ) ) ) ) . '</span>' . '</div>' . '</div>'; } if ( cbgjClass::hasAccess( 'usr_mod', $authorized ) || ( $plugin->params->get( 'category_nested', 1 ) && ( ! $row->get( 'parent' ) ) ) ) { $return .= '<div class="gjEditContentInput control-group">' . '<label class="gjEditContentInputTitle control-label">' . CBTxt::Th( 'Parent' ) . '</label>' . '<div class="gjEditContentInputField controls">' . $input['parent'] . '<span class="gjEditContentInputIcon help-inline">' . cbgjClass::getIcon( CBTxt::P( 'Select parent [category]. Selecting parent [category] allows for nested [category] display.', array( '[category]' => cbgjClass::getOverride( 'category' ) ) ) ) . '</span>' . '</div>' . '</div>'; } elseif ( $row->get( 'parent' ) ) { $return .= '<div class="gjEditContentInput control-group">' . '<label class="gjEditContentInputTitle control-label">' . CBTxt::Th( 'Parent' ) . '</label>' . '<div class="gjEditContentInputField controls">' . $row->getParent()->getName() . '<input type="hidden" id="parent" name="parent" value="' . (int) $row->get( 'parent' ) . '" />' . '</div>' . '</div>'; } $return .= '<div class="gjEditContentInput control-group">' . '<label class="gjEditContentInputTitle control-label">' . CBTxt::Th( 'Name' ) . '</label>' . '<div class="gjEditContentInputField controls">' . $input['name'] . '<span class="gjEditContentInputIcon help-inline">' . cbgjClass::getIcon( null, CBTxt::T( 'Required' ), 'icon-star' ) . cbgjClass::getIcon( CBTxt::P( 'Input [category] name. This is the name that will distinguish this [category] from others. Suggested to input something unique and intuitive.', array( '[category]' => cbgjClass::getOverride( 'category' ) ) ) ) . '</span>' . '</div>' . '</div>' . '<div class="gjEditContentInput control-group">' . '<label class="gjEditContentInputTitle control-label">' . CBTxt::Th( 'Description' ) . '</label>' . '<div class="gjEditContentInputField controls">' . $input['description'] . '<span class="gjEditContentInputIcon help-inline">' . cbgjClass::getIcon( CBTxt::P( 'Input [category] description. Your [category] description should be short and to the point; describing what your [category] is all about.', array( '[category]' => cbgjClass::getOverride( 'category' ) ) ) ) . '</span>' . '</div>' . '</div>'; if ( $input['inputlimit'] !== false ) { $return .= '<div class="gjEditContentInput control-group">' . '<label class="gjEditContentInputTitle control-label">' . CBTxt::Th( 'Input Limit' ) . '</label>' . '<div class="gjEditContentInputField controls">' . $input['inputlimit'] . '</div>' . '</div>'; } $return .= '<div class="gjEditContentInput control-group">' . '<label class="gjEditContentInputTitle control-label">' . CBTxt::Th( 'Logo' ) . '</label>' . '<div class="gjEditContentInputField controls">' . '<div style="margin-bottom: 10px;">' . $row->getLogo( true ) . '</div>' . ( $row->get( 'logo' ) ? '<div style="margin-bottom: 5px;">' . $input['del_logo'] . '</div>' : null ) . '<div>' . $input['file'] . '<span class="gjEditContentInputIcon help-inline">' . cbgjClass::getIcon( CBTxt::P( 'Select [category] logo. A logo should represent the focus of your [category]; please be respectful and tasteful when selecting a logo.', array( '[category]' => cbgjClass::getOverride( 'category' ) ) ) ) . '</span>' . '</div>' . '</div>' . '</div>'; if ( $plugin->params->get( 'category_types_config', 1 ) || cbgjClass::hasAccess( 'usr_mod', $authorized ) ) { $return .= '<div class="gjEditContentInput control-group">' . '<label class="gjEditContentInputTitle control-label">' . CBTxt::Th( 'Types' ) . '</label>' . '<div class="gjEditContentInputField controls">' . $input['types'] . '<span class="gjEditContentInputIcon help-inline">' . cbgjClass::getIcon( null, CBTxt::T( 'Required' ), 'icon-star' ) . cbgjClass::getIcon( CBTxt::P( 'Select [categories] available [group] types. Types determine the way a [group] is joined (e.g. Invite requires new [users] to be invited to join a [group]).', array( '[categories]' => cbgjClass::getOverride( 'category', true ), '[group]' => cbgjClass::getOverride( 'group' ), '[users]' => cbgjClass::getOverride( 'user', true ) ) ) ) . '</span>' . '</div>' . '</div>'; } if ( $plugin->params->get( 'category_access_config', 1 ) || cbgjClass::hasAccess( 'usr_mod', $authorized ) ) { $return .= '<div class="gjEditContentInput control-group">' . '<label class="gjEditContentInputTitle control-label">' . CBTxt::Th( 'Access' ) . '</label>' . '<div class="gjEditContentInputField controls">' . $input['access'] . '<span class="gjEditContentInputIcon help-inline">' . cbgjClass::getIcon( CBTxt::P( 'Select [category] access. Access determines who can effectively see your [category]. The group selected as well as those above it will have access (e.g. Registered will also be accessible to Author).', array( '[category]' => cbgjClass::getOverride( 'category' ) ) ) ) . '</span>' . '</div>' . '</div>'; } if ( cbgjClass::hasAccess( 'grp_create', $authorized ) ) { if ( $plugin->params->get( 'category_create_config', 1 ) || cbgjClass::hasAccess( 'usr_mod', $authorized ) ) { $return .= '<div class="gjEditContentInput control-group">' . '<label class="gjEditContentInputTitle control-label">' . CBTxt::Th( 'Create' ) . '</label>' . '<div class="gjEditContentInputField controls">' . $input['create'] . '<span class="gjEditContentInputIcon help-inline">' . cbgjClass::getIcon( CBTxt::P( 'Enable or disable the creation of [groups] in this [category]. Moderators and [owner] are exempt from this configuration and can always create [groups].', array( '[category]' => cbgjClass::getOverride( 'category' ), '[owner]' => cbgjClass::getOverride( 'owner' ), '[groups]' => cbgjClass::getOverride( 'group', true ) ) ) ) . '</span>' . '</div>' . '</div>'; } if ( $plugin->params->get( 'category_createaccess_config', 1 ) || cbgjClass::hasAccess( 'usr_mod', $authorized ) ) { $return .= '<div class="gjEditContentInput control-group">' . '<label class="gjEditContentInputTitle control-label">' . CBTxt::Th( 'Create Access' ) . '</label>' . '<div class="gjEditContentInputField controls">' . $input['create_access'] . '<span class="gjEditContentInputIcon help-inline">' . cbgjClass::getIcon( CBTxt::P( 'Select [group] create access. Create access determines who can create [groups] in this [category]. The group selected as well as those above it will have access (e.g. Registered will also be accessible to Author). Moderators and [owner] are exempt from this configuration and can always create [groups].', array( '[category]' => cbgjClass::getOverride( 'category' ), '[owner]' => cbgjClass::getOverride( 'owner' ), '[group]' => cbgjClass::getOverride( 'group' ), '[groups]' => cbgjClass::getOverride( 'group', true ) ) ) ) . '</span>' . '</div>' . '</div>'; } } if ( cbgjClass::hasAccess( 'cat_nested', $authorized ) ) { if ( $plugin->params->get( 'category_nested_config', 1 ) || cbgjClass::hasAccess( 'usr_mod', $authorized ) ) { $return .= '<div class="gjEditContentInput control-group">' . '<label class="gjEditContentInputTitle control-label">' . CBTxt::Th( 'Nested' ) . '</label>' . '<div class="gjEditContentInputField controls">' . $input['nested'] . '<span class="gjEditContentInputIcon help-inline">' . cbgjClass::getIcon( CBTxt::P( 'Enable or disable the creation of [categories] in this [category]. Moderators and [owner] are exempt from this configuration and can always create [categories].', array( '[category]' => cbgjClass::getOverride( 'category' ), '[categories]' => cbgjClass::getOverride( 'category', true ), '[owner]' => cbgjClass::getOverride( 'owner' ) ) ) ) . '</span>' . '</div>' . '</div>'; } if ( $plugin->params->get( 'category_nestedaccess_config', 1 ) || cbgjClass::hasAccess( 'usr_mod', $authorized ) ) { $return .= '<div class="gjEditContentInput control-group">' . '<label class="gjEditContentInputTitle control-label">' . CBTxt::Th( 'Nested Access' ) . '</label>' . '<div class="gjEditContentInputField controls">' . $input['nested_access'] . '<span class="gjEditContentInputIcon help-inline">' . cbgjClass::getIcon( CBTxt::P( 'Select [categories] create access. Create access determines who can create [categories] in this [category]. The group selected as well as those above it will have access (e.g. Registered will also be accessible to Author). Moderators and [owner] are exempt from this configuration and can always create [categories].', array( '[category]' => cbgjClass::getOverride( 'category' ), '[categories]' => cbgjClass::getOverride( 'category', true ), '[owner]' => cbgjClass::getOverride( 'owner' ) ) ) ) . '</span>' . '</div>' . '</div>'; } } if ( cbgjClass::hasAccess( 'usr_mod', $authorized ) ) { $return .= '<div class="gjEditContentInput control-group">' . '<label class="gjEditContentInputTitle control-label">' . cbgjClass::getOverride( 'owner' ) . '</label>' . '<div class="gjEditContentInputField controls">' . $input['owner'] . '<span class="gjEditContentInputIcon help-inline">' . cbgjClass::getIcon( null, CBTxt::T( 'Required' ), 'icon-star' ) . cbgjClass::getIcon( CBTxt::P( 'Input [category] [owner]. [category] [owner] determines the creator of the [category] specified as User ID.', array( '[category]' => cbgjClass::getOverride( 'category' ), '[owner]' => cbgjClass::getOverride( 'owner' ) ) ) ) . '</span>' . '</div>' . '</div>'; } if ( $onEdit ) { $return .= '<div class="gjEditContentInput control-group">' . '<label class="gjEditContentInputTitle control-label">' . CBTxt::Th( 'Integrations' ) . '</label>' . '<div class="gjEditContentInputField controls">' . $tabs->startPane( 'gjIntegrationsTabs' ) . $onEdit . $tabs->endPane() . '</div>' . '</div>'; } if ( $input['captcha'] !== false ) { $return .= '<div class="gjEditContentInput control-group">' . '<label class="gjEditContentInputTitle control-label">' . CBTxt::Th( 'Captcha' ) . '</label>' . '<div class="gjEditContentInputField controls">' . '<div style="margin-bottom: 5px;">' . $input['captcha']['code'] . '</div>' . '<div>' . $input['captcha']['input'] . '</div>' . '<span class="gjEditContentInputIcon help-inline">' . cbgjClass::getIcon( null, CBTxt::T( 'Required' ), 'icon-star' ) . '</span>' . '</div>' . '</div>'; } $return .= '<div class="gjButtonWrapper form-actions">' . '<input type="submit" value="' . htmlspecialchars( ( $row->get( 'id' ) ? CBTxt::P( 'Update [category]', array( '[category]' => cbgjClass::getOverride( 'category' ) ) ) : CBTxt::P( 'Create [category]', array( '[category]' => cbgjClass::getOverride( 'category' ) ) ) ) ) . '" class="gjButton gjButtonSubmit btn btn-primary" /> ' . '<input type="button" value="' . htmlspecialchars( CBTxt::T( 'Cancel' ) ) . '" class="gjButton gjButtonCancel btn btn-mini" onclick="' . cbgjClass::getPluginURL( ( $row->get( 'id' ) ? array( 'categories', 'show', (int) $row->get( 'id' ) ) : ( $row->get( 'parent' ) ? array( 'categories', 'show', (int) $row->get( 'parent' ) ) : array( 'overview' ) ) ), CBTxt::T( 'Are you sure you want to cancel? All unsaved data will be lost!' ), true, false, null, false, false, true ) . '" />' . '</div>' . cbGetSpoofInputTag( 'plugin' ) . '</form>' . '</div>'; echo $return; }