Content Types and Views Information Systems 337 Prof. Harry Plantinga.

Slides:



Advertisements
Similar presentations
PHP Hypertext Preprocessor Information Systems 337 Prof. Harry Plantinga.
Advertisements

INSERT BOOK COVER 1Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall. Exploring Microsoft Access 2010 by Robert Grauer, Keith Mast,
Chapter 3 Tables and Page Layout
XP Chapter 3 Succeeding in Business with Microsoft Office Access 2003: A Problem-Solving Approach 1 Analyzing Data For Effective Decision Making.
Creating Custom Forms. 2 Design and create a custom form You can create a custom form by modifying an existing form or creating a new form. Either way,
Drupal Create a website/web app quickly with this Content Management System Jiaying Xu Spring 2011 COMS E6125 Web-enHanced Information.
Concepts of Database Management Sixth Edition
1 Chapter 1 Tour of Access. 1 Chapter Objectives Start and exit Microsoft Access Open and run an Access application Identify the major elements of the.
Concepts of Database Management Sixth Edition
Microsoft Access 2010 Chapter 7 Using SQL.
DAT702.  Standard Query Language  Ability to access and manipulate databases ◦ Retrieve data ◦ Insert, delete, update records ◦ Create and set permissions.
Review of last session The Weebly Dashboard The Weebly Dashboard Controls your account and your sites Controls your account and your sites From here you.
The Dr ü G Book: An Intro to Drupal The Dr ü G Book: An Intro to Drupal (Dr ü G: Drupal User ’ s Group - users, not developers) This is an introduction.
Justin Klein Keane Drupal Training Session 1 Introduction to Drupal.
Drupal Workshop Introduction to Drupal Part 1: Web Content Management, Advantages/Disadvantages of Drupal, Drupal terminology, Drupal technology, directories.
Basics of Drupal: Part 3 Rochelle Terman
Page 1 ISMT E-120 Desktop Applications for Managers Introduction to Microsoft Access.
Lecture 3 – Data Storage with XML+AJAX and MySQL+socket.io
MySQL Dr. Hsiang-Fu Yu National Taipei University of Education
Module 3: Table Selection
Session 5: Working with MySQL iNET Academy Open Source Web Development.
Concepts of Database Management, Fifth Edition
Drupal Training Syllabus Chaitanya Lakshmi
Databases C HAPTER Chapter 10: Databases2 Databases and Structured Fields  A database is a collection of information –Typically stored as computer.
Concepts of Database Management Seventh Edition
Chapter 4 The Relational Model 3: Advanced Topics Concepts of Database Management Seventh Edition.
Moodle (Course Management Systems). Assignments 1 Assignments are a refreshingly simple method for collecting student work. They are a simple and flexible.
Chapter 6 Advanced Report Techniques
Drupal Jumpstart Information Systems 337 Prof. Harry Plantinga.
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. Office Access 2003 Lab 3 Analyzing Data and Creating Reports.
CSS/417 Introduction to Database Management Systems Workshop 2.
Microsoft Access 2010 Building and Using Queries.
Analyzing Data For Effective Decision Making Chapter 3.
Moodle (Course Management Systems). Managing Your class In this Lecture, we’ll cover course management, including understanding and using roles, arranging.
NMED 3850 A Advanced Online Design January 12, 2010 V. Mahadevan.
Microsoft Office 2007 Intermediate© 2008 Pearson Prentice Hall1 PowerPoint Presentation to Accompany GO! With Microsoft ® Office 2007 Intermediate Chapter.
® Microsoft Office 2010 Access Tutorial 3 Maintaining and Querying a Database.
Using Special Operators (LIKE and IN)
Concepts of Database Management Seventh Edition
Chapter 17 Creating a Database.
Drupal Overview Prepared by : Agustin D. Gumogda Jr. Instructor.
Review of last session Add text to your website Add text to your website Title Title Paragraph Paragraph Title and paragraph Title and paragraph Add photographs.
Seattle Drupal Clinic Introduction to Drupal Part 1: Web Content Management, Advantages/Disadvantages of Drupal, Drupal terminology.
What’s new in Kentico CMS 5.0 Michal Neuwirth Product Manager Kentico Software.
ACCESS Part 2. OBJECTIVE  Use the Query Wizard.  Work with data in a query.  Use Query Design View.  Sort and find data.  Filter data Apply AND criteria.
Concepts of Database Management Eighth Edition Chapter 3 The Relational Model 2: SQL.
Microsoft ® Office Excel 2003 Training Using XML in Excel SynAppSys Educational Services presents:
6 th Annual Focus Users’ Conference 6 th Annual Focus Users’ Conference Import Testing Data Presented by: Adrian Ruiz Presented by: Adrian Ruiz.
How does Drupal Work? Information Systems 337 Prof. Harry Plantinga.
TRAINING SESSIONS.NET Controls.  Standard Controls  Label  Textbox  Checkbox  Button, Image Button, Image control  Radio Button  Literal  Hyperlink.
Introduction to Views Stanford Drupal Camp April 6, 2013.
Drupal for client Maria Sherskova skype: sherskova.
USING WORDPRESS TO CREATE A WEBSITE (RATHER THAN A BLOG) STEP-BY-STEP INSTRUCTIONS.
Concepts of Database Management Seventh Edition Chapter 3 The Relational Model 2: SQL.
Mr. Justin “JET” Turner CSCI 3000 – Fall 2015 CRN Section A – TR 9:30-10:45 CRN – Section B – TR 5:30-6:45.
Gold – Crystal Reports Introductory Course Cortex User Group Meeting New Orleans – 2011.
Drupal Recipe: Before and After Gallery Lisa Forgan and Chris Neglia, using notes from Drupal Camp Colorado Copyright 2009, Page 1 Solutions LLC.
IST 220 – Intro to Databases Lecture 2 Touring Microsoft Access.
Microsoft Office 2013 Try It! Chapter 4 Storing Data in Access.
6 Copyright © 2011, Oracle and/or its affiliates. All rights reserved. Creating RTF Templates by Using Template Builder.
XP New Perspectives on Microsoft Office Access 2003, Second Edition- Tutorial 6 1 Microsoft Office Access 2003 Tutorial 6 – Creating Custom Forms.
Concepts of Database Management, Fifth Edition Chapter 3: The Relational Model 2: SQL.
Views: From the Beginning John Fiala Twitter: jcfiala Vintage Digital.
This is the cover slide..
What is new In Pangea 6.11 Pangea 6.11.
Content Management Systems
Content Types and Views
PHP Hypertext Preprocessor
MySQL Dr. Hsiang-Fu Yu National Taipei University of Education
Presentation transcript:

