Пример #1
0
 /**
  * Add default records to database.
  *
  * This function is called whenever the database is built, after the
  * database tables have all been created. Overload this to add default
  * records when the database is built, but make sure you call
  * parent::requireDefaultRecords().
  */
 public function requireDefaultRecords()
 {
     if (!SiteTree::get_by_link(Config::inst()->get('RootURLController', 'default_homepage_link'))) {
         $homepage = new HomePage();
         $homepage->Title = 'Home';
         $homepage->URLSegment = Config::inst()->get('RootURLController', 'default_homepage_link');
         $homepage->Sort = 1;
         $homepage->write();
         $homepage->publish('Stage', 'Live');
         $homepage->flushCache();
         DB::alteration_message('Home page created', 'created');
     }
     if (DB::query("SELECT COUNT(*) FROM \"SiteTree\"")->value() == 1) {
         $aboutus = new RootPage();
         $aboutus->Title = 'About Us';
         $aboutus->Sort = 2;
         $aboutus->write();
         $aboutus->publish('Stage', 'Live');
         $aboutus->flushCache();
         DB::alteration_message('Book 1 created', 'created');
         $contactus = new RootPage();
         $contactus->Title = 'Contact Us';
         $contactus->Sort = 3;
         $contactus->write();
         $contactus->publish('Stage', 'Live');
         $contactus->flushCache();
         DB::alteration_message('Book 2 created', 'created');
     }
     // call it on the parent
     parent::requireDefaultRecords();
 }
Пример #2
0
 public function testNavPlanifSejour()
 {
     $homePage = new HomePage($this);
     $homePage->goToPlanifSejour();
     $this->assertEquals("Planification des hospitalisations et chirurgies", $homePage->getTitle());
     self::$endOfClass = true;
 }
 /**
  * Test submitting data to the home page (index)
  *
  * @dataProvider dataPeople
  */
 public function testSubmit(PersonModel $person)
 {
     $home = new HomePage($this);
     $home->load();
     $home->setPerson($person);
     $view = $home->save();
     $this->assertEquals($person->getRealName(), $view->getRealName());
     $this->assertEquals($person->getGenderString(), $view->getGenderString());
 }
    /**
     * @dataProvider dataPeople
     */
    public function testSubmit(PersonModel $person)
    {
        $this->open('/');
        
        $home = new HomePage($this);
        $home->setFromModel($person);
        $view = $home->save();

        $view->assertEqualsModel($person);
    }
Пример #5
0
 public function run()
 {
     DB::table('home_page')->delete();
     $success = File::cleanDirectory($this->getImagesPath());
     File::put($this->getImagesPath() . '.gitignore', File::get(public_path() . '/../app/storage/cache/.gitignore'));
     HomePage::create(['headline' => "Industrial Legacy", 'text' => 'RUSTIC DETAILS. MODERN EDGE. REFINED LIVING IN COURT SQUARE. <br> 1 - 4 BEDROOM HOMES FROM $615K. PENTHOUSES PRICED UPON REQUEST.', 'subtext' => 'CHILDREN\'S PLAYROOM, LOUNGE, LIBRARY, GYM, TERRACE AND PARKING', 'image' => $this->copyImage(public_path() . '/backup_images/building/building.jpg')]);
 }
Пример #6
0
 public function __construct()
 {
     parent::__construct();
     $self = $this;
     $this->add(new picon\Link('link', function () use($self) {
         $_SESSION['auth'] = false;
         $self->setPage(HomePage::getIdentifier());
     }));
 }
Пример #7
0
 public function __construct()
 {
     parent::__construct();
     $this->add(new picon\Label('text', new picon\PropertyModel($this, 'text')));
     $self = $this;
     $this->add(new \picon\Link('alterLink', function () use($self) {
         $self->text = 'Update in callback text';
     }));
     $this->add(new \picon\Link('pageLink', function () use($self) {
         $self->setPage(HomePage::getIdentifier());
     }));
 }
