public function searchForm()
 {
     $this->loadClass('form', 'htmlelements');
     $this->loadClass('textinput', 'htmlelements');
     $this->loadClass('button', 'htmlelements');
     $form = new form('searchfile', $this->uri(array('action' => 'search')));
     $textinput = new textinput('filesearch');
     $button = new button('submitsearch', 'Search');
     $button->setToSubmit();
     $form->addToForm($textinput->show() . ' ' . $button->show());
     return $form->show();
 }
 /**
  * Method to display the navigation
  */
 public function show()
 {
     $str = '';
     $heading = new htmlheading();
     $heading->type = 2;
     $heading->str = ucwords($this->objLanguage->code2Txt('mod_contextadmin_name', 'contextadmin', NULL, '[-context-] Admin'));
     $str = $heading->show();
     $str .= '<ul id="nav-secondary">';
     $mycoursesLink = new link($this->uri(NULL));
     $mycoursesLink->link = ucwords($this->objLanguage->code2Txt('phrase_mycourses', 'system', NULL, 'My [-contexts-]'));
     $str .= '<li>' . $mycoursesLink->show() . '</li>';
     $objUser = $this->getObject('user', 'security');
     if ($objUser->isAdmin() || $objUser->isLecturer()) {
         $createCourse = new link($this->uri(array('action' => 'add')));
         $createCourse->link = ucwords($this->objLanguage->code2Txt('mod_contextadmin_createcontext', 'contextadmin', NULL, 'Create [-context-]'));
         $str .= '<li>' . $createCourse->show() . '</li>';
     }
     $str .= '</ul>';
     $heading = new htmlheading();
     $heading->type = 3;
     $heading->str = ucwords($this->objLanguage->code2Txt('mod_contextadmin_searchforcontext', 'contextadmin', NULL, 'Search for [-context-]'));
     $str .= '<br />' . $heading->show();
     $form = new form('searchform', $this->uri(array('action' => 'search')));
     $form->method = 'GET';
     $module = new hiddeninput('module', $this->getParam('module', 'contextadmin'));
     $action = new hiddeninput('action', 'search');
     $textinput = new textinput('search', $this->getParam('search'));
     $button = new button('searchbutton', $this->objLanguage->languageText('word_search', 'system', 'Search'));
     $button->setToSubmit();
     $form->addToForm($module->show() . $action->show() . $textinput->show() . $button->show());
     $str .= $form->show();
     $heading = new htmlheading();
     $heading->type = 3;
     $heading->str = ucwords($this->objLanguage->code2Txt('phrase_browsecourses', 'system', NULL, 'Browse [-contexts-]'));
     $str .= $heading->show();
     $str .= $this->getAlphaListingTable();
     return $str;
 }
示例#3
0
if (isset($title)) {
    $objTit->setValue($title);
}
//Create an instance of the fieldset object
$objFieldset = $this->getObject('fieldset', 'htmlelements');
$objFieldset->legend = $fieldsetLabel;
$objFieldset->contents = "<table><tr><td align=\"right\">" . $catLabel->show() . ": </td><td>" . $objCat->show() . "</td></tr>" . "<tr><td align=\"right\">" . $titLabel->show() . ": </td><td>" . $objTit->show() . "</td></tr></table>";
//Add the fieldset to the form
$objForm->addToForm($objFieldset->show());
// Create an instance of the button object
$this->loadClass('button', 'htmlelements');
// Create a submit button
$objElement = new button('submit');
$objElement->setIconClass("save");
// Set the button type to submit
$objElement->setToSubmit();
// Use the language object to add the word save
$objElement->setValue(' ' . $this->objLanguage->languageText("word_save") . ' ');
// Create cancel button
$objCancel = new button('cancel');
$objCancel->setIconClass("cancel");
$objCancel->setOnClick("window.location='" . $this->uri(NULL) . "';");
$objCancel->setValue(' ' . $this->objLanguage->languageText("mod_storycategoryadmin_cancel", "storycategoryadmin") . ' ');
// Add the button to the form
$objForm->addToForm('<br/>' . $objElement->show() . "&nbsp;" . $objCancel->show());
//Add the heading to the layer
$this->objH = $this->getObject('htmlheading', 'htmlelements');
$this->objH->type = 1;
//Heading <h1>
$this->objH->str = $objLanguage->code2txt("mod_storycategoryadmin_title", "storycategoryadmin");
$rightSideColumn = $this->objH->show();
 /**
  * Method to render an add form to a template
  *
  * @param string $module The module to add the parameter
  */
 function showEditAddForm($pmodule)
 {
     //Create a form
     $formAction = $this->uri(array('action' => 'save'));
     //Load the form class
     $this->loadClass('form', 'htmlelements');
     //Create and instance of the form class
     $objForm = new form('sysconfig');
     //Set the action for the form to the uri with paramArray
     $objForm->setAction($formAction);
     //Set the displayType to 3 for freeform
     $objForm->displayType = 3;
     //Create a heading for the title
     //$objHd = $this->newObject('htmlheading', 'htmlelements');
     //Load the textinput class
     $this->loadClass('textinput', 'htmlelements');
     //Load the label class
     $this->loadClass('label', 'htmlelements');
     //Load the dropdown class
     //Kevin Cyster
     $this->loadClass('dropdown', 'htmlelements');
     //Create an element for the input of module
     $objElement = new textinput("pmodule");
     //Set the value of the element to $module
     if (isset($pmodule)) {
         $objElement->setValue($pmodule);
     }
     //Create label for input of module
     $label = new label($this->objLanguage->languageText("mod_sysconfig_modtxt", 'sysconfig'), "input_pmodule");
     $objForm->addToForm("<p><strong>" . $this->objLanguage->languageText("mod_sysconfig_modtxt", 'sysconfig') . "</strong>: " . $pmodule . "</p>");
     //Get the pk value
     $id = $this->getParam('id');
     //Get the records for editing
     $ar = $this->objDbSysconfig->getRow('id', $id, 'tbl_sysconfig_properties');
     //Get the two values needed
     if (isset($ar)) {
         $pname = $ar['pname'];
         $pvalue = $ar['pvalue'];
     } else {
         $pname = $this->getParam('id', NULL);
         $pvalue = $this->getParam('value', NULL);
     }
     #if
     //Create an element for the input of id
     $objElement = new textinput("id");
     $objElement->fldType = "hidden";
     $objElement->setValue($id);
     $objForm->addToForm($objElement->show());
     //Create an element for the input of id
     $objElement = new textinput("pmodule");
     $objElement->fldType = "hidden";
     $objElement->setValue($pmodule);
     $objForm->addToForm($objElement->show());
     //Add the $name element to the form
     $objForm->addToForm('<p><b>' . $this->objLanguage->languageText("mod_sysconfig_paramname", 'sysconfig') . '</b>: ' . $pname . '</p>');
     // Check in Config folder if module is gives as _site_
     if ($pmodule == '_site_') {
         $moduleToCheck = 'config';
     } else {
         $moduleToCheck = $pmodule;
     }
     // Load object that checks if class exists
     $checkobject = $this->getObject('checkobject', 'utilities');
     // Check if class 'sysconfig_{pname}' exists in module.
     if ($checkobject->objectFileExists('sysconfig_' . str_replace('/', '_', str_replace('-', '_', $pname)), $moduleToCheck)) {
         // If yes, instantiate the object
         $objParamValue = $this->getObject(strtolower('sysconfig_' . str_replace('/', '_', str_replace('-', '_', $pname))), $moduleToCheck);
         // send it the current default value
         $objParamValue->setDefaultValue($pvalue);
     } else {
         $valueLabel = new label($this->objLanguage->languageText("mod_sysconfig_paramvalue", 'sysconfig'), "input_pvalue");
         //Add the $value element to the form
         $objForm->addToForm("<b>" . $valueLabel->show() . "</b>: ");
         //Create an element for the input of value
         $objParamValue = new textinput("pvalue");
         $objParamValue->size = "50";
         //Set the value of the element to $value
         if (isset($pvalue)) {
             $objParamValue->setValue($pvalue);
         }
         #if
     }
     //Create text add link
     $objForm->addToForm($objParamValue->show() . "<br /><br />");
     // Create an instance of the button object and add a save button to the form
     $this->loadClass('button', 'htmlelements');
     // Create a submit button
     $objElement = new button('submit');
     // Set the button type to submit
     $objElement->setToSubmit();
     // Use the language object to add the word save
     $objElement->setValue(' ' . $this->objLanguage->languageText("word_save") . ' ');
     // Add the button to the form
     $objForm->addToForm('<br/>' . $objElement->show());
     //Add the form
     return $objForm->show();
 }
示例#5
0
$objTable->startRow();
$objTable->addCell($objLabel->show());
$objTable->addCell($closeField);
$objTable->endRow();
/*
  $objElement = new checkbox('studentsonly', '', true);  // this will checked
  $check = $objElement->show();
  $objTable->addRow(array(
  $userOptLabel,
  $check
  )); */
