SlideShare a Scribd company logo
1 of 28
ModelAdmin
                SilverStripe’s great new tool for building CRMs
                                (and other things)




Monday, March 2, 2009
We develop a CMS
Monday, March 2, 2009
We do other stu
                              too!
                    • Most of our sites include a CMS
                    • But also: CRM, event management,
                      e-commerce, internal business
                      systems
                    • The CMS paradigm doesn’t fit all of
                      these

Monday, March 2, 2009
Let’s build a CRM!

                    • We’ve made CRMs for SilverStripe
                        ... several, in fact
                    • Each time we had a “CRM”
                      customer, it seemed that they
                      wanted something dierent


Monday, March 2, 2009
Flexible Data, Fixed
                         UI
                    • Clients are very specific about data
                      and business logic
                    • But not about user interface - as
                      long as it’s good, they’re happy
                    • SilverStripe CMS exploits this by
                      making it easy to create new Page
                      Types with custom fields

Monday, March 2, 2009
From CMS to DMS

                    • Can we apply this concept to CRM?
                    • Don’t just manage Content
                    • Manage any kind of Data



Monday, March 2, 2009
ModelAdmin
                    • Data Management built into
                      SilverStripe
                    • ModelAdmin gives you a CRUD
                      interface around any data: Search,
                      Results, Detail
                    • Same building blocks as CMS
                      interface

Monday, March 2, 2009
ModelAdmin

                    • Search on fields linked by relations
                    • Detail record gives you a scaolded
                      interface for editing all relations



Monday, March 2, 2009
Monday, March 2, 2009
Monday, March 2, 2009
Monday, March 2, 2009
Code Demo



Monday, March 2, 2009
Random example: A small webhosting company
     with products, customers and contracts


                              * Web2.0ified by http://
                                     creatr.cc
Monday, March 2, 2009
Our Datamodel
                                 HostingContrac
                Customer                            HostingType
                                        t

                           has_many           has_one




Monday, March 2, 2009
HostingType
                    ?php
                    class HostingType extends DataObject {
                        static $db = array(
                            'Title' = 'Text',
                            'Description' = 'Text',
                            'Price' = 'Float',
                        );
                        static $has_many = array(
                            'HostingContracts' = 'HostingContract',
                        );
                    }
                    ?


                                   mysite/code/HostingType.php


Monday, March 2, 2009
HostingType




Monday, March 2, 2009
HostingContract
                         ?php
                         class HostingContract extends DataObject {
                             static $db = array(
                                 'ContractNumber' = 'Varchar',
                                 'StartDate' = 'Date',
                                 'EndDate' = 'Date'
                             );
                             static $has_one = array(
                                 'Customer' = 'Customer',
                                 'HostingType' = 'HostingType',
                             );
                         }
                         ?
                               mysite/code/HostingContract.php


Monday, March 2, 2009
HostingContract




Monday, March 2, 2009
Customer
                   ?php
                   class Customer extends Member {
                       static $db = array(
                           'CustomerType' = quot;Enum('Private,Business','Private')quot;
                       );
                       static $has_one = array(
                           'Avatar' = 'Image',
                       );
                       static $has_many = array(
                           'HostingContracts' = 'HostingContract'
                       );
                   }
                   ?
                                    mysite/code/Customer.php


Monday, March 2, 2009
Monday, March 2, 2009
MyCRMAdmin
         ?php
         class MyCRMAdmin extends ModelAdmin {
             protected static $managed_models = array(
                 'Customer',
                 'HostingContract',
                 'HostingType'
             );
             static $url_segment = 'mycrm'; // will be linked as /admin/mycrm
             static $menu_title = 'My CRM';
         }
         ?


                             mysite/code/MyCRMAdmin.php


Monday, March 2, 2009
Some tweaking...



Monday, March 2, 2009
Summary Fields
                          ?php
                          class Customer extends Member {
                              // ...
                              static $summary_fields = array(
                                  'FirstName',
                                  'Surname',
                                  'CustomerType'
                              );
                          }
                          ?




Monday, March 2, 2009
Searchable Fields
                          ?php
                          class Customer extends Member {
                              // ...
                              static $searchable_fields = array(
                                  'FirstName',
                                  'Surname',
                                  'HostingContracts.ContractNumber'
                              );
                          }
                          ?




Monday, March 2, 2009
getCMSFields()
                        ?php
                        class Customer extends Member {
                            // ...
                            function getCMSFields() {
                                $fields = parent::getCMSFields();
                                $fields-removeByName('Locale');

                                 return $fields;
                             }
                        }
                        ?




Monday, March 2, 2009
Using Data on




Monday, March 2, 2009
SilverStripe 2.4 and
                        beyond
                        • New data mapper
                        • Thinner, reusable
                          controllers
                        • “Intelligent data”



