本文整理汇总了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];
}