Add the page title and toolbar.

@return  void

@since   1.6
481163
protected function addToolbar()
	{
		$extension = JFactory::getApplication()->input->get('extension');
		$user = JFactory::getUser();
		$userId = $user->id;

		$isNew = ($this->item->id == 0);
		$checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $userId);

        // Check to see if the type exists
        //$ucmType = new ContentTableUcmType;
        //$this->typeId = $ucmType->getTypeId($extension . '.category');

		// Avoid nonsense situation.
		if ($extension == 'com_categories')
		{
			return;
		}

		// The extension can be in the form com_foo.section
		$parts = explode('.', $extension);
		$component = $parts[0];
		$section = (count($parts) > 1) ? $parts[1] : null;
		$componentParams = JComponentHelper::getParams($component);

		// Need to load the menu language file as mod_menu hasn't been loaded yet.
		$lang = JFactory::getLanguage();
		$lang->load($component, JPATH_BASE, null, false, true)
		|| $lang->load($component, JPATH_ADMINISTRATOR . '/components/' . $component, null, false, true);

		// Load the category helper.
		JLoader::register('CategoriesHelper', JPATH_ADMINISTRATOR . '/components/com_categories/helpers/categories.php');

		// Get the results for each action.
		$canDo = $this->canDo;

		// If a component categories title string is present, let's use it.
		if ($lang->hasKey($component_title_key = $component . ($section ? "_$section" : '') . '_CATEGORY_' . ($isNew ? 'ADD' : 'EDIT') . '_TITLE'))
		{
			$title = JText::_($component_title_key);
		}
		// Else if the component section string exits, let's use it
		elseif ($lang->hasKey($component_section_key = $component . ($section ? "_$section" : '')))
		{
			$title = JText::sprintf('COM_CATEGORIES_CATEGORY_' . ($isNew ? 'ADD' : 'EDIT')
					. '_TITLE', $this->escape(JText::_($component_section_key))
					);
		}
		// Else use the base title
		else
		{
			$title = JText::_('COM_CATEGORIES_CATEGORY_BASE_' . ($isNew ? 'ADD' : 'EDIT') . '_TITLE');
		}

		// Load specific css component
		JHtml::_('stylesheet', $component . '/administrator/categories.css', array(), true);

		// Prepare the toolbar.
		JToolbarHelper::title(
			$title,
			'folder category-' . ($isNew ? 'add' : 'edit')
				. ' ' . substr($component, 4) . ($section ? "-$section" : '') . '-category-' . ($isNew ? 'add' : 'edit')
		);

		// For new records, check the create permission.
		if ($isNew && (count($user->getAuthorisedCategories($component, 'core.create')) > 0))
		{
			JToolbarHelper::apply('category.apply');
			JToolbarHelper::save('category.save');
			JToolbarHelper::save2new('category.save2new');
			JToolbarHelper::cancel('category.cancel');
		}

		// If not checked out, can save the item.
		else
		{
			// Since it's an existing record, check the edit permission, or fall back to edit own if the owner.
			$itemEditable = $canDo->get('core.edit') || ($canDo->get('core.edit.own') && $this->item->created_user_id == $userId);

			// Can't save the record if it's checked out and editable
			if (!$checkedOut && $itemEditable)
			{
				JToolbarHelper::apply('category.apply');
				JToolbarHelper::save('category.save');

				if ($canDo->get('core.create'))
				{
					JToolbarHelper::save2new('category.save2new');
				}
			}

			// If an existing item, can save to a copy.
			if ($canDo->get('core.create'))
			{
				JToolbarHelper::save2copy('category.save2copy');
			}

			JToolbarHelper::cancel('category.cancel', 'JTOOLBAR_CLOSE');
		}

		JToolbarHelper::divider();

		// Compute the ref_key
		$ref_key = strtoupper($component . ($section ? "_$section" : '')) . '_CATEGORY_' . ($isNew ? 'ADD' : 'EDIT') . '_HELP_KEY';

		// Check if thr computed ref_key does exist in the component
		if (!$lang->hasKey($ref_key))
		{
			$ref_key = 'JHELP_COMPONENTS_'
						. strtoupper(substr($component, 4) . ($section ? "_$section" : ''))
						. '_CATEGORY_' . ($isNew ? 'ADD' : 'EDIT');
		}

		/*
		 * Get help for the category/section view for the component by
		 * -remotely searching in a language defined dedicated URL: *component*_HELP_URL
		 * -locally  searching in a component help file if helpURL param exists in the component and is set to ''
		 * -remotely searching in a component URL if helpURL param exists in the component and is NOT set to ''
		 */
		if ($lang->hasKey($lang_help_url = strtoupper($component) . '_HELP_URL'))
		{
			$debug = $lang->setDebug(false);
			$url = JText::_($lang_help_url);
			$lang->setDebug($debug);
		}
		else
		{
			$url = null;
		}

		JToolbarHelper::help($ref_key, $componentParams->exists('helpURL'), $url, $component);
	}
