當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。