Monday, March 2, 2009
Thank you
                                  Download this talk at:
                    http://www.slideshare.net/chillu/modeladmin-in-silverstripe-23


                                       Code         (requires SilverStripe 2.3+)

                        http://silverstripe.org/assets/presentations/2009-02-28-
                                     modeladminpresentationmysite.zip



                                Ingo Schommer, SilverStripe Ltd., ingo@silverstripe.com
                             License: http://creativecommons.org/licenses/by-nc/3.0/nz/



Monday, March 2, 2009

More Related Content

Recently uploaded

Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 

Recently uploaded (20)

Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 

Featured

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Featured (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

ModelAdmin in SilverStripe 2.3

  • 1. ModelAdmin SilverStripe’s great new tool for building CRMs (and other things) Monday, March 2, 2009
  • 2. We develop a CMS Monday, March 2, 2009
  • 3. We do other stu too! • Most of our sites include a CMS • But also: CRM, event management, e-commerce, internal business systems • The CMS paradigm doesn’t fit all of these Monday, March 2, 2009
  • 4. Let’s build a CRM! • We’ve made CRMs for SilverStripe ... several, in fact • Each time we had a “CRM” customer, it seemed that they wanted something dierent Monday, March 2, 2009
  • 5. Flexible Data, Fixed UI • Clients are very specific about data and business logic • But not about user interface - as long as it’s good, they’re happy • SilverStripe CMS exploits this by making it easy to create new Page Types with custom fields Monday, March 2, 2009
  • 6. From CMS to DMS • Can we apply this concept to CRM? • Don’t just manage Content • Manage any kind of Data Monday, March 2, 2009
  • 7. ModelAdmin • Data Management built into SilverStripe • ModelAdmin gives you a CRUD interface around any data: Search, Results, Detail • Same building blocks as CMS interface Monday, March 2, 2009
  • 8. ModelAdmin • Search on fields linked by relations • Detail record gives you a scaolded interface for editing all relations Monday, March 2, 2009
  • 13. Random example: A small webhosting company with products, customers and contracts * Web2.0ified by http:// creatr.cc Monday, March 2, 2009
  • 14. Our Datamodel HostingContrac Customer HostingType t has_many has_one Monday, March 2, 2009
  • 15. HostingType ?php class HostingType extends DataObject { static $db = array( 'Title' = 'Text', 'Description' = 'Text', 'Price' = 'Float', ); static $has_many = array( 'HostingContracts' = 'HostingContract', ); } ? mysite/code/HostingType.php Monday, March 2, 2009
  • 17. HostingContract ?php class HostingContract extends DataObject { static $db = array( 'ContractNumber' = 'Varchar', 'StartDate' = 'Date', 'EndDate' = 'Date' ); static $has_one = array( 'Customer' = 'Customer', 'HostingType' = 'HostingType', ); } ? mysite/code/HostingContract.php Monday, March 2, 2009
  • 19. Customer ?php class Customer extends Member { static $db = array( 'CustomerType' = quot;Enum('Private,Business','Private')quot; ); static $has_one = array( 'Avatar' = 'Image', ); static $has_many = array( 'HostingContracts' = 'HostingContract' ); } ? mysite/code/Customer.php Monday, March 2, 2009
  • 21. MyCRMAdmin ?php class MyCRMAdmin extends ModelAdmin { protected static $managed_models = array( 'Customer', 'HostingContract', 'HostingType' ); static $url_segment = 'mycrm'; // will be linked as /admin/mycrm static $menu_title = 'My CRM'; } ? mysite/code/MyCRMAdmin.php Monday, March 2, 2009
  • 23. Summary Fields ?php class Customer extends Member { // ... static $summary_fields = array( 'FirstName', 'Surname', 'CustomerType' ); } ? Monday, March 2, 2009
  • 24. Searchable Fields ?php class Customer extends Member { // ... static $searchable_fields = array( 'FirstName', 'Surname', 'HostingContracts.ContractNumber' ); } ? Monday, March 2, 2009
  • 25. getCMSFields() ?php class Customer extends Member { // ... function getCMSFields() { $fields = parent::getCMSFields(); $fields-removeByName('Locale'); return $fields; } } ? Monday, March 2, 2009
  • 26. Using Data on Monday, March 2, 2009
  • 27. SilverStripe 2.4 and beyond • New data mapper • Thinner, reusable controllers • “Intelligent data” Monday, March 2, 2009
  • 28. Thank you Download this talk at: http://www.slideshare.net/chillu/modeladmin-in-silverstripe-23 Code (requires SilverStripe 2.3+) http://silverstripe.org/assets/presentations/2009-02-28- modeladminpresentationmysite.zip Ingo Schommer, SilverStripe Ltd., ingo@silverstripe.com License: http://creativecommons.org/licenses/by-nc/3.0/nz/ Monday, March 2, 2009

Editor's Notes

  1. Talk briefly about the CMS.