public function action_myform() { $fieldset = \fieldset::forge('form'); $fieldset->add('title', 'title', array('maxlength' => 50), array(array('required'))); if (\input::post()) { echo \input::post('title'); } return \Response::forge($fieldset); }
/** * Method to Display the Business Card * @return string */ public function show() { switch ($this->userArray['sex']) { case 'M': $gender = 'Male'; break; case 'F': $gender = 'Female'; break; default: $gender = 'Unknown'; break; } $emailLabel = $this->objLanguage->languageText('phrase_emailaddress'); $genderLabel = $this->objLanguage->languageText('word_gender'); $mobileLabel = $this->objLanguage->languageText('phrase_mobilenumber'); $countryLabel = $this->objLanguage->languageText('word_country'); $image = $this->objUser->getUserImage($this->userArray['userid'], TRUE); if ($this->showResetImage) { if ($this->objUser->hasCustomImage($this->userArray['userid'])) { $resetimageform = new form('updateimage', $this->uri(array('action' => $this->resetAction), $this->resetModule)); $id = new hiddeninput('id', $this->userArray['id']); $resetimageform->addToForm($id->show()); $userid = new hiddeninput('userid', $this->userArray['userid']); $resetimageform->addToForm($userid->show()); $button = new button('resetimage', 'Reset Image'); $button->setToSubmit(); $resetimageform->addToForm(' ' . $button->show()); $image .= $resetimageform->show(); } } $objHeading = new htmlheading(); $objHeading->str = $this->userArray['title'] . ' ' . $this->userArray['firstname'] . ' ' . $this->userArray['surname']; $objHeading->type = 1; $heading = $objHeading->show(); $objTable = new htmltable(); $objTable->width = '100%'; $objTable->cellpadding = '4'; $objTable->startRow(); $objTable->addCell($image, '25%', 'center', 'center', 'userbizcardleft', 'rowspan="6"'); $objTable->endRow(); $objTable->startRow(); $objTable->addCell('<strong>' . ucfirst(strtolower($emailLabel)) . ':</strong>', '30%', '', '', 'heading', ''); $objTable->addCell($this->userArray['emailaddress'], '', '', '', 'heading', ''); $objTable->endRow(); $objTable->startRow(); $objTable->addCell('<strong>' . $mobileLabel . ':</strong>', '', '', '', 'heading', ''); $objTable->addCell($this->userArray['cellnumber'], '', '', '', 'heading', ''); $objTable->endRow(); $objTable->startRow(); $objTable->addCell('<strong>' . $countryLabel . ':</strong>', '', '', '', 'heading', ''); $objTable->addCell($this->objCountries->getCountryName($this->userArray['country']) . ' ' . $this->objCountries->getCountryFlag($this->userArray['country']), '', '', '', 'heading', ''); $objTable->endRow(); $objTable->startRow(); $objTable->addCell('<strong>' . $genderLabel . ':</strong>', '', '', '', 'heading', ''); $objTable->addCell($gender, '', '', '', 'heading', ''); $objTable->endRow(); $string = $objTable->show(); $objFieldset = new fieldset(); $objFieldset->legend = $heading; $objFieldset->contents = $string; $objFieldset->width = '500px'; $fieldset = $objFieldset->show(); return $fieldset; }
$textinput = new textinput('foldername', $folderpath); $form->addToForm($label->show() . $textinput->show()); $buttonSubmit = new button('renamefoldersubmit', $this->objLanguage->languageText('mod_filemanager_renamefolder', 'filemanager')); $buttonSubmit->setToSubmit(); $form->addToForm(' ' . $buttonSubmit->show() . '<br/><div class="warning">' . $this->objLanguage->languageText('mod_filemanager_renamewarning', 'filemanager') . '</div>'); $fieldset = new fieldset(); $fieldset->setLegend($this->objLanguage->languageText('mod_filemanager_renamefolder', 'filemanager')); //$folderId $fieldset->addContent($form->show()); $folderActions .= '<span id="renamefolder" style="display: xnone;">' . $fieldset->show() . '<br /></span>'; $objAccess = $this->getObject("folderaccess", "filemanager"); $accessContent = $objAccess->createAccessControlForm($folder['id']); $folderActions .= '<span id="accessfolder" >' . $accessContent . '<br /></span>'; $alertContent = $objAccess->createAlertsForm($folder['id']); $folderActions .= '<span id="alertsfolder" >' . $alertContent . '<br /></span>'; $fieldset = new fieldset(); $fieldset->setLegend($this->objLanguage->languageText('mod_filemanager_deletefolder', 'filemanager', 'Delete Folder')); $fieldset->addContent('<br/><div class="warning">' . $this->objLanguage->languageText('mod_filemanager_deletewarning', 'filemanager') . '</div><br/>' . $icon); $folderActions .= $fieldset->show(); } if ((count($files) > 0 || count($subfolders) > 0 || count($symlinks) > 0) && $folderPermission) { $form = new form('movedeletefiles', $this->uri(array('action' => 'multimovedelete'))); $form->addToForm($table); $folderPath_ = $this->objFolders->getFolderPath($folderId); if ($folderPath_ !== FALSE) { $folderParts = explode('/', $folderPath_); $folderTree = $this->objFolders->getTree($folderParts[0], $folderParts[1], 'htmldropdown', $folderId); $objButtonMove = new button('movefiles', $this->objLanguage->languageText('mod_filemanager_moveselecteditems', 'filemanager')); $objButtonMove->setToSubmit(); $move = $this->objLanguage->languageText('mod_filemanager_moveto', 'filemanager') . ': ' . $folderTree . ' ' . $objButtonMove->show() . ' '; } else {
/** * Modify (input) fieldset so it includes hidden fields * * @param fieldset $fieldset HTML/QuickForm2 fieldset to modify * @param array $hidden array of hidden fieldnames (keys) and values * @return null * * @access private */ private function add_hidden_fields_to_fieldset(&$fieldset, $hidden) { foreach (array_keys($hidden) as $key) { $value = $hidden[$key]; $fieldset->addElement('hidden', $key)->setValue($value); } }
/** @brief Fieldsets do not have names. @since 2014-11-16 12:59:23 **/ public function __toString_before_inputs() { $this->set_attribute('name', $this->__name); unset($this->__name); return parent::__toString_before_inputs(); }
/** * this creates the visibility control field * @param type $id * @return type */ function createFileVisibilityForm($id) { $dbFile = $this->getObject("dbfile", "filemanager"); $file = $dbFile->getFile($id); $form = new form('visibilityform', $this->uri(array('action' => 'setfilevisibility', 'id' => $id))); $visibleTxt = $this->objLanguage->languageText('mod_filemanager_visible', 'filemanager'); $hiddenTxt = $this->objLanguage->languageText('mod_filemanager_hidden', 'filemanager'); $legend = $this->objLanguage->languageText('mod_filemanager_visibility', 'filemanager'); $objElement = new radio('access_radio'); $objElement->addOption('visible', $visibleTxt . '<br/>'); $objElement->addOption('hidden', $hiddenTxt . '<br/>'); $access = $file['visibility'] == NULL ? 'visible' : $file['visibility']; $objElement->setSelected($access); $applyButton = new button('apply', $this->objLanguage->languageText('mod_filemanager_apply', 'filemanager')); $applyButton->setToSubmit(); $fieldset = new fieldset(); $fieldset->setLegend($legend); $fieldset->addContent($objElement->show() . '<br/>' . $applyButton->show()); $hiddeninput = new hiddeninput('id', $id); $form->addToForm($hiddeninput->show()); $form->addToForm($fieldset->show()); $content = $form->show(); $objModule = $this->getObject('modules', 'modulecatalogue'); //See if the simple map module is registered and set a param $isRegistered = $objModule->checkIfRegistered('digitallibrary'); if ($isRegistered) { $dlfieldset = new fieldset(); $dlfieldset->setLegend("Link to digital library"); $link = new link($this->uri(array("action" => "linkfromfilemanager", "fileid" => $id), "digitallibrary")); $link->link = "<strong>Link this file</>"; $dlfieldset->addContent($link->show()); $content .= $dlfieldset->show(); } return $content; }
<?php $legend = $this->objLanguage->languageText('mod_filemanager_accessdenied_legend', 'filemanager'); $accessDenied = $this->objLanguage->languageText('mod_filemanager_accessdenied_txt', 'filemanager'); $fieldset = new fieldset(); $fieldset->setLegend($legend); $fieldset->addContent($accessDenied); $heading = $this->newObject('htmlheading', 'htmlelements'); $heading->htmlheading($legend, 1); echo $heading->show(); echo $fieldset->show();
/** * * Render a login box * * @param string $module The module we are in or will go to * @param boolean $ajaxLogin Whether or not to do ajax login * @return string The login box * @access public * */ public function renderLoginBox($module = NULL, $ajaxLogin = FALSE) { try { // Determine if we need to use https $useHTTPS = $this->objSysConfig->getValue('MOD_SECURITY_HTTPS', 'security'); // Set the formaction depending on whether it is going to use ajax or not. if (!$ajaxLogin) { // Set the action for the login form depending on if there is a module or not. if ($module != NULL) { $formAction = $this->uri(array('action' => 'login', 'mod' => $module), 'security'); } else { $formAction = $this->uri(array('action' => 'login'), 'login'); } if ($useHTTPS == '1' || $useHTTPS == 'TRUE') { $formAction = str_replace("http:", "https:", $formAction); } } else { // We want an ajax login. $formAction = 'javascript:void(0);'; } // Create a Form object. $objForm = new form('loginform', $formAction); $objFields = new fieldset(); $objFields->setLegend(' '); //--Create an element for the username $objInput = new textinput('username', '', 'text', '15'); $objInput->extra = 'maxlength="255"'; $objInput->setCss('required minlength(2)'); $objLabel = new label($this->objLanguage->languageText('word_username') . ': ', 'input_username'); //Add the username box to the form $objFields->addContent($objLabel->show() . '<br />'); $objFields->addContent($objInput->show() . '<br />'); //--- Create an element for the password $objInput = new textinput('password', '', 'password', '15'); $objInput->extra = 'maxlength="255"'; $objInput->setCss('required'); $objLabel = new label($this->objLanguage->languageText('word_password') . ': ', 'input_password'); $objFields->addContent($objLabel->show() . '<br />'); $objFields->addContent($objInput->show()); //--- Create an element for the network login radio $objElement = new checkbox("useLdap"); $objElement->setCSS("transparentbgnb"); $objElement->label = $this->objLanguage->languageText("phrase_networkid") . ' '; $ldap = ''; $objSysConfig = $this->getObject('dbsysconfig', 'sysconfig'); $showLDAPCheckBox = $objSysConfig->getValue('show_ldap_checkbox', 'security'); // Get a nonce $objNonce = $this->getObject('nonce', 'login'); $nonce = $objNonce->storeNonce(); // Create a hidden field for the nonce $objNonce = new hiddeninput('nonce', $nonce); $objNonce->extra = ' id=\'nonce\''; $nonce = $objNonce->show(); //----------------------------------------------------------------------------------------Checking this is a violation of the principle of chain of responsiblity @todo fix it if ($this->objConfig->getuseLDAP() && $showLDAPCheckBox == 'true') { $ldap .= $objElement->label . ' ' . $objElement->show(); } //--- Create an element for the remember me checkbox $objRElement = new checkbox("remember"); $objRElement->setCSS("transparentbgnb noborder"); $objRElement->label = $this->objLanguage->languageText("phrase_rememberme", "security"); $rem = $objRElement->show() . "<br />"; //--- Create a submit button $objButton = new button('submit', $this->objLanguage->languageText("word_login")); // Add the login icon $objButton->setIconClass("user"); // Set the button type to submit $objButton->setToSubmit(); // Give the button an ID for jQuery to grab. $objButton->setId('loginButton'); // Add the button to the form ----------------------------------------------------------- Note LDAP breaks the COR pattern $objFields->addContent($ldap . '<br />' . $nonce . $rem . "<div class='loginbuttonwrap'>" . $objButton->show() . '</div>'); $helpText = strtoupper($this->objLanguage->languageText('word_help', 'system')); $helpIcon = $this->objHelp->show('register', 'useradmin', $helpText); $resetLink = new Link($this->uri(array('action' => 'needpassword'), 'security')); $resetLink->link = $this->objLanguage->languageText('mod_security_forgotpassword'); // the help link $p = '<br/>' . $resetLink->show() . '<br />' . $helpIcon; $objFields->addContent($p); $objForm->addToForm($objFields->show()); return '<div id="login_block_wrapper">' . $objForm->show() . '</div>'; } catch (Exception $e) { customException::cleanUp(); } }
/** * Method to render a login box * @returns string */ public function renderLoginBox($module = NULL) { try { //set the action for the login form if ($module != NULL) { $formAction = $this->objEngine->uri(array('action' => 'login', 'mod' => $module), 'security'); } else { $formAction = $this->objEngine->uri(array('action' => 'login'), 'security'); } $useHTTPS = $this->objSysConfig->getValue('MOD_SECURITY_HTTPS', 'security'); if ($useHTTPS == '1') { $formAction = str_replace("http:", "https:", $formAction); } //Load up the various HTML classes $this->loadClass('button', 'htmlelements'); $this->loadClass('textinput', 'htmlelements'); $this->loadClass('checkbox', 'htmlelements'); $this->loadClass('link', 'htmlelements'); $this->loadClass('label', 'htmlelements'); $this->loadClass('fieldset', 'htmlelements'); $objBox = $this->newObject('alertbox', 'htmlelements'); $objIcon = $this->getObject('geticon', 'htmlelements'); // prepare the link for the oAuth providers $box = $this->oauthDisp(); $fb = $this->fbButton(); //fbConnect(); // Create a Form object $objForm = new form('loginform', $formAction); $objFields = new fieldset(); $objFields->setLegend(' '); //--Create an element for the username $objInput = new textinput('username', '', 'text', '15'); $objInput->extra = 'maxlength="255" placeholder="' . $this->objLanguage->languageText('word_username', 'system') . '"'; $objLabel = new label($this->objLanguage->languageText('word_username') . ': ', 'input_username'); //Add validation for username $objForm->addRule('username', $this->objLanguage->languageText("mod_login_unrequired", 'security', 'Please enter a username. A username is required in order to login.'), 'required'); //Add the username box to the form $this->objIcon->setIcon('user'); $objFields->addContent($this->objIcon->show()); $objFields->addContent($objInput->show() . '<br />'); //$objForm->addToForm(); //--- Create an element for the password $objInput = new textinput('password', '', 'password', '15'); $objInput->extra = 'maxlength="255" placeholder="' . $this->objLanguage->languageText('word_password', 'system') . '"'; $objLabel = new label($this->objLanguage->languageText('word_password') . ': ', 'input_password'); //Add the password box to the form //$objForm->addToForm(); $this->objIcon->setIcon('key'); $objFields->addContent($this->objIcon->show()); // $objFields->addContent($objLabel->show() . '<br />'); $objFields->addContent($objInput->show()); //--- Create an element for the network login radio $objElement = new checkbox("useLdap"); $objElement->setCSS("transparentbgnb"); $objElement->label = $this->objLanguage->languageText("phrase_networkid") . ' '; $ldap = ''; $objSysConfig = $this->getObject('dbsysconfig', 'sysconfig'); $showLDAPCheckBox = $objSysConfig->getValue('show_ldap_checkbox', 'security'); if ($this->objConfig->getuseLDAP() && $showLDAPCheckBox == 'true') { $ldap .= $objElement->label . ' ' . $objElement->show(); } //--- Create an element for the remember me checkbox $objRElement = new checkbox("remember"); $objRElement->setCSS("transparentbgnb noborder"); $objRElement->label = $this->objLanguage->languageText("phrase_rememberme", "security"); $rem = $objRElement->show() . "<br />"; //--- Create a submit button $objButton = new button('submit', $this->objLanguage->languageText("word_login")); // Add the login icon $objButton->setIconClass("user"); // Set the button type to submit $objButton->setToSubmit(); // Add the button to the form // openid / google /yahoo login // Open ID login code. $showOpenIdLogin = $objSysConfig->getValue('show_openidconnect_auth', 'security'); $openidlink = ""; if ($showOpenIdLogin == 'true') { // OpenId auth page is used for Google and Yahoo $objAltConfig = $this->getObject('altconfig', 'config'); $siteRoot = $objAltConfig->getSiteRoot(); $OPENID_AUTH_PAGE = $this->uri(array("action" => "openidconnect"), "security"); // Google icon $gIcon = $this->newObject('geticon', 'htmlelements'); $gIcon->setIcon('google'); $gIcon->alt = "Google ID"; $gIcon->extra = ' name="but_google" id="but_google2" onload="" '; // Facebook icon $fIcon = $this->newObject('geticon', 'htmlelements'); $fIcon->setIcon('facebook'); $fIcon->alt = "FB ID"; $fIcon->extra = ' name="but_fb" id="but_fb" onload="" '; $FB_AUTH_PAGE = $this->uri(array("action" => "initfacebooklogin", 'auth_site' => 'facebook'), "security"); // Yahoo icon $yIcon = $this->newObject('geticon', 'htmlelements'); $yIcon->setIcon('yahoo'); $yIcon->alt = "Yahoo ID"; $yIcon->extra = ' name="but_yahoo" id="but_yahoo" onload="" '; //Twitter icon $tIcon = $this->newObject('geticon', 'htmlelements'); $tIcon->setIcon('twitter', 'png'); $tIcon->alt = "TWITTER ID"; $tIcon->extra = ' name="but_twitter" id="but_twitter" onload="" '; $TWITTER_AUTH_PAGE = $this->uri(array("action" => "dotwitterlogin", 'auth_site' => 'twitter'), "security"); $TWITTER_AUTH_PAGE = str_replace("&", "&", $TWITTER_AUTH_PAGE); $openidloginlink = new link($this->uri(array("action" => "openidconnect"), "security")); $openidloginlink->link = '<h3>' . $this->objLanguage->languageText('mod_security_oauthheading', 'security') . '</h3>'; $sitePath = $objAltConfig->getSitePath(); // A google login icon linked to OpenID login with gooogle id. $googleTD = '<a href="' . $OPENID_AUTH_PAGE . '&auth_site=google" target="_top">' . $gIcon->show() . '</a>'; // A Yahoo login icon linked to OpenId login with Yahoo ID. $yahooTD = '<a href="' . $OPENID_AUTH_PAGE . '&auth_site=yahoo" target="_top">' . $yIcon->show() . '</a>'; // Facebook login icon with link to login page. $fbTD = '<a href="' . $FB_AUTH_PAGE . '" target="_top">' . $fIcon->show() . '</a>'; // Twitter login icon with link to login page. $twitterTD = '<a href="' . $TWITTER_AUTH_PAGE . '" target="_top">' . $tIcon->show() . '</a>'; //$twitterTD = NULL; <--- uncomment for commit until TWITTER AUTH is fixed // Explanation text for the textbox and Choose button $explainBox = '<div class="oid_explain">' . $this->objLanguage->languageText('mod_security_openidexplainbox', 'security') . '</div>'; // Title for the fieldset. $title = '<h3>' . $this->objLanguage->languageText('mod_security_openidlogintitle', 'security') . '</h3>'; $allowOpenIdForm = FALSE; if ($allowOpenIdForm) { // Allow login via any Open ID url, use mainly for testing. $openIdForm = new form('openlogiidnform', $this->uri(array("action" => "openidconnect", "auth_site" => "openid"))); $objInput = new textinput('openIDField', '', 'text', '30'); $objInput->extra = 'maxlength="255"'; $openIdForm->addToForm($explainBox . $objInput->show()); // The login via provided open ID URL button $openIdButton = new button('submit', $this->objLanguage->languageText("mod_security_openidlogin", 'security')); // Add the login icon $openIdButton->setIconClass("user"); // Set the button type to submit $openIdButton->setToSubmit(); $openIdForm->addToForm($openIdButton->show()); $opForm = '<hr/><br/>' . $openIdForm->show(); } else { $opForm = NULL; } $openIdFields = new fieldset(); $openIdFields->setLegend('<h3>' . $title . '</h3>'); $openIdFields->addContent($this->objLanguage->languageText('mod_security_oidliinstr', 'security', 'Login with one of the accounts indicated by the icons below')); $openIdFields->addContent('<hr>'); $openIdFields->addContent($fbTD . ' ' . $twitterTD . ' ' . $googleTD . ' ' . $yahooTD . ' ' . $opForm); $openidlink = '<div class="openidlogin">' . $openIdFields->show() . "</div>"; } $objFields->addContent($ldap . '<br />' . $rem . $box . "<div class='loginbuttonwrap'>" . $objButton->show() . '</div>' . $fb); $notice = $this->objLanguage->languageText('mod_security_forgotpassword'); $helpText = strtoupper($this->objLanguage->languageText('mod_security_helpmelogin', 'security', 'Yes, please help me to login')); $resetLink = new Link($this->uri(array('action' => 'needpassword'), 'security')); $resetLink->link = $helpText; // the help link $p = '<br />' . $notice . '<br/>' . $resetLink->show() . '<br />'; $objFields->addContent($p); $objForm->addToForm($objFields->show()); return $objForm->show() . $openidlink; } catch (Exception $e) { customException::cleanUp(); } }