Ejemplo n.º 1
0
 public function homeAction()
 {
     $this->view->page = $page = new Pages_Model_Zupalpages(1);
     $aid = $page->get_atomic_id();
     $m = Model_Zupalbonds::getInstance();
     $this->view->pages = $m->get_bonds_to($aid, 'parent', 'from_atom');
 }
Ejemplo n.º 2
0
 /**
  * returns a rendered page identified by either a tag ($pKey) or an HTML file ($page_path).
  * If the module is passed, path is relative to the modules' pages folder.
  *
  * @param string $pKey
  * @param string $page_path
  * @param string | NULL $pTitle
  * @param string | NULL $pModule
  * @return string (the content of the page view
  */
 public function filepage($pKey, $page_path, $pTitle = NULL, $pModule = NULL)
 {
     $pParams = array('name' => 'tag', 'value' => $pKey);
     $ion = Model_Zupalions::getInstance()->findOne($pParams);
     if ($ion) {
         $page = Pages_Model_Zupalpages::getInstance()->for_atom_id($ion->get_atomic_id());
     } else {
         $page = new Pages_Model_Zupalpages();
         if ($pModule) {
             $m = Administer_Model_Modules::getInstance()->get($pModule);
             $pages = $m->module_path('pages');
             $page_path = rtrim($pages, '/') . '/' . ltrim($page_path, '/');
         }
         $pc = file_get_contents($page_path);
         if (preg_match('~<title>(.*)</title>~', $pc, $m)) {
             $pTitle = $m[1];
         }
         if (preg_match('~<body>(.*)</body>~', str_replace("\n", ' ', $pc), $m)) {
             $pc = $m[1];
         }
         $page->set_content($pc);
         $page->set_title($pTitle);
         $page->save();
         $page->add_ion($pParams);
         $page->add_ion('content_file', $page_path);
     }
     $params = array('id' => $page->identity());
     return $this->view->action('view', 'index', 'pages', $params);
 }
Ejemplo n.º 3
0
 public function save()
 {
     $this->get_domain()->setTitle($this->title->getValue());
     $this->get_domain()->setLead($this->lead->getValue());
     $this->get_domain()->setContent($this->content->getValue());
     $this->get_domain()->save();
     if ($this->get_parent()) {
         if (is_numeric($this->get_parent())) {
             $parent = Pages_Model_Zupalpages::getInstance()->for_atom_id($this->get_parent());
             $this->set_parent($parent);
         }
         $this->get_domain()->bond_to('parent', $this->get_parent(), FALSE);
     }
 }
Ejemplo n.º 4
0
 public function repairatomsAction()
 {
     foreach (Pages_Model_Zupalpages::getInstance()->findAll() as $page) {
         $page->get_atom();
     }
     foreach (Ultimatum_Model_Ultgroups::getInstance()->findAll() as $group) {
         /**
          * @var Model_Zupalatoms
          */
         $atom = $group->get_atom();
         if (!$atom->get_format_lead()) {
             $atom->strip_lead_markup();
         }
         if (!$atom->get_format_content()) {
             $atom->strip_content_markup();
         }
     }
     $this->_forward('atoms');
 }
Ejemplo n.º 5
0
 /**
  *
  */
 public function pagesstoreAction()
 {
     $pt = Pages_Model_Zupalpages::getInstance();
     $pages = $pt->findAll('id');
     $data = array();
     foreach ($pages as $page) {
         $row = $page->toArray();
         if ($atom = $page->get_atom($page->atomic_id)) {
             if ($publish_status = $page->get_publish_status()) {
                 $psa = Zupal_Util_Array::mod_keys($publish_status->toArray(), 'ps_');
             } else {
                 $psa = array();
             }
             $row = array_merge($row, Zupal_Util_Array::mod_keys($atom->toArray(), 'a_'), $psa);
         }
         $data[] = $row;
     }
     $this->_store('id', $data, 'a_title');
 }
Ejemplo n.º 6
0
 /**
  *
  * @param boolean $pReload
  * @return Pages_Model_Zupalpages
  */
 public static function getInstance($pReload = FALSE)
 {
     if ($pReload || is_null(self::$_instance)) {
         // process
         self::$_instance = new self();
     }
     return self::$_instance;
 }