当前位置: 首页>>代码示例>>PHP>>正文


PHP ContentController类代码示例

本文整理汇总了PHP中ContentController的典型用法代码示例。如果您正苦于以下问题:PHP ContentController类的具体用法?PHP ContentController怎么用?PHP ContentController使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ContentController类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testCustomSearchFormClassesToTest

 function testCustomSearchFormClassesToTest()
 {
     FulltextSearchable::enable('File');
     $page = new Page();
     $controller = new ContentController($page);
     $form = $controller->SearchForm();
     $this->assertEquals(array('File'), $form->getClassesToSearch());
 }
开发者ID:SustainableCoastlines,项目名称:loveyourwater,代码行数:8,代码来源:ContentControllerSearchExtensionTest.php

示例2: testList

 public function testList()
 {
     $c = new ContentController();
     $model = $c->getModel('helloworlds');
     $worlds = $model->getItems();
     var_dump($worlds);
     $this->assertNotEmpty($worlds);
 }
开发者ID:uozuAho,项目名称:joomla25_helloworld,代码行数:8,代码来源:modelsHelloWorldsTest.php

示例3: handleInput

 /**
  *	Handles input, by calling according controller,
  *	an sets view depending on url.
  *	@return void
  */
 public function handleInput()
 {
     //Create database, get content catalog
     $db = new Database();
     $contentDAL = new contentDAL($db);
     $Catalog = new contentCatalog();
     $contentController = new ContentController($contentDAL, $Catalog);
     $contentCatalog = $contentController->getContent();
     //Handle login
     if ($this->navigationView->wantsToLogin()) {
         $login = new LoginController($this->users, $this->navigationView);
         $this->IsLoggedIn = $login->doLogin();
         if ($this->IsLoggedIn) {
             $this->navigationView->redirToAdmin();
         } else {
             $this->view = $login->getOutPut();
         }
     } else {
         if ($this->navigationView->wantsToUpload() && isset($_SESSION['user'])) {
             $this->view = new AdminView();
             $uploadController = new uploadController($this->view, $contentDAL, $this->users);
             $uploadController->doUpload();
         } else {
             if ($this->navigationView->wantsToReg()) {
                 $model = new RegFacade($this->userDAL);
                 $this->view = new RegView($this->navigationView);
                 $regControl = new RegisterController($model, $this->view);
                 $regControl->addUser();
                 $this->view = new RegView($this->navigationView);
             } else {
                 if ($this->navigationView->wantsToViewImage()) {
                     $this->view = new ImageView();
                     $imgController = new ImageController($this->view, $contentCatalog);
                     $imgController->getImage();
                 } else {
                     if ($this->navigationView->wantsToViewContent()) {
                         $commentView = new commentView();
                         $this->view = new ContentView($commentView);
                         $id = $this->view->getID();
                         $commentDAL = new commentDAL($db);
                         $commentController = new CommentController($commentView, $commentDAL);
                         $comments = $commentController->doComment($id);
                         $content = $contentController->getContentByID($id);
                         $this->view->createHTML($content, $comments);
                     } else {
                         $this->view = new galleryView();
                         $galController = new GalleryController($this->view);
                         $galController->doGallery($contentCatalog);
                     }
                 }
             }
         }
     }
 }
开发者ID:henceee,项目名称:1DV608_project,代码行数:59,代码来源:MasterController.php

示例4: testHasmethodBehaviour

	function testHasmethodBehaviour() {
		/* SiteTree should have all of the methods that Versioned has, because Versioned is listed in SiteTree's
		 * extensions */
		$st = new SiteTree();
		$cc = new ContentController($st);

		$this->assertTrue($st->hasMethod('publish'), "Test SiteTree has publish");
		$this->assertTrue($st->hasMethod('migrateVersion'), "Test SiteTree has migrateVersion");
		
		/* This relationship should be case-insensitive, too */
		$this->assertTrue($st->hasMethod('PuBliSh'), "Test SiteTree has PuBliSh");
		$this->assertTrue($st->hasMethod('MiGratEVersIOn'), "Test SiteTree has MiGratEVersIOn");
		
		/* In a similar manner, all of SiteTree's methods should be available on ContentController, because $failover is set */
		$this->assertTrue($cc->hasMethod('canView'), "Test ContentController has canView");
		$this->assertTrue($cc->hasMethod('linkorcurrent'), "Test ContentController has linkorcurrent");
		
		/* This 'method copying' is transitive, so all of Versioned's methods should be available on ContentControler.
		 * Once again, this is case-insensitive */
		$this->assertTrue($cc->hasMethod('MiGratEVersIOn'), "Test ContentController has MiGratEVersIOn");
		
		/* The above examples make use of SiteTree, Versioned and ContentController.  Let's test defineMethods() more
		 * directly, with some sample objects */
		$objs = array();
		$objs[] = new ObjectTest_T2();
		$objs[] = new ObjectTest_T2();
		$objs[] = new ObjectTest_T2();
		
		// All these methods should exist and return true
		$trueMethods = array('testMethod','otherMethod','someMethod','t1cMethod','normalMethod');
		
		foreach($objs as $i => $obj) {
			foreach($trueMethods as $method) {
				$methodU = strtoupper($method);
				$methodL = strtoupper($method);
				$this->assertTrue($obj->hasMethod($method), "Test that obj#$i has method $method");
				$this->assertTrue($obj->hasMethod($methodU), "Test that obj#$i has method $methodU");
				$this->assertTrue($obj->hasMethod($methodL), "Test that obj#$i has method $methodL");

				$this->assertTrue($obj->$method(), "Test that obj#$i can call method $method");
				$this->assertTrue($obj->$methodU(), "Test that obj#$i can call method $methodU");
				$this->assertTrue($obj->$methodL(), "Test that obj#$i can call method $methodL");
			}
			
			$this->assertTrue($obj->hasMethod('Wrapping'), "Test that obj#$i has method Wrapping");
			$this->assertTrue($obj->hasMethod('WRAPPING'), "Test that obj#$i has method WRAPPING");
			$this->assertTrue($obj->hasMethod('wrapping'), "Test that obj#$i has method wrapping");
			
			$this->assertEquals("Wrapping", $obj->Wrapping(), "Test that obj#$i can call method Wrapping");
			$this->assertEquals("Wrapping", $obj->WRAPPING(), "Test that obj#$i can call method WRAPPIGN");
			$this->assertEquals("Wrapping", $obj->wrapping(), "Test that obj#$i can call method wrapping");
		}
		
	}
