本文整理汇总了PHP中PHPWS_Template::processTemplate方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPWS_Template::processTemplate方法的具体用法?PHP PHPWS_Template::processTemplate怎么用?PHP PHPWS_Template::processTemplate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPWS_Template
的用法示例。
在下文中一共展示了PHPWS_Template::processTemplate方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show
public function show()
{
PHPWS_Core::initCoreClass('Form.php');
$form = new PHPWS_Form();
$form->addDropBox('rlc', HMS_Learning_Community::getRlcList());
$form->setClass('rlc', 'form-control');
$form->addHidden('module', 'hms');
$form->addHidden('action', 'ShowSearchByRlc');
$form->addSubmit('submit', _('Search'));
$form->setClass('submit', 'btn btn-primary pull-right');
$tags = $form->getTemplate();
$tags['TITLE'] = "RLC Search";
Layout::addPageTitle("RLC Search");
$final = PHPWS_Template::processTemplate($tags, 'hms', 'admin/search_by_rlc.tpl');
return $final;
}
示例2: editChannel
public static function editChannel(RSS_Channel $channel)
{
$form = new PHPWS_Form();
$form->addHidden('module', 'rss');
$form->addHidden('command', 'post_channel');
$form->addSubmit(dgettext('rss', 'Save Channel'));
if ($channel->id) {
$form->addHidden('channel_id', $channel->id);
}
$form->addText('title', $channel->title);
$form->setLabel('title', dgettext('rss', 'Title'));
$form->addTextArea('description', $channel->description);
$form->setLabel('description', dgettext('rss', 'Description'));
$formtpl = $form->getTemplate();
$tpl['CONTENT'] = PHPWS_Template::processTemplate($formtpl, 'rss', 'channel_form.tpl');
$tpl['TITLE'] = dgettext('rss', 'Edit channel');
return $tpl;
}
示例3: emailBodyHtml
function emailBodyHtml($content)
{
$entryTags = array();
$entryTags['ENTRY_DATA'] = array();
/* Step through the entries values and feed them through the entryRow template */
$rowClass = NULL;
$tog = 1;
foreach ($content as $key => $value) {
$rowTags = array();
if ($key == 'position') {
continue;
} elseif ($key == 'updated') {
$value = date(PHPWS_DATE_FORMAT . ' ' . PHPWS_TIME_FORMAT, $value);
}
/* Toggle the row colors for better visability */
if ($tog % 2) {
$rowClass = PHAT_SECTION_HEX;
} else {
$rowClass = null;
}
$tog++;
if (isset($rowClass)) {
$rowTags['ROW_CLASS'] = " bgcolor=\"{$rowClass}\"";
}
$rowTags['ENTRY_LABEL'] = $key;
if (preg_match('/a:.:{/', $value)) {
$rowTags['ENTRY_VALUE'] = implode(', ', unserialize(stripslashes($value)));
} else {
$rowTags['ENTRY_VALUE'] = PHPWS_Text::parseOutput($value, ENCODE_PARSED_TEXT, false, true);
}
$entryTags['ENTRY_DATA'][] = PHPWS_Template::processTemplate($rowTags, 'phatform', 'report/entryRow.tpl');
}
$entryTags['ENTRY_DATA'] = implode('', $entryTags['ENTRY_DATA']);
$message = PHPWS_Template::processTemplate($entryTags, 'phatform', 'report/entry.tpl');
return $message;
}
示例4: edit
/**
* Edit this PHAT_Radiobutton
*
* This function provides the HTML form to edit or create a new PHAT_Radiobutton
*
* @return string The HTML form for editing
* @access public
*/
function edit()
{
$numOptions = sizeof($this->getOptionText());
if (!$numOptions) {
$numOptions = '';
}
$elements[0] = PHPWS_Form::formHidden('module', 'phatform') . PHPWS_Form::formHidden('PHAT_EL_OP', 'SaveElement');
if (!$this->getLabel()) {
$num = $_SESSION['PHAT_FormManager']->form->numElements();
$this->setLabel('Element' . ($num + 1));
}
if (PHAT_SHOW_INSTRUCTIONS) {
$GLOBALS['CNT_phatform']['title'] = dgettext('phatform', 'Radiobutton Element Instructions');
}
$editTags['BLURB_LABEL'] = dgettext('phatform', 'Associated Text');
$editTags['BLURB_INPUT'] = PHPWS_Form::formTextArea('PHAT_ElementBlurb', $this->getBlurb(), PHAT_DEFAULT_ROWS, PHAT_DEFAULT_COLS);
$editTags['NAME_LABEL'] = dgettext('phatform', 'Name');
$editTags['NAME_INPUT'] = PHPWS_Form::formTextField('PHAT_ElementName', $this->getLabel(), PHAT_DEFAULT_SIZE, PHAT_DEFAULT_MAXSIZE);
$editTags['OPTIONS_LABEL'] = dgettext('phatform', 'Number of Options');
$editTags['OPTIONS_INPUT'] = PHPWS_Form::formTextField('PHAT_ElementNumOptions', $numOptions, 5, 3);
$options = $this->getOptionSets();
if (is_array($options)) {
$editTags['OPTION_SET_LABEL'] = dgettext('phatform', 'Predefined Option Set');
$editTags['OPTION_SET_INPUT'] = PHPWS_Form::formSelect('PHAT_OptionSet', $options, $this->getOptionSet(), FALSE, TRUE);
}
$editTags['REQUIRE_LABEL'] = dgettext('phatform', 'Required');
$editTags['REQUIRE_INPUT'] = PHPWS_Form::formCheckBox('PHAT_ElementRequired', 1, $this->isRequired());
$editTags['BACK_BUTTON'] = PHPWS_Form::formSubmit(dgettext('phatform', 'Back'), 'PHAT_ElementBack');
$editTags['NEXT_BUTTON'] = PHPWS_Form::formSubmit(dgettext('phatform', 'Next'));
$elements[0] .= PHPWS_Template::processTemplate($editTags, 'phatform', 'radiobutton/edit.tpl');
return PHPWS_Form::makeForm('PHAT_RadiobuttonEdit', 'index.php', $elements, 'post', NULL, NULL);
}
示例5: testEditors
function testEditors($text)
{
if ($_SESSION["OBJ_user"]->allow_access("xwysiwyg", "settings")) {
$this->content .= "<a href=\"" . $this->linkRef . "&action=admin" . "\">" . $_SESSION['translate']->it("Back to administration") . "</a>";
$tags = array();
$tags["TESTAREA"] = PHPWS_WizardBag::js_insert("wysiwyg", "xw_test_form", "xw_testarea") . PHPWS_Form::formTextArea("xw_testarea", $text, 10, 70);
$tags["SUBMIT_BUTTON"] = PHPWS_Form::formSubmit($_SESSION["translate"]->it("Save"));
$elements[0] = PHPWS_Form::formHidden("module", "xwysiwyg");
$elements[0] .= PHPWS_Form::formHidden("action", "testEditor");
$elements[0] .= PHPWS_Template::processTemplate($tags, "xwysiwyg", "test_editor.tpl");
$this->content .= PHPWS_Form::makeForm("xw_test_form", "index.php", $elements, "post", FALSE, TRUE);
$this->content .= "<hr /><br />" . PHPWS_Text::parseOutput($text);
} else {
$this->content .= $_SESSION['translate']->it("Access was denied due to lack of proper permissions.");
}
// End of ADMINISTRATOR condition
}
示例6: edit
/**
* Edit this PHAT_Textarea
*
* @return string The HTML form needed to edit this PHAT_Textarea
* @access public
*/
function edit()
{
$elements[0] = PHPWS_Form::formHidden('module', 'phatform') . PHPWS_Form::formHidden('PHAT_EL_OP', 'SaveElement');
if (!$this->getLabel()) {
$num = $_SESSION['PHAT_FormManager']->form->numElements();
$this->setLabel('Element' . ($num + 1));
}
if (PHAT_SHOW_INSTRUCTIONS) {
$GLOBALS['CNT_phatform']['title'] = dgettext('phatform', 'Textarea Element Instructions');
}
$editTags['BLURB_LABEL'] = dgettext('phatform', 'Associated Text');
$editTags['BLURB_INPUT'] = PHPWS_Form::formTextArea('PHAT_ElementBlurb', $this->getBlurb(), PHAT_DEFAULT_ROWS, PHAT_DEFAULT_COLS);
$editTags['NAME_LABEL'] = dgettext('phatform', 'Name');
$editTags['NAME_INPUT'] = PHPWS_Form::formTextField('PHAT_ElementName', $this->getLabel(), PHAT_DEFAULT_SIZE, PHAT_DEFAULT_MAXSIZE);
$editTags['ROWS_LABEL'] = dgettext('phatform', 'Rows');
$editTags['ROWS_INPUT'] = PHPWS_Form::formTextField('PHAT_ElementRows', $this->_rows, 5, 3);
$editTags['COLS_LABEL'] = dgettext('phatform', 'Columns');
$editTags['COLS_INPUT'] = PHPWS_Form::formTextField('PHAT_ElementCols', $this->_cols, 5, 3);
$editTags['VALUE_LABEL'] = dgettext('phatform', 'Value');
$editTags['VALUE_INPUT'] = PHPWS_Form::formTextArea('PHAT_ElementValue', $this->getValue(), PHAT_DEFAULT_ROWS, PHAT_DEFAULT_COLS);
$editTags['REQUIRE_LABEL'] = dgettext('phatform', 'Require');
$editTags['REQUIRE_INPUT'] = PHPWS_Form::formCheckBox('PHAT_ElementRequired', 1, $this->isRequired());
$editTags['BACK_BUTTON'] = PHPWS_Form::formSubmit(dgettext('phatform', 'Back'), 'PHAT_ElementBack');
$editTags['SAVE_BUTTON'] = PHPWS_Form::formSubmit(dgettext('phatform', 'Save Textarea'));
$elements[0] .= PHPWS_Template::processTemplate($editTags, 'phatform', 'textarea/edit.tpl');
return PHPWS_Form::makeForm('PHAT_TextareaEdit', 'index.php', $elements, 'post', NULL, NULL);
}
示例7: confirmDelete
/**
*
*
*
*
*/
function confirmDelete()
{
$hiddens['module'] = 'phatform';
$hiddens['PHAT_REPORT_OP'] = 'delete';
$hiddens['PHAT_ENTRY_ID'] = $_REQUEST['PHAT_ENTRY_ID'];
foreach ($hiddens as $key => $value) {
$eles[] = PHPWS_Form::formHidden($key, $value);
}
$elements[0] = implode("\n", $eles);
$confirmTags['MESSAGE'] = dgettext('phatform', 'Are you sure you want to delete this entry?');
$confirmTags['NO_BUTTON'] = PHPWS_Form::formSubmit(dgettext('phatform', 'No'), 'PHAT_DeleteNo');
$confirmTags['YES_BUTTON'] = PHPWS_Form::formSubmit(dgettext('phatform', 'Yes'), 'PHAT_DeleteYes');
$elements[0] .= PHPWS_Template::processTemplate($confirmTags, 'phatform', 'report/deleteConfirm.tpl');
$content = PHPWS_Form::makeForm('PHAT_EntryDeleteConfirm', 'index.php', $elements);
$content .= '<br /><hr /><br />';
$content .= $this->view(FALSE);
return $content;
}
示例8: edit
/**
* Edit a new or existing PHAT_Dropbox element
*
* The edit function provides the HTML form to edit a new or existing
* PHAT_Dropbox element.
* g
* return string The HTML form to edit a PHAT_Dropbox
*/
function edit()
{
$numOptions = sizeof($this->getOptionText());
if (!$numOptions || $this->getOptionSet()) {
$numOptions = '';
}
$form = new PHPWS_Form();
$form->addHidden('module', 'phatform');
$form->addHidden('PHAT_EL_OP', 'SaveElement');
if (!$this->getLabel()) {
$num = $_SESSION['PHAT_FormManager']->form->numElements();
$this->setLabel('Element' . ($num + 1));
}
$form->addTextArea('PHAT_ElementBlurb', $this->getBlurb());
$form->setRows('PHAT_ElementBlurb', PHAT_DEFAULT_ROWS);
$form->setCols('PHAT_ElementBlurb', PHAT_DEFAULT_COLS);
$form->setLabel('PHAT_ElementBlurb', dgettext('phatform', 'Associated Text'));
$form->addText('PHAT_ElementName', $this->getLabel());
$form->setSize('PHAT_ElementName', PHAT_DEFAULT_SIZE, PHAT_DEFAULT_MAXSIZE);
$form->setLabel('PHAT_ElementName', dgettext('phatform', 'Name'));
$form->addText('PHAT_ElementNumOptions', $numOptions);
$form->setSize('PHAT_ElementNumOptions', 5, 3);
$form->setLabel('PHAT_ElementNumOptions', dgettext('phatform', 'Number of Options'));
$options = $this->getOptionSets();
if (is_array($options)) {
$editTags['OPTION_SET_LABEL'] = dgettext('phatform', 'Predefined Option Set');
$form->addSelect('PHAT_OptionSet', $options);
$form->setMatch('PHAT_OptionSet', $this->getOptionSet());
}
$form->addCheck('PHAT_ElementRequired', 1);
$form->setMatch('PHAT_ElementRequired', $this->isRequired());
$form->setLabel('PHAT_ElementRequired', dgettext('phatform', 'Required'));
$form->addSubmit('PHAT_ElementBack', dgettext('phatform', 'Back'));
$form->addSubmit('NEXT_BUTTON', dgettext('phatform', 'Next'));
$template = $form->getTemplate();
return PHPWS_Template::processTemplate($template, 'phatform', 'dropbox/edit.tpl');
}
示例9: remove
/**
* Remove this PHAT_Element
*
* @accesss public
*/
function remove()
{
if (isset($_REQUEST['PHAT_Yes'])) {
$result = $this->kill();
if (PHPWS_Error::isError($result)) {
return PHPWS_Error::get(PHATFORM_CANNOT_DELETE_ELEMENT, 'phatform', 'PHAT_Element::remove()');
} else {
$result = $_SESSION['PHAT_FormManager']->form->popElement();
if (PHPWS_Error::isError($result)) {
return $result;
} else {
return dgettext('phatform', 'The element was successfully removed.');
}
}
} else {
if (isset($_REQUEST['PHAT_No'])) {
return dgettext('phatform', 'No element was removed.');
} else {
$className = get_class($this);
$properName = ucfirst(str_ireplace('phat_', '', $className));
$tags['MESSAGE'] = sprintf(dgettext('phatform', 'Are you sure you want to remove this %s element?'), '<b><i>' . $properName . '</i></b>');
$tags['YES_BUTTON'] = PHPWS_Form::formSubmit('Yes', 'PHAT_Yes');
$tags['NO_BUTTON'] = PHPWS_Form::formSubmit('No', 'PHAT_No');
$tags['ELEMENT_PREVIEW'] = $this->view();
$elements[0] = PHPWS_Form::formHidden('module', 'phatform');
$elements[0] .= PHPWS_Form::formHidden('PHAT_EL_OP', 'RemoveElement');
$elements[0] .= PHPWS_Template::processTemplate($tags, 'phatform', 'form/deleteConfirm.tpl');
$content = PHPWS_Form::makeForm('PHAT_Confirm', 'index.php', $elements);
}
}
return $content;
}
示例10: delete
/**
* Delete
*
* @author Greg Meiste <greg.meiste+github@gmail.com>
*/
function delete()
{
if (!Current_User::authorized('wiki', 'upload_images') && !(PHPWS_Settings::get('wiki', 'allow_image_upload') && Current_User::isLogged())) {
Current_User::disallow(dgettext('wiki', 'User attempted access to image delete.'));
return;
}
if (isset($_REQUEST['yes'])) {
@unlink(PHPWS_HOME_DIR . 'images/wiki/' . $this->getFilename());
$db = new PHPWS_DB('wiki_images');
$db->addWhere('id', $this->getId());
if (PHPWS_Error::logIfError($db->delete())) {
return dgettext('wiki', 'Error deleting image.');
}
return dgettext('wiki', 'Image deleted!');
} else {
if (isset($_REQUEST['no'])) {
return dgettext('wiki', 'Image was not deleted!');
}
}
$tags = array();
$tags['MESSAGE'] = dgettext('wiki', 'Are you sure you want to delete this image?');
$tags['YES'] = PHPWS_Text::secureLink(dgettext('wiki', 'Yes'), 'wiki', array('op' => 'doimagedelete', 'yes' => 1, 'id' => $this->getId()));
$tags['NO'] = PHPWS_Text::secureLink(dgettext('wiki', 'No'), 'wiki', array('op' => 'doimagedelete', 'no' => 1, 'id' => $this->getId()));
$tags['WIKIPAGE'] = '<img src="images/wiki/' . $this->getFilename() . '" alt="" />';
return PHPWS_Template::processTemplate($tags, 'wiki', 'confirm.tpl');
}
示例11: viewArchives
function viewArchives()
{
if (isset($_REQUEST['PDA_start'])) {
$this->pageStart = $_REQUEST['PDA_start'];
} else {
$_REQUEST['PDA_start'] = $this->pageStart;
}
if (isset($_REQUEST['PDA_section'])) {
$this->pageSection = $_REQUEST['PDA_section'];
} else {
$_REQUEST['PDA_section'] = $this->pageSection;
}
if (isset($_REQUEST['PDA_limit'])) {
$this->pageLimit = $_REQUEST['PDA_limit'];
} else {
$_REQUEST['PDA_limit'] = $this->pageLimit;
}
$listTags = array();
$listTags['FORMNAME_LABEL'] = dgettext('phatform', 'Form Name');
$listTags['FILENAME_LABEL'] = dgettext('phatform', 'Filename');
$listTags['DATE_LABEL'] = dgettext('phatform', 'Date Created');
$listTags['ACTION_LABEL'] = dgettext('phatform', 'Action');
$highlight = ' class="bgcolor1"';
$files = array();
$total_files = 0;
$dir = PHPWS_HOME_DIR . 'files/phatform/archive/';
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
if (preg_match('/phat$/', $file)) {
$files[$total_files]['filename'] = $file;
$timeStamp = preg_split('/\\./', $file);
$files[$total_files]['date'] = date('m / d / y', $timeStamp[1]);
$total_files++;
}
}
closedir($dh);
}
}
if (sizeof($files) > 0) {
$data = paginateDataArray($files, 'index.php?module=phatform&PHAT_MAN_OP=viewArchives', $this->pageLimit, TRUE, array('<b>[ ', ' ]</b>'), NULL, 10, TRUE);
}
if (isset($data) && is_array($data[0]) && sizeof($data[0]) > 0) {
$listTags['LIST_ITEMS'] = NULL;
$tog = 1;
foreach ($data[0] as $entry) {
$rowTags = array();
$formNum = array();
ereg('^([0-9]+)', $entry['filename'], $formNum);
if ($formname = $this->getArchiveFormName($entry['filename'], $formNum[0])) {
$rowTags['FORMNAME'] = $formname;
} else {
$rowTags['FORMNAME'] = dgettext('phatform', 'Unknown');
}
$rowTags['HIGHLIGHT'] = $highlight;
$rowTags['FILENAME'] = $entry['filename'];
$rowTags['DATE'] = $entry['date'];
$rowTags['DOWNLOAD'] = '<a href="index.php?module=phatform&ARCHIVE_OP=downloadArchive&ARCHIVE_filename=' . $entry['filename'] . '">' . dgettext('phatform', 'Download') . '</a>';
$rowTags['VIEW'] = '<a href="index.php?module=phatform&ARCHIVE_OP=viewArchive&ARCHIVE_filename=' . $entry['filename'] . '">' . dgettext('phatform', 'View') . '</a>';
$db = new PHPWS_DB('mod_phatform_forms');
$db->addWhere('archiveFileName', '%' . $entry['filename'] . '%', 'LIKE');
$result = $db->select();
if ($result) {
$rowTags['CLEANUP'] = '<a href="index.php?module=phatform&ARCHIVE_OP=cleanUpArchive&ARCHIVE_filename=' . $entry['filename'] . '">' . dgettext('phatform', 'Clean-Up') . '</a>';
}
$rowTags['DELETE'] = '<a href="index.php?module=phatform&ARCHIVE_OP=deleteArchive&ARCHIVE_filename=' . $entry['filename'] . '">' . dgettext('phatform', 'Delete') . '</a>';
if ($tog % 2) {
$highlight = ' class="bgcolor1"';
} else {
$highlight = null;
}
$tog++;
$listTags['LIST_ITEMS'] .= PHPWS_Template::processTemplate($rowTags, 'phatform', 'report/archive/row.tpl');
}
if (count($files) > $this->pageLimit) {
$listTags['NAVIGATION_LINKS'] = $data[1];
}
$listTags['SECTION_INFO'] = $data[2];
$listTags['SECTION_INFO_LABEL'] = dgettext('phatform', 'Entries');
$listTags['LINK_BACK'] = '<a href="index.php?module=phatform&PHAT_FORM_OP=report">' . dgettext('phatform', 'Report View') . '</a>';
} else {
$listTags['LIST_ITEMS'] = '<tr><td colspan="4" class="smalltext">' . dgettext('phatform', 'No entries were found matching your search query.') . '</td></tr>';
}
$GLOBALS['CNT_phatform']['title'] = dgettext('phatform', 'Existing Archives');
return PHPWS_Template::processTemplate($listTags, 'phatform', 'report/archive/list.tpl');
}
示例12: getList
//.........这里部分代码省略.........
if ($item['hidden'] == 1) {
$rowTags['HIDDEN'] = _('Hidden');
} else {
$rowTags['HIDDEN'] = _('Visible');
}
}
} else {
if ($listColumn == 'approved') {
/* Setting message depending if this item is approved or not */
if (isset($this->_listValues['hidden'])) {
$rowTags['APPROVED'] = $this->_listValues['approved'][$item['approved']];
} else {
if ($item['approved'] == 1) {
$rowTags['APPROVED'] = _('Approved');
} else {
$rowTags['APPROVED'] = _('Unapproved');
}
}
} else {
if ($listColumn == 'groups') {
$groups = unserialize($item['groups']);
if (is_array($groups) && sizeof($groups) > 0) {
/* Set flag to check whether to add a comma or not */
$flag = FALSE;
/* Create a string of group names the current item belongs to */
foreach ($groups as $group) {
if ($flag) {
$rowTags['GROUPS'] .= ', ';
}
$rowTags['GROUPS'] .= $group;
$flag = TRUE;
}
} else {
$rowTags['GROUPS'] = _('All');
}
} else {
$method = 'get' . $listColumn;
if (is_object($object) && in_array($method, $classMethods)) {
$rowTags[$column] = $object->{$method}();
} else {
$rowTags[$column] = $item[$listColumn];
}
}
}
}
}
}
}
/* Process this item and concatenate onto the current list of items */
$listTags['LIST_ITEMS'] .= PHPWS_Template::processTemplate($rowTags, 'core', $rowTpl, FALSE);
}
if (isset($this->_listPaging[$this->listName]) && is_array($this->_listPaging[$this->listName]) && sizeof($this->_listPaging[$this->listName]) > 0) {
$listTags['NAV_BACKWARD'] = $this->_pagers[$this->listName]->getBackLink($this->_listPaging[$this->listName]['back']);
$listTags['NAV_FORWARD'] = $this->_pagers[$this->listName]->getForwardLink($this->_listPaging[$this->listName]['forward']);
if (isset($this->_listPaging[$this->listName]['section'])) {
$listTags['NAV_SECTIONS'] = $this->_pagers[$this->listName]->getSectionLinks();
}
$listTags['NAV_LIMITS'] = $this->_pagers[$this->listName]->getLimitLinks();
$listTags['NAV_INFO'] = $this->_pagers[$this->listName]->getSectionInfo();
}
$actions = array();
if (isset($this->_listActions[$this->listName]) && is_array($this->_listActions[$this->listName])) {
foreach ($this->_listActions[$this->listName] as $actionString => $actionLabel) {
if (isset($this->_listPermissions[$this->listName][$actionString])) {
$permission = $this->_listPermissions[$this->listName][$actionString];
}
if (isset($permission)) {
if (Current_User::allow($this->_module, $permission)) {
$actions[$actionString] = $actionLabel;
}
} else {
$actions[$actionString] = $actionLabel;
}
}
}
if ($makeForm) {
/* Create action select and Go button */
$ele = new Form_Select($this->_request, $actions);
$listTags['ACTION_SELECT'] = $ele->get();
$listTags['ACTION_BUTTON'] = sprintf('<input type="submit" value="%s" />', _('Go'));
$listTags['TOGGLE_ALL'] = javascript('check_all', array('FORM_NAME' => 'PHPWS_MAN_LIST_' . $this->listName));
/* Add hidden variable to designate the current module */
$ele = new Form_Hidden('module', $this->_module);
$elements[0] = $ele->get();
$elements[0] .= PHPWS_Template::processTemplate($listTags, 'core', $listTpl, FALSE);
/* Create final form and dump it into a content variable to be returned */
$content = sprintf('<form name="%s" action="index.php" method="post">%s</form>', 'PHPWS_MAN_LIST_' . $this->listName, implode("\n", $elements));
} else {
$content = PHPWS_Template::processTemplate($listTags, 'core', $listTpl, FALSE);
}
} else {
$listTags['LIST_ITEMS'] = '<tr><td colspan="' . $columns . '">' . _('No items for the current list.') . '</td></tr>';
$content = PHPWS_Template::processTemplate($listTags, 'core', $listTpl, FALSE);
}
/* reinitialize sort and order before next list */
$this->setSort(NULL);
$this->setOrder(NULL);
$this->_class = NULL;
return $content;
}
示例13: _editOptions
function _editOptions()
{
if (Current_User::allow('phatform', 'edit_options')) {
if (isset($_REQUEST['PHAT_OptionSetId']) && !is_numeric($_REQUEST['PHAT_OptionSetId']) || isset($_REQUEST['PHAT_OptionBack'])) {
$_REQUEST['PHAT_MAN_OP'] = 'Options';
$this->action();
return;
} else {
$optionSetId = $_REQUEST['PHAT_OptionSetId'];
}
if (isset($_REQUEST['PHAT_SaveOptionSet'])) {
if (is_array($_REQUEST['PHAT_ElementOptions']) && is_array($_REQUEST['PHAT_ElementValues'])) {
for ($i = 0; $i < sizeof($_REQUEST['PHAT_ElementOptions']); $i++) {
$_REQUEST['PHAT_ElementOptions'][$i] = PHPWS_Text::parseInput($_REQUEST['PHAT_ElementOptions'][$i]);
$_REQUEST['PHAT_ElementValues'][$i] = PHPWS_Text::parseInput($_REQUEST['PHAT_ElementValues'][$i]);
}
$options = addslashes(serialize($_REQUEST['PHAT_ElementOptions']));
$values = addslashes(serialize($_REQUEST['PHAT_ElementValues']));
$saveArray = array('optionSet' => $options, 'valueSet' => $values);
$db = new PHPWS_DB('mod_phatform_options');
$db->addWhere('id', $optionSetId);
$db->addValue($saveArray);
$db->update();
}
} else {
if (isset($_REQUEST['PHAT_delete'])) {
$db = new PHPWS_DB('mod_phatform_options');
$db->addWhere('id', $optionSetId);
$db->delete();
$_REQUEST['PHAT_MAN_OP'] = 'Options';
$this->action();
return;
}
}
$GLOBALS['CNT_phatform']['title'] = PHAT_TITLE;
$sql = "SELECT * FROM mod_phatform_options WHERE id='{$optionSetId}'";
$result = PHPWS_DB::getRow($sql);
if ($result) {
$elements = array();
$elements[] = PHPWS_Form::formHidden('module', $this->_module);
$elements[] = PHPWS_Form::formHidden('PHAT_MAN_OP', 'editOptions');
$elements[] = PHPWS_Form::formHidden('PHAT_OptionSetId', $optionSetId);
$options = unserialize(stripslashes($result['optionSet']));
$values = unserialize(stripslashes($result['valueSet']));
$editTags = array();
$editTags['TITLE'] = dgettext('phatform', 'Edit option set') . " {$result['label']}";
$editTags['NUMBER_LABEL'] = dgettext('phatform', 'Option');
$editTags['INPUT_LABEL'] = dgettext('phatform', 'Text');
$editTags['VALUE_LABEL'] = dgettext('phatform', 'Value');
$editTags['OPTIONS'] = '';
$rowClass = NULL;
for ($i = 0; $i < sizeof($options); $i++) {
$optionRow['OPTION_NUMBER'] = $i + 1;
$optionRow['OPTION_INPUT'] = PHPWS_Form::formTextField("PHAT_ElementOptions[{$i}]", $options[$i], PHAT_DEFAULT_SIZE, PHAT_DEFAULT_MAXSIZE);
$optionRow['VALUE_INPUT'] = PHPWS_Form::formTextField("PHAT_ElementValues[{$i}]", $values[$i], PHAT_DEFAULT_SIZE, PHAT_DEFAULT_MAXSIZE);
$optionRow['ROW_CLASS'] = $rowClass;
if ($i % 2) {
$rowClass = ' class="bgcolor1"';
} else {
$rowClass = null;
}
$editTags['OPTIONS'] .= PHPWS_Template::processTemplate($optionRow, 'phatform', 'options/option.tpl');
}
}
$editTags['BACK_BUTTON'] = PHPWS_Form::formSubmit(dgettext('phatform', 'Back'), 'PHAT_OptionBack');
$editTags['SAVE_BUTTON'] = PHPWS_Form::formSubmit(dgettext('phatform', 'Save'), 'PHAT_SaveOptionSet');
$elements[] = PHPWS_Template::processTemplate($editTags, 'phatform', 'options/optionList.tpl');
return PHPWS_Form::makeForm('PHAT_Options_edit', 'index.php', $elements);
} else {
$this->_list();
}
}