function getBlockCode_Rate()
 {
     ml_clonetwo_import('Voting');
     $o = new MlClonetwoVoting('ml_clonetwo', (int) $this->aDataEntry['id']);
     if (!$o->isEnabled()) {
         return '';
     }
     return $o->getBigVoting($this->_oMain->isAllowedRate($this->aDataEntry));
 }
 function getBlockCode_LatestFeaturedGroup()
 {
     $aDataEntry = $this->oDb->getLatestFeaturedItem();
     if (!$aDataEntry) {
         return false;
     }
     $aAuthor = getProfileInfo($aDataEntry['author_id']);
     $sImageUrl = '';
     $sImageTitle = '';
     $a = array('ID' => $aDataEntry['author_id'], 'Avatar' => $aDataEntry['thumb']);
     $aImage = BxDolService::call('photos', 'get_image', array($a, 'file'), 'Search');
     ml_clonetwo_import('Voting');
     $oRating = new MlClonetwoVoting('ml_clonetwo', $aDataEntry['id']);
     $aVars = array('bx_if:image' => array('condition' => !$aImage['no_image'] && $aImage['file'], 'content' => array('image_url' => !$aImage['no_image'] && $aImage['file'] ? $aImage['file'] : '', 'image_title' => !$aImage['no_image'] && $aImage['title'] ? $aImage['title'] : '', 'group_url' => BX_DOL_URL_ROOT . $this->oConfig->getBaseUri() . 'view/' . $aDataEntry['uri'])), 'group_url' => BX_DOL_URL_ROOT . $this->oConfig->getBaseUri() . 'view/' . $aDataEntry['uri'], 'group_title' => $aDataEntry['title'], 'author_title' => _t('_From'), 'author_username' => getNickName($aAuthor['ID']), 'author_url' => getProfileLink($aAuthor['ID']), 'rating' => $oRating->isEnabled() ? $oRating->getJustVotingElement(true, $aDataEntry['id']) : '', 'fans_count' => $aDataEntry['fans_count'], 'country_city' => $this->oMain->_formatLocation($aDataEntry, false, true));
     return $this->oTemplate->parseHtmlByName('latest_featured_group', $aVars);
 }
 function MlClonetwoSearchResult($sMode = '', $sValue = '', $sValue2 = '', $sValue3 = '')
 {
     switch ($sMode) {
         case 'pending':
             if (false !== bx_get('ml_clonetwo_filter')) {
                 $this->aCurrent['restriction']['keyword'] = array('value' => process_db_input(bx_get('ml_clonetwo_filter'), BX_TAGS_STRIP), 'field' => '', 'operator' => 'against');
             }
             $this->aCurrent['restriction']['activeStatus']['value'] = 'pending';
             $this->sBrowseUrl = "administration";
             $this->aCurrent['title'] = _t('_ml_clonetwo_page_title_pending_approval');
             unset($this->aCurrent['rss']);
             break;
         case 'my_pending':
             $oMain = $this->getMain();
             $this->aCurrent['restriction']['owner']['value'] = $oMain->_iProfileId;
             $this->aCurrent['restriction']['activeStatus']['value'] = 'pending';
             $this->sBrowseUrl = "browse/user/" . getNickName($oMain->_iProfileId);
             $this->aCurrent['title'] = _t('_ml_clonetwo_page_title_pending_approval');
             unset($this->aCurrent['rss']);
             break;
         case 'search':
             if ($sValue) {
                 $this->aCurrent['restriction']['keyword'] = array('value' => $sValue, 'field' => '', 'operator' => 'against');
             }
             if ($sValue2) {
                 $this->aCurrent['join']['category'] = array('type' => 'inner', 'table' => 'sys_categories', 'mainField' => 'id', 'onField' => 'ID', 'joinFields' => '');
                 $this->aCurrent['restriction']['category_type']['value'] = $this->aCurrent['name'];
                 $this->aCurrent['restriction']['category']['value'] = $sValue2;
                 if (is_array($sValue2)) {
                     $this->aCurrent['restriction']['category']['operator'] = 'in';
                 }
             }
             $sValue = $GLOBALS['MySQL']->unescape($sValue);
             $sValue2 = $GLOBALS['MySQL']->unescape($sValue2);
             $this->sBrowseUrl = "search/{$sValue}/" . (is_array($sValue2) ? implode(',', $sValue2) : $sValue2);
             $this->aCurrent['title'] = _t('_ml_clonetwo_page_title_search_results') . ' ' . (is_array($sValue2) ? implode(', ', $sValue2) : $sValue2) . ' ' . $sValue;
             unset($this->aCurrent['rss']);
             break;
         case 'user':
             $iProfileId = $GLOBALS['oMlClonetwoModule']->_oDb->getProfileIdByNickName($sValue, false);
             $GLOBALS['oTopMenu']->setCurrentProfileID($iProfileId);
             // select profile subtab, instead of module tab
             if (!$iProfileId) {
                 $this->isError = true;
             } else {
                 $this->aCurrent['restriction']['owner']['value'] = $iProfileId;
             }
             $sValue = $GLOBALS['MySQL']->unescape($sValue);
             $this->sBrowseUrl = "browse/user/{$sValue}";
             $this->aCurrent['title'] = ucfirst(strtolower($sValue)) . _t('_ml_clonetwo_page_title_browse_by_author');
             if (bx_get('rss')) {
                 $aData = getProfileInfo($iProfileId);
                 if ($aData['Avatar']) {
                     $a = array('ID' => $aData['author_id'], 'Avatar' => $aData['thumb']);
                     $aImage = BxDolService::call('photos', 'get_image', array($a, 'browse'), 'Search');
                     if (!$aImage['no_image']) {
                         $this->aCurrent['rss']['image'] = $aImage['file'];
                     }
                 }
             }
             break;
         case 'joined':
             $iProfileId = $GLOBALS['oMlClonetwoModule']->_oDb->getProfileIdByNickName($sValue, false);
             $GLOBALS['oTopMenu']->setCurrentProfileID($iProfileId);
             // select profile subtab, instead of module tab
             if (!$iProfileId) {
                 $this->isError = true;
             } else {
                 $this->aCurrent['join']['fans'] = array('type' => 'inner', 'table' => 'ml_clonetwo_fans', 'mainField' => 'id', 'onField' => 'id_entry', 'joinFields' => array('id_profile'));
                 $this->aCurrent['restriction']['fans'] = array('value' => $iProfileId, 'field' => 'id_profile', 'operator' => '=', 'table' => 'ml_clonetwo_fans');
                 $this->aCurrent['restriction']['confirmed_fans'] = array('value' => 1, 'field' => 'confirmed', 'operator' => '=', 'table' => 'ml_clonetwo_fans');
             }
             $sValue = $GLOBALS['MySQL']->unescape($sValue);
             $this->sBrowseUrl = "browse/joined/{$sValue}";
             $this->aCurrent['title'] = ucfirst(strtolower($sValue)) . _t('_ml_clonetwo_page_title_browse_by_author_joined_groups');
             if (bx_get('rss')) {
                 $aData = getProfileInfo($iProfileId);
                 if ($aData['Avatar']) {
                     $a = array('ID' => $aData['author_id'], 'Avatar' => $aData['thumb']);
                     $aImage = BxDolService::call('photos', 'get_image', array($a, 'browse'), 'Search');
                     if (!$aImage['no_image']) {
                         $this->aCurrent['rss']['image'] = $aImage['file'];
                     }
                 }
             }
             break;
         case 'admin':
             $this->aCurrent['restriction']['owner']['value'] = 0;
             $this->sBrowseUrl = "browse/admin";
             $this->aCurrent['title'] = _t('_ml_clonetwo_page_title_admin_groups');
             break;
         case 'category':
             $this->aCurrent['join']['category'] = array('type' => 'inner', 'table' => 'sys_categories', 'mainField' => 'id', 'onField' => 'ID', 'joinFields' => '');
             $this->aCurrent['restriction']['category_type']['value'] = $this->aCurrent['name'];
             $this->aCurrent['restriction']['category']['value'] = $sValue;
             $sValue = $GLOBALS['MySQL']->unescape($sValue);
             $this->sBrowseUrl = "browse/category/" . title2uri($sValue);
             $this->aCurrent['title'] = _t('_ml_clonetwo_page_title_browse_by_category') . ' ' . $sValue;
             break;
         case 'tag':
             $this->aCurrent['restriction']['tag']['value'] = $sValue;
             $sValue = $GLOBALS['MySQL']->unescape($sValue);
             $this->sBrowseUrl = "browse/tag/" . title2uri($sValue);
             $this->aCurrent['title'] = _t('_ml_clonetwo_page_title_browse_by_tag') . ' ' . $sValue;
             break;
         case 'recent':
             $this->sBrowseUrl = 'browse/recent';
             $this->aCurrent['title'] = _t('_ml_clonetwo_page_title_browse_recent');
             break;
         case 'top':
             $this->sBrowseUrl = 'browse/top';
             $this->aCurrent['sorting'] = 'top';
             $this->aCurrent['title'] = _t('_ml_clonetwo_page_title_browse_top_rated');
             break;
         case 'popular':
             $this->sBrowseUrl = 'browse/popular';
             $this->aCurrent['sorting'] = 'popular';
             $this->aCurrent['title'] = _t('_ml_clonetwo_page_title_browse_popular');
             break;
         case 'featured':
             $this->aCurrent['restriction']['featured'] = array('value' => 1, 'field' => 'featured', 'operator' => '=');
             $this->sBrowseUrl = 'browse/featured';
             $this->aCurrent['title'] = _t('_ml_clonetwo_page_title_browse_featured');
             break;
         case 'calendar':
             $this->aCurrent['restriction']['calendar-min'] = array('value' => "UNIX_TIMESTAMP('{$sValue}-{$sValue2}-{$sValue3} 00:00:00')", 'field' => 'created', 'operator' => '>=', 'no_quote_value' => true);
             $this->aCurrent['restriction']['calendar-max'] = array('value' => "UNIX_TIMESTAMP('{$sValue}-{$sValue2}-{$sValue3} 23:59:59')", 'field' => 'created', 'operator' => '<=', 'no_quote_value' => true);
             $this->sEventsBrowseUrl = "browse/calendar/{$sValue}/{$sValue2}/{$sValue3}";
             $this->aCurrent['title'] = _t('_ml_clonetwo_page_title_browse_by_day') . getLocaleDate(strtotime("{$sValue}-{$sValue2}-{$sValue3}"), BX_DOL_LOCALE_DATE_SHORT);
             break;
         case '':
             $this->sBrowseUrl = 'browse/';
             $this->aCurrent['title'] = _t('_ml_clonetwo');
             unset($this->aCurrent['rss']);
             break;
         default:
             $this->isError = true;
     }
     $oMain = $this->getMain();
     $this->aCurrent['paginate']['perPage'] = $oMain->_oDb->getParam('ml_clonetwo_perpage_browse');
     if (isset($this->aCurrent['rss'])) {
         $this->aCurrent['rss']['link'] = BX_DOL_URL_ROOT . $oMain->_oConfig->getBaseUri() . $this->sBrowseUrl;
     }
     if (bx_get('rss')) {
         $this->aCurrent['ownFields'][] = 'desc';
         $this->aCurrent['ownFields'][] = 'created';
         $this->aCurrent['paginate']['perPage'] = $oMain->_oDb->getParam('ml_clonetwo_max_rss_num');
     }
     bx_import('Voting', $oMain->_aModule);
     $oVotingView = new MlClonetwoVoting('ml_clonetwo', 0);
     $this->oVotingView = $oVotingView->isEnabled() ? $oVotingView : null;
     $this->sFilterName = 'ml_clonetwo_filter';
     parent::BxDolTwigSearchResult();
 }