JomSocial
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2102
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2102
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2102
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2102
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2102
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2102
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2102
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2102
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2102
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2102
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2102
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2102
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2102
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2102
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2102
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2102
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2102
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2102
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2102
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2102
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2102
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2102
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2102
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2102
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2102
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2102
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2435
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2451
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2456
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2461
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2467
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2479
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2496
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2497
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2498
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2499
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2517
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2518
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2519
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2520
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2550
Материал из Newman's WiKi.
| Версия 17:44, 27 ноября 2010 WikiSysop (Обсуждение | вклад) (→Поиск по всем полям профиля) ← К предыдущему изменению |
Текущая версия WikiSysop (Обсуждение | вклад) (→Поиск по всем полям профиля) |
||
| Строка 12: | Строка 12: | ||
| <pre> | <pre> | ||
| if(isset($search) && $data->query!="") { | if(isset($search) && $data->query!="") { | ||
| + | CFactory::load('libraries', 'advancesearch'); | ||
| $filter=array(); | $filter=array(); | ||
| - | foreach($fields AS $group) { | + | $SFields=CAdvanceSearch::getFields(); |
| + | foreach($SFields AS $group) { | ||
| foreach($group->fields AS $fl) { | foreach($group->fields AS $fl) { | ||
| $f = new stdClass(); | $f = new stdClass(); | ||
| Строка 24: | Строка 26: | ||
| } | } | ||
| } | } | ||
| - | $model =& $this->getModel('search'); | ||
| $data->result = $model->getAdvanceSearch($filter, "or"); | $data->result = $model->getAdvanceSearch($filter, "or"); | ||
| } else { | } else { | ||
| Строка 30: | Строка 31: | ||
| } | } | ||
| </pre> | </pre> | ||
| + | ==Получить поля профиля из третьего компонента== | ||
| + | Часто для интеграции Jom Social с другими кмопонентами требуется получить значение всех полей профиля для конкретного пользователя. | ||
| + | Сделать это можно с помощью следующего кода | ||
| + | <pre> | ||
| + | require_once( JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'models' . DS . 'models.php' ); | ||
| + | require_once( JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'models' . DS . 'profile.php' ); | ||
| + | $model=new CommunityModelProfile(); | ||
| + | $profile=$model->getEditableProfile($userid); | ||
| + | $profile_fields=array("email"=>$profile["email"], "name"=>$profile["name"]); | ||
| + | |||
| + | if(isset($profile["fields"]) && is_array($profile["fields"]) && count($profile["fields"])>0) { | ||
| + | foreach($profile["fields"] AS $fld) { | ||
| + | if(is_array($fld) && count($fld)>0) { | ||
| + | foreach($fld AS $field) { | ||
| + | $profile_fields[$field["fieldcode"]]=$field["value"]; | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | |||
| + | $profile=$model->getViewableProfile($userid); | ||
| + | if(isset($profile["fields"]) && is_array($profile["fields"]) && count($profile["fields"])>0) { | ||
| + | foreach($profile["fields"] AS $fld) { | ||
| + | if(is_array($fld) && count($fld)>0) { | ||
| + | foreach($fld AS $field) { | ||
| + | $profile_fields[$field["fieldcode"]]=$field["value"]; | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | </pre> | ||
| + | В результате в '''$profile_fields''' значения полей в виде имяполя=>значение | ||
| =Ссылки= | =Ссылки= | ||
Текущая версия
JomSocial это компонент для Joomla позволяющий создавать на сайте различные сообщества пользователей. Служебное, так сказать, имя компонента com_community. Помимо самого компонента для него существует очень много дополнительных модулей и плагинов. А так же есть возможность интеграции с другими известными компонентами (форумы, блоги, фотогалереи и т.д.)
Содержание |
Хаки
Поиск по всем полям профиля
В компоненте существует поиск пользователей. При этом в стандартной поставке при обычном поиске просматриваются только поля имени и e-mail. Расширенный же поиск не совсем удобен с точки зрения удобства пользования.
Поэтому был реализован небольшой хак, позволяющий искать сразу по всем полям профиля, используя стандартную форму. В файле /components/com_community/controllers/search.php находим строку
$data->result = $model->searchPeople( $search );
и заменяем ее на следующий код
if(isset($search) && $data->query!="") {
CFactory::load('libraries', 'advancesearch');
$filter=array();
$SFields=CAdvanceSearch::getFields();
foreach($SFields AS $group) {
foreach($group->fields AS $fl) {
$f = new stdClass();
$f->condition="contain";
$f->value=$data->query;
$f->fieldType=$fl->type;
$f->field=$fl->fieldcode;
$filter[]=$f;
unset($f);
}
}
$data->result = $model->getAdvanceSearch($filter, "or");
} else {
$data->result=array();
}
Получить поля профиля из третьего компонента
Часто для интеграции Jom Social с другими кмопонентами требуется получить значение всех полей профиля для конкретного пользователя. Сделать это можно с помощью следующего кода
require_once( JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'models' . DS . 'models.php' );
require_once( JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'models' . DS . 'profile.php' );
$model=new CommunityModelProfile();
$profile=$model->getEditableProfile($userid);
$profile_fields=array("email"=>$profile["email"], "name"=>$profile["name"]);
if(isset($profile["fields"]) && is_array($profile["fields"]) && count($profile["fields"])>0) {
foreach($profile["fields"] AS $fld) {
if(is_array($fld) && count($fld)>0) {
foreach($fld AS $field) {
$profile_fields[$field["fieldcode"]]=$field["value"];
}
}
}
}
$profile=$model->getViewableProfile($userid);
if(isset($profile["fields"]) && is_array($profile["fields"]) && count($profile["fields"])>0) {
foreach($profile["fields"] AS $fld) {
if(is_array($fld) && count($fld)>0) {
foreach($fld AS $field) {
$profile_fields[$field["fieldcode"]]=$field["value"];
}
}
}
}
В результате в $profile_fields значения полей в виде имяполя=>значение