$objContextModules = $this->getObject('dbcontextmodules', 'context');
$objModules = $this->getObject('modules', 'modulecatalogue');
$contextModules = $objContextModules->getContextModules($contextCode);
$plugins = $objModules->getListContextPlugins();
$dropDown = new dropdown('moduleid');
//$dropDown->addOption('all','All');
foreach ($plugins as $plugin) {
    $dropDown->addOption($plugin['module_id'], $plugin['title']);
}
if ($action == 'showuseractivitybymodule') {
    $objTable->addRow(array('<b>' . $selectModuleLabel . '</b>', $dropDown->show()));
}
$saveLabel = "View";
$objButton = new button('save', $saveLabel);
$objButton->setToSubmit();
$btnSave = $objButton->show();
$objForm = new form('showuseractivity', $this->uri(array('action' => $action)));
$objForm->addToForm($objTable->show());
$objForm->addToForm($btnSave);
echo $objForm->show();
 /**
  * Method to generate an edit context settings form
  * @param array $context Current Context Settings
  * @return str
  */
 public function editContextForm($context)
 {
     $header = new htmlheading();
     $header->type = 1;
     $header->str = $this->objLanguage->languageText('word_edit', 'system', 'Edit') . ': ' . $context['title'];
     $str = $header->show();
     $title = new textinput('title');
     $title->size = 50;
     if ($context != NULL) {
         $title->value = htmlentities($context['title']);
     }
     $titleLabel = new label($this->objLanguage->languageText('word_title', 'system', 'Title'), 'input_title');
     $status = new dropdown('status');
     //$status->setBreakSpace('<br />');
     $status->addOption('Published', $this->objLanguage->languageText('word_published', 'system', 'Published'));
     $status->addOption('Unpublished', $this->objLanguage->languageText('word_unpublished', 'system', 'Unpublished'));
     if ($context != NULL) {
         $status->setSelected($context['status']);
     }
     if ($this->objSysConfig->getValue('context_access_private_only', 'context', 'false') == 'true') {
         if (is_null($context)) {
             $access_ = 'Private';
         } else {
             $access_ = $context['access'];
         }
         $access = new hiddeninput('access', $access_);
     } else {
         $access = new radio('access');
         $access->setBreakSpace('<br />');
         $access->addOption('Public', '<strong>' . $this->objLanguage->languageText('word_public', 'system', 'Public') . '</strong> - <span class="caption">' . ucfirst($this->objLanguage->code2Txt('mod_context_publiccontextdescription', 'context', NULL, '[-context-] can be accessed by all users, including anonymous users')) . '</span>');
         $access->addOption('Open', '<strong>' . $this->objLanguage->languageText('word_open', 'system', 'Open') . '</strong> - <span class="caption">' . ucfirst($this->objLanguage->code2Txt('mod_context_opencontextdescription', 'context', NULL, '[-context-] can be accessed by all users that are logged in')) . '</span>');
         $access->addOption('Private', '<strong>' . $this->objLanguage->languageText('word_private', 'system', 'Private') . '</strong> - <span class="caption">' . $this->objLanguage->code2Txt('mod_context_privatecontextdescription', 'context', NULL, 'Only [-context-] members can enter the [-context-]') . '<span class="caption">');
         if ($context != NULL) {
             $access->setSelected($context['access']);
         } else {
             $access->setSelected('Public');
         }
     }
     $table = $this->newObject('htmltable', 'htmlelements');
     if ($context != NULL) {
         $table->startRow();
         $table->addCell(ucwords($this->objLanguage->code2Txt('mod_context_contextcode', 'context', NULL, '[-context-] Code')) . ':', 100);
         $table->addCell('<strong>' . $context['contextcode'] . '</strong>');
         $table->endRow();
     } else {
         $code = new textinput('contextcode');
         $codeLabel = new label(ucwords($this->objLanguage->code2Txt('mod_context_contextcode', 'context', NULL, '[-context-] Code')), 'input_contextcode');
         $table->startRow();
         $table->addCell($codeLabel->show(), 100);
         $table->addCell($code->show() . ' <span id="contextcodemessage"></span>');
         $table->endRow();
     }
     $table->startRow();
     $table->addCell($titleLabel->show() . ':');
     $table->addCell($title->show());
     $table->endRow();
     $table->startRow();
     $table->addCell('&nbsp;');
     $table->addCell('&nbsp;');
     $table->endRow();
     $table->startRow();
     $table->addCell($this->objLanguage->languageText('word_status', 'system', 'Status') . ':');
     $table->addCell($status->show());
     $table->endRow();
     if ($this->objSysConfig->getValue('context_access_private_only', 'context', 'false') == 'false') {
         $table->startRow();
         $table->addCell($this->objLanguage->languageText('word_access', 'system', 'Access') . ':');
         $table->addCell($access->show());
         $table->endRow();
     }
     $alerts = explode("|", $context['alerts']);
     $emailAlert = new checkbox('emailalertopt', $this->objLanguage->languageText('mod_contextadmin_emailalert', 'contextadmin', 'Email alerts'), $alerts[0] == 'e' || $alerts[0] == '1');
     // this will checked
     //$alerts=array();
     //$emailchecked=;
     //$emailAlert->setChecked(FALSE);
     //if($emailchecked) {
     //    $emailAlert->setChecked($emailchecked);
     //}
     $table->startRow();
     $table->addCell($this->objLanguage->languageText('mod_contextadmin_emailalert', 'contextadmin', 'Alerts'));
     $table->addCell($emailAlert->show());
     $table->endRow();
     $objSelectImage = $this->getObject('selectimage', 'filemanager');
     $objSelectImage->context = TRUE;
     $table2 = $this->newObject('htmltable', 'htmlelements');
     $table2->startRow();
     $table2->addCell($table->show(), 600, NULL, NULL, NULL, 'colspan="2"');
     $table2->addCell($objSelectImage->show());
     $table2->endRow();
     $table2->startRow();
     $table2->addCell('&nbsp;');
     $table2->addCell('&nbsp;');
     $table2->addCell('&nbsp;');
     $table2->endRow();
     $table2->startRow();
     $table2->addCell(ucwords($this->objLanguage->code2Txt('mod_context_aboutcontext', 'context', NULL, 'About [-context-]')) . ':', 100);
     $htmlEditor = $this->newObject('htmlarea', 'htmlelements');
     $htmlEditor->name = 'about';
     $htmlEditor->toolbarSet = 'advanced';
     if ($context != NULL) {
         $htmlEditor->value = $context['about'];
     }
     $table2->addCell($htmlEditor->show(), NULL, NULL, NULL, NULL, 'colspan="2"');
     $table2->endRow();
     $table2->startRow();
     $table2->addCell('&nbsp;');
     $table2->addCell('&nbsp;');
     $table2->addCell('&nbsp;');
     $table2->endRow();
     $table2->startRow();
     $table2->addCell('&nbsp;', 100);
     if ($context == NULL) {
         $button = new button('savecontext', $formButton);
     } else {
         $button = new button('savecontext', ucwords($this->objLanguage->code2Txt('mod_context_updatecontext', 'context', NULL, 'Update [-context-]')));
     }
     $button->setToSubmit();
     $table2->addCell($button->show(), NULL, NULL, NULL, NULL, 'colspan="2"');
     $table2->endRow();
     $form = new form('createcontext', $this->uri(array('action' => $this->formAction), $this->formModule));
     $form->addToForm($table2->show());
     if ($this->objSysConfig->getValue('context_access_private_only', 'context', 'false') == 'true') {
         $form->addToForm($access->show());
     }
     if ($context != NULL) {
         $hiddenInput = new hiddeninput('contextcode', $context['contextcode']);
         $form->addToForm($hiddenInput->show());
     }
     $form->addRule('title', $this->objLanguage->code2Txt('mod_context_entertitleofcontext', 'context', NULL, 'Please enter the title of your [-context-]'), 'required');
     $str .= $form->show();
     return $str;
 }
