SlideShare ist ein Scribd-Unternehmen logo
1 von 30
Downloaden Sie, um offline zu lesen
Desarrollo de módulos en
 Drupal e integración con
     dispositivos móviles
            Luis Curo Salvatierra
                    CTO Xurface
DRUPAL ARCHITECTURE
DATABASE ABSTRACTION LAYER

 • Schema Definition

 • Insert
 • Update
 • Delete
NODES

• Basic unit of information
• Content
• Object
MODULES

• Control of Drupal environment

• Control of Drupal Layers




                                    7, 587
                                  modules
                                  till today
BLOCKS

• Piece of structural view
USER - PERMISSIONS

• Manage user authentication
• Manage user autorization
• Manage user privileges
UI - THEMING

• Manage design layouts
• Manage UI
Hooks

• Way to interact with drupal layers


                                               V. Hooks
                                               5 57
                                               6 80
                                               7 267
http://api.drupal.org/api/drupal/includes--module.inc/group/hooks
Hooks samples


•   hook_block()
•   hook_node_info()
•   hook_form(&$node)
•   hook_access ($op, $node, $account)
•   hook_load ($node)
• hook_view($node, $teaser = FALSE, $page = FALSE)
Working with Blocks


function MyCustomBlock_block($op='list', $delta=0, $edit=array())
{
     switch ($op)
     {
        case 'list':
                  $blocks[0]['info'] = 'This is my custom Block';
                  return $blocks;
        case 'view':
                  $blocks['subject'] = 'My Block';
                  $blocks['content'] = 'Hey My Block is Here!';
                  return $blocks;
     }
   }
Working with Nodes
function MyCustomNode_node_info()
{
   return array(
       'MyCustomNode' => array(
       'name' => 'Custom Node’,
       'module' => 'MyCustomNode',
       'description' => 'This is my custom node',
       'has_title' => TRUE,
       'title_label' => 'Title of my node’,
       'has_body' => TRUE,
       'body_label' => 'Body of my node’,
   )
   );
}
Working with Forms
   function MyCustomNode_form(&$node) {
      $type = node_get_types('type', $node);
      if ($type->has_title) {
             $form['title'] = array(
             '#type' => 'textfield',
             '#title' => $type->title_label,
             '#required' => TRUE,
             '#default_value' => $node->title,
             '#weight' => -5,
             );
      }
      if ($type->has_body) {
             $form['body_field'] = node_body_field(
             $node,
             $type->body_label,
             $type->min_word_count
             );
      }
Working with Forms
    $form['code'] = array(
            '#type' => 'textfield',
            '#size' => 50,
            '#maxlengh' => 127,
            '#title' => ('Code'),
            '#description' => 'Code',
            '#default_value' => isset($node->code) ? $node->code :
       '',
            );

            return $form;
       }
Working with Users -
Permissions
    function MyCustomNode_perm() {
       return array(
             'create MyCustom node',
             'edit MyCustom node',
             'delete MyCustom node',
             );
       }

       function MyCustomNode_access($op, $node, $account) {
             switch ($op) {
             case 'create':
             return user_access('create MyCustom node', $account);
             case 'update':
             return user_access('edit MyCustom node', $account);
             case 'delete':
             return user_access('delete MyCustom node', $account);
             }
       }
Working with Data

