function __construct($oMain, $iProfileId, $isRemovePhotoFieldAllowed = true, $iEntryId = 0, $iThumb = 0) { $this->_aMedia = array(); if (BxDolRequest::serviceExists('photos', 'perform_photo_upload', 'Uploader')) { $this->_aMedia['images'] = array('post' => 'ready_images', 'upload_func' => 'uploadPhotos', 'tag' => BX_STORE_PHOTOS_TAG, 'cat' => BX_STORE_PHOTOS_CAT, 'thumb' => 'thumb', 'module' => 'photos', 'title_upload_post' => 'images_titles', 'title_upload' => _t('_bx_store_form_caption_file_title'), 'service_method' => 'get_photo_array'); } if (BxDolRequest::serviceExists('videos', 'perform_video_upload', 'Uploader')) { $this->_aMedia['videos'] = array('post' => 'ready_videos', 'upload_func' => 'uploadVideos', 'tag' => BX_STORE_VIDEOS_TAG, 'cat' => BX_STORE_VIDEOS_CAT, 'thumb' => false, 'module' => 'videos', 'title_upload' => _t('_bx_store_form_caption_file_title'), 'service_method' => 'get_video_array'); } $this->_oMain = $oMain; $this->_oDb = $oMain->_oDb; bx_import('BxDolCategories'); $oCategories = new BxDolCategories(); $oCategories->getTagObjectConfig(); // generate templates for form custom elements $aCustomMediaTemplates = $this->generateCustomMediaTemplates($iProfileId, $iEntryId, $iThumb); // files $aFilesChoiceOrig = $this->_getFilesInEntry('files', 'get_file_array', 'ready_files', 'files', (int) $iProfileId, $iEntryId); $aFilesChoice = array(); $sCurrencySign = getParam('pmt_default_currency_sign'); foreach ($aFilesChoiceOrig as $k => $r) { if (!$r['checked']) { continue; } $a = $GLOBALS['oBxStoreModule']->_oDb->getFileInfo($iEntryId, $r['id']); $r['file_id'] = $a['id']; $r['title'] .= ' - ' . $sCurrencySign . ' ' . $a['price'] . ' (' . $GLOBALS['oBxStoreModule']->getGroupName($a['allow_purchase_to']) . ')'; $r['visibility'] = $a['hidden'] ? _t('_bx_store_product_file_hidden') : _t('_bx_store_product_file_visible'); $aFilesChoice[] = $r; } $aVarsFilesChoice = array('bx_store_base_url' => $this->_oMain->_oConfig->getBaseUri(), 'bx_if:empty' => array('condition' => empty($aFilesChoice), 'content' => array()), 'bx_repeat:files' => $aFilesChoice); $aInputPrivacyPurchase = $GLOBALS['oBxStoreModule']->_oPrivacyProduct->getGroupChooser($iProfileId, 'store', 'purchase'); foreach ($aInputPrivacyPurchase['values'] as $k => $r) { if ($r['key'] == BX_DOL_PG_ALL) { unset($aInputPrivacyPurchase['values'][$k]); break; } } require_once BX_DIRECTORY_PATH_INC . 'membership_levels.inc.php'; $aMemberships = getMemberships(); unset($aMemberships[MEMBERSHIP_ID_NON_MEMBER]); // unset Non-member unset($aMemberships[MEMBERSHIP_ID_STANDARD]); // unset member $aMemberships = array('' => '----') + $aMemberships; $aMembershipsValues = array(); foreach ($aMemberships as $k => $v) { $aMembershipsValues[] = array('key' => $k ? 'm' . $k : $k, 'value' => $v); } $aInputPrivacyPurchase['values'] = array_merge($aInputPrivacyPurchase['values'], $aMembershipsValues); /* if (empty($aInputPrivacyPurchase['value']) || !$aInputPrivacyPurchase['value']) $aInputPrivacyPurchase['value'] = BX_DOL_PG_MEMBERS; */ $sInputPrivacyPurchase = str_replace('name="allow_purchase_to"', 'name="allow_purchase_to[]"', $this->genInputSelect($aInputPrivacyPurchase)); $aVarsFilesUpload = array('file' => 'files', 'title' => 'files_titles', 'file_upload_title' => _t('_bx_store_form_caption_file_title'), 'bx_if:price' => array('condition' => true, 'content' => array('price' => 'files_prices', 'file_price_title' => _t('_bx_store_form_caption_file_price'))), 'bx_if:privacy' => array('condition' => true, 'content' => array('select' => $sInputPrivacyPurchase, 'file_permission_title' => _t('_bx_store_form_caption_file_allow_purcase_to')))); // privacy $aInputPrivacyCustom = array(); $aInputPrivacyCustom[] = array('key' => '', 'value' => '----'); $aInputPrivacyCustom[] = array('key' => 'c', 'value' => _t('_bx_store_privacy_customers_only')); $aInputPrivacyPostInForum = $GLOBALS['oBxStoreModule']->_oPrivacyProduct->getGroupChooser($iProfileId, 'store', 'post_in_forum'); $aInputPrivacyPostInForum['values'] = array_merge($aInputPrivacyPostInForum['values'], $aInputPrivacyCustom); $aInputPrivacyPostInForum['db'] = array('pass' => 'Preg', 'params' => array('/^([0-9c]+)$/')); $aInputPrivacyViewForum = $GLOBALS['oBxStoreModule']->_oPrivacyProduct->getGroupChooser($iProfileId, 'store', 'view_forum'); $aInputPrivacyViewForum['values'] = array_merge($aInputPrivacyViewForum['values'], $aInputPrivacyCustom); $aInputPrivacyViewForum['db'] = $aInputPrivacyPostInForum['db']; $aCustomForm = array('form_attrs' => array('name' => 'form_store', 'action' => '', 'method' => 'post', 'enctype' => 'multipart/form-data'), 'params' => array('db' => array('table' => 'bx_store_products', 'key' => 'id', 'uri' => 'uri', 'uri_title' => 'title', 'submit_name' => 'submit_form')), 'inputs' => array('header_info' => array('type' => 'block_header', 'caption' => _t('_bx_store_form_header_info')), 'title' => array('type' => 'text', 'name' => 'title', 'caption' => _t('_bx_store_form_caption_title'), 'required' => true, 'checker' => array('func' => 'length', 'params' => array(3, 100), 'error' => _t('_bx_store_form_err_title')), 'db' => array('pass' => 'Xss')), 'desc' => array('type' => 'textarea', 'name' => 'desc', 'caption' => _t('_bx_store_form_caption_desc'), 'required' => true, 'html' => 2, 'checker' => array('func' => 'length', 'params' => array(20, 64000), 'error' => _t('_bx_store_form_err_desc')), 'db' => array('pass' => 'XssHtml')), 'tags' => array('type' => 'text', 'name' => 'tags', 'caption' => _t('_Tags'), 'info' => _t('_sys_tags_note'), 'required' => true, 'checker' => array('func' => 'avail', 'error' => _t('_bx_store_form_err_tags')), 'db' => array('pass' => 'Tags')), 'categories' => $oCategories->getGroupChooser('bx_store', (int) $iProfileId, true), 'header_images' => array('type' => 'block_header', 'caption' => _t('_bx_store_form_header_images'), 'collapsable' => true, 'collapsed' => false), 'thumb' => array('type' => 'custom', 'content' => $aCustomMediaTemplates['images']['thumb_choice'], 'name' => 'thumb', 'caption' => _t('_bx_store_form_caption_thumb_choice'), 'info' => _t('_bx_store_form_info_thumb_choice'), 'required' => false, 'db' => array('pass' => 'Int')), 'images_choice' => array('type' => 'custom', 'content' => $aCustomMediaTemplates['images']['choice'], 'name' => 'images_choice[]', 'caption' => _t('_bx_store_form_caption_images_choice'), 'info' => _t('_bx_store_form_info_images_choice'), 'required' => false), 'images_upload' => array('type' => 'custom', 'content' => $aCustomMediaTemplates['images']['upload'], 'name' => 'images_upload[]', 'caption' => _t('_bx_store_form_caption_images_upload'), 'info' => _t('_bx_store_form_info_images_upload'), 'required' => false), 'header_videos' => array('type' => 'block_header', 'caption' => _t('_bx_store_form_header_videos'), 'collapsable' => true, 'collapsed' => false), 'videos_choice' => array('type' => 'custom', 'content' => $aCustomMediaTemplates['videos']['choice'], 'name' => 'videos_choice[]', 'caption' => _t('_bx_store_form_caption_videos_choice'), 'info' => _t('_bx_store_form_info_videos_choice'), 'required' => false), 'videos_upload' => array('type' => 'custom', 'content' => $aCustomMediaTemplates['videos']['upload'], 'name' => 'videos_upload[]', 'caption' => _t('_bx_store_form_caption_videos_upload'), 'info' => _t('_bx_store_form_info_videos_upload'), 'required' => false), 'header_files' => array('type' => 'block_header', 'caption' => _t('_bx_store_form_header_files'), 'collapsable' => true, 'collapsed' => false), 'files_choice' => array('type' => 'custom', 'content' => $aFilesChoice ? $GLOBALS['oBxStoreModule']->_oTemplate->parseHtmlByName('form_field_product_files_choice', $aVarsFilesChoice) : '', 'name' => 'files_choice[]', 'caption' => _t('_bx_store_form_caption_files_choice'), 'info' => _t('_bx_store_form_info_files_choice'), 'required' => false), 'files_upload' => array('type' => 'custom', 'content' => $GLOBALS['oBxStoreModule']->_oTemplate->parseHtmlByName('form_field_files_upload', $aVarsFilesUpload), 'name' => 'files_upload[]', 'caption' => _t('_bx_store_form_caption_files_upload'), 'info' => _t('_bx_store_form_info_files_upload'), 'required' => false), 'header_privacy' => array('type' => 'block_header', 'caption' => _t('_bx_store_form_header_privacy')), 'allow_view_product_to' => $GLOBALS['oBxStoreModule']->_oPrivacyProduct->getGroupChooser($iProfileId, 'store', 'view_product'), 'allow_post_in_forum_to' => $aInputPrivacyPostInForum, 'allow_view_forum_to' => $aInputPrivacyViewForum)); if (!$aCustomForm['inputs']['images_choice']['content']) { unset($aCustomForm['inputs']['thumb']); unset($aCustomForm['inputs']['images_choice']); } if (!$aCustomForm['inputs']['videos_choice']['content']) { unset($aCustomForm['inputs']['videos_choice']); } if (!$aFilesChoice) { unset($aCustomForm['inputs']['files_choice']); } if (!isset($this->_aMedia['images'])) { unset($aCustomForm['inputs']['header_images']); unset($aCustomForm['inputs']['PrimPhoto']); unset($aCustomForm['inputs']['images_choice']); unset($aCustomForm['inputs']['images_upload']); unset($aCustomForm['inputs']['allow_upload_photos_to']); } if (!isset($this->_aMedia['videos'])) { unset($aCustomForm['inputs']['header_videos']); unset($aCustomForm['inputs']['videos_choice']); unset($aCustomForm['inputs']['videos_upload']); unset($aCustomForm['inputs']['allow_upload_videos_to']); } $aFormInputsSubmit = array('Submit' => array('type' => 'submit', 'name' => 'submit_form', 'value' => _t('_Submit'))); $aCustomForm['inputs'] = array_merge($aCustomForm['inputs'], $aFormInputsSubmit); $this->processMembershipChecksForMediaUploads($aCustomForm['inputs']); parent::__construct($aCustomForm); }
function BxEventsFormAdd($oMain, $iProfileId, $iEntryId = 0, $iThumb = 0) { $this->_oMain = $oMain; $this->_oDb = $oMain->_oDb; $this->_aMedia = array('images' => array('post' => 'ready_images', 'upload_func' => 'uploadPhotos', 'tag' => BX_EVENTS_PHOTOS_TAG, 'cat' => BX_EVENTS_PHOTOS_CAT, 'thumb' => 'PrimPhoto', 'module' => 'photos', 'title_upload_post' => 'images_titles', 'title_upload' => _t('_bx_events_form_caption_file_title'), 'service_method' => 'get_photo_array'), 'videos' => array('post' => 'ready_videos', 'upload_func' => 'uploadVideos', 'tag' => BX_EVENTS_VIDEOS_TAG, 'cat' => BX_EVENTS_VIDEOS_CAT, 'thumb' => false, 'module' => 'videos', 'title_upload_post' => 'videos_titles', 'title_upload' => _t('_bx_events_form_caption_file_title'), 'service_method' => 'get_video_array'), 'sounds' => array('post' => 'ready_sounds', 'upload_func' => 'uploadSounds', 'tag' => BX_EVENTS_SOUNDS_TAG, 'cat' => BX_EVENTS_SOUNDS_CAT, 'thumb' => false, 'module' => 'sounds', 'title_upload_post' => 'sounds_titles', 'title_upload' => _t('_bx_events_form_caption_file_title'), 'service_method' => 'get_music_array'), 'files' => array('post' => 'ready_files', 'upload_func' => 'uploadFiles', 'tag' => BX_EVENTS_FILES_TAG, 'cat' => BX_EVENTS_FILES_CAT, 'thumb' => false, 'module' => 'files', 'title_upload_post' => 'files_titles', 'title_upload' => _t('_bx_events_form_caption_file_title'), 'service_method' => 'get_file_array')); bx_import('BxDolCategories'); $oCategories = new BxDolCategories(); $oCategories->getTagObjectConfig(); $oProfileFields = new BxDolProfileFields(0); $aCountries = $oProfileFields->convertValues4Input('#!Country'); asort($aCountries); // generate templates for form custom elements $aCustomMediaTemplates = $this->generateCustomMediaTemplates($this->_oMain->_iProfileId, $iEntryId, $iThumb); // privacy $aInputPrivacyCustom = array(); $aInputPrivacyCustom[] = array('key' => '', 'value' => '----'); $aInputPrivacyCustom[] = array('key' => 'p', 'value' => _t('_bx_events_privacy_participants_only')); $aInputPrivacyCustomPass = array('pass' => 'Preg', 'params' => array('/^([0-9p]+)$/')); $aInputPrivacyCustom2 = array(array('key' => 'p', 'value' => _t('_bx_events_privacy_participants')), array('key' => 'a', 'value' => _t('_bx_events_privacy_admins_only'))); $aInputPrivacyCustom2Pass = array('pass' => 'Preg', 'params' => array('/^([pa]+)$/')); $aInputPrivacyViewParticipants = $GLOBALS['oBxEventsModule']->_oPrivacy->getGroupChooser($iProfileId, 'events', 'view_participants'); $aInputPrivacyViewParticipants['values'] = array_merge($aInputPrivacyViewParticipants['values'], $aInputPrivacyCustom); $aInputPrivacyComment = $GLOBALS['oBxEventsModule']->_oPrivacy->getGroupChooser($iProfileId, 'events', 'comment'); $aInputPrivacyComment['values'] = array_merge($aInputPrivacyComment['values'], $aInputPrivacyCustom); $aInputPrivacyComment['db'] = $aInputPrivacyCustomPass; $aInputPrivacyRate = $GLOBALS['oBxEventsModule']->_oPrivacy->getGroupChooser($iProfileId, 'events', 'rate'); $aInputPrivacyRate['values'] = array_merge($aInputPrivacyRate['values'], $aInputPrivacyCustom); $aInputPrivacyRate['db'] = $aInputPrivacyCustomPass; $aInputPrivacyForum = $GLOBALS['oBxEventsModule']->_oPrivacy->getGroupChooser($iProfileId, 'events', 'post_in_forum'); $aInputPrivacyForum['values'] = array_merge($aInputPrivacyForum['values'], $aInputPrivacyCustom); $aInputPrivacyForum['db'] = $aInputPrivacyCustomPass; $aInputPrivacyUploadPhotos = $this->_oMain->_oPrivacy->getGroupChooser($iProfileId, 'events', 'upload_photos'); $aInputPrivacyUploadPhotos['values'] = $aInputPrivacyCustom2; $aInputPrivacyUploadPhotos['db'] = $aInputPrivacyCustom2Pass; $aInputPrivacyUploadVideos = $this->_oMain->_oPrivacy->getGroupChooser($iProfileId, 'events', 'upload_videos'); $aInputPrivacyUploadVideos['values'] = $aInputPrivacyCustom2; $aInputPrivacyUploadVideos['db'] = $aInputPrivacyCustom2Pass; $aInputPrivacyUploadSounds = $this->_oMain->_oPrivacy->getGroupChooser($iProfileId, 'events', 'upload_sounds'); $aInputPrivacyUploadSounds['values'] = $aInputPrivacyCustom2; $aInputPrivacyUploadSounds['db'] = $aInputPrivacyCustom2Pass; $aInputPrivacyUploadFiles = $this->_oMain->_oPrivacy->getGroupChooser($iProfileId, 'events', 'upload_files'); $aInputPrivacyUploadFiles['values'] = $aInputPrivacyCustom2; $aInputPrivacyUploadFiles['db'] = $aInputPrivacyCustom2Pass; $aCustomForm = array('form_attrs' => array('name' => 'form_events', 'action' => '', 'method' => 'post', 'enctype' => 'multipart/form-data'), 'params' => array('db' => array('table' => 'bx_events_main', 'key' => 'ID', 'uri' => 'EntryUri', 'uri_title' => 'Title', 'submit_name' => 'submit_form')), 'inputs' => array('header_info' => array('type' => 'block_header', 'caption' => _t('_bx_events_form_header_info')), 'Title' => array('type' => 'text', 'name' => 'Title', 'caption' => _t('_bx_events_caption_title'), 'required' => true, 'checker' => array('func' => 'length', 'params' => array(3, 100), 'error' => _t('_bx_events_err_title')), 'db' => array('pass' => 'Xss'), 'display' => true), 'Description' => array('type' => 'textarea', 'name' => 'Description', 'caption' => _t('_bx_events_caption_desc'), 'required' => true, 'html' => 2, 'checker' => array('func' => 'length', 'params' => array(20, 64000), 'error' => _t('_bx_events_err_desc')), 'db' => array('pass' => 'XssHtml')), 'Country' => array('type' => 'select', 'name' => 'Country', 'caption' => _t('_bx_events_caption_country'), 'values' => $aCountries, 'required' => true, 'checker' => array('func' => 'preg', 'params' => array('/^[a-zA-Z]{2}$/'), 'error' => _t('_bx_events_err_country')), 'db' => array('pass' => 'Preg', 'params' => array('/([a-zA-Z]{2})/'))), 'City' => array('type' => 'text', 'name' => 'City', 'caption' => _t('_bx_events_caption_city'), 'required' => true, 'checker' => array('func' => 'length', 'params' => array(3, 50), 'error' => _t('_bx_events_err_city')), 'db' => array('pass' => 'Xss')), 'Place' => array('type' => 'text', 'name' => 'Place', 'caption' => _t('_bx_events_caption_place'), 'required' => true, 'checker' => array('func' => 'avail', 'error' => _t('_bx_events_err_place')), 'db' => array('pass' => 'Xss'), 'display' => true), 'EventStart' => array('type' => 'datetime', 'name' => 'EventStart', 'caption' => _t('_bx_events_caption_event_start'), 'required' => true, 'checker' => array('func' => 'DateTime', 'error' => _t('_bx_events_err_event_start')), 'db' => array('pass' => 'DateTime'), 'display' => 'filterDate'), 'EventEnd' => array('type' => 'datetime', 'name' => 'EventEnd', 'caption' => _t('_bx_events_caption_event_end'), 'required' => true, 'checker' => array('func' => 'DateTime', 'error' => _t('_bx_events_err_event_end')), 'db' => array('pass' => 'DateTime'), 'display' => 'filterDate'), 'Tags' => array('type' => 'text', 'name' => 'Tags', 'caption' => _t('_Tags'), 'info' => _t('_sys_tags_note'), 'required' => true, 'checker' => array('func' => 'avail', 'error' => _t('_bx_events_err_tags')), 'db' => array('pass' => 'Tags')), 'Categories' => $oCategories->getGroupChooser('bx_events', (int) $iProfileId, true), 'header_images' => array('type' => 'block_header', 'caption' => _t('_bx_events_form_header_images'), 'collapsable' => true, 'collapsed' => false), 'PrimPhoto' => array('type' => 'custom', 'content' => $aCustomMediaTemplates['images']['thumb_choice'], 'name' => 'PrimPhoto', 'caption' => _t('_bx_events_form_caption_thumb_choice'), 'info' => _t('_bx_events_form_info_thumb_choice'), 'required' => false, 'db' => array('pass' => 'Int')), 'images_choice' => array('type' => 'custom', 'content' => $aCustomMediaTemplates['images']['choice'], 'name' => 'images_choice[]', 'caption' => _t('_bx_events_form_caption_images_choice'), 'info' => _t('_bx_events_form_info_images_choice'), 'required' => false), 'images_upload' => array('type' => 'custom', 'content' => $aCustomMediaTemplates['images']['upload'], 'name' => 'images_upload[]', 'caption' => _t('_bx_events_form_caption_images_upload'), 'info' => _t('_bx_events_form_info_images_upload'), 'required' => false), 'header_videos' => array('type' => 'block_header', 'caption' => _t('_bx_events_form_header_videos'), 'collapsable' => true, 'collapsed' => false), 'videos_choice' => array('type' => 'custom', 'content' => $aCustomMediaTemplates['videos']['choice'], 'name' => 'videos_choice[]', 'caption' => _t('_bx_events_form_caption_videos_choice'), 'info' => _t('_bx_events_form_info_videos_choice'), 'required' => false), 'videos_upload' => array('type' => 'custom', 'content' => $aCustomMediaTemplates['videos']['upload'], 'name' => 'videos_upload[]', 'caption' => _t('_bx_events_form_caption_videos_upload'), 'info' => _t('_bx_events_form_info_videos_upload'), 'required' => false), 'header_sounds' => array('type' => 'block_header', 'caption' => _t('_bx_events_form_header_sounds'), 'collapsable' => true, 'collapsed' => false), 'sounds_choice' => array('type' => 'custom', 'content' => $aCustomMediaTemplates['sounds']['choice'], 'name' => 'sounds_choice[]', 'caption' => _t('_bx_events_form_caption_sounds_choice'), 'info' => _t('_bx_events_form_info_sounds_choice'), 'required' => false), 'sounds_upload' => array('type' => 'custom', 'content' => $aCustomMediaTemplates['sounds']['upload'], 'name' => 'sounds_upload[]', 'caption' => _t('_bx_events_form_caption_sounds_upload'), 'info' => _t('_bx_events_form_info_sounds_upload'), 'required' => false), 'header_files' => array('type' => 'block_header', 'caption' => _t('_bx_events_form_header_files'), 'collapsable' => true, 'collapsed' => false), 'files_choice' => array('type' => 'custom', 'content' => $aCustomMediaTemplates['files']['choice'], 'name' => 'files_choice[]', 'caption' => _t('_bx_events_form_caption_files_choice'), 'info' => _t('_bx_events_form_info_files_choice'), 'required' => false), 'files_upload' => array('type' => 'custom', 'content' => $aCustomMediaTemplates['files']['upload'], 'name' => 'files_upload[]', 'caption' => _t('_bx_events_form_caption_files_upload'), 'info' => _t('_bx_events_form_info_files_upload'), 'required' => false), 'header_privacy' => array('type' => 'block_header', 'caption' => _t('_bx_events_form_header_privacy')), 'allow_view_event_to' => $GLOBALS['oBxEventsModule']->_oPrivacy->getGroupChooser($iProfileId, 'events', 'view_event'), 'allow_view_participants_to' => $aInputPrivacyViewParticipants, 'allow_comment_to' => $aInputPrivacyComment, 'allow_rate_to' => $aInputPrivacyRate, 'allow_post_in_forum_to' => $aInputPrivacyForum, 'allow_join_to' => $GLOBALS['oBxEventsModule']->_oPrivacy->getGroupChooser($iProfileId, 'events', 'join'), 'JoinConfirmation' => array('type' => 'select', 'name' => 'JoinConfirmation', 'caption' => _t('_bx_events_form_caption_join_confirmation'), 'info' => _t('_bx_events_form_info_join_confirmation'), 'values' => array(0 => _t('_bx_events_form_join_confirmation_disabled'), 1 => _t('_bx_events_form_join_confirmation_enabled')), 'checker' => array('func' => 'int', 'error' => _t('_bx_events_form_err_join_confirmation')), 'db' => array('pass' => 'Int')), 'allow_upload_photos_to' => $aInputPrivacyUploadPhotos, 'allow_upload_videos_to' => $aInputPrivacyUploadVideos, 'allow_upload_sounds_to' => $aInputPrivacyUploadSounds, 'allow_upload_files_to' => $aInputPrivacyUploadFiles)); if (!$aCustomForm['inputs']['images_choice']['content']) { unset($aCustomForm['inputs']['PrimPhoto']); unset($aCustomForm['inputs']['images_choice']); } if (!$aCustomForm['inputs']['videos_choice']['content']) { unset($aCustomForm['inputs']['videos_choice']); } if (!$aCustomForm['inputs']['sounds_choice']['content']) { unset($aCustomForm['inputs']['sounds_choice']); } if (!$aCustomForm['inputs']['files_choice']['content']) { unset($aCustomForm['inputs']['files_choice']); } $aFormInputsAdminPart = array(); if ($GLOBALS['oBxEventsModule']->isAdmin()) { require_once BX_DIRECTORY_PATH_INC . 'membership_levels.inc.php'; $aMemberships = getMemberships(); unset($aMemberships[MEMBERSHIP_ID_NON_MEMBER]); // unset Non-member $aMemberships = array('' => _t('_bx_events_membership_filter_none')) + $aMemberships; $aFormInputsAdminPart = array('EventMembershipFilter' => array('type' => 'select', 'name' => 'EventMembershipFilter', 'caption' => _t('_bx_events_caption_membership_filter'), 'info' => _t('_bx_events_info_membership_filter'), 'values' => $aMemberships, 'value' => '', 'checker' => array('func' => 'preg', 'params' => array('/^[0-9a-zA-Z]*$/'), 'error' => _t('_bx_events_err_membership_filter')), 'db' => array('pass' => 'Preg', 'params' => array('/([0-9a-zA-Z]*)/')))); } $aFormInputsSubmit = array('Submit' => array('type' => 'submit', 'name' => 'submit_form', 'value' => _t('_Submit'), 'colspan' => true)); $aCustomForm['inputs'] = array_merge($aCustomForm['inputs'], $aFormInputsAdminPart, $aFormInputsSubmit); $this->processMembershipChecksForMediaUploads($aCustomForm['inputs']); parent::BxDolFormMedia($aCustomForm); }
function getQueueMessage() { global $aPreValues; if ($_POST['msgs_id']) { $aSexValues = getFieldValues('Sex'); foreach ($aSexValues as $sKey => $sValue) { $aSexValues[$sKey] = _t($sValue); } $aAgeValues = array('all' => _t('_All'), 'selectively' => _t('_Selectively')); $aStartAgesOptions = array(); $aEndAgesOptions = array(); $gl_search_start_age = (int) getParam('search_start_age'); $gl_search_end_age = (int) getParam('search_end_age'); for ($i = $gl_search_start_age; $i <= $gl_search_end_age; $i++) { $aStartAgesOptions[$i] = $i; } for ($i = $gl_search_start_age; $i <= $gl_search_end_age; $i++) { $aEndAgesOptions[$i] = $i; } $aCountryOptions = array('all' => _t('_All')); foreach ($aPreValues['Country'] as $key => $value) { $aCountryOptions[$key] = _t($value['LKey']); } $aMembershipOptions = array('all' => _t('_All')); $memberships_arr = getMemberships(); foreach ($memberships_arr as $membershipID => $membershipName) { if ($membershipID == MEMBERSHIP_ID_NON_MEMBER) { continue; } $aMembershipOptions[$membershipID] = $membershipName; } $iRecipientMembers = (int) $GLOBALS['MySQL']->getOne("SELECT COUNT(`ID`) AS `count` FROM `Profiles` WHERE `Status`<>'Unconfirmed' AND `EmailNotify` = 1 LIMIT 1"); $aForm = array('form_attrs' => array('name' => 'form_queue', 'class' => 'form_queue_form', 'action' => $GLOBALS['site']['url_admin'] . 'notifies.php', 'method' => 'post'), 'inputs' => array('Send1' => array('type' => 'checkbox', 'name' => 'send_to_subscribers', 'label' => _t('_adm_mmail_Send_to_subscribers'), 'value' => 'non', 'checked' => true), 'Send2' => array('type' => 'checkbox', 'name' => 'send_to_members', 'label' => _t('_adm_mmail_Send_to_members'), 'value' => 'memb', 'checked' => true, 'attrs' => array('onClick' => 'setControlsState();'), 'info' => _t('_adm_mmail_Send_to_members_info', $iRecipientMembers)), 'sex' => array('type' => 'checkbox_set', 'name' => 'sex', 'values' => $aSexValues, 'value' => array_keys($aSexValues)), 'Age' => array('type' => 'select', 'name' => 'age', 'caption' => _t('_adm_mmail_Age'), 'value' => 'all', 'values' => $aAgeValues, 'attrs' => array('onClick' => 'setAgeState();')), 'StartAge' => array('type' => 'select', 'name' => 'age_start', 'caption' => _t('_from'), 'values' => $aStartAgesOptions, 'value' => $gl_search_start_age), 'EndAge' => array('type' => 'select', 'name' => 'age_end', 'caption' => _t('_to'), 'values' => $aEndAgesOptions, 'value' => $gl_search_end_age), 'Country' => array('type' => 'select', 'name' => 'country', 'caption' => _t('_Country'), 'values' => $aCountryOptions, 'value' => 'all'), 'Membership' => array('type' => 'select', 'name' => 'membership', 'caption' => _t('_adm_mmi_membership_levels'), 'values' => $aMembershipOptions, 'value' => 'all'), 'msgs_id' => array('type' => 'hidden', 'name' => 'msgs_id', 'value' => (int) $_POST['msgs_id']), 'submit' => array('type' => 'submit', 'name' => 'queue_message', 'value' => _t('_Submit')))); $oForm = new BxTemplFormView($aForm); $sTmplResult = $GLOBALS['oAdmTemplate']->parseHtmlByName('notifies_filter.html', array()); return DesignBoxContent(_t('_adm_mmail_Queue_message'), $oForm->getCode() . $sTmplResult, 11); } }
/** * purchase memberships */ function PageCompMemberships() { global $site; global $en_credits; global $doll; global $oTemplConfig; $expl_win_h = 400; //not global $purchasableOnly = true; $purchasableMemberships = getMemberships($purchasableOnly); $credit2money = (double) getParam('credit2money'); // how many credits for one money unit $ret = ''; foreach ($purchasableMemberships as $ID => $name) { ob_start(); ?> <div class="membership_line"> <form id="membership<?php echo $ID; ?> Form" action="<?php echo $site['url'] . 'checkout.php'; ?> " method="post" style="margin: 2px"> <input type="hidden" name="action" value="calculate" /> <input type="hidden" name="checkout_action" value="membership" /> <input type="hidden" name="allow_subscribe" value="on" /> <input type="hidden" name="data" value="<?php echo $ID; ?> " /> <table cellpadding="4" cellspacing="0" border="0" width="100%"> <tr> <td align="left"><?php echo htmlspecialchars($name); ?> </td> <td align="right"> <select class="no" name="amount" style="vertical-align: middle;"> <?php $prices = getMembershipPrices($ID); foreach ($prices as $days => $price) { $optionText = $days ? $days . ' ' . _t('_days') : _t('_Lifetime'); $optionText .= ' - ' . $doll . $price; if ($en_credits) { $optionText .= ' (' . sprintf('%.2f', $price * $credit2money) . ' ' . _t('_credits') . ')'; } echo "<option value=\"{$price}\">{$optionText}</option>\n"; } ?> </select> </td> <td align="right" width="110"> <input type="submit" class="no" value="<?php echo _t("_Check Out"); ?> " style="width: 100px; vertical-align: middle;" /> </td> <td align="right" width="60"> <a href="javascript:void(0);" onClick="javascript: window.open('explanation.php?explain=membership&type=<?php echo $ID; ?> ', '', 'width=<?php echo $oTemplConfig->popUpWindowWidth; ?> ,height=<?php echo $expl_win_h; ?> ,menubar=no,status=no,resizable=no,scrollbars=yes,toolbar=no, location=no' );"><?php echo _t("_Explanation"); ?> </a> </td> </tr> </table> </form> </div> <?php $ret .= ob_get_contents(); ob_end_clean(); } $ret = "<div class=\"memberships_box\">\n{$ret}\n</div>\n"; return DesignBoxContent(_t("_Membership NEW"), $ret, $oTemplConfig->PageCompMemberships_db_num); }
function __construct($aModule) { parent::__construct($aModule); $this->_aMemberships = getMemberships(); }
function BxPageACConfig($aModule) { parent::BxDolConfig($aModule); $this->_aMemberships = getMemberships(); }
function insertInput($aInput) { global $site; $sCode = ''; switch ($aInput['Type']) { case 'text': $sCode = '<input type="text" class="input_text" name="' . $aInput['Name'] . '" value="' . $this->value2html($aInput['Value']) . '" />'; break; case 'area': $sCode = ' <textarea class="input_area" name="' . $aInput['Name'] . '">' . $this->value2html($aInput['Value']) . '</textarea>'; break; case 'pass': $sCode = '<input type="password" class="input_pass" name="' . $aInput['Name'] . '" />'; break; case 'date': $sCode = '<input type="text" class="input_date" name="' . $aInput['Name'] . '" value="' . $this->value2html($aInput['Value']) . '" />'; break; case 'select_one': $this->insertSelectOne($aInput); break; case 'select_set': $this->insertSelectSet($aInput); break; case 'num': $sCode = '<input type="text" class="input_num" name="' . $aInput['Name'] . '" value="' . $this->value2html($aInput['Value']) . '" />'; break; case 'range': $sCode = '<input type="text" class="input_range_0" name="' . $aInput['Name'] . '[0]" value="' . $this->value2html($aInput['Value'][0]) . '" />'; $sCode .= ' - '; $sCode .= '<input type="text" class="input_range_1" name="' . $aInput['Name'] . '[1]" value="' . $this->value2html($aInput['Value'][1]) . '" />'; break; case 'bool': $sCode = ' <input type="checkbox" name="' . $aInput['Name'] . '" value="yes"' . ($aInput['Value'] ? ' checked="checked"' : '') . ' />'; break; case 'system': switch ($aInput['Name']) { case 'Couple': $sCode = '<select name="Couple" class="input_select_couple" onchange="doShowHideSecondProfile( this.value, this.form )">' . '<option value="no"' . ($aInput['Value'] ? '' : ' selected="selected"') . '>' . _t('_Single') . '</option>' . '<option value="yes"' . ($aInput['Value'] ? ' selected="selected"' : '') . '>' . _t('_Couple') . '</option>' . '</select>'; break; case 'Captcha': $sCode = '<img src="' . $site['url'] . 'simg/simg.php" class="form_captcha" /><br /><br /> <input type="text" class="input_text" maxlength="6" name="Captcha" />'; break; case 'Status': $this->insertSelectOne($aInput, false); break; case 'Featured': $aInput['Type'] = 'bool'; $this->insertInput($aInput); break; case 'TermsOfUse': $sCode = ' <input type="checkbox" name="TermsOfUse" value="yes" id="TermsOfUse_agree" /> <label for="TermsOfUse_agree"> ' . $aInput['Caption'] . ' </label>'; break; case 'Membership': $aMemberships = getMemberships(); $this->insertInputMembership($aMemberships, $aInput['Value']); break; default: $sCode = 'Unknown control type'; } break; default: $sCode = 'Unknown control type'; } $this->sCode .= $sCode; }
/** * Prints edit form for event editing * * @param bool $newEvent - if event already exists - then edit, create new otherwise * @param array $eventArr - if event exists then this parameter should contain all event data * * */ function SDShowEditForm($newEvent, $eventArr = array()) { global $aPreValues; global $dir; global $site; if ($newEvent) { $eventTitle = ''; $eventDesc = ''; $eventStatusActiveSel = ''; $eventStatusInactiveSel = ''; $eventStatusCanceledSel = ''; $eventStatusMsg = ''; $eventCity = ''; $eventPlace = ''; $eventStart = ''; $eventEnd = ''; $eventSaleStart = ''; $eventSaleEnd = ''; $eventRespName = ''; $eventRespEmail = ''; $eventRespPhone = ''; $eventSexFemale = 'checked="checked"'; $eventSexMale = 'checked="checked"'; $eventCountFemale = ''; $eventCountMale = ''; $eventPriceFemale = ''; $eventPriceMale = ''; $eventPriceFree = ''; $eventPriceFemaleDisabled = ''; $eventPriceMaleDisabled = ''; $eventChoosePeriod = ''; $eventAllowView = ''; } else { $eventTitle = htmlspecialchars($eventArr['Title']); $eventDesc = htmlspecialchars($eventArr['Description']); $eventStatusActiveSel = ''; $eventStatusInactiveSel = ''; $eventStatusCanceledSel = ''; switch ($eventArr['Status']) { case 'Active': $eventStatusActiveSel = 'selected="selected"'; break; case 'Inactive': $eventStatusInactiveSel = 'selected="selected"'; break; case 'Canceled': $eventStatusCanceledSel = 'selected="selected"'; break; } $eventStatusMsg = htmlspecialchars($eventArr['StatusMessage']); $eventCity = htmlspecialchars($eventArr['City']); $eventPlace = htmlspecialchars($eventArr['Place']); $eventStart = $eventArr['EventStart']; $eventEnd = $eventArr['EventEnd']; $eventSaleStart = $eventArr['TicketSaleStart']; $eventSaleEnd = $eventArr['TicketSaleEnd']; $eventRespName = htmlspecialchars($eventArr['ResponsibleName']); $eventRespEmail = htmlspecialchars($eventArr['ResponsibleEmail']); $eventRespPhone = htmlspecialchars($eventArr['ResponsiblePhone']); $eventSexFemale = strstr($eventArr['EventSexFilter'], 'female') ? 'checked="checked"' : ''; $eventSexMale = strstr($eventArr['EventSexFilter'], 'male') ? 'checked="checked"' : ''; $eventCountFemale = $eventArr['TicketCountFemale']; $eventCountMale = $eventArr['TicketCountMale']; $eventPriceFemale = sprintf("%.2f", (double) $eventArr['TicketPriceFemale']); $eventPriceMale = sprintf("%.2f", (double) $eventArr['TicketPriceMale']); $eventPriceFree = $eventPriceFemale == '0.00' && $eventPriceMale == '0.00' ? 'checked="checked"' : ''; $eventPriceFemaleDisabled = strlen($eventPriceFree) ? 'disabled="disabled"' : ''; $eventPriceMaleDisabled = strlen($eventPriceFree) ? 'disabled="disabled"' : ''; $eventChoosePeriod = $eventArr['ChoosePeriod']; $eventAllowView = $eventArr['AllowViewParticipants'] == 1 ? 'checked="checked"' : ''; } ?> <script language="JavaScript" type="text/javascript"> <!-- function trim(inputString) { if (typeof inputString != "string") { return inputString; } var retValue = inputString; // Check for spaces at the beginning of the string var ch = retValue.substring(0, 1); while (ch == " ") { retValue = retValue.substring(1, retValue.length); ch = retValue.substring(0, 1); } // Check for spaces at the end of the string ch = retValue.substring(retValue.length-1, retValue.length); while (ch == " ") { retValue = retValue.substring(0, retValue.length-1); ch = retValue.substring(retValue.length-1, retValue.length); } // Note that there are two spaces in the string - look for multiple spaces within the string while (retValue.indexOf(" ") != -1) { // Again, there are two spaces in each of the strings retValue = retValue.substring(0, retValue.indexOf(" ")) + retValue.substring(retValue.indexOf(" ")+1, retValue.length); } return retValue; } function validateEditForm() { // check title if ( trim(document.getElementById('event_title_id').value).length == 0 ) { alert('Please enter event title'); return false; } // check description if ( trim(document.getElementById('event_desc_id').value).length == 0 ) { alert('Please enter event description'); return false; } // check status message if ( trim(document.getElementById('event_statusmsg_id').value).length == 0 ) { alert('Please enter event status message'); return false; } // check city if ( trim(document.getElementById('event_city_id').value).length == 0 ) { alert('Please enter event city'); return false; } // check place if ( trim(document.getElementById('event_place_id').value).length == 0 ) { alert('Please enter event place'); return false; } // check start date if ( trim(document.getElementById('event_start_id').value).length == 0 ) { alert('Please enter event start date'); return false; } // check end date if ( trim(document.getElementById('event_end_id').value).length == 0 ) { alert('Please enter event end date'); return false; } // check sale start date if ( trim(document.getElementById('event_sale_start_id').value).length == 0 ) { alert('Please enter event sale start date'); return false; } // check sale end date if ( trim(document.getElementById('event_sale_end_id').value).length == 0 ) { alert('Please enter event sale end date'); return false; } // check if any of sex checkboxes checked if ( !document.getElementById('event_sex_female_id').checked && !document.getElementById('event_sex_male_id').checked ) { alert('At least one sex should be chosen'); return false; } // check if age range is correct var ageStart = parseInt( document.getElementById('event_age_start_id').value ); var ageEnd = parseInt( document.getElementById('event_age_end_id').value ); if ( isNaN(ageStart) || isNaN(ageEnd) || ageEnd < ageStart ) { alert('Please specify correct participants age range'); return false; } // check if any membership level selected var anySelected = false; var selectOptions = document.getElementById('event_membership_id').options; for ( i = 0; i < selectOptions.length; i++ ) { if ( selectOptions[i].selected ) { anySelected = true; break; } } if ( !anySelected ) { alert('Select membership level(s) of participants'); return false; } // check female ticket count if ( isNaN( parseInt(document.getElementById('event_count_female_id').value) ) ) { alert('Please enter correct female ticket count'); return false; } // check male ticket count if ( isNaN( parseInt(document.getElementById('event_count_male_id').value) ) ) { alert('Please enter correct male ticket count'); return false; } // check if event is free var isFree = document.getElementById('event_price_free_id').checked; // check female ticket price if ( !isFree && isNaN( parseFloat(document.getElementById('event_price_female_id').value) ) ) { alert('Please enter correct female ticket price'); return false; } // check male ticket price if ( !isFree && isNaN( parseFloat(document.getElementById('event_price_male_id').value) ) ) { alert('Please enter correct male ticket price'); return false; } // check choose period if ( isNaN( parseInt(document.getElementById('event_choose_period_id').value) ) ) { alert('Please enter correct choose period days'); return false; } return true; } function updatePriceControls() { var isFree = document.getElementById('event_price_free_id').checked; document.getElementById('event_price_female_id').disabled = isFree; document.getElementById('event_price_male_id').disabled = isFree; } --> </script> <form id="editEventForm" action="<?php echo $_SERVER['PHP_SELF']; ?> " method="post" enctype="multipart/form-data" style="margin: 0px;"> <table cellpadding="4" cellspacing="2" border="0" width="540" class="text"> <tr> <td class="section_header">Common</td> </tr> <tr> <td class="section_row"> <table cellpadding="4" cellspacing="0" border="0" class="text" width="100%"> <tr> <td align="left" width="120">Title <font color="red">*</font></td> <td align="left"> <input type="text" class="no" name="event_title" id="event_title_id" size="50" value="<?php echo $eventTitle; ?> " /> </td> </tr> <tr> <td align="left" width="120" valign="top">Description <font color="red">*</font></td> <td align="left"> <textarea class="no" name="event_desc" id="event_desc_id" cols="60" rows="10"><?php echo $eventDesc; ?> </textarea> </td> </tr> <tr> <td align="left" width="120">Status</td> <td align="left"> <select class="no" name="event_status" id="event_status_id" style="width: 100px;"> <option value="active" <?php echo $eventStatusActiveSel; ?> >Active</option> <option value="inactive" <?php echo $eventStatusInactiveSel; ?> >Inactive</option> <option value="canceled" <?php echo $eventStatusCanceledSel; ?> >Canceled</option> </select> </td> </tr> <tr> <td align="left" width="120">Status message <font color="red">*</font></td> <td align="left"> <input type="text" class="no" name="event_statusmsg" id="event_statusmsg_id" size="60" value="<?php echo $eventStatusMsg; ?> " /> </td> </tr> </table> </td> </tr> <tr> <td class="section_header">Event place</td> </tr> <tr> <td class="section_row"> <table cellpadding="4" cellspacing="0" border="0" class="text" width="100%"> <tr> <td align="left" width="120">Country <font color="red">*</font></td> <td align="left"> <select class="no" name="event_country" id="event_country_id"> <?php $selectedCountry = $newEvent ? getParam('default_country') : $eventArr['Country']; foreach ($aPreValues['Country'] as $key => $value) { echo "\n\t\t\t\t\t\t\t<option value=\"{$key}\" " . ($selectedCountry == $key ? 'selected="selected"' : '') . " >" . _t($value['LKey']) . "</option>"; } ?> </select> </td> </tr> <tr> <td align="left" width="120">City <font color="red">*</font></td> <td align="left"> <input type="text" class="no" name="event_city" id="event_city_id" size="24" value="<?php echo $eventCity; ?> " /> </td> </tr> <tr> <td align="left" width="120">Place <font color="red">*</font></td> <td align="left"> <input type="text" class="no" name="event_place" id="event_place_id" size="60" value="<?php echo $eventPlace; ?> " /> </td> </tr> <?php if (!$newEvent && strlen($eventArr['PhotoFilename']) && file_exists($dir['sdatingImage'] . $eventArr['PhotoFilename'])) { ?> <tr> <td align="left" valign="top" width="120">Venue photo</td> <td align="left"> <img src="<?php echo $site['sdatingImage'] . $eventArr['PhotoFilename']; ?> " border="0" alt="Event photo" /> </td> </tr> <tr> <td align="right" width="120" nowrap>upload new photo</td> <?php } else { ?> <tr> <td align="left" valign="middle" width="120">Venue photo</td> <?php } ?> <td align="left"> <input type="file" class="no" name="event_photo" id="event_photo_id" size="40" /> </td> </tr> <tr> <td align="right" width="120" nowrap>resize photo to</td> <td align="left"> <input type="text" class="no" name="event_photo_width" id="event_photo_width_id" size="4" value="200" style="vertical-align: middle;" /> x <input type="text" class="no" name="event_photo_height" id="event_photo_height_id" size="4" value="150" style="vertical-align: middle;" /> pixels </td> </tr> </table> </td> </tr> <tr> <td class="section_header">Event date</td> </tr> <tr> <td class="section_row"> <table cellpadding="4" cellspacing="0" border="0" class="text" width="100%"> <tr> <td align="left" width="120">Event start <font color="red">*</font></td> <td align="left"> <input type="text" class="no" name="event_start" id="event_start_id" size="20" value="<?php echo $eventStart; ?> " /> <input type="button" id="start_choose_id" value="Choose" /> <input type="button" id="start_clear_id" onClick="document.getElementById('event_start_id').value = ''; " value="Clear" /> </td> </tr> <tr> <td align="left" width="120">Event end <font color="red">*</font></td> <td align="left"> <input type="text" class="no" name="event_end" id="event_end_id" size="20" value="<?php echo $eventEnd; ?> " /> <input type="button" id="end_choose_id" value="Choose" /> <input type="button" id="end_clear_id" onClick="document.getElementById('event_end_id').value = ''; " value="Clear" /> </td> </tr> <tr> <td align="left" width="120">Ticket sale start <font color="red">*</font></td> <td align="left"> <input type="text" class="no" name="event_sale_start" id="event_sale_start_id" size="20" value="<?php echo $eventSaleStart; ?> " /> <input type="button" id="sale_start_choose_id" value="Choose" /> <input type="button" id="sale_start_clear_id" onClick="document.getElementById('event_sale_start_id').value = ''; " value="Clear" /> </td> </tr> <tr> <td align="left" width="120">Ticket sale end <font color="red">*</font></td> <td align="left"> <input type="text" class="no" name="event_sale_end" id="event_sale_end_id" size="20" value="<?php echo $eventSaleEnd; ?> " /> <input type="button" id="sale_end_choose_id" value="Choose" /> <input type="button" id="sale_end_clear_id" onClick="document.getElementById('event_sale_end_id').value = ''; " value="Clear" /> </td> </tr> </table> </td> </tr> <tr> <td class="section_header">Responsible person or company</td> </tr> <tr> <td class="section_row"> <table cellpadding="4" cellspacing="0" border="0" class="text" width="100%"> <tr> <td align="left" width="120">Name</td> <td align="left"> <input type="text" class="no" name="event_resp_name" id="event_resp_name_id" size="40" value="<?php echo $eventRespName; ?> " /> </td> </tr> <tr> <td align="left" width="120">E-mail</td> <td align="left"> <input type="text" class="no" name="event_resp_email" id="event_resp_email_id" size="40" value="<?php echo $eventRespEmail; ?> " /> </td> </tr> <tr> <td align="left" width="120">Phone</td> <td align="left"> <input type="text" class="no" name="event_resp_phone" id="event_resp_phone_id" size="16" value="<?php echo $eventRespPhone; ?> " /> </td> </tr> </table> </td> </tr> <tr> <td class="section_header">Event participants</td> </tr> <tr> <td class="section_row"> <table cellpadding="4" cellspacing="0" border="0" class="text" width="100%"> <tr> <td align="left" width="120">Sex</td> <td align="left"> <input type="checkbox" class="no" name="event_sex_female" id="event_sex_female_id" style="vertical-align: middle;" <?php echo $eventSexFemale; ?> /> <label for="event_sex_female_id">female</label> <input type="checkbox" class="no" name="event_sex_male" id="event_sex_male_id" style="vertical-align: middle;" <?php echo $eventSexMale; ?> /> <label for="event_sex_male_id">male</label> </td> </tr> <tr> <td align="left" width="120">Age</td> <td align="left"> from <select class="no" name="event_age_start" id="event_age_start_id" style="vertical-align: middle;"> <?php // if it's new event then show default values and show values from database otherwise $gl_search_start_age = (int) getParam('search_start_age'); $gl_search_end_age = (int) getParam('search_end_age'); $ageStartSel = $newEvent ? $gl_search_start_age : $eventArr['EventAgeLowerFilter']; $ageEndSel = $newEvent ? $gl_search_end_age : $eventArr['EventAgeUpperFilter']; for ($i = $gl_search_start_age; $i <= $gl_search_end_age; $i++) { $sel = $i == $ageStartSel ? 'selected="selected"' : ''; echo "\n\t\t\t\t\t\t\t<option value=\"{$i}\" {$sel}>{$i}</option>"; } ?> </select> to <select class="no" name="event_age_end" id="event_age_end_id" style="vertical-align: middle;"> <?php for ($i = $gl_search_start_age; $i <= $gl_search_end_age; $i++) { $sel = $i == $ageEndSel ? 'selected="selected"' : ''; echo "\n\t\t\t\t\t\t\t<option value=\"{$i}\" {$sel}>{$i}</option>"; } ?> </select> </td> </tr> <tr> <td align="left" valign="top" width="120">Membership</td> <td align="left"> <select class="no" name="event_membership[]" id="event_membership_id" size="6" multiple style="width: 150px;"> <option value="all" <?php echo $newEvent || strstr($eventArr['EventMembershipFilter'], '\'all\'') ? 'selected="selected"' : ''; ?> >All</option> <?php // show all membership levels except non-member $memberships_arr = getMemberships(); foreach ($memberships_arr as $membershipID => $membershipName) { if ($membershipID == MEMBERSHIP_ID_NON_MEMBER) { continue; } echo "\n\t\t\t\t\t\t\t<option value=\"{$membershipID}\" " . (!$newEvent && strstr($eventArr['EventMembershipFilter'], "'{$membershipID}'") ? 'selected="selected"' : '') . " >{$membershipName}</option>"; } ?> </select> </td> </tr> <tr> <td align="left" width="120">Female ticket count <font color="red">*</font></td> <td align="left"> <input type="text" class="no" name="event_count_female" id="event_count_female_id" size="6" value="<?php echo $eventCountFemale; ?> " /> </td> </tr> <tr> <td align="left" width="120">Male ticket count <font color="red">*</font></td> <td align="left"> <input type="text" class="no" name="event_count_male" id="event_count_male_id" size="6" value="<?php echo $eventCountMale; ?> " /> </td> </tr> </table> </td> </tr> <tr> <td class="section_header">Ticket prices</td> </tr> <tr> <td class="section_row"> <table cellpadding="4" cellspacing="0" border="0" class="text" width="100%"> <tr> <td align="left" width="120">Event is free</td> <td align="left"> <input type="checkbox" class="no" name="event_price_free" id="event_price_free_id" style="vertical-align: middle;" onClick="javascript: updatePriceControls();" <?php echo $eventPriceFree; ?> /> </td> </tr> <tr> <td align="left" width="120">Female ticket price <font color="red">*</font></td> <td align="left"> <input type="text" class="no" name="event_price_female" id="event_price_female_id" size="8" value="<?php echo $eventPriceFemale; ?> " <?php echo $eventPriceFemaleDisabled; ?> /> </td> </tr> <tr> <td align="left" width="120">Male ticket price <font color="red">*</font></td> <td align="left"> <input type="text" class="no" name="event_price_male" id="event_price_male_id" size="8" value="<?php echo $eventPriceMale; ?> " <?php echo $eventPriceMaleDisabled; ?> /> </td> </tr> </table> </td> </tr> <tr> <td class="section_header">Member side options</td> </tr> <tr> <td class="section_row"> <table cellpadding="4" cellspacing="0" border="0" class="text" width="100%"> <tr> <td align="left" width="120">Choose period <font color="red">*</font><br />(in days)</td> <td align="left"> <input type="text" class="no" name="event_choose_period" id="event_choose_period_id" size="6" value="<?php echo $eventChoosePeriod; ?> " /> </td> </tr> <tr> <td align="left" width="120">Allow members to view participants list</td> <td align="left"> <input type="checkbox" class="no" name="event_allow_view" id="event_allow_view_id" <?php echo $eventAllowView; ?> /> </td> </tr> </table> </td> </tr> <tr> <td align="center" valign="middle" style="padding-top: 8px;"> <input type="submit" class="no" name="event_save" value="Save" style="width: 60px; vertical-align: middle;" onClick="javascript: return validateEditForm();" /> <?php if (!$newEvent) { ?> <input type="checkbox" class="no" name="event_as_new" id="event_as_new_id" style="vertical-align: middle;" /> <label for="event_as_new_id">as new</label> <input type="hidden" name="event_id" value="<?php echo $eventArr['ID']; ?> " /> <input type="hidden" name="action" value="edit" /> <?php } else { ?> <input type="hidden" name="action" value="new" /> <?php } ?> </td> </tr> </table> </form> <?php }
<?php foreach ($prof['countries'] as $key => $value) { echo "\n\t\t\t\t\t\t\t<option value=\"{$key}\">" . _t('__' . $value) . "</option>"; } ?> </select> </td> </tr> <tr class="table"> <td align="right" valign="middle">Membership level:</td> <td width="12"></td> <td align="left" valign="middle"> <select class="text" name="membership"> <option value="all" selected>All</option> <?php $memberships_arr = getMemberships(); foreach ($memberships_arr as $membershipID => $membershipName) { if ($membershipID == MEMBERSHIP_ID_NON_MEMBER) { continue; } echo "\n\t\t\t\t\t\t\t<option value=\"{$membershipID}\">{$membershipName}</option>"; } ?> </select> </td> </tr> </table> </td> </tr> <tr class="table"> <td align="center" style="padding: 5px;">
/** * page code function */ function PageCompPageMainCode() { global $site; global $dir; global $_page; global $p_arr; global $p_arr_new; global $db_vsbl; global $db_editbl; global $tab; global $autoApproval_ifProfile; global $ID; global $MEMBER; global $ADMIN; global $NEW_TO_ADD; global $Featured; global $pic; global $pics; global $pic_num; global $enable_audio_upload; global $enable_video_upload; global $sound_file_exist; global $video_file_exist; global $status_admin_ex; global $change_error_text; global $result_text; global $pictures_text; global $membership_message; global $max_thumb_height; global $max_thumb_width; global $enable_ray; global $enable_ray_pro; ob_start(); if ($NEW_TO_ADD) { $_page['header'] = _t("_New Member"); $_page['header_text'] = _t("_New Member Add Here"); } else { $_page['header'] = process_line_output($p_arr['NickName']) . ": " . process_line_output(strmaxtextlen($p_arr['DescriptionMe'], 45)); $_page['header_text'] = "<b>" . process_line_output($p_arr['NickName']) . "</b> - "; $_page['header_text'] .= _t('_' . $p_arr['Sex']); $_page['header_text'] .= ", " . _t("_y/o", age($p_arr['DateOfBirth'])) . " (ID: {$p_arr['ID']})"; } echo '<table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td>'; if ($ADMIN && $status_admin_ex) { echo $status_admin_ex; } if ($change_error_text) { echo $change_error_text . '<br />'; } global $moderator; if ($ADMIN && !$moderator) { echo "<div align=right class=text2><a href=\"{$_SERVER['PHP_SELF']}\">" . _t("_Add New Profile") . "</a></div>"; } if ($result_text) { echo '<center>' . $result_text . '</center><br />'; } if ($ADMIN && !$NEW_TO_ADD && $enable_video_upload && $enable_ray && $enable_ray_pro && file_exists($dir['root'] . "ray/modules/video/admin.php")) { $sRayHeaderPath = $dir['root'] . "ray/inc/header.inc.php"; $iId = (int) $p_arr['ID']; $aAdmin = db_arr("SELECT `Name`, `Password` FROM `Admins` LIMIT 1"); $sNick = $aAdmin['Name']; $sPassword = $aAdmin['Password']; echo "<tr><td><div style=\"width:179px; padding-bottom:10px; margin-left:auto; margin-right:auto;\">"; require_once $dir['root'] . "ray/modules/video/admin.php"; echo "</div></td></tr>"; } if ($ADMIN && !$NEW_TO_ADD) { // Print membership information and controls $memberships_arr = getMemberships(); $membership_info = getMemberMembershipInfo($ID); ?> <!-- MEMBERSHIP [BEGIN] --> <tr><td> <center><?php echo $membership_message; ?> </center> <form name="MembershipForm" action="profile_edit.php?ID=<?php echo $p_arr['ID']; ?> " method=post> <input type="hidden" name="SetMembership" value="YES"> <table width=100% cellspacing=0 cellpadding=2 class="text2" border=0> <?php echo print_rows_set_membership(1, $memberships_arr, $membership_info, 3, "table", "panel", "25%"); ?> </table> <center> <input class=no type="submit" value="Set" style="width: 50px;"> </center> </form> <hr> </td></tr> <!-- MEMBERSHIP [ END ] --> <?php } ?> <form name="jform" method="post" action="profile_edit.php?ID=<?php echo $p_arr['ID']; ?> "> <?php if ($NEW_TO_ADD) { ?> <input type="hidden" name="NewProfile" value="YES" /> <?php } ?> <input type="hidden" name="SaveChanges" value="YES" /> <?php if ($ADMIN) { ?> <table cellspacing="0" cellpadding="0" class="small2" align="center"> <tr> <td align="right" width="75%"><?php echo _t("_Mark as Featured"); ?> </td> <td align="left" width="25%"> <input type="checkbox" name="Featured" <?php if ($Featured) { echo 'checked="checked"'; } ?> > </td> </tr> </table> <?php } ?> <table border="0" cellspacing="0" cellpadding="0" width="100%"> <tr> <td valign="top"> <table border="0" cellspacing="1" cellpadding="0" width="100%"> <tr><td align="center" valign="middle"> <?php if ($NEW_TO_ADD) { echo _t("_New Member") . '<br /><br />'; } else { ?> <table border="0" cellspacing="0" cellpadding="0" width="250"> <tr> <td align="center" valign="middle" style="position:relative; display:block;width:112px;"> <?php echo get_member_thumbnail($p_arr['ID'], 'none'); ?> </td> <td> <?php $yes_ph = 0; require_once BX_DIRECTORY_PATH_ROOT . 'profilePhotos.php'; $oPhoto = new ProfilePhotos($p_arr['ID']); $oPhoto->getMediaArray(); $yes_ph = $oPhoto->iMediaCount; if ($yes_ph) { ?> <a href="<?php echo $site['url']; ?> photos_gallery.php?ID=<?php echo $p_arr['ID']; ?> " ><?php echo _t("_More Photos"); ?> </a><br /> <?php } if (!$MEMBER) { echo "<div class=small2>" . _t("_Last logged in") . ": "; if (!$p_arr['LastLoggedIn'] || $p_arr['LastLoggedIn'] == "0000-00-00 00:00:00") { echo _t("_never"); } else { echo $p_arr['LastLoggedIn']; } echo "</div>"; } else { echo _t("_Profile status"); ?> : <b><font class=prof_stat_<?php echo $p_arr['Status']; ?> > <?php echo _t("_" . $p_arr['Status']); ?> </font></b><br /> <?php if ($MEMBER) { switch ($p_arr['Status']) { case 'Active': echo '<a href="change_status.php">' . _t("_Suspend account") . '</a><br />'; break; case 'Suspended': echo '<a href="change_status.php">' . _t("_Activate account") . '</a><br />'; break; } } } ?> </td></tr> </table> <?php } ?> </td> <td valign="top" align="center" width="100%"> <?php $free_mode = getParam("free_mode") == "on" ? 1 : 0; ?> </td> </table> </td></tr> <tr><td> <table class="profile_edit_table"><!-- Profile edit page --> <?php $first_row = 1; $rd = !($ADMIN || $MEMBER); $columns = 2; $respd = db_res("SELECT *, (`editable` & {$db_editbl}) AS `is_editable` FROM `ProfilesDesc` WHERE `visible` & {$db_vsbl} AND ( FIND_IN_SET('0', `show_on_page`) OR FIND_IN_SET('" . (int) $_page['name_index'] . "', show_on_page)) ORDER BY `order` ASC"); while ($arrpd = mysql_fetch_array($respd)) { $fname = get_input_name($arrpd); if ($arrpd['get_value'] && $arrpd['to_db'] == 0) { $funcbody = $arrpd['get_value']; $func = create_function('$arg0', $funcbody); $p_arr[$fname] = $func($p_arr_new); } if ($arrpd['is_editable'] && isset($p_arr_new[$fname])) { $p_arr[$fname] = $p_arr_new[$fname]; } $not_first_row = 0; $read_only = !$arrpd['is_editable']; switch ($arrpd['type']) { case 'set': // set of checkboxes echo print_row_set($first_row, $arrpd, $p_arr[$fname], "table", $rd, $columns, "", $read_only); break; case 'rb': // radio buttons echo print_row_radio_button($first_row, $arrpd, $p_arr[$fname], "table", $rd, $columns, "", $read_only); break; case 'r': // reference to array for combo box if ($fname == 'Country') { $onchange = "flagImage = document.getElementById('flagImageId'); flagImage.src = '{$site['flags']}' + this.value.toLowerCase() + '.gif';"; if (strlen($p_arr[$fname]) == 0) { $p_arr[$fname] = getParam('default_country'); } $imagecode = '<img id="flagImageId" src="' . ($site['flags'] . strtolower($p_arr[$fname])) . '.gif" alt="flag" />'; } else { $onchange = ''; $imagecode = ''; } echo print_row_ref($first_row, $arrpd, $p_arr[$fname], "table", $rd, $columns, "", $read_only, $onchange, $imagecode); break; case '0': // divider echo print_row_delim($first_row, $arrpd, "panel", $columns); $not_first_row = 1; $first_row = 1; break; case 'e': // enum combo box. if field name is 'Sex', than this is simple text, user can not change it echo print_row_enum($first_row, $arrpd, $p_arr[$fname], "table", $javascript, $rd, $columns, "", $read_only); break; case 'en': // enum combo box with numbers echo print_row_enum_n($first_row, $arrpd, $p_arr[$fname], "table", $rd, $columns, "", $read_only); break; case 'eny': // enum combo box with years echo print_row_enum_years($first_row, $arrpd, $p_arr[$fname], "table", $rd, $columns, "", $read_only); break; case 'a': // text Area echo print_row_area($first_row, $arrpd, $p_arr[$fname], "table", $rd, $columns, "", $read_only); break; case 'c': // input box echo print_row_edit($first_row, $arrpd, $p_arr[$fname], "table", $rd, $columns, "", $read_only); break; case 'date': // date echo print_row_date($first_row, $arrpd, $p_arr[$fname], "table", $rd, $columns, "", $read_only); break; case 'p': // input box password echo print_row_pwd($first_row, $arrpd, '', "table", $rd, $columns, "", $read_only); break; default: $not_first_row = 1; } if (!$not_first_row && $first_row == 1) { $first_row = 0; } } ?> </table> </td></tr> </table> <br /> <?php if (!!($ADMIN || $MEMBER)) { ?> <center><input type="submit" value="<?php echo _t("_Save Changes"); ?> " /></center> </form> <br /> <?php if ($MEMBER && !$NEW_TO_ADD) { if (!$autoApproval_ifProfile) { attention(_t("_PROFILE_WARNING1", $site['title'])); } attention(_t("_PROFILE_WARNING2", $site['title'])); } } echo "</td></tr></table>"; $ret = ob_get_clean(); return $ret; }
function getBlockCode_Membership() { if (!isAdmin()) { return; } $sUnlimited = process_line_output(_t('_pfm_unlimited')); $this->aFormMembership = array('form_attrs' => array('id' => 'profile_edit_membership', 'name' => 'profile_edit_membership', 'action' => BX_DOL_URL_ROOT . 'pedit.php?ID=' . $this->iProfileID, 'method' => 'post', 'enctype' => 'multipart/form-data'), 'params' => array('db' => array('table' => '', 'key' => '', 'uri' => '', 'uri_title' => '', 'submit_name' => 'save_membership')), 'inputs' => array('doSetMembership' => array('type' => 'hidden', 'name' => 'doSetMembership', 'value' => 'yes'), 'MembershipInfo' => array('type' => 'custom', 'caption' => _t('_Membership_current'), 'content' => ''), 'MembershipID' => array('type' => 'select', 'name' => 'MembershipID', 'caption' => _t('_Membership_name'), 'value' => '', 'values' => array(), 'required' => 0, 'attrs' => array('onchange' => 'checkStandard()'), 'checker' => array('func' => 'avail', 'params' => array(), 'error' => _t('_Membership_name_err_empty')), 'db' => array('pass' => 'Int')), 'MembershipDays' => array('type' => 'text', 'name' => 'MembershipDays', 'caption' => _t('_Membership_days'), 'value' => $sUnlimited, 'required' => 0, 'attrs' => array('onfocus' => "if(MembershipDays.value == '" . $sUnlimited . "') MembershipDays.value = ''", 'onblur' => "if(MembershipDays.value == '') MembershipDays.value = '" . $sUnlimited . "'"), 'info' => _t('_Membership_days_info'), 'db' => array('pass' => 'Xss')), 'MembershipImmediately' => array('type' => 'checkbox', 'name' => 'MembershipImmediately', 'caption' => _t('_Membership_starts'), 'value' => 'on', 'required' => 0, 'db' => array('pass' => 'Xss')), 'save_membership' => array('type' => 'submit', 'name' => 'save_membership', 'value' => _t('_Membership_save')))); $aMemberships = getMemberships(); foreach ($aMemberships as $iId => $sName) { if ($iId != MEMBERSHIP_ID_NON_MEMBER) { $this->aFormMembership['inputs']['MembershipID']['values'][] = array('key' => $iId, 'value' => $sName); } } $oForm = new BxTemplFormView($this->aFormMembership); $oForm->initChecker(); $sContent = ""; if ($oForm->isSubmittedAndValid()) { $iMshipID = (int) $oForm->getCleanValue('MembershipID'); $iMshipDays = (int) $oForm->getCleanValue('MembershipDays'); //0 = unlim $bStartsNow = $oForm->getCleanValue('MembershipImmediately') == 'on'; $bSave = setMembership($this->iProfileID, $iMshipID, $iMshipDays, $bStartsNow); $sContent .= MsgBox(_t($bSave ? '_Membership_save_msg_saved' : '_Membership_save_err_saved'), 3); } /** * Retrieve current membership info. */ $aMembershipCurrent = getMemberMembershipInfo($this->iProfileID); $sMembershipCurrent = $aMembershipCurrent['Name']; if ($aMembershipCurrent['ID'] != MEMBERSHIP_ID_STANDARD) { $sMembershipCurrent .= ', ' . (!isset($aMembershipCurrent['DateExpires']) ? _t('_MEMBERSHIP_EXPIRES_NEVER') : _t('_MEMBERSHIP_EXPIRES', defineTimeInterval($aMembershipCurrent['DateExpires']))); } $oForm->aInputs['MembershipInfo']['content'] = $sMembershipCurrent; ob_start(); ?> <script type="text/javascript"> <!-- function checkStandard() { var iId = parseInt($("[name='MembershipID']").val()); if(iId == <?php echo MEMBERSHIP_ID_STANDARD; ?> ) { $("[name='MembershipDays']").attr('disabled', 'disabled'); $("[name='MembershipImmediately']").attr('disabled', 'disabled'); } else { $("[name='MembershipDays']").removeAttr('disabled'); $("[name='MembershipImmediately']").removeAttr('disabled'); } } $(document).ready(function() { checkStandard(); }); --> </script> <?php $sContent .= ob_get_clean(); return array($sContent . $oForm->getCode(), array(), array(), false); }
function convertValues4Input($mValues, $sUseLKey = 'LKey', $sName = '', $aItem = array(), $sValue = '') { $aValues = array(); if (db_value("SHOW TABLES LIKE '{$mValues[0]}'") && $sName && $mValues[0] != 'ml_clonetwo_fields') { switch ($mValues[0]) { case 'sys_acl_levels': require_once BX_DIRECTORY_PATH_INC . 'membership_levels.inc.php'; $aMemberships = getMemberships(); unset($aMemberships[MEMBERSHIP_ID_NON_MEMBER]); $aValues = array('' => _t('_ml_clonetwo_membership_filter_none')) + $aMemberships; $aAllValues['values'] = $aValues; return $aAllValues; break; case 'sys_categories': bx_import('BxDolCategories'); $oCategories = new BxDolCategories(); $aValues = $oCategories->getGroupChooser('ml_clonetwo', getLoggedId(), true, $sValue); $aValues = $aValues['values']; $aAllValues['values'] = $aValues; return $aAllValues; break; case 'sys_privacy_actions': $aInputPrivacyCustom = array(); $aInputPrivacyCustom[] = array('key' => '', 'value' => '----'); $aInputPrivacyCustom[] = array('key' => 'f', 'value' => _t('_ml_clonetwo_privacy_fans_only')); $sName = str_replace('allow_', '', $sName); $sName = str_replace('_to', '', $sName); $aPValues = $this->_oMain->_oPrivacy->getGroupChooser(getLoggedId(), $this->_aModule['uri'], $sName); //print_r($aPValues['values']); foreach ($aPValues['values'] as $sKey => $aPValue) { $aValues[] = array('key' => $aPValue['key'], 'value' => $aPValue['value']); } if ($sName == 'upload_files' || $sName == 'upload_photos' || $sName == 'upload_videos' || $sName == 'upload_sounds') { $aValues = array(array('key' => 'f', 'value' => _t('_ml_clonetwo_privacy_fans')), array('key' => 'a', 'value' => _t('_ml_clonetwo_privacy_admins_only'))); } else { $aValues = array_merge($aValues, $aInputPrivacyCustom); } break; default: if ($aItem['IdField'] && $aItem['CaptionField']) { if ($aItem['DepParentField'] && !$aItem['DepField']) { $sValue = $sValue ? $sValue : $aItem['Default']; if (!$sValue) { $sValue = db_value("SELECT `Default` FROM `ml_clonetwo_fields` WHERE `Name` = '{$sName}' LIMIT 1"); } if ($sValue) { $iParentId = db_value("SELECT `{$aItem['DepParentField']}` FROM `{$mValues[0]}` WHERE `{$aItem['IdField']}` = '{$sValue}' LIMIT 1"); if ($iParentId) { $sAddQuery = "WHERE `{$aItem['DepParentField']}` = '{$iParentId}'"; } else { $sAddQuery = "WHERE `{$aItem['DepParentField']}` = '{$sValue}'"; } } $aAllValues['attrs'] = array('id' => "{$sName}"); } elseif ($aItem['DepParentField'] && $aItem['DepField']) { $sAddQuery = "WHERE `{$aItem['DepParentField']}` = '0'"; } $sQuery = db_res("SELECT `{$aItem['IdField']}` as `key`, `{$aItem['CaptionField']}` as `value` FROM `{$mValues[0]}` {$sAddQuery}"); while ($aRow = mysql_fetch_array($sQuery)) { $aValues[$aRow['key']] = $aRow['value']; } if ($aItem['DepField']) { $aDepData = db_arr("SELECT `IdField`, `CaptionField`, `DepParentField` FROM `ml_clonetwo_fields` WHERE `Name` = '{$aItem['DepField']}' LIMIT 1"); if (empty($aDepData)) { return; } $sAjaxUrl = BX_DOL_URL_ROOT . "modules/modloaded/clonetwo/pages.php?ajax=1&key={$aDepData['IdField']}&value={$aDepData['CaptionField']}&table={$mValues[0]}&parent={$aDepData['DepParentField']}&filter="; $aAllValues['attrs'] = array('onchange' => "getHtmlData('{$aItem['DepField']}','{$sAjaxUrl}'+this.value)"); } $aAllValues['values'] = $aValues; return $aAllValues; } } } elseif (is_array($mValues)) { foreach ($mValues as $sKey) { $aValues[$sKey] = _t('_FieldValues_' . $sKey); } } elseif (is_string($mValues) and !empty($mValues) and substr($mValues, 0, 2) == $this->sLinkPref) { $sKey = substr($mValues, 2); if (isset($GLOBALS['aPreValues'][$sKey])) { $aPValues = $GLOBALS['aPreValues'][$sKey]; foreach ($aPValues as $sKey => $aPValue) { if (!isset($aPValue[$sUseLKey])) { $sUseLKey = 'LKey'; } $aValues[$sKey] = _t($aPValue[$sUseLKey]); } } } //echoDbg($aValues); return $aValues; }
/** * Display controls for editing category settings. * The enclosing form must be defined outside of the function, this is done to be able * to display controls for editing a single category or a group of categories. * @param $cat -- Category for which to display controls. * The function makes use of $errors global variable. This is an array of invalid parameters and * it is used to highligh those paramters while displaying. */ function display_category_settings($cat) { global $errors; global $dir; $cat = (int) $cat; // Get category name. $q_str = "SELECT `name` FROM `GlParamsKateg` WHERE `ID` = '{$cat}'"; $row = db_arr($q_str); $cat_name = $row['name']; // Get a list of category items. $q_str = "\r\n \t\tSELECT\r\n \t\t\t\t`Name`,\r\n \t\t\t\t`VALUE`,\r\n \t\t\t\t`desc`,\r\n \t\t\t\t`Type`\r\n \t\tFROM\r\n \t\t\t\t`GlParams`\r\n \t\tWHERE\r\n \t\t\t\t`kateg` = '{$cat}' AND `Name` NOT LIKE '%_subject' ORDER BY `order_in_kateg` ASC"; $items = db_res($q_str); // Display controls for editing items. ?> <center> <table width="100%" cellspacing="0" cellpadding="3" class="text" style="border-collapse: collapse; border: 1px solid silver" border="0"> <?php // Iterate thru items. $i = 0; while ($row = mysql_fetch_array($items)) { $param_name = $row['Name']; $param_value = $row['VALUE']; $param_type = $row['Type']; $param_desc = $row['desc']; if (1 == $errors[$param_name]) { $class = 'table_err'; } else { if (0 == $i % 2) { $class = 'table'; } else { $class = 'table_odd'; } } $i++; echo "<tr class=\"{$class}\"><td align=\"left\" class=\"small1\""; // Display item caption. if ('text' == $param_type) { echo ' valign="top"'; } echo ">{$param_desc}</td><td align=\"right\" width=\"200\">"; // Display item control. if ('text' == $param_type) { if (EMAIL_TEMPLATE_CATEGORY == $cat) { // Get email subject. $subject_name = $param_name . '_subject'; $q_str = "SELECT `VALUE` FROM `GlParams` WHERE `Name` = '{$subject_name}'"; $res = db_res($q_str); if ($row = mysql_fetch_array($res)) { $subject_value = $row['VALUE']; } else { $subject_value = ''; } echo "<b>HTML version</b> ("; echo "<a href=\"javascript:void(0);\" onClick=\"javascript:docOpen('" . rawurlencode($param_value) . "');\">"; echo _t("_Preview"); echo "</a>)<br>"; echo 'Subject:<br />'; echo "<input type=\"text\" class=\"no\" size=\"50\" name=\"{$param_name}_subject\" value=\"{$subject_value}\"/><br /><br />"; echo 'Body:<br />'; echo "<textarea cols=\"50\" rows=\"10\" class=\"no\" name=\"{$param_name}\">" . htmlspecialchars($param_value) . "</textarea>"; $tags = '<RealName> <SiteName> <ConfCode> <ConfirmationLink> <StrID> <Email> <Password> <YourRealName> <NickName> <Domain> <ID> <TEXT> <VKissLink> <ContactInfo> <DomainName> <FromName> <Link> <NickSpamer> <IDspamer> <LinkSpamer> <MatchProfileLink> <Requester> <Profile> <site> <PrivPhotosMember> <LoginLink> <Title> <Message_Text> <MessageText> <LinkSDatingEvent> <NameSDating> <PlaceSDating> <WhenStarSDating> <PersonalUID> <MatchLink>'; echo '<br><br><br><b>Text version</b><br>'; echo 'Subject:<br />'; echo "<input readonly type=\"text\" class=\"no\" size=\"50\" name=\"{$param_name}_subject_ro\" value=\"{$subject_value}\"/><br /><br />"; echo 'Body:<br />'; echo "<textarea readonly cols=\"50\" rows=\"10\" class=\"no\" name=\"{$param_name}_ro\">" . htmlspecialchars(html2txt($param_value, $tags)) . "</textarea>"; } else { echo "<textarea cols=\"50\" rows=\"10\" class=\"no\" name=\"{$param_name}\">{$param_value}</textarea>"; } } elseif ('digit' == $param_type) { echo "<input type=\"text\" class=\"no\" name=\"{$param_name}\" size=\"15\" value=\"{$param_value}\" />"; } elseif ('checkbox' == $param_type) { echo "<input type=\"checkbox\" name=\"{$param_name}\" " . ('on' == $param_value ? 'checked' : '') . '>'; } elseif ('select' == $param_type) { if ('chicks_for_free' == $param_name) { $vals = getParam('chicks_for_free', false); $query = "SELECT `extra` FROM `ProfilesDesc` WHERE name='Sex'"; $result = db_arr($query); $result['extra'] = str_replace('\'', '', $result['extra']); $sex = split(',', $result['extra']); echo "<select name=\"{$param_name}[]\" multiple>"; foreach ($sex as $sex_key) { if (strstr($vals, '\'' . $sex_key . '\'')) { $selected = 'selected'; } else { $selected = ''; } echo "<option value=\"{$sex_key}\" {$selected} >{$sex_key}</option>"; } echo "</select>"; } else { echo " "; } } elseif ('combobox' == $param_type) { if ('chicks_for_free_membership' == $param_name) { $memberships_arr = getMemberships(); $vals = getParam('chicks_for_free_membership', false); echo "<select name=\"{$param_name}\">"; foreach ($memberships_arr as $membershipID => $membershipName) { if ($membershipID == MEMBERSHIP_ID_NON_MEMBER) { continue; } $selected = (int) $vals == $membershipID ? ' selected ' : ''; echo "<option value=\"{$membershipID}\" {$selected} >{$membershipName}</option>"; } echo "</select>"; } elseif ('template' == $param_name) { $old_val = getParam('template'); $templ_choices = get_templates_array(); echo "<select name=\"{$param_name}\">"; foreach ($templ_choices as $key => $value) { echo "<option value=\"{$key}\" " . ($old_val == $key ? 'selected="selected"' : '') . ">{$value}</option>\n"; } echo "</select>"; } } else { echo "<input type=\"text\" name=\"{$param_name}\" value=\"{$param_value}\" size=\"30\" />"; } echo "</td></tr>"; } ?> </table> </center><br /> <?php return ' '; }
function convertEditField2Input($aItem, $aParams, $iPerson) { $bCouple = $aParams['couple']; $aValues = $aParams['values']; $aErrors = $aParams['errors']; $iProfileID = $aParams['profile_id']; $aInput = array(); switch ($aItem['Type']) { case 'text': $aInput['type'] = 'text'; $aInput['value'] = $aValues[$iPerson]; break; case 'area': $aInput['type'] = 'textarea'; $aInput['value'] = $aValues[$iPerson]; $aInput['attrs']['counter'] = 'true'; break; case 'html_area': $aInput['type'] = 'textarea'; $aInput['html'] = true; $aInput['value'] = $aValues[$iPerson]; $aInput['attrs']['counter'] = 'true'; break; case 'date': $aInput['type'] = 'date'; $aInput['value'] = $aValues[$iPerson]; break; case 'datetime': $aInput['type'] = 'datetime'; $aInput['value'] = $aValues[$iPerson]; break; case 'num': $aInput['type'] = 'number'; $aInput['value'] = $aValues[$iPerson]; break; case 'range': $aInput['type'] = 'doublerange'; $aInput['value'] = $aValues[$iPerson]; break; case 'pass': $aInput['type'] = 'password'; break; case 'bool': $aInput['type'] = 'checkbox'; $aInput['value'] = 'yes'; $aInput['checked'] = (bool) (int) $aValues[$iPerson]; break; case 'select_one': switch ($aItem['Control']) { case 'select': $aInput['type'] = 'select'; break; case 'radio': $aInput['type'] = 'radio_set'; break; default: return false; } $aInput['values'] = $this->convertValues4Input($aItem['Values'], $aItem['UseLKey']); $aInput['value'] = $aValues[$iPerson]; break; case 'select_set': switch ($aItem['Control']) { case 'select': $aInput['type'] = 'select_multiple'; break; case 'checkbox': $aInput['type'] = 'checkbox_set'; break; default: return false; } $aInput['values'] = $this->convertValues4Input($aItem['Values'], $aItem['UseLKey']); $aInput['value'] = $aValues[$iPerson]; break; case 'system': switch ($aItem['Name']) { case 'Featured': $aInput = array('type' => 'checkbox', 'value' => 'yes', 'checked' => $aValues[0]); break; case 'Status': $aInput = array('type' => 'select', 'value' => $aValues[0], 'values' => array()); foreach ($aItem['Values'] as $sValue) { $aInput['values'][$sValue] = _t("_FieldValues_{$sValue}"); } break; case 'Membership': $aMemberships = getMemberships(); $aMembershipInfo = getMemberMembershipInfo($iProfileID); $aInput = array('type' => 'custom', 'content' => $this->getInputMembership($aMemberships, $aMembershipInfo)); break; case 'ID': case 'DateReg': case 'DateLastEdit': case 'DateLastLogin': //non editable return false; break; default: return false; } break; default: return false; } $aInput['name'] = $aItem['Type'] == 'system' ? $aItem['Name'] : $aItem['Name'] . "[{$iPerson}]"; $aInput['caption'] = _t($aItem['Caption']); $aInput['required'] = $aItem['Type'] == 'pass' ? false : $aItem['Mandatory']; $aInput['info'] = ($sInfo = _t($aItem['Desc'], $aItem['Min'], $aItem['Max'])) != $aItem['Desc'] ? $sInfo : null; if ($aItem['Type'] == 'date') { $aInput['attrs']['min'] = $aItem['Max'] ? date('Y') - $aItem['Max'] . '-' . date('m') . '-' . date('d') : date('Y') - 100 . '-' . date('m') . '-' . date('d'); $aInput['attrs']['max'] = $aItem['Min'] ? date('Y') - $aItem['Min'] . '-' . date('m') . '-' . date('d') : date('Y') + 100 . '-' . date('m') . '-' . date('d'); } else { $aInput['attrs']['min'] = $aItem['Min']; $aInput['attrs']['max'] = $aItem['Max']; } $aInput['error'] = $aErrors[$iPerson]; if ($iPerson == 1) { $aInput['tr_attrs'] = array('class' => 'hidable', 'style' => 'display: ' . ($bCouple ? 'table-row' : 'none')); } return $aInput; }