Example #1
0
$objForm->addRule('category', $catMiss, 'required');
//Set the value of the element to $category
if (isset($category)) {
    $objCat->setValue($category);
}
//Create label for the input of title
$titLabel = new label($this->objLanguage->languageText("word_title"), "input_title");
//Create an element for the input of title
$objTit = new textinput("title");
$titMiss = $this->objLanguage->languageText('mod_storycategory_titmiss', "storycategoryadmin");
$objForm->addRule('title', $titMiss, 'required');
//Set the width
$objTit->size = 70;
//Set the value of the element to $title
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
 /**
  * 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();
 }
Example #3
0
$ciplabel = new label($this->objLanguage->languageText('mod_cache_ip', 'cache') . ':', 'input_ip');
$ip = new textinput('ip');
$ip->extra = ' style="width:50%;" ';
if (isset($cache['ip'])) {
    $ip->setValue(htmlentities($cache['ip'], ENT_QUOTES));
}
$cadd->addCell($ciplabel->show());
$cadd->addCell($ip->show());
$cadd->endRow();
//Port
$cadd->startRow();
$plabel = new label($this->objLanguage->languageText('mod_cache_port', 'cache') . ':', 'input_port');
$port = new textinput('port');
$port->extra = ' style="width:50%;" ';
if (isset($cache['port'])) {
    $port->setValue($cache['port']);
}
$cadd->addCell($plabel->show());
$cadd->addCell($port->show());
$cadd->endRow();
//end off the form and add the buttons
$this->objCButton = new button($this->objLanguage->languageText('word_save', 'system'));
$this->objCButton->setValue($this->objLanguage->languageText('word_save', 'system'));
$this->objCButton->setToSubmit();
$cfieldset->addContent($cadd->show());
$cform->addToForm($cfieldset->show());
$cform->addToForm($this->objCButton->show());
$cform = $cform->show();
$this->objIcon = $this->getObject('geticon', 'htmlelements');
if (class_exists('Memcache')) {
    $memcache = new Memcache();
Example #4
0
} else {
    // We are adding.
    if (isset($pname)) {
        $objElement->setValue($pname);
    }
    $txtToShow = $objElement->show();
}
//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
Example #5
0
 /**
  * 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;
 }