当前位置: 首页>>代码示例>>PHP>>正文


PHP SFUtils::linkForSpecialPage方法代码示例

本文整理汇总了PHP中SFUtils::linkForSpecialPage方法的典型用法代码示例。如果您正苦于以下问题:PHP SFUtils::linkForSpecialPage方法的具体用法?PHP SFUtils::linkForSpecialPage怎么用?PHP SFUtils::linkForSpecialPage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SFUtils的用法示例。


在下文中一共展示了SFUtils::linkForSpecialPage方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getPageHeader

 function getPageHeader()
 {
     global $wgUser;
     $sk = $wgUser->getSkin();
     $create_form_link = SFUtils::linkForSpecialPage($sk, 'CreateForm');
     $header = "<p>" . $create_form_link . ".</p>\n";
     $header .= '<p>' . wfMsg('sf_forms_docu') . "</p><br />\n";
     return $header;
 }
开发者ID:yusufchang,项目名称:app,代码行数:9,代码来源:SF_Forms.php

示例2: execute

	function execute( $query ) {
		global $wgOut, $wgRequest, $wgUser, $sfgScriptPath;
		global $wgLang, $smwgContLang;

		# Check permissions
		if ( !$wgUser->isAllowed( 'createclass' ) ) {
			$this->displayRestrictionError();
			return;
		}

		$this->setHeaders();
		$wgOut->addExtensionStyle( $sfgScriptPath . "/skins/SemanticForms.css" );
		$numStartingRows = 10;
		self::addJavascript( $numStartingRows );

		$property_name_error_str = '';
		$save_page = $wgRequest->getCheck( 'save' );
		if ( $save_page ) {
			$template_name = trim( $wgRequest->getVal( "template_name" ) );
			$form_name = trim( $wgRequest->getVal( "form_name" ) );
			$category_name = trim( $wgRequest->getVal( "category_name" ) );
			if ( $template_name === '' | $form_name === '' || $category_name === '' ) {
				$wgOut->addWikiMsg( 'sf_createclass_missingvalues' );
				return;
			}
			$fields = array();
			$jobs = array();
			// cycle through all the rows passed in
			for ( $i = 1; $wgRequest->getCheck( "property_name_$i" ); $i++ ) {
				// go through the query values, setting the appropriate local variables
				$property_name = trim( $wgRequest->getVal( "property_name_$i" ) );
				if ( empty( $property_name ) ) continue;
				$field_name = trim( $wgRequest->getVal( "field_name_$i" ) );
				if ( $field_name === '' )
					$field_name = $property_name;
				$property_type = $wgRequest->getVal( "property_type_$i" );
				$allowed_values = $wgRequest->getVal( "allowed_values_$i" );
				$is_list = $wgRequest->getCheck( "is_list_$i" );
				// create an SFTemplateField based on these
				// values, and add it to the $fields array
				$field = SFTemplateField::create( $field_name, $field_name, $property_name, $is_list );
				$fields[] = $field;

				// create the property, and make a job for it
				$full_text = SFCreateProperty::createPropertyText( $property_type, '', $allowed_values );
				$property_title = Title::makeTitleSafe( SMW_NS_PROPERTY, $property_name );
				$params = array();
				$params['user_id'] = $wgUser->getId();
				$params['page_text'] = $full_text;
				$jobs[] = new SFCreatePageJob( $property_title, $params );
			}

			// create the template, and save it
			$full_text = SFTemplateField::createTemplateText( $template_name, $fields, null, $category_name, null, null, null );
			$template_title = Title::makeTitleSafe( NS_TEMPLATE, $template_name );
			$template_article = new Article( $template_title, 0 );
			$edit_summary = '';
			$template_article->doEdit( $full_text, $edit_summary );

			// create the form, and make a job for it
			$form_template = SFTemplateInForm::create( $template_name, '', false );
			$form_templates = array( $form_template );
			$form = SFForm::create( $form_name, $form_templates );
			$full_text = $form->createMarkup();
			$form_title = Title::makeTitleSafe( SF_NS_FORM, $form_name );
			$params = array();
			$params['user_id'] = $wgUser->getId();
			$params['page_text'] = $full_text;
			$jobs[] = new SFCreatePageJob( $form_title, $params );

			// create the category, and make a job for it
			$full_text = SFCreateCategory::createCategoryText( $form_name, $category_name, '' );
			$category_title = Title::makeTitleSafe( NS_CATEGORY, $category_name );
			$params = array();
			$params['user_id'] = $wgUser->getId();
			$params['page_text'] = $full_text;
			$jobs[] = new SFCreatePageJob( $category_title, $params );
			Job::batchInsert( $jobs );

			$wgOut->addWikiMsg( 'sf_createclass_success' );
			return;
		}

		$datatype_labels = $smwgContLang->getDatatypeLabels();

		// make links to all the other 'Create...' pages, in order to
		// link to them at the top of the page
		$sk = $wgUser->getSkin();
		$creation_links = array();
		$creation_links[] = SFUtils::linkForSpecialPage( $sk, 'CreateProperty' );
		$creation_links[] = SFUtils::linkForSpecialPage( $sk, 'CreateTemplate' );
		$creation_links[] = SFUtils::linkForSpecialPage( $sk, 'CreateForm' );
		$creation_links[] = SFUtils::linkForSpecialPage( $sk, 'CreateCategory' );
		$create_class_docu = wfMsg( 'sf_createclass_docu', $wgLang->listToText( $creation_links ) );
		$leave_field_blank = wfMsg( 'sf_createclass_leavefieldblank' );
		$form_name_label = wfMsg( 'sf_createclass_nameinput' );
		$template_name_label = wfMsg( 'sf_createtemplate_namelabel' );
		$category_name_label = wfMsg( 'sf_createcategory_name' );
		$property_name_label = wfMsg( 'sf_createproperty_propname' );
		$field_name_label = wfMsg( 'sf_createtemplate_fieldname' );
//.........这里部分代码省略.........
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:101,代码来源:SF_CreateClass.php

示例3: doSpecialCreateForm


//.........这里部分代码省略.........
								$value = true;
							}
							$field->setFieldArg( $paramName, $value );
						}
					}
				}
			}
		}
		$form = SFForm::create( $form_name, $form_templates );

		// If a submit button was pressed, create the form-definition
		// file, then redirect.
		$save_page = $wgRequest->getCheck( 'wpSave' );
		$preview_page = $wgRequest->getCheck( 'wpPreview' );
		if ( $save_page || $preview_page ) {
			// Validate form name
			if ( $form->getFormName() == "" ) {
				$form_name_error_str = wfMsg( 'sf_blank_error' );
			} else {
				// Redirect to wiki interface
				$wgOut->setArticleBodyOnly( true );
				$title = Title::makeTitleSafe( SF_NS_FORM, $form->getFormName() );
				$full_text = $form->createMarkup();
				$text = SFUtils::printRedirectForm( $title, $full_text, "", $save_page, $preview_page, false, false, false, null, null );
				$wgOut->addHTML( $text );
				return;
			}
		}

		$text = "\t" . '<form action="" method="post">' . "\n";
		// Set 'title' field, in case there's no URL niceness
		$text .= SFFormUtils::hiddenFieldHTML( 'title', $this->getTitle()->getPrefixedText() );
		$text .= "\t<p>" . wfMsg( 'sf_createform_nameinput' ) . ' ' . wfMsg( 'sf_createform_nameinputdesc' ) . ' <input size=25 name="form_name" value="' . $form_name . '" />';
		if ( ! empty( $form_name_error_str ) )
			$text .= "\t" . Html::element( 'font', array( 'color' => 'red' ), $form_name_error_str );
		$text .= "</p>\n";

		$text .= $form->creationHTML();

		$text .= "\t<p>" . wfMsg( 'sf_createform_addtemplate' ) . "\n";

		$select_body = "";
		foreach ( $all_templates as $template ) {
			$select_body .= "	" . Html::element( 'option', array( 'value' => $template ), $template ) . "\n";
		}
		$text .= "\t" . Html::rawElement( 'select', array( 'name' => 'new_template' ), $select_body ) . "\n";
		// If a template has already been added, show a dropdown letting
		// the user choose where in the list to add a new dropdown.
		if ( count( $form_templates ) > 0 ) {
			$before_template_msg = wfMsg( 'sf_createform_beforetemplate' );
			$text .= $before_template_msg;
			$select_body = "";
			foreach ( $form_templates as $i => $ft ) {
				$select_body .= "\t" . Html::element( 'option', array( 'value' => $i ), $ft->getTemplateName() ) . "\n";
			}
			$final_index = count( $form_templates );
			$at_end_msg = wfMsg( 'sf_createform_atend' );
			$select_body .= "\t" . Html::element( 'option', array( 'value' => $final_index, 'selected' => 'selected' ), $at_end_msg );
			$text .= Html::rawElement( 'select', array( 'name' => 'before_template' ), $select_body ) . "\n";
		}

		// Disable 'save' and 'preview' buttons if user has not yet
		// added any templates.
		$disabled_text = ( count( $form_templates ) == 0 ) ? "disabled" : "";
		$add_button_text = wfMsg( 'sf_createform_add' );
		$sk = $wgUser->getSkin();
		$create_template_link = SFUtils::linkForSpecialPage( $sk, 'CreateTemplate' );
		$text .= "\t" . Html::input( 'add_field', $add_button_text, 'submit' );
		$text .= <<<END
