cms = 'Joomla';
if (true || !defined('JPATH_ADMINISTRATOR') || !file_exists(rtrim(JPATH_ADMINISTRATOR, DS).DS.'components'.DS.'com_community'.DS)) {
$this->installed = false;
}
}
function dynamicText()
{
$onePlugin = new stdClass();
$onePlugin->name = 'JomSocial';
$onePlugin->plugin = __CLASS__;
$onePlugin->type = 'joomla';
$onePlugin->help = 'plugin-jomsocial';
return $onePlugin;
}
function insertOptions()
{
$plugin = new stdClass();
$plugin->name = 'JomSocial';
$plugin->icon = ACYM_DYNAMICS_URL.basename(__DIR__).'/icon.ico';
$plugin->plugin = __CLASS__;
return $plugin;
}
function textPopup()
{
?>
';
$otherFields = acym_loadObjectList("SELECT `name`, `id` FROM `#__community_fields` WHERE `type` != 'group' ORDER BY `ordering` ASC");
foreach ($otherFields as $oneField) {
$text .= '
';
}
$fields = acym_getColumns('community_users', false);
foreach ($fields as $fieldname) {
$type = '';
if (strpos(strtolower($fieldname), 'date') !== false) {
$type = '|type:date';
}
if (!empty($fieldType[$fieldname]) && $fieldType[$fieldname]->type == 'image') {
$type = '|type:image';
}
$text .= '';
}
$text .= '';
echo $text;
}
function replaceUserInformation(&$email, &$user, $send = true)
{
$extractedTags = $this->acympluginHelper->extractTags($email, 'jomsocialfield');
if (empty($extractedTags)) {
return;
}
$tags = [];
foreach ($extractedTags as $i => $oneTag) {
if (isset($tags[$i])) {
continue;
}
if (empty ($user->cms_id)) {
$tags[$i] = '';
continue;
}
if ($user->cms_id != $this->lastuserid) {
$this->lastuserid = $user->cms_id;
$this->valuesNum = null;
$this->valuesString = null;
}
$field = $oneTag->id;
if (is_numeric($field)) {
if ($this->valuesNum === null) {
$this->valuesNum = acym_loadObjectList('SELECT `field_id`,`value` FROM #__community_fields_values WHERE user_id = '.intval($user->cms_id), 'field_id');
}
if (isset($this->valuesNum[$field]->value)) {
$tags[$i] = $this->valuesNum[$field]->value;
}
} else {
if ($this->valuesString === null) {
$this->valuesString = acym_loadObject('SELECT * FROM #__community_users WHERE userid = '.intval($user->cms_id));
}
if (isset($this->valuesString->$field)) {
$tags[$i] = $this->valuesString->$field;
}
if (in_array($field, ['avatar', 'thumb']) && !empty($this->valuesString->$field)) {
$tags[$i] = '
';
if (!empty($oneTag->maxheight) || !empty($oneTag->maxwidth)) {
$tags[$i] = $this->acympluginHelper->managePicts($oneTag, $tags[$i]);
}
}
}
}
$this->acympluginHelper->replaceTags($email, $tags);
}
function contentPopup()
{
acym_loadLanguageFile('com_community', JPATH_SITE);
$tabHelper = acym_get('helper.tab');
$tabHelper->startTab(acym_translation('ACYM_USERS'));
$attributes = [
'title' => 'ACYM_TITLE',
'karma' => 'COM_COMMUNITY_KARMA',
'email' => 'COM_COMMUNITY_EMAIL',
'registerdate' => 'COM_COMMUNITY_MEMBER_SINCE',
'lastvisitdate' => 'COM_COMMUNITY_LAST_LOGIN',
'views' => 'COM_COMMUNITY_PROFILE_VIEW',
'friends' => 'COM_COMMUNITY_PROFILE_FRIENDS',
];
$extraFields = acym_loadObjectList(
"SELECT `name`, `fieldcode`
FROM `#__community_fields`
WHERE `type` != 'group'
ORDER BY `ordering` ASC"
);
$extra = [];
foreach ($extraFields as $field) {
$extra[strtolower($field->fieldcode)] = $field->name;
}
$attributes = array_merge($attributes, $extra);
$displayOptions = [
[
'title' => 'ACYM_DISPLAY',
'type' => 'checkbox',
'name' => 'fields',
'options' => $attributes,
'default' => 'full',
],
[
'title' => 'ACYM_DISPLAY_PICTURES',
'type' => 'pictures',
'name' => 'pictures',
],
[
'title' => 'ACYM_IMAGE_REQUIRED',
'type' => 'boolean',
'name' => 'required',
'default' => false,
],
[
'title' => 'ACYM_ORDER_BY',
'type' => 'select',
'name' => 'order',
'options' => [
'u.registerDate' => 'ACYM_DATE_CREATED',
'u.lastvisitDate' => 'COM_COMMUNITY_LAST_LOGIN',
'c.view' => 'COM_COMMUNITY_PROFILE_VIEW',
'c.points' => 'COM_COMMUNITY_KARMA',
'rand()' => 'ACYM_RANDOM',
],
],
[
'title' => 'Number of characters ("About me" field)',
'type' => 'text',
'name' => 'chars',
'default' => 150,
],
[
'title' => 'ACYM_COLUMNS',
'type' => 'text',
'name' => 'cols',
'default' => 1,
],
[
'title' => 'ACYM_MAX_NB_ELEMENTS',
'type' => 'text',
'name' => 'max',
'default' => 20,
],
];
echo $this->acympluginHelper->displayOptions($displayOptions, 'jomsocialusers', 'simple');
$tabHelper->endTab();
$tabHelper->startTab(acym_translation('COM_COMMUNITY_VIDEOS'));
$attributes = [
'description' => acym_translation('COM_COMMUNITY_VIDEOS_DESCRIPTION'),
'duration' => trim(acymailing_translation('COM_COMMUNITY_VIDEOS_DURATION'), ': '),
'uploadedby' => acymailing_translation_sprintf('COM_COMMUNITY_PHOTOS_UPLOADED_BY', ''),
'uploadedon' => trim(acymailing_translation('COM_COMMUNITY_VIDEOS_CREATED'), ': '),
'views' => ucfirst(trim(acymailing_translation_sprintf('COM_COMMUNITY_VIDEOS_HITS_COUNT', ''))),
'category' => acymailing_translation('COM_COMMUNITY_VIDEOS_CATEGORY'),
];
$displayOptions = [
[
'title' => 'ACYM_DISPLAY',
'type' => 'checkbox',
'name' => 'fields',
'options' => $attributes,
'default' => 'full',
],
[
'title' => 'ACYM_DISPLAY_PICTURES',
'type' => 'pictures',
'name' => 'pictures',
],
[
'title' => 'ACYM_ORDER_BY',
'type' => 'select',
'name' => 'order',
'options' => [
'v.created' => 'COM_COMMUNITY_VIDEOS_SORT_LATEST',
'v.hits' => 'COM_COMMUNITY_VIDEOS_SORT_POPULAR',
'rand()' => 'ACYM_RANDOM',
],
],
[
'title' => 'Number of characters ("Description" field)',
'type' => 'text',
'name' => 'chars',
'default' => 150,
],
[
'title' => 'ACYM_COLUMNS',
'type' => 'text',
'name' => 'cols',
'default' => 1,
],
[
'title' => 'ACYM_MAX_NB_ELEMENTS',
'type' => 'text',
'name' => 'max',
'default' => 20,
],
];
echo $this->acympluginHelper->displayOptions($displayOptions, 'jomsocialusers', 'simple');
$tabHelper->endTab();
$tabHelper->display('plugin');
}
}