Esempio n. 1
0
	/**
	 * Returns the inline edit view for the widget.
	 * Widgets do not have to support this, however if they are editable and
	 * configurable then the page view can be returned in a tool block view, which
	 * the default implementation provides.
	 *
	 * The inline edit view allows the current user to edit the contents of the
	 * widget.  This should only be allowed for users with permission and should
	 * generally be used to edit widget content rather than configuration.
	 *
	 * @return vBCms_View_Widget					- The view result
	 */
	public function getInlineEditView()
	{
		$this->assertWidget();

		// add the tool block
		$view = new vBCms_View_EditBlock('vbcms_edit_block');

		if ($this->canEdit())
		{
			$view->content = $this->getInlineEditBodyView();

			if ($this->is_editable)
			{
				$view->edit_url = vBCms_Route_Content::getURL(array('node' => $this->content->getNodeURLSegment(),
																'action' => vB_Router::getUserAction('vBCms_Controller_Widget', 'Edit')),
																array($this->widget->getId()));
			}

			if ($this->is_configurable)
			{
				$view->config_url = vBCms_Route_Content::getURL(array('node' => $this->content->getNodeURLSegment(),
																		'action' => vB_Router::getUserAction('vBCms_Controller_Widget', 'Config')),
																		array($this->widget->getId()));
			}
		}
		else
		{
			$view->content = $this->getPageView();
		}

		$view->type = new vB_Phrase('vbcms', 'widget');
		$view->typetitle = $this->widget->getTypeTitle();
		$view->title = $this->widget->getTitle();

		return $view;
	}