Пример #1
0
	/**
	 * @return array
	 */
	public function privacyList()
	{
		$options		=	array();

		if ( $this->installed() ) {
			$options	=	cbprivacyClass::getPrivacyOptions();
		}

		return $options;
	}
	/**
	 * @param int       $userId
	 * @param UserTable $user
	 * @return mixed
	 */
	public function deleteProfile( $userId, $user )
	{
		global $_CB_framework;

		if ( ! $userId ) {
			$userId			=	$user->get( 'id' );
		}

		$profileUrl			=	$_CB_framework->userProfileUrl( $userId, false );

		if ( ! $userId ) {
			$profileUrl		=	'index.php';
		}

		if ( ! $this->getDeleteField( $userId, $user ) ) {
			cbRedirect( $profileUrl, CBTxt::T( 'Not authorized.' ), 'error' );
		}

		cbprivacyClass::getTemplate( 'delete' );

		HTML_privacyDelete::showDelete( $userId, $user, $this );
	}
Пример #3
0
	/**
	 * @param FieldTable $field
	 * @param UserTable  $user
	 * @param string     $output
	 * @param string     $reason
	 * @param int        $list_compare_types
	 * @return mixed|null|string
	 */
	public function getField( &$field, &$user, $output, $reason, $list_compare_types )
	{
		global $_CB_framework;

		$return			=	null;

		if ( ( ! Application::Cms()->getClientId() ) && ( $output == 'htmledit' ) && ( $reason == 'edit' ) && $user->get( 'id' ) && ( ! cbprivacyClass::checkUserModerator( $user->get( 'id' ) ) ) ) {
			$url		=	$_CB_framework->pluginClassUrl( $this->element, true, array( 'action' => 'privacy', 'func' => 'delete' ) );

			$value		=	'<a href="javascript: void(0);" onclick="if ( confirm( \'' . addslashes( CBTxt::T( 'Are you sure you want to delete your account?' ) ) . '\' ) ) { location.href = \'' . $url . '\'; }">'
						.		CBTxt::T( 'Delete account and user profile.' )
						.	'</a>';

			$return		=	$this->formatFieldValueLayout( $value, $reason, $field, $user, false )
						.	$this->_fieldIconsHtml( $field, $user, $output, $reason, null, 'html', $value, null, null, true, 0 );
		}

		return $return;
	}