Development

/plugins/sfSimpleCMSPlugin/lib/model/sfSimpleCMSPage.php

You must first sign up to be able to contribute.

root/plugins/sfSimpleCMSPlugin/lib/model/sfSimpleCMSPage.php

Revision 4630, 1.5 kB (checked in by francois, 6 years ago)

sfSimpleCMSPlugin Initial commit

Line 
1 <?php
2
3 /**
4  * Subclass for representing a row from the 'sf_simple_cms_page' table.
5  *
6  *
7  *
8  * @package plugins.sfSimpleCMSPlugin.lib.model
9  */
10 class sfSimpleCMSPage extends BasesfSimpleCMSPage
11 {
12   protected $localizations = null;
13  
14   public function __toString()
15   {
16     return ($this->getTitle() ? $this->getTitle() : '['.$this->getSlug().']');
17   }
18  
19   public function getSlugWithLevel()
20   {
21     return str_repeat(' - ', $this->getLevel()).$this->getSlug();
22   }
23  
24   public function hasLocalization($culture)
25   {
26     $localizations = $this->getLocalizations();
27     return in_array($culture, $localizations);
28   }
29  
30   public function getLocalizations()
31   {
32     if($this->localizations === null)
33     {
34       $c = new Criteria();
35       $c->clearSelectColumns();
36       $c->addSelectColumn(sfSimpleCMSPageI18nPeer::CULTURE);
37       $c->add(sfSimpleCMSPageI18nPeer::ID, $this->getId());
38       $rs = sfSimpleCMSPageI18nPeer::doSelectRS($c);
39       
40       $localizations = array();
41       foreach ($rs as $set)
42       {
43         $localizations[] = $set[0];
44       }
45       
46       $this->localizations = $localizations;
47     }
48     
49     return $this->localizations;
50   }
51 }
52
53 $columns_map = array('left'   => sfSimpleCMSPagePeer::TREE_LEFT,
54                      'right'  => sfSimpleCMSPagePeer::TREE_RIGHT,
55                      'parent' => sfSimpleCMSPagePeer::TREE_PARENT,
56                      'scope'  => sfSimpleCMSPagePeer::TOPIC_ID);
57
58 sfPropelBehavior::add('sfSimpleCMSPage', array('actasnestedset' => array('columns' => $columns_map)));
Note: See TracBrowser for help on using the browser.