1132492
public function add()
    {
        $dashboard = $this->Dashboards->newEntity();

        /**
         * @var \Search\Model\Table\WidgetsTable $widgetsTable
         */
        $widgetsTable = TableRegistry::get('Search.Widgets');
        $widgets = $widgetsTable->getWidgets();

        if ($this->request->is('post')) {
            $data = (array)$this->request->getData();

            $widgets = [];

            $dashboard = $this->Dashboards->patchEntity($dashboard, [
                'name' => $data['name'],
                'role_id' => $data['role_id'],
            ]);

            $resultedDashboard = $this->Dashboards->save($dashboard);

            if ($resultedDashboard) {
                $this->Flash->success((string)__('The dashboard has been saved.'));

                $dashboardId = $resultedDashboard->id;

                $data['widgets'] = !empty($data['options']) ? json_decode($data['options'], true) : [];

                if (!empty($data['widgets'])) {
                    $widgetsTable->saveDashboardWidgets($dashboardId, $data['widgets']);
                }

                return $this->redirect(['action' => 'view', $dashboard->id]);
            } else {
                $this->Flash->error((string)__('The dashboard could not be saved. Please, try again.'));
            }
        }

        $roles = $this->Dashboards->Roles->find('list', ['limit' => 200]);
        $savedWidgetData = [];

        $this->set(compact('dashboard', 'roles', 'widgets', 'savedWidgetData'));
        $this->set('columns', Configure::readOrFail('Search.dashboard.columns'));
        $this->set('_serialize', ['dashboard']);
    }
1099531
public function addPathes() {
		$this->AddPath(BTEMPLATESPATH . $this->templatename . DIRECTORY_SEPARATOR);
		$this->AddPath(BTEMPLATESPATH . 'default' . DIRECTORY_SEPARATOR);
	}
