public function saveData($aDocumentationData) { if ($this->iDocumentationId === null) { $oDocumentation = new Documentation(); } else { $oDocumentation = DocumentationQuery::create()->findPk($this->iDocumentationId); } $oRichtextUtil = new RichtextUtil(); $oRichtextUtil->setTrackReferences($oDocumentation); $oDocumentation->setDescription($oRichtextUtil->parseInputFromEditor($aDocumentationData['description'])); $oDocumentation->setName($aDocumentationData['name']); $oDocumentation->setTitle($aDocumentationData['title']); $oDocumentation->setKey($aDocumentationData['key']); if (isset($aDocumentationData['name_space'])) { $oDocumentation->setNameSpace($aDocumentationData['name_space']); } $oDocumentation->setVersion($aDocumentationData['version']); $oDocumentation->setTitle($aDocumentationData['title']); $oDocumentation->setIsPublished($aDocumentationData['is_published']); $oDocumentation->setYoutubeUrl($aDocumentationData['youtube_url']); if ($oDocumentation->getYoutubeUrl() == null) { $oDocumentation->setYoutubeUrl(null); } $this->validate($aDocumentationData, $oDocumentation); if (!Flash::noErrors()) { throw new ValidationException(); } return $oDocumentation->save(); }
public function getCustomListElements() { if (DocumentationQuery::create()->count() > 0) { return array(array('documentation_id' => CriteriaListWidgetDelegate::SELECT_ALL, 'full_name' => TranslationPeer::getString('wns.sidebar.select_all'), 'magic_column' => 'all')); } return array(); }
public function onPageHasBeenSet($oPage, $bIsNotFound, $oNavigationItem) { if ($bIsNotFound || !$oNavigationItem instanceof VirtualNavigationItem || $oNavigationItem->getType() !== self::ITEM_TYPE && $oNavigationItem->getType() !== self::ITEM_TYPE_UNCATEGORIZED) { return; } // IMPORTANT: documentation needs to be configured as content in the parent page, f.e. "show detail" if ($oNavigationItem->getType() === self::ITEM_TYPE) { DocumentationsFrontendModule::$DOCUMENTATION = DocumentationQuery::create()->active()->filterByKey($oNavigationItem->getName())->findOne(); } DocumentationsFrontendModule::$DOCUMENTATION_PARTS = $oNavigationItem->getData(); }
private function contentAction() { $sLanguageId = Manager::usePath(); $sDocumentationKey = Manager::usePath(); $sPartKey = Manager::usePath(); RichtextUtil::$USE_ABSOLUTE_LINKS = LinkUtil::isSSL(); if ($sPartKey) { $oPart = DocumentationPartQuery::create()->filterByLanguageId($sLanguageId)->filterByKeys($sDocumentationKey, $sPartKey)->findOne(); if (!$oPart) { if ($sPartKey === self::TUTORIAL_KEY) { return TranslationPeer::getString('wns.documentation.video_tutorial', $sLanguageId, "Tutorial"); } return null; } return RichtextUtil::parseStorageForFrontendOutput($oPart->getBody())->render(); } else { $oDocumentation = DocumentationQuery::create()->filterByLanguageId($sLanguageId)->filterByKey($sDocumentationKey)->findOne(); if (!$oDocumentation) { return null; } $sHtmlOutput = RichtextUtil::parseStorageForFrontendOutput($oDocumentation->getDescription())->render(); $aParts = $oDocumentation->getDocumentationPartsOrdered(); if (count($aParts) > 0) { $sHtmlOutput .= '<ul class="documentation_parts">'; foreach ($aParts as $i => $oPart) { $sHtmlOutput .= TagWriter::quickTag('li', array(), self::addPartLink($oPart)); } $sHtmlOutput .= '</ul>'; } $bDisplayVideo = false; if ($bDisplayVideo && $oDocumentation->getYoutubeUrl()) { $sHtmlOutput .= $this->embedVideo($oDocumentation->getYoutubeUrl()); } return $sHtmlOutput; } }
public function getDocumentations() { return WidgetJsonFileModule::jsonBaseObjects(DocumentationQuery::create()->orderByName()->find(), array('id', 'name')); }
/** * Get the associated Documentation object * * @param PropelPDO $con Optional Connection object. * @param $doQuery Executes a query to get the object if required * @return Documentation The associated Documentation object. * @throws PropelException */ public function getDocumentation(PropelPDO $con = null, $doQuery = true) { if ($this->aDocumentation === null && $this->documentation_id !== null && $doQuery) { $this->aDocumentation = DocumentationQuery::create()->findPk($this->documentation_id, $con); /* The following can be used additionally to guarantee the related object contains a reference to this object. This level of coupling may, however, be undesirable since it could result in an only partially populated collection in the referenced object. $this->aDocumentation->addDocumentationParts($this); */ } return $this->aDocumentation; }
/** * Removes this object from datastore and sets delete attribute. * * @param PropelPDO $con * @return void * @throws PropelException * @throws Exception * @see BaseObject::setDeleted() * @see BaseObject::isDeleted() */ public function delete(PropelPDO $con = null) { if ($this->isDeleted()) { throw new PropelException("This object has already been deleted."); } if ($con === null) { $con = Propel::getConnection(DocumentationPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); } $con->beginTransaction(); try { $deleteQuery = DocumentationQuery::create()->filterByPrimaryKey($this->getPrimaryKey()); $ret = $this->preDelete($con); // denyable behavior if (!(DocumentationPeer::isIgnoringRights() || $this->mayOperate("delete"))) { throw new PropelException(new NotPermittedException("delete.by_role", array("role_key" => "documentations"))); } if ($ret) { $deleteQuery->delete($con); $this->postDelete($con); $con->commit(); $this->setDeleted(true); } else { $con->commit(); } } catch (Exception $e) { $con->rollBack(); throw $e; } }
public function getDocumentationName() { $oDocumentation = DocumentationQuery::create()->findPk($this->oDelegateProxy->getDocumentationId()); if ($oDocumentation) { return $oDocumentation->getName(); } if ($this->oDelegateProxy->getDocumentationId() === CriteriaListWidgetDelegate::SELECT_WITHOUT) { return TranslationPeer::getString('wns.documentation_part.without_documentation'); } return $this->oDelegateProxy->getDocumentationId(); }
private function getDocumentationOptions() { return DocumentationQuery::create()->orderByName()->select(array('Id', 'Name'))->find()->toKeyValue('Id', 'Name'); }
public function renderMostRecentTeaser() { $oDocumentation = DocumentationQuery::create()->active()->filterByLanguageId(Session::language())->filterByYoutubeUrl(null, Criteria::ISNOTNULL)->orderByCreatedAt(Criteria::DESC)->findOne(); if ($oDocumentation === null) { return null; } $this->setLinkPage(); $oTemplate = $this->constructTemplate('teaser'); $oTemplate->replaceIdentifier('title', $oDocumentation->getTitle()); $oTemplate->replaceIdentifier('name', $oDocumentation->getName()); if ($oDocumentation->getYoutubeUrl() != null) { $this->embedVideo($oTemplate, $oDocumentation->getYoutubeUrl()); } $oLink = TagWriter::quickTag('a', array('rel' => 'internal', 'href' => LinkUtil::link($this->oPage->getFullPathArray(array($oDocumentation->getKey()))), 'class' => 'read_more'), TranslationPeer::getString('wns.read_more')); $oTemplate->replaceIdentifier('link_to_detail', $oLink); return $oTemplate; }
/** * Returns a new DocumentationQuery object. * * @param string $modelAlias The alias of a model in the query * @param DocumentationQuery|Criteria $criteria Optional Criteria to build the query from * * @return DocumentationQuery */ public static function create($modelAlias = null, $criteria = null) { if ($criteria instanceof DocumentationQuery) { return $criteria; } $query = new DocumentationQuery(null, null, $modelAlias); if ($criteria instanceof Criteria) { $query->mergeWith($criteria); } return $query; }