Пример #8
0
 /**
  * Change the home page to HomePage type
  */
 public function requireDefaultRecords()
 {
     if (!SiteTree::get_by_link("home")) {
         $homepage = new HomePage();
         ${$homepage}->Title = "Home";
         $homepage->URLSegment = "home";
         $homepage->Sort = 1;
         $homepage->write();
         $homepage->publish('Stage', 'Live');
         $homepage->flushCache();
         DB::alteration_message('Home Page created', 'created');
     } else {
         $homepage = SiteTree::get_by_link("home");
         if ($homepage->ClassName != "HomePage") {
             $homepage = $homepage->newClassInstance("HomePage");
             $homepage->write();
             $homepage->publish('Stage', 'Live');
             $homepage->flushCache();
             DB::alteration_message('Home changed to HomePage', 'changed');
         }
     }
     parent::requireDefaultRecords();
 }
 /**
  * Change the contact-us page to ContactUsPage type
  */
 function requireDefaultRecords()
 {
     if (!SiteTree::get_by_link("contact-us")) {
         $contactpage = new HomePage();
         $contactpage->Title = "Contact Us";
         $contactpage->URLSegment = "contact-us";
         $contactpage->Sort = 3;
         $contactpage->write();
         $contactpage->publish('Stage', 'Live');
         $contactpage->flushCache();
         DB::alteration_message('Contact Us created', 'created');
     } else {
         $contactpage = SiteTree::get_by_link("contact-us");
         if ($contactpage->ClassName != "ContactUsPage") {
             $contactpage = $contactpage->newClassInstance("ContactUsPage");
             $contactpage->write();
             $contactpage->publish('Stage', 'Live');
             $contactpage->flushCache();
             DB::alteration_message('Contact Us changed to ContactUsPage', 'changed');
         }
     }
     parent::requireDefaultRecords();
 }
Пример #10
0
 public function __construct()
 {
     parent::__construct();
     $self = $this;
     $this->add(new Link('home', function () use($self) {
         $self->setPage(HomePage::getIdentifier());
     }));
     $files = array('index.php', 'assets/AbstractPage.php', 'assets/AbstractPage.html', 'assets/SamplePageClassAuthorisationStrategy.php');
     $files = array_merge($files, $this->getInvolvedFiles());
     $sourceLink = new Link('source', function () use($self, $files) {
         $self->setPage(new SourcePage($files));
     });
     $sourceLink->setPopupSettings(new \picon\PopupSettings('Source Code', '900px', '600px'));
     $this->add($sourceLink);
 }
Пример #11
0
 public static function getInstance($path, $params)
 {
     if (!count($path)) {
         self::redirectTo('home');
         exit;
     }
     $pname = $path[0];
     $path = self::nextPath($path);
     switch ($pname) {
         case 'home':
             $page = HomePage::getInstance($path, $params);
             break;
         case 'register':
             $page = RegistrationPage::getInstance($path, $params);
             break;
         case 'login':
             $page = LoginPage::getInstance($path, $params);
             break;
         case 'logout':
             $page = LogoutPage::getInstance($path, $params);
             break;
         case 'switch-user':
             $page = SwitchUserPage::getInstance($path, $params);
             break;
         case 'links':
             $page = LinksPage::getInstance($path, $params);
             break;
         case 'users':
             $page = UsersPage::getInstance($path, $params);
             break;
         case 'groups':
             $page = GroupsPage::getInstance($path, $params);
             break;
         case 'settings':
             $page = SettingsPage::getInstance($path, $params);
             break;
         case 'tools':
             $page = ToolsPage::getInstance($path, $params);
             break;
         case 'installation':
             $page = InstallationPage::getInstance($path, $params);
             break;
         default:
             $page = NotFoundPage::getInstance($path, $params);
     }
     return $page;
 }
Пример #12
0
 public function getIndex()
 {
     $homePage = HomePage::first();
     return View::make('site.contact', array('homePage' => $homePage));
 }
Пример #13
0
 function __construct($driver)
 {
     parent::__construct($driver);
     $this->driver->url("/?login=selenium:test");
     $this->driver->url("/index.php?m=dPcim10");
 }
Пример #14
0
 public function getIndex()
 {
     $homePage = HomePage::orderBy('order_id')->get();
     return View::make('site.index', array('homePage' => $homePage));
 }
