当前位置: 首页>>代码示例>>PHP>>正文


PHP CBTxt::P方法代码示例

本文整理汇总了PHP中CBTxt::P方法的典型用法代码示例。如果您正苦于以下问题:PHP CBTxt::P方法的具体用法?PHP CBTxt::P怎么用?PHP CBTxt::P使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CBTxt的用法示例。


在下文中一共展示了CBTxt::P方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: showGroupPanes

	/**
	 * render frontend group panes
	 *
	 * @param cbgjGroup $row
	 * @param cbgjCategory $category
	 * @param moscomprofilerUser $user
	 * @param object $plugin
	 * @return string
	 */
	static function showGroupPanes( $row, $category, $user, $plugin ) {
		$authorized		=	cbgjClass::getAuthorization( $category, $row, $user );

		if ( $row->get( 'published' ) == 1 ) {
			$state		=	'<div><i class="icon-ban-circle"></i> <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' ) ) ) ) . '">' . CBTxt::Ph( 'Unpublish [group]', array( '[group]' => cbgjClass::getOverride( 'group' ) ) ) . '</a></div>';
		} else {
			$state		=	'<div><i class="icon-ok"></i> <a href="' . cbgjClass::getPluginURL( array( 'groups', 'publish', (int) $category->get( 'id' ), (int) $row->get( 'id' ) ) ) . '">' . CBTxt::Ph( 'Publish [group]', array( '[group]' => cbgjClass::getOverride( 'group' ) ) ) . '</a></div>';
		}

		$groupAdmins	=	$row->getAdmins();
		$groupMods		=	$row->getModerators();

		$return			=	'<legend class="gjHeaderTitle">' . $row->getName() . '</legend>'
						.	'<div class="gjGrid row-fluid">'
						.		'<div class="gjGridLeft span9">'
						.			'<div class="gjGridLeftLogo span4">'
						.				$row->getLogo( true )
						.			'</div>'
						.			'<div class="gjGridLeftInfo span8">'
						.				cbgjClass::getIntegrations( 'gj_onBeforeGroupInfo', array( $row, $category, $user, $plugin ) )
						.				( ( ( ( ! $row->get( 'nested' ) ) && cbgjClass::hasAccess( 'mod_lvl2', $authorized ) ) || $row->get( 'nested' ) ) && $row->nestedCount() ? '<div>' . cbgjClass::getOverride( 'group', true ) . ': ' . $row->nestedCount() . '</div>' : null )
						.				( $row->userCount() ? '<div>' . cbgjClass::getOverride( 'user', true ) . ': ' . $row->userCount() . '</div>' : null )
						.				( $row->get( 'user_id' ) ? '<div>' . cbgjClass::getOverride( 'owner' ) . ': ' . $row->getOwnerName( true ) . '</div>' : null )
						.				( ! empty( $groupMods ) ? '<div>' . cbgjClass::getOverride( 'moderator', true ) . ': ' . implode( ', ', $groupMods ) . '</div>' : null )
						.				( ! empty( $groupAdmins ) ? '<div>' . cbgjClass::getOverride( 'admin', true ) . ': ' . implode( ', ', $groupAdmins ) . '</div>' : null )
						.				'<div>' . CBTxt::Ph( 'Type: [grp_type]', array( '[grp_type]' => $row->getType() ) ) . '</div>'
						.				'<div>' . CBTxt::Ph( 'Access: [grp_access]', array( '[grp_access]' => $row->getAccess() ) ) . '</div>'
						.				'<div>' . cbgjClass::getOverride( 'category' ) . ': ' . $category->getName( 0, true ) . '</div>'
						.				( $row->get( 'parent' ) ? '<div>' . cbgjClass::getOverride( 'group' ) . ': ' . $row->getParent()->getName( 0, true ) . '</div>' : null )
						.				'<div>' . CBTxt::Ph( 'Created: [grp_date]', array( '[grp_date]' => cbFormatDate( $row->get( 'date' ), 1, false ) ) ) . '</div>'
						.				cbgjClass::getIntegrations( 'gj_onAfterGroupInfo', array( $row, $category, $user, $plugin ) )
						.			'</div>';

		if ( $row->get( 'description' ) ) {
			$return		.=			'<div class="gjGridLeftDesc span12 well well-small">'
						.				$row->getDescription()
						.			'</div>';
		}

		$return			.=		'</div>'
						.		'<div class="gjGridRight span3">'
						.			cbgjClass::getIntegrations( 'gj_onBeforeGroupMenu', array( $row, $category, $user, $plugin ), null, null )
						.			( cbgjClass::hasAccess( array( 'grp_join', 'grp_approved' ), $authorized, true ) ? '<div><i class="icon-plus"></i> <a href="' . cbgjClass::getPluginURL( array( 'groups', 'join', (int) $category->get( 'id' ), (int) $row->get( 'id' ) ) ) . '">' . ( cbgjClass::hasAccess( 'grp_invited', $authorized ) ? CBTxt::Th( 'Accept Invite' ) : CBTxt::Ph( 'Join [group]', array( '[group]' => cbgjClass::getOverride( 'group' ) ) ) ) . '</a></div>' : null )
						.			( cbgjClass::hasAccess( array( 'grp_nested_create', 'grp_approved' ), $authorized, true ) ? '<div><i class="icon-plus"></i> <a href="' . cbgjClass::getPluginURL( array( 'groups', 'new', (int) $category->get( 'id' ), (int) $row->get( 'id' ) ) ) . '">' . CBTxt::Ph( 'New [group]', array( '[group]' => cbgjClass::getOverride( 'group' ) ) ) . '</a></div>' : null )
						.			( cbgjClass::hasAccess( array( 'grp_leave', 'grp_approved' ), $authorized, true ) ? '<div><i class="icon-minus"></i> <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' ) ) ) ) . '">' . CBTxt::Ph( 'Leave [group]', array( '[group]' => cbgjClass::getOverride( 'group' ) ) ) . '</a></div>' : null )
						.			( cbgjClass::hasAccess( 'mod_lvl3', $authorized ) ? '<div><i class="icon-pencil"></i> <a href="' . cbgjClass::getPluginURL( array( 'groups', 'edit', (int) $category->get( 'id' ), (int) $row->get( 'id' ) ) ) . '">' . CBTxt::Ph( 'Edit [group]', array( '[group]' => cbgjClass::getOverride( 'group' ) ) ) . '</a></div>' : null )
						.			( cbgjClass::hasAccess( 'grp_message', $authorized ) && $row->userCount() ? '<div><i class="icon-envelope"></i> <a href="' . cbgjClass::getPluginURL( array( 'groups', 'message', (int) $category->get( 'id' ), (int) $row->get( 'id' ) ) ) . '">' . CBTxt::Ph( 'Message [users]', array( '[users]' => cbgjClass::getOverride( 'user', true ) ) ) . '</a></div>' : null )
						.			( cbgjClass::hasAccess( 'grp_can_publish', $authorized ) ? $state : null )
						.			( cbgjClass::hasAccess( 'mod_lvl2', $authorized ) ? '<div><i class="icon-remove"></i> <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 ) ) ) ) . '">' . CBTxt::Ph( 'Delete [group]', array( '[group]' => cbgjClass::getOverride( 'group' ) ) ) . '</a></div>' : null )
						.			cbgjClass::getIntegrations( 'gj_onAfterGroupMenu', array( $row, $category, $user, $plugin ), null, null )
						.			( cbgjClass::hasAccess( 'grp_usr_notifications', $authorized ) ? '<div><i class="icon-info-sign"></i> <a href="' . cbgjClass::getPluginURL( array( 'notifications', 'show', (int) $category->get( 'id' ), (int) $row->get( 'id' ) ) ) . '">' . CBTxt::Th( 'Notifications' ) . '</a></div>' : null )
						.			( $row->get( 'parent' ) ? '<div><i class="icon-share-alt"></i> <a href="' . $row->getParent()->getUrl() . '">' . CBTxt::Ph( 'Back to [group]', array( '[group]' => cbgjClass::getOverride( 'group' ) ) ) . '</a></div>' : null )
						.			( ! $row->get( 'parent' ) ? '<div><i class="icon-share-alt"></i> <a href="' . $category->getUrl() . '">' . CBTxt::Ph( 'Back to [category]', array( '[category]' => cbgjClass::getOverride( 'category' ) ) ) . '</a></div>' : null )
						.		'</div>'
						.	'</div>';

		return $return;
	}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:67,代码来源:group_panes.php