Content Types and Views Information Systems 337 Prof. Harry Plantinga

Drupal’s Most Powerful Features Content types, Fields, and Fields UI Content types, Fields, and Fields UI Build custom content types Build custom content types Add appropriate fields Add appropriate fields Custom forms for input Custom forms for input Views: Views: Select and display such data Select and display such data Flexible selection, sorting, and formatting Flexible selection, sorting, and formatting Output as a block Output as a block

Content Types and Fields Add fields to content types Add fields to content types Control how they are entered and validated Control how they are entered and validated Change the way they are displayed Change the way they are displayed Many plug-ins available for custom types Many plug-ins available for custom types date, autocomplete, button, RSS, video, audio, calculated values, jQuery Gallery View, Flickr, Google maps, flashcard, … date, autocomplete, button, RSS, video, audio, calculated values, jQuery Gallery View, Flickr, Google maps, flashcard, …

Examples Without writing a line of code… Without writing a line of code… Paged table showing product details that can be sorted by name, price, or manufacturer Paged table showing product details that can be sorted by name, price, or manufacturer A block that lists the albums of a particular artist in a grid with cover thumbnails A block that lists the albums of a particular artist in a grid with cover thumbnails Anywhere on your site you need a custom list of content Anywhere on your site you need a custom list of content

Content Types Structure -> Content Types Structure -> Content Types

Managing Fields

Adding Fields With Drupal 7 you can add fields to any entity type in the system With Drupal 7 you can add fields to any entity type in the system Add a tag field to users Add a tag field to users Add a file upload field to contents Add a file upload field to contents

Adding Fields Field Types Field Types Standard: Integer, Float, List, File, Image, Text, etc. Standard: Integer, Float, List, File, Image, Text, etc. Modules enable additional field types such as dates Modules enable additional field types such as dates Input widgets Input widgets Upload tool for images, jQuery date selector for dates,… Upload tool for images, jQuery date selector for dates,…

Manage Display Control how fields are displayed Control how fields are displayed

PrepSoccer.org What content types might I need? What content types might I need? Team Team Game Game (Possibly also player, division, league, etc) (Possibly also player, division, league, etc) How to create? How to create?

Team Content Type

Add fields

Team content type

Manage display

Game Content Type

Game Manage Fields

Game Display Fields

A game Custom formatting done in theme Custom formatting done in theme

Displaying Teams, Games How to display a team's results? Conference standings? How to display a team's results? Conference standings? Need to understand: Need to understand: Drupal’s database Drupal’s database Views module Views module

Views A visual query builder for displaying summaries of node collections A visual query builder for displaying summaries of node collections HTML table or list output HTML table or list output A single view may have many displays, e.g. A single view may have many displays, e.g. Page Page Block Block Feed Feed Attachment Attachment

