Example #1
0
 /**
  * Class Constructor.
  *
  * @since	1.0
  * @access	public
  * @param	int		The total number of records.
  * @param	int		The number of items shown.
  * @param	int		The number of items to be shown per page.
  */
 public function __construct($total, $limitstart, $limit)
 {
     // Initialize the original pagination from Joomla.
     $this->pagination = new JPagination($total, $limitstart, $limit);
     if (!FD::isJoomla30()) {
         $this->pagination->pagesCurrent = $this->pagination->get('pages.current');
         $this->pagination->pagesTotal = $this->pagination->get('pages.total');
         $this->pagination->pagesStart = $this->pagination->get('pages.start');
         $this->pagination->pagesStop = $this->pagination->get('pages.stop');
     }
 }
 /**
  * Method to index an item. The item must be a FinderIndexerResult object.
  *
  * @param   FinderIndexerResult  $item    The item to index as an FinderIndexerResult object.
  * @param   string               $format  The item format
  *
  * @return  void
  *
  * @since   2.5
  * @throws  Exception on database error.
  */
 protected function index(FinderIndexerResult $item, $format = 'html')
 {
     // Check if the extension is enabled
     if (JComponentHelper::isEnabled($this->extension) == false) {
         return;
     }
     $access = 1;
     if (is_null($item->privacy)) {
         $privacy = FD::privacy($item->user_id);
         $privacyValue = $privacy->getValue('photos', 'view');
         $item->privacy = $privacyValue;
     }
     if ($item->privacy == SOCIAL_PRIVACY_PUBLIC) {
         $access = 1;
     } else {
         if ($item->privacy == SOCIAL_PRIVACY_MEMBER) {
             $access = 2;
         } else {
             // this is not public / member items. do not index this item
             return;
         }
     }
     // $sql->select('a.id, a.title, a.alias, a.introtext AS summary, a.fulltext AS body');
     // $sql->select('a.state, a.catid, a.created AS start_date, a.created_by');
     // $sql->select('a.created_by_alias, a.modified, a.modified_by, a.attribs AS params');
     // $sql->select('a.metakey, a.metadesc, a.metadata, a.language, a.access, a.version, a.ordering');
     // $sql->select('a.publish_up AS publish_start_date, a.publish_down AS publish_end_date');
     // $sql->select('c.title AS category, c.published AS cat_state, c.access AS cat_access');
     // album onwer
     $user = FD::user($item->user_id);
     $userAlias = $user->getAlias(false);
     $photo = FD::table('Photo');
     $photo->load($item->id);
     // Build the necessary route and path information.
     // index.php?option=com_easysocial&view=photos&layout=item&id=510:00000690&type=user&uid=84:jenny-siew
     $item->url = 'index.php?option=com_easysocial&view=photos&layout=item&id=' . $photo->getAlias() . '&type=' . $photo->type . '&uid=' . $userAlias;
     $item->route = $photo->getPermalink();
     $item->route = $this->removeAdminSegment($item->route);
     $item->path = FinderIndexerHelper::getContentPath($item->route);
     $category = 'user photo';
     if ($item->type == SOCIAL_TYPE_GROUP) {
         $category = 'group photo';
     }
     $item->access = $access;
     $item->alias = $photo->getAlias();
     $item->state = 1;
     $item->catid = $photo->type == SOCIAL_TYPE_GROUP ? 2 : 1;
     $item->start_date = $photo->created;
     $item->created_by = $photo->user_id;
     $item->created_by_alias = $userAlias;
     $item->modified = $photo->assigned_date == '0000-00-00 00:00:00' ? $photo->created : $photo->assigned_date;
     $item->modified_by = $photo->user_id;
     $item->params = '';
     $item->metakey = $category . ' ' . $photo->title;
     $item->metadesc = $category . ' ' . $photo->title;
     $item->metadata = '';
     $item->publish_start_date = $item->modified;
     $item->category = $category;
     $item->cat_state = 1;
     $item->cat_access = 0;
     $item->summary = $photo->title;
     $item->body = $photo->title;
     // Add the meta-author.
     $item->metaauthor = $userAlias;
     $item->author = $userAlias;
     // add image param
     $registry = FD::registry();
     $registry->set('image', $photo->getSource());
     $item->params = $registry;
     // Add the meta-data processing instructions.
     $item->addInstruction(FinderIndexer::META_CONTEXT, 'metakey');
     $item->addInstruction(FinderIndexer::META_CONTEXT, 'metadesc');
     $item->addInstruction(FinderIndexer::META_CONTEXT, 'metaauthor');
     $item->addInstruction(FinderIndexer::META_CONTEXT, 'author');
     // Add the type taxonomy data.
     $item->addTaxonomy('Type', 'EasySocial.Photos');
     // Add the author taxonomy data.
     $item->addTaxonomy('Author', $userAlias);
     // Add the category taxonomy data.
     $item->addTaxonomy('Category', $item->category, $item->cat_state, $item->cat_access);
     // Add the language taxonomy data.
     $langParams = JComponentHelper::getParams('com_languages');
     $item->language = $langParams->get('site', 'en-GB');
     $item->addTaxonomy('Language', $item->language);
     // Get content extras.
     FinderIndexerHelper::getContentExtras($item);
     // Index the item.
     if (FD::isJoomla30()) {
         $this->indexer->index($item);
     } else {
         FinderIndexer::index($item);
     }
 }
