SlideShare uma empresa Scribd logo
1 de 30
Baixar para ler offline
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

Mais conteúdo relacionado

Mais procurados

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
 

Mais procurados (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...
 

Semelhante a 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
 

Semelhante a 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
 

Último

A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????blackmambaettijean
 

Último (20)

A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????
 

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