开发者ID:neopba,项目名称:silverstripe-book,代码行数:54,代码来源:ObjectTest.php

示例5: testCustomSearchFormClassesToTest

	function testCustomSearchFormClassesToTest() {
		FulltextSearchable::enable('File');
		
		$page = new Page();
		$page->URLSegment = 'whatever';
		$page->Content = 'oh really?';
		$page->write();
		$page->publish('Stage', 'Live'); 
		$controller = new ContentController($page);
		$form = $controller->SearchForm(); 
		
		if (get_class($form) == 'SearchForm') $this->assertEquals(array('File'), $form->getClassesToSearch());
	}
开发者ID:redema,项目名称:silverstripe-cms,代码行数:13,代码来源:ContentControllerSearchExtensionTest.php

示例6: enable

 public static function enable($searchableClasses = array('SiteTree'))
 {
     // Chris Bolt, removed file
     // Chris Bolt add site tree extension
     SiteTree::add_extension('BoltSearchIndexedSiteTree');
     $defaultColumns = array('SiteTree' => '"Title","MenuTitle","Content","MetaDescription","SearchIndex"');
     if (!is_array($searchableClasses)) {
         $searchableClasses = array($searchableClasses);
     }
     foreach ($searchableClasses as $class) {
         if (!class_exists($class)) {
             continue;
         }
         if (isset($defaultColumns[$class])) {
             Config::inst()->update($class, 'create_table_options', array(MySQLSchemaManager::ID => 'ENGINE=MyISAM'));
             $class::add_extension("FulltextSearchable('{$defaultColumns[$class]}')");
         } else {
             throw new Exception("FulltextSearchable::enable() I don't know the default search columns for class '{$class}'");
         }
     }
     self::$searchable_classes = $searchableClasses;
     if (class_exists("ContentController")) {
         ContentController::add_extension("ContentControllerSearchExtension");
     }
 }
开发者ID:christopherbolt,项目名称:silverstripe-bolttools,代码行数:25,代码来源:BoltFulltextSearchable.php

示例7: module_controller_for_request

 public static function module_controller_for_request(ContentController $contentController, SS_HTTPRequest $request, $relationship = 'ContentModules')
 {
     $moduleURLSegment = $request->shift();
     if ($module = $contentController->data()->{$relationship}()->filter('URLSegment', $moduleURLSegment)->first()) {
         $controller = self::controller_for($module, $contentController);
         //backwards compatibility support for modules handling actions directly
         //should move to using controllers to handle actions
         if ($controller instanceof ModuleController) {
             return $controller->handleRequest($request, new DataModel());
         } else {
             $action = $request->shift();
             if ($controller->hasMethod($action)) {
                 return $controller->{$action}($request);
             }
         }
     }
 }
开发者ID:webtorque7,项目名称:inpage-modules,代码行数:17,代码来源:ModuleAsController.php

示例8: init

 public function init()
 {
     parent::init();
     // Import jquery and bootstrap js
     Requirements::javascript($this->ThemeDir() . "/js/libs/jquery.min.js");
     Requirements::javascript($this->ThemeDir() . "/js/libs/bootstrap.min.js");
 }
开发者ID:robb-j,项目名称:ss-boilerplate,代码行数:7,代码来源:Page.php

