/** * * Method to show the user selectable grades * * @acces public * @return VOID */ public function showGrades() { $selectGradeLabel = $this->objLanguage->code2Txt('mod_grades_grade', 'grades', NULL, 'ERROR: mod_grades_grade'); $selectLabel = $this->objLanguage->languageText('word_select', 'system', 'ERROR: word_select'); $successTitleLabel = $this->objLanguage->languageText('word_success', 'system', 'ERROR: word_success'); $successLabel = $this->objLanguage->code2Txt('mod_userdetails_gradesuccess', 'userdetails', NULL, 'ERROR: mod_userdetails_gradesuccess'); $errorTitleLabel = $this->objLanguage->languageText('word_error', 'system', 'ERROR: word_error'); $errorLabel = $this->objLanguage->code2Txt('mod_userdetails_gradeerror', 'userdetails', NULL, 'ERROR: mod_userdetails_gradeerror'); $grades = $this->objDBgrades->getAll(); $userGroups = $this->objGroups->getUserGroups($this->objUser->userId()); $name = NULL; if (!empty($userGroups)) { foreach ($userGroups as $group) { foreach ($grades as $grade) { if ($group['group_define_name'] == $grade['name']) { $name = $grade['name']; break; break; } } } } $objDrop = new dropdown('new_name'); $objDrop->addFromDB($grades, 'name', 'name'); $objDrop->setSelected($name); $gradeDrop = $objDrop->show(); $objInput = new textinput('old_name', $name, 'hidden', '50'); $nameInput = $objInput->show(); $objButton = new button('select', $selectLabel); $objButton->setId('grade_select'); $selectButton = $objButton->show(); $objTable = new htmltable(); $objTable->cellpadding = '4'; $objTable->startRow(); $objTable->addCell('<b>' . ucfirst(strtolower($selectGradeLabel)) . ': </b>', '', '', '', '', '', ''); $objTable->endRow(); $objTable->startRow(); $objTable->addCell($nameInput . $gradeDrop, '', '', '', '', '', ''); $objTable->endRow(); $objTable->startRow(); $objTable->addCell($selectButton, '', '', '', '', '', ''); $objTable->endRow(); $gradeTable = $objTable->show(); $objForm = new form('user', $this->uri(array('action' => 'change_grade'))); $objForm->extra = ' enctype="multipart/form-data"'; $objForm->addToForm($gradeTable); $gradeForm = $objForm->show(); $string = $gradeForm; $this->objDialog = $this->newObject('dialog', 'jquerycore'); $this->objDialog->setCssId('dialog_grade_success'); $this->objDialog->setTitle(ucwords($successTitleLabel)); $this->objDialog->setCloseOnEscape(FALSE); $this->objDialog->setContent('<span class="success">' . $successLabel . '</span>'); $this->objDialog->setAutoOpen(FALSE); $this->objDialog->setOpen("jQuery('.ui-dialog-titlebar-close').hide();"); $dialog = $this->objDialog->show(); $this->objDialog = $this->newObject('dialog', 'jquerycore'); $this->objDialog->setCssId('dialog_grade_error'); $this->objDialog->setTitle(ucwords($errorTitleLabel)); $this->objDialog->setCloseOnEscape(FALSE); $this->objDialog->setContent('<span class="error">' . $errorLabel . '</span>'); $this->objDialog->setAutoOpen(FALSE); $this->objDialog->setOpen("jQuery('.ui-dialog-titlebar-close').hide();"); $dialog .= $this->objDialog->show(); return $string . $dialog; }
$objTextInput = new textinput('id', $id); $objTextInput->fldType = "hidden"; $objFmTable->addCell($objTextInput->show(), NULL, "top", "left"); } else { $objFmTable->addCell($id, NULL, "top", "left"); $language = ""; if ($action != 'translate') { $parentId = ""; } } $objFmTable->endRow(); //Create a dropdown for the category selector $objCat = new dropdown('category_selector'); $objCat->extra = " onchange=\"document.forms['storyinput'].category.value=document.forms['storyinput'].category_selector.value;\""; $objCat->addOption("", "Clear input"); $objCat->addFromDB($car, 'title', 'category', $category); //Add a row for the category $objFmTable->startRow(); $objFmTable->addCell($objLanguage->languageText("word_category") . ": ", NULL, "top", "right"); $objTextInput = new textinput('category', $category); $objTextInput->extra = 'readonly="READONLY"'; $objForm->addRule('category', $objLanguage->languageText("mod_stories_val_catnotnull", "stories"), 'required'); $objFmTable->addCell($objTextInput->show() . " " . $objCat->show(), NULL, "top", "left"); $objFmTable->endRow(); //Add a row for the language $objFmTable->startRow(); $objFmTable->addCell($objLanguage->languageText("word_language") . ": ", NULL, "top", "right"); $objTextInput = new textinput('language', $language); $objTextInput->extra = 'readonly="READONLY"'; $objForm->addRule(array('name' => 'language', 'length' => 2), $objLanguage->languageText("mod_stories_val_lang2chargt", "stories"), 'maxlength'); $objForm->addRule('language', $objLanguage->languageText("mod_stories_val_langnotnull", "stories"), 'required');
/** * 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; }
/** * Short description for function * * Long description (if any) ... * * @return void * @access public */ function showForms() { //Text Input $objForm = new form('testform'); $url = $this->uri(array('action' => 'add'), 'htmlelements'); $objForm->setAction($this->uri(array('action' => 'save'), 'htmlelements')); $objForm->setDisplayType(2); $objElement = new textinput('textbox'); $objElement->setValue('Some text'); $objElement->label = 'Textbox\'s label'; $text = $objElement->show() . '<br />'; $objForm->addToForm('<span class="warning">Start of Form</span><br />'); $objForm->addToForm($objElement); //Calendar /*$objElement = new calendar('cal'); $today = getdate(); $objElement->setDate($today['mon'],$today['mday'],$today['year']); $calendar = $objElement->show().'<br />';*/ //Radion button Group $objElement = new radio('sex_radio'); $objElement->addOption('m', 'Male'); $objElement->addOption('f', 'Female'); $objElement->addOption('n', 'Seaweed'); $objElement->setSelected('f'); $radio = $objElement->show() . '<br />'; //Check boxes $objElement = new checkbox('m', 'Male', true); $check = $objElement->show(); $objElement = new checkbox('f', 'Female'); $check .= $objElement->show(); $objElement = new checkbox('n', 'Seawood'); $check .= $objElement->show() . '<br />'; //Dropdown $objElement = new dropdown('sex_dropdown'); $objElement->addOption('', ''); //adding a blank option $objElement->addOption('m', 'Male'); $objElement->addOption('f', 'Female'); $objElement->addOption('n', 'Seaweed'); $objElement->setSelected('f'); $dropdown = $objElement->show() . "<br />"; //Dropdown created from array $objElement = new dropdown('user_dropdown'); $objElement->addFromDB($this->objDBUser->getAll(), 'username', 'userid', $this->objDBUser->userName()); $objElement->label = 'User list'; $dropdown .= $objElement->show() . "<br />"; //Textarea $objElement = new textarea('text_area'); $objElement->setRows(3); $objElement->setColumns('45'); $objElement->setContent('This is some content for the textarea'); $ta = $objElement->show() . '<br />'; //Button $objElement = new button('mybutton'); $objElement->setValue('Normal Button'); $objElement->setOnClick('alert(\'An onclick Event\')'); $button = $objElement->show() . '<br />'; //Submit Button $objElement = new button('mybutton'); $objElement->setToSubmit(); $objElement->label = 'Buttons Label'; $objElement->setValue('Submit Button'); $submit = $objElement->show() . '<br />'; //add submit button to the form; $objForm->addToForm($objElement); $mouseoverpopup = new mouseoverpopup('this is some text'); $mouseoverpopup = $mouseoverpopup->show(); //Add all the above to a tabbedbox $objElement = new tabbedbox(); $objElement->addTabLabel('Tabbed box 1'); $objElement->addBoxContent($mouseoverpopup . $text . $dropdown . $button . $submit); $tab = '<br />' . $objElement->show() . '<br />'; //add the tab to the form $objForm->addToForm($objElement); $objForm->addToForm('<span class="warning">End of Form</span>'); $form = $objForm->show() . '<br />'; //create a multitabbedbox $objElement = new multitabbedbox('100px', '500px'); $objElement->addTab(array('name' => 'First', 'url' => 'http://localhost', 'content' => $form, 'default' => true)); $objElement->addTab(array('name' => 'Second', 'url' => 'http://localhost', 'content' => $check . $radio)); $objElement->addTab(array('name' => 'Third', 'url' => 'http://localhost', 'content' => $tab, 'height' => '300px', 'width' => '600px')); //$objElement->addTab(array('name'=>'Test Validation','url'=>'http://localhost','content' => $this->valFormShow(),'height' => '300','width' => '700')); //set layers $left = $tab; $content = 'This is an example using most of the classes in the htmlelements module<br />'; $content .= '<br />' . $objElement->show(); //this to make the centre layer strech downwards for ($i = 0; $i < 10; $i++) { $content .= '<br />'; } $right = $tab; $bottom = $ta; $this->setVar('left', $left); $this->setVar('right', $right); $this->setVar('content', $content); $this->setVar('bottom', $bottom); //return $str; }