示例2: showCategoryPanes

	/**
	 * render frontend category panes
	 *
	 * @param cbgjCategory $row
	 * @param moscomprofilerUser $user
	 * @param object $plugin
	 * @return string
	 */
	static function showCategoryPanes( $row, $user, $plugin ) {
		$authorized		=	cbgjClass::getAuthorization( $row, null, $user );

		if ( $row->get( 'published' ) == 1 ) {
			$state		=	'<div><i class="icon-ban-circle"></i> <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' ) ) ) ) . '">' . CBTxt::Ph( 'Unpublish [category]', array( '[category]' => cbgjClass::getOverride( 'category' ) ) ) . '</a></div>';
		} else {
			$state		=	'<div><i class="icon-ok"></i> <a href="' . cbgjClass::getPluginURL( array( 'categories', 'publish', (int) $row->get( 'id' ) ) ) . '">' . CBTxt::Ph( 'Publish [category]', array( '[category]' => cbgjClass::getOverride( 'category' ) ) ) . '</a></div>';
		}

		$return			=	'<legend class="gjHeaderTitle">' . $row->getName() . '</legend>'
						.	'<div class="gjGrid row-fluid">'
						.		'<div class="gjGridLeft span9">'
						.			'<div class="gjGridLeftLogo span4">'
						.				$row->getLogo( true )
						.			'</div>'
						.			'<div class="gjGridLeftInfo span8">'
						.				cbgjClass::getIntegrations( 'gj_onBeforeCategoryInfo', array( $row, $user, $plugin ) )
						.				( ( ( ( ! $row->get( 'nested' ) ) && cbgjClass::hasAccess( 'mod_lvl1', $authorized ) ) || $row->get( 'nested' ) ) && $row->nestedCount() ? '<div>' . cbgjClass::getOverride( 'category', true ) . ': ' . $row->nestedCount() . '</div>' : null )
						.				( $row->groupCount() ? '<div>' . cbgjClass::getOverride( 'group', true ) . ': ' . $row->groupCount() . '</div>' : null )
						.				( $row->get( 'user_id' ) ? '<div>' . cbgjClass::getOverride( 'owner' ) . ': ' . $row->getOwnerName( true ) . '</div>' : null )
						.				'<div>' . CBTxt::Ph( 'Types: [cat_types]', array( '[cat_types]' => implode( ', ', $row->getTypes() ) ) ) . '</div>'
						.				'<div>' . CBTxt::Ph( 'Access: [cat_access]', array( '[cat_access]' => $row->getAccess() ) ) . '</div>'
						.				( $row->get( 'parent' ) ? '<div>' . cbgjClass::getOverride( 'category' ) . ': ' . $row->getParent()->getName( 0, true ) . '</div>' : null )
						.				'<div>' . CBTxt::Ph( 'Created: [cat_date]', array( '[cat_date]' => cbFormatDate( $row->get( 'date' ), 1, false ) ) ) . '</div>'
						.				cbgjClass::getIntegrations( 'gj_onAfterCategoryInfo', array( $row, $user, $plugin ) )
						.			'</div>';

		if ( $row->get( 'description' ) ) {
			$return		.=			'<div class="gjGridLeftDesc span12 well well-small">'
						.				$row->getDescription()
						.			'</div>';
		}

		$return			.=		'</div>'
						.		'<div class="gjGridRight span3">'
						.			cbgjClass::getIntegrations( 'gj_onBeforeCategoryMenu', array( $row, $user, $plugin ), null, null )
						.			( cbgjClass::hasAccess( 'cat_nested_create', $authorized ) ? '<div><i class="icon-plus"></i> <a href="' . cbgjClass::getPluginURL( array( 'categories', 'new', (int) $row->get( 'id' ) ) ) . '">' . CBTxt::Ph( 'New [category]', array( '[category]' => cbgjClass::getOverride( 'category' ) ) ) . '</a></div>' : null )
						.			( cbgjClass::hasAccess( 'cat_grp_create', $authorized ) ? '<div><i class="icon-plus"></i> <a href="' . cbgjClass::getPluginURL( array( 'groups', 'new', (int) $row->get( 'id' ) ) ) . '">' . CBTxt::Ph( 'New [group]', array( '[group]' => cbgjClass::getOverride( 'group' ) ) ) . '</a></div>' : null )
						.			( cbgjClass::hasAccess( 'mod_lvl1', $authorized ) ? '<div><i class="icon-pencil"></i> <a href="' . cbgjClass::getPluginURL( array( 'categories', 'edit', (int) $row->get( 'id' ) ) ) . '">' . CBTxt::Ph( 'Edit [category]', array( '[category]' => cbgjClass::getOverride( 'category' ) ) ) . '</a></div>' : null )
						.			( cbgjClass::hasAccess( 'cat_message', $authorized ) && $row->groupCount() ? '<div><i class="icon-envelope"></i> <a href="' . cbgjClass::getPluginURL( array( 'categories', 'message', (int) $row->get( 'id' ) ) ) . '">' . CBTxt::Ph( 'Message [groups]', array( '[groups]' => cbgjClass::getOverride( 'group', true ) ) ) . '</a></div>' : null )
						.			( cbgjClass::hasAccess( 'cat_can_publish', $authorized ) ? $state : null )
						.			( cbgjClass::hasAccess( 'mod_lvl1', $authorized ) ? '<div><i class="icon-remove"></i> <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 ) ) ) ) . '">' . CBTxt::Ph( 'Delete [category]', array( '[category]' => cbgjClass::getOverride( 'category' ) ) ) . '</a></div>' : null )
						.			cbgjClass::getIntegrations( 'gj_onAfterCategoryMenu', array( $row, $user, $plugin ), null, null )
						.			( cbgjClass::hasAccess( 'cat_usr_notifications', $authorized ) ? '<div><i class="icon-info-sign"></i> <a href="' . cbgjClass::getPluginURL( array( 'notifications', 'show', (int) $row->get( 'id' ) ) ) . '">' . CBTxt::Th( 'Notifications' ) . '</a></div>' : null )
						.			( $row->get( 'parent' ) ? '<div><i class="icon-share-alt"></i> <a href="' . $row->getParent()->getUrl() . '">' . CBTxt::Ph( 'Back to [category]', array( '[category]' => cbgjClass::getOverride( 'category' ) ) ) . '</a></div>' : null )
						.			( ! $row->get( 'parent' ) ? '<div><i class="icon-share-alt"></i> <a href="' . cbgjClass::getPluginURL( array( 'overview' ) ) . '">' . CBTxt::Ph( 'Back to [overview]', array( '[overview]' => cbgjClass::getOverride( 'overview' ) ) ) . '</a></div>' : null )
						.		'</div>'
						.	'</div>';

		return $return;
	}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:59,代码来源:category_panes.php