Example #3
0
 /**
  * Generates a hash on a string.
  *
  * @since	1.0
  * @access	public
  * @param	string	The string to be hashed.
  */
 public static function getHash($str)
 {
     if (FD::isJoomla30()) {
         return JApplication::getHash($str);
     }
     return JUtility::getHash($str);
 }
Example #4
0
 /**
  * Responsible to output the search layout.
  *
  * @access	public
  * @return	null
  *
  */
 public function display($tpl = null)
 {
     // Check for user profile completeness
     FD::checkCompleteProfile();
     // Get the current logged in user.
     $query = $this->input->get('q', '', 'default');
     $q = $query;
     // Get the search type
     $type = $this->input->get('type', '', 'cmd');
     // Load up the model
     $indexerModel = FD::model('Indexer');
     // Retrieve a list of supported types
     $allowedTypes = $indexerModel->getSupportedType();
     if (!in_array($type, $allowedTypes)) {
         $type = '';
     }
     // Options
     $data = null;
     $types = null;
     $count = 0;
     $next_limit = '';
     $limit = FD::themes()->getConfig()->get('search_limit');
     // Get the search model
     $model = FD::model('Search');
     $searchAdapter = FD::get('Search');
     // Determines if finder is enabled
     $isFinderEnabled = JComponentHelper::isEnabled('com_finder');
     if (!empty($query) && $isFinderEnabled) {
         jimport('joomla.application.component.model');
         $lib = JPATH_ROOT . '/components/com_finder/models/search.php';
         require_once $lib;
         if ($type) {
             JRequest::setVar('t', $type);
         }
         // Load up finder's model
         $finderModel = new FinderModelSearch();
         $state = $finderModel->getState();
         // Get the query
         // this line need to be here. so that the indexer can get the correct value
         $query = $finderModel->getQuery();
         // When there is no terms match, check if smart search suggested any terms or not. if yes, lets use it.
         if (!$query->terms) {
             if (isset($query->included) && count($query->included) > 0) {
                 $suggestion = '';
                 foreach ($query->included as $item) {
                     if (isset($item->suggestion) && !empty($item->suggestion)) {
                         $suggestion = $item->suggestion;
                     }
                 }
                 if ($suggestion) {
                     $app = JFactory::getApplication();
                     $input = $app->input;
                     $input->request->set('q', $suggestion);
                     // Load up the new model
                     $finderModel = new FinderModelSearch();
                     $state = $finderModel->getState();
                     // this line need to be here. so that the indexer can get the correct value
                     $query = $finderModel->getQuery();
                 }
             }
         }
         //reset the pagination state.
         $state->{'list.start'} = 0;
         $state->{'list.limit'} = $limit;
         $results = $finderModel->getResults();
         $count = $finderModel->getTotal();
         $pagination = $finderModel->getPagination();
         if ($results) {
             $data = $searchAdapter->format($results, $query);
             $query = $finderModel->getQuery();
             if (FD::isJoomla30()) {
                 $pagination->{'pages.total'} = $pagination->pagesTotal;
             }
             if ($pagination->{'pages.total'} == 1) {
                 $next_limit = '-1';
             } else {
                 $next_limit = $pagination->limitstart + $pagination->limit;
             }
         }
         // @badge: search.create
         // Assign badge for the person that initiated the friend request.
         $badge = FD::badges();
         $badge->log('com_easysocial', 'search.create', $this->my->id, JText::_('COM_EASYSOCIAL_SEARCH_BADGE_SEARCHED_ITEM'));
         // get types
         $types = $searchAdapter->getTaxonomyTypes();
     }
     // Set the page title
     FD::page()->title(JText::_('COM_EASYSOCIAL_PAGE_TITLE_SEARCH'));
     // Set the page breadcrumb
     FD::page()->breadcrumb(JText::_('COM_EASYSOCIAL_PAGE_TITLE_SEARCH'));
     $this->set('types', $types);
     $this->set('data', $data);
     $this->set('query', $q);
     $this->set('total', $count);
     $this->set('totalcount', $count);
     $this->set('next_limit', $next_limit);
     echo parent::display('site/search/default');
 }