887101
public function CreatePage() 
	{
		parent::CreatePage(); // Doesnt necessary get PX, because PX is protected!
		
		$deleteMode = false;
		
		//Strings
		$action = strtolower($this->_action);
		$id = $this->_context->get("id");
		$group = $this->_context->get("group");
		$contents = "";
		$titleIndex = $this->_context->get("titleIndex");		
		$summaryIndex = $this->_context->get("summaryIndex");
		$groupKeyword = $this->_context->get("groupKeyword");

		$myWords = $this->WordCollection();
		$this->setHelp($myWords->Value("DESCRIPTION"));
		$this->setTitlePage($myWords->Value("TITLE"));
		
		//XmlNode 
		$block = $this->_px->addBlockCenter($myWords->Value("WORKINGAREA"));

		$this->addMenuOption($myWords->Value("TXT_BACK"), "module:Xmlnuke.Admin.ListXML");
		/*
		XmlNode paragraph;
		XmlNode form;
		XmlNode boxButton;
		XmlNode editNode; // (For Index)
		processor.XMLFilenameProcessor xmlFile;
		*/

		// Open Index File
		$indexFile = new XMLFilenameProcessor("index");
		//XmlDocument 
		
		$index = $this->_context->getXMLDataBase()->getDocument($indexFile->FullQualifiedName(),null);

		// --------------------------------------
		// CHECK ACTION
		// --------------------------------------
		
		if ( ($action == "edit") || ($action == "new") )
		{
			$contents = $this->_context->get("contents");				
			$contents = stripslashes($contents);
			$this->_context->setSession("texto", $contents); 
			
			/*echo "<PRE>";
			echo htmlentities($contents);
			echo "</PRE>";*/
			
			try
			{
				$title = "";
				$summary = "";
				//XmlNode $node;

				// Get edited XML and update info about INDEX.
				//XmlDocument
				$xml = XmlUtil::CreateXmlDocumentFromStr($contents);

				//$node = XmlUtil::SelectSingleNode($xml->documentElement, "/page/meta/title");
				$node = XmlUtil::SelectSingleNode($xml->documentElement, "meta/title");
				if ($node != null)
				{
					$title = $node->nodeValue;
				}
				//$node = XmlUtil::SelectSingleNode($xml->documentElement,"/page/meta/abstract");
				$node = XmlUtil::SelectSingleNode($xml->documentElement,"meta/abstract");
				if ($node != null)
				{
					$summary = $node->nodeValue;
				}
				//$node = XmlUtil::SelectSingleNode($xml->documentElement,"/page/meta/modified");
				$node = XmlUtil::SelectSingleNode($xml->documentElement,"meta/modified");
				if ($node != null)
				{
					$node->nodeValue = date("D M j Y G:i:s");
				}
				//$node = XmlUtil::SelectSingleNode($xml->documentElement,"/page/meta/groupkeyword");
				$node = XmlUtil::SelectSingleNode($xml->documentElement,"meta/groupkeyword");
				
				if ($node != null)
				{
					$node->nodeValue = $groupKeyword;
				}

				if ($id != "_all")
				{
					if ($action == "edit")
					{
						//$editNode = XmlUtil::SelectSingleNode($index->documentElement, "/xmlindex/group[id='" . $group . "']/page[id='" . $id . "']");
						$editNode = XmlUtil::SelectSingleNode($index->documentElement, "group[id='" . $group . "']/page[id='" . $id . "']");
						if ($titleIndex == "")
						{
							$titleIndex = $title;
						}
						XmlUtil::SelectSingleNode($editNode,"title")->nodeValue = $titleIndex;

						if ($summaryIndex == "")
						{
							$summaryIndex = $summary;
						}
						XmlUtil::SelectSingleNode($editNode,"summary")->nodeValue = $summaryIndex;
					}
					else
					{
						
						//$editNode = XmlUtil::SelectSingleNode($index->documentElement,"/xmlindex/group[id='" . $group . "']");		
						$editNode = XmlUtil::SelectSingleNode($index->documentElement,"group[id='" . $group . "']");
						$newNode = XmlUtil::CreateChild($editNode, "page", "");
						XmlUtil::CreateChild($newNode, "id", $id);
						XmlUtil::CreateChild($newNode, "title", $title);
						XmlUtil::CreateChild($newNode, "summary", $summary);
						$titleIndex = $title;
						$summaryIndex = $summary;
					}
				}

				$xmlFile = new XMLFilenameProcessor($id);
					
				$this->_context->getXMLDataBase()->saveDocumentXML($xmlFile->FullQualifiedName(), $xml);
				$this->_context->getXMLDataBase()->saveDocumentXML($indexFile->FullQualifiedName(), $index);
				$this->_context->getXMLDataBase()->saveIndex();
				$paragraph = $this->_px->addParagraph($block);
				FileUtil::DeleteFilesFromPath($this->_cacheFile);
				FileUtil::DeleteFilesFromPath(new XSLCacheFilenameProcessor(""));
				$this->_px->addBold($paragraph, $myWords->Value("SAVED"));
			}
			//catch (XmlException ex)
			catch (Exception $ex)
			{
				
				$paragraph = $this->_px->addParagraph($block);
				$this->_px->AddErrorMessage($paragraph, $contents, $ex);
			}
		}

		// Get the group from the Index and Update Edit Fields
		//$editNode = XmlUtil::SelectSingleNode( $index->documentElement,"/xmlindex/group[page[id='" . $id . "']]/id");
		$editNode = XmlUtil::SelectSingleNode( $index->documentElement,"group[page[id='" . $id . "']]/id");
		if ($editNode != null)
		{
			$group = $editNode->nodeValue;
			//$editNode = XmlUtil::SelectSingleNode($index->documentElement,"/xmlindex/group[id='" . $group . "']/page[id='" . $id . "']");
			$editNode = XmlUtil::SelectSingleNode($index->documentElement,"group[id='" . $group . "']/page[id='" . $id . "']");
			$titleIndex = XmlUtil::SelectSingleNode($editNode,"title")->nodeValue;
			$summaryIndex = XmlUtil::SelectSingleNode($editNode,"summary")->nodeValue;
		}
		
		if ($action == "delete")
		{
			$paragraph = $this->_px->addParagraph($block);
			$this->_px->addHref($paragraph, "module:Xmlnuke.Admin.ManageXML?id=" . $this->_context->get("id") . "&action=confirmdelete", $myWords->Value("CONFIRMDELETE", $this->_context->get("id")), null);
			$deleteMode = true;
		}

		if ($action == "confirmdelete")
		{
			$paragraph = $this->_px->addParagraph($block);
			//$editNode = XmlUtil::SelectSingleNode($index->documentElement,"/xmlindex/group[id='" . $group . "']");		
			$editNode = XmlUtil::SelectSingleNode($index->documentElement,"group[id='" . $group . "']");
			$delNode = XmlUtil::SelectSingleNode($editNode,"page[id='" . $id . "']");
			if ($delNode != null)
			{
				$editNode->removeChild($delNode);
			}
			
			$this->_context->getXMLDataBase()->saveDocumentXML($indexFile->FullQualifiedName(), $index);
			//util.FileUtil.DeleteFile(new processor.XMLFilenameProcessor(_context.get("id"), this._context));
			$this->_context->getXMLDataBase()->saveIndex();
			$this->_px->addBold($paragraph, $myWords->Value("DELETED"));
			$deleteMode = true;
		}

		// --------------------------------------
		// EDIT XML PAGE
		// --------------------------------------
		// If doesnt have an ID, list all pages or add new!
		if ($id == "")
		{
			$action = "new";
		}
		else
		{
			$this->addMenuOption($myWords->Value("PREVIEWMENU"), "engine:xmlnuke?xml=" . $id . "&xsl=[param:xsl]&lang=[param:lang]", "preview");
			$this->addMenuOption($myWords->Value("NEWXMLMENU"), "module:Xmlnuke.Admin.ManageXML", null);
			$langAvail = $this->_context->LanguagesAvailable();
			$processorFile = new XMLFilenameProcessor($id);
			foreach(array_keys($langAvail) as $key) 				
			{
				if ($key != strtolower($this->_context->Language()->getName()));
				{
					$repositorio = 	new XmlnukeDB($this->_context->XmlHashedDir(), $this->_context->XmlPath(), $key);
					$fileToCheck = $processorFile->FullName($id, "", $key) . $processorFile->Extension();
					if ($repositorio->existsDocument($fileToCheck))
					{
						$this->addMenuOption($myWords->ValueArgs("EDITXMLMENU" ,array($langAvail[$key])), "module:Xmlnuke.Admin.ManageXML?id=" . $id . "&lang=".$key, null);
					}
					else
					{
						$this->addMenuOption($myWords->ValueArgs("CREATEXMLMENU", array($langAvail[$key])), "module:Xmlnuke.Admin.ManageXML?id=" . $id . "&lang=".$key, null);
					}
				}
			}
			$action = "edit";
		}


		// Show form to Edit/Insert
		if (!$deleteMode)
		{
			$paragraph = $this->_px->addParagraph($block);
			//XmlNodeS 
			$table = $this->_px->addTable($paragraph);
			$row = $this->_px->addTableRow($table);
			$col = $this->_px->addTableColumn($row);
			$form = $this->_px->addForm($col, "module:Xmlnuke.Admin.ManageXML", "","form", true );

			$xmlExist = true;
			if ($id != "")
			{
				$xmlTestExist = new XMLFilenameProcessor($id);
				$xmlExist = $this->_context->getXMLDataBase()->existsDocument($xmlTestExist->FullQualifiedName());
			}

			$canUseNew = (($action != "new") && !$xmlExist);
			
			//Trecho acrescentado para manter o conteudo do textarea mesmo no caso de erro.
			$contents = $this->_context->getSession("texto");
			//echo $contents;
			if (($action == "new") || $canUseNew)
			{
				$action = "new"; // This is necessary, because user can Create a predefined ID...
				if (!$canUseNew || ($id == ""))
				{
					$this->_px->addTextBox($form, $myWords->Value("XMLBOX"), "id", "", 20, true, INPUTTYPE::TEXT);
				}
				else
				{
					$this->_px->addLabelField($form, $myWords->Value("XMLBOX"), $id);
					$this->_px->addHidden($form, "id", $id);
				}
				$this->_px->addLabelField($form, $myWords->Value("LANGUAGEBOX"), strtolower($this->_context->Language()->getName()));
				//if($contents!="")
				//{
					$contents = 
						"<page>\n" .
						"  <meta>\n" .
						"    <title>Put your title here</title>\n" .
						"    <abstract>Put page abstract informations here</abstract>\n" .
						"    <created>" . date("D M j Y G:i:s") . "</created>\n" .
						"    <modified/>\n" .
						"    <keyword>xmlnuke</keyword>\n" . 
						"    <groupkeyword>all</groupkeyword>\n" .
						"  </meta>\n" .
						"  <blockcenter>\n" . 
						"    <title>Block Title</title>\n" .
						"    <body>\n" .
						"      <p>This is the first paragraph</p>\n" .
						"    </body>\n" .
						"  </blockcenter>\n" .
						"</page>\n";
				//}
				session_unregister("texto");
			}
			else
			{
				$this->_px->addLabelField($form, $myWords->Value("LANGUAGEBOX"), strtolower($this->_context->Language()->getName()));
				$this->_px->addHidden($form, "id", $id);
				$xmlFile = new XMLFilenameProcessor($id);
				//XmlDocument 
				$xml = $this->_context->getXMLDataBase()->getDocument($xmlFile->FullQualifiedName(), null);
				//if($contents!="")					
					$contents = str_replace("&amp;", "&", XmlUtil::GetFormattedDocument($xml));
				$editNode = XmlUtil::SelectSingleNode($xml->documentElement,"meta/groupkeyword");
				if ($editNode != null)
				{
					$groupKeyword = $editNode->nodeValue;
				}
				session_unregister("texto");
			}

			if ($id != "_all")
			{
				$this->_px->addCaption($form, $myWords->Value("SITEMAPINFO"));
				$this->_px->addTextBox($form, $myWords->Value("INDEXBOX"), "titleIndex", $titleIndex, 60, true, INPUTTYPE::TEXT);
				$selectNode = $this->_px->addSelect($form, $myWords->Value("LISTEDBOX"), "group");
				$this->_px->addTextBox($form, $myWords->Value("INDEXSUMMARYBOX"), "summaryIndex", $summaryIndex, 60, true, INPUTTYPE::TEXT);

				$this->_px->addCaption($form, $myWords->Value("PAGEINFO"));
				//XmlNode 
				$selectPageNode = $this->_px->addSelect($form,$myWords->Value("SHOWMENUBOX"), "groupKeyword");
				$this->_px->addOption($selectPageNode, $myWords->Value("NOTLISTEDOPTION"), "-", null);					
				
				//XmlNodeList 
				//$groupList = XmlUtil::SelectNodes($index->documentElement,"/xmlindex/group");
				$groupList = XmlUtil::SelectNodes($index->documentElement,"/group");
				
				foreach( $groupList as $node )					
				{				
					
					$value = XmlUtil::SelectSingleNode($node,"title")->nodeValue;
										
					$this->_px->addOption($selectNode, XmlUtil::SelectSingleNode($node,"title")->nodeValue . " (" . XmlUtil::SelectSingleNode($node,"/id")->nodeValue . ")", XmlUtil::SelectSingleNode($node,"/id")->nodeValue, XmlUtil::SelectSingleNode($node,"/id")->nodeValue == $group);
					
					$this->_px->addOption($selectPageNode, XmlUtil::SelectSingleNode($node,"title")->nodeValue . " (" . XmlUtil::SelectSingleNode($node,"/keyword")->nodeValue . ")", XmlUtil::SelectSingleNode($node,"/keyword")->nodeValue, XmlUtil::SelectSingleNode($node,"/keyword")->nodeValue == $groupKeyword);
				
				}
			
			}
			
			$this->_px->addHidden($form, "action", $action);
			$this->_px->addCaption($form, $myWords->Value("XMLEDITINFO"));
			$this->_px->addMemo($form, $myWords->Value("XMLCONTENTBOX"), "contents", $contents, 80, 30, "soft");
			$boxButton = $this->_px->addBoxButtons($form);
			$this->_px->addSubmit($boxButton, "", $myWords->Value("TXT_SAVE"));
		}
		
		return $this->_px;
	}
