本文整理匯總了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);
}
示例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];
}