Source for file GeneralUsersPropertys.php
Documentation is available at GeneralUsersPropertys.php
if (!defined("GY_CORE") && (GY_CORE !== true)) die( "gy: err include core" );
* GeneralUsersPropertys - класс для работы с общими свойствами пользователей
private static $tableNameCreatePropertys = 'create_all_users_property';
private static $tableNameTypePropertys = 'type_all_user_propertys';
private static $tableNameTypePropertysForCodeTypeProperty = array(
'text' => 'value_all_user_propertys_text'
* getAllGeneralUsersPropertys
* - получить все созданные пользовательские свойства
self::$tableNameCreatePropertys,
$result = $DB->fetchAll($res, 'id');
* getAllTypeAllUsersPropertys
* - получить все возможные типы пользовательских свойств
self::$tableNameTypePropertys,
$result = $DB->fetchAll($res, 'id');
* - создать пользовательское свойство
* @param string $name - имя
* @param int $idType - тип
* @param string $code - код
self::$tableNameCreatePropertys,
'name_property' => $name,
'type_property' => $idType,
* - удалить общее пользовательское свойство
* @param int $id - id общего пользовательского свойства
self::$tableNameCreatePropertys,
array('='=> array('id', $id))
self::deleteAllValuesAllUserBypropertyId($id, 'text'); // text - т.к. пока других нет
* deleteAllValuesAllUserBypropertyId
* - удалить все значения определённого свойства у всех пользователей
* @param int $idProperty - id свойства (общее свойство)
* @param string $typePropertyCode - пока у всех значение text
if (!empty(self::$tableNameTypePropertysForCodeTypeProperty[$typePropertyCode])) {
self::$tableNameTypePropertysForCodeTypeProperty[$typePropertyCode],
array( '=' => array('id_property', $idProperty) )
* getAllValueUserProperty
* - взять все значения определённого типа свойства пользователя
* @param int $idUser - id пользователя
* @param string $typePropertyCode - пока у всех значение text
if (!empty(self::$tableNameTypePropertysForCodeTypeProperty[$typePropertyCode])) {
self::$tableNameTypePropertysForCodeTypeProperty[$typePropertyCode],
array( '=' => array('id_users', $idUser) )
$result = $DB->fetchAll($res, 'id_property');
* - добавить значение свойства
* @param int $idUser - id пользователя
* @param string $typePropertyCode - пока у всех значение text
* @param int $idProperty - id пользовательского свойства
* @param string $value - пока тип text, тут только строка
public static function addValueProperty($idUser, $typePropertyCode, $idProperty, $value)
if (!empty(self::$tableNameTypePropertysForCodeTypeProperty[$typePropertyCode])) {
self::$tableNameTypePropertysForCodeTypeProperty[$typePropertyCode],
'id_property' => $idProperty
* - удалить значения конкретного свойства конкретного пользователя
* @param int $idUser - id пользователя
* @param string $typePropertyCode - пока у всех значение text
* @param int $idProperty - id пользовательского свойства
if (!empty(self::$tableNameTypePropertysForCodeTypeProperty[$typePropertyCode])) {
self::$tableNameTypePropertysForCodeTypeProperty[$typePropertyCode],
array('=' => array('id_users', $idUser) ),
array('=' => array('id_property', $idProperty) )
* - изменить значение конкретного свойства конкретного пользователя
* @param int $idUser - id пользователя
* @param string $typePropertyCode - пока у всех значение text
* @param int $idProperty - id пользовательского свойства
* @param string $value - пока тип text, тут только строка
if (!empty(self::$tableNameTypePropertysForCodeTypeProperty[$typePropertyCode])) {
self::$tableNameTypePropertysForCodeTypeProperty[$typePropertyCode],
'id_property' => $idProperty,
array('=' => array('id_users', $idUser) ),
array('=' => array('id_property', $idProperty) )
|