290575
public function addToolbarCommands()
    {
        $entity = $this->getController()->getItem();

        if ($entity->authorize('edit')) {
            $this->addCommand('edit');
        }

        if ($entity->authorize('delete')) {
            $this->addCommand('delete');
        }
    }
517561
public static function updateTitle()
    {
        if (Yii::$app instanceof Application === true && Yii::$app->request->get('page') !== null) {
            Yii::$app->view->title .= Yii::t(
                'plugin',
                ' - Page {page}',
                ['page' => (int)Yii::$app->request->get('page')]
            );
        }
    }
1236555
public function addBookmark()
    {
        $this->setBookmark();
        $this->controlAccess('bookmark_add');

        $options = array(
            'user_id' => $this->uid,
            'title' => $this->data_title
        );

        $this->bookmark->set($this->data_path, $options);
        $this->redirect($this->data_path);
    }
1213087
private function pageHeaderEndHandler(): void
    {
        $this->print_data      = array_pop($this->print_data_stack);
        $this->current_element = $this->wt_report;
        $this->wt_report       = array_pop($this->wt_report_stack);
        $this->wt_report->addElement($this->current_element);
    }
1148494
def add_toolbars_to_menu(self, menu_title, actions):
        """"""
        # Six is the position of the view menu in menus list
        # that you can find in plugins/editor.py setup_other_windows.
        view_menu = self.menus[6]
        if actions == self.toolbars and view_menu:
            toolbars = []
            for toolbar in self.toolbars:
                action = toolbar.toggleViewAction()
                toolbars.append(action)
            add_actions(view_menu, toolbars)
