Esempio n. 1
0
 /**
  * Responsible to output the html codes that is displayed to
  * a user when their profile is viewed.
  *
  * @since	1.0
  * @access	public
  */
 public function onDisplay($user)
 {
     $value = $this->value;
     if (!$value) {
         return;
     }
     if (!$this->allowedPrivacy($user)) {
         return;
     }
     // If there's no http:// or https:// , automatically append http://
     if (stristr($value, 'http://') === false && stristr($value, 'https://') === false) {
         $value = 'http://' . $value;
     }
     // Push vars to the theme
     $this->set('value', $this->escape($value));
     // linkage to advanced search page.
     $field = $this->field;
     if ($field->searchable) {
         $params = array('layout' => 'advanced');
         $params['criterias[]'] = $field->unique_key . '|' . $field->element;
         $params['operators[]'] = 'contain';
         $params['conditions[]'] = $this->escape($this->value);
         $advsearchLink = FRoute::search($params);
         $this->set('advancedsearchlink', $advsearchLink);
     }
     return $this->display();
 }
Esempio n. 2
0
 /**
  * Displays the gender in the position profileHeaderA
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function profileHeaderA($key, $user, $field)
 {
     $value = $field->data;
     // If user didn't set their gender, don't need to do anything
     if (!$value) {
         return;
     }
     $my = FD::user();
     $privacyLib = FD::privacy($my->id);
     if (!$privacyLib->validate('core.view', $field->id, SOCIAL_TYPE_FIELD, $user->id)) {
         return;
     }
     $theme = FD::themes();
     $theme->set('value', $value);
     $theme->set('params', $field->getParams());
     // linkage to advanced search page.
     if ($field->searchable) {
         $params = array('layout' => 'advanced');
         $params['criterias[]'] = $field->unique_key . '|' . $field->element;
         $params['operators[]'] = 'equal';
         $params['conditions[]'] = $value;
         $advsearchLink = FRoute::search($params);
         $theme->set('advancedsearchlink', $advsearchLink);
     }
     echo $theme->output('fields/user/gender/widgets/display');
 }
Esempio n. 3
0
 /**
  * Responsible to output the html codes that is displayed to
  * a user when their profile is viewed.
  *
  * @since	1.0
  * @access	public
  */
 public function onDisplay($user)
 {
     $value = $this->value;
     if ($value == '') {
         return;
     }
     if (!$this->allowedPrivacy($user)) {
         return;
     }
     // linkage to advanced search page.
     $field = $this->field;
     if ($field->searchable) {
         $params = array('layout' => 'advanced');
         $params['criterias[]'] = $field->unique_key . '|' . $field->element;
         $params['operators[]'] = 'equal';
         $params['conditions[]'] = $this->value;
         $advsearchLink = FRoute::search($params);
         $this->set('advancedsearchlink', $advsearchLink);
     }
     // Push variables into theme.
     $this->set('value', $value);
     return $this->display();
 }