示例#7
0
        $objButtonMove = new button('movefiles', $this->objLanguage->languageText('mod_filemanager_moveselecteditems', 'filemanager'));
        $objButtonMove->setToSubmit();
        $move = $this->objLanguage->languageText('mod_filemanager_moveto', 'filemanager') . ':&nbsp;' . $folderTree . '&nbsp;' . $objButtonMove->show() . '&nbsp;';
    } else {
        $move = '';
    }
    $button = new button('submitform', $this->objLanguage->languageText('mod_filemanager_deleteselecteditems', 'filemanager', 'Delete Selected Items'));
    $button->setToSubmit();
    // Set Ability to create symlinks to nothing - default no ability
    $symlink = '';
    // Check ability to create symlinks
    if ($this->contextCode != '' && $this->getParam('context') != 'no' && substr($folder['folderpath'], 0, 7) != 'context') {
        $folderPermission = $this->objFolders->checkPermissionUploadFolder('context', $this->contextCode);
        if ($folderPermission) {
            $symlinkButton = new button('symlinkcontext', $this->objLanguage->code2Txt('mod_filemanager_attachtocontext', 'filemanager', NULL, 'Attach to [-context-]'));
            $symlinkButton->setToSubmit();
            $symlink = '&nbsp;' . $symlinkButton->show();
        }
    }
    $selectallbutton = new button('selectall', $this->objLanguage->languageText('phrase_selectall', 'system', 'Select All'));
    $selectallbutton->setOnClick("javascript:SetAllCheckBoxes('movedeletefiles', 'files[]', true);");
    $deselectallbutton = new button('deselectall', $this->objLanguage->languageText('phrase_deselectall', 'system', 'Deselect all'));
    $deselectallbutton->setOnClick("javascript:SetAllCheckBoxes('movedeletefiles', 'files[]', false);");
    $form->addToForm($move . $button->show() . $symlink . '&nbsp;' . $selectallbutton->show() . '&nbsp;' . $deselectallbutton->show());
    $folderInput = new hiddeninput('folder', $folderId);
    $form->addToForm($folderInput->show());
    $folderContent .= $form->show();
} else {
    $folderContent .= $table;
}
if ($folderPermission2) {
示例#8
0
 /**
  * Short description for function
  *
  * Long description (if any) ...
  *
  * @param  unknown $folderId Parameter description (if any) ...
  * @return object  Return description (if any) ...
  * @access public
  */
 function showCreateFolderForm($folderId)
 {
     $folderPath = $this->getFolderPath($folderId);
     if ($folderPath == FALSE) {
         return '';
     }
     $folderParts = explode('/', $folderPath);
     $form = new form('createfolder', $this->uri(array('action' => 'createfolder')));
     $label = new label('Create a subfolder in: ', 'input_parentfolder');
     $form->addToForm($label->show() . '<br/>' . $this->getTree($folderParts[0], $folderParts[1], 'htmldropdown', $folderId));
     $textinput = new textinput('foldername');
     $label = new label('Name of Folder: ', 'input_foldername');
     $form->addToForm('<br/>' . $label->show() . '<br/>' . $textinput->show() . '&nbsp;');
     $button = new button('create', 'Create Folder');
     $button->setToSubmit();
     $form->addToForm('<br/>' . $button->show());
     return $form->show();
 }
示例#9
0
 /**
  * Method to get a list of contexts.
  * The method returns a dropdown list of contexts in which the user is registered.
  */
 function showDropDown()
 {
     $objForm = $this->newObject('form', 'htmlelements');
     $objButton = $this->newObject('button', 'htmlelements');
     $objDropDown = $this->newObject('dropdown', 'htmlelements');
     $go = $this->objLanguage->languageText('word_go');
     $objDropDown = new dropdown('context_dropdown');
     $objDropDown->cssClass = 'coursechooser';
     $contexts = $this->objManageGroups->userContextCodes();
     if (!empty($contexts)) {
         foreach ($contexts as $code) {
             $menu = $this->objDBContext->getMenuText($code);
             $objDropDown->addOption($code, $menu);
         }
         $objDropDown->extra = 'onchange="document.enter.submit();"';
         // submit button
         $objButton = new button('go', $go);
         $objButton->setToSubmit();
         // Build form
         $objForm->form('enter', $this->uri(array('action' => 'joincontext'), 'context'));
         $objForm->addToForm($objDropDown->show());
         $objForm->addToForm($objButton->show());
         return $objForm->show();
     }
     return FALSE;
 }
示例#10
0
 /**
  * Short description for function
  *
  * Long description (if any) ...
  *
  * @return void
  * @access public
  */
 function valFormShow()
 {
     //I am not using multilingualized text for the examples
     $objForm = new form('testform');
     $objForm->setAction($this->uri(array('action' => 'valform'), 'htmlelements'));
     $objForm->setDisplayType(2);
     $name = new textinput('name');
     $name->label = 'Name(must be filled out)';
     $objForm->addRule('name', 'Please enter your name', 'required');
     $surname = new textinput('surname');
     $surname->label = 'Surname (must be less than 15 characters)';
     $objForm->addRule(array('name' => 'surname', 'length' => 15), 'Your surname is too long', 'maxlength');
     $email = new textinput('email');
     $email->label = 'Email (must be a valid email address)';
     $objForm->addRule('email', 'Not a valid Email', 'email');
     $pwd = new textinput('pwd');
     $pwd->label = 'Password ';
     $pwd->fldType = 'password';
     $pwd2 = new textinput('pwd2');
     $pwd2->label = 'Retype password (must be the same as "Password" case sensitive)';
     $pwd2->fldType = 'password';
     $objForm->addRule(array('pwd', 'pwd2'), 'Password did not match', 'compare');
     $age = new textinput('age');
     $age->label = 'Age (must be older than 18)';
     $objForm->addRule(array('name' => 'age', 'minnumber' => 18), 'You have to be older than 18', 'minnumber');
     $colour = new textinput('colour');
     $colour->label = 'Favourate Colour (must be between 3 and 15 characters inclusive)';
     $objForm->addRule(array('name' => 'colour', 'lower' => 3, 'upper' => 10), 'must be between 3 and 10 characters inclusive', 'rangelength');
     $sentence = new textinput('sentence');
     $sentence->label = 'Sentence (must contain no punctuation) not working yet';
     $car = new textinput('car');
     $car->label = 'Favourate Car (must contain only alphabetic characters)';
     $objForm->addRule('car', 'Must contain letters of the alphabet', 'letteronly');
     $monitor = new textinput('monitor');
     $monitor->label = 'Favourate Monitor (must contain only alphanumeric characters)';
     $objForm->addRule('monitor', 'Must contain letters of the alphabet and valid numbers', 'alphanumeric');
     $birthday = new textinput('birthday');
     $birthday->label = 'Birthday (mm/dd/yyy) not working yet';
     $sex = new radio('sex_radio');
     $sex->addOption('m', 'Male');
     $sex->addOption('f', 'Female');
     $sex->addOption('n', 'Seaweed');
     //$objForm->addRule('sex_radio','Please select your sex','select');
     $save = new button('save');
     $save->setToSubmit();
     $save->setValue('Save');
     $objForm->addToForm($name);
     $objForm->addToForm($surname);
     $objForm->addToForm($email);
     $objForm->addToForm($pwd);
     $objForm->addToForm($pwd2);
     $objForm->addToForm($age);
     $objForm->addToForm($sentence);
     $objForm->addToForm($colour);
     $objForm->addToForm($car);
     $objForm->addToForm($monitor);
     $objForm->addToForm($birthday);
     //$objForm->addToForm($sex);
     $objForm->addToForm($save);
     $this->setVar('left', "");
     $this->setVar('right', '');
     $this->setVar('content', $objForm->show());
     $this->setVar('bottom', '');
 }
示例#11
0
 /**
  * Method to get the about form
  * @return string
  * @param string $contextCode
  * @access public
  */
 public function getAboutForm($contextCode = '')
 {
     if (empty($contextCode)) {
         $contextCode = $this->_objDBContext->getContextCode();
     }
     //add step 1 template
     $objH = new htmlheading();
     $objForm = new form();
     $inpContextCode = new textinput();
     $inpMenuText = new textinput();
     $inpAbout = $this->newObject('htmlarea', 'htmlelements');
     $inpButton = new button();
     $objH->str = $this->_objLanguage->code2Txt("mod_context_aboutthecontext", 'context', array('context' => 'Course'));
     $objH->type = 3;
     //setup the form
     $objForm->name = 'addfrm';
     $objForm->action = $this->uri(array('action' => 'saveaboutedit'));
     //$objForm->extra = 'class="f-wrap-1"';
     $objForm->displayType = 3;
     $inpAbout->name = 'about';
     $inpAbout->id = 'about';
     $inpAbout->value = '';
     $contextLine = $this->_objDBContext->getRow('contextcode', $this->_objDBContext->getContextCode());
     $inpAbout->setContent($contextLine['about']);
     //$inpAbout->cssClass = 'f-comments';
     $inpButton->setToSubmit();
     $inpButton->cssClass = 'f-submit';
     $inpButton->value = $this->_objLanguage->languageText("word_save");
     //validation
     //$objForm->addRule('about','About is a required field!', 'required');
     //$objForm->addToForm('<div class="req"><b>*</b> Indicates required field</div>');
     //$objForm->addToForm('<fieldset>');
     $objForm->addToForm($objH->show());
     //$objForm->addToForm('</fieldset><b><span class="req">*</span>About:</b>');
     $objForm->addToForm($inpAbout->show());
     $objForm->addToForm('<div class="f-submit-wrap">' . $inpButton->show() . '<br /></div>');
     return $objForm->show() . '<br/>';
     //return $inpAbout->show();
 }
示例#12
0
$hTable = $this->newObject('htmltable', 'htmlelements');
$hTable->startRow();
$hTable->addCell($objH->show(), null, null, 'left');
$hTable->addCell($srchStr->show(), null, 'bottom', 'right');
$hTable->endRow();
$hTable->startRow();
$hTable->addCell(null, null, null, 'left');
$hTable->addCell($srch, null, 'top', 'right');
$hTable->endRow();
$searchForm->addToForm($hTable->show());
$this->appendArrayVar('headerParams', "<script type='text/javascript' src='core_modules/modulecatalogue/resources/remote.js'></script>");
$objSelectFile = new textinput('archive', null, 'file', 30);
$uploadSize = new textinput('MAX_FILE_SIZE', '8000000', 'hidden');
$fButton = new button('bupload', $this->objLanguage->languageText('word_upload'));
//,"javascript:uploadArchive($('form_fupload').archive.value,'$moduleId');");
$fButton->setToSubmit();
$objUForm = new form('fupload', $this->uri(array('action' => 'uploadarchive', 'cat' => $activeCat)));
$objUForm->extra = 'enctype="multipart/form-data"';
$objUForm->addToForm($uploadSize->show());
$objUForm->addToForm($objSelectFile->show());
$objUForm->addToForm($fButton->show());
$objUploadTable = $this->newObject('htmlTable', 'htmlelements');
$objUploadTable->startRow();
$objUploadTable->addCell('&nbsp;');
$objUploadTable->addCell($this->objLanguage->languageText('mod_modulecatalogue_uploadmod', 'modulecatalogue') . "<br />" . $objUForm->show(), null, null, 'right');
$objUploadTable->endRow();
if ($modules && $missingModules) {
    $remoteEx = new htmlHeading();
    $remoteEx->type = 4;
    $remoteEx->str = $this->objLanguage->languageText('mod_modulecatalogue_rpcex', 'modulecatalogue');
    $remote = $remoteEx->show() . "<br />" . $objUploadTable->show() . $objRemoteTable->show();
 /**
  * Method to show the interface for overwriting files
  */
 public function showUserOverwiteInterface()
 {
     $userId = $this->objUser->userId();
     $tempFiles = $this->objFile->getTemporaryFiles($userId);
     $form = new form('fixtempfiles', $this->uri(array('action' => 'fixtempfiles')));
     $divider = '';
     $splitter = '';
     $listItems = '';
     $submitButton = new button('submitform', 'Update Files');
     $submitButton->setToSubmit();
     $objHighlightLabels = $this->getObject('highlightlabels', 'htmlelements');
     $objHighlightLabels->show();
     $formatsize = new formatfilesize();
     foreach ($tempFiles as $file) {
         //$form->addToForm($divider);
         //$divider = '<hr size="1" width="70%" />';
         $listItems .= $splitter . $file['id'];
         $splitter = '|';
         // Rename Id of the button to keep them unique
         $submitButton->cssId = 'input_button_' . $file['id'];
         $originalFile = $this->objFile->getOriginalFile($file['filename'], $userId);
         $form->addToForm('<h2>' . $file['filename'] . '</h2>');
         $table = $this->newObject('htmltable', 'htmlelements');
         $table->startHeaderRow();
         $table->addHeaderCell('Info', '20%');
         $table->addHeaderCell('Old File', '40%');
         $table->addHeaderCell('New File', '40%');
         $table->endHeaderRow();
         if ($originalFile['category'] == 'images') {
             $oldThumbnail = $this->objFileEmbed->embed($this->objThumbnails->getThumbnail($originalFile['id'], $originalFile['filename']), 'image');
             $newThumbnail = $this->objFileEmbed->embed($this->objThumbnails->getThumbnail($file['id'], $file['filename']), 'image');
             // File Preview
             $table->startRow();
             $table->addCell('File Preview');
             $table->addCell($oldThumbnail);
             $table->addCell($newThumbnail);
             $table->endRow();
         } else {
             $oldThumbnail = 'gdsgsd';
             $newThumbnail = 'gdsgsd';
         }
         // File Size
         $table->startRow();
         $table->addCell('Size of File');
         $table->addCell($formatsize->formatsize($originalFile['filesize']));
         $table->addCell($formatsize->formatsize($file['filesize']));
         $table->endRow();
         // Date Uploaded
         $table->startRow();
         $table->addCell('Date Uploaded');
         $table->addCell($this->objFormatDateTime->formatDateOnly($originalFile['datecreated']) . ' at ' . $this->objFormatDateTime->formatTime($originalFile['timecreated']));
         $table->addCell($this->objFormatDateTime->formatDateOnly($file['datecreated']) . ' at ' . $this->objFormatDateTime->formatTime($file['timecreated']));
         $table->endRow();
         $form->addToForm($table->show());
         $form->addToForm('<h4>Options:</h4>');
         $radio = new radio($file['id']);
         $radio->setBreakSpace('<br />');
         $radio->addOption('ignore', 'Ignore this file for the time being');
         $radio->addOption('overwrite', 'Overwrite old file with new one');
         $radio->addOption('deletetemp', 'Delete the Temporary File');
         $extension = $this->objFileParts->getExtension($file['filename']);
         if (strlen($extension) == strlen($file['filename'])) {
             $filename = $file['filename'];
             $extension = '';
         } else {
             $filename = substr($file['filename'], 0, strlen($file['filename']) - strlen($extension) - 1);
             $extension = '.' . $extension;
         }
         $textinput = new textinput('rename__' . $file['id'], $filename);
         $textinput->size = 50;
         $extensioninput = new textinput('extension__' . $file['id'], $extension);
         $extensioninput->size = 5;
         $extensioninput->extra = ' readonly="true"';
         // Fix Up - Highlight Radio Button
         //$textinput->extra = ' onclick="document.getElementById(\'input_gen19Srv1Nme34_247ignore\').focus();"; ';
         //$radio->addOption('rename', 'Rename the temporary file to: ');
         $radio->setSelected('ignore');
         //$form->addToForm($radio->show().$textinput->show().$extensioninput->show());
         $form->addToForm($radio->show());
         $form->addToForm('<p align="center">' . $submitButton->show() . '</p>');
     }
     $hiddenInput = new hiddeninput('listitems', $listItems);
     $form->addToForm($hiddenInput->show());
     return $form->show();
 }
 /**
  * Method to process Error Upload Messages
  * @return string Confirmation message of error uploads
  */
 public function processOverwriteMessages()
 {
     if ($this->getParam('overwrite') == '') {
         $overwriteMessage = '';
     } else {
         $items = explode('__', $this->getParam('overwrite'));
         $overwriteMessage = '';
         $table = $this->newObject('htmltable', 'htmlelements');
         $table->startHeaderRow();
         $table->addHeaderCell('Filename');
         $table->addHeaderCell('File Size of Existing File', NULL, NULL, 'center');
         $table->addHeaderCell('File Size of New File', NULL, NULL, 'center');
         $table->addHeaderCell('Overwrite File?', NULL, NULL, 'center');
         $table->endHeaderRow();
         $actualItems = array();
         $formatsize = new formatfilesize();
         foreach ($items as $item) {
             // Get File Details
             $file = $this->objFiles->getFile($item);
             // Generate Path to File
             $tempFilePath = $this->objConfig->getcontentBasePath() . '/filemanager_tempfiles/' . $item;
             // Create Boolean Variable - does file exist
             if (file_exists($tempFilePath)) {
                 $tempFileExists = TRUE;
             } else {
                 $tempFileExists = FALSE;
             }
             // If no record
             if ($file == FALSE) {
                 // Delete temp file if it exists
                 if ($tempFileExists && is_file($tempFilePath)) {
                     unlink($tempFilePath);
                 }
             } else {
                 if ($file && $tempFileExists) {
                     // If Record and Temp File exists
                     // Add to Form for User to choose option
                     $actualItems[] = $item;
                     $table->startRow();
                     $table->addCell('<strong>' . $file['filename'] . '</strong>');
                     $table->addCell($formatsize->formatsize($file['filesize']), NULL, NULL, 'center');
                     $table->addCell($formatsize->formatsize(filesize($tempFilePath)), NULL, NULL, 'center');
                     $radio = new radio($item);
                     $radio->addOption('delete', ' No');
                     $radio->addOption('overwrite', ' Yes');
                     $radio->setSelected('delete');
                     $radio->setBreakSpace(' &nbsp; ');
                     $table->addCell($radio->show(), NULL, NULL, 'center');
                     $table->endRow();
                 }
             }
         }
         if (count($actualItems) > 0) {
             $form = new form('overwriteoptions', $this->uri(array('action' => 'fixtempfiles')));
             $form->addToForm($table->show());
             $list = '';
             $separator = '';
             foreach ($actualItems as $itemId) {
                 $list .= $separator . $itemId;
                 $separator = '__';
             }
             $hiddenInput = new hiddeninput('listitems', $list);
             $form->addToForm($hiddenInput->show());
             $overMsg = $this->objLanguage->languageText('mod_filemanager_overwriteconfirm', 'filemanager', 'Do you wish to overwrite?');
             $button = new button('submitform', $overMsg);
             $button->setToSubmit();
             $form->addToForm($button->show());
             $overwriteMessage = $form->show();
         }
     }
     return $overwriteMessage;
 }
 /**
  * Standard block show method. 
  */
 public function show()
 {
     // Get all user contents
     $contexts = $this->objUserContext->getUserContext($this->objUser->userId());
     if (count($contexts) == 0) {
         return $this->objLanguage->code2Txt('mod_context_youdonotbelongtocontexts', 'context', NULL, 'You do not belong to any [-contexts-]');
     } else {
         $form = new form('joincontext', $this->uri(array('action' => 'joincontext'), 'context'));
         $dropdown = new dropdown('contextcode');
         $contextArray = array();
         foreach ($contexts as $contextCode) {
             $contextDetails = $this->objContext->getContextDetails($contextCode);
             //check if this course is unpublished
             if ($contextDetails["status"] == "Unpublished") {
                 //if so check if this person is lecturer lecturer of the course
                 $groupId = $this->objGroups->getLeafId(array($contextCode, 'Lecturers'));
                 $ret = $this->objGroups->isGroupMember($this->objUser->userId(), $groupId);
                 if ($ret) {
                     $contextArray[$contextDetails['title']] = $contextCode;
                 }
             } else {
                 $contextArray[$contextDetails['title']] = $contextCode;
             }
         }
         if (count($contextArray) < 1) {
             return $this->objLanguage->code2Txt('mod_context_youdonotbelongtocontexts', 'context', NULL, 'You do not belong to any [-contexts-]');
         }
         ksort($contextArray);
         foreach ($contextArray as $title => $code) {
             $dropdown->addOption($code, $title);
         }
         $dropdown->setSelected($this->objContext->getContextCode());
         $button = new button('submitform', ucwords($this->objLanguage->code2Txt('mod_context_entercourse', 'context', NULL, 'Enter [-context-]')));
         $button->setToSubmit();
         $form->addToForm($dropdown->show() . '<br />' . $button->show());
         return $form->show();
     }
 }
 /**
  * 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("&amp;", "&", $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 . '&nbsp;' . $twitterTD . '&nbsp;' . $googleTD . '&nbsp;' . $yahooTD . '&nbsp;' . $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();
     }
 }
 /**
  *
  * Method to generate the html for the form template
  * 
  * @access public
  * @return string $string The html string to be sent to the template 
  */
 public function showMain()
 {
     if ($this->check) {
         $userArray = $this->objDBusers->getUser($this->userId);
     } else {
         $userArray = $this->objUserAdmin->getUserDetails($this->userId);
     }
     $titleValue = $userArray['title'];
     $firstNameValue = $userArray['firstname'];
     $lastNameValue = $userArray['surname'];
     $genderValue = $userArray['sex'];
     $countryValue = $userArray['country'];
     $emailAddressValue = $userArray['emailaddress'];
     $contactNumberValue = $userArray['cellnumber'];
     $userId = $userArray['userid'];
     $passwordValue = NULL;
     $confirmPasswordValue = NULL;
     if ($this->check) {
         $middleNameValue = $userArray['middle_name'];
         $dayValue = !empty($userArray['date_of_birth']) ? date('j', strtotime($userArray['date_of_birth'])) : NULL;
         $monthValue = !empty($userArray['date_of_birth']) ? date('n', strtotime($userArray['date_of_birth'])) : NULL;
         $yearValue = !empty($userArray['date_of_birth']) ? date('Y', strtotime($userArray['date_of_birth'])) : NULL;
         if (!empty($userArray['address'])) {
             $address = explode('|', $userArray['address']);
             $addressOneValue = $address[0];
             $addressTwoValue = $address[1];
         } else {
             $addressOneValue = NULL;
             $addressTwoValue = NULL;
         }
         $cityValue = $userArray['city'];
         $stateValue = $userArray['state'];
         $postalCodeValue = $userArray['postal_code'];
         $schoolIdValue = $userArray['school_id'];
         $schoolArray = $this->objDBschools->getSchool($schoolIdValue);
         $schoolValue = $schoolArray['name'];
         $descriptionValue = $userArray['description'];
     } else {
         $staffNumberValue = $userArray['staffnumber'];
     }
     $errors = $this->getSession('errors');
     $titleValue = !empty($errors) ? $errors['data']['title'] : $titleValue;
     $firstNameValue = !empty($errors) ? $errors['data']['first_name'] : $firstNameValue;
     $lastNameValue = !empty($errors) ? $errors['data']['last_name'] : $lastNameValue;
     $genderValue = !empty($errors) ? $errors['data']['gender'] : $genderValue;
     $countryValue = !empty($errors) ? $errors['data']['country'] : $countryValue;
     $emailAddressValue = !empty($errors) ? $errors['data']['email_address'] : $emailAddressValue;
     $contactNumberValue = !empty($errors) ? $errors['data']['contact_number'] : $contactNumberValue;
     $passwordValue = !empty($errors) ? $errors['data']['password'] : $passwordValue;
     $confirmPasswordValue = !empty($errors) ? $errors['data']['confirm_password'] : $confirmPasswordValue;
     $titleError = !empty($errors) && array_key_exists('title', $errors['errors']) ? $errors['errors']['title'] : NULL;
     $firstNameError = !empty($errors) && array_key_exists('first_name', $errors['errors']) ? $errors['errors']['first_name'] : NULL;
     $lastNameError = !empty($errors) && array_key_exists('last_name', $errors['errors']) ? $errors['errors']['last_name'] : NULL;
     $genderError = !empty($errors) && array_key_exists('gender', $errors['errors']) ? $errors['errors']['gender'] : NULL;
     $emailAddressError = !empty($errors) && array_key_exists('email_address', $errors['errors']) ? $errors['errors']['email_address'] : NULL;
     $passwordError = !empty($errors) && array_key_exists('password', $errors['errors']) ? $errors['errors']['password'] : NULL;
     if ($this->check) {
         $middleNameValue = !empty($errors) ? $errors['data']['middle_name'] : $middleNameValue;
         $dayValue = !empty($errors) ? $errors['data']['date_of_birth'][0] : $dayValue;
         $monthValue = !empty($errors) ? $errors['data']['date_of_birth'][1] : $monthValue;
         $yearValue = !empty($errors) ? $errors['data']['date_of_birth'][2] : $yearValue;
         $addressOneValue = !empty($errors) ? $errors['data']['address'][0] : $addressOneValue;
         $addressTwoValue = !empty($errors) ? $errors['data']['address'][1] : $addressTwoValue;
         $cityValue = !empty($errors) ? $errors['data']['city'] : $cityValue;
         $stateValue = !empty($errors) ? $errors['data']['state'] : $stateValue;
         $postalCodeValue = !empty($errors) ? $errors['data']['postal_code'] : $postalCodeValue;
         $schoolIdValue = !empty($errors) ? $errors['data']['school_id'] : $schoolIdValue;
         if (!is_null($schoolIdValue)) {
             $schoolArray = $this->objDBschools->getSchool($schoolIdValue);
             $schoolValue = $schoolArray['name'];
         }
         $descriptionValue = !empty($errors) ? $errors['data']['description'] : $descriptionValue;
         $schoolError = !empty($errors) && array_key_exists('school_id', $errors['errors']) ? $errors['errors']['school_id'] : NULL;
         $dateOfBirthError = !empty($errors) && array_key_exists('date_of_birth', $errors['errors']) ? $errors['errors']['date_of_birth'] : NULL;
         $addressError = !empty($errors) && array_key_exists('address', $errors['errors']) ? $errors['errors']['address'] : NULL;
         $cityError = !empty($errors) && array_key_exists('city', $errors['errors']) ? $errors['errors']['city'] : NULL;
         $stateError = !empty($errors) && array_key_exists('state', $errors['errors']) ? $errors['errors']['state'] : NULL;
         $postalCodeError = !empty($errors) && array_key_exists('postal_code', $errors['errors']) ? $errors['errors']['postal_code'] : NULL;
         $descriptionError = !empty($errors) && array_key_exists('description', $errors['errors']) ? $errors['errors']['description'] : NULL;
     }
     $titleLabel = $this->objLanguage->languageText('word_title', 'system', 'ERROR: word_title');
     $mr = $this->objLanguage->languageText('title_mr', 'system', 'TITLE: title_mr');
     $miss = $this->objLanguage->languageText('title_miss', 'system', 'TITLE: title_miss');
     $mrs = $this->objLanguage->languageText('title_mrs', 'system', 'TITLE: title_mrs');
     $ms = $this->objLanguage->languageText('title_ms', 'system', 'TITLE: title_ms');
     $dr = $this->objLanguage->languageText('title_dr', 'system', 'TITLE: title_dr');
     $rev = $this->objLanguage->languageText('title_rev', 'system', 'TITLE: title_rev');
     $prof = $this->objLanguage->languageText('title_prof', 'system', 'TITLE: title_prof');
     $assocprof = $this->objLanguage->languageText('title_assocprof', 'system', 'TITLE: title_assocprof');
     $sir = $this->objLanguage->languageText('title_sir', 'system', 'TITLE: title_sir');
     $dame = $this->objLanguage->languageText('title_dame', 'system', 'TITLE: title_dame');
     $firstNameLabel = $this->objLanguage->languageText('phrase_firstname', 'system', 'ERROR: phrase_firstname');
     $lastNameLabel = $this->objLanguage->languageText('phrase_lastname', 'system', 'ERROR: phrase_lastname');
     $genderLabel = $this->objLanguage->languageText('word_gender', 'system', 'ERROR: word_gender');
     $maleLabel = $this->objLanguage->languageText('word_male', 'system', 'ERROR: word_male');
     $femaleLabel = $this->objLanguage->languageText('word_female', 'system', 'ERROR: word_female');
     $dateOfBirthLabel = $this->objLanguage->languageText('phrase_dateofbirth', 'system', 'ERROR: phrase_dateofbirth');
     $addressLabel = $this->objLanguage->languageText('word_address', 'system', 'ERROR: word_address');
     $cityLabel = $this->objLanguage->languageText('word_city', 'system', 'ERROR: word_city');
     $stateLabel = $this->objLanguage->languageText('word_state', 'system', 'ERROR: word_state');
     $countryLabel = $this->objLanguage->languageText('word_country', 'system', 'ERROR: word_country');
     $postalCodeLabel = $this->objLanguage->languageText('phrase_postalcode', 'system', 'ERROR: phrase_postalcode');
     $emailAddressLabel = $this->objLanguage->languageText('phrase_emailaddress', 'system', 'ERROR: phrase_emailaddress');
     $contactNumberLabel = $this->objLanguage->languageText('phrase_contactnumber', 'system', 'ERROR: phrase_contactnumber');
     $usernameLabel = $this->objLanguage->languageText('word_username', 'system', 'ERROR: word_username');
     $passwordLabel = $this->objLanguage->languageText('word_password', 'system', 'ERROR: word_password');
     $confirmPasswordLabel = $this->objLanguage->languageText('phrase_confirmpassword', 'system', 'ERROR: phrase_confirmpassword');
     $passwordNotAlike = $this->objLanguage->languageText('mod_userdetails_passwordsnotalike', 'userdetails', 'ERROR: mod_userdetails_passwordsnotalike');
     $updateLabel = $this->objLanguage->languageText('mod_userdetails_updatedetails', 'userdetails', 'ERROR: mod_userdetails_updatedetails');
     $successTitleLabel = $this->objLanguage->languageText('word_success', 'system', 'ERROR: word_success');
     $successImageLabel = $this->objLanguage->languageText('mod_userdetails_userimagereset', 'userdetails', 'ERROR: mod_userdetails_userimagereset');
     $resetLabel = $this->objLanguage->languageText('phrase_resetform', 'system', 'ERROR: phrase_resetform');
     $successDetailsLabel = $this->objLanguage->languageText('mod_userdetails_detailssuccessfullyupdate', 'userdetails', 'ERROR: mod_userdetails_detailssuccessfullyupdate');
     $successPasswordLabel = $this->objLanguage->languageText('mod_userdetails_passwordupdated', 'userdetails', 'ERROR: mod_userdetails_passwordupdated');
     $errorLabel = $this->objLanguage->languageText('word_error', 'system', 'ERROR: word_error');
     $noChangeLabel = $this->objLanguage->languageText('mod_userdetails_nochange', 'userdetails', 'ERROR: mod_userdetails_nochange');
     if ($this->check) {
         $middleNameLabel = $this->objLanguage->languageText('mod_schoolusers_middlename', 'schoolusers', 'ERROR: mod_schoolusers_middlename');
         $schoolLabel = $this->objLanguage->code2Txt('mod_schools_school', 'schools', NULL, 'ERROR: mod_schools_school');
         $descriptionLabel = $this->objLanguage->languageText('mod_schoolusers_aboutyourself', 'schoolusers', 'ERROR: mod_schoolusers_aboutyourself');
     } else {
         $staffNumberLabel = $this->objLanguage->languageText('phrase_staffstudnumber', 'system', 'ERROR: phrase_staffstudnumber');
     }
     $arrayVars = array();
     $arrayVars['password_not_alike'] = $passwordNotAlike;
     // pass password error to javascript.
     $this->objSvars->varsToJs($arrayVars);
     $bizcard = $this->showBizCard();
     $objLayer = new layer();
     $objLayer->id = 'bizcard';
     $objLayer->str = $bizcard;
     $bizcardLayer = $objLayer->show();
     $string = $bizcardLayer;
     // Show the userid so the user has a place to find it
     $uidExplain = $this->objLanguage->languageText('mod_userdetails_uidexplain', 'userdetails', 'Your user ID');
     $objLayer = new layer();
     $objLayer->id = 'userid_exp';
     $objLayer->str = $uidExplain . ": <span class='uid'>" . $userId . "</span>";
     $expLayer = $objLayer->show();
     $string = $string . $expLayer;
     // set up html elements
     $objDrop = new dropdown('title');
     $objDrop->addOption($mr, $mr);
     $objDrop->addOption($miss, $miss);
     $objDrop->addOption($mrs, $mrs);
     $objDrop->addOption($ms, $ms);
     $objDrop->addOption($dr, $dr);
     $objDrop->addOption($rev, $rev);
     $objDrop->addOption($prof, $prof);
     $objDrop->addOption($assocprof, $assocprof);
     $objDrop->addOption($sir, $sir);
     $objDrop->addOption($dame, $dame);
     $objDrop->setSelected($titleValue);
     $titleDrop = $objDrop->show();
     $objInput = new textinput('first_name', $firstNameValue, '', '50');
     $firstNameInput = $objInput->show();
     $objInput = new textinput('last_name', $lastNameValue, '', '50');
     $lastNameInput = $objInput->show();
     $objRadio = new radio('gender');
     $objRadio->addOption('M', $maleLabel);
     $objRadio->addOption('F', $femaleLabel);
     $objRadio->setSelected($genderValue);
     $genderRadio = $objRadio->show();
     $countryDrop = $this->objCountries->countryAlpha($countryValue);
     $objInput = new textinput('email_address', $emailAddressValue, '', '50');
     $emailAddressInput = $objInput->show();
     $objInput = new textinput('contact_number', $contactNumberValue, '', '50');
     $contactNumberInput = $objInput->show();
     $objInput = new textinput('password', $passwordValue, 'password', '50');
     $passwordInput = $objInput->show();
     $objInput = new textinput('confirm_password', $confirmPasswordValue, 'password', '50');
     $confirmPasswordInput = $objInput->show();
     $objButton = new button('update', $updateLabel);
     $objButton->setToSubmit();
     $updateButton = $objButton->show();
     $objButton = new button('reset', $resetLabel);
     $objButton->setToSubmit();
     $resetButton = $objButton->show();
     if ($this->check) {
         $objInput = new textinput('school', $schoolValue, '', '50');
         $schoolInput = $objInput->show();
         $objInput = new textinput('school_id', $schoolIdValue, 'hidden', '');
         $schoolIdInput = $objInput->show();
         $objInput = new textinput('middle_name', $middleNameValue, '', '50');
         $middleNameInput = $objInput->show();
         $day = range(1, 31);
         array_unshift($day, '-');
         $days = array_combine($day, $day);
         $months = array('-' => '-', 1 => 'Jan', 2 => 'Feb', 3 => 'Mar', 4 => 'Apr', 5 => 'May', 6 => 'Jun', 7 => 'Jul', 8 => 'Aug', 9 => 'Sep', 10 => 'Oct', 11 => 'Nov', 12 => 'Dec');
         $year = range(date('Y'), date('Y') - 85);
         array_unshift($year, '-');
         $years = array_combine($year, $year);
         $objDrop = new dropdown('date_of_birth[]');
         $objDrop->extra = 'style="width: auto;"';
         $objDrop->addFromArray($days);
         $objDrop->setSelected($dayValue);
         $dayDrop = $objDrop->show();
         $objDrop = new dropdown('date_of_birth[]');
         $objDrop->extra = 'style="width: auto;"';
         $objDrop->addFromArray($months);
         $objDrop->setSelected($monthValue);
         $monthDrop = $objDrop->show();
         $objDrop = new dropdown('date_of_birth[]');
         $objDrop->extra = 'style="width: auto;"';
         $objDrop->addFromArray($years);
         $objDrop->setSelected($yearValue);
         $yearDrop = $objDrop->show();
         $objInput = new textinput('address[]', $addressOneValue, '', '50');
         $addressOneInput = $objInput->show();
         $objInput = new textinput('address[]', $addressTwoValue, '', '50');
         $addressTwoInput = $objInput->show();
         $objInput = new textinput('city', $cityValue, '', '50');
         $cityInput = $objInput->show();
         $objInput = new textinput('state', $stateValue, '', '50');
         $stateInput = $objInput->show();
         $objInput = new textinput('postal_code', $postalCodeValue, '', '50');
         $postalCodeInput = $objInput->show();
         $objText = new textarea('description', $descriptionValue);
         $descriptionText = $objText->show();
     } else {
         $objInput = new textinput('staffnumber', $staffNumberValue, '', '50');
         $staffNumberInput = $objInput->show();
     }
     $objTable = new htmltable();
     $objTable->cellpadding = '4';
     if ($this->check) {
         $objTable->startRow();
         $objTable->addCell('<b>' . ucfirst(strtolower($schoolLabel)) . ': </b>', '', '', '', '', '', '');
         $objTable->addCell($schoolError . $schoolIdInput . $schoolInput, '', '', '', '', '', '');
         $objTable->endRow();
     }
     $objTable->startRow();
     $objTable->addCell('<b>' . $titleLabel . ': </b>', '200px', '', '', '', '', '');
     $objTable->addCell($titleError . $titleDrop, '', '', '', '', '', '');
     $objTable->endRow();
     $objTable->startRow();
     $objTable->addCell('<b>' . $firstNameLabel . ': </b>', '', '', '', '', '', '');
     $objTable->addCell($firstNameError . $firstNameInput, '', '', '', '', '', '');
     $objTable->endRow();
     if ($this->check) {
         $objTable->startRow();
         $objTable->addCell('<b>' . $middleNameLabel . ': </b>', '', '', '', '', '', '');
         $objTable->addCell($middleNameInput, '', '', '', '', '', '');
         $objTable->endRow();
     }
     $objTable->startRow();
     $objTable->addCell('<b>' . $lastNameLabel . ': </b>', '', '', '', '', '', '');
     $objTable->addCell($lastNameError . $lastNameInput, '', '', '', '', '', '');
     $objTable->endRow();
     if (!$this->check) {
         $objTable->startRow();
         $objTable->addCell('<b>' . $staffNumberLabel . ': </b>', '', '', '', '', '', '');
         $objTable->addCell($staffNumberInput, '', '', '', '', '', '');
         $objTable->endRow();
     }
     $objTable->startRow();
     $objTable->addCell('<b>' . $genderLabel . ': </b>', '', '', '', '', '', '');
     $objTable->addCell($genderError . $genderRadio, '', '', '', '', '', '');
     $objTable->endRow();
     if ($this->check) {
         $objTable->startRow();
         $objTable->addCell('<b>' . $dateOfBirthLabel . ': </b>', '', '', '', '', '', '');
         $objTable->addCell($dateOfBirthError . $dayDrop . ' / ' . $monthDrop . ' / ' . $yearDrop, '', '', '', '', '', '');
         $objTable->endRow();
         $objTable->startRow();
         $objTable->addCell('<b>' . $addressLabel . ': </b>', '', '', '', '', '', '');
         $objTable->addCell($addressError . $addressOneInput, '', '', '', '', '', '');
         $objTable->endRow();
         $objTable->startRow();
         $objTable->addCell('', '', '', '', '', '', '');
         $objTable->addCell($addressTwoInput, '', '', '', '', '', '');
         $objTable->endRow();
         $objTable->startRow();
         $objTable->addCell('<b>' . $cityLabel . ': </b>', '', '', '', '', '', '');
         $objTable->addCell($cityError . $cityInput, '', '', '', '', '', '');
         $objTable->endRow();
         $objTable->startRow();
         $objTable->addCell('<b>' . $stateLabel . ': </b>', '', '', '', '', '', '');
         $objTable->addCell($stateError . $stateInput, '', '', '', '', '', '');
         $objTable->endRow();
     }
     $objTable->startRow();
     $objTable->addCell('<b>' . $countryLabel . ': </b>', '', '', '', '', '', '');
     $objTable->addCell($countryDrop, '', '', '', '', '', '');
     $objTable->endRow();
     if ($this->check) {
         $objTable->startRow();
         $objTable->addCell('<b>' . $postalCodeLabel . ': </b>', '', '', '', '', '', '');
         $objTable->addCell($postalCodeError . $postalCodeInput, '', '', '', '', '', '');
         $objTable->endRow();
     }
     $objTable->startRow();
     $objTable->addCell('<b>' . $emailAddressLabel . ': </b>', '', '', '', '', '', '');
     $objTable->addCell($emailAddressError . $emailAddressInput, '', '', '', '', '', '');
     $objTable->endRow();
     $objTable->startRow();
     $objTable->addCell('<b>' . $contactNumberLabel . ': </b>', '', '', '', '', '', '');
     $objTable->addCell($contactNumberInput, '', '', '', '', '', '');
     $objTable->endRow();
     if ($this->check) {
         $objTable->startRow();
         $objTable->addCell('<b>' . $descriptionLabel . ': </b>', '', '', '', '', '', '');
         $objTable->addCell($descriptionError . $descriptionText, '', '', '', '', '', '');
         $objTable->endRow();
     }
     $objTable->startRow();
     $objTable->addCell('<b>' . $usernameLabel . ': </b>', '', '', '', '', '', '');
     $objTable->addCell('<strong>' . $userArray['username'] . '</strong>', '', '', '', '', '', '');
     $objTable->endRow();
     $objTable->startRow();
     $objTable->addCell('<b>' . $passwordLabel . ': </b>', '', '', '', '', '', '');
     $objTable->addCell($passwordError . $passwordInput, '', '', '', '', '', '');
     $objTable->endRow();
     $objTable->startRow();
     $objTable->addCell('<b>' . $confirmPasswordLabel . ': </b>', '', '', '', '', '', '');
     $objTable->addCell($confirmPasswordInput, '', '', '', '', '', '');
     $objTable->endRow();
     $objTable->startRow();
     $objTable->addCell($updateButton . '&nbsp;' . $resetButton, '', '', '', '', 'colspan="2"', '');
     $objTable->endRow();
     $userTable = $objTable->show();
     $objForm = new form('user', $this->uri(array('action' => 'validate'), 'userdetails'));
     $objForm->extra = ' enctype="multipart/form-data"';
     $objForm->addToForm($userTable);
     $addForm = $objForm->show();
     $string .= '<br />' . $addForm;
     $this->objDialog = $this->newObject('dialog', 'jquerycore');
     $this->objDialog->setCssId('dialog_imagereset');
     $this->objDialog->setTitle(ucwords($successTitleLabel));
     $this->objDialog->setCloseOnEscape(FALSE);
     $this->objDialog->setContent('<span class="success">' . $successImageLabel . '</span>');
     $this->objDialog->setAutoOpen(FALSE);
     $this->objDialog->setOpen("jQuery('.ui-dialog-titlebar-close').hide();");
     $dialog = $this->objDialog->show();
     $success = $this->getSession('success', NULL);
     if (!empty($success)) {
         if (in_array('no change', $success)) {
             $this->objDialog = $this->newObject('dialog', 'jquerycore');
             $this->objDialog->setCssId('dialog_nochange');
             $this->objDialog->setTitle(ucwords($errorLabel));
             $this->objDialog->setCloseOnEscape(FALSE);
             $this->objDialog->setContent('<span class="error">' . $noChangeLabel . '</span>');
             $this->objDialog->setAutoOpen(TRUE);
             $this->objDialog->setOpen("jQuery('.ui-dialog-titlebar-close').hide();");
             $this->objDialog->setBeforeClose('resetSession(this)');
             $dialog .= $this->objDialog->show();
         } else {
             $content = '';
             if (in_array('details', $success)) {
                 $content .= '<span class="success">' . $successDetailsLabel . '</span><br />';
             }
             if (in_array('password', $success)) {
                 $content .= '<span class="success">' . $successPasswordLabel . '</span>';
             }
             $this->objDialog = $this->newObject('dialog', 'jquerycore');
             $this->objDialog->setCssId('dialog_updatesuccess');
             $this->objDialog->setTitle(ucwords($successTitleLabel));
             $this->objDialog->setCloseOnEscape(FALSE);
             $this->objDialog->setContent($content);
             $this->objDialog->setAutoOpen(TRUE);
             $this->objDialog->setOpen("jQuery('.ui-dialog-titlebar-close').hide();");
             $this->objDialog->setBeforeClose('resetSession(this)');
             $dialog .= $this->objDialog->show();
         }
     }
     $string .= $dialog;
     return $string;
 }
示例#18
0
 /**
  *
  * 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();
     }
 }
 /**
  * Standard block show method. 
  */
 public function show()
 {
     try {
         $objContext = $this->getObject('dbcontext', 'context');
         $courses = $objContext->getListOfPublicContext();
         if (count($courses) == 0) {
             $msg = $this->objLanguage->code2Txt('mod_context_nocontexts', 'context');
             return "<span class='noRecordsMessage'>{$msg}</span>";
         } else {
             $form = new form('joincontext', $this->uri(array('action' => 'joincontext'), 'context'));
             $dropdown = new dropdown('contextcode');
             foreach ($courses as $course) {
                 $dropdown->addOption($course['contextcode'], $course['menutext']);
             }
             $dropdown->setSelected($objContext->getContextCode());
             $button = new button('submitform', ucwords($this->objLanguage->code2Txt('mod_context_entercourse', 'context', NULL, 'Enter [-context-]')));
             $button->setToSubmit();
             $form->addToForm($dropdown->show() . '<br />' . $button->show());
             return $form->show();
         }
     } catch (customException $e) {
         customException::cleanUp();
     }
 }
 /**
  * Method to generate a context search form
  */
 public function searchForm()
 {
     $this->loadClass('form', 'htmlelements');
     $this->loadClass('textinput', 'htmlelements');
     $this->loadClass('button', 'htmlelements');
     $this->loadClass('hiddeninput', 'htmlelements');
     $form = new form('contextsearch', $this->uri(array('action' => 'search'), 'context'));
     $form->method = 'GET';
     $module = new hiddeninput('module', 'context');
     $action = new hiddeninput('action', 'search');
     $form->addToForm($module->show() . $action->show());
     $textinput = new textinput('search', $this->getParam('search'));
     $button = new button('searchButton', ucwords($this->objLanguage->code2Txt('mod_context_searchcontext', 'context', NULL, 'Search [-context-]')));
     $button->setIconClass("search");
     $button->setToSubmit();
     $form->addToForm('<p align="center">' . $textinput->show() . '<br />' . $button->show() . '</p>');
     return $form->show();
 }
 /**
  * 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;
 }
 /**
  *  Method to get the dropdown that contains all the public courses
  * @author Wesley Nitsckie
  */
 function getContextDropDown()
 {
     $objModule = $this->newObject('modules', 'modulecatalogue');
     $objDBContext = $this->newObject('dbcontext', 'context');
     $dropdown = $this->newObject('dropdown', 'htmlelements');
     $str = '';
     $frmContext = $this->newObject('form', 'htmlelements');
     $frmContext->name = 'joincontext';
     $frmContext->setAction($this->uri(array('action' => 'joincontext'), 'context'));
     $frmContext->setDisplayType(3);
     $objLeaveButton = $this->getObject('geticon', 'htmlelements');
     $objLeaveButton->setIcon('close');
     $objLeaveButton->alt = $this->objLanguage->languageText("word_leave") . ' ' . $this->objLanguage->languageText("word_course");
     $objLeaveButton->title = $this->objLanguage->languageText("word_leave") . ' ' . $this->objLanguage->languageText("word_course");
     $objLeaveLink = $this->getObject('link', 'htmlelements');
     $objLeaveLink->href = $this->uri(array('action' => 'leavecontext'));
     $objLeaveLink->link = $objLeaveButton->show();
     if ($objModule->checkIfRegistered('', 'context')) {
         // Get Context Code & Title
         $contextObject = $this->getObject('dbcontext', 'context');
         $contextCode = $contextObject->getContextCode();
         $this->loadClass('link', 'htmlelements');
         $contextLink = new link($this->uri(null, 'context'));
         $contextLink->link = $contextObject->getTitle();
         // Set Context Code to 'root' if not in context
         if ($contextCode == '') {
             $contextTitle = $this->objLanguage->languageText('mod_context_lobby');
         } else {
             $contextTitle = $contextLink->show() . ' ' . $objLeaveLink->show();
         }
         $contextTitle = str_replace('{context}', '<strong>' . $contextTitle . '</strong>', $this->objLanguage->languageText('mod_postlogin_currentlyincontext'));
         $str .= '<p>' . $contextTitle . '</p>';
     }
     $dropdown->name = 'contextCode';
     $dropdown->cssClass = 'coursechooser';
     $dropdown->addFromDB($objDBContext->getAll(), 'menutext', 'contextCode', $objDBContext->getContextCode());
     $button = new button();
     $button->setToSubmit();
     $button->setValue($this->objLanguage->languageText('word_go'));
     //mod_context_entercourse
     $frmContext->addToForm($this->objLanguage->languageText('phrase_selectcourse') . ':<br/>');
     $frmContext->addToForm($dropdown->show());
     $frmContext->addToForm($button->show());
     if (count($objDBContext->getAll()) == 0) {
         return NULL;
     } else {
         return $frmContext->show();
     }
 }
示例#23
0
$loHiddenLOCount = $this->newObject('textinput', 'htmlelements');
$loHiddenLOCount->textinput("outcount", $value = $outcomesCount, $type = 'hidden', $size = "10");
//Hidden textinput to store the count of new LO's
$loHiddenLODrops = $this->newObject('textinput', 'htmlelements');
$table->startRow();
$table->addCell('<div id="textBoxes"></div>');
$table->endRow();
//Spacer
$table->startRow();
$table->addCell(Null);
$table->endRow();
//Spacer
$table->startRow();
$table->addCell('<div id="countDiv">' . $loHiddenLOCount->show() . '</div>');
$table->endRow();
$button = new button('savecontext', $formButton);
$button->setToSubmit();
$delButton = new button('deleteoutcomes', $deleteLOButton);
$delButton->setToSubmit();
$form = new form('createcontext', $this->uri(array('action' => $formAction)));
// Fixed Ticket #3128 J C O'Connor
//$backUri = $this->uri(array('action' => 'step2', 'mode' => 'edit', 'contextcode' => $contextCode), 'contextadmin');
$backButton = new button('back', $this->objLanguage->languageText('word_back'));
$backButton->setToSubmit();
$form->addToForm($table->show());
$form->addToForm($backButton->show() . " " . $delButton->show() . " " . $button->show());
$hiddenInput = new hiddeninput('mode', $mode);
$form->addToForm($hiddenInput->show());
$hiddenInput = new hiddeninput('contextCode', $contextCode);
$form->addToForm($hiddenInput->show());
echo $form->show();
示例#24
0
 /**
  * Method to create a dropdown list on interest groups (workgroups).
  * @param string $filter Determines if users should be filtered by context or not (alumni users).
  * @return the html string.
  */
 function joinInterestGroup($filter = 'context')
 {
     // Check if workgroup is registered and active for the context
     $objModule = $this->getObject('modules', 'modulecatalogue');
     $objCondition = $this->getObject('contextcondition', 'contextpermissions');
     ///////////////////+>
     $notaMember = $this->objLanguage->code2Txt('mod_toolbar_notingroup', 'toolbar');
     ///////////////////+>
     $leaveGroup = $this->objLanguage->code2Txt('mod_workgroup_leavegroup', 'workgroup');
     ///////////////////+>
     $join = ucwords($this->objLanguage->code2Txt('mod_toolbar_joingroup', 'toolbar'));
     ////////////////+>
     $notInGroup = $this->objLanguage->code2Txt('phrase_notinworkgroup');
     $inGroup = $this->objLanguage->code2Txt('mod_workgroup_currentlyinworkgroup', 'workgroup');
     $go = $this->objLanguage->languageText('word_go');
     $str = '';
     if ($objModule->checkIfRegistered('workgroup', 'workgroup')) {
         $objDBWorkgroup = $this->getObject('dbworkgroup', 'workgroup');
         $this->objHeading = $this->newObject('htmlheading', 'htmlelements');
         $this->objHeading->str = $join;
         $this->objHeading->type = 4;
         $str = $this->objHeading->show();
         if ($filter == 'context') {
             // Get available workgroups. Lecturers - all in context
             if ($objCondition->isContextMember('Lecturers')) {
                 $workgroups = $objDBWorkgroup->getAll($this->contextcode);
             } else {
                 $workgroups = $objDBWorkgroup->getAllForUser($this->contextcode, $this->objUser->userId());
             }
         } else {
             $workgroups = $objDBWorkgroup->getAllForUser(NULL, $this->objUser->userId());
         }
         // No workgroups are available.
         if (count($workgroups) == 0) {
             $str .= $notaMember;
         } else {
             $workgroupId = $objDBWorkgroup->getWorkgroupId();
             if ($workgroupId == NULL) {
                 $workgroupTitle = '';
                 //"<strong>".$notInGroup."</strong>";
             } else {
                 $objLink = new link($this->uri(null, 'workgroup'));
                 $objLink->link = $objDBWorkgroup->getDescription($workgroupId);
                 $workGroupLink = $objLink->show();
                 $this->objIcon->setIcon('leavecourse');
                 $this->objIcon->alt = $leaveGroup;
                 $this->objIcon->title = $leaveGroup;
                 $objLink = new link($this->uri(array('action' => 'leaveworkgroup'), 'workgroup'));
                 $objLink->link = $this->objIcon->show();
                 $workgroupTitle = $workGroupLink . ' ' . $objLink->show();
                 $workgroupTitle = str_replace('{workgroup}', '<strong>' . $workgroupTitle . '</strong>', $inGroup);
             }
             $str .= '<p>' . $workgroupTitle . '</p>';
             $objForm = new form('joinworkgroup', $this->uri(array('action' => 'joinworkgroup'), 'workgroup'));
             $objForm->setDisplayType(3);
             $dropdown = new dropdown('workgroup');
             $dropdown->cssClass = 'coursechooser';
             $dropdown->addFromDB($workgroups, 'description', 'id', $workgroupId);
             $button = new button('save', $go);
             $button->setToSubmit();
             $objForm->addToForm('<p>' . $dropdown->show() . '</p>');
             $objForm->addToForm('<p>' . $button->show() . '</p>');
             $str .= $objForm->show();
         }
     }
     return $str;
 }
示例#25
0
    $tabContent->addTab(array('name' => $this->objLanguage->languageText('mod_filemanager_embedcode', 'filemanager', 'Embed Code'), 'content' => $embedCode));
}
$fileInfo = $this->objLanguage->languageText('mod_filemanager_fileinfo', 'filemanager', 'File Information');
$fileInfoContent = '<h2>' . $fileInfo . '</h2>' . $this->objFiles->getFileInfoTable($file['id']);
if (array_key_exists('width', $file)) {
    $mediaInfo = $this->objLanguage->languageText('mod_filemanager_mediainfo', 'filemanager', 'Media Information');
    $fileInfoContent .= '<br /><h2>' . $mediaInfo . '</h2>' . $this->objFiles->getFileMediaInfoTable($file['id']);
}
$tabContent->addTab(array('name' => $fileInfo, 'content' => $fileInfoContent));
if ($folderPermission) {
    $fileAccess = $this->getObject("folderaccess", "filemanager");
    $tabContent->addTab(array('name' => $this->objLanguage->languageText('mod_filemanager_access', 'filemanager', 'Access'), 'content' => $fileAccess->createFileAccessControlForm($file['id']) . '<br/>' . $fileAccess->createFileVisibilityForm($file['id'])));
}
echo $tabContent->show();
if ($file['category'] == 'archives' && $file['datatype'] == 'zip') {
    $folderParts = explode('/', $file['filefolder']);
    //getTree($folderType='users', $id, $treeType='dhtml', $selected='')
    //get the archive file id
    $archiveId = $this->getParam('id');
    $form = new form('extractarchive', $this->uri(array('action' => 'extractarchive', 'id' => $archiveId)));
    $form->addToForm($this->objLanguage->languageText('mod_filemanager_extractarchiveto', 'filemanager', 'Extract Archive to') . ': ' . $this->objFolders->getTree($folderParts[0], $folderParts[1], 'htmldropdown', $folderId));
    $button = new button('submitform', $this->objLanguage->languageText('mod_filemanager_extractfiles', 'filemanager', 'Extract Files'));
    $button->setToSubmit();
    $form->addToForm($button->show());
    $hiddeninput = new hiddeninput('file', $file['id']);
    $form->addToForm($hiddeninput->show());
    echo $form->show();
}
// echo '<h3>'.$this->objLanguage->languageText('mod_filemanager_filehistory', 'filemanager', 'File History').'</h3>';
// echo $this->objFiles->getFileHistory($file['id']);
echo '<p><br />' . $link->show() . ' ' . $link2->show() . '</p>';
 /**
  * Standard block show method. It uses the renderform
  * class to render the login box
  */
 public function show()
 {
     $this->loadClass('label', 'htmlelements');
     $this->loadClass('textinput', 'htmlelements');
     $this->loadClass('button', 'htmlelements');
     $this->loadClass('form', 'htmlelements');
     $this->loadClass('htmlheading', 'htmlelements');
     $this->loadClass('link', 'htmlelements');
     $form = new form('elearnlogin', $this->uri(array('action' => 'login'), 'security'));
     $label = new label($this->objLanguage->languageText('word_username', 'system', 'Username') . ':', 'username');
     $form->addToForm($label->show());
     $username = new textinput('username');
     $form->addToForm('<br />' . $username->show());
     $label = new label($this->objLanguage->languageText('word_password', 'system', 'Password') . ':', 'username');
     $form->addToForm('<br />' . $label->show());
     $password = new textinput('password');
     $password->fldType = 'password';
     $form->addToForm('<br />' . $password->show());
     $button = new button('login', $this->objLanguage->languageText('word_login', 'system', 'Login'));
     $button->setToSubmit();
     $form->addToForm('<br />' . $button->show());
     $str = $form->show();
     $str .= '<hr />';
     if ($this->objSysConfig->getValue('elearnlogin_forgotpassword', 'security', 'true') === 'true') {
         // JOC [[ Forgot your password OK
         $header = new htmlheading();
         $header->type = 5;
         $header->str = $this->objLanguage->languageText('mod_security_forgotyourpassword', 'security', 'Forgot your password') . '?';
         $str .= $header->show();
         // JOC [[ Yes, help me login OK
         $link = new link($this->uri(array('action' => 'needpassword')), 'security');
         $link->link = $this->objLanguage->languageText('mod_security_helpmelogin', 'security', 'Yes, help me login');
         $str .= '<p>' . $link->show() . '</p>';
     }
     return $str;
 }
示例#27
0
$this->loadClass('form', 'htmlelements');
//$this->loadClass('textinput','htmlelements');
//$this->loadClass('dropdown','htmlelements');
$this->loadClass('button', 'htmlelements');
//
$form = new form('language', $this->uri(array('action' => 'downloadpo')));
//$textinput = new textinput('langname','');
$dropdown = $this->newObject('dropdown', 'htmlelements');
$dropdown->name = 'langname';
$langs = $this->objLanguage->languagelist();
//echo '<pre>';
//var_dump($langs);
//var_dump($objLanguageCode->iso_639_2_tags->codes);
//echo '</pre>';
foreach ($langs as $lang) {
    $langName = $lang['languagename'];
    //$_langName = strtolower($langName);
    $langCode = 'unknown';
    foreach ($this->objLanguageCode->iso_639_2_tags->codes as $ISO => $language) {
        if ($langName == $language) {
            $langCode = $ISO;
            break;
        }
    }
    $dropdown->addOption($langCode, $langName);
}
$submit = new button('submit', $this->objLanguage->languageText('word_submit'));
$submit->setToSubmit();
$form->addToForm($this->objLanguage->languageText('mod_modulecatalogue_language', 'modulecatalogue') . ' : ' . $dropdown->show());
$form->addToForm('&nbsp;' . $submit->show());
echo $form->show();
 /**
  * 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;
 }
 /**
  *
  * Method to parse the string
  * @param  String $str The string to parse
  * @return The    parsed string
  *                
  */
 public function parse($txt)
 {
     preg_match_all('/\\[LIBRARYSEARCH\\](.*)\\[\\/LIBRARYSEARCH\\]/U', $txt, $results, PREG_PATTERN_ORDER);
     preg_match_all('/\\[LIBRARYSEARCH:(.*?)\\]/', $txt, $results2, PREG_PATTERN_ORDER);
     $counter = 0;
     foreach ($results[1] as $item) {
         $objForm = new form('library_search_form', $this->uri(array('action' => 'search'), 'librarysearch'));
         $searchInput = new textinput('search_key');
         $selectCluster = new dropdown('subject_cluster');
         $selectCluster->addOption('database', 'Database');
         $selectCluster->addOption('books', 'Books');
         $selectCluster->addOption('websites', 'Websites');
         $selectCluster->selected = 'websites';
         // Submit Button
         $button = new button('submit_search', $this->objLanguage->languageText('word_search'));
         $button->setToSubmit();
         $objForm->addToForm($searchInput->show() . ' ');
         $objForm->addToForm($selectCluster->show() . ' ');
         $objForm->addToForm($button->show());
         $replacement = $objForm->show();
         $txt = str_replace($results[0][$counter], $replacement, $txt);
         $counter++;
     }
     return $txt;
 }
 /**
  *
  * Method to generate a form for a site-wide search
  *
  * @param boolean $compact whether or not to use the compact search form for small screens.
  * @return str Search Form
  * @access public
  *
  */
 public function show($compact = FALSE)
 {
     //checking if configuration exist-By Emmanuel Natalis
     if (strtoupper($this->objConfig->getenable_searchBox()) == 'TRUE' && $this->objModules->checkIfRegistered('search')) {
         $slabel = new label($this->objLanguage->languageText('phrase_sitesearch', 'search', 'Site Search') . ':', 'input_search');
         $sform = new form('query', $this->uri(NULL, 'search'));
         //$sform->addRule('searchterm', $this->objLanguage->languageText("mod_blog_phrase_searchtermreq", "blog") , 'required');
         $query = new textinput('search');
         $query->size = 15;
         $objSButton = new button($this->objLanguage->languageText('word_go', 'system'));
         // Add the search icon
         $objSButton->setIconClass("search");
         //$this->objSButton->setValue($this->objLanguage->languageText('mod_skin_find', 'skin'));
         $objSButton->setValue('Find');
         $objSButton->setToSubmit();
         if ($compact) {
             $sform->addToForm($slabel->show() . ' ' . $objSButton->show() . '<br /> ' . $query->show());
         } else {
             $sform->addToForm($slabel->show() . ' ' . $query->show() . ' ' . $objSButton->show());
         }
         $sform = '<div id="search">' . $sform->show() . '</div>';
         return $sform;
     } else {
         return NULL;
     }
 }