public function getXHTMLContent() { $content = $this->getContent(); $content = nahoWikiContentPeer::preConvert($this->getPage(), $content); $content = nahoWikiContentPeer::doConvert($content); $content = nahoWikiContentPeer::postConvert($this->getPage(), $content); return $content; }
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = nahoWikiContentPeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) { $this->setId($arr[$keys[0]]); } if (array_key_exists($keys[1], $arr)) { $this->setContent($arr[$keys[1]]); } if (array_key_exists($keys[2], $arr)) { $this->setGzContent($arr[$keys[2]]); } }
public static function doSelectJoinAllExceptnahoWikiPage(Criteria $c, $con = null) { foreach (sfMixer::getCallables('BasenahoWikiRevisionPeer:doSelectJoinAllExcept:doSelectJoinAllExcept') as $callable) { call_user_func($callable, 'BasenahoWikiRevisionPeer', $c, $con); } $c = clone $c; if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } nahoWikiRevisionPeer::addSelectColumns($c); $startcol2 = nahoWikiRevisionPeer::NUM_COLUMNS - nahoWikiRevisionPeer::NUM_LAZY_LOAD_COLUMNS + 1; nahoWikiContentPeer::addSelectColumns($c); $startcol3 = $startcol2 + nahoWikiContentPeer::NUM_COLUMNS; $c->addJoin(nahoWikiRevisionPeer::CONTENT_ID, nahoWikiContentPeer::ID); $rs = BasePeer::doSelect($c, $con); $results = array(); while ($rs->next()) { $omClass = nahoWikiRevisionPeer::getOMClass(); $cls = Propel::import($omClass); $obj1 = new $cls(); $obj1->hydrate($rs); $omClass = nahoWikiContentPeer::getOMClass(); $cls = Propel::import($omClass); $obj2 = new $cls(); $obj2->hydrate($rs, $startcol2); $newObject = true; for ($j = 0, $resCount = count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; $temp_obj2 = $temp_obj1->getnahoWikiContent(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addnahoWikiRevision($obj1); break; } } if ($newObject) { $obj2->initnahoWikiRevisions(); $obj2->addnahoWikiRevision($obj1); } $results[] = $obj1; } return $results; }
public static function retrieveByPKs($pks, $con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(); $criteria->add(nahoWikiContentPeer::ID, $pks, Criteria::IN); $objs = nahoWikiContentPeer::doSelect($criteria, $con); } return $objs; }
?> <?php } ?> </p> <?php } else { ?> <?php $content = $revision->getXHTMLContent(); ?> <?php if ($display_toc) { ?> <?php $toc = nahoWikiContentPeer::getTOC($content); ?> <div class="wiki-toc-container"> <a class="wiki-toc-header" href="#" onclick="var n=document.getElementById('wiki-toc');n.style.display=n.style.display=='none'?'block':'none';return false"><?php echo __('Table of contents'); ?> </a> <div id="wiki-toc"><?php include_partial('toc', array('toc' => $toc)); ?> </div> </div> <?php } ?> <?php
public function getnahoWikiContent($con = null) { if ($this->anahoWikiContent === null && $this->content_id !== null) { include_once 'plugins/nahoWikiPlugin/lib/model/om/BasenahoWikiContentPeer.php'; $this->anahoWikiContent = nahoWikiContentPeer::retrieveByPK($this->content_id, $con); } return $this->anahoWikiContent; }
$prefix = sfConfig::get(sprintf('propel_behavior_wikifiableBehavior_%s_prefix', get_class($obj_votazione))); $t->ok($prefix == 'votazione', 'The prefix was correctly read from the behavior configuration'); $wiki_page = nahoWikiPagePeer::retrieveByName($prefix . "_" . $obj_votazione->getId()); $t->ok($wiki_page instanceof nahoWikiPage, 'a wiki page was just created for this object'); $c = new Criteria(); $c->add(nahoWikiRevisionPeer::REVISION, 1); $wiki_revisions = $wiki_page->getRevisions($c); $wiki_revision = $wiki_revisions[0]; $t->ok(count($wiki_revisions) == 1 && $wiki_revision instanceof nahoWikiRevision, 'a wiki revision was added'); $wiki_content = $wiki_revision->getnahoWikiContent(); $t->ok($wiki_content instanceof nahoWikiContent, 'a wiki content was also added'); $t->ok($wiki_revision->getComment() == 'Creazione Automatica' && $wiki_revision->getContent() == 'Descrizione wiki, a cura degli utenti.', 'comment and content were correctly inserted'); $votazione_page_id = $wiki_page->getId(); $votazione_revision_num = $wiki_revision->getRevision(); $votazione_content_id = $wiki_content->getId(); $t->diag('Remove the act object'); $obj_atto->delete(); $wiki_page = nahoWikiPagePeer::retrieveByPK($atto_page_id); $t->ok(!$wiki_page instanceof nahoWikiPage, 'the wiki page was removed'); $wiki_revision = nahoWikiRevisionPeer::retrieveByPK($atto_page_id, $atto_revision_num, $atto_content_id); $t->ok(!$wiki_revision instanceof nahoWikiRevision, 'the wiki revision was removed'); $wiki_content = nahoWikiContentPeer::retrieveByPK($atto_content_id); $t->ok($wiki_content instanceof nahoWikiContent, 'the wiki content was NOT removed'); $t->diag('Remove the votation object'); $obj_votazione->delete(); $wiki_page = nahoWikiPagePeer::retrieveByPK($votazione_page_id); $t->ok(!$wiki_page instanceof nahoWikiPage, 'the wiki page was removed'); $wiki_revision = nahoWikiRevisionPeer::retrieveByPK($votazione_page_id, $votazione_revision_num, $votazione_content_id); $t->ok(!$wiki_revision instanceof nahoWikiRevision, 'the wiki revision was removed'); $wiki_content = nahoWikiContentPeer::retrieveByPK($votazione_content_id); $t->ok($wiki_content instanceof nahoWikiContent, 'the wiki content was NOT removed');
* (c) 2008 Guglielmo Celata <*****@*****.**> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * * Creates the initial wiki descriptions for Attos and Votaziones */ define('SF_ROOT_DIR', realpath(dirname(__FILE__) . '/..')); define('SF_APP', 'fe'); define('SF_ENVIRONMENT', 'dev'); define('SF_DEBUG', true); require_once SF_ROOT_DIR . DIRECTORY_SEPARATOR . 'apps' . DIRECTORY_SEPARATOR . SF_APP . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.php'; sfContext::getInstance(); // clean all pages and content nahoWikiPagePeer::doDeleteAll(); nahoWikiContentPeer::doDeleteAll(); // define all classes that needs descriptions and their prefix in the name field $classes = array('OppAtto' => 'atto', 'OppVotazione' => 'votazione'); $tot_cnt = 0; foreach ($classes as $model => $name_prefix) { echo "Processing {$model} "; $c = new Criteria(); // extract the number of items to process for the generator $n_todo = call_user_func_array(array($model . 'Peer', 'doCount'), array($c)); echo "({$n_todo}) "; // get table map and columns map for this generator $model_table = call_user_func($model . 'Peer::getTableMap'); $model_columns = $model_table->getColumns(); // find and store primary keys $pks = array(); foreach ($model_columns as $column) {