PageRenderTime 47ms CodeModel.GetById 24ms RepoModel.GetById 1ms app.codeStats 0ms

/baser/plugins/mail/views/helpers/mailfield.php

https://github.com/hashing/basercms
PHP | 95 lines | 37 code | 16 blank | 42 comment | 5 complexity | 528594c332f9936dd34407d52f679177 MD5 | raw file
Possible License(s): MIT
  1. <?php
  2. /* SVN FILE: $Id$ */
  3. /**
  4. * メールフィールドヘルパー
  5. *
  6. * PHP versions 5
  7. *
  8. * baserCMS : Based Website Development Project <http://basercms.net>
  9. * Copyright 2008 - 2012, baserCMS Users Community <http://sites.google.com/site/baserusers/>
  10. *
  11. * @copyright Copyright 2008 - 2012, baserCMS Users Community
  12. * @link http://basercms.net baserCMS Project
  13. * @package baser.plugins.mail.views.helpers
  14. * @since baserCMS v 0.1.0
  15. * @version $Revision$
  16. * @modifiedby $LastChangedBy$
  17. * @lastmodified $Date$
  18. * @license http://basercms.net/license/index.html
  19. */
  20. /**
  21. * Include files
  22. */
  23. /**
  24. * メールフィールドヘルパー
  25. *
  26. * @package baser.plugins.mail.views.helpers
  27. *
  28. */
  29. class MailfieldHelper extends AppHelper {
  30. /**
  31. * htmlの属性を取得する
  32. *
  33. * @param array メールフィールド
  34. * @return array html属性
  35. * @access public
  36. */
  37. function getAttributes($data) {
  38. if(isset($data['MailField'])) {
  39. $data = $data['MailField'];
  40. }
  41. $attributes['size']=$data['size'];
  42. $attributes['rows']=$data['rows'];
  43. $attributes['maxlength']=$data['maxlength'];
  44. $attributes['separator']=$data['separator'];
  45. $attributes['class']=$data['class'];
  46. if(!empty($data['options'])) {
  47. $options = explode("|",$data['options']);
  48. $options = call_user_func_array('aa', $options);
  49. $attributes = am($attributes,$options);
  50. }
  51. return $attributes;
  52. }
  53. /**
  54. * コントロールのソースを取得する
  55. *
  56. * @param array メールフィールド
  57. * @return array コントロールソース
  58. * @access public
  59. */
  60. function getOptions($data) {
  61. if(isset($data['MailField'])) {
  62. $data = $data['MailField'];
  63. }
  64. $attributes = $this->getAttributes($data);
  65. // コントロールソースを変換
  66. if(!empty($data['source'])) {
  67. if($data['type']!="check") {
  68. $values = split("\|",$data['source']);
  69. $i = 0;
  70. foreach($values as $value) {
  71. $i++;
  72. $source[$i] = $value;
  73. }
  74. return $source;
  75. }
  76. }
  77. }
  78. }
  79. ?>