</p>
	<br />

END;
		$saveAttrs = array( 'id' => 'wpSave' );
		if ( count( $form_templates ) == 0 ) {
			$saveAttrs['disabled'] = true;
		}
		$editButtonsText = "\t" . Html::input( 'wpSave', wfMsg( 'savearticle' ), 'submit', $saveAttrs ) . "\n";
		$previewAttrs = array( 'id' => 'wpPreview' );
		if ( count( $form_templates ) == 0 ) {
			$previewAttrs['disabled'] = true;
		}
		$editButtonsText .= "\t" . Html::input( 'wpPreview',  wfMsg( 'preview' ), 'submit', $previewAttrs ) . "\n";
		$text .= "\t" . Html::rawElement( 'div', array( 'class' => 'editButtons' ),
			Html::rawElement( 'p', array(), $editButtonsText ) . "\n" ) . "\n";
		// Explanatory message if buttons are disabled because no
		// templates have been added.
		if ( count( $form_templates ) == 0 ) {
			$text .= "\t" . Html::element( 'p', null, "(" . wfMsg( 'sf_createtemplate_addtemplatebeforesave' ) . ")" );
		}
		$text .= <<<END
	</form>
	<hr /><br />

END;
		$text .= "\t" . Html::rawElement( 'p', null, $create_template_link . '.' );

		$wgOut->addExtensionStyle( $sfgScriptPath . "/skins/SemanticForms.css" );
		$wgOut->addHTML( $text );
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:101,代码来源:SF_CreateForm.php

