/**
  * Function will get config form;
  * 
  * @param  : $oModule (object) - current module;
  * @return : (text) - html presentation data;
  */
 function getConfigForm(&$oModule)
 {
     $aForm = array('form_attrs' => array('action' => $oModule->sPathToModule . 'administration/settings', 'method' => 'post', 'name' => 'form'), 'params' => array('checker_helper' => 'BxCheckerMigration', 'db' => array('submit_name' => 'do_submit')), 'inputs' => array('location' => array('type' => 'text', 'name' => 'location', 'caption' => _t('_bx_data_migration_q_where_located'), 'required' => true, 'value' => $oModule->_oDb->getExtraParam('root'), 'info' => _t('_bx_data_migration_q_d_where_located', ' ' . BX_DIRECTORY_PATH_ROOT), 'checker' => array('func' => 'DolpinDirectory', 'params' => array(), 'error' => _t('_bx_data_migration_q_e_wrong_path')))));
     // add submit button;
     $aForm['inputs'][] = array('type' => 'submit', 'name' => 'do_submit', 'value' => _t('_Submit'));
     $oForm =& new BxTemplFormView($aForm);
     $oForm->initChecker();
     if ($oForm->isSubmittedAndValid()) {
         $sOutputCode = $oModule->createConfig($oForm->getCleanValue('location'));
     } else {
         $sOutputCode = $oForm->getCode();
     }
     return $sOutputCode;
 }
Example #2
0
 /**
  * Function will generate country block ;
  *
  * @param        : $oObject (object) - link on created object;
  * @param        : $sCurrentKey (string) - key name, need for search into cacje file;
  * @return       : Html presentation data;
  */
 function _genCountrySection(&$oObject, $sCurrentKey)
 {
     global $site;
     // init some variables ;
     $sCountrySection = '';
     $sExtendedCss = '';
     $aCurrentArray = '';
     $aUsedTemplates = array('browse_settings_section.html');
     $iIndex = 0;
     // ** need for dividers ;
     if (isset($oObject->aMembersInfo[$sCurrentKey]['country'])) {
         $aCurrentArray =& $oObject->aMembersInfo[$sCurrentKey]['country'];
     } elseif ($oObject->aParameters['country']) {
         // ** if param `Country` was selected;
         // ** load data again;
         $aCurrentArray = $oObject->_getGlobalStatistics($oObject->aParameters['sex'], $oObject->aParameters['age'], null, $oObject->aAdditionalParameters['photos_only'], $oObject->aAdditionalParameters['online_only'], 'country');
     }
     // hide selected block ;
     if ($oObject->aParameters['country']) {
         $aCurrentArray['all'] = _t('_All');
         $sExtendedCss = 'hidden_block';
     }
     $iArrayCount = count($aCurrentArray);
     if (is_array($aCurrentArray) and !empty($aCurrentArray)) {
         foreach ($aCurrentArray as $sKey => $sValue) {
             $iDivider = $iIndex % 2;
             if ($sKey != 'all') {
                 $sValue = $sExtendedCss ? 0 : $sValue;
             }
             if ($sKey == 'all') {
                 $sCountrySection .= $oObject->genBrowseLink($sValue, null, $oObject->genLinkLocation('country', $sKey), 'post_featured.png');
             } else {
                 $sCountryName = strtolower($sKey);
                 $sImagePath = $site['flags'] . $sCountryName . '.gif';
                 $sCountrySection .= $oObject->genBrowseLink($sKey, $sValue, $oObject->genLinkLocation('country', $sCountryName), $sImagePath, false);
             }
             if ($iDivider) {
                 $sCountrySection .= '
                     <div class="clear_both"></div>
                 ';
             }
             $iIndex++;
             if ($iDivider and $iIndex >= 2 and $iArrayCount > 2 and $iIndex <= $iArrayCount - 1) {
                 $sCountrySection .= '
                     <div class="devider"></div>
                 ';
             }
         }
     }
     if (!$sCountrySection) {
         $sCountrySection = MsgBox(_t('_Empty'));
     }
     // fill array with template's keys ;
     $aTemplateKeys = array('section_id' => 'country_section', 'extended_css' => $sExtendedCss, 'section_data' => $sCountrySection);
     $sCountrySection = $GLOBALS['oSysTemplate']->parseHtmlByName($aUsedTemplates[0], $aTemplateKeys);
     // return builded template ;
     return $sCountrySection;
 }
 /**
  * Function will create new message;
  *
  * @param : $oObject (object)        - current created object;
  * @param  : $iRecipientId (integer) - recipient's Id ;
  * @param  : $sMessage (string)      - sender's message ;
  */
 function _addMessage(&$oObject, $iRecipientId, $sMessage)
 {
     $iRecipientId = (int) $iRecipientId;
     $sMessage = trim(strip_tags($sMessage));
     if ($iRecipientId && $sMessage && (getProfileInfo($iRecipientId) && $iRecipientId != $oObject->iLoggedMemberId)) {
         // write received message ;
         if (getProfileInfo($iRecipientId)) {
             // procces smiles;
             if ($oObject->aCoreSettings['procces_smiles']) {
                 $sMessage = $oObject->proccesSmiles($sMessage);
             }
             $oObject->_oDb->createMessage($oObject->iLoggedMemberId, $iRecipientId, $sMessage);
             // check save chat history ;
             if (!$oObject->aCoreSettings['save_chat_history']) {
                 $oObject->_oDb->deleteMessagesHistory($oObject->iLoggedMemberId, $iRecipientId, $oObject->aCoreSettings['number_visible_messages']);
             }
         }
     }
 }