Esempio n. 4
0
 /**
  * Displays the gender in the position profileHeaderA
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function profileHeaderA($key, $user, $field)
 {
     $dateString = '';
     $theme = FD::themes();
     $regDate = FD::date($user->registerDate);
     // linkage to advanced search page.
     if ($field->searchable) {
         $date = $regDate->toFormat('Y-m-d');
         $params = array('layout' => 'advanced');
         $params['criterias[]'] = $field->unique_key . '|' . $field->element;
         $params['operators[]'] = 'between';
         $params['conditions[]'] = $date . ' 00:00:00' . '|' . $date . ' 23:59:59';
         $advsearchLink = FRoute::search($params);
         $theme->set('advancedsearchlink', $advsearchLink);
     }
     $fieldParams = $field->getParams();
     $format = 'd M Y';
     switch ($fieldParams->get('date_format')) {
         case 2:
         case '2':
             $format = 'M d Y';
             break;
         case 3:
         case '3':
             $format = 'Y d M';
             break;
         case 4:
         case '4':
             $format = 'Y M d';
             break;
     }
     $dateString = $regDate->toFormat($format);
     $dateString = JText::sprintf('PLG_FIELDS_JOOMLA_JOINDATE_WIDGETS_MEMBER_SINCE', $dateString);
     $theme->set('value', $dateString);
     echo $theme->output('fields/user/joomla_joindate/widgets/display');
 }
Esempio n. 5
0
 /**
  * Displays the gender in the position profileHeaderA
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function profileHeaderA($key, $user, $field)
 {
     $dateString = '';
     $theme = FD::themes();
     if ($user->lastvisitDate == '' || $user->lastvisitDate == '0000-00-00 00:00:00') {
         $dateString = JText::_('PLG_FIELDS_JOOMLA_LASTLOGIN_WIDGETS_NEVER_LOGGED_IN');
     } else {
         $llDate = FD::date($user->lastvisitDate);
         // linkage to advanced search page.
         if ($field->searchable) {
             $date = $llDate->toFormat('Y-m-d');
             $params = array('layout' => 'advanced');
             $params['criterias[]'] = $field->unique_key . '|' . $field->element;
             $params['operators[]'] = 'between';
             $params['conditions[]'] = $date . ' 00:00:00' . '|' . $date . ' 23:59:59';
             $advsearchLink = FRoute::search($params);
             $theme->set('advancedsearchlink', $advsearchLink);
         }
         $dateString = $llDate->toLapsed();
         $dateString = JText::sprintf('PLG_FIELDS_JOOMLA_LASTLOGIN_WIDGETS_LAST_LOGGED_IN', $dateString);
     }
     $theme->set('value', $dateString);
     echo $theme->output('fields/user/joomla_lastlogin/widgets/display');
 }
Esempio n. 6
0
">
							<i class="ies-users ies-small mr-5"></i> <?php 
            echo JText::_('COM_EASYSOCIAL_TOOLBAR_BROWSE_USERS');
            ?>
						</a>
					</li>
					<li class="divider"></li>
					<?php 
        }
        ?>
					<?php 
        if ($this->template->get('show_advanced_search', true)) {
            ?>
					<li>
						<a href="<?php 
            echo FRoute::search(array('layout' => 'advanced'));
            ?>
">
							</i> <?php 
            echo JText::_('COM_EASYSOCIAL_TOOLBAR_ADVANCED_SEARCH');
            ?>
						</a>
					</li>
					<?php 
        }
        ?>
					<?php 
    }
    ?>
				<?php 
}
Esempio n. 7
0
 public function toDisplay($display = '', $linkToAdvancedSearch = false)
 {
     $value = $this->value->title;
     if (!$this->value->value) {
         return '';
     }
     $lib = FD::privacy(FD::user()->id);
     if (!$lib->validate('field.' . $this->element, $this->field_id, SOCIAL_TYPE_FIELD, $this->uid)) {
         return '';
     }
     if ($display) {
         // append gender icon.
         $icontype = $this->value->value == 1 ? 'male' : 'female';
         $icon = '';
         if ($this->value->value != 3) {
             $icon = '<i class="ies-small mr-5 ies-' . $icontype . '"></i>';
         }
         $value = $icon . $this->value->title;
     }
     if ($linkToAdvancedSearch) {
         $params = array('layout' => 'advanced');
         $params['criterias[]'] = $this->unique_key . '|' . $this->element;
         $params['operators[]'] = 'equal';
         $params['conditions[]'] = $this->value->value;
         $advsearchLink = FRoute::search($params);
         $value = '<a class="fd-small muted" href="' . $advsearchLink . '">' . $value . '</a>';
     }
     return $value;
 }
<li class="custom-filter<?php 
echo $fid == $filter->id ? ' active' : '';
?>
"
	data-sidebar-menu
	data-sidebar-item
	data-id="<?php 
echo $filter->id;
?>
"
	data-search-filter-<?php 
echo $filter->id;
?>
>
	<a href="<?php 
echo FRoute::search(array('layout' => 'advanced', 'fid' => $filter->getAlias()));
?>
"
		data-type="custom"
		data-search-filter-item
		data-id="<?php 
echo $filter->id;
?>
"
		data-title="<?php 
echo $this->html('string.escape', $filter->title);
?>
"
	>
		<i class="ies-list mr-5"></i> <?php 
echo $this->html('string.escape', $filter->title);
Esempio n. 9
0
 /**
  * Responsible to output the html codes that is displayed to
  * a user when their profile is viewed.
  *
  * @since	1.0
  * @access	public
  */
 public function onDisplay($user)
 {
     $value = $this->value;
     if (!$value) {
         return;
     }
     if (!$this->allowedPrivacy($user)) {
         return;
     }
     $option = FD::table('fieldoptions');
     $option->load(array('parent_id' => $this->field->id, 'key' => 'items', 'value' => $value));
     $field = $this->field;
     if ($field->searchable) {
         $params = array('layout' => 'advanced');
         $params['criterias[]'] = $field->unique_key . '|' . $field->element;
         $params['operators[]'] = 'equal';
         $params['conditions[]'] = $this->value;
         $advsearchLink = FRoute::search($params);
         $this->set('advancedsearchlink', $advsearchLink);
     }
     // Push variables into theme.
     $this->set('option', $option);
     $this->set('value', $value);
     return $this->display();
 }
