/** * Method to add a grid cell. * * @param object The object action or rule used as the lookup. * @param string The id of the rule or condition to be found. * @param string The class for the row. * * @access public * @author Jonathan Abrahams * @return nothing Inserts new cell into the table. */ function addGridCell($objLookup, $id, $class) { extract($this->_properties); $X = $this->showX($objLookup, $id); $condRule = $this->class == 'condition_rule' && $objLookup->_name == $this->name; $actRule = $this->class == 'action_rule' && $id == $this->name; $cond = $this->class == 'condition' && $id == $this->name; $act = $this->class == 'action' && $objLookup->_name == $this->name; if ($cond || $act || $actRule || $condRule) { $checkbox = new checkbox("List[" . get_class($objLookup) . "][{$objLookup->_name}][{$id}]"); $checkbox->setChecked($X); $X = $checkbox->show(); } else { $X = $X ? "X" : "-"; } $this->objGrid->addCell($X, $colWidth, NULL, 'center', $class); }
$form = new form('updateplugins', $this->uri(array('action' => 'savestep4'))); $table = $this->newObject('htmltable', 'htmlelements'); $objIcon = $this->newObject('geticon', 'htmlelements'); $counter = 0; $newPlugins = array(); foreach ($plugins as $plugin) { $newPlugins[$plugin['title']] = $plugin; } ksort($newPlugins); foreach ($newPlugins as $plugin) { $counter++; $checkbox = new checkbox('plugins[]'); $checkbox->setValue($plugin['module_id']); $checkbox->setId('module_' . $plugin['module_id']); if (in_array($plugin['module_id'], $contextModules)) { $checkbox->setChecked(TRUE); } $objIcon->setModuleIcon($plugin['module_id']); if ($counter % 2 == 1) { $table->startRow(); } $table->addCell($checkbox->show(), 20); $label = new label($objIcon->show(), 'module_' . $plugin['module_id']); $table->addCell($label->show(), 30); $label = new label('<strong>' . $plugin['title'] . '</strong><br />' . $plugin['description'], 'module_' . $plugin['module_id']); $table->addCell($label->show() . '<br /><br />'); if ($counter % 2 == 2) { $table->endRow(); } } if ($counter % 2 == 1) {
/** * Creates form that allows user to enable/disable alerts on folder changes. * These alerts include adding/deleting/renaming and generally any changes on * the file/folder * @param type $id * @return type */ function createAlertsForm($id) { $dbFolder = $this->getObject("dbfolder", "filemanager"); $folder = $dbFolder->getFolder($id); //mod_filemanager_alertchangesonfolder $form = new form('accessform', $this->uri(array('action' => 'setfolderalerts'))); $legend = $this->objLanguage->languageText('mod_filemanager_alerts', 'filemanager'); $objElement = new checkbox('alerts', $this->objLanguage->languageText('mod_filemanager_alertchangesonfolder', 'filemanager'), false); $alertVal = null; if (key_exists("alerts", $folder)) { $alertVal = $folder['alerts']; } $alerts = $alertVal == NULL ? false : $folder['alerts'] == 'y' ? true : false; $objElement->setChecked($alerts); $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()); return $form->show(); }
$table->addCell($showcomment->show() . " *" . $this->objLanguage->languageText('mod_contextadmin_comments', 'contextadmin', 'Enable or Disable users to post comments on page content')); $table->endRow(); $table->startRow(); $table->addCell(' '); $table->addCell(' '); $table->endRow(); if ($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(); } $emailAlert = new checkbox('emailalertopt', $this->objLanguage->languageText('mod_contextadmin_emailalertwhat', 'contextadmin', 'Send email alerts'), true); // this will checked if ($mode == 'add' && is_array($fixup)) { $emailAlert->setChecked($fixup['alerts']); } elseif ($mode == 'add') { $emailAlert->setChecked('0'); } else { if ($mode == 'edit') { $emailAlert->setChecked($context['alerts']); } } $table->startRow(); $table->addCell($this->objLanguage->languageText('mod_contextadmin_emailalert', 'contextadmin', 'Alerts')); $table->addCell($emailAlert->show()); $table->endRow(); $button = new button('savecontext', $this->objLanguage->languageText('mod_contextadmin_gotonextstep', 'contextadmin', 'Go to Next Step')); $button->cssId = 'savebutton'; $button->setToSubmit(); //$table_ = $table->show();
// Context dependent module $objLabel = new label($dependsLabel, 'input_dependsContext'); $objCheck = new checkbox('dependsContext'); $objCheck->setChecked($depends); $objTable->addRow(array($objLabel->show(), $objCheck->show())); // Link Permissions $objHead->str = $linkPermLabel; $objHead->type = 3; $objTable->startRow(); $objTable->addCell($objHead->show(), '', '', '', '', 'colspan="4"'); $objTable->endRow(); // set available to whole site if (!$page) { $objLabel = new label($siteLabel, 'input_site'); $objCheck = new checkbox('site'); $objCheck->setChecked($allSite); $objTable->addRow(array($objLabel->show(), $objCheck->show())); } $objLink = new link('javascript:void(0)'); $objLink->link = $setPermLabel; $objLink->extra = "onclick = \"javascript:window.open('" . $this->uri(array('action' => 'setperm', 'modulename' => $moduleName), '', '', TRUE) . "', 'setperms', 'width=800, height=600, scrollbars')\""; $objTable->startRow(); $objTable->addCell($objLink->show(), '', '', '', '', 'colspan="2"'); $objTable->endRow(); $formElements = ''; // hidden elements: id, module, dependsContext, adminOnly if ($mode == 'edit') { $objInput = new textinput('id', $data['id']); $objInput->fldType = 'hidden'; $formElements .= $objInput->show(); }
/** * Method to generate a form with the * plugin modules on * @param string $contextCode * * @return string */ public function getPluginForm($contextCode = NULL) { if (empty($contextCode)) { $contextCode = $this->_objDBContext->getContextCode(); } $objForm = new form(); $objFormMod = new form(); $objH = new htmlheading(); $inpContextCode = new textinput(); $inpMenuText = new textinput(); $objDBContextParams = $this->newObject('dbcontextparams', 'context'); $featureBox = $this->getObject('featurebox', 'navigation'); //list of modules for this context $arrContextModules = $this->_objContextModules->getContextModules($contextCode); $inpButton = new button(); //setup the form $objForm->name = 'addfrm'; $objForm->action = $this->uri(array('action' => 'savestep3')); $objForm->displayType = 3; $objFormMod->name = 'modfrm'; $objFormMod->action = $this->uri(array('action' => 'savedefaultmod')); $objFormMod->displayType = 1; $inpAbout->name = 'about'; $inpAbout->id = 'about'; $inpAbout->value = ''; $inpAbout->width = '20px'; $inpButton->setToSubmit(); $inpButton->cssClass = 'f-submit'; $inpButton->value = ucwords($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('<div id="resultslist-wrap"><ol>'); $objModuleFile = $this->newObject('modulefile', 'modulecatalogue'); $objModules = $this->newObject('modules', 'modulecatalogue'); $arrModules = $objModules->getModules(2); foreach ($arrModules as $module) { if ($objModuleFile->contextPlugin($module['module_id'])) { $checkbox = new checkbox('mod_' . $module['module_id']); $checkbox->value = $module['module_id']; $checkbox->cssId = 'mod_' . $module['module_id']; $checkbox->name = 'mod_' . $module['module_id']; $checkbox->cssClass = 'f-checkbox'; foreach ($arrContextModules as $arr) { if ($arr['moduleid'] == $module['module_id']) { $checkbox->setChecked(TRUE); break 1; } } $icon = $this->newObject('geticon', 'htmlelements'); $icon->setModuleIcon($module['module_id']); $objForm->addToForm('<ul><dt>' . $checkbox->show() . ' ' . $icon->show() . ' ' . ucwords($this->_objLanguage->code2Txt('mod_' . $module['module_id'] . '_name', $module['module_id'], array('context' => 'Course'))) . '</dt>'); $objForm->addToForm('<dd class="subdued">' . $this->_objLanguage->abstractText($module['description']) . '</dd>'); $objForm->addToForm('</ul>'); } } $objForm->addToForm('</ol></div><div class="f-submit-wrap">' . $inpButton->show() . '</div></fieldset>'); $dropDefaultModule = new dropdown(); $defaultmoduleid = $objDBContextParams->getParamValue($contextCode, 'defaultmodule'); $drop = '<select id="defaultmodule" name="defaultmodule">'; $drop .= '<option value="">' . $this->_objLanguage->languageText("mod_context_setdefaultmodule", 'context') . '</option>'; //$inpButton->value = $this->_objLanguage->languageText("mod_context_setasdefaultmodule",'context'); foreach ($arrContextModules as $mod) { $modInfo = $objModules->getModuleInfo($mod['moduleid']); $drop .= '<option value="' . $mod['moduleid'] . '"'; $drop .= $defaultmoduleid == $mod['moduleid'] ? ' selected="selected" ' : ''; $drop .= '>' . ucwords($modInfo['name']) . '</option>'; } $drop .= '</select>'; $drop = '<div style="width:270px">' . $drop . $inpButton->show() . '</div>'; $objFormMod->addToForm($drop); $objFormMod->addToForm('<span class="subdued">' . $this->_objLanguage->code2Txt("mod_contextadmin_defaultmodhelp", 'context', array('context' => 'Course')) . '</span>'); return $featureBox->show($this->_objLanguage->languageText("mod_context_setdefaultmodule", 'context'), $objFormMod->show()) . $featureBox->show('Plugin List', $objForm->show()) . '<br/>'; }
} $objTable->addRow(array($objLabel->show(), $objDrop->show())); $objHead->str = $settingsLabel; $objHead->type = 3; $objTable->startRow(); $objTable->addCell($objHead->show(), '', '', '', '', 'colspan="4"'); $objTable->endRow(); // Admin only module $objLabel = new label($adminLabel, 'input_adminOnly'); $objCheck = new checkbox('adminOnly'); $objCheck->setChecked($adminOnly); $objTable->addRow(array($objLabel->show(), $objCheck->show())); // Context dependent module $objLabel = new label($dependsLabel, 'input_dependsContext'); $objCheck = new checkbox('dependsContext'); $objCheck->setChecked($dependsContext); $objTable->addRow(array($objLabel->show(), $objCheck->show())); // Link Permissions //$objHead->str = $linkPermLabel; //$objHead->type = 3; //$objTable->startRow(); //$objTable->addCell($objHead->show(), '', '','','','colspan="4"'); //$objTable->endRow(); //$objLink = new link('javascript:void(0)'); //$objLink->link = $setPermLabel; //$objLink->extra = "onclick = \"javascript:window.open('". $this->uri(array('action'=>'setperm', 'modulename'=>$moduleName), '', '', TRUE)."', 'setperms', 'width=800, height=600, scrollbars')\""; //$objTable->startRow(); //$objTable->addCell($objLink->show(), '', '','','','colspan="4"'); //$objTable->endRow(); $formElements = ''; // hidden elements: id, module, permissions