示例4: execute

    function execute($query)
    {
        global $wgOut, $wgRequest, $wgUser, $sfgScriptPath;
        $this->setHeaders();
        // Cycle through the query values, setting the appropriate
        // local variables.
        $category_name = $wgRequest->getVal('category_name');
        $default_form = $wgRequest->getVal('default_form');
        $parent_category = $wgRequest->getVal('parent_category');
        $category_name_error_str = null;
        $save_page = $wgRequest->getCheck('wpSave');
        $preview_page = $wgRequest->getCheck('wpPreview');
        if ($save_page || $preview_page) {
            // Validate category name
            if ($category_name === '') {
                $category_name_error_str = wfMsg('sf_blank_error');
            } else {
                // Redirect to wiki interface
                $wgOut->setArticleBodyOnly(true);
                $title = Title::makeTitleSafe(NS_CATEGORY, $category_name);
                $full_text = SFCreateCategory::createCategoryText($default_form, $category_name, $parent_category);
                $text = SFUtils::printRedirectForm($title, $full_text, "", $save_page, $preview_page, false, false, false, null, null);
                $wgOut->addHTML($text);
                return;
            }
        }
        $all_forms = SFUtils::getAllForms();
        // Set 'title' as hidden field, in case there's no URL niceness
        global $wgContLang;
        $mw_namespace_labels = $wgContLang->getNamespaces();
        $special_namespace = $mw_namespace_labels[NS_SPECIAL];
        $text = <<<END
\t<form action="" method="get">

END;
        $text .= "\t" . Html::hidden('title', "{$special_namespace}:CreateCategory") . "\n";
        $firstRow = wfMsg('sf_createcategory_name') . ' ' . Html::input('category_name', null, 'text', array('size' => 25)) . "\n";
        if (!is_null($category_name_error_str)) {
            $firstRow .= Html::element('span', array('style' => 'color: red;'), $category_name_error_str) . "\n";
        }
        $firstRow .= "\t" . wfMsg('sf_createcategory_defaultform') . "\n";
        $formSelector = "\t" . Html::element('option', null, null) . "\n";
        foreach ($all_forms as $form) {
            $formSelector .= "\t" . Html::element('option', null, $form) . "\n";
        }
        $firstRow .= Html::rawElement('select', array('id' => 'form_dropdown', 'name' => 'default_form'), $formSelector);
        $text .= Html::rawElement('p', null, $firstRow);
        $subcategory_label = wfMsg('sf_createcategory_makesubcategory');
        $text .= <<<END
\t<p>{$subcategory_label}
\t<select id="category_dropdown" name="parent_category">
\t<option></option>

END;
        $categories = SFUtils::getCategoriesForPage();
        foreach ($categories as $category) {
            $category = str_replace('_', ' ', $category);
            $text .= "\t" . Html::element('option', null, $category) . "\n";
        }
        $text .= "\t</select>\n";
        $editButtonsText = "\t" . Html::input('wpSave', wfMsg('savearticle'), 'submit', array('id' => 'wpSave')) . "\n";
        $editButtonsText .= "\t" . Html::input('wpPreview', wfMsg('preview'), 'submit', array('id' => 'wpPreview')) . "\n";
        $text .= "\t" . Html::rawElement('div', array('class' => 'editButtons'), $editButtonsText) . "\n";
        $text .= <<<END
\t<br /><hr /<br />

END;
        $sk = $wgUser->getSkin();
        $create_form_link = SFUtils::linkForSpecialPage($sk, 'CreateForm');
        $text .= "\t" . Html::rawElement('p', null, $create_form_link . '.') . "\n";
        $text .= "\t</form>\n";
        $wgOut->addExtensionStyle($sfgScriptPath . "/skins/SemanticForms.css");
        $wgOut->addHTML($text);
    }