1289828
private function AddTitleField()
    {
        $name = 'Title';
        $this->AddField(Input::Text($name, $this->page->GetTitle()));
    }
296231
function title(cb) {
    cb((params.sitemap && params.sitemap[page]) ?
      params.sitemap[page].title :
      '[error] page ' + page + ' does not have any sitemap title');
  }
543156
@Override
    public void addPages() {
        super.addPages();
        mainPage = new ExportWizardPage("Bug Counts Export", TITLE, DESCRIPTION, "icons/export_bugs.png");
        addPage(mainPage);
        setWindowTitle(mainPage.getName());
    }
1284376
protected function addStandardAssignments()
    {
        $this->searchProvider->setConfigurationValue('extendedSearch', $this->searchProvider->isExtendedSearch());
        $this->searchProvider->setConfigurationValue(
            'uid',
            $this->configurationManager->getContentObject()->data['uid']
        );
        $this->searchProvider->setConfigurationValue('prefixID', 'tx_find_find');
        $this->searchProvider->setConfigurationValue('pageTitle', $GLOBALS['TSFE']->page['title']);
    }
726890
private function AddMetaTitlePlacementField()
    {
        $name = 'MetaTitlePlacement';
        $value = $this->archive->GetMetaTitlePlacement() ?: MetaPlacement::Prepend()->Value();
        $this->AddMetaPlacementSelect($name, $value);
    }
920494
protected function addPageName()
    {
        if (! empty($this->getPageName()) && ! in_array($this->getPageName(), $this->collection)) {
            $this->add($this->getPageName());
        }
    }
437937
protected function create_navbar() {
        global $PAGE, $CFG;

        $PAGE->navbar->add(format_string($this->title), $CFG->wwwroot . '/mod/wiki/view.php?pageid=' . $this->page->id);
    }
982000
protected function setTitleIndexCategory()
    {
        $metatitle = $this->data_category['meta_title'];

        if (empty($metatitle)) {
            $metatitle = $this->data_category['title'];
        }

        $this->setTitle($metatitle, false);
        $this->setPageTitle($this->data_category['title']);
    }