/** * @param string $sConfigVar Specify the variable in the INI file where module options. Default module.setting * @param string $sConfigPath Specify the path of INI file configuration WITHOUT "config.ini". The default value is the current configuration file module. Default NULL * @return void */ public static function display($sConfigVar = 'module.setting', $sConfigPath = null) { $sConfigFile = 'config.ini'; $sIniFile = empty($sConfigPath) ? Registry::getInstance()->path_module_config . $sConfigFile : $sConfigPath . $sConfigFile; $aData = parse_ini_file($sIniFile, true); $rData = file_get_contents($sIniFile); if (isset($_POST['submit_config'])) { if (\PFBC\Form::isValid($_POST['submit_config'])) { new ConfigFileCoreFormProcess($sConfigVar, $sIniFile); } Framework\Url\Header::redirect(); } $oForm = new \PFBC\Form('form_config', 600); $oForm->configure(array('action' => '')); $oForm->addElement(new \PFBC\Element\Hidden('submit_config', 'form_config')); $oForm->addElement(new \PFBC\Element\Token('config')); foreach ($aData[$sConfigVar] as $sKey => $sVal) { $sLabel = str_replace(array('.', '_'), ' ', $sKey); $sLabel = (new Str())->upperFirstWords($sLabel); if (false !== strpos($sKey, 'enable')) { $oForm->addElement(new \PFBC\Element\Select($sLabel, 'config[' . $sKey . ']', array(1 => t('Enable'), 0 => t('Disable')), array('value' => $sVal))); } elseif (false !== strpos($sKey, 'email')) { $oForm->addElement(new \PFBC\Element\Email($sLabel, 'config[' . $sKey . ']', array('value' => $sVal))); } elseif (ctype_digit($sVal)) { $oForm->addElement(new \PFBC\Element\Number($sLabel, 'config[' . $sKey . ']', array('step' => 'any', 'value' => $sVal))); } else { $oForm->addElement(new \PFBC\Element\Textbox($sLabel, 'config[' . $sKey . ']', array('value' => $sVal))); } } $oForm->addElement(new \PFBC\Element\Button()); $oForm->render(); }
public static function display() { $oForm = new \PFBC\Form('form_update_admin_ads', 500); $oForm->configure(array('action' => '')); $oForm = new \PFBC\Form('form_banner_ads', 500); $oPage = new Page(); $oAdsModel = new AdsCoreModel(); $oPage->getTotalPages($oAdsModel->total('AdsAffiliates'), 10); $oAds = $oAdsModel->get(null, $oPage->getFirstItem(), $oPage->getNbItemsByPage(), 'AdsAffiliates'); unset($oPage, $oAdsModel); $oSysVar = new SysVar(); foreach ($oAds as $oRow) { // Begin ads div tags $oForm->addElement(new \PFBC\Element\HTMLExternal('<div id="ad_' . $oRow->adsId . '">')); $oForm->addElement(new \PFBC\Element\Hidden('id_ads', $oRow->adsId)); $oForm->addElement(new \PFBC\Element\HTMLExternal('<h2>' . $oRow->name . '</h2>')); $oForm->addElement(new \PFBC\Element\HTMLExternal('<p>' . t('Preview Banner:') . '</p>')); $oForm->addElement(new \PFBC\Element\HTMLExternal('<div>' . $oSysVar->parse($oRow->code) . '</div>')); $oForm->addElement(new \PFBC\Element\Textarea(t('Banner:'), 'code', array('readonly' => 'readonly', 'onclick' => 'this.select()', 'value' => $oSysVar->parse($oRow->code)))); // End ads div tags $oForm->addElement(new \PFBC\Element\HTMLExternal('</div>')); $oForm->addElement(new \PFBC\Element\HTMLExternal('<br /><hr /><br />')); } $oForm->render(); }
/** * @param $sUrl The URL to share. If you enter nothing, it will be the current URL. Default: NULL * @param integer $iWidth Default: 350 * @return void */ public static function display($sUrl = null, $iWidth = 350) { $sUrl = !empty($sUrl) ? $sUrl : (new Http())->currentUrl(); $oForm = new \PFBC\Form('form_share_url', $iWidth); $oForm->configure(array('class' => 'center')); $oForm->addElement(new \PFBC\Element\Url(t('Share URL:'), 'share', array('value' => $sUrl, 'readonly' => 'readonly', 'onclick' => 'this.select()'))); $oForm->addElement(new \PFBC\Element\HTMLExternal('<br />')); $oForm->render(); }
/** * Embed code * * @param string $sFileUrl * @param integer $iEmbedWidth Width of the embed code. Default: 580 * @param integer $iEmbedHeight Height of the embed code. Default: 450 * @param integer $iWidth Width of the form. Default: 350 * @return void */ public static function display($sFileUrl, $iEmbedWidth = 580, $iEmbedHeight = 450, $iWidth = 350) { $sEmbedCode = '<object codebase="http://www.adobe.com/go/getflashplayer" width="' . $iEmbedWidth . '" height="' . $iEmbedHeight . '" align="middle"><param name="movie" value="' . $sFileUrl . '" /><param name="quality" value="high" /><embed src="' . $sFileUrl . '" width="' . $iEmbedWidth . '" height="' . $iEmbedHeight . '" align="middle" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed></object>'; $oForm = new \PFBC\Form('form_share_embed', $iWidth); $oForm->configure(array('class' => 'center')); $oForm->addElement(new \PFBC\Element\Textarea(t('Embed Code'), 'embed', array('value' => $sEmbedCode, 'readonly' => 'readonly', 'onclick' => 'this.select()'))); $oForm->addElement(new \PFBC\Element\HTMLExternal('<br />')); $oForm->render(); }
/** * Home Page */ public function home() { // Load global variables global $template; // So we can render a view global $response; // Manage form requests - helper // Create an array of the variables that // will be passed for use within the view $variables = array('page_title' => "Welcome to my PHP site."); // If its not a form submission then show the form if (!$response->form_submission) { $form = new \PFBC\Form("login"); $form->addElement(new \PFBC\Element\HTML('<legend>Login</legend>')); $form->addElement(new \PFBC\Element\Hidden("form", "login")); $form->addElement(new \PFBC\Element\Email("Email Address:", "Email", array("required" => 1))); $form->addElement(new \PFBC\Element\Password("Password:"******"Password", array("required" => 1))); $form->addElement(new \PFBC\Element\Checkbox("", "Remember", array("1" => "Remember me"))); $form->addElement(new \PFBC\Element\Button("Login")); $form->addElement(new \PFBC\Element\Button("Cancel", "button", array("onclick" => "history.go(-1);"))); // Pass the form object to the view $variables['form'] = $form; } // Call the view $template->render("home", $variables, 'default'); }
public static function display() { if (isset($_POST['submit_module'])) { if (\PFBC\Form::isValid($_POST['submit_module'])) { new DisableModuleFormProcess(); } Framework\Url\Header::redirect(); } $oModuleData = (new ModuleModel())->get(); $aModuleNames = []; $aSelectedMods = []; foreach ($oModuleData as $oData) { if ((int) $oData->enabled === 1) { $aSelectedMods[] = $oData->moduleId; } $sPremiumText = ''; if ((int) $oData->premiumMod === 1) { $sPremiumText = ' (<a class="italic darkred" href="' . Core::SOFTWARE_LICENSE_KEY_URL . '">' . t('Premium Module') . '</a>)'; } $aModuleNames[$oData->moduleId] = ucwords(str_replace(['-', '_'], ' ', $oData->folderName)) . $sPremiumText; } unset($oModuleData); $oForm = new \PFBC\Form('form_module'); $oForm->configure(array('action' => '')); $oForm->addElement(new \PFBC\Element\Hidden('submit_module', 'form_module')); $oForm->addElement(new \PFBC\Element\Token('module')); $oForm->addElement(new \PFBC\Element\Checkbox('', 'module_id', $aModuleNames, array('value' => $aSelectedMods))); $oForm->addElement(new \PFBC\Element\Button(t('Save'))); $oForm->render(); }
public static function display() { if (isset($_POST['submit_module'])) { if (\PFBC\Form::isValid($_POST['submit_module'])) { new DisableModuleFormProcess(); } Framework\Url\Header::redirect(); } $oModuleData = (new ModuleModel())->get(); $aModuleNames = []; $aSelectedMods = []; foreach ($oModuleData as $oId) { if ((int) $oId->enabled === 1) { $aSelectedMods[] = $oId->moduleId; } $aModuleNames[$oId->moduleId] = ucwords(str_replace(['-', '_'], ' ', $oId->folderName)); } $oForm = new \PFBC\Form('form_module'); $oForm->configure(array('action' => '')); $oForm->addElement(new \PFBC\Element\Hidden('submit_module', 'form_module')); $oForm->addElement(new \PFBC\Element\Token('module')); $oForm->addElement(new \PFBC\Element\Checkbox('', 'module_id', $aModuleNames, array('value' => $aSelectedMods))); $oForm->addElement(new \PFBC\Element\Button(t('Save'))); $oForm->render(); }
public static function display() { if (isset($_POST['submit_import_user'])) { if (\PFBC\Form::isValid($_POST['submit_import_user'])) { new ImportUserFormProcess(); } Framework\Url\HeaderUrl::redirect(); } $oForm = new \PFBC\Form('form_import_user', 550); $oForm->configure(array('action' => '')); $oForm->addElement(new \PFBC\Element\HTMLExternal('<p>' . t('Import members into your site from a <strong><abbr title="Comma Separated Values">CSV</abbr></strong> file. You can find database users <strong><a href="%0%">here</a></strong>.', 'http://www.saledatingprofiles.com/?from=hizup.com') . '</p>')); $oForm->addElement(new \PFBC\Element\Hidden('submit_import_user', 'form_import_user')); $oForm->addElement(new \PFBC\Element\Token('import_user')); $oForm->addElement(new \PFBC\Element\File(t('CSV file:'), 'csv_file', array('accept' => '.csv', 'required' => 1))); $oForm->addElement(new \PFBC\Element\Select(t('Delimiter:'), 'delimiter', array(',', ';', '|'), array('required' => 1))); $oForm->addElement(new \PFBC\Element\Select(t('Enclosure:'), 'enclosure', array('"', '/'), array('required' => 1))); $oForm->addElement(new \PFBC\Element\Button()); $oForm->render(); }
public static function display() { if (isset($_POST['submit_msg'])) { if (\PFBC\Form::isValid($_POST['submit_msg'])) { new MsgFormProcess(); } Framework\Url\HeaderUrl::redirect(); } $oForm = new \PFBC\Form('form_msg', 650); $oForm->configure(array('action' => '')); $oForm->addElement(new \PFBC\Element\Hidden('submit_msg', 'form_msg')); $oForm->addElement(new \PFBC\Element\Token('msg')); $oForm->addElement(new \PFBC\Element\HTMLExternal('<p class="center italic bold">' . t('ATTENTION! Sending emails may take several tens of minutes/hours.') . '<br />' . t('Once the form is sent, do not close the browser page!') . '</p>')); $oForm->addElement(new \PFBC\Element\Checkbox('', 'only_subscribers', array('1' => t('Only subscribers to the newsletter:')))); $oForm->addElement(new \PFBC\Element\Textbox(t('Subject:'), 'subject', array('validation' => new \PFBC\Validation\Str(5, 80), 'required' => 1))); $oForm->addElement(new \PFBC\Element\CKEditor(t('Body:'), 'body', array('required' => 1))); $oForm->addElement(new \PFBC\Element\Button(t('Send!'), 'submit')); $oForm->render(); }
public static function display() { if (isset($_POST['submit_delete_account'])) { if (\PFBC\Form::isValid($_POST['submit_delete_account'])) { new DeleteUserCoreFormProcess(); } Framework\Url\Header::redirect(); } $oForm = new \PFBC\Form('form_delete_account', 500); $oForm->configure(array('action' => '')); $oForm->addElement(new \PFBC\Element\Hidden('submit_delete_account', 'form_delete_account')); $oForm->addElement(new \PFBC\Element\Token('delete_account')); $oForm->addElement(new \PFBC\Element\Password(t('Your Password:'******'password', array('required' => 1))); $oForm->addElement(new \PFBC\Element\Textarea(t('Reason:'), 'message', array('description' => t('Please be specific in your reason. This will hep us to improve our service and make it the best social service for you.'), 'required' => 1, 'validation' => new \PFBC\Validation\Str(5, 500)))); $oForm->addElement(new \PFBC\Element\Radio(t('Why:'), 'why_delete', array(t('I do not like the site'), t('I met someone'), t('Other, I put the answer in the message!')), array('required' => 1))); $oForm->addElement(new \PFBC\Element\CCaptcha(t('Captcha:'), 'captcha', array('description' => t('Enter the code above')))); $oForm->addElement(new \PFBC\Element\Button()); $oForm->render(); }
public static function display() { if (isset($_POST['submit_add_field'])) { if (\PFBC\Form::isValid($_POST['submit_add_field'])) { new AddFieldFormProcess(); } Framework\Url\Header::redirect(); } $sFieldPattern = Config::getInstance()->values['module.setting']['field.pattern']; $oForm = new \PFBC\Form('form_add_field', 550); $oForm->configure(array('action' => '')); $oForm->addElement(new \PFBC\Element\Hidden('submit_add_field', 'form_add_field')); $oForm->addElement(new \PFBC\Element\Token('add_field')); $oForm->addElement(new \PFBC\Element\Select(t('Field Type:'), 'type', array('textbox' => t('Text Box'), 'number' => t('Number')), array('required' => 1))); $oForm->addElement(new \PFBC\Element\Textbox(t('Field Name:'), 'name', array('description' => t('Field Name must contain 2-30 alphanumeric characters ([a-z], [A-Z], [0-9] and [_], [-]).'), 'pattern' => $sFieldPattern, 'required' => 1, 'validation' => new \PFBC\Validation\RegExp($sFieldPattern)))); $oForm->addElement(new \PFBC\Element\Number(t('Length Field:'), 'length', array('required' => 1))); $oForm->addElement(new \PFBC\Element\Textbox(t('Default Field Value'), 'value', array('validation' => new \PFBC\Validation\Str(2, 120)))); $oForm->addElement(new \PFBC\Element\Button(t('Add'))); $oForm->render(); }
/** * @param array $aParam The parameters * @return void */ public static function display(array $aParam) { $sUrl = Uri::get($aParam['module'], $aParam['controller'], $aParam['action']); $oForm = new \PFBC\Form('form_confirm'); $oForm->configure(array('action' => $sUrl)); $oForm->addElement(new \PFBC\Element\Hidden('submit_confirm', 'form_confirm')); $oForm->addElement(new \PFBC\Element\Token(substr($sUrl, -14, -6))); // Create a name token and generate a random token $oForm->addElement(new \PFBC\Element\Hidden('id', $aParam['id'])); $oForm->addElement(new \PFBC\Element\HTMLExternal('<h2>' . t('Are you sure you want to make this?') . '</h2>')); $oForm->addElement(new \PFBC\Element\HTMLExternal('<p class="err_msg s_marg">' . t('Warning, this action is irreversible!') . '</p>')); $oForm->addElement(new \PFBC\Element\Button($aParam['label'], 'submit')); /** * Bug Ajax jQuery -> https://github.com/jquery/jquery-mobile/issues/3202 * $oForm->addElement(new \PFBC\Element\Button($aParam['label'], 'submit', array('formaction'=>$sUrl))); */ $oForm->addElement(new \PFBC\Element\Button(t('Cancel'), 'cancel', array('onclick' => '$("form").attr("action", "");parent.$.colorbox.close();'))); // Bug fixes $oForm->render(); }
public static function display() { if (isset($_POST['submit_edit_field'])) { if (\PFBC\Form::isValid($_POST['submit_edit_field'])) { new EditFieldFormProcess(); } Framework\Url\Header::redirect(); } $sFieldPattern = Config::getInstance()->values['module.setting']['field.pattern']; $oForm = new \PFBC\Form('form_edit_field', 550); $oForm->configure(array('action' => '')); $oForm->addElement(new \PFBC\Element\Hidden('submit_edit_field', 'form_edit_field')); $oForm->addElement(new \PFBC\Element\Token('edit_field')); $oForm->addElement(new \PFBC\Element\Select(t('Field Type:'), 'type', array('textbox' => t('Text Box'), 'number' => t('Number')), array('value' => 'textbox', 'required' => 1))); $oForm->addElement(new \PFBC\Element\Textbox(t('Field Name:'), 'name', array('description' => t('Field Name must contain 2-30 alphanumeric characters ([a-z], [A-Z], [0-9] and [_], [-]). After you can translate this language key in <span class="italic underline">%0%</span>', PH7_PATH_APP_LANG . PH7_LANG_NAME . PH7_DS . 'language.php'), 'value' => (new Http())->get('name'), 'pattern' => $sFieldPattern, 'required' => 1, 'validation' => new \PFBC\Validation\RegExp($sFieldPattern)))); $oForm->addElement(new \PFBC\Element\Number(t('Length Field:'), 'length', array('description' => t('Length of the field in numeric number (e.g., 250).'), 'value' => 255, 'required' => 1))); $oForm->addElement(new \PFBC\Element\Textbox(t('Default Field Value'), 'value', array('description' => t('The value by default of the field (optional).'), 'validation' => new \PFBC\Validation\Str(2, 120)))); $oForm->addElement(new \PFBC\Element\Button(t('Edit'))); $oForm->render(); }
public static function display($iWidth = 500) { $oForm = new \PFBC\Form('form_search', $iWidth); $oForm->configure(array('action' => Uri::get('blog', 'main', 'result') . PH7_SH, 'method' => 'get')); $oForm->addElement(new \PFBC\Element\Search(t('Name, Keyword of post, or ID of Blog Post:'), 'looking', array('style' => 'width:' . $iWidth * 1.1 . 'px'))); $oForm->addElement(new \PFBC\Element\Select(t('Browse By:'), 'order', array(SearchCoreModel::TITLE => t('Title'), SearchCoreModel::VIEWS => t('Popular'), SearchCoreModel::RATING => t('Rated'), SearchCoreModel::CREATED => t('Created Date'), SearchCoreModel::UPDATED => t('Updated Date')))); $oForm->addElement(new \PFBC\Element\Select(t('Direction:'), 'sort', array(SearchCoreModel::ASC => t('Ascending'), SearchCoreModel::DESC => t('Descending')))); $oForm->addElement(new \PFBC\Element\Button(t('Search'), 'submit', array('icon' => 'search'))); $oForm->render(); }
public static function display($iWidth = 500) { $oForm = new \PFBC\Form('form_search', $iWidth); $oForm->configure(array('action' => Uri::get('game', 'main', 'result') . PH7_SH, 'method' => 'get')); $oForm->addElement(new \PFBC\Element\Search(t('Search Games'), 'looking', array('title' => t('Enter Name, Description, Keyword or ID of a Game.'), 'style' => 'width:' . $iWidth * 1.1 . 'px'))); $oForm->addElement(new \PFBC\Element\Select(t('Browse By:'), 'order', array(SearchCoreModel::TITLE => t('Title'), SearchCoreModel::VIEWS => t('Popular'), SearchCoreModel::RATING => t('Rated'), SearchCoreModel::DOWNLOADS => t('Downloaded')))); $oForm->addElement(new \PFBC\Element\Select(t('Direction:'), 'sort', array(SearchCoreModel::ASC => t('Ascending'), SearchCoreModel::DESC => t('Descending')))); $oForm->addElement(new \PFBC\Element\Button(t('Search'), 'submit', array('icon' => 'search'))); $oForm->render(); }
public static function display() { $oForm = new \PFBC\Form('form_search', 500); $oForm->configure(array('action' => Uri::get('picture', 'main', 'result') . PH7_SH, 'method' => 'get')); $oForm->addElement(new \PFBC\Element\Search(t('ID or Name of Picture:'), 'looking')); $oForm->addElement(new \PFBC\Element\Select(t('Browse By:'), 'order', array(SearchCoreModel::TITLE => t('Title'), SearchCoreModel::VIEWS => t('Popular'), SearchCoreModel::RATING => t('Rated'), SearchCoreModel::CREATED => t('Created Date'), SearchCoreModel::UPDATED => t('Updated Date')))); $oForm->addElement(new \PFBC\Element\Select(t('Direction:'), 'sort', array(SearchCoreModel::ASC => t('Ascending'), SearchCoreModel::DESC => t('Descending')))); $oForm->addElement(new \PFBC\Element\Button(t('Search'), 'submit', array('icon' => 'search'))); $oForm->render(); }
public static function display() { if (isset($_POST['submit_reply'])) { if (\PFBC\Form::isValid($_POST['submit_reply'])) { new ReplyMsgFormProcess(); } Framework\Url\Header::redirect(); } $oForm = new \PFBC\Form('form_reply', '100%'); $oForm->configure(array('action' => '')); $oForm->addElement(new \PFBC\Element\Hidden('submit_reply', 'form_reply')); $oForm->addElement(new \PFBC\Element\Token('reply')); $oForm->addElement(new \PFBC\Element\CKEditor(t('Message:'), 'message', array('required' => 1, 'validation' => new \PFBC\Validation\Str(4)))); if (DbConfig::getSetting('isCaptchaForum')) { $oForm->addElement(new \PFBC\Element\CCaptcha(t('Captcha:'), 'captcha', array('id' => 'ccaptcha', 'onkeyup' => 'CValid(this.value, this.id)', 'description' => t('Enter the code above:')))); $oForm->addElement(new \PFBC\Element\HTMLExternal('<span class="input_error ccaptcha"></span>')); } $oForm->addElement(new \PFBC\Element\Button()); $oForm->addElement(new \PFBC\Element\HTMLExternal('<script src="' . PH7_URL_STATIC . PH7_JS . 'validate.js"></script>')); $oForm->render(); }
public static function display() { $oForm = new \PFBC\Form('form_search', 500); $oForm->configure(array('action' => Uri::get('forum', 'forum', 'result') . PH7_SH, 'method' => 'get')); $oForm->addElement(new \PFBC\Element\Search(t('Name, Keyword of message, Author (username) or ID of Topic Forum:'), 'looking')); $oForm->addElement(new \PFBC\Element\Select(t('Browse By:'), 'order', array(SearchCoreModel::TITLE => t('Title'), SearchCoreModel::VIEWS => t('Popular'), SearchCoreModel::CREATED => t('Created Date'), SearchCoreModel::UPDATED => t('Updated Date')))); $oForm->addElement(new \PFBC\Element\Select(t('Direction:'), 'sort', array(SearchCoreModel::ASC => t('Ascending'), SearchCoreModel::DESC => t('Descending')))); $oForm->addElement(new \PFBC\Element\Button(t('Search'), 'submit', array('icon' => 'search'))); $oForm->render(); }
public static function display() { $oForm = new \PFBC\Form('form_search', 500); $oForm->configure(array('action' => Uri::get('newsletter', 'admin', 'browse') . PH7_SH, 'method' => 'get')); $oForm->addElement(new \PFBC\Element\Search(t('Search an Subscriber:'), 'looking', array('description' => t('Enter their ID, Name, Email or IP address.')))); $oForm->addElement(new \PFBC\Element\Select(t('Browse By:'), 'order', array(SearchCoreModel::EMAIL => t('Email'), SearchCoreModel::NAME => t('Name'), SearchCoreModel::LATEST => t('Latest')))); $oForm->addElement(new \PFBC\Element\Select(t('Direction:'), 'sort', array(SearchCoreModel::ASC => t('Ascending'), SearchCoreModel::DESC => t('Descending')))); $oForm->addElement(new \PFBC\Element\Button(t('Search'), 'submit', array('icon' => 'search'))); $oForm->render(); }
public static function display() { $oForm = new \PFBC\Form('form_admin_search', 500); $oForm->configure(array('action' => Uri::get(PH7_ADMIN_MOD, 'admin', 'browse') . PH7_SH, 'method' => 'get')); $oForm->addElement(new \PFBC\Element\Search(t('Search an Admin:'), 'looking', array('description' => t('Enter their ID, First Name, Last Name, Username, Email, Sex or IP address.')))); $oForm->addElement(new \PFBC\Element\Select(t('Browse By:'), 'order', array(SearchCoreModel::USERNAME => t('Username'), SearchCoreModel::FIRST_NAME => t('First Name'), SearchCoreModel::LAST_NAME => t('Last Name'), SearchCoreModel::EMAIL => t('Email'), SearchCoreModel::LATEST => t('Latest Admins'), SearchCoreModel::LAST_ACTIVITY => t('Last Activity'), SearchCoreModel::LAST_EDIT => t('Last Account Edit')))); $oForm->addElement(new \PFBC\Element\Select(t('Direction:'), 'sort', array(SearchCoreModel::ASC => t('Ascending'), SearchCoreModel::DESC => t('Descending')))); $oForm->addElement(new \PFBC\Element\Button(t('Search'), 'submit', array('icon' => 'search'))); $oForm->render(); }
public static function display() { if (isset($_POST['submit_picture_album'])) { if (\PFBC\Form::isValid($_POST['submit_picture_album'])) { new AlbumFormProcess(); } Framework\Url\Header::redirect(); } $oForm = new \PFBC\Form('form_picture_album', 500); $oForm->configure(array('action' => '')); $oForm->addElement(new \PFBC\Element\Hidden('submit_picture_album', 'form_picture_album')); $oForm->addElement(new \PFBC\Element\Token('album')); $oForm->addElement(new \PFBC\Element\Textbox(t('Name of your album:'), 'name', array('required' => 1, 'validation' => new \PFBC\Validation\Str(2, 40)))); $oForm->addElement(new \PFBC\Element\Textarea(t('Description of your album:'), 'description', array('validation' => new \PFBC\Validation\Str(2, 200)))); $oForm->addElement(new \PFBC\Element\File(t('Thumb of the your album'), 'album', array('accept' => 'image/*', 'required' => 1))); $oForm->addElement(new \PFBC\Element\Button()); $oForm->render(); }
public static function display() { $sUsername = (new Http())->get('username'); $oForm = new \PFBC\Form('form_search', 500); $oForm->configure(array('action' => Uri::get('user', 'visitor', 'index', $sUsername) . PH7_SH, 'method' => 'get')); $oForm->addElement(new \PFBC\Element\Search(t('Find Search a Visitor of "%0%"', $sUsername), 'looking', array('title' => t('Enter its First Name, Last Name, Username, Email address or ID of your Friend.')))); $oForm->addElement(new \PFBC\Element\Select(t('Browse By:'), 'order', array(SearchCoreModel::LAST_VISIT => t('Last Seen on your profile'), SearchCoreModel::USERNAME => t('Username'), SearchCoreModel::FIRST_NAME => t('First Name'), SearchCoreModel::LAST_NAME => t('Last Name'), SearchCoreModel::EMAIL => t('Email'), SearchCoreModel::LATEST => t('Latest'), SearchCoreModel::LAST_ACTIVITY => t('Last Activity'), SearchCoreModel::VIEWS => t('Popular'), SearchCoreModel::RATING => t('Rated')))); $oForm->addElement(new \PFBC\Element\Select(t('Direction:'), 'sort', array(SearchCoreModel::DESC => t('Descending'), SearchCoreModel::ASC => t('Ascending')))); $oForm->addElement(new \PFBC\Element\Button(t('Search'), 'submit', array('icon' => 'search'))); $oForm->render(); }
public static function display() { $bAdminLogged = AdminCore::auth() && !UserCore::auth(); $oForm = new \PFBC\Form('form_search', 500); $sUrl = $bAdminLogged ? Uri::get('mail', 'admin', 'msglist') : Uri::get('mail', 'main', 'result'); $oForm->configure(array('action' => $sUrl . PH7_SH, 'method' => 'get')); $oForm->addElement(new \PFBC\Element\Search(t('Search a message:'), 'looking', array('title' => t('Enter a keyword in the Subject, Contents, Author (username, first name, last name) or message ID.')))); $oForm->addElement(new \PFBC\Element\Select(t('Browse By:'), 'order', array(SearchCoreModel::TITLE => t('Subject'), SearchCoreModel::USERNAME => t('Author (username)'), SearchCoreModel::SEND_DATE => t('Recent')))); if (!$bAdminLogged) { $oForm->addElement(new \PFBC\Element\Select(t('Where:'), 'where', array(MailModel::INBOX => t('Inbox'), MailModel::OUTBOX => t('Outbox'), MailModel::TRASH => t('Trash')))); } $oForm->addElement(new \PFBC\Element\Select(t('Direction:'), 'sort', array(SearchCoreModel::ASC => t('Ascending'), SearchCoreModel::DESC => t('Descending')))); $oForm->addElement(new \PFBC\Element\Button(t('Search'), 'submit', array('icon' => 'search'))); $oForm->render(); }
public static function display() { if (isset($_POST['submit_category'])) { if (\PFBC\Form::isValid($_POST['submit_category'])) { new CategoryFormProcess(); } Framework\Url\HeaderUrl::redirect(); } $sTitlePattern = Config::getInstance()->values['module.setting']['url_title.pattern']; $oForm = new \PFBC\Form('form_category', '100%'); $oForm->configure(array('action' => '')); $oForm->addElement(new \PFBC\Element\Hidden('submit_category', 'form_category')); $oForm->addElement(new \PFBC\Element\Token('category')); $oForm->addElement(new \PFBC\Element\Textbox(t('Category Name:'), 'title', array('id' => 'str_category', 'onblur' => 'CValid(this.value,this.id,2,60)', 'pattern' => $sTitlePattern, 'required' => 1, 'validation' => new \PFBC\Validation\RegExp($sTitlePattern)))); $oForm->addElement(new \PFBC\Element\HTMLExternal('<span class="input_error str_category"></span>')); $oForm->addElement(new \PFBC\Element\Button()); $oForm->addElement(new \PFBC\Element\HTMLExternal('<script src="' . PH7_URL_STATIC . PH7_JS . 'validate.js"></script>')); $oForm->render(); }
public static function display() { if (isset($_POST['submit_edit_msg'])) { if (\PFBC\Form::isValid($_POST['submit_edit_msg'])) { new EditMsgFormProcess(); } Framework\Url\Header::redirect(); } $oHttpRequest = new Http(); $oMsg = (new ForumModel())->getTopic(strstr($oHttpRequest->get('forum_name'), '-', true), $oHttpRequest->get('forum_id'), strstr($oHttpRequest->get('topic_name'), '-', true), $oHttpRequest->get('topic_id'), (new Session())->get('member_id'), 1, 0, 1); unset($oHttpRequest); $sTitlePattern = Config::getInstance()->values['module.setting']['url_title.pattern']; $oForm = new \PFBC\Form('form_edit_msg', '100%'); $oForm->configure(array('action' => '')); $oForm->addElement(new \PFBC\Element\Hidden('submit_edit_msg', 'form_edit_msg')); $oForm->addElement(new \PFBC\Element\Token('edit_msg')); $oForm->addElement(new \PFBC\Element\Textbox(t('Subject:'), 'title', array('value' => $oMsg->title, 'id' => 'str_title', 'onblur' => 'CValid(this.value,this.id,2,60)', 'pattern' => $sTitlePattern, 'required' => 1, 'validation' => new \PFBC\Validation\RegExp($sTitlePattern)))); $oForm->addElement(new \PFBC\Element\HTMLExternal('<span class="input_error str_title"></span>')); $oForm->addElement(new \PFBC\Element\CKEditor(t('Message:'), 'message', array('value' => $oMsg->message, 'required' => 1, 'validation' => new \PFBC\Validation\Str(4)))); $oForm->addElement(new \PFBC\Element\Button()); $oForm->addElement(new \PFBC\Element\HTMLExternal('<script src="' . PH7_URL_STATIC . PH7_JS . 'validate.js"></script>')); $oForm->render(); }
public static function display() { if (isset($_POST['submit_ads'])) { if (\PFBC\Form::isValid($_POST['submit_ads'])) { new AdsFormProcess(); } Framework\Url\Header::redirect(); } $aAdSizes = PH7_PATH_APP_CONFIG . 'ad_sizes.php'; $oForm = new \PFBC\Form('form_ads', 500); $oForm->configure(array('action' => '')); $oForm->addElement(new \PFBC\Element\Hidden('submit_ads', 'form_ads')); $oForm->addElement(new \PFBC\Element\Token('ads')); $oForm->addElement(new \PFBC\Element\Textbox(t('Title:'), 'title', array('required' => 1, 'validation' => new \PFBC\Validation\Str(2, 40)))); $oForm->addElement(new \PFBC\Element\Select(t('Size of the Banner:'), 'size', $aAdSizes, array('required' => 1))); $sText = AdsCore::getTable() == 'AdsAffiliates' ? t('The predefined variable for the URL of an affiliate account to put in the HTML is: %0%.', '<strong>#!%affiliate_url%!#</strong>') : t('The predefined variable to the URL of your site to indicate this in the HTML is: %0%.', '<strong>#!%site_url%!#</strong>'); $oForm->addElement(new \PFBC\Element\Textarea(t('Banner:'), 'code', array('description' => $sText, 'required' => 1))); $oForm->addElement(new \PFBC\Element\Button()); $oForm->render(); }
public static function display() { if (isset($_POST['submit_admin_ads'])) { if (\PFBC\Form::isValid($_POST['submit_admin_ads'])) { new AdsAdminFormProcess(); } Framework\Url\Header::redirect(); } $oForm = new \PFBC\Form('form_admin_ads', 500); $oForm->configure(array('action' => '')); $oForm->addElement(new \PFBC\Element\Hidden('submit_admin_ads', 'form_admin_ads')); $oForm->addElement(new \PFBC\Element\Token('admin_ads')); $oForm->addElement(new \PFBC\Element\Textbox(t('Title'), 'title', array('required' => 1, 'validation' => new \PFBC\Validation\Str(2, 20)))); $oForm->addElement(new \PFBC\Element\Textarea(t('Advertisement'), 'code', array('required' => 1))); $oForm->addElement(new \PFBC\Element\Button()); $oForm->render(); }
public static function display() { $oUserModel = new UserCoreModel(); $iProfileId = (int) (new Session())->get('member_id'); if (isset($_POST['submit_notification'])) { if (\PFBC\Form::isValid($_POST['submit_notification'])) { new NotificationFormProcess($iProfileId, $oUserModel); } Framework\Url\Header::redirect(); } $oNotification = $oUserModel->getNotification($iProfileId); $oForm = new \PFBC\Form('form_notification', 650); $oForm->configure(array('action' => '')); $oForm->addElement(new \PFBC\Element\Hidden('submit_notification', 'form_notification')); $oForm->addElement(new \PFBC\Element\Token('notification')); $oForm->addElement(new \PFBC\Element\Select(t('Newsletters'), 'enable_newsletters', array('1' => t('Enable'), '0' => t('Disable')), array('description' => t('By enabling this option, you would be likely to receive occasional news on our website and our services and offers, promotions and other benefits to our partners.'), 'value' => $oNotification->enableNewsletters, 'required' => 1))); $oForm->addElement(new \PFBC\Element\Select(t('Message'), 'new_msg', array('1' => t('Yes'), '0' => t('No')), array('value' => $oNotification->newMsg, 'required' => 1))); $oForm->addElement(new \PFBC\Element\Select(t('Friend requests'), 'friend_request', array('1' => t('Yes'), '0' => t('No')), array('value' => $oNotification->friendRequest, 'required' => 1))); $oForm->addElement(new \PFBC\Element\Button()); $oForm->render(); }
/** * @param string $sLabel Link name of submit form * @param string $sModule * @param string $sController * @param string $sAction * @param array $aParams The parameters * @return void */ public static function display($sLabel, $sModule, $sController, $sAction, array $aParams) { $sUrl = !isset($sModule, $sController, $sAction) ? (new Http())->currentUrl() : Uri::get($sModule, $sController, $sAction); $oForm = new \PFBC\Form('form_link'); $oForm->configure(array('action' => $sUrl, 'class' => 'form_link')); $oForm->addElement(new \PFBC\Element\Hidden('submit_link', 'form_link')); $oForm->addElement(new \PFBC\Element\Token(substr($sUrl, -14, -6))); // Create a name token and generate a random token foreach ($aParams as $sKey => $sVal) { $oForm->addElement(new \PFBC\Element\Hidden($sKey, $sVal)); } $oForm->addElement(new \PFBC\Element\Submit($sLabel)); $oForm->render(); }
public static function display() { if (isset($_POST['submit_edit_video_album'])) { if (\PFBC\Form::isValid($_POST['submit_edit_video_album'])) { new EditAlbumFormProcess(); } Framework\Url\Header::redirect(); } $oAlbum = (new VideoModel())->album((new Session())->get('member_id'), (new Http())->get('album_id'), 1, 0, 1); $oForm = new \PFBC\Form('form_edit_video_album', 500); $oForm->configure(array('action' => '')); $oForm->addElement(new \PFBC\Element\Hidden('submit_edit_video_album', 'form_edit_video_album')); $oForm->addElement(new \PFBC\Element\Token('edit_album')); $oForm->addElement(new \PFBC\Element\Textbox(t('Name of your album:'), 'name', array('value' => $oAlbum->name, 'required' => 1, 'validation' => new \PFBC\Validation\Str(2, 40)))); $oForm->addElement(new \PFBC\Element\Textarea(t('Description of your album:'), 'description', array('value' => $oAlbum->description, 'validation' => new \PFBC\Validation\Str(2, 200)))); $oForm->addElement(new \PFBC\Element\Button()); $oForm->render(); }