开发者ID:schwarer2006,项目名称:wikia,代码行数:74,代码来源:SF_CreateCategory.php

示例5: printCreateTemplateForm

    function printCreateTemplateForm()
    {
        global $wgOut, $wgRequest, $wgUser, $sfgScriptPath;
        self::addJavascript();
        $text = '';
        $save_page = $wgRequest->getCheck('wpSave');
        $preview_page = $wgRequest->getCheck('wpPreview');
        if ($save_page || $preview_page) {
            $validToken = $this->getUser()->matchEditToken($wgRequest->getVal('csrf'), 'CreateTemplate');
            if (!$validToken) {
                $text = "This appears to be a cross-site request forgery; canceling save.";
                $wgOut->addHTML($text);
                return;
            }
            $fields = array();
            // Cycle through the query values, setting the
            // appropriate local variables.
            foreach ($wgRequest->getValues() as $var => $val) {
                $var_elements = explode("_", $var);
                // we only care about query variables of the form "a_b"
                if (count($var_elements) != 2) {
                    continue;
                }
                list($field_field, $id) = $var_elements;
                if ($field_field == 'name' && $id != 'starter') {
                    $field = SFTemplateField::create($val, $wgRequest->getVal('label_' . $id), $wgRequest->getVal('semantic_property_' . $id), $wgRequest->getCheck('is_list_' . $id));
                    $fields[] = $field;
                }
            }
            // Assemble the template text, and submit it as a wiki
            // page.
            $wgOut->setArticleBodyOnly(true);
            $template_name = $wgRequest->getVal('template_name');
            $title = Title::makeTitleSafe(NS_TEMPLATE, $template_name);
            $category = $wgRequest->getVal('category');
            $aggregating_property = $wgRequest->getVal('semantic_property_aggregation');
            $aggregation_label = $wgRequest->getVal('aggregation_label');
            $template_format = $wgRequest->getVal('template_format');
            $full_text = SFTemplateField::createTemplateText($template_name, $fields, null, $category, $aggregating_property, $aggregation_label, $template_format);
            $text = SFUtils::printRedirectForm($title, $full_text, "", $save_page, $preview_page, false, false, false, null, null);
            $wgOut->addHTML($text);
            return;
        }
        $text .= '	<form id="createTemplateForm" action="" method="post">' . "\n";
        // Set 'title' field, in case there's no URL niceness
        $text .= Html::hidden('title', $this->getTitle()->getPrefixedText()) . "\n";
        $text .= "\t<p id=\"template_name_p\">" . wfMsg('sf_createtemplate_namelabel') . ' <input size="25" id="template_name" name="template_name" /></p>' . "\n";
        $text .= "\t<p>" . wfMsg('sf_createtemplate_categorylabel') . ' <input size="25" name="category" /></p>' . "\n";
        $text .= "\t<fieldset>\n";
        $text .= "\t" . Html::element('legend', null, wfMsg('sf_createtemplate_templatefields')) . "\n";
        $text .= "\t" . Html::element('p', null, wfMsg('sf_createtemplate_fieldsdesc')) . "\n";
        $all_properties = self::getAllPropertyNames();
        $text .= '<div id="fieldsList">' . "\n";
        $text .= self::printFieldEntryBox("1", $all_properties);
        $text .= self::printFieldEntryBox("starter", $all_properties, false);
        $text .= "</div>\n";
        $add_field_button = Html::input(null, wfMsg('sf_createtemplate_addfield'), 'button', array('onclick' => "createTemplateAddField()"));
        $text .= Html::rawElement('p', null, $add_field_button) . "\n";
        $text .= "\t</fieldset>\n";
        $text .= "\t<fieldset>\n";
        $text .= "\t" . Html::element('legend', null, wfMsg('sf_createtemplate_aggregation')) . "\n";
        $text .= "\t" . Html::element('p', null, wfMsg('sf_createtemplate_aggregationdesc')) . "\n";
        $text .= "\t<p>" . wfMsg('sf_createtemplate_semanticproperty') . ' ' . self::printPropertiesDropdown($all_properties, "aggregation") . "</p>\n";
        $text .= "\t<p>" . wfMsg('sf_createtemplate_aggregationlabel') . ' ' . Html::input('aggregation_label', null, 'text', array('size' => '25')) . "</p>\n";
        $text .= "\t</fieldset>\n";
        $text .= "\t<p>" . wfMsg('sf_createtemplate_outputformat') . "\n";
        $text .= "\t" . Html::input('template_format', 'standard', 'radio', array('checked' => true), null) . ' ' . wfMsg('sf_createtemplate_standardformat') . "\n";
        $text .= "\t" . Html::input('template_format', 'infobox', 'radio', null) . ' ' . wfMsg('sf_createtemplate_infoboxformat') . "</p>\n";
        $text .= "\t" . Html::hidden('csrf', $this->getUser()->getEditToken('CreateTemplate')) . "\n";
        $save_button_text = wfMsg('savearticle');
        $preview_button_text = wfMsg('preview');
        $text .= <<<END
\t<div class="editButtons">
\t<input type="submit" id="wpSave" name="wpSave" value="{$save_button_text}" />
\t<input type="submit" id="wpPreview" name="wpPreview" value="{$preview_button_text}" />
\t</div>
\t</form>

END;
        $sk = $wgUser->getSkin();
        $create_property_link = SFUtils::linkForSpecialPage($sk, 'CreateProperty');
        $text .= "\t<br /><hr /><br />\n";
        $text .= "\t" . Html::rawElement('p', null, $create_property_link . '.') . "\n";
        $wgOut->addExtensionStyle($sfgScriptPath . "/skins/SemanticForms.css");
        $wgOut->addHTML($text);
    }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:86,代码来源:SF_CreateTemplate.php