示例3: showCategoryMessage

	/**
	 * 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" />&nbsp;'
						.				'<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;
	}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:58,代码来源:category_message.php

示例4: showOverviewMessage

	/**
	 * 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" />&nbsp;'
						.				'<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;
	}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:55,代码来源:overview_message.php

示例5: validate

 /**
  * Validator:
  * Validates $value for $field->required and other rules
  * Override
  *
  * @param  moscomprofilerFields  $field
  * @param  moscomprofilerUser    $user        RETURNED populated: touch only variables related to saving this field (also when not validating for showing re-edit)
  * @param  string                $columnName  Column to validate
  * @param  string                $value       (RETURNED:) Value to validate, Returned Modified if needed !
  * @param  array                 $postdata    Typically $_POST (but not necessarily), filtering required.
  * @param  string                $reason      'edit' for save profile edit, 'register' for registration, 'search' for searches
  * @return boolean                            True if validate, $this->_setErrorMSG if False
  */
 function validate(&$field, &$user, $columnName, &$value, &$postdata, $reason)
 {
     $validated = parent::validate($field, $user, $columnName, $value, $postdata, $reason);
     if ($validated && $value !== '' && $value !== null) {
         // empty values (e.g. non-mandatory) are treated in the parent validation.
         $pregExp = $this->_getRegexp($field);
         if ($pregExp) {
             $validated = preg_match($pregExp, $value);
             if (!$validated) {
                 $pregExpError = CBTxt::P($field->params->get('pregexperror', 'Not a valid input'), array('[FIELDNAME]' => $field->title));
                 // CBTxt::T('Not a valid input')
                 $this->_setValidationError($field, $user, $reason, $pregExpError);
             }
         }
     }
     return $validated;
 }
开发者ID:rogatnev-nikita,项目名称:cloudinterpreter,代码行数:30,代码来源:cb.core.php

示例6: getField

	/**
	 * Returns a field in specified format
	 *
	 * @param  moscomprofilerFields  $field
	 * @param  moscomprofilerUser    $user
	 * @param  string                $output  'html', 'xml', 'json', 'php', 'csvheader', 'csv', 'rss', 'fieldslist', 'htmledit'
	 * @param  string                $reason  'profile' for user profile view, 'edit' for profile edit, 'register' for registration, 'list' for user-lists
	 * @param  int                   $list_compare_types   IF reason == 'search' : 0 : simple 'is' search, 1 : advanced search with modes, 2 : simple 'any' search
	 * @return mixed                
	 */
	function getField( &$field, &$user, $output, $reason, $list_compare_types ) {
		global $_CB_framework;

		if ( ( $output == 'htmledit' ) && ( $reason != 'search' ) && defined( '_CB_VALIDATE_NEW' ) ) {
			if ( $field->params->get( 'fieldValidateInBrowser', 1 ) == 1 ) {
				$pregExp				=	$this->_getRegexp( $field );
				if ( $pregExp ) {
					$validationId		=	'cbvalidatefield_' . $field->name;
					$pregExpError		=	CBTxt::P( $field->params->get( 'pregexperror', 'Not a valid input' ), array( '[FIELDNAME]' => $field->title ) );				// CBTxt::T('Not a valid input')
					$_CB_framework->outputCbJQuery( 'jQuery.validator.addMethod("' . addslashes( $validationId ) . '", function(value, element) {'
					.	'	return this.optional(element) || ' . $pregExp . '.test(value);'
					.	'}, "' . addslashes( $pregExpError ) . '"); ');
	
					$value				=	$user->get( $field->name );
					return $this->_fieldEditToHtml( $field, $user, $reason, 'input', 'text', $value, '', null, true, array( $this->getMetaClass( $field, array( $validationId . ':true' ) ) ) );
				}
			}
		}
		return parent::getField( $field, $user, $output, $reason, $list_compare_types );
	}
开发者ID:rkern21,项目名称:videoeditor,代码行数:30,代码来源:cb.core.php

示例7: checkcbdb

