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


PHP UserTable::bindThisUserFromDbArray方法代码示例

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


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

示例1: bindThisUserFromDbArray

 /**
  * Copy the named array or object content into this object as vars
  * All $arr values are filled in vars of $this->_cbuser
  *
  * @access private this is just to be usable by UserTable::loadUsersMatchingIdIntoList()
  *
  * @param  array               $arr    The input array
  */
 public function bindThisUserFromDbArray($arr)
 {
     $this->_cbuser = new UserTable($this->_db);
     $this->_cbuser->bindThisUserFromDbArray($arr);
 }
开发者ID:bobozhangshao,项目名称:HeartCare,代码行数:13,代码来源:CBuser.php

示例2: getFieldValue

	/**
	 * @param UserTable  $user
	 * @param CBuser     $cbUser
	 * @param FieldTable $field
	 * @param string     $reason
	 * @param bool       $forceNoPost
	 * @return array|mixed|string
	 */
	private function getFieldValue( $user, $cbUser, $field, $reason, $forceNoPost = false )
	{
		global $_PLUGINS;

		static $values											=	array();

		$fieldId												=	(int) $field->get( 'fieldid' );
		$userId													=	(int) $user->get( 'id' );

		if ( ! isset( $values[$fieldId][$userId][$reason][$forceNoPost] ) ) {
			if ( ! ( $field->params instanceof ParamsInterface ) ) {
				$field->params									=	new Registry( $field->params );
			}

			$fieldValue											=	null;

			$values[$fieldId][$userId][$reason][$forceNoPost]	=	$fieldValue;

			$post												=	$this->getInput()->getNamespaceRegistry( 'post' );

			if ( ( ! $forceNoPost ) && in_array( $reason, array( 'register', 'edit' ) ) && ( $post->count() && in_array( $this->input( 'view', null, GetterInterface::STRING ), array( 'saveregisters', 'saveuseredit' ) ) ) ) {
				$postUser										=	new UserTable();

				foreach ( array_keys( get_object_vars( $user ) ) as $k ) {
					if ( substr( $k, 0, 1 ) != '_' ) {
						$postUser->set( $k, $user->get( $k ) );
					}
				}

				if ( ! $post->get( $field->get( 'name' ) ) ) {
					$post->set( $field->get( 'name' ), null );
				}

				$postUser->bindThisUserFromDbArray( $post->asArray() );

				$fieldValue										=	$postUser->get( $field->get( 'name' ) );

				if ( is_array( $fieldValue ) ) {
					$fieldValue									=	implode( '|*|', $fieldValue );
				}

				if ( $fieldValue === null ) {
					$field->set( '_noCondition', true );

					$fieldValue									=	$_PLUGINS->callField( $field->get( 'type' ), 'getFieldRow', array( &$field, &$postUser, 'php', 'none', 'profile', 0 ), $field );

					$field->set( '_noCondition', false );

					if ( is_array( $fieldValue ) ) {
						$fieldValue								=	array_shift( $fieldValue );

						if ( is_array( $fieldValue ) ) {
							$fieldValue							=	implode( '|*|', $fieldValue );
						}
					}

					if ( $fieldValue === null ) {
						$fieldValue								=	$this->getFieldValue( $user, $cbUser, $field, $reason, true );
					}
				}
			} else {
				$fieldValue										=	$user->get( $field->get( 'name' ) );

				if ( is_array( $fieldValue ) ) {
					$fieldValue									=	implode( '|*|', $fieldValue );
				}

				if ( $fieldValue === null ) {
					$field->set( '_noCondition', true );

					$fieldValue									=	$_PLUGINS->callField( $field->get( 'type' ), 'getFieldRow', array( &$field, &$user, 'php', 'none', 'profile', 0 ), $field );

					$field->set( '_noCondition', false );

					if ( is_array( $fieldValue ) ) {
						$fieldValue								=	array_shift( $fieldValue );

						if ( is_array( $fieldValue ) ) {
							$fieldValue							=	implode( '|*|', $fieldValue );
						}
					}
				}
			}

			$values[$fieldId][$userId][$reason][$forceNoPost]	=	$fieldValue;
		}

		return $values[$fieldId][$userId][$reason][$forceNoPost];
	}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:97,代码来源:cbconditional.php


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