示例6: execute

    function execute($query)
    {
        global $wgLang, $smwgContLang;
        $out = $this->getOutput();
        $req = $this->getRequest();
        // Check permissions.
        if (!$this->getUser()->isAllowed('createclass')) {
            $this->displayRestrictionError();
            return;
        }
        $this->setHeaders();
        $numStartingRows = 5;
        $out->addJsConfigVars('$numStartingRows', $numStartingRows);
        $out->addModules(array('ext.semanticforms.SF_CreateClass'));
        $createAll = $req->getCheck('createAll');
        if ($createAll) {
            // Guard against cross-site request forgeries (CSRF).
            $validToken = $this->getUser()->matchEditToken($req->getVal('csrf'), 'CreateClass');
            if (!$validToken) {
                $text = "This appears to be a cross-site request forgery; canceling save.";
                $out->addHTML($text);
                return;
            }
            $this->createAllPages();
            return;
        }
        $specialBGColor = '#eeffcc';
        if (defined('SMW_VERSION')) {
            $possibleTypes = $smwgContLang->getDatatypeLabels();
        } elseif (defined('CARGO_VERSION')) {
            global $wgCargoFieldTypes;
            $possibleTypes = $wgCargoFieldTypes;
            $specialBGColor = '';
        } else {
            $possibleTypes = array();
        }
        // Make links to all the other 'Create...' pages, in order to
        // link to them at the top of the page.
        $creation_links = array();
        if (defined('SMW_VERSION')) {
            $creation_links[] = SFUtils::linkForSpecialPage('CreateProperty');
        }
        $creation_links[] = SFUtils::linkForSpecialPage('CreateTemplate');
        $creation_links[] = SFUtils::linkForSpecialPage('CreateForm');
        $creation_links[] = SFUtils::linkForSpecialPage('CreateCategory');
        $text = '<form action="" method="post">' . "\n";
        $text .= "\t" . Html::rawElement('p', null, wfMessage('sf_createclass_docu')->rawParams($wgLang->listToText($creation_links))->escaped()) . "\n";
        $templateNameLabel = wfMessage('sf_createtemplate_namelabel')->escaped();
        $templateNameInput = Html::input('template_name', null, 'text', array('size' => 30));
        $text .= "\t" . Html::rawElement('p', null, $templateNameLabel . ' ' . $templateNameInput) . "\n";
        $templateInfo = SFCreateTemplate::printTemplateStyleInput('template_format');
        $templateInfo .= Html::rawElement('p', null, Html::element('input', array('type' => 'checkbox', 'name' => 'template_multiple', 'id' => 'template_multiple', 'class' => "disableFormAndCategoryInputs")) . ' ' . wfMessage('sf_createtemplate_multipleinstance')->escaped()) . "\n";
        // Either #set_internal or #subobject will be added to the
        // template, depending on whether Semantic Internal Objects is
        // installed.
        global $smwgDefaultStore;
        if (defined('SIO_VERSION') || $smwgDefaultStore == "SMWSQLStore3") {
            $templateInfo .= Html::rawElement('div', array('id' => 'connecting_property_div', 'style' => 'display: none;'), wfMessage('sf_createtemplate_connectingproperty')->escaped() . "\n" . Html::element('input', array('type' => 'text', 'name' => 'connecting_property'))) . "\n";
        }
        $text .= Html::rawElement('blockquote', null, $templateInfo);
        $form_name_label = wfMessage('sf_createclass_nameinput')->text();
        $text .= "\t" . Html::rawElement('p', null, Html::element('label', array('for' => 'form_name'), $form_name_label) . ' ' . Html::element('input', array('size' => '30', 'name' => 'form_name', 'id' => 'form_name'), null)) . "\n";
        $category_name_label = wfMessage('sf_createcategory_name')->text();
        $text .= "\t" . Html::rawElement('p', null, Html::element('label', array('for' => 'category_name'), $category_name_label) . ' ' . Html::element('input', array('size' => '30', 'name' => 'category_name', 'id' => 'category_name'), null)) . "\n";
        if (defined('CARGO_VERSION') && !defined('SMW_VERSION')) {
            $cargo_table_label = wfMessage('sf_createtemplate_cargotablelabel')->escaped();
            $text .= "\t" . Html::rawElement('p', null, Html::element('label', array('for' => 'cargo_table'), $cargo_table_label) . ' ' . Html::element('input', array('size' => '30', 'name' => 'cargo_table', 'id' => 'cargo_table'), null)) . "\n";
        }
        $text .= "\t" . Html::element('br', null, null) . "\n";
        $text .= <<<END
\t<div>
\t\t<table id="mainTable" style="border-collapse: collapse;">

END;
        if (defined('SMW_VERSION')) {
            $property_label = wfMessage('smw_pp_type')->escaped();
            $text .= <<<END
\t\t<tr>
\t\t\t<th colspan="3" />
\t\t\t<th colspan="3" style="background: #ddeebb; padding: 4px;">{$property_label}</th>
\t\t</tr>

END;
        }
        $field_name_label = wfMessage('sf_createtemplate_fieldname')->escaped();
        $list_of_values_label = wfMessage('sf_createclass_listofvalues')->escaped();
        $text .= <<<END
\t\t<tr>
\t\t\t<th colspan="2">{$field_name_label}</th>
\t\t\t<th style="padding: 4px;">{$list_of_values_label}</th>

END;
        if (defined('SMW_VERSION')) {
            $property_name_label = wfMessage('sf_createproperty_propname')->escaped();
            $text .= <<<END
\t\t\t<th style="background: {$specialBGColor}; padding: 4px;">{$property_name_label}</th>

END;
        }
        $type_label = wfMessage('sf_createproperty_proptype')->escaped();
//.........这里部分代码省略.........
开发者ID:paladox,项目名称:mediawiki-extensions-SemanticForms,代码行数:101,代码来源:SF_CreateClass.php

示例7: execute

    function execute($query)
    {
        global $wgOut, $wgRequest, $wgUser, $sfgScriptPath;
        global $wgLang, $smwgContLang;
        // Check permissions.
        if (!$wgUser->isAllowed('createclass')) {
            $this->displayRestrictionError();
            return;
        }
        $this->setHeaders();
        $wgOut->addExtensionStyle($sfgScriptPath . "/skins/SemanticForms.css");
        $numStartingRows = 5;
        self::addJavascript($numStartingRows);
        $createAll = $wgRequest->getCheck('createAll');
        if ($createAll) {
            self::createAllPages();
            return;
        }
        $datatypeLabels = $smwgContLang->getDatatypeLabels();
        // Make links to all the other 'Create...' pages, in order to
        // link to them at the top of the page.
        $creation_links = array();
        $creation_links[] = SFUtils::linkForSpecialPage('CreateProperty');
        $creation_links[] = SFUtils::linkForSpecialPage('CreateTemplate');
        $creation_links[] = SFUtils::linkForSpecialPage('CreateForm');
        $creation_links[] = SFUtils::linkForSpecialPage('CreateCategory');
        $form_name_label = wfMessage('sf_createclass_nameinput')->text();
        $category_name_label = wfMessage('sf_createcategory_name')->text();
        $field_name_label = wfMessage('sf_createtemplate_fieldname')->text();
        $list_of_values_label = wfMessage('sf_createclass_listofvalues')->text();
        $property_name_label = wfMessage('sf_createproperty_propname')->text();
        $type_label = wfMessage('sf_createproperty_proptype')->text();
        $allowed_values_label = wfMessage('sf_createclass_allowedvalues')->text();
        $text = '<form action="" method="post">' . "\n";
        $text .= "\t" . Html::rawElement('p', null, wfMessage('sf_createclass_docu', $wgLang->listToText($creation_links))->text()) . "\n";
        $templateNameLabel = wfMessage('sf_createtemplate_namelabel')->text();
        $templateNameInput = Html::input('template_name', null, 'text', array('size' => 30));
        $text .= "\t" . Html::rawElement('p', null, $templateNameLabel . ' ' . $templateNameInput) . "\n";
        $templateInfo = SFCreateTemplate::printTemplateStyleInput('template_format');
        $templateInfo .= Html::rawElement('p', null, Html::element('input', array('type' => 'checkbox', 'name' => 'template_multiple', 'id' => 'template_multiple', 'onclick' => "disableFormAndCategoryInputs()")) . ' ' . wfMessage('sf_createtemplate_multipleinstance')->text()) . "\n";
        $text .= Html::rawElement('blockquote', null, $templateInfo);
        $text .= "\t" . Html::rawElement('p', null, Html::element('label', array('for' => 'form_name'), $form_name_label) . ' ' . Html::element('input', array('size' => '30', 'name' => 'form_name', 'id' => 'form_name'), null)) . "\n";
        $text .= "\t" . Html::rawElement('p', null, Html::element('label', array('for' => 'category_name'), $category_name_label) . ' ' . Html::element('input', array('size' => '30', 'name' => 'category_name', 'id' => 'category_name'), null)) . "\n";
        $text .= "\t" . Html::element('br', null, null) . "\n";
        $property_label = wfMessage('smw_pp_type')->text();
        $text .= <<<END
\t<div>
\t\t<table id="mainTable" style="border-collapse: collapse;">
\t\t<tr>
\t\t\t<th colspan="3" />
\t\t\t<th colspan="3" style="background: #ddeebb; padding: 4px;">{$property_label}</th>
\t\t</tr>
\t\t<tr>
\t\t\t<th colspan="2">{$field_name_label}</th>
\t\t\t<th style="padding: 4px;">{$list_of_values_label}</th>
\t\t\t<th style="background: #eeffcc; padding: 4px;">{$property_name_label}</th>
\t\t\t<th style="background: #eeffcc; padding: 4px;">{$type_label}</th>
\t\t\t<th style="background: #eeffcc; padding: 4px;">{$allowed_values_label}</th>
\t\t</tr>

END;
        // Make one more row than what we're displaying - use the
        // last row as a "starter row", to be cloned when the
        // "Add another" button is pressed.
        for ($i = 1; $i <= $numStartingRows + 1; $i++) {
            if ($i == $numStartingRows + 1) {
                $rowString = 'id="starterRow" style="display: none"';
                $n = 'starter';
            } else {
                $rowString = '';
                $n = $i;
            }
            $text .= <<<END
\t\t<tr {$rowString} style="margin: 4px;">
\t\t\t<td>{$n}.</td>
\t\t\t<td><input type="text" size="25" name="field_name_{$n}" /></td>
\t\t\t<td style="text-align: center;"><input type="checkbox" name="is_list_{$n}" /></td>
\t\t\t<td style="background: #eeffcc; padding: 4px;"><input type="text" size="25" name="property_name_{$n}" /></td>
\t\t\t<td style="background: #eeffcc; padding: 4px;">

END;
            $typeDropdownBody = '';
            foreach ($datatypeLabels as $label) {
                $typeDropdownBody .= "\t\t\t\t<option>{$label}</option>\n";
            }
            $text .= "\t\t\t\t" . Html::rawElement('select', array('name' => "property_type_{$n}"), $typeDropdownBody) . "\n";
            $text .= <<<END
\t\t\t</td>
\t\t\t<td style="background: #eeffcc; padding: 4px;"><input type="text" size="25" name="allowed_values_{$n}" /></td>

END;
        }
        $text .= <<<END
\t\t</tr>
\t\t</table>
\t</div>

END;
        $add_another_button = Html::element('input', array('type' => 'button', 'value' => wfMessage('sf_formedit_addanother')->text(), 'onclick' => "createClassAddRow()"));
        $text .= Html::rawElement('p', null, $add_another_button) . "\n";
//.........这里部分代码省略.........
开发者ID:seedbank,项目名称:old-repo,代码行数:101,代码来源:SF_CreateClass.php


注:本文中的SFUtils::linkForSpecialPage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。