/**
  *
  * Method to display the user image
  * 
  * @access public
  * @return string $string The html string for display 
  */
 public function showUserImage()
 {
     $updateLabel = $this->objLanguage->languageText('phrase_updateimage', 'system', 'ERROR: phrase_updateimage');
     $errorTitleLabel = $this->objLanguage->languageText('word_error', 'system', 'ERROR: word_error');
     $successTitleLabel = $this->objLanguage->languageText('word_success', 'system', 'ERROR: word_success');
     $successLabel = $this->objLanguage->languageText('mod_userdetails_userimagechanged', 'userdetails', 'ERROR: mod_userdetails_userimagechanged');
     $errorNoFileLabel = $this->objLanguage->languageText('mod_userdetails_imagedoesnotexist', 'userdetails', 'ERROR: mod_userdetails_imagedoesnotexist');
     $errorNoImageLabel = $this->objLanguage->languageText('mod_userdetails_noimageprovided', 'userdetails', 'ERROR: mod_userdetails_noimageprovided');
     $errorNotImageLabel = $this->objLanguage->languageText('mod_userdetails_filenotimage', 'userdetails', 'ERROR: mod_userdetails_filenotimage');
     $objSelectFile = $this->newObject('selectimage', 'filemanager');
     $objSelectFile->name = 'imageselect';
     $objSelectFile->restrictFileList = array('jpg', 'gif', 'png', 'jpeg', 'bmp');
     $image = $objSelectFile->show();
     $objButton = new button('update', $updateLabel);
     $objButton->setId('update_image');
     $updateButton = $objButton->show();
     $objForm = new form('user_image', $this->uri(array('action' => 'ajaxChangeImage'), 'userdetails'));
     $objForm->extra = ' enctype="multipart/form-data"';
     $objForm->addToForm($image . '<br />' . $updateButton);
     $imageForm = $objForm->show();
     $string = $imageForm;
     $this->objDialog = $this->newObject('dialog', 'jquerycore');
     $this->objDialog->setCssId('dialog_imagechanged');
     $this->objDialog->setTitle(ucwords($successTitleLabel));
     $this->objDialog->setCloseOnEscape(FALSE);
     $this->objDialog->setContent('<span class="success">' . $successLabel . '</span>');
     $this->objDialog->setAutoOpen(FALSE);
     $this->objDialog->setOpen("jQuery('.ui-dialog-titlebar-close').hide();");
     $dialog = $this->objDialog->show();
     $this->objDialog = $this->newObject('dialog', 'jquerycore');
     $this->objDialog->setCssId('dialog_nopicturegiven');
     $this->objDialog->setTitle(ucwords($errorTitleLabel));
     $this->objDialog->setCloseOnEscape(FALSE);
     $this->objDialog->setContent('<span class="error">' . $errorNoImageLabel . '</span>');
     $this->objDialog->setAutoOpen(FALSE);
     $this->objDialog->setOpen("jQuery('.ui-dialog-titlebar-close').hide();");
     $dialog .= $this->objDialog->show();
     $this->objDialog = $this->newObject('dialog', 'jquerycore');
     $this->objDialog->setCssId('dialog_imagedoesnotexist');
     $this->objDialog->setTitle(ucwords($errorTitleLabel));
     $this->objDialog->setCloseOnEscape(FALSE);
     $this->objDialog->setContent('<span class="error">' . $errorNoFileLabel . '</span>');
     $this->objDialog->setAutoOpen(FALSE);
     $this->objDialog->setOpen("jQuery('.ui-dialog-titlebar-close').hide();");
     $dialog .= $this->objDialog->show();
     $this->objDialog = $this->newObject('dialog', 'jquerycore');
     $this->objDialog->setCssId('dialog_fileisnotimage');
     $this->objDialog->setTitle(ucwords($errorTitleLabel));
     $this->objDialog->setCloseOnEscape(FALSE);
     $this->objDialog->setContent('<span class="error">' . $errorNotImageLabel . '</span>');
     $this->objDialog->setAutoOpen(FALSE);
     $this->objDialog->setOpen("jQuery('.ui-dialog-titlebar-close').hide();");
     $dialog .= $this->objDialog->show();
     return $string . $dialog;
 }
 /**
  *
  * 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();
     }
 }