示例9: init

    public function init()
    {
        parent::init();
        Requirements::themedCSS('reset');
        Requirements::themedCSS('layout');
        Requirements::themedCSS('form');
        Requirements::themedCSS('typography');
        Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js');
        Requirements::css('mysite/css/demo.css');
        Requirements::css('mysite/css/moduleSupport.css');
        Requirements::customScript(<<<JS
(function(i,s,o,g,r,a,m){ i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ 
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
 })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-84547-17', 'auto', { 'allowLinker': true });
ga('require', 'linker');
ga('linker:autoLink', [
\t'www.silverstripe.com',
\t'www.silverstripe.org',
\t'addons.silverstripe.org',
\t'api.silverstripe.org',
\t'docs.silverstripe.org',
\t'userhelp.silverstripe.org',
\t'demo.silverstripe.org'
]);
ga('send', 'pageview');
JS
);
    }
开发者ID:mateusz,项目名称:demo.silverstripe.org,代码行数:31,代码来源:Page.php

示例10: init

 public function init()
 {
     parent::init();
     // Note: you should use SS template require tags inside your templates
     // instead of putting Requirements calls here.  However these are
     // included so that our older themes still work
     Requirements::themedCSS('layout');
     Requirements::themedCSS('comments');
     Requirements::themedCSS('typography');
     Requirements::themedCSS('form');
     Requirements::themedCSS('slick');
     if (!Cookie::get($StoryModeCookie)) {
         Cookie::set($StoryModeCookie, 'Normal');
     }
     if (!Cookie::get($StorySizeCookie)) {
         Cookie::set($StorySizeCookie, 'Normal');
     }
     // Increment page view counter
     $pagecounter = DataObject::get_one("PageCounter", "PageID='{$this->ID}'");
     if (!$pagecounter) {
         $pagecounter = new PageCounter();
         $pagecounter->PageID = $this->ID;
     }
     $pagecounter->Counter = $pagecounter->Counter + 1;
     $pagecounter->write();
 }
开发者ID:krissihall,项目名称:sm_ss,代码行数:26,代码来源:Page.php

示例11: init

 public function init()
 {
     parent::init();
     // You can include any CSS or JS required by your project here.
     // See: http://doc.silverstripe.org/framework/en/reference/requirements
     Requirements::css("https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css");
 }
开发者ID:andrewandante,项目名称:blackdorisrovers,代码行数:7,代码来源:Page.php

示例12: init

	function init() {
		parent::init();
		
		Requirements::themedCSS("layout");
		Requirements::themedCSS("typography");
		Requirements::themedCSS("form");
	}
开发者ID:neopba,项目名称:silverstripe-book,代码行数:7,代码来源:Page.php

示例13: init

    public function init()
    {
        parent::init();
        Requirements::themedCSS('reset');
        Requirements::themedCSS('layout');
        Requirements::themedCSS('form');
        Requirements::themedCSS('typography');
        Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js');
        Requirements::css('mysite/css/demo.css');
        Requirements::css('mysite/css/moduleSupport.css');
        Requirements::customScript(<<<JS
var _gaq = _gaq || [];

_gaq.push(['_setAccount', 'UA-84547-11']);
_gaq.push(['_setDomainName', 'none']);
_gaq.push(['_setAllowLinker', true]);
_gaq.push(['_trackPageview']);

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
JS
);
    }
开发者ID:newleeland,项目名称:demo.silverstripe.org,代码行数:26,代码来源:Page.php

示例14: init

 public function init()
 {
     parent::init();
     if (!$this->config()->service) {
         $this->httpError(404);
     }
     $this->setService($this->config()->service);
     $this->pageService = new StyleGuide\PageService($this);
     // redirect to the first action route
     if (!$this->request->param('Action')) {
         $page = $this->pageService->getPages()->first();
         $this->redirect($page->Link);
     }
     // if no template set on the action route then redirect to the first child
     if (!$this->request->param('ChildAction') && !$this->pageService->getTemplate()) {
         $page = $this->pageService->getActivePage();
         if (isset($page->Children)) {
             $childPage = $page->Children->first();
             $this->redirect($childPage->Link);
         }
     }
     // set the service
     $this->setRequirements();
     // load the fixture file
     $this->loadFixture();
 }
开发者ID:benmanu,项目名称:silverstripe-styleguide,代码行数:26,代码来源:StyleGuideController.php

示例15: init

 public function init()
 {
     parent::init();
     // Note: you should use SS template require tags inside your templates
     // instead of putting Requirements calls here.  However these are
     // included so that our older themes still work
     Requirements::css('themes/simple/css/homepage.css');
     Requirements::customScript('
             $("a.scroll-arrow").mousedown( function(e) {
                          e.preventDefault();              
           			var container = $(this).parent().attr("id");                              
                            var direction = $(this).is("#scroll-right") ? "+=" : "-=";
                            var totalWidth = -$(".row__inner").width();
                            $(".row__inner .tile").each(function() {
                                totalWidth += $(this).outerWidth(true);
                            });
                            
                            $("#"+ container + " .row__inner").animate({
                                scrollLeft: direction + Math.min(totalWidth, 3000)
                                
                            },{
                                duration: 2500,
                                easing: "swing", 
                                queue: false }
                            );
                        }).mouseup(function(e) {
                          $(".row__inner").stop();
            });');
 }
开发者ID:jareddreyer,项目名称:catalogue,代码行数:29,代码来源:Page.php


注:本文中的ContentController类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。