示例#1
0
//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();
$rightSideColumn .= $objForm->show();
// Add Left column
$cssLayout->setLeftColumnContent($leftSideColumn);
// Add Right Column
$cssLayout->setMiddleColumnContent($rightSideColumn);
//Output the content to the page
echo $cssLayout->show();
示例#2
0
//Add the $pname element to the form
$objForm->addToForm($pnameLabel->show() . ": " . $txtToShow . "<br />");
//Create label for the input of ptag
$ptagLabel = new label($this->objLanguage->languageText("mod_userparamsadmin_pvalue", 'userparamsadmin'), "input_ptag");
//Create an element for the input of ptag
$objElement = new textinput("ptag");
//Set the value of the element to $ptag
if (isset($ptag)) {
    $objElement->setValue($ptag);
}
//Add the $ptag element to the form
$objForm->addToForm($ptagLabel->show() . ": " . $objElement->show() . "<br />");
$commaWarn = "<div class='warning'>" . $this->objLanguage->languageText("mod_userparams_nocommas", 'userparamsadmin') . "</div>";
$objForm->addToForm($commaWarn);
// 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(array()) . "';");
$objCancel->setValue(' ' . $this->objLanguage->languageText("mod_userparamsadmin_cancel", 'userparamsadmin') . ' ');
// Add the buttons to the form
$objForm->addToForm('<br/>&nbsp;' . $objElement->show() . "&nbsp;" . $objCancel->show());
echo $str . "<div class='standard_form'>" . $objForm->show() . "</div>";
 /**
  * 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();
 }
示例#4
0
 /**
  * Method to add the dropdown for joining or leaving a course.
  */
 function joinContext()
 {
     $objModule = $this->getObject('modules', 'modulecatalogue');
     $contextAdminUtils = $this->getObject('contextadminutils', 'contextadmin');
     $joinCourse = ucwords($this->objLanguage->code2Txt('mod_context_joincontext', 'context', array('context' => 'course')));
     $leaveCourse = ucwords($this->objLanguage->code2Txt('mod_toolbar_leavecontext', 'toolbar'));
     $go = $this->objLanguage->languageText('word_go', 'system');
     $inCourse = $this->objLanguage->languageText('mod_postlogin_currentlyincontext', 'postlogin');
     $str = '';
     if ($objModule->checkIfRegistered('context', 'context')) {
         $header = $joinCourse;
         //The Course that you are currently in
         $this->objIcon->setIcon('leavecourse');
         $this->objIcon->alt = $leaveCourse;
         $this->objIcon->title = $leaveCourse;
         $objLeaveButton = $this->objIcon->show();
         $objLink = new link($this->uri(array('action' => 'leavecontext'), 'context'));
         $objLink->link = $objLeaveButton;
         $objLeaveLink = $objLink->show();
         $contextObject = $this->getObject('dbcontext', 'context');
         $contextcode = $contextObject->getcontextcode();
         $objLink = new link($this->uri(null, 'context'));
         $objLink->link = $this->contextTitle;
         $contextLink = $objLink->show();
         // Set Context Code to 'root' if not in context
         if ($this->contextcode == '') {
             $contextTitle = $this->contextTitle;
         } else {
             $contextTitle = $contextLink . ' ' . $objLeaveLink;
         }
         $contextTitle = str_replace('{context}', '<strong>' . $contextTitle . '</strong>', $inCourse);
         $str .= '<p>' . $contextTitle . '</p>';
         // get number of courses available
         $numberofcontexts = count($this->objContext->getAll());
         // dont show course drop down if no courses are available
         if ($numberofcontexts > 0) {
             $objForm = new form('joincontext', $this->uri(array('action' => 'joincontext'), 'context'));
             $objForm->setDisplayType(3);
             $objDrop = new dropdown('context_dropdown');
             $objDrop->cssClass = 'coursechooser';
             $objDrop->addFromDB($contextAdminUtils->getUserContext(), 'menutext', 'contextcode', $this->contextcode);
             $objButton = new button();
             $objButton->setToSubmit();
             $objButton->setValue($go);
             $objForm->addToForm('<p>' . $objDrop->show() . '</p>');
             $objForm->addToForm('<p>' . $objButton->show() . '</p>');
             $str .= $objForm->show();
         }
         $objFeatureBox = $this->newObject('featurebox', 'navigation');
         $str = $objFeatureBox->show($header, $str);
     }
     return $str;
 }
 /**
  *  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();
     }
 }
示例#6
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', '');
 }
示例#7
0
        $notice = "<span class='error'>{$output}</span>";
    }
    $this->unsetSession('output');
}
$objForm =& new form('batchform', $this->uri(array('action' => $actiontotake, 'cat' => $activeCat), 'modulecatalogue'));
$objForm->displayType = 3;
$objForm->addToForm($notice);
$objForm->addToForm($top);
$objForm->addToForm($objTable->show());
$objForm->addToForm($bot);
$searchForm = new form('searchform', $this->uri(array('action' => 'search', 'cat' => 'all'), 'modulecatalogue'));
$searchForm->displayType = 3;
$srchStr = new textinput('srchstr', $this->getParam('srchstr'), null, '21');
$srchButton = new button('search');
$srchButton->setIconClass("search");
$srchButton->setValue($this->objLanguage->languageText('word_search'));
$srchButton->setToSubmit();
$srchType = new dropdown('srchtype');
$srchType->addOption('name', $this->objLanguage->languageText('mod_modulecatalogue_modname', 'modulecatalogue'));
$srchType->addOption('description', $this->objLanguage->languageText('mod_modulecatalogue_description', 'modulecatalogue'));
$srchType->addOption('both', $this->objLanguage->languageText('word_all'));
$srchType->addOption('tags', $this->objLanguage->languageText('mod_modulecatalogue_tags', 'modulecatalogue'));
$srchType->setSelected($this->getParam('srchtype'));
$srch = $srchType->show() . $srchButton->show();
$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');
 /**
  *
  * 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;
     }
 }