Example #5
0
 /**
  * Method to index an item. The item must be a FinderIndexerResult object.
  *
  * @param   FinderIndexerResult  $item    The item to index as an FinderIndexerResult object.
  * @param   string               $format  The item format
  *
  * @return  void
  *
  * @since   2.5
  * @throws  Exception on database error.
  */
 protected function index(FinderIndexerResult $item, $format = 'html')
 {
     // Check if the extension is enabled
     if (JComponentHelper::isEnabled($this->extension) == false) {
         return;
     }
     // load foundry config
     $config = FD::config();
     $privacy = FD::privacy($item->user_id);
     //default access
     $access = 1;
     if ($config->get('users.indexer.privacy', 1)) {
         $privacyValue = $privacy->getValue('profiles', 'search');
         $item->privacy = $privacyValue;
         if ($item->privacy == SOCIAL_PRIVACY_PUBLIC) {
             $access = 1;
         } else {
             if ($item->privacy == SOCIAL_PRIVACY_MEMBER) {
                 $access = 2;
             } else {
                 // this is not public / member items. let set the access to 'special'
                 $access = 3;
             }
         }
     }
     $user = FD::user($item->user_id);
     $userAlias = $user->getAlias(false);
     $contentSnapshot = array();
     $userName = $user->getName($config->get('users.indexer.name'));
     $userEmail = $config->get('users.indexer.email') ? $user->email : '';
     $contentSnapshot[] = $userName;
     if ($userEmail) {
         // we need to check for the email field privacy
         if ($config->get('users.indexer.privacy', 1)) {
             $privacyModel = FD::model('Privacy');
             $fieldPrivacyValue = $privacyModel->getFieldValue('field.joomla_email', $user->id);
             if ($fieldPrivacyValue == SOCIAL_PRIVACY_PUBLIC || $fieldPrivacyValue == SOCIAL_PRIVACY_MEMBER) {
                 $contentSnapshot[] = $userEmail;
             } else {
                 $userEmail = '';
             }
         } else {
             $contentSnapshot[] = $userEmail;
         }
     }
     // get data from customfields
     // get customfields.
     // $fieldsLib		= FD::fields();
     // $fieldModel  	= FD::model( 'Fields' );
     // $fieldsResult 	= array();
     // $options = array();
     // $options['data'] 		= true;
     // $options['dataId'] 		= $user->user_id;
     // $options['dataType'] 	= SOCIAL_TYPE_USER;
     // $options['searchable'] 	= 1;
     // //todo: get customfields.
     // $fields = $fieldModel->getCustomFields( $options );
     // if( count( $fields ) > 0 )
     // {
     // 	//foreach( $fields as $item )
     // 	foreach( $fields as $field )
     // 	{
     // 		$userFieldData = isset( $field->data ) ? $field->data : '';
     // 		$args 			= array( $userFieldData );
     // 		$f 				= array( &$field );
     // 		$dataResult 	= @$fieldsLib->trigger( 'onIndexer' , SOCIAL_FIELDS_GROUP_USER , $f , $args );
     // 		if( $dataResult !== false && count( $dataResult ) > 0 )
     // 			$fieldsResult[]  	= $dataResult[0];
     // 	}
     // 	if( $fieldsResult )
     // 	{
     // 		$customFieldsContent 	= implode( ' ', $fieldsResult );
     // 		$contentSnapshot[] 		= $customFieldsContent;
     // 	}
     // }
     $content = implode(' ', $contentSnapshot);
     // Build the necessary route and path information.
     // we need to pass in raw url so that if the site on sef, smart serach will not create new item.
     // index.php?option=com_easysocial&view=profile&id=84:jenny-siew
     // $item->url		= 'index.php?option=com_easysocial&view=profile&id=' . $userAlias;
     $item->url = 'index.php?option=com_easysocial&view=profile&id=' . $user->id;
     $item->route = $user->getPermalink();
     $item->route = $this->removeAdminSegment($item->route);
     $item->path = FinderIndexerHelper::getContentPath($item->route);
     $userProfile = $user->getProfile();
     $metaKey = $userName;
     if ($userEmail) {
         $metaKey .= ', ' . $userEmail;
     }
     $item->title = $userName;
     $item->access = $access;
     $item->alias = $userAlias;
     $item->state = 1;
     $item->start_date = $user->registerDate;
     $item->created_by = $item->user_id;
     $item->created_by_alias = $userAlias;
     $item->modified = $user->registerDate;
     $item->modified_by = $item->user_id;
     $item->params = '';
     $item->metakey = $metaKey;
     $item->metadesc = $content;
     $item->metadata = '';
     $item->publish_start_date = $user->registerDate;
     // let put user profile as category
     $item->catid = $userProfile->id;
     $item->category = $userProfile->getTitle();
     $item->cat_state = 1;
     $item->cat_access = 0;
     $item->summary = $content;
     $item->body = $content;
     // Add the meta-author.
     $item->metaauthor = $userAlias;
     $item->author = $userAlias;
     // add image param
     $registry = FD::registry();
     $registry->set('image', $user->getAvatar());
     $item->params = $registry;
     // Add the meta-data processing instructions.
     $item->addInstruction(FinderIndexer::META_CONTEXT, 'metakey');
     $item->addInstruction(FinderIndexer::META_CONTEXT, 'metadesc');
     $item->addInstruction(FinderIndexer::META_CONTEXT, 'metaauthor');
     $item->addInstruction(FinderIndexer::META_CONTEXT, 'author');
     // Add the type taxonomy data.
     $item->addTaxonomy('Type', 'EasySocial.Users');
     // Add the author taxonomy data.
     $item->addTaxonomy('Author', $userAlias);
     // Add the category taxonomy data.
     $item->addTaxonomy('Category', $item->category, $item->cat_state, $item->cat_access);
     // Add the language taxonomy data.
     // $langParams 	= JComponentHelper::getParams('com_languages');
     // $item->language = $langParams->get( 'site', 'en-GB');
     //
     $item->language = '*';
     $item->addTaxonomy('Language', $item->language);
     // Get content extras.
     FinderIndexerHelper::getContentExtras($item);
     // Index the item.
     if (FD::isJoomla30()) {
         $this->indexer->index($item);
     } else {
         FinderIndexer::index($item);
     }
 }
 /**
  * Method to index an item. The item must be a FinderIndexerResult object.
  *
  * @param   FinderIndexerResult  $item    The item to index as an FinderIndexerResult object.
  * @param   string               $format  The item format
  *
  * @return  void
  *
  * @since   2.5
  * @throws  Exception on database error.
  */
 protected function index(FinderIndexerResult $item, $format = 'html')
 {
     // Check if the extension is enabled
     if (JComponentHelper::isEnabled($this->extension) == false) {
         return;
     }
     $access = 1;
     if (is_null($item->privacy)) {
         $privacy = FD::privacy($item->user_id);
         $privacyValue = $privacy->getValue('albums', 'view');
         $item->privacy = $privacyValue;
     }
     if ($item->privacy == SOCIAL_PRIVACY_PUBLIC) {
         $access = 1;
     } else {
         if ($item->privacy == SOCIAL_PRIVACY_MEMBER) {
             $access = 2;
         } else {
             // this is not public / member items. do not index this item
             return;
         }
     }
     // $sql->select('a.id, a.title, a.alias, a.introtext AS summary, a.fulltext AS body');
     // $sql->select('a.state, a.catid, a.created AS start_date, a.created_by');
     // $sql->select('a.created_by_alias, a.modified, a.modified_by, a.attribs AS params');
     // $sql->select('a.metakey, a.metadesc, a.metadata, a.language, a.access, a.version, a.ordering');
     // $sql->select('a.publish_up AS publish_start_date, a.publish_down AS publish_end_date');
     // $sql->select('c.title AS category, c.published AS cat_state, c.access AS cat_access');
     // album onwer
     $user = FD::user($item->user_id);
     $userAlias = $user->getAlias(false);
     $album = FD::table('Album');
     $album->load($item->id);
     $albumAlias = $album->getAlias();
     // Build the necessary route and path information.
     // we need to pass in raw url so that smart search will not create another duplicate item.
     // index.php?option=com_easysocial&view=albums&id=171:collection&layout=item&uid=84:jenny-siew&type=user
     $item->url = 'index.php?option=com_easysocial&view=albums&id=' . $albumAlias . '&layout=item&uid=' . $userAlias . '&type=' . $album->type;
     $item->route = $album->getPermalink();
     $item->route = $this->removeAdminSegment($item->route);
     $item->path = FinderIndexerHelper::getContentPath($item->route);
     $category = '';
     if ($album->core == SOCIAL_ALBUM_PROFILE_PHOTOS) {
         $category = 'avatar album';
     } else {
         if ($album->core == SOCIAL_ALBUM_PROFILE_COVERS) {
             $category = 'cover album';
         } else {
             if ($album->core == SOCIAL_ALBUM_STORY_ALBUM) {
                 $category = 'story album';
             } else {
                 $category = 'user album';
             }
         }
     }
     $item->access = $access;
     $item->alias = $albumAlias;
     $item->state = 1;
     $item->catid = $album->core;
     $item->start_date = $album->created;
     $item->created_by = $album->user_id;
     $item->created_by_alias = $userAlias;
     $item->modified = $album->assigned_date;
     $item->modified_by = $album->user_id;
     $item->params = '';
     $item->metakey = $category . ' ' . $album->title;
     $item->metadesc = $album->title . ' ' . $album->caption;
     $item->metadata = '';
     $item->publish_start_date = $album->assigned_date;
     $item->category = $category;
     $item->cat_state = 1;
     $item->cat_access = 0;
     $item->summary = empty($album->caption) ? $album->title : $album->caption;
     $item->body = $album->title . ' ' . $album->caption;
     // Add the meta-author.
     $item->metaauthor = $userAlias;
     $item->author = $userAlias;
     // add image param
     $registry = FD::registry();
     $registry->set('image', $album->getCover());
     $item->params = $registry;
     // Add the meta-data processing instructions.
     $item->addInstruction(FinderIndexer::META_CONTEXT, 'metakey');
     $item->addInstruction(FinderIndexer::META_CONTEXT, 'metadesc');
     $item->addInstruction(FinderIndexer::META_CONTEXT, 'metaauthor');
     $item->addInstruction(FinderIndexer::META_CONTEXT, 'author');
     // Add the type taxonomy data.
     $item->addTaxonomy('Type', 'EasySocial.Albums');
     // Add the author taxonomy data.
     $item->addTaxonomy('Author', $userAlias);
     // Add the category taxonomy data.
     $item->addTaxonomy('Category', $item->category, $item->cat_state, $item->cat_access);
     // Add the language taxonomy data.
     $langParams = JComponentHelper::getParams('com_languages');
     $item->language = $langParams->get('site', 'en-GB');
     $item->addTaxonomy('Language', $item->language);
     // Get content extras.
     FinderIndexerHelper::getContentExtras($item);
     // Index the item.
     if (FD::isJoomla30()) {
         $this->indexer->index($item);
     } else {
         FinderIndexer::index($item);
     }
 }
