Your SlideShare is downloading. ×
20100120 AppleBU - FileMakerとCakePHPでつくる簡単Webアプリケーション
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

20100120 AppleBU - FileMakerとCakePHPでつくる簡単Webアプリケーション

3,142

Published on

2010.1.20に Apple Store 天神で行われた AppleBUセミナーの発表資料です。

2010.1.20に Apple Store 天神で行われた AppleBUセミナーの発表資料です。

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
3,142
On Slideshare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
15
Comments
0
Likes
2
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • Transcript

    • 1. FileMaker CakePHP Apple BU, Jan 2010 Takashi Nojima ELASTIC Consultants Inc.
    • 2. • • FileMaker • CakePHP • FMCakeMix • Web • CakePHP • FMCakeMix • •
    • 3. • WEB Developer / PHP / CakePHP / HTML / CSS / jQuery / PostgreSQL / MySQL / iPhone / / / / / / / / no more • BLOG: http://php-tips.com/ • TWITTER: @nojimage
    • 4. • WEB Developer / PHP / CakePHP / HTML / CSS / jQuery / PostgreSQL / MySQL / iPhone / / / / / / / / no more • BLOG: http://php-tips.com/ • TWITTER: @nojimage FileMaker
    • 5. FileMaker
    • 6. FileMaker Manage people, projects, assets and more - the easy way! • • • Mac, Windows • PDF •
    • 7. FileMaker Manage people, projects, assets and more - the easy way! FileMaker Pro 10 FileMaker Pro 10 Advanced • • FileMaker Pro FileMaker Server 10 • Web FileMaker Server 10 Advanced • ODBC/JDBC •
    • 8. CakePHP
    • 9. CakePHP CakePHP enables PHP users at all levels to rapidly develop robust web applications. CakePHP PHP MVC ORM CakePHP
    • 10. CakePHP CakePHP enables PHP users at all levels to rapidly develop robust web applications. ‣ ‣ Scaffolding ‣ Bake ‣ HTML AJAX Javascript XML RSS ‣ ACL ‣ ‣ URL Router ‣ ‣
    • 11. CakePHP CakePHP enables PHP users at all levels to rapidly develop robust web applications. ‣ gettext ‣ bake, schema, acl, i18 extractor, api ‣ CSRF ‣ HTTP ‣ memcache, apc, xcache, ‣ Configure App importing
    • 12. × FMCakeMix
    • 13. FMCakeMix • FileMaker CakePHP (DataSource) http://www.beezwax.net/solutions/FMCakeMix • FX.php
    • 14. FMCakeMix FileMaker CakePHP Server output Web XML FMCake FX.php Mix input
    • 15. FMCakeMix Web
    • 16. • FileMaker Server 10 • Apache HTTPD • PHP5 • PHP vim, emacs, Eclipse PDT, NetBeans, etc... •
    • 17. CakePHP • http://cakephp.jp/ 2010.01.20 1.2.5 zip, bzip2, tar.gz, dmg • Mac /Users/Hoge/Sites/ • Apache { }/app/webroot/ • .htaccess RewriteBase
    • 18. FMCakeMix • http://github.com/beezwax/FMCakeMix git git clone • dbo_fmcakemix.php app/models/datasources/dbo/
    • 19. FX.php • http://www.iviking.org/FX.php/ Download FX.zip (zipped version) • FX.php, FX_Error.php, FX_Constants.php, image_proxy.php vendors/
    • 20. FX.php • FX.php (via http://msyk.net/fmp/fx_ja/) • http://msyk.net/fmp/fx_ja/ FX.php http://msyk.net/fmp/fx_ja/FX_patched091010.zip
    • 21. FMCakeMix FMCakeMix encoding http://github.com/nojimage/FMCakeMix
    • 22. • Starter Solution ToDo • [fmapp] fmxml
    • 23. FMS • FMS • XML
    • 24. Web • Web • Web
    • 25. CakePHP • app/core/database.php <?php class DATABASE_CONFIG { public $default = array( 'driver' => 'fmcakemix', // datasouce 'persistent' => false, // 'dataSourceType' => 'FMPro7', // FileMaker 'scheme' => 'http', // FMS 'port' => 16080, // FMS ( ) 'host' => '127.0.0.1', // FMS ( ) 'login' => 'Admin', // DB ( ) 'password' => 'admin', // DB ( ) 'database' => 'To Do ', // DB ( ) 'prefix' => '', // 'encoding' => 'UTF-8' // ); }
    • 26. Bake • “cake bake” DB • FMCakeMix
    • 27. - Model • •
    • 28. <?php Todo class Todo extends AppModel { /** * * @var string */ Model public $name = 'Todo'; /** * * @var string */ public $primaryKey = '-recid'; // -- FMCakeMix /** * • $defaultLayout * @var string */ public $defaultLayout = 'WebLayout'; /** * $fmDatabaseName * @var string • */ public $fmDatabaseName = 'To Do '; /** * true $returnValueLists * @var boolean • */ public $returnValueLists = true; /** * call behavior * @var array */ public $actsAs = array('FmValueList'); /** * * @var array */ public $validate = array(' ' => 'notempty'); /** * * @var array */ public $valueLists = array(); }
    • 29. - Controller • • CakePHP http://example.com/{controller }/{action } • URI action
    • 30. Todos <?php class TodosController extends AppController { public $name = 'Todos'; public $uses = array('Todo'); Controller /** * * @var Todo */ public $Todo; /** * */ public function index() • index() { $this->set('todos', $this->paginate()); } /** * */ • view() public function view($id = null) { if (!$id) { $this->Session->setFlash(__(' ID ', true)); $this->redirect(array('action'=>'index')); } • add() } $this->set('todo', $this->Todo->read(null, $id)); /** * */ edit() public function add() • { // $this->set('valueLists', $this->Todo->valueLists); if (!empty($this->data)) { // POST • delete() $this->Todo->create(); if ($this->Todo->save($this->data)) { $this->Session->setFlash(__('TODO ', true)); $this->redirect(array('action'=>'index')); } else { $this->Session->setFlash(__('TODO ', true)); } } } /** *
    • 31. - View • • •
    • 32. Todos <?php $this->pageTitle = __('TODO ', true); $javascript->codeBlock(" ", array('inline' => false)); View (Index) ?> <h2><?php echo $this->pageTitle; ?></h2> <div class="todos index content"> <?php if (empty($todos)) : ?> <p><?php __(' TODO ') ?></p> <?php else: ?> <p class="pagination-count"><?php echo $paginator->counter(array('format' => __(' %count% , <table class="data-table"> • Todo <tr> <th><?php echo $paginator->sort(' ', ' ');?></th> <th><?php echo $paginator->sort(' ', ' ');?></th> <th><?php echo $paginator->sort(' ', ' ');?></th> <th><?php echo $paginator->sort(' ', ' ');?></th> <th><?php echo $paginator->sort(' ', ' ');?></th> <th><?php echo $paginator->sort(' ', ' ');?></th> <th><?php echo $paginator->sort(' ', ' ');?></th> <th><?php echo $paginator->sort(' ', ' ');?></th> <th class="actions"><?php __(' ');?></th> </tr> <?php $i = 0; foreach ($todos as $todo): $i++; ?> <tr<?php echo ($i % 2 == 0) ? ' class="altrow"' : '';?>> <td><?php echo $html->link($todo['Todo'][' '], array('action' => 'view', $todo[' <td><?php echo $todo['Todo'][' '] ? $time->format('Y-m-d', $todo['Todo'][' ']) <td><?php echo $todo['Todo'][' '] ? $time->format('Y-m-d', $todo['Todo'][' ']) : ' <td><?php echo $todo['Todo'][' '] ?></td> <td><?php echo $todo['Todo'][' '] ?></td> <td><?php echo $todo['Todo'][' '] ?></td> <td><?php echo $todo['Todo'][' '] ? $todo['Todo'][' '] : '' ?></td> <td><?php echo $todo['Todo'][' '] ? $time->format('Y-m-d', $todo['Todo'][' ']) <td class="actions"> <?php echo $html->link(__(' ', true), array('action' => 'edit', $todo['Todo']['- <?php echo $html->link(__(' ', true), array('action' => 'delete', $todo['Todo'][ </td> </tr> <?php endforeach; ?> </table> <div class="paging"> <?php echo $paginator->prev('<< '.__('previous', true), array(), null, array('class'=>'dis <?php echo $paginator->numbers();?> <?php echo $paginator->next(__('next', true).' >>', array(), null, array('class' => 'disab
    • 33. Todos <div class="ads view"> <h2><?php __('Todo');?></h2> <dl> <?php $i = 0; $class = ' class="altrow"';?> <dt <?php if ($i % 2 == 0) echo $class;?>><?php __(' '); ?></dt> <dd <?php if ($i++ % 2 == 0) echo $class;?>><?php echo $todo['Todo'][' ']; ?> View (view) &nbsp;</dd> <dt <?php if ($i % 2 == 0) echo $class;?>><?php __(' '); ?></dt> <dd <?php if ($i++ % 2 == 0) echo $class;?>><?php echo $todo['Todo'][' ']; ?> &nbsp;</dd> <dt <?php if ($i % 2 == 0) echo $class;?>><?php __(' '); ?></dt> <dd <?php if ($i++ % 2 == 0) echo $class;?>><?php echo $todo['Todo'][' '] ? $time->for &nbsp;</dd> <dt <?php if ($i % 2 == 0) echo $class;?>><?php __(' '); ?></dt> <dd <?php if ($i++ % 2 == 0) echo $class;?>><?php echo $todo['Todo'][' '] ? $time->forma • Todo &nbsp;</dd> <dt <?php if ($i % 2 == 0) echo $class;?>><?php __(' '); ?></dt> <dd <?php if ($i++ % 2 == 0) echo $class;?>><?php echo $todo['Todo'][' ']; ?> &nbsp;</dd> <dt <?php if ($i % 2 == 0) echo $class;?>><?php __(' '); ?></dt> <dd <?php if ($i++ % 2 == 0) echo $class;?>><?php echo $todo['Todo'][' ']; ?> &nbsp;</dd> <dt <?php if ($i % 2 == 0) echo $class;?>><?php __(' '); ?></dt> <dd <?php if ($i++ % 2 == 0) echo $class;?>><?php echo nl2br($todo['Todo'][' ']); ?> &nbsp;</dd> <dt <?php if ($i % 2 == 0) echo $class;?>><?php __(' '); ?></dt> <dd <?php if ($i++ % 2 == 0) echo $class;?>><?php echo $todo['Todo'][' '] ? $time->for &nbsp;</dd> <dt <?php if ($i % 2 == 0) echo $class;?>><?php __(' '); ?></dt> <dd <?php if ($i++ % 2 == 0) echo $class;?>><?php echo $todo['Todo'][' '] ? '○' : '' ?> &nbsp;</dd> </dl> </div> <div class="actions"> <ul> <li><?php echo $html->link(__(' ', true), array('action' => 'edit', $todo['Todo']['-reci <li><?php echo $html->link(__(' ', true), array('action' => 'delete', $form->value('Todo <li><?php echo $html->link(__('TODO ', true), array('action' => 'index')); ?></li> </ul> </div>
    • 34. Todos <?php $this->pageTitle = __('TODO ', true); $fields = array( ' ' => array('label' => __(' ', true)), View (Add) ' ' => array('label' => __(' ', true), 'options' => $valueList ' ' => array('label' => __(' ', true), 'options' => $valueList ' ' => array('label' => __(' ', true), 'options' => $valueLists[' ' ' => array('label' => __(' ', true), 'dateFormat' => 'YMD', 'mo ' ' => array('label' => __(' ', true), 'dateFormat' => 'YMD', 'monthN ' ' => array('label' => __(' ', true), 'type' => 'textarea'), ); • Todo $javascript->codeBlock(" ", array('inline' => false)); ?> <h2><?php echo $this->pageTitle; ?></h2> <?php echo $form->create(); ?> <?php echo $form->inputs($fields); ?> <?php echo $form->end(__(' ', true)); ?> <div class="actions"> <ul> <li><?php echo $html->link(__('TODO ', true), array('action' => ' </ul> </div>
    • 35. Todos <?php $this->pageTitle = __('TODO ', true); $fields = array( ' ' => array('label' => __(' ', true)), View (Edit) ' ' => array('label' => __(' ', true), 'options' => $valueList ' ' => array('label' => __(' ', true), 'options' => $valueList ' ' => array('label' => __(' ', true), 'options' => $valueLists[' ' ' => array('label' => __(' ', true), 'dateFormat' => 'YMD', 'mo ' ' => array('label' => __(' ', true), 'dateFormat' => 'YMD', 'monthN ' ' => array('label' => __(' ', true), 'type' => 'textarea'), ' ' => array('label' => __(' ', true), 'type' => 'text', 'value' • Todo ')) : '')), ' ' => array('label' => __(' ', true), 'type' => 'checkbox'), ); $javascript->codeBlock(" ", array('inline' => false)); ?> <h2><?php echo $this->pageTitle; ?></h2> <?php echo $form->create(); ?> <?php echo $form->hidden('Todo.-recid'); ?> <?php echo $form->inputs($fields); ?> <?php echo $form->end(__(' ', true)); ?> <div class="actions"> <ul> <li><?php echo $html->link(__(' ', true), array('action' => 'delete true)); ?></li> <li><?php echo $html->link(__('TODO ', true), array('action' => ' </ul> </div>
    • 36. FMCakeMix • FileMaker DB WEB WEB • • Web (Ajax) • iPhone
    • 37. FMCakeMix • FileMaker • Container Fields : container fields will supply a url string to the resource or a copy of the resource made by filemaker, but files can not be uploaded into container fields. ( ) • CakePHP Model • Attributes • hasOne : currently no support for this relationship type (hasOne ) • hasAndBelongsToMany : currently no support for this relationship type Methods (HABTM ) • Methods • deleteAll : only takes the condition that the -recid equals the recid of the record to delete and therefore does not support deleting many records at a time. Also, you must pass a boolean false as the second parameter of this request so that it does not attempt recursive deletion of related records ( ) • save : the fields parameter, or white list of fields to save, does not work. ($fieldList )

    ×