Esempio n. 10
0
 public function onDisplay($user)
 {
     $regDate = FD::date($user->registerDate);
     $format = 'd M Y';
     switch ($this->params->get('date_format')) {
         case 2:
         case '2':
             $format = 'M d Y';
             break;
         case 3:
         case '3':
             $format = 'Y d M';
             break;
         case 4:
         case '4':
             $format = 'Y M d';
             break;
     }
     // linkage to advanced search page.
     // place the code here so that the timezone wont kick in. we search the date using GMT value.
     $field = $this->field;
     if ($field->searchable) {
         $date = $regDate->toFormat('Y-m-d');
         $params = array('layout' => 'advanced');
         $params['criterias[]'] = $field->unique_key . '|' . $field->element;
         $params['operators[]'] = 'between';
         $params['conditions[]'] = $date . ' 00:00:00' . '|' . $date . ' 23:59:59';
         $advsearchLink = FRoute::search($params);
         $this->set('advancedsearchlink', $advsearchLink);
     }
     $this->set('date', $regDate->toFormat($format));
     return $this->display();
 }
Esempio n. 11
0
 public function onDisplay($user)
 {
     if ($user->lastvisitDate == '' || $user->lastvisitDate == '0000-00-00 00:00:00') {
         $this->set('date', JText::_('PLG_FIELDS_JOOMLA_LASTLOGIN_WIDGETS_NEVER_LOGGED_IN'));
     }
     $llDate = FD::date($user->lastvisitDate);
     $format = 'd M Y';
     switch ($this->params->get('date_format')) {
         case 2:
         case '2':
             $format = 'M d Y';
             break;
         case 3:
         case '3':
             $format = 'Y d M';
             break;
         case 4:
         case '4':
             $format = 'Y M d';
             break;
     }
     $format .= ' H:i:s';
     // linkage to advanced search page.
     // place the code here so that the timezone wont kick in. we search the date using GMT value.
     $field = $this->field;
     if ($field->searchable) {
         $date = $llDate->toFormat('Y-m-d');
         $params = array('layout' => 'advanced');
         $params['criterias[]'] = $field->unique_key . '|' . $field->element;
         $params['operators[]'] = 'between';
         $params['conditions[]'] = $date . ' 00:00:00' . '|' . $date . ' 23:59:59';
         $advsearchLink = FRoute::search($params);
         $this->set('advancedsearchlink', $advsearchLink);
     }
     $this->set('date', $llDate->toFormat($format));
     return $this->display();
 }