Example #7
0
 /**
  * get activity logs.
  *
  * @since	1.0
  * @access	public
  */
 public function getItems()
 {
     // Check for request forgeries!
     FD::checkToken();
     // search controller do not need to check islogin.
     // Get the current view
     $view = $this->getCurrentView();
     // Get current logged in user
     $my = FD::user();
     // 7:EasyBlog
     $type = JRequest::getInt('type', 0);
     $keywords = JRequest::getVar('q', '');
     $next_limit = JRequest::getVar('next_limit', '');
     $last_type = JRequest::getVar('last_type', '');
     $isloadmore = JRequest::getVar('loadmore', false);
     $ismini = JRequest::getVar('mini', false);
     $highlight = $ismini ? false : true;
     $limit = $ismini ? FD::themes()->getConfig()->get('search_toolbarlimit') : FD::themes()->getConfig()->get('search_limit');
     // @badge: search.create
     // Assign badge for the person that initiated the friend request.
     if (!$isloadmore) {
         $badge = FD::badges();
         $badge->log('com_easysocial', 'search.create', $my->id, JText::_('COM_EASYSOCIAL_SEARCH_BADGE_SEARCHED_ITEM'));
     }
     $results = array();
     $pagination = null;
     $count = 0;
     $data = array();
     $isFinderEnabled = JComponentHelper::isEnabled('com_finder');
     if ($isFinderEnabled) {
         jimport('joomla.application.component.model');
         $searchAdapter = FD::get('Search');
         $path = JPATH_ROOT . '/components/com_finder/models/search.php';
         require_once $path;
         $jModel = new FinderModelSearch();
         $state = $jModel->getState();
         $query = $jModel->getQuery();
         // this line need to be here. so that the indexer can get the correct value
         if (!$query->terms) {
             // if there is no terms match. lets check if smart search suggested any terms or not. if yes, lets use it.
             if (isset($query->included) && count($query->included) > 0) {
                 $suggestion = '';
                 foreach ($query->included as $item) {
                     if (isset($item->suggestion) && !empty($item->suggestion)) {
                         $suggestion = $item->suggestion;
                     }
                 }
                 if ($suggestion) {
                     //reset the query string.
                     $app = JFactory::getApplication();
                     $input = $app->input;
                     $input->request->set('q', $suggestion);
                     //refresh
                     $jModel = new FinderModelSearch();
                     $state = $jModel->getState();
                     $query = $jModel->getQuery();
                     // this line need to be here. so that the indexer can get the correct value
                 }
             }
         }
         //reset the pagination state.
         $state->{'list.start'} = $next_limit;
         $state->{'list.limit'} = $limit;
         if ($type) {
             // 7:EasyBlog
             $typeAlias = JRequest::getVar('type', '');
             $typeAlias = explode(':', $typeAlias);
             $typeAlias = $typeAlias[1];
             $typeArr['Type'] = array($typeAlias => $type);
             $query->filters = $typeArr;
         }
         $results = $jModel->getResults();
         $count = $jModel->getTotal();
         $pagination = $jModel->getPagination();
         if (FD::isJoomla30()) {
             $pagination->{'pages.total'} = $pagination->pagesTotal;
             $pagination->{'pages.current'} = $pagination->pagesCurrent;
         }
         if ($results) {
             $data = $searchAdapter->format($results, $query, $highlight);
             if ($pagination->{'pages.total'} == 1 || $pagination->{'pages.total'} == $pagination->{'pages.current'}) {
                 $next_limit = '-1';
             } else {
                 $next_limit = $pagination->limitstart + $pagination->limit;
             }
         }
     }
     return $view->call(__FUNCTION__, $data, $last_type, $next_limit, $isloadmore, $ismini, $count);
 }
 /**
  * Method to index an item. The item must be a FinderIndexerResult object.
  *
  * @param   FinderIndexerResult  $item    The item to index as an FinderIndexerResult object.
  * @param   string               $format  The item format
  *
  * @return  void
  *
  * @since   2.5
  * @throws  Exception on database error.
  */
 protected function index(FinderIndexerResult $item, $format = 'html')
 {
     // Check if the extension is enabled
     if (JComponentHelper::isEnabled($this->extension) == false) {
         return;
     }
     $access = 1;
     if ($item->type == SOCIAL_EVENT_TYPE_PRIVATE) {
         $access = 2;
     }
     // $sql->select('a.id, a.title, a.alias, a.introtext AS summary, a.fulltext AS body');
     // $sql->select('a.state, a.catid, a.created AS start_date, a.created_by');
     // $sql->select('a.created_by_alias, a.modified, a.modified_by, a.attribs AS params');
     // $sql->select('a.metakey, a.metadesc, a.metadata, a.language, a.access, a.version, a.ordering');
     // $sql->select('a.publish_up AS publish_start_date, a.publish_down AS publish_end_date');
     // $sql->select('c.title AS category, c.published AS cat_state, c.access AS cat_access');
     // album onwer
     $user = FD::user($item->creator_uid);
     $userAlias = $user->getAlias(false);
     $event = FD::event($item->id);
     // Build the necessary route and path information.
     // index.php?option=com_easysocial&view=groups&id=7:chogokin&layout=item&Itemid=799
     $item->url = 'index.php?option=com_easysocial&view=events&id=' . $event->getAlias() . '&layout=item';
     $item->route = $event->getPermalink();
     $item->route = $this->removeAdminSegment($item->route);
     $item->path = FinderIndexerHelper::getContentPath($item->route);
     $item->access = $access;
     $item->alias = $event->getAlias();
     $item->state = 1;
     $item->catid = $event->category_id;
     $item->start_date = $event->created;
     $item->created_by = $event->creator_uid;
     $item->created_by_alias = $userAlias;
     $item->modified = $event->created;
     $item->modified_by = $event->creator_uid;
     $item->params = '';
     $item->metakey = $item->category . ' ' . $event->title;
     $item->metadesc = $event->title . ' ' . $event->description;
     $item->metadata = '';
     $item->publish_start_date = $event->created;
     $item->category = $item->category;
     $item->cat_state = 1;
     $item->cat_access = 0;
     $item->summary = $event->title . ' ' . $event->description;
     $item->body = $event->title . ' ' . $event->description;
     // Add the meta-author.
     $item->metaauthor = $userAlias;
     $item->author = $userAlias;
     // add image param
     $registry = FD::registry();
     $registry->set('image', $event->getAvatar());
     $item->params = $registry;
     // Add the meta-data processing instructions.
     $item->addInstruction(FinderIndexer::META_CONTEXT, 'metakey');
     $item->addInstruction(FinderIndexer::META_CONTEXT, 'metadesc');
     $item->addInstruction(FinderIndexer::META_CONTEXT, 'metaauthor');
     $item->addInstruction(FinderIndexer::META_CONTEXT, 'author');
     // Add the type taxonomy data.
     $item->addTaxonomy('Type', 'EasySocial.Events');
     // Add the author taxonomy data.
     $item->addTaxonomy('Author', $userAlias);
     // Add the category taxonomy data.
     $item->addTaxonomy('Category', $item->category, $item->cat_state, $item->cat_access);
     // Add the language taxonomy data.
     $langParams = JComponentHelper::getParams('com_languages');
     $item->language = $langParams->get('site', 'en-GB');
     $item->addTaxonomy('Language', $item->language);
     // Get content extras.
     FinderIndexerHelper::getContentExtras($item);
     // Index the item.
     if (FD::isJoomla30()) {
         $this->indexer->index($item);
     } else {
         FinderIndexer::index($item);
     }
 }