Views Documentation Install Advanced Help module to get help Install Advanced Help module to get help

Available Views

Adding a Basic View

View Details

View Displays Views have multiple displays (page, block, etc) Views have multiple displays (page, block, etc) You can edit the view generally, or override for a particular display You can edit the view generally, or override for a particular display

View Output Output can be table, list, grid, menu, etc. Output can be table, list, grid, menu, etc.

What to Display Select fields Select fields Filter: which nodes to display? Filter: which nodes to display? Sort critera Sort critera

Page Settings Path to page Path to page Header, footer Header, footer Pager Pager

Relationships Like a database Join Like a database Join For example, on a Schedule/Results view, you would want to display games but set up a relationship with Teams For example, on a Schedule/Results view, you would want to display games but set up a relationship with Teams Relationship on Team1 Relationship on Team1

Contextual Filters Arguments Arguments E.g. which team to show results for E.g. which team to show results for We’ll use these in a later lab We’ll use these in a later lab

Other Options AJAX: use AJAX for paging, instead of refreshing page (affects linking to page) AJAX: use AJAX for paging, instead of refreshing page (affects linking to page) Aggregation: count, sum fields Aggregation: count, sum fields How many games? How many games? Total goals scored? Total goals scored?

Live Preview

Views and SQL

Problems… How do I show all a team's games? How do I show all a team's games? How can I display conference standings? How can I display conference standings? What if it Views can't do what I want? What if it Views can't do what I want?

Rolling Your Own "View" MSPSP U14 Boys Classic 3 <?php $result = db_query("select name, abbrev, wins, losses, ties, points, goalsFor, goalsAgainst, power from stats.team order by points desc, power desc"); while ($row = db_fetch_array($result)) { echo(" $row[name] "); echo(" $row[wins] "); echo(" $row[losses] "); echo(" $row[ties] "); echo(" $row[points] "); echo(" $row[goalsFor] "); echo(" $row[goalsAgainst] "); $power=round($row[power],2); echo(" $power "); } ?>

Pros and Cons of Custom "Views" Drawbacks Can't use built-in support (CCK, views, ratings, comments, etc) Can't use built-in support (CCK, views, ratings, comments, etc) Need to write your own PHP code Need to write your own PHP code May need a separate database May need a separate database Must upgrade your code with new Drupal versions Must upgrade your code with new Drupal versions Benefits Can handle more complex problems Can handle more complex problems Can optimize queries and performance Can optimize queries and performance Give back by releasing your own Drupal module? Give back by releasing your own Drupal module?

SQL & MySQL Database concepts: Database concepts: Server Server Client Client Table Table Row Row Attribute (or column) Attribute (or column) Query Query SQL SQL

Drupal Databases mysql> show databases; | Database | | information_schema | | drupal_elkmelk | | drupal_openpsalter | | drupal_prepsoccer | | drupal_v1_prepsoccer | | drupal_v2_prepsoccer | | mysql | | stats | rows in set (0.00 sec) mysql> use drupal_v2_prepsoccer; Database changed mysql> show tables; | Tables_in_drupal_v2_prepsoccer | | blocks | | blocks_roles | | comments | | filter_formats | | filters | | menu_custom | | menu_links | | menu_router | | node | | node_access | | node_revisions | | node_type | | permission | | role | | sessions |

Tables mysql> describe node; | Field | Type | Key | | nid | int(10) unsigned | PRI | | vid | int(10) unsigned | UNI | | type | varchar(32) | MUL | | language | varchar(12) | | | title | varchar(255) | MUL | | uid | int(11) | MUL | | status | int(11) | MUL | | created | int(11) | MUL | | changed | int(11) | MUL | | comment | int(11) | | | promote | int(11) | MUL | | moderate | int(11) | MUL | | sticky | int(11) | | | tnid | int(10) unsigned | MUL | | translate | int(11) | MUL | rows in set (0.00 sec) mysql> select nid, type, title from node order by created limit 9; order by created limit 9; | nid | type | title | 1 | story | Welcome to PrepSoccer.or | 2 | forum | Fall 2009 Season Discuss | 7 | league | Michigan State Premiere | 8 | page | Division Standings | 9 | page | Team Results | 10 | forum | Power ranking | 11 | page | About Us | 13 | division | Premiere 1 | 14 | division | Premiere rows in set (0.00 sec)

Queries Select: 90% of typical queries. Typical form: Select: 90% of typical queries. Typical form: select [fields] from [tables] where [conditions] order by [fields] select [fields] from [tables] where [conditions] order by [fields] Examples Examples select name, abbrev, wins, losses, ties, points, goalsFor, goalsAgainst, power from stats.team where wins >= losses order by points desc, power desc select name, abbrev, wins, losses, ties, points, goalsFor, goalsAgainst, power from stats.team where wins >= losses order by points desc, power desc