Esempio n. 12
0
 public function onDisplay($user)
 {
     if (!$this->allowedPrivacy($user)) {
         return;
     }
     $model = $this->model('relations');
     $relation = $model->getActorRelationship($user->id);
     if (!$relation) {
         return;
     }
     // linkage to advanced search page.
     $field = $this->field;
     if ($field->searchable) {
         $params = array('layout' => 'advanced');
         $params['criterias[]'] = $field->unique_key . '|' . $field->element;
         $params['operators[]'] = 'equal';
         $params['conditions[]'] = $relation->getType()->value;
         $advsearchLink = FRoute::search($params);
         $this->set('advancedsearchlink', $advsearchLink);
     }
     $this->set('relation', $relation);
     return $this->display();
 }
Esempio n. 13
0
 public function onDisplay($user)
 {
     $value = $this->value;
     if (!$value) {
         return;
     }
     $value = FD::makeObject($value);
     if (!$this->allowedPrivacy($user)) {
         return;
     }
     $field = $this->field;
     $options = array();
     foreach ($value as $v) {
         $option = FD::table('fieldoptions');
         $option->load(array('parent_id' => $this->field->id, 'key' => 'items', 'value' => $v));
         if ($field->searchable) {
             $params = array('layout' => 'advanced');
             $params['criterias[]'] = $field->unique_key . '|' . $field->element;
             $params['operators[]'] = 'contain';
             $params['conditions[]'] = $v;
             $advsearchLink = FRoute::search($params);
             $option->advancedsearchlink = $advsearchLink;
         }
         $options[] = $option;
     }
     // echo '<pre>';print_r( $value );echo '</pre>';
     $this->set('options', $options);
     return $this->display();
 }
Esempio n. 14
0
 public function formatMini($results, $q, $highlight = true)
 {
     $config = FD::config();
     $data = array();
     if ($results) {
         $searchRegex = '';
         $hlword = $q;
         if ($hlword) {
             $searchRegex = '#(';
             $searchRegex .= preg_quote($hlword, '#');
             $searchRegex .= '(?!(?>[^<]*(?:<(?!/?a\\b)[^<]*)*)</a>))#iu';
         }
         foreach ($results as $row) {
             $obj = new SocialSearchItem();
             $obj->link = FRoute::search(array('q' => urlencode($row)));
             //lets process the content and title highlight
             $title = $row;
             if ($highlight) {
                 if ($title) {
                     $title = preg_replace($searchRegex, '<span class="highlight">\\0</span>', $title);
                 }
             }
             $obj->title = $title;
             $data[] = $obj;
         }
     }
     return $data;
 }
Esempio n. 15
0
*/
defined('_JEXEC') or die('Unauthorized Access');
?>
<ul class="list-unstyled">
<?php 
foreach ($value as $v) {
    ?>
	<li>
        <?php 
    $advsearchLink = '';
    if (isset($field) && $field->searchable && $v) {
        $params = array('layout' => 'advanced');
        $params['criterias[]'] = $field->unique_key . '|' . $field->element;
        $params['operators[]'] = 'contain';
        $params['conditions[]'] = $v;
        $advsearchLink = FRoute::search($params);
    }
    ?>
        <?php 
    echo isset($advsearchLink) && $advsearchLink ? '<a href="' . $advsearchLink . '">' : '';
    ?>
        <?php 
    echo $v;
    ?>
        <?php 
    echo isset($advsearchLink) && $advsearchLink ? '</a>' : '';
    ?>
    </li>
<?php 
}
?>
Esempio n. 16
0
 public function onDisplay($user)
 {
     if (empty($this->value)) {
         return;
     }
     if (!$this->allowedPrivacy($user)) {
         return;
     }
     $json = FD::json();
     $result = $json->decode($this->value);
     if (!is_array($result) || empty($result)) {
         return;
     }
     $field = $this->field;
     $values = array();
     foreach ($result as $r) {
         $r = trim($r);
         if (empty($r)) {
             continue;
         }
         $option = Foundry::table('fieldoptions');
         $option->load(array('parent_id' => $this->field->id, 'key' => 'items', 'value' => $r));
         if ($field->searchable) {
             $params = array('layout' => 'advanced');
             $params['criterias[]'] = $field->unique_key . '|' . $field->element;
             $params['operators[]'] = 'contain';
             $params['conditions[]'] = $v;
             $advsearchLink = FRoute::search($params);
             $option->advancedsearchlink = $advsearchLink;
         }
         $values[] = $option;
     }
     if (empty($values)) {
         return;
     }
     $this->set('values', $values);
     return $this->display();
 }