function MyCustomNode_schema() {
      $schema['MyCustomNode'] = array(
      'description' => 'My Custom node table',
      'fields' => array(
      'vid' => array(
      'type' => 'int',
      'unsigned' => TRUE,
      'not null' => TRUE,
      'default' => 0,
      'description' => 'version id',
 ),
Working with Data

      'nid' => array(
      'type' => 'int',
      'unsigned' => TRUE,
      'not null' => TRUE,
      'default' => 0,
      'description' => 'node id'
      ),
Working with Data
          'code' => array(
          'description' => 'code',
          'type' => 'varchar',
          'length' => 127,
          'not null' => TRUE,
          'default' => 'varchar'
          ),),
          'primary key' => array(
          'vid', 'nid‘ ), );
          return $schema;
          }
Working with Data
 function MyCustomNode_load($node) {
     $result = db_query(
     'SELECT code FROM {MyCustomNode}
     WHERE vid = %d',
     $node->vid
     );
     return db_fetch_object($result);
 }
Working with Data
     function MyCustomNode_insert($node) {
        if (!isset($node->life)) {
                 $node->life = '';
        }
        if (!isset($node->works)) {
                 $node->works = '';
        }
        db_query(
        'INSERT INTO {MyCustomNode} (vid, nid, code) '
        ."VALUES (%d, %d, '%s')",
        $node->vid,
        $node->nid,
        $node->code );
    }
Working with Data
  function MyCustomNode_update($node) {
      if ($node->revision) {
      MyCustomNode_insert($node); }
      else {
      db_query("UPDATE {MyCustomNode} "
      ."SET code = '%s'"
      ."WHERE vid = %d",
      $node->code,
      $node->vid
      );
  }}
Working with Data
function MyCustomNode_delete($node) {
      db_query( 'DELETE FROM {MyCustomNode}
      WHERE nid = %d‘,$node->nid
      );
}
function MyCustomNode_nodeapi(&$node, $op, $teaser, $page)
{
if ($op == 'delete revision') {
      db_query(
      'DELETE FROM {MyCustomNode}
      WHERE vid = %d',
      $node->vid );
      }
 }
Working with XML

• Drupal uses XML-RPC
• Define the XMP-RPC method
• Use hook_xmlrpc()

               XML-RPC
xProgramD
ARCHITECTURE
XProgramD Architecture




                         Call




                                xProgram
                                  SqLite
XProgramD Architecture
Practical Case
Questions ….
Thank you

Weitere ähnliche Inhalte

Was ist angesagt?

Your code sucks, let's fix it - DPC UnCon
Your code sucks, let's fix it - DPC UnConYour code sucks, let's fix it - DPC UnCon
Your code sucks, let's fix it - DPC UnConRafael Dohms
 
"Coffee Script" in Brief
"Coffee Script" in Brief"Coffee Script" in Brief
"Coffee Script" in BriefNat Weerawan
 
Doctrine For Beginners
Doctrine For BeginnersDoctrine For Beginners
Doctrine For BeginnersJonathan Wage
 
テストデータどうしてますか?
テストデータどうしてますか?テストデータどうしてますか?
テストデータどうしてますか?Yuki Shibazaki
 
Transparent Object Persistence with FLOW3
Transparent Object Persistence with FLOW3Transparent Object Persistence with FLOW3
Transparent Object Persistence with FLOW3Karsten Dambekalns
 
Drupal csu-open atriumname
Drupal csu-open atriumnameDrupal csu-open atriumname
Drupal csu-open atriumnameEmanuele Quinto
 
SenchaCon 2016: Add Magic to Your Ext JS Apps with D3 Visualizations - Vitaly...
SenchaCon 2016: Add Magic to Your Ext JS Apps with D3 Visualizations - Vitaly...SenchaCon 2016: Add Magic to Your Ext JS Apps with D3 Visualizations - Vitaly...
SenchaCon 2016: Add Magic to Your Ext JS Apps with D3 Visualizations - Vitaly...Sencha
 
Let's write secure Drupal code! - 13.09.2018 @ Drupal Europe, Darmstadt, Germany
Let's write secure Drupal code! - 13.09.2018 @ Drupal Europe, Darmstadt, GermanyLet's write secure Drupal code! - 13.09.2018 @ Drupal Europe, Darmstadt, Germany
Let's write secure Drupal code! - 13.09.2018 @ Drupal Europe, Darmstadt, GermanyBalázs Tatár
 
Database Design Patterns
Database Design PatternsDatabase Design Patterns
Database Design PatternsHugo Hamon
 
Zf Zend Db by aida
Zf Zend Db by aidaZf Zend Db by aida
Zf Zend Db by aidawaraiotoko
 
Cycle.js: Functional and Reactive
Cycle.js: Functional and ReactiveCycle.js: Functional and Reactive
Cycle.js: Functional and ReactiveEugene Zharkov
 
Prototype & jQuery
Prototype & jQueryPrototype & jQuery
Prototype & jQueryRemy Sharp
 
MongoDB全機能解説2
MongoDB全機能解説2MongoDB全機能解説2
MongoDB全機能解説2Takahiro Inoue
 
WordCamp Montreal 2015: Combining Custom Post Types, Fields, and Meta Boxes t...
WordCamp Montreal 2015: Combining Custom Post Types, Fields, and Meta Boxes t...WordCamp Montreal 2015: Combining Custom Post Types, Fields, and Meta Boxes t...
WordCamp Montreal 2015: Combining Custom Post Types, Fields, and Meta Boxes t...allilevine
 

Was ist angesagt? (20)

Your code sucks, let's fix it - DPC UnCon
Your code sucks, let's fix it - DPC UnConYour code sucks, let's fix it - DPC UnCon
Your code sucks, let's fix it - DPC UnCon
 
Presentation1
Presentation1Presentation1
Presentation1
 
"Coffee Script" in Brief
"Coffee Script" in Brief"Coffee Script" in Brief
"Coffee Script" in Brief
 
Doctrine For Beginners
Doctrine For BeginnersDoctrine For Beginners
Doctrine For Beginners
 
テストデータどうしてますか?
テストデータどうしてますか?テストデータどうしてますか?
テストデータどうしてますか?
 
Transparent Object Persistence with FLOW3
Transparent Object Persistence with FLOW3Transparent Object Persistence with FLOW3
Transparent Object Persistence with FLOW3
 
Drupal csu-open atriumname
Drupal csu-open atriumnameDrupal csu-open atriumname
Drupal csu-open atriumname
 
SenchaCon 2016: Add Magic to Your Ext JS Apps with D3 Visualizations - Vitaly...
SenchaCon 2016: Add Magic to Your Ext JS Apps with D3 Visualizations - Vitaly...SenchaCon 2016: Add Magic to Your Ext JS Apps with D3 Visualizations - Vitaly...
SenchaCon 2016: Add Magic to Your Ext JS Apps with D3 Visualizations - Vitaly...
 
Let's write secure Drupal code! - 13.09.2018 @ Drupal Europe, Darmstadt, Germany
Let's write secure Drupal code! - 13.09.2018 @ Drupal Europe, Darmstadt, GermanyLet's write secure Drupal code! - 13.09.2018 @ Drupal Europe, Darmstadt, Germany
Let's write secure Drupal code! - 13.09.2018 @ Drupal Europe, Darmstadt, Germany
 
Database Design Patterns
Database Design PatternsDatabase Design Patterns
Database Design Patterns
 
jQuery secrets
jQuery secretsjQuery secrets
jQuery secrets
 
Coding website
Coding websiteCoding website
Coding website
 
Fact, Fiction, and FP
Fact, Fiction, and FPFact, Fiction, and FP
Fact, Fiction, and FP
 
Elm: give it a try
Elm: give it a tryElm: give it a try
Elm: give it a try
 
Zf Zend Db by aida
Zf Zend Db by aidaZf Zend Db by aida
Zf Zend Db by aida
 
Ricky Bobby's World
Ricky Bobby's WorldRicky Bobby's World
Ricky Bobby's World
 
Cycle.js: Functional and Reactive
Cycle.js: Functional and ReactiveCycle.js: Functional and Reactive
Cycle.js: Functional and Reactive
 
Prototype & jQuery
Prototype & jQueryPrototype & jQuery
Prototype & jQuery
 
MongoDB全機能解説2
MongoDB全機能解説2MongoDB全機能解説2
MongoDB全機能解説2
 
WordCamp Montreal 2015: Combining Custom Post Types, Fields, and Meta Boxes t...
WordCamp Montreal 2015: Combining Custom Post Types, Fields, and Meta Boxes t...WordCamp Montreal 2015: Combining Custom Post Types, Fields, and Meta Boxes t...
WordCamp Montreal 2015: Combining Custom Post Types, Fields, and Meta Boxes t...
 

Ähnlich wie Desarrollo de módulos en Drupal e integración con dispositivos móviles

Drupal - dbtng 25th Anniversary Edition
Drupal - dbtng 25th Anniversary EditionDrupal - dbtng 25th Anniversary Edition
Drupal - dbtng 25th Anniversary Editionddiers
 
laravel tricks in 50minutes
laravel tricks in 50minuteslaravel tricks in 50minutes
laravel tricks in 50minutesBarang CK
 
50 Laravel Tricks in 50 Minutes
50 Laravel Tricks in 50 Minutes50 Laravel Tricks in 50 Minutes
50 Laravel Tricks in 50 MinutesAzim Kurt
 
Dependency Injection
Dependency InjectionDependency Injection
Dependency InjectionRifat Nabi
 
Propel sfugmd
Propel sfugmdPropel sfugmd
Propel sfugmdiKlaus
 
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011Masahiro Nagano
 
From mysql to MongoDB(MongoDB2011北京交流会)
From mysql to MongoDB(MongoDB2011北京交流会)From mysql to MongoDB(MongoDB2011北京交流会)
From mysql to MongoDB(MongoDB2011北京交流会)Night Sailer
 
The History of PHPersistence
The History of PHPersistenceThe History of PHPersistence
The History of PHPersistenceHugo Hamon
 
Virtual Madness @ Etsy
Virtual Madness @ EtsyVirtual Madness @ Etsy
Virtual Madness @ EtsyNishan Subedi
 
Drupal II: The SQL
Drupal II: The SQLDrupal II: The SQL
Drupal II: The SQLddiers
 
You code sucks, let's fix it
You code sucks, let's fix itYou code sucks, let's fix it
You code sucks, let's fix itRafael Dohms
 
Let's write secure Drupal code! - DrupalCamp Oslo, 2018
Let's write secure Drupal code! - DrupalCamp Oslo, 2018Let's write secure Drupal code! - DrupalCamp Oslo, 2018
Let's write secure Drupal code! - DrupalCamp Oslo, 2018Balázs Tatár
 
Fields in Core: How to create a custom field
Fields in Core: How to create a custom fieldFields in Core: How to create a custom field
Fields in Core: How to create a custom fieldIvan Zugec
 
The Zen of Lithium
The Zen of LithiumThe Zen of Lithium
The Zen of LithiumNate Abele
 
AngularJS Compile Process
AngularJS Compile ProcessAngularJS Compile Process
AngularJS Compile ProcessEyal Vardi
 
Introduction to Zend Framework web services
Introduction to Zend Framework web servicesIntroduction to Zend Framework web services
Introduction to Zend Framework web servicesMichelangelo van Dam
 
Doctrine MongoDB Object Document Mapper
Doctrine MongoDB Object Document MapperDoctrine MongoDB Object Document Mapper
Doctrine MongoDB Object Document MapperJonathan Wage
 

Ähnlich wie Desarrollo de módulos en Drupal e integración con dispositivos móviles (20)

Drupal - dbtng 25th Anniversary Edition
Drupal - dbtng 25th Anniversary EditionDrupal - dbtng 25th Anniversary Edition
Drupal - dbtng 25th Anniversary Edition
 
laravel tricks in 50minutes
laravel tricks in 50minuteslaravel tricks in 50minutes
laravel tricks in 50minutes
 
50 Laravel Tricks in 50 Minutes
50 Laravel Tricks in 50 Minutes50 Laravel Tricks in 50 Minutes
50 Laravel Tricks in 50 Minutes
 
Dependency Injection
Dependency InjectionDependency Injection
Dependency Injection
 
Propel sfugmd
Propel sfugmdPropel sfugmd
Propel sfugmd
 
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
 
From mysql to MongoDB(MongoDB2011北京交流会)
From mysql to MongoDB(MongoDB2011北京交流会)From mysql to MongoDB(MongoDB2011北京交流会)
From mysql to MongoDB(MongoDB2011北京交流会)
 
Database api
Database apiDatabase api
Database api
 
The History of PHPersistence
The History of PHPersistenceThe History of PHPersistence
The History of PHPersistence
 
Virtual Madness @ Etsy
Virtual Madness @ EtsyVirtual Madness @ Etsy
Virtual Madness @ Etsy
 
Drupal II: The SQL
Drupal II: The SQLDrupal II: The SQL
Drupal II: The SQL
 
You code sucks, let's fix it
You code sucks, let's fix itYou code sucks, let's fix it
You code sucks, let's fix it
 
Let's write secure Drupal code! - DrupalCamp Oslo, 2018
Let's write secure Drupal code! - DrupalCamp Oslo, 2018Let's write secure Drupal code! - DrupalCamp Oslo, 2018
Let's write secure Drupal code! - DrupalCamp Oslo, 2018
 
Min-Maxing Software Costs
Min-Maxing Software CostsMin-Maxing Software Costs
Min-Maxing Software Costs
 
Fields in Core: How to create a custom field
Fields in Core: How to create a custom fieldFields in Core: How to create a custom field
Fields in Core: How to create a custom field
 
The Zen of Lithium
The Zen of LithiumThe Zen of Lithium
The Zen of Lithium
 
AngularJS Compile Process
AngularJS Compile ProcessAngularJS Compile Process
AngularJS Compile Process
 
Bacbkone js
Bacbkone jsBacbkone js
Bacbkone js
 
Introduction to Zend Framework web services
Introduction to Zend Framework web servicesIntroduction to Zend Framework web services
Introduction to Zend Framework web services
 
Doctrine MongoDB Object Document Mapper
Doctrine MongoDB Object Document MapperDoctrine MongoDB Object Document Mapper
Doctrine MongoDB Object Document Mapper
 

Kürzlich hochgeladen

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
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
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
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
 
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
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
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
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 

Kürzlich hochgeladen (20)

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
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
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
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...
 
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
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
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
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 

Desarrollo de módulos en Drupal e integración con dispositivos móviles

  • 1.
  • 2. Desarrollo de módulos en Drupal e integración con dispositivos móviles Luis Curo Salvatierra CTO Xurface
  • 4. DATABASE ABSTRACTION LAYER • Schema Definition • Insert • Update • Delete
  • 5. NODES • Basic unit of information • Content • Object
  • 6. MODULES • Control of Drupal environment • Control of Drupal Layers 7, 587 modules till today
  • 7. BLOCKS • Piece of structural view
  • 8. USER - PERMISSIONS • Manage user authentication • Manage user autorization • Manage user privileges
  • 9. UI - THEMING • Manage design layouts • Manage UI
  • 10. Hooks • Way to interact with drupal layers V. Hooks 5 57 6 80 7 267 http://api.drupal.org/api/drupal/includes--module.inc/group/hooks
  • 11. Hooks samples • hook_block() • hook_node_info() • hook_form(&$node) • hook_access ($op, $node, $account) • hook_load ($node) • hook_view($node, $teaser = FALSE, $page = FALSE)
  • 12. Working with Blocks function MyCustomBlock_block($op='list', $delta=0, $edit=array()) { switch ($op) { case 'list': $blocks[0]['info'] = 'This is my custom Block'; return $blocks; case 'view': $blocks['subject'] = 'My Block'; $blocks['content'] = 'Hey My Block is Here!'; return $blocks; } }
  • 13. Working with Nodes function MyCustomNode_node_info() { return array( 'MyCustomNode' => array( 'name' => 'Custom Node’, 'module' => 'MyCustomNode', 'description' => 'This is my custom node', 'has_title' => TRUE, 'title_label' => 'Title of my node’, 'has_body' => TRUE, 'body_label' => 'Body of my node’, ) ); }
  • 14. Working with Forms function MyCustomNode_form(&$node) { $type = node_get_types('type', $node); if ($type->has_title) { $form['title'] = array( '#type' => 'textfield', '#title' => $type->title_label, '#required' => TRUE, '#default_value' => $node->title, '#weight' => -5, ); } if ($type->has_body) { $form['body_field'] = node_body_field( $node, $type->body_label, $type->min_word_count ); }
  • 15. Working with Forms $form['code'] = array( '#type' => 'textfield', '#size' => 50, '#maxlengh' => 127, '#title' => ('Code'), '#description' => 'Code', '#default_value' => isset($node->code) ? $node->code : '', ); return $form; }
  • 16. Working with Users - Permissions function MyCustomNode_perm() { return array( 'create MyCustom node', 'edit MyCustom node', 'delete MyCustom node', ); } function MyCustomNode_access($op, $node, $account) { switch ($op) { case 'create': return user_access('create MyCustom node', $account); case 'update': return user_access('edit MyCustom node', $account); case 'delete': return user_access('delete MyCustom node', $account); } }
  • 17. Working with Data function MyCustomNode_schema() { $schema['MyCustomNode'] = array( 'description' => 'My Custom node table', 'fields' => array( 'vid' => array( 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'description' => 'version id', ),
  • 18. Working with Data 'nid' => array( 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'description' => 'node id' ),
  • 19. Working with Data 'code' => array( 'description' => 'code', 'type' => 'varchar', 'length' => 127, 'not null' => TRUE, 'default' => 'varchar' ),), 'primary key' => array( 'vid', 'nid‘ ), ); return $schema; }
  • 20. Working with Data function MyCustomNode_load($node) { $result = db_query( 'SELECT code FROM {MyCustomNode} WHERE vid = %d', $node->vid ); return db_fetch_object($result); }
  • 21. Working with Data function MyCustomNode_insert($node) { if (!isset($node->life)) { $node->life = ''; } if (!isset($node->works)) { $node->works = ''; } db_query( 'INSERT INTO {MyCustomNode} (vid, nid, code) ' ."VALUES (%d, %d, '%s')", $node->vid, $node->nid, $node->code ); }
  • 22. Working with Data function MyCustomNode_update($node) { if ($node->revision) { MyCustomNode_insert($node); } else { db_query("UPDATE {MyCustomNode} " ."SET code = '%s'" ."WHERE vid = %d", $node->code, $node->vid ); }}
  • 23. Working with Data function MyCustomNode_delete($node) { db_query( 'DELETE FROM {MyCustomNode} WHERE nid = %d‘,$node->nid ); } function MyCustomNode_nodeapi(&$node, $op, $teaser, $page) { if ($op == 'delete revision') { db_query( 'DELETE FROM {MyCustomNode} WHERE vid = %d', $node->vid ); } }
  • 24. Working with XML • Drupal uses XML-RPC • Define the XMP-RPC method • Use hook_xmlrpc() XML-RPC
  • 26. XProgramD Architecture Call xProgram SqLite