Пример #15
0
 public function getHomePage()
 {
     $homePage = HomePage::first();
     return View::make('admin.home', array('homePage' => $homePage));
 }
 public function testGetModuleDefaultPage()
 {
     $userRoleIds = array(1, 2, 3);
     $users = TestDataService::loadObjectList('SystemUser', $this->fixture, 'SystemUser');
     $adminUserSupervisor = $users[3];
     $this->manager->setUser($adminUserSupervisor);
     $module = "time";
     $defaultPage1 = new HomePage();
     $defaultPage1->fromArray(array('id' => 4, "module_id" => 5, "user_role_id" => 1, "action" => 'pim/viewEmployeeTimesheets', "enable_class" => 'TestEnableClass', "priority" => 50));
     $defaultPage2 = new HomePage();
     $defaultPage2->fromArray(array('id' => 5, "module_id" => 5, "user_role_id" => 1, "action" => 'pim/viewEmployeeList', "priority" => 30));
     $defaultPage3 = new HomePage();
     $defaultPage3->fromArray(array('id' => 3, "module_id" => 5, "user_role_id" => 1, "action" => 'pim/viewSystemUsers', "priority" => 30));
     $defaultPage4 = new HomePage();
     $defaultPage4->fromArray(array('id' => 1, "module_id" => 5, "user_role_id" => 1, "action" => 'pim/viewEmployeeList2', "priority" => 10));
     $defaultPage5 = new HomePage();
     $defaultPage5->fromArray(array('id' => 2, "module_id" => 5, "user_role_id" => 1, "action" => 'pim/viewMyDetails', "priority" => 0));
     $defaultPages = array($defaultPage1, $defaultPage2, $defaultPage3, $defaultPage4, $defaultPage5);
     $mockDao = $this->getMock('HomePageDao', array('getModuleDefaultPagesInPriorityOrder'));
     $mockDao->expects($this->once())->method('getModuleDefaultPagesInPriorityOrder')->with($module, $userRoleIds)->will($this->returnValue($defaultPages));
     $this->manager->setHomePageDao($mockDao);
     $homePage = $this->manager->getModuleDefaultPage($module);
     $this->assertEquals('pim/viewEmployeeList', $homePage);
 }
Пример #17
0
require 'vendor/autoload.php';
use Transphporm\Builder;
class HomePage
{
    private $template;
    private $data = array();
    public function __construct($xmlTemplateFilePath, $tssTransformFilePath)
    {
        $this->template = new Builder($xmlTemplateFilePath, $tssTransformFilePath);
    }
    public function curry($curriedParameters = array())
    {
        if (is_array($curriedParameters)) {
            $this->data = array_merge($this->data, $curriedParameters);
        } else {
            throw new \InvalidArgumentException("HomePage requires an array of simple named scalar values as parameters, something else given");
        }
    }
    public function render($overrideData = array())
    {
        $this->curry($overrideData);
        return $this->template->output((object) $this->data)->body;
    }
}
$data = array('pagetitle' => "Most Awesome Page", 'title' => "Most Excellent Article", 'subtitle' => "By Mitch", 'fruits' => [(object) ['name' => 'Hillary'], (object) ['name' => 'Bernie'], (object) ['name' => 'Trump'], (object) ['name' => 'Paul']], 'navigation' => [(object) ['label' => 'Home'], (object) ['url' => '#'], (object) ['label' => 'News'], (object) ['url' => '#'], (object) ['label' => 'Favorites'], (object) ['url' => '#'], (object) ['label' => 'About Us'], (object) ['url' => '#'], (object) ['label' => 'Why?'], (object) ['url' => '#']]);
// Roadblock: how to express that pages/home.xml ISA or uses simplePage.xhtml ?
$page = 'templates/layouts/simplePage.xhtml';
$tss = 'templates/bindings/home.tss';
$template = new HomePage($page, $tss);
$template->curry($data);
echo $template->render();
Пример #18
0
 /**
  * Populates the HomePage object from the request
  * @return bean HomePage
  */
 private function getBeanFromRequest()
 {
     $home_page = new HomePage();
     $home_page->setOid($_REQUEST['oid']);
     $home_page->setName($_REQUEST['name']);
     $home_page->setPubState($_REQUEST['pubState']);
     // Format the times
     $startTime = mktime(0, 0, 0, $_REQUEST['startMonth'], $_REQUEST['startDay'], $_REQUEST['startYear']);
     $home_page->setStartTime($startTime);
     for ($index = 1; $index <= 13; $index++) {
         if (isset($_REQUEST['event' . $index])) {
             $method = 'setEvent' . $index;
             $home_page->{$method}($_REQUEST['event' . $index]);
         }
     }
     return $home_page;
 }
