Example #1
0
 /**
  * Builds the form for adding or editing a page.
  * @param string $action
  * @param Page $page
  * @return Zend_Form
  */
 protected function _getForm($action, $page)
 {
     $config = Zend_Registry::get('config');
     $formConfig = array('action' => $action, 'elements' => array('id' => array('type' => 'hidden', 'options' => array('required' => false, 'value' => $page['id'])), 'title' => array('type' => 'text', 'options' => array('label' => 'Title', 'required' => true, 'value' => $page->title)), 'slug' => array('type' => 'text', 'options' => array('label' => 'Slug', 'required' => true, 'value' => $page->slug, 'filters' => array('slugify'), 'validators' => array('slugUnique'))), 'body' => array('type' => 'wysiwyg', 'options' => array('label' => 'Body', 'required' => true, 'value' => $page->body, 'attribs' => array('style' => 'width: 100%;'))), 'template' => array('type' => 'select', 'options' => array('label' => 'Template', 'required' => true, 'multiOptions' => $this->_fetchFiles($config->paths->templatePath), 'value' => $page->getTemplate(), 'description' => 'You can select a different template to structure the text.')), 'layout' => array('type' => 'select', 'options' => array('label' => 'Layout', 'required' => true, 'multiOptions' => $this->_fetchFiles($config->paths->layoutPath, false), 'value' => $page->getLayout(), 'description' => 'You can select a different layout to render the structured text in.')), 'homepage' => array('type' => 'checkbox', 'options' => array('label' => 'Is Homepage', 'required' => false, 'value' => (int) $page->homepage, 'checked' => (bool) $page->homepage ? 'checked' : '', 'description' => 'Check this box to make this page the default.')), 'submit' => array('type' => 'submit', 'options' => array('label' => 'Save', 'ignore' => true))));
     $form = new Fizzy_Form();
     $form->setOptions($formConfig);
     $form->template->addDecorator('Description');
     $form->layout->addDecorator('Description');
     return $form;
 }
Example #2
0
<?php

include_once getRootPath() . "/classes/core/Page.php";
include_once getRootPath() . "/classes/core/Layout.php";
if (array_key_exists("node", $_REQUEST)) {
    $strNode = stripslashes($_REQUEST["node"]);
} else {
    $strNode = "/home";
}
$objPage = new Page($strNode);
$strLayout = $objPage->getLayout()->name;
$aryLayouts = Layout::getLayouts();
$aryPlaceholders = $objPage->getLayout()->getPlaceHolders();
$aryPagePlaceholders = $objPage->getPlaceHolders();
$aryViewsSelected = array();
$aryViewsAvailable = array();
foreach ($aryPagePlaceholders as $ph) {
    $strName = strToLower($ph->name);
    $aryViews = $ph->getViews();
    $aryViewsSelected[$strName] = array();
    foreach ($aryViews as $v) {
        $aryViewsSelected[$strName][] = $v->path;
    }
}
foreach ($aryPlaceholders as $strName) {
    $strName = strToLower($strName);
    $aryViewsAvailable[$strName] = PlaceHolder::getViewsAvailable($strName);
}
Example #3
0
 public static function renderLayout(Page $objPage)
 {
     echo $objPage->getLayout()->render();
 }