function checkcbdb($dbId = 0)
{
    global $_CB_database, $_CB_framework, $ueConfig, $_PLUGINS;
    // Try extending time, as unziping/ftping took already quite some... :
    @set_time_limit(240);
    HTML_comprofiler::secureAboveForm('checkcbdb');
    outputCbTemplate(2);
    outputCbJs(2);
    global $_CB_Backend_Title;
    $_CB_Backend_Title = array(0 => array('cbicon-48-tools', CBTxt::T('CB Tools: Check database: Results')));
    $cbSpoofField = cbSpoofField();
    $cbSpoofString = cbSpoofString(null, 'cbtools');
    $version = $_CB_database->getVersion();
    $version = substr($version, 0, strpos($version, '-'));
    if ($dbId == 0) {
        echo "<div style='text-align:left;'><p>" . CBTxt::T('Checking Community Builder Database') . ":</p>";
        // 1. check comprofiler_field_values table for bad rows
        $sql = "SELECT fieldvalueid,fieldid FROM #__comprofiler_field_values WHERE fieldid=0";
        $_CB_database->setQuery($sql);
        $bad_rows = $_CB_database->loadObjectList();
        if ($_CB_database->getErrorNum()) {
            echo "<p><font color=red>" . sprintf(CBTxt::T('ERROR: sql query: %s : returned error: %s'), htmlspecialchars($sql), stripslashes($_CB_database->getErrorMsg())) . "</font></p>";
        } elseif (count($bad_rows) != 0) {
            echo "<p><font color=red>" . sprintf(CBTxt::T('Warning: %s entries in Community Builder comprofiler_field_values have bad fieldid values.'), count($bad_rows)) . "</font></p>";
            foreach ($bad_rows as $bad_row) {
                if ($bad_row->fieldvalueid == 0) {
                    echo "<p><font color=red>" . sprintf(CBTxt::T('ZERO fieldvalueid illegal: fieldvalueid=%s fieldid=0'), $bad_row->fieldvalueid) . "</font></p>";
                } else {
                    echo "<p><font color=red>fieldvalueid=" . $bad_row->fieldvalueid . " fieldid=0</font></p>";
                }
            }
            echo '<p><font color=red>' . CBTxt::T('This one can be fixed by <strong>first backing up database</strong>') . ' <a href="' . $_CB_framework->backendUrl("index.php?option=com_comprofiler&task=fixcbmiscdb&{$cbSpoofField}={$cbSpoofString}") . '"> ' . CBTxt::T('then by clicking here') . '</a>.</font></p>';
        } else {
            echo "<p><font color=green>" . CBTxt::T('All Community Builder comprofiler_field_values table fieldid rows all match existing fields.') . "</font></p>";
        }
        // 2.	check if comprofiler_field_values table has entries where corresponding fieldtype value in comprofiler_fields table
        //		does not allow values
        $sql = "SELECT v.fieldvalueid, v.fieldid, f.name, f.type FROM #__comprofiler_field_values as v, #__comprofiler_fields as f WHERE v.fieldid = f.fieldid AND f.type NOT IN ('checkbox','multicheckbox','select','multiselect','radio')";
        $_CB_database->setQuery($sql);
        $bad_rows = $_CB_database->loadObjectList();
        if ($_CB_database->getErrorNum()) {
            echo "<p><font color=red>" . sprintf(CBTxt::T('ERROR: sql query: %s : returned error: %s'), htmlspecialchars($sql), stripslashes($_CB_database->getErrorMsg())) . "</font></p>";
        } elseif (count($bad_rows) != 0) {
            echo "<p><font color=red>" . sprintf(CBTxt::T('Warning: %s entries in Community Builder comprofiler_field_values link back to fields of wrong fieldtype.'), count($bad_rows)) . "</font></p>";
            foreach ($bad_rows as $bad_row) {
                echo "<p><font color=red>fieldvalueid=" . $bad_row->fieldvalueid . " fieldtype=" . $bad_row->type . "</font></p>";
            }
            echo "<p><font color=red>" . CBTxt::T('This one can be fixed in SQL using a tool like phpMyAdmin.') . "</font></p>";
            // not done automatically since some fields might have field values ! echo '<p><font color=red>This one can be fixed by <strong>first backing up database</strong> then <a href="' . $_CB_framework->backendUrl( "index.php?option=com_comprofiler&task=fixcbmiscdb&$cbSpoofField=$cbSpoofString" ) . '">by clicking here</a>.</font></p>';
        } else {
            echo "<p><font color=green>" . CBTxt::T('All Community Builder comprofiler_field_values table rows link to correct fieldtype fields in comprofiler_field table.') . "</font></p>";
        }
        // 5.	check if all cb defined fields have corresponding comprofiler columns
        $sql = "SELECT * FROM #__comprofiler";
        $_CB_database->setQuery($sql, 0, 1);
        $all_comprofiler_fields_and_values = $_CB_database->loadAssoc();
        $all_comprofiler_fields = array();
        if ($all_comprofiler_fields_and_values === null) {
            echo "<p><font color=red>" . sprintf(CBTxt::T('ERROR: sql query: %s : returned error: %s'), htmlspecialchars($sql), stripslashes($_CB_database->getErrorMsg())) . "</font></p>";
        } elseif (is_array($all_comprofiler_fields_and_values)) {
            while (false != (list($_cbfield) = each($all_comprofiler_fields_and_values))) {
                array_push($all_comprofiler_fields, $_cbfield);
            }
        }
        $sql = "SELECT * FROM #__comprofiler_fields WHERE `name` != 'NA' AND `table` = '#__comprofiler'";
        $_CB_database->setQuery($sql);
        $field_rows = $_CB_database->loadObjectList(null, 'moscomprofilerFields', array(&$_CB_database));
        if ($_CB_database->getErrorNum()) {
            echo "<p><font color=red>" . sprintf(CBTxt::T('ERROR: sql query: %s : returned error: %s'), htmlspecialchars($sql), stripslashes($_CB_database->getErrorMsg())) . "</font></p>";
        } else {
            $html_output = array();
            $cb11 = true;
            foreach ($field_rows as $field_row) {
                if ($field_row->tablecolumns !== null) {
                    // CB 1.2 way:
                    if ($field_row->tablecolumns != '') {
                        $tableColumns = explode(',', $field_row->tablecolumns);
                        foreach ($tableColumns as $col) {
                            if (!in_array($col, $all_comprofiler_fields)) {
                                $html_output[] = "<p><font color=red>" . sprintf(CBTxt::T(' - Field %s - Column %s is missing from comprofiler table.'), $field_row->name, $col) . "</font></p>";
                            }
                        }
                    }
                    $cb11 = false;
                } else {
                    // cb 1.1 way
                    if (!in_array($field_row->name, $all_comprofiler_fields)) {
                        $html_output[] = "<p><font color=red>" . sprintf(CBTxt::T(' - Column %s is missing from comprofiler table.'), $field_row->name) . "</font></p>";
                    }
                }
            }
            if (count($html_output) > 0) {
                echo "<p><font color=red>" . sprintf(CBTxt::T('There are %s column(s) missing in the comprofiler table, which are defined as fields (rows in comprofiler_fields):'), count($html_output)) . "</font></p>";
                echo implode('', $html_output);
                echo "<p><font color=red>" . CBTxt::T('This one can be fixed by deleting and recreating the field(s) using components / Community Builder / Field Management.') . '<br />' . CBTxt::T('Please additionally make sure that columns in comprofiler table <strong>are not also duplicated in users table</strong>.') . "</font></p>";
            } elseif ($cb11) {
                echo "<p><font color=red>" . CBTxt::T('All Community Builder fields from comprofiler_fields are present as columns in the comprofiler table, but comprofiler_fields table is not yet upgraded to CB 1.2 table structure. Just going to Community Builder Fields Management will fix this automatically.') . "</font></p>";
            } else {
                echo "<p><font color=green>" . CBTxt::T('All Community Builder fields from comprofiler_fields are present as columns in the comprofiler table.') . "</font></p>";
            }
//.........这里部分代码省略.........
开发者ID:rogatnev-nikita,项目名称:cloudinterpreter,代码行数:101,代码来源:controller.default.php

示例8: showGroupAll

	/**
	 * 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 {
//.........这里部分代码省略.........
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:101,代码来源:group_all.php

示例9: htmlspecialchars

								.					( $nestedCount ? '<div class="gjModuleContentBoxRow">' . cbgjClass::getOverride( 'group', $row->nestedCount() ) . '</div>' : null )
								.					( $row->userCount() ? '<div class="gjModuleContentBoxRow">' . cbgjClass::getOverride( 'user', $row->userCount() ) . '</div>' : null )
								.					'<div class="gjModuleContentBoxRow"><input type="button" value="' . htmlspecialchars( CBTxt::T( 'Join' ) ) . '" class="gjButton btn btn-mini btn-success" onclick="' . cbgjClass::getPluginURL( array( 'groups', 'join', (int) $row->get( 'category' ), (int) $row->get( 'id' ) ), true, true, false, null, true ) . '" /></div>'
								.				'</div>';
		} else {
			$return				.=				'<div class="gjModuleContent row-fluid">'
								.					'<div class="gjModuleContentLogo span2">' . $row->getLogo( true, true, true ) . '</div>'
								.					'<div class="gjModuleContentBody span10">'
								.						'<div class="gjModuleContentBodyTitle">' . $row->getName( $nameLength, true ) . '</div>'
								.						'<div class="gjModuleContentBodyInfo">'
								.							( $nestedCount ? cbgjClass::getOverride( 'group', $row->nestedCount() ) : null )
								.							( $row->userCount() ? ( $nestedCount ? ' | ' : null ) . cbgjClass::getOverride( 'user', $row->userCount() ) : null )
								.						'</div>'
								.						'<div class="gjModuleContentBodyFooter"><input type="button" value="' . htmlspecialchars( CBTxt::T( 'Join' ) ) . '" class="gjButton btn btn-mini btn-success" onclick="' . cbgjClass::getPluginURL( array( 'groups', 'join', (int) $row->get( 'category' ), (int) $row->get( 'id' ) ), true, true, false, null, true ) . '" /></div>'
								.					'</div>'
								.				'</div>'
								.				'<div class="gjModuleContentDivider"></div>';
		}
	} else {
		$return					.=				CBTxt::P( 'You are not invited to any [groups].', array( '[groups]' => cbgjClass::getOverride( 'group', true ) ) );
	}

	$return						.=			'</div>';
}

$return							.=		'</div>'
								.	'</div>';

echo $return;
?>
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:30,代码来源:mod_cbgroupjive.php

示例10: saveMenus

	/**
	 * save menus
	 *
	 * @param string $id
	 * @param moscomprofilerUser $user
	 * @param object $plugin
	 */
	private function saveMenus( $user, $plugin ) {
		$types								=	cbGetParam( $_POST, 'type', array() );
		$categories							=	cbGetParam( $_POST, 'cats', array() );
		$groups								=	cbGetParam( $_POST, 'grps', array() );

		if ( $categories ) {
			cbArrayToInts( $categories );
		}

		if ( $groups ) {
			cbArrayToInts( $groups );
		}

		if ( $types ) {
			foreach ( $types as $type ) {
				switch ( $type ) {
					case 'categories':
						if ( $categories ) {
							foreach ( $categories as $catid ) {
								$category	=	cbgjData::getCategories( null, array( 'id', '=', (int) $catid ), null, null, false );

								if ( ! cbgjClass::setMenu( $category->getName(), 'index.php?option=' . $plugin->option . '&task=pluginclass&plugin=' . $plugin->element . '&action=categories&func=show&cat=' . $category->get( 'id' ), $plugin ) ) {
									cbgjClass::getPluginURL( array( 'menus' ), CBTxt::P( '[category_name] menu failed to create!', array( '[category_name]' => $category->getName() ) ), false, true, 'error' );
								}
							}
						} else {
							cbgjClass::getPluginURL( array( 'menus' ), CBTxt::T( 'No categories specified to create menus for.' ), false, true, 'error' );
						}
						break;
					case 'groups':
						if ( $groups ) {
							foreach ( $groups as $grpid ) {
								$group		=	cbgjData::getGroups( null, array( 'id', '=', (int) $grpid ), null, null, false );

								if ( ! cbgjClass::setMenu( $group->getName(), 'index.php?option=' . $plugin->option . '&task=pluginclass&plugin=' . $plugin->element . '&action=groups&func=show&cat=' . $group->get( 'category' ) . '&grp=' . $group->get( 'id' ), $plugin ) ) {
									cbgjClass::getPluginURL( array( 'menus' ), CBTxt::P( '[group_name] menu failed to create!', array( '[group_name]' => $group->getName() ) ), false, true, 'error' );
								}
							}
						} else {
							cbgjClass::getPluginURL( array( 'menus' ), CBTxt::T( 'No groups specified to create menus for.' ), false, true, 'error' );
						}
						break;
					case 'new-category-nested':
						if ( $categories ) {
							foreach ( $categories as $catid ) {
								$category	=	cbgjData::getCategories( null, array( 'id', '=', (int) $catid ), null, null, false );

								if ( ! cbgjClass::setMenu( CBTxt::P( '[category_name] New [category]', array( '[category_name]' => $category->getName(), '[category]' => cbgjClass::getOverride( 'category' ) ) ), 'index.php?option=' . $plugin->option . '&task=pluginclass&plugin=' . $plugin->element . '&action=categories&func=new&cat=' . $category->get( 'id' ), $plugin ) ) {
									cbgjClass::getPluginURL( array( 'menus' ), CBTxt::P( '[category_name] new category menu failed to create!', array( '[category_name]' => $category->getName() ) ), false, true, 'error' );
								}
							}
						} else {
							cbgjClass::getPluginURL( array( 'menus' ), CBTxt::T( 'No categories specified to create menus for.' ), false, true, 'error' );
						}
						break;
					case 'new-category-group':
						if ( $categories ) {
							foreach ( $categories as $catid ) {
								$category	=	cbgjData::getCategories( null, array( 'id', '=', (int) $catid ), null, null, false );

								if ( ! cbgjClass::setMenu( CBTxt::P( '[category_name] New [group]', array( '[category_name]' => $category->getName(), '[group]' => cbgjClass::getOverride( 'group' ) ) ), 'index.php?option=' . $plugin->option . '&task=pluginclass&plugin=' . $plugin->element . '&action=groups&func=new&cat=' . $category->get( 'id' ), $plugin ) ) {
									cbgjClass::getPluginURL( array( 'menus' ), CBTxt::P( '[category_name] new group menu failed to create!', array( '[category_name]' => $category->getName() ) ), false, true, 'error' );
								}
							}
						} else {
							cbgjClass::getPluginURL( array( 'menus' ), CBTxt::T( 'No categories specified to create menus for.' ), false, true, 'error' );
						}
						break;
					case 'new-group-nested':
						if ( $groups ) {
							foreach ( $groups as $grpid ) {
								$group		=	cbgjData::getGroups( null, array( 'id', '=', (int) $grpid ), null, null, false );

								if ( ! cbgjClass::setMenu( CBTxt::P( '[group_name] New [category]', array( '[group_name]' => $group->getName(), '[category]' => cbgjClass::getOverride( 'category' ) ) ), 'index.php?option=' . $plugin->option . '&task=pluginclass&plugin=' . $plugin->element . '&action=groups&func=new&cat=' . $group->get( 'category' ) . '&grp=' . $group->get( 'id' ), $plugin ) ) {
									cbgjClass::getPluginURL( array( 'menus' ), CBTxt::P( '[group_name] new category menu failed to create!', array( '[group_name]' => $group->getName() ) ), false, true, 'error' );
								}
							}
						} else {
							cbgjClass::getPluginURL( array( 'menus' ), CBTxt::T( 'No categories specified to create menus for.' ), false, true, 'error' );
						}
						break;
					case 'approve-category':
						if ( ! cbgjClass::setMenu( CBTxt::P( '[category] Approval', array( '[category]' => cbgjClass::getOverride( 'category' ) ) ), 'index.php?option=' . $plugin->option . '&task=pluginclass&plugin=' . $plugin->element . '&action=categories&func=approval', $plugin ) ) {
							cbgjClass::getPluginURL( array( 'menus' ), CBTxt::T( 'Category approval menu failed to create!' ), false, true, 'error' );
						}
						break;
					case 'approve-group':
						if ( ! cbgjClass::setMenu( CBTxt::P( '[group] Approval', array( '[group]' => cbgjClass::getOverride( 'group' ) ) ), 'index.php?option=' . $plugin->option . '&task=pluginclass&plugin=' . $plugin->element . '&action=groups&func=approval', $plugin ) ) {
							cbgjClass::getPluginURL( array( 'menus' ), CBTxt::T( 'Group approval menu failed to create!' ), false, true, 'error' );
						}
						break;
					case 'new-category':
						if ( ! cbgjClass::setMenu( CBTxt::P( 'New [category]', array( '[category]' => cbgjClass::getOverride( 'category' ) ) ), 'index.php?option=' . $plugin->option . '&task=pluginclass&plugin=' . $plugin->element . '&action=categories&func=new', $plugin ) ) {
//.........这里部分代码省略.........
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:101,代码来源:admin.cbgroupjive.php

示例11: showCategoryMain

	/**
	 * render frontend category main
	 *
	 * @param cbgjCategory $row
	 * @param moscomprofilerUser $user
	 * @param object $plugin
	 * @return string
	 */
	static function showCategoryMain( $row, $user, $plugin ) {
		global $_CB_framework;

		$componentClass			=	new CBplug_cbgroupjive();
		$authorized				=	cbgjClass::getAuthorization( $row, null, $user );

		$tabs					=	new cbTabs( 1, 1 );

		$newCategory			=	( $plugin->params->get( 'category_new_category', 0 ) && cbgjClass::hasAccess( 'cat_nested_create', $authorized ) );
		$newGroup				=	( $plugin->params->get( 'category_new_group', 0 ) && cbgjClass::hasAccess( 'cat_grp_create', $authorized ) );
		$hasNested				=	( $row->nestedCount() && cbgjClass::hasAccess( 'cat_approved', $authorized ) );
		$beforeTab				=	cbgjClass::getIntegrations( 'gj_onBeforeCategoryTab', array( $tabs, $row, $user, $plugin ), null, null );
		$afterTab				=	cbgjClass::getIntegrations( 'gj_onAfterCategoryTab', array( $tabs, $row, $user, $plugin ), null, null );

		$return					=	null;

		if ( ( $row->get( 'published' ) == -1 ) && $plugin->params->get( 'category_approve', 0 ) ) {
			$return				.=	'<div class="alert alert-error">' . CBTxt::P( 'This [category] is currently pending approval.', array( '[category]' => cbgjClass::getOverride( 'category' ) ) ) . '</div>';
		} elseif ( ( $row->get( 'published' ) == 0 ) || ( ( $row->get( 'published' ) == 1 ) && ( ! cbgjClass::hasAccess( 'cat_approved', $authorized ) ) ) ) {
			$return				.=	'<div class="alert alert-error">' . CBTxt::P( 'This [category] is currently unpublished.', array( '[category]' => cbgjClass::getOverride( 'category' ) ) ) . '</div>';
		}

		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', (int) $row->get( 'id' ) ), 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', (int) $row->get( 'id' ) ), true ) . '" />' : null )
								.		'</div>'
								.	'</div>';
		}

		if ( $beforeTab || $afterTab || $hasNested ) {
			$return				.=	$tabs->startPane( 'getCategoryTabs' );

			if ( $hasNested && ( ( ( ! $row->get( 'nested' ) ) && cbgjClass::hasAccess( 'mod_lvl1', $authorized ) ) || $row->get( 'nested' ) ) ) {
				$return			.=		$tabs->startTab( null, cbgjClass::getOverride( 'category', true ), 'gjCategories' )
								.			'<div class="gjNestedCategories">'
								.				$componentClass->showNestedCategories( $row, $user, $plugin )
								.			'</div>'
								.		$tabs->endTab();
			}

			$return				.=		$beforeTab;

			if ( cbgjClass::hasAccess( 'cat_approved', $authorized ) ) {
				$return			.=		$tabs->startTab( null, cbgjClass::getOverride( 'group', true ), 'gjGroups' );
			}
		}

		if ( cbgjClass::hasAccess( 'cat_approved', $authorized ) ) {
			$return				.=			'<div class="gjCategoryGroups">'
								.				$componentClass->showCategoryGroups( $row, $user, $plugin )
								.			'</div>';
		}

		if ( $beforeTab || $afterTab || $hasNested ) {
			if ( cbgjClass::hasAccess( 'cat_approved', $authorized ) ) {
				$return			.=		$tabs->endTab();
			}

			$return				.=		$afterTab
								.	$tabs->endPane();
		}

		if ( isset( $_GET['tab'] ) ) {
			$tab				=	urldecode( stripslashes( cbGetParam( $_GET, 'tab' ) ) );
		} elseif ( isset( $_POST['tab'] ) ) {
			$tab				=	stripslashes( cbGetParam( $_POST, 'tab' ) );
		} else {
			$tab				=	null;
		}

		if ( $tab ) {
			$js					=	"$( '#getCategoryTabs .tab-row .tab a' ).each( function() {"
								.		"if ( $( this ).text().toLowerCase() == '" . addslashes( strtolower( $tab ) ) . "' ) {"
								.			"$( this ).parent( '.tab' ).trigger( 'click' );"
								.		"}"
								.	"});";

			$_CB_framework->outputCbJQuery( $js );
		}

		return $return;
	}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:92,代码来源:category_main.php

示例12: showOverviewMain

	/**
	 * 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 )
//.........这里部分代码省略.........
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:101,代码来源:overview_main.php

示例13: showInvites

	/**
	 * 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" />&nbsp;'
									.			( $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>';
		}

//.........这里部分代码省略.........
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:101,代码来源:group_invites.php

示例14: saveNotifications

	/**
	 * saves users notifications
	 *
	 * @param int $catid
	 * @param int $grpid
	 * @param moscomprofilerUser $user
	 * @param object $plugin
	 * @param boolean $silent
	 * @return boolean
	 */
	static public function saveNotifications( $catid, $grpid, $user, $plugin, $silent = true ) {
		$category						=	cbgjData::getCategories( null, array( 'id', '=', (int) $catid ), null, null, false );
		$group							=	cbgjData::getGroups( null, array( 'id', '=', (int) $grpid ), null, null, false );

		if ( ( ! $category->get( 'id' ) ) && $group->get( 'id' ) ) {
			$category					=	$group->getCategory();
		}

		$authorized						=	cbgjClass::getAuthorization( $category, $group, $user );

		if ( cbgjClass::hasAccess( 'usr_notifications', $authorized ) ) {
			$categoryApprove			=	$plugin->params->get( 'category_approve', 0 );
			$groupApprove				=	$plugin->params->get( 'group_approve', 0 );

			if ( cbgjClass::hasAccess( 'gen_usr_notifications', $authorized ) ) {
				$generalNotifications	=	cbgjData::getNotifications( null, array( array( 'type', '=', 'general' ), array( 'user_id', '=', (int) $user->id ) ), null, null, false );

				$generalNotifications->set( 'user_id', (int) $user->id );
				$generalNotifications->set( 'type', 'general' );
				$generalNotifications->set( 'item', 0 );

				if ( $generalNotifications->getError() || ( ! $generalNotifications->store() ) ) {
					if ( ! $silent ) {
						cbgjClass::getPluginURL( array( 'notifications', 'show', (int) $category->get( 'id' ), (int) $group->get( 'id' ) ), CBTxt::P( 'General notifications failed to save! Error: [error]', array( '[error]' => $generalNotifications->getError() ) ), false, true, null, false, false, true );
					}

					return false;
				}

				$generalParams			=	$generalNotifications->getParams();
				$generalCleanParams		=	new cbParamsBase( null );

				$generalCleanParams->set( 'general_categorynew', ( (int) ( cbgjClass::hasAccess( 'usr_mod', $authorized ) ? cbgjClass::getCleanParam( true, 'general_categorynew', $generalParams->get( 'general_categorynew', $plugin->params->get( 'notifications_general_categorynew', 0 ) ) ) : 0 ) ? 1 : 0 ) );
				$generalCleanParams->set( 'general_categoryapprove', ( (int) ( cbgjClass::hasAccess( 'usr_mod', $authorized ) && $categoryApprove ? cbgjClass::getCleanParam( true, 'general_categoryapprove', $generalParams->get( 'general_categoryapprove', $plugin->params->get( 'notifications_general_categoryapprove', 0 ) ) ) : 0 ) ? 1 : 0 ) );
				$generalCleanParams->set( 'general_categoryupdate', ( (int) ( cbgjClass::hasAccess( 'usr_mod', $authorized ) ? cbgjClass::getCleanParam( true, 'general_categoryupdate', $generalParams->get( 'general_categoryupdate', $plugin->params->get( 'notifications_general_categoryupdate', 0 ) ) ) : 0 ) ? 1 : 0 ) );
				$generalCleanParams->set( 'general_categorydelete', ( (int) ( cbgjClass::hasAccess( 'usr_mod', $authorized ) ? cbgjClass::getCleanParam( true, 'general_categorydelete', $generalParams->get( 'general_categorydelete', $plugin->params->get( 'notifications_general_categorydelete', 0 ) ) ) : 0 ) ? 1 : 0 ) );

				if ( $generalNotifications->getError() || ( ! $generalNotifications->storeParams( $generalCleanParams ) ) ) {
					if ( ! $silent ) {
						cbgjClass::getPluginURL( array( 'notifications', 'show', (int) $category->get( 'id' ), (int) $group->get( 'id' ) ), CBTxt::P( 'General notifications failed to save! Error: [error]', array( '[error]' => $generalNotifications->getError() ) ), false, true, null, false, false, true );
					}

					return false;
				}
			}

			if ( cbgjClass::hasAccess( 'cat_usr_notifications', $authorized ) ) {
				$categoryNotifications	=	cbgjData::getNotifications( null, array( array( 'type', '=', 'category' ), array( 'item', '=', (int) $catid ), array( 'user_id', '=', (int) $user->id ) ), null, null, false );

				$categoryNotifications->set( 'user_id', (int) $user->id );
				$categoryNotifications->set( 'type', 'category' );
				$categoryNotifications->set( 'item', (int) $category->get( 'id' ) );

				if ( $categoryNotifications->getError() || ( ! $categoryNotifications->store() ) ) {
					if ( ! $silent ) {
						cbgjClass::getPluginURL( array( 'notifications', 'show', (int) $category->get( 'id' ), (int) $group->get( 'id' ) ), CBTxt::P( '[category] notifications failed to save! Error: [error]', array( '[category]' => cbgjClass::getOverride( 'category' ), '[error]' => $categoryNotifications->getError() ) ), false, true, null, false, false, true );
					}

					return false;
				}

				$categoryParams			=	$categoryNotifications->getParams();
				$categoryCleanParams	=	new cbParamsBase( null );

				$categoryCleanParams->set( 'category_nestednew', ( (int) ( cbgjClass::hasAccess( array( 'mod_lvl1', 'cat_nested' ), $authorized, true ) ? cbgjClass::getCleanParam( true, 'category_nestednew', $categoryParams->get( 'category_nestednew', $plugin->params->get( 'notifications_category_nestednew', 0 ) ) ) : 0 ) ? 1 : 0 ) );
				$categoryCleanParams->set( 'category_nestedapprove', ( (int) ( cbgjClass::hasAccess( array( 'mod_lvl1', 'cat_nested' ), $authorized, true ) && $categoryApprove ? cbgjClass::getCleanParam( true, 'category_nestedapprove', $categoryParams->get( 'category_nestedapprove', $plugin->params->get( 'notifications_category_nestedapprove', 0 ) ) ) : 0 ) ? 1 : 0 ) );
				$categoryCleanParams->set( 'category_nestedupdate', ( (int) ( cbgjClass::hasAccess( array( 'mod_lvl1', 'cat_nested' ), $authorized, true ) ? cbgjClass::getCleanParam( true, 'category_nestedupdate', $categoryParams->get( 'category_nestedupdate', $plugin->params->get( 'notifications_category_nestedupdate', 0 ) ) ) : 0 ) ? 1 : 0 ) );
				$categoryCleanParams->set( 'category_nesteddelete', ( (int) ( cbgjClass::hasAccess( array( 'mod_lvl1', 'cat_nested' ), $authorized, true ) ? cbgjClass::getCleanParam( true, 'category_nesteddelete', $categoryParams->get( 'category_nesteddelete', $plugin->params->get( 'notifications_category_nesteddelete', 0 ) ) ) : 0 ) ? 1 : 0 ) );
				$categoryCleanParams->set( 'category_groupnew', ( (int) ( cbgjClass::hasAccess( array( 'mod_lvl1', 'grp_create' ), $authorized, true ) ? cbgjClass::getCleanParam( true, 'category_groupnew', $categoryParams->get( 'category_groupnew', $plugin->params->get( 'notifications_category_groupnew', 0 ) ) ) : 0 ) ? 1 : 0 ) );
				$categoryCleanParams->set( 'category_groupapprove', ( (int) ( cbgjClass::hasAccess( array( 'mod_lvl1', 'grp_create' ), $authorized, true ) && $groupApprove ? cbgjClass::getCleanParam( true, 'category_groupapprove', $categoryParams->get( 'category_groupapprove', $plugin->params->get( 'notifications_category_groupapprove', 0 ) ) ) : 0 ) ? 1 : 0 ) );
				$categoryCleanParams->set( 'category_groupupdate', ( (int) ( cbgjClass::hasAccess( array( 'mod_lvl1', 'grp_create' ), $authorized, true ) ? cbgjClass::getCleanParam( true, 'category_groupupdate', $categoryParams->get( 'category_groupupdate', $plugin->params->get( 'notifications_category_groupupdate', 0 ) ) ) : 0 ) ? 1 : 0 ) );
				$categoryCleanParams->set( 'category_groupdelete', ( (int) ( cbgjClass::hasAccess( array( 'mod_lvl1', 'grp_create' ), $authorized, true ) ? cbgjClass::getCleanParam( true, 'category_groupdelete', $categoryParams->get( 'category_groupdelete', $plugin->params->get( 'notifications_category_groupdelete', 0 ) ) ) : 0 ) ? 1 : 0 ) );

				if ( $categoryNotifications->getError() || ( ! $categoryNotifications->storeParams( $categoryCleanParams ) ) ) {
					if ( ! $silent ) {
						cbgjClass::getPluginURL( array( 'notifications', 'show', (int) $category->get( 'id' ), (int) $group->get( 'id' ) ), CBTxt::P( '[category] notifications failed to save! Error: [error]', array( '[category]' => cbgjClass::getOverride( 'category' ), '[error]' => $categoryNotifications->getError() ) ), false, true, null, false, false, true );
					}

					return false;
				}
			}

			if ( cbgjClass::hasAccess( 'grp_usr_notifications', $authorized ) ) {
				$groupNotifications		=	cbgjData::getNotifications( null, array( array( 'type', '=', 'group' ), array( 'item', '=', (int) $grpid ), array( 'user_id', '=', (int) $user->id ) ), null, null, false );

				$groupNotifications->set( 'user_id', (int) $user->id );
				$groupNotifications->set( 'type', 'group' );
				$groupNotifications->set( 'item', (int) $group->get( 'id' ) );

				if ( $groupNotifications->getError() || ( ! $groupNotifications->store() ) ) {
//.........这里部分代码省略.........
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:101,代码来源:cbgroupjive.class.php

示例15: install

 public function install($parent)
 {
     global $_CB_framework, $_CB_adminpath, $ueConfig;
     // Ensure PHP version is adaquete for CB:
     if (version_compare(phpversion(), '5.3.3', '<')) {
         JFactory::getApplication()->enqueueMessage(sprintf('As stated in README and prerequisites, PHP Version %s, which is obsolete since before 2009-11-19 and insecure, is not compatible with %s: Please upgrade to PHP %s or greater (CB is also compatible with PHP 5.4 and 5.5) before installing Community Builder.', phpversion(), 'Community Builder', sprintf('at least version %s, recommended version %s', '5.3.1', '5.3.10')), 'error');
         JFactory::getApplication()->enqueueMessage(sprintf('Installation failed. In all cases, please require your hoster to upgrade your PHP version as soon as possible.'), 'error');
         return false;
     }
     // Initialize CB Appplication library (which has delayed config lazy loading):
     if (is_readable(JPATH_SITE . '/libraries/CBLib/CB/Application/CBApplication.php')) {
         /** @noinspection PhpIncludeInspection */
         include_once JPATH_SITE . '/libraries/CBLib/CB/Application/CBApplication.php';
         \CB\Application\CBApplication::init();
     } else {
         JFactory::getApplication()->enqueueMessage("Mandatory Community Builder lib_CBLib not installed!", 'error');
         return false;
     }
     // Determine path to CBs backend file structure:
     $_CB_adminpath = JPATH_ADMINISTRATOR . '/components/com_comprofiler/';
     // Disable loading of config immediately after foundation include as the db may not exist yet:
     \CB\Application\CBConfig::setCbConfigReadyToLoad(false);
     // Check if CBLib can load:
     /** @noinspection PhpIncludeInspection */
     if (false === (include_once $_CB_adminpath . 'plugin.foundation.php')) {
         return false;
     }
     // Check if CBLib is up to date:
     if (version_compare(constant('CBLIB'), $ueConfig['version'], '<')) {
         JFactory::getApplication()->enqueueMessage(sprintf('Community Builder library lib_CBLib version %s is older than the Community Builder version %s tried to be installed.', constant('CBLIB'), $ueConfig['version']), 'error');
         return false;
     }
     // Set location to backend:
     $_CB_framework->cbset('_ui', 2);
     if ($_CB_framework->getCfg('debug')) {
         ini_set('display_errors', true);
         error_reporting(E_ALL);
     }
     // Load in CB API:
     cbimport('cb.tabs');
     cbimport('cb.adminfilesystem');
     cbimport('cb.dbchecker');
     // Define CB backend filesystem API:
     $adminFS = cbAdminFileSystem::getInstance();
     // Delete removed files on upgrade:
     $filesToDelete = array($_CB_adminpath . 'comprofileg.xml', $_CB_adminpath . 'comprofilej.xml', $_CB_adminpath . 'admin.comprofiler.php', $_CB_adminpath . 'ue_config_first.php');
     foreach ($filesToDelete as $deleteThisFile) {
         if ($adminFS->file_exists($deleteThisFile)) {
             $adminFS->unlink($deleteThisFile);
         }
     }
     $liveSite = $_CB_framework->getCfg('live_site');
     $return = '<div style="margin-bottom:10px;width:100%;text-align:center;"><img alt="' . htmlspecialchars(CBTxt::T('CB Logo')) . '" src="' . $liveSite . '/components/com_comprofiler/images/smcblogo.gif" /></div>' . '<div style="font-size:14px;margin-bottom:10px;">Copyright 2004-2015 Joomlapolis.com. ' . CBTxt::T('This component is released under the GNU/GPL version 2 License. All copyright statements must be kept. Derivate work must prominently duly acknowledge original work and include visible online links.') . '</div>';
     $cbDatabase = \CBLib\Application\Application::Database();
     // Core database fixes:
     $dbChecker = new \CB\Database\CBDatabaseChecker($cbDatabase);
     $result = $dbChecker->checkDatabase(true, false, null, null);
     if ($result == true) {
         // All ok, Nothing to alarm user here:
         // $return							.=	'<div style="font-size:18px;color:green;margin-bottom:10px;">' . CBTxt::T( 'Automatic database upgrade applied successfully.' ) . '</div>';
     } elseif (is_string($result)) {
         $return .= '<div style="font-size:18px;color:red;margin-bottom:10px;">' . $result . '</div>';
     } else {
         $errors = $dbChecker->getErrors(false);
         if ($errors) {
             $return .= '<div style="color:red;margin-bottom:10px;">' . '<div style="font-size:18px;font-weight:bold;padding-bottom:5px;margin-bottom:5px;border-bottom:1px solid red;">' . CBTxt::T('Database fixing errors') . '</div>';
             foreach ($errors as $error) {
                 $return .= '<div style="margin-bottom:10px;">' . '<div style="font-size:14px;">' . $error[0] . '</div>';
                 if ($error[1]) {
                     $return .= '<div style="font-size:12px;text-indent:15px;">' . $error[1] . '</div>';
                 }
                 $return .= '</div>';
             }
             $return .= '</div>';
         }
     }
     if ($_CB_framework->getCfg('session_handler') != 'database') {
         $logs = $dbChecker->getLogs(false);
         if (count($logs) > 0) {
             $return .= '<div style="margin-bottom:10px;">' . '<div style="font-size:14px;margin-bottom:5px;">' . '<a href="javascript: void(0);" id="cbdetailsLinkShow" onclick="this.style.display=\'none\';document.getElementById(\'cbdetailsdbcheck\').style.display=\'block\';document.getElementById(\'cbdetailsLinkHide\').style.display=\'block\';return false;">' . CBTxt::T('Click to Show details') . '</a>' . '<a href="javascript: void(0);" id="cbdetailsLinkHide" onclick="this.style.display=\'none\';document.getElementById(\'cbdetailsdbcheck\').style.display=\'block\';document.getElementById(\'cbdetailsLinkShow\').style.display=\'block\';return false;" style="display:none;">' . CBTxt::T('Click to Hide details') . '</a>' . '</div>' . '<div id="cbdetailsdbcheck" style="dsiplay:none;color:green;">';
             foreach ($logs as $log) {
                 $return .= '<div style="margin-bottom:10px;">' . '<div style="font-size:14px;">' . $log[0] . '</div>';
                 if ($log[1]) {
                     $return .= '<div style="font-size:12px;text-indent:15px;">' . $log[1] . '</div>';
                 }
                 $return .= '</div>';
             }
             $return .= '</div>' . '</div>';
         }
     }
     // Fix old 1.x usergroups-based permissions to 2.x access-levels in lists and in tabs:
     $this->convertUserGroupsToViewAccessLevels(new \CB\Database\Table\TabTable(), 'CB Tab access');
     $this->convertUserGroupsToViewAccessLevels(new \CB\Database\Table\ListTable(), 'CB Users list access');
     // Synchronize users to CB:
     $query = 'INSERT IGNORE INTO ' . $cbDatabase->NameQuote('#__comprofiler') . "\n (" . $cbDatabase->NameQuote('id') . ', ' . $cbDatabase->NameQuote('user_id') . ')' . "\n SELECT " . $cbDatabase->NameQuote('id') . ', ' . $cbDatabase->NameQuote('id') . "\n FROM " . $cbDatabase->NameQuote('#__users');
     $cbDatabase->setQuery($query);
     if (!$cbDatabase->query()) {
         $cbSpoofField = cbSpoofField();
         $cbSpoofString = cbSpoofString(null, 'plugin');
         $return .= '<div style="font-size:14px;color:red;margin-bottom:10px;">' . CBTxt::P('User synchronization failed. Please <a href="[url]" target="_blank">click here</a> to manually synchronize.', array('[url]' => $_CB_framework->backendUrl("index.php?option=com_comprofiler&view=syncUsers&{$cbSpoofField}={$cbSpoofString}"))) . '</div>';
//.........这里部分代码省略.........
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:101,代码来源:install.comprofiler.php


注:本文中的CBTxt::P方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。