/** * Sets the content * @param integer $widgetId Id of the widget * @param array $result Array with Content objects * @param joppa\content\model\ContentProperties $contentProperties Properties for the view * @param joppa\content\model\PaginationProperties $paginationProperties Properties for the pagination * @param string $moreUrl URL * @return null */ public function setContent($widgetId, array $result, ContentProperties $contentProperties, PaginationProperties $paginationProperties = null, $moreUrl = null) { // $template = $properties->getViewTemplate(); // if ($template) { // $this->template = $template; // } $this->set('widgetId', $widgetId); $this->set('title', $contentProperties->getTitle()); $this->set('emptyResultMessage', $contentProperties->getEmptyResultMessage()); $this->set('result', $result); $this->set('pagination', $paginationProperties); if ($moreUrl) { $this->set('moreUrl', $moreUrl); $this->set('moreLabel', $contentProperties->getMoreLabel()); } else { $this->set('moreUrl', null); } if ($contentProperties->useAjaxForPagination()) { $this->addJavascript(self::SCRIPT); $this->addInlineJavascript('joppaContentInitializePagination(' . $widgetId . ')'); } }
/** * Gets a content properties object for the submitted form * @return joppa\content\model\ContentProperties */ public function getContentProperties() { $properties = new ContentProperties(); $properties->setModelName($this->getValue(self::FIELD_MODEL)); $properties->setRecursiveDepth($this->getValue(self::FIELD_RECURSIVE_DEPTH)); $properties->setIncludeUnlocalized($this->getValue(self::FIELD_INCLUDE_UNLOCALIZED)); $properties->setView($this->getValue(self::FIELD_VIEW)); $fields = $this->getValue(self::FIELD_FIELDS); if ($fields) { $properties->setModelFields($fields); } return $properties; }
/** * Gets the properties * @return joppa\content\model\ContentProperties */ private function getContentProperties() { $contentProperties = new ContentProperties(); $contentProperties->getFromWidgetProperties($this->properties, $this->locale); return $contentProperties; }