SELECT count(distinct sequence), SUM(LENGTH(texttext) > 200 AND NOTdoNotDisplay) as hasText, SUM(textinfo != '') as hastextInfo,SUM(tuneinfo != '') as hastuneInfo FROM ((SELECT text.firstLine, tune.title, text.hymnalID, text.number, text.sequence, text.info AS textinfo, tune.info AS tuneinfo, text.text AS texttext, text.doNotDisplay FROM hymnary.hymnText text LEFT JOIN hymnary.hymnTune tune USING(sequence, hymnalID) WHERE text.pub = 'p' AND text.hymnalID = 'WOV' GROUP BY text.hymnalID, text.number ORDER BY NULL) UNION (SELECT text.firstLine, tune.title, tune.hymnalID, tune.number, tune.sequence, text.info AS textinfo, tune.info AS tuneinfo, text.text AS texttext, text.doNotDisplay FROM hymnary.hymnTune tune LEFT JOIN hymnary.hymnText text USING(sequence, hymnalID) WHERE tune.pub='p' AND tune.hymnalID='WOV' GROUP BY tune.hymnalID, tune.number ORDER BY NULL)) AS subquery SELECT count(distinct sequence), SUM(LENGTH(texttext) > 200 AND NOTdoNotDisplay) as hasText, SUM(textinfo != '') as hastextInfo,SUM(tuneinfo != '') as hastuneInfo FROM ((SELECT text.firstLine, tune.title, text.hymnalID, text.number, text.sequence, text.info AS textinfo, tune.info AS tuneinfo, text.text AS texttext, text.doNotDisplay FROM hymnary.hymnText text LEFT JOIN hymnary.hymnTune tune USING(sequence, hymnalID) WHERE text.pub = 'p' AND text.hymnalID = 'WOV' GROUP BY text.hymnalID, text.number ORDER BY NULL) UNION (SELECT text.firstLine, tune.title, tune.hymnalID, tune.number, tune.sequence, text.info AS textinfo, tune.info AS tuneinfo, text.text AS texttext, text.doNotDisplay FROM hymnary.hymnTune tune LEFT JOIN hymnary.hymnText text USING(sequence, hymnalID) WHERE tune.pub='p' AND tune.hymnalID='WOV' GROUP BY tune.hymnalID, tune.number ORDER BY NULL)) AS subquery WHERE TRUE AND subquery.title LIKE '%we come to the hungry feast%' AND (EXISTS( (SELECT type FROM hymnary.entryMedia entryMediaAny WHERE subquery.hymnalID = entryMediaAny.hymnalID AND subquery.number =entryMediaAny.number)) OR (LENGTH(texttext) > 200 AND doNotDisplay IS FALSE) OR textinfo != '' OR tuneinfo != '' ) GROUP BY sequence;

Joins mysql> select nid, type, title from node where type='division' and nid >= 26 and nid select nid, type, title from node where type='division' and nid >= 26 and nid <= 31; | nid | type | title | | 26 | division | Classic 3 | | 27 | division | Rg Red | | 28 | division | St Blue | | 29 | division | St Orange | | 30 | division | St Silver | | 31 | division | St White | mysql> select nid, … from content_type_division limit 6; | nid | season | year | age | gender | | 26 | Fall | 2009 | U14 | Boys | | 27 | Fall | 2009 | U13 | Boys | | 28 | Fall | 2009 | U13 | Boys | | 29 | Fall | 2009 | U13 | Boys | | 30 | Fall | 2009 | U13 | Boys | | 31 | Fall | 2009 | U13 | Boys | rows in set (0.00 sec) mysql> select node.nid, type, title, field_season_value as season … from node, content_type_division where node.nid=content_type_division.nid limit 2; | nid | type | title | season | year | age | gender | | 26 | division | Classic 3 | Fall | 2009 | U14 | Boys | | 27 | division | Rg Red | Fall | 2009 | U13 | Boys | rows in set (0.00 sec)

Other SQL queries  insert (5%)  insert into [table] values (v1, v2, v3, …)  delete from [table] where [condition]  The other 5%:  update  call  load data  replace  show tables  show databases, use, alter table, drop table, drop database, truncate, flush privileges, describe, explain, use, help, set, show, etc.

MySQL utilities mysqladmin mysqladmin mysqldump mysqldump mysql mysql How would I find other utilities? How would I find other utilities? /usr/bin/mysql* /usr/bin/mysql* Where would I find documentation? Where would I find documentation?