Пример #19
0
<?php

// Define the homepage information
$HomePage = new HomePage($Theamus);
$i = $HomePage->redirect();
// Redirect if necessary
// Query the database for a page
$query = $Theamus->DB->select_from_table($Theamus->DB->system_table('pages'), array('views'), array('operator' => '', 'conditions' => array('alias' => $i['alias'])));
$row = $Theamus->DB->fetch_rows($query);
// Define the page information
// Add to the page view count
$views = $row['views'] + 1;
$Theamus->DB->update_table_row($Theamus->DB->system_table('pages'), array('views' => $views), array('operator' => '', 'conditions' => array('alias' => $i['alias'])));
//Show the page information
echo $HomePage->page_content;
Пример #20
0
 public function HomePage()
 {
     return HomePage::get_one('HomePage');
 }
Пример #21
0
 public function updateSortableElements($type)
 {
     $ids = Input::get('item');
     if ($type == 'amenities') {
         for ($i = 0; $i < count($ids); $i++) {
             $amenitie = Amenitie::where('id', '=', $ids[$i])->first();
             var_dump($amenitie->toJson());
             $amenitie->update(array('order_id' => $i + 1));
         }
     } else {
         if ($type == 'residences') {
             for ($i = 0; $i < count($ids); $i++) {
                 $residence = Residence::where('id', '=', $ids[$i])->first();
                 $residence->update(array('order_id' => $i + 1));
             }
         } else {
             if ($type == 'home') {
                 for ($i = 0; $i < count($ids); $i++) {
                     $residence = HomePage::where('id', '=', $ids[$i])->first();
                     $residence->update(array('order_id' => $i + 1));
                 }
             } else {
                 if ($type == 'terrace') {
                     for ($i = 0; $i < count($ids); $i++) {
                         $residence = TerraceLivingPage::where('id', '=', $ids[$i])->first();
                         $residence->update(array('order_id' => $i + 1));
                     }
                 } else {
                     echo 'Non sortable type';
                 }
             }
         }
     }
 }
Пример #22
0
<?php

include_once 'html.php';
include '_pageClass/HomePage.php';
include '_pageClass/ProductPage.php';
include '_pageClass/CategoryPage.php';
include '_pageClass/CategoriesPage.php';
switch ($currentPage) {
    case 'home-page':
        $obj = new HomePage();
        $module = $obj->module();
        break;
    case 'product-page':
        $obj = new ProductPage();
        $module = $obj->module($params);
        break;
    case 'category-page':
        $obj = new CategoryPage();
        $module = $obj->module($params, $catType);
        break;
    case 'categories-page':
        $obj = new CategoriesPage();
        $module = $obj->module($params, $catType);
        break;
}
$data['current-page'] = $currentPage;
if ($currentPage == 'product-page') {
    $data['product-detail'] = $module['productDetail'];
    $data['spin-content'] = $module['spinContent'];
}
$seoTags = $module['seoTags'];
 /**
  * Walk the site-tree to find a page given a nested path.
  * @param $path
  * @return \DataObject|\Page
  */
 public static function page_for_path($path)
 {
     $path = trim($path, '/');
     if ($path == '') {
         return \HomePage::get()->first();
     }
     /** @var \Page $page */
     $page = null;
     $parts = explode('/', $path);
     $children = \Page::get()->filter('ParentID', 0);
     while ($segment = array_shift($parts)) {
         if (!($page = $children->find('URLSegment', $segment))) {
             break;
         }
         $children = $page->Children();
     }
     return $page;
 }
 protected function advertisementParent()
 {
     $parent = null;
     if ($this->owner->ParentID) {
         $parent = SiteTree::get()->byID($this->owner->ParentID);
     } elseif ($this->owner->URLSegment != "home") {
         $parent = SiteTree::get()->where("URLSegment = 'home' AND \"ClassName\" <> 'RedirectorPage'")->First();
         if (!$parent) {
             if (class_exists("HomePage")) {
                 $parent = HomePage::get()->First();
             } else {
                 $parent = Page::get()->filter(array("URLSegment" => "home"))->First();
             }
         }
     }
     if ($parent) {
         if ($this->classHasAdvertisements($parent->ClassName)) {
             return $parent;
         }
     }
 }