Esempio n. 17
0
    echo JText::_('COM_EASYSOCIAL_SEARCH_VIEW_ALL_RESULTS');
    ?>
			</a>
		</div>
		<div class="text-center fd-small">
			<?php 
    echo JText::sprintf('COM_EASYSOCIAL_ADVANCED_SEARCH_TRY_ADVANCED_SEARCH', FRoute::search(array('layout' => 'advanced')));
    ?>
		</div>
	</div>

<?php 
} else {
    ?>
		<div class="search-empty text-center">
			<?php 
    echo JText::_('COM_EASYSOCIAL_SEARCH_NO_RECORDS_FOUND');
    ?>

			<div class="fd-small">
			<?php 
    echo JText::sprintf('COM_EASYSOCIAL_ADVANCED_SEARCH_TRY_ADVANCED_SEARCH', FRoute::search(array('layout' => 'advanced')));
    ?>
		</div>
		</div>

<?php 
}
?>
</div>
Esempio n. 18
0
 public function onDisplay($user)
 {
     $value = $this->value;
     if (!$value) {
         return;
     }
     $value = FD::makeArray($value);
     if (!$this->allowedPrivacy($user)) {
         return;
     }
     $field = $this->field;
     $countries = array();
     $aslink = array();
     foreach ($value as $v) {
         $country = SocialFieldsUserCountryHelper::getCountryName($v);
         if ($country) {
             if ($field->searchable) {
                 $params = array('layout' => 'advanced');
                 $params['criterias[]'] = $field->unique_key . '|' . $field->element;
                 $params['operators[]'] = 'equal';
                 $params['conditions[]'] = $v;
                 $advsearchLink = FRoute::search($params);
                 $aslink[] = $advsearchLink;
             } else {
                 $aslink[] = '';
                 // give empty value so that the array tally with the countries size.
             }
             $countries[] = $country;
         }
     }
     if (count($countries) === 0) {
         return;
     }
     $this->set('advancedsearchlinks', $aslink);
     $this->set('countries', $countries);
     return $this->display();
 }
Esempio n. 19
0
				</div>
			</legend>
			<?php 
}
?>

			<?php 
$routerSegment = array();
$routerSegment['layout'] = 'advanced';
if ($fid) {
    $routerSegment['fid'] = $filter->getAlias();
}
?>

			<form name="frmAdvSearch" method="post" action="<?php 
echo FRoute::search($routerSegment);
?>
" data-adv-search-form>

				<div class="es-search-criteria mb-15" data-advsearch-list>
					<?php 
echo $criteriaHTML;
?>
				</div>

				<div class="es-search-add-criteria mb-20">
					<a href="javascript:void(0);" class="btn btn-es-inverse btn-sm" data-adv-search-add-criteria><i class="ies-plus-2 ies-small mr-5"></i> <?php 
echo JText::_('COM_EASYSOCIAL_ADVANCED_SEARCH_NEW_CRITERIA');
?>
</a>
				</div>
Esempio n. 20
0
if ($types) {
    ?>
				<?php 
    foreach ($types as $item) {
        $lang = JText::_('COM_EASYSOCIAL_SEARCH_BY_' . strtoupper($item->displayTitle));
        $typeAlias = $item->id . ':' . $item->title;
        ?>
					<li
						data-sidebar-menu
						data-sidebar-item
						data-type="<?php 
        echo $typeAlias;
        ?>
"
						data-url="<?php 
        echo FRoute::search(array('type' => $typeAlias, 'q' => $query));
        ?>
"
					>
						<a href="javascript:void(0);">
							<i class="<?php 
        echo $item->icon;
        ?>
 ies-small mr-5"></i> <?php 
        echo strpos($lang, 'COM_EASYSOCIAL_SEARCH_BY_') !== false ? ucfirst($item->displayTitle) : $lang;
        ?>
							<div class="label label-notification pull-right mr-20"></div>
						</a>
					</li>
				<?php 
    }
Esempio n. 21
0
 /**
  * Responsible to output the html codes that is displayed to
  * a user when their profile is viewed.
  *
  * @since	1.0
  * @access	public
  */
 public function onDisplay($user)
 {
     $name = new stdClass();
     if (empty($this->value)) {
         $name->first = $this->escape($user->name);
         $name->middle = '';
         $name->last = '';
         $name->name = $this->escape($user->name);
     } else {
         $obj = FD::makeObject($this->value);
         $name->first = !empty($obj->first) ? $this->escape($obj->first) : '';
         $name->middle = !empty($obj->middle) ? $this->escape($obj->middle) : '';
         $name->last = !empty($obj->last) ? $this->escape($obj->last) : '';
         $name->name = !empty($obj->name) ? $this->escape($obj->name) : '';
     }
     // $this->set('user'	, $user);
     $this->set('name', $name);
     // linkage to advanced search page.
     $field = $this->field;
     if ($field->searchable) {
         $params = array('layout' => 'advanced');
         $params['criterias[]'] = $field->unique_key . '|' . $field->element;
         $params['datakeys[]'] = 'first';
         $params['operators[]'] = 'contain';
         $params['conditions[]'] = $name->first;
         $advsearchLink = FRoute::search($params);
         $this->set('advancedsearchlink', $advsearchLink);
     }
     return $this->display();
 }
Esempio n. 22
0
 /**
  * Override datetime class onDisplay to show age as well.
  *
  * @author Jason Rey <*****@*****.**>
  * @since  1.2
  * @access public
  * @param  SocialUser    $user The user object being viewed.
  * @return string              The html string display.
  */
 public function onDisplay($user)
 {
     if (empty($this->value)) {
         return;
     }
     if (!$this->allowedPrivacy($user)) {
         return;
     }
     if (empty($this->value['date'])) {
         return;
     }
     $data = $this->getDatetimeValue($this->value['date']);
     if ($data->isEmpty()) {
         return;
     }
     $allowYear = true;
     if ($this->params->get('year_privacy')) {
         $allowYear = $this->allowedPrivacy($user, 'year');
     }
     $format = $allowYear ? 'd M Y' : 'd M';
     switch ($this->params->get('date_format')) {
         case 2:
         case '2':
             $format = $allowYear ? 'M d Y' : 'M d';
             break;
         case 3:
         case '3':
             $format = $allowYear ? 'Y d M' : 'd M';
             break;
         case 4:
         case '4':
             $format = $allowYear ? 'Y M d' : 'M d';
             break;
     }
     $age = $allowYear && $this->params->get('show_age') ? $data->toAge() : '';
     // Push variables into theme.
     $this->set('date', $data->toFormat($format));
     $this->set('allowYearSettings', $this->params->get('year_privacy') && FD::user()->id === $user->id);
     $this->set('age', $age);
     // linkage to advanced search page.
     $field = $this->field;
     if ($allowYear && $field->searchable) {
         $date = $data->toFormat('Y-m-d');
         $params = array('layout' => 'advanced');
         $params['criterias[]'] = $field->unique_key . '|' . $field->element;
         $params['operators[]'] = 'between';
         $params['conditions[]'] = $date . ' 00:00:00' . '|' . $date . ' 23:59:59';
         $advsearchLink = FRoute::search($params);
         $this->set('advancedsearchlink', $advsearchLink);
     }
     return $this->display();
 }
Esempio n. 23
0
 /**
  * Responsible to output the html codes that is displayed to
  * a user when their profile is viewed.
  *
  * @since   1.0
  * @access  public
  * @param   SocialUser  The user object
  * @return  string  The html output.
  *
  * @author  Jason Rey <*****@*****.**>
  */
 public function onDisplay($user)
 {
     if (empty($this->value)) {
         return;
     }
     if (!$this->allowedPrivacy($user)) {
         return;
     }
     if (empty($this->value['date'])) {
         return;
     }
     $data = $this->getDatetimeValue($this->value['date']);
     if ($data->isEmpty()) {
         return;
     }
     $allowYear = true;
     if ($this->params->get('year_privacy')) {
         $allowYear = $this->allowedPrivacy($user, 'year');
     }
     $format = $allowYear ? 'd M Y' : 'd M';
     switch ($this->params->get('date_format')) {
         case 2:
         case '2':
             $format = $allowYear ? 'M d Y' : 'M d';
             break;
         case 3:
         case '3':
             $format = $allowYear ? 'Y d M' : 'd M';
             break;
         case 4:
         case '4':
             $format = $allowYear ? 'Y M d' : 'M d';
             break;
     }
     if ($this->params->get('allow_time')) {
         $format .= $this->params->get('time_format') == 1 ? ' g:i:sA' : ' H:i:s';
     }
     // linkage to advanced search page.
     // place the code here so that the timezone wont kick in. we search the date using GMT value.
     $field = $this->field;
     if ($allowYear && $field->searchable) {
         $date = $data->toFormat('Y-m-d');
         $params = array('layout' => 'advanced');
         $params['criterias[]'] = $field->unique_key . '|' . $field->element;
         $params['operators[]'] = 'between';
         $params['conditions[]'] = $date . ' 00:00:00' . '|' . $date . ' 23:59:59';
         $advsearchLink = FRoute::search($params);
         $this->set('advancedsearchlink', $advsearchLink);
     }
     $this->set('allowYearSettings', $this->params->get('year_privacy') && FD::user()->id === $user->id);
     if ($this->params->get('allow_timezone')) {
         $timezone = isset($this->value['timezone']) ? $this->value['timezone'] : $this->getUserTimezone($user);
         $this->set('timezone', $timezone);
         $timezones = $this->getTimezones();
         $this->set('timezones', $timezones);
         $data->setTimezone($timezone);
     }
     // Push variables into theme.
     $this->set('date', $data->toFormat($format));
     $this->set('dateObject', $data);
     $this->set('user', $user);
     return $this->display();
 }
Esempio n. 24
0
 public function toDisplay($options = '', $linkToAdvancedSearch = false)
 {
     if (!isset($this->value)) {
         return '';
     }
     $display = $options['display'];
     $config = FD::config();
     $params = array('layout' => 'advanced');
     $params['datakeys[]'] = 'state';
     $params['conditions[]'] = $this->value->state;
     $value = $this->value->address;
     $icontype = 'compass';
     $icon = '<i class="ies-small mr-5 ies-' . $icontype . '"></i>';
     $searchUnit = $config->get('general.location.proximity.unit', 'mile');
     $searchText = $value;
     if ($display == 'distance') {
         // from input
         $lat = $options['lat'];
         $lon = $options['lon'];
         // from user data
         $uLat = $this->value->latitude;
         $uLon = $this->value->longitude;
         $dist = $this->distance($lat, $lon, $uLat, $uLon, $searchUnit);
         $value = round($dist, 1);
         $params['datakeys[]'] = 'distance';
         $cValue = ceil($value) . '|' . $uLat . '|' . $uLon . '|' . $this->value->address;
         $params['conditions[]'] = $cValue;
         $searchText = JText::sprintf('PLG_FIELDS_ADDRESS_DISTANCE_IN_' . strtoupper($searchUnit), $value);
     }
     if ($linkToAdvancedSearch) {
         $params['criterias[]'] = $this->unique_key . '|' . $this->element;
         $params['operators[]'] = 'equal';
         $advsearchLink = FRoute::search($params);
         $value = '<a href="' . $advsearchLink . '">' . $icon . $searchText . '</a>';
     }
     return $value;
 }
Esempio n. 25
0
 /**
  * Displays the age in the position profileHeaderA
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function profileHeaderA($key, $user, $field)
 {
     $my = FD::user();
     $privacyLib = FD::privacy($my->id);
     if (!$privacyLib->validate('core.view', $field->id, SOCIAL_TYPE_FIELD, $user->id)) {
         return;
     }
     $params = $field->getParams();
     if ($params->get('show_age') && !$privacyLib->validate('field.birthday', $field->id, 'year', $user->id)) {
         return;
     }
     // Get the current stored value.
     $value = $field->data;
     if (empty($value)) {
         return false;
     }
     if (is_array($value) && isset($value['date']) && !$value['date']) {
         // empty value. just return empty string.
         return false;
     }
     $data = new SocialFieldsUserDateTimeObject($value);
     $date = null;
     if (!empty($data->year) && !empty($data->month) && !empty($data->day)) {
         $date = $data->year . '-' . $data->month . '-' . $data->day;
     }
     if (!$date) {
         return;
     }
     $allowYear = true;
     $theme = FD::themes();
     if ($params->get('show_age')) {
         // Compute the age now.
         $age = $this->getAge($date);
         $theme->set('value', $age);
     } else {
         $allowYear = $privacyLib->validate('field.birthday', $field->id, 'year', $user->id);
         $format = $allowYear ? 'j F Y' : 'j F';
         $birthday = FD::date($date, false)->format($format);
         $theme->set('value', $birthday);
     }
     // linkage to advanced search page.
     if ($allowYear && $field->searchable) {
         $date = $data->format('Y-m-d');
         $params = array('layout' => 'advanced');
         $params['criterias[]'] = $field->unique_key . '|' . $field->element;
         $params['operators[]'] = 'between';
         $params['conditions[]'] = $date . ' 00:00:00' . '|' . $date . ' 23:59:59';
         $advsearchLink = FRoute::search($params);
         $theme->set('advancedsearchlink', $advsearchLink);
     }
     $theme->set('params', $params);
     echo $theme->output('fields/user/birthday/widgets/display');
 }
Esempio n. 26
0
 public function toDisplay($display = '', $linkToAdvancedSearch = false)
 {
     $value = $this->value->title;
     if (!$this->value->value) {
         return '';
     }
     if ($display) {
         // append gender icon.
         $icontype = $this->value->value == 1 ? 'male' : 'female';
         $icon = '';
         if ($this->value->value != 3) {
             $icon = '<i class="ies-small mr-5 ies-' . $icontype . '"></i>';
         }
         $value = $icon . $this->value->title;
     }
     if ($linkToAdvancedSearch) {
         $params = array('layout' => 'advanced');
         $params['criterias[]'] = $this->unique_key . '|' . $this->element;
         $params['operators[]'] = 'equal';
         $params['conditions[]'] = $this->value->value;
         $advsearchLink = FRoute::search($params);
         $value = '<a href="' . $advsearchLink . '">' . $value . '</a>';
     }
     return $value;
 }