當前位置: 首頁>>代碼示例>>PHP>>正文


PHP HTML_Common::_getAttrString方法代碼示例

本文整理匯總了PHP中HTML_Common::_getAttrString方法的典型用法代碼示例。如果您正苦於以下問題:PHP HTML_Common::_getAttrString方法的具體用法?PHP HTML_Common::_getAttrString怎麽用?PHP HTML_Common::_getAttrString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在HTML_Common的用法示例。


在下文中一共展示了HTML_Common::_getAttrString方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: createButtons

 /**
  * Adds all necessary buttons to the given page object.
  *
  * @param      object    $page          Page where to put the button
  * @param      array     $buttons       Key/label of each button/event to handle
  * @param      mixed     $attributes    (optional) Either a typical HTML attribute string
  *                                      or an associative array.
  * @return     void
  * @since      1.1
  * @access     public
  * @throws     HTML_PROGRESS_ERROR_INVALID_INPUT
  */
 function createButtons(&$page, $buttons, $attributes = null)
 {
     if (!is_a($page, 'HTML_QuickForm_Page')) {
         return HTML_Progress::raiseError(HTML_PROGRESS_ERROR_INVALID_INPUT, 'exception', array('var' => '$page', 'was' => gettype($page), 'expected' => 'HTML_QuickForm_Page object', 'paramnum' => 1));
     } elseif (!is_array($buttons)) {
         return HTML_Progress::raiseError(HTML_PROGRESS_ERROR_INVALID_INPUT, 'exception', array('var' => '$buttons', 'was' => gettype($buttons), 'expected' => 'array', 'paramnum' => 2));
     } elseif (!is_array($attributes) && !is_string($attributes) && !is_null($attributes)) {
         return HTML_Progress::raiseError(HTML_PROGRESS_ERROR_INVALID_INPUT, 'exception', array('var' => '$attributes', 'was' => gettype($attributes), 'expected' => 'array | string', 'paramnum' => 3));
     }
     $confirm = $attributes = HTML_Common::_parseAttributes($attributes);
     $confirm['onClick'] = "return(confirm('Are you sure ?'));";
     $prevnext = array();
     foreach ($buttons as $event => $label) {
         if ($event == 'cancel') {
             $type = 'submit';
             $attrs = $confirm;
         } elseif ($event == 'reset') {
             $type = 'reset';
             $attrs = $confirm;
         } else {
             $type = 'submit';
             $attrs = $attributes;
         }
         $prevnext[] = $page->createElement($type, $page->getButtonName($event), $label, HTML_Common::_getAttrString($attrs));
     }
     $page->addGroup($prevnext, 'buttons', '', ' ', false);
 }
開發者ID:alachaum,項目名稱:timetrex,代碼行數:39,代碼來源:generator.php

示例2: buildButtons

 /**
  * Builds command buttons of the Wizard.
  *
  * @return void
  * @since  2.1.0
  * @access public
  */
 function buildButtons($disable = null, $commands = null)
 {
     $buttons = array('back', 'next', 'cancel', 'reset', 'dump', 'apply', 'process');
     if (isset($commands)) {
         $buttons = array_merge($buttons, $commands);
     }
     if (!isset($disable)) {
         $disable = array();
     } elseif (!isset($disable[0])) {
         $disable = array($disable);
     }
     $confirm = $attributes = array('class' => 'cmdButton');
     $confirm['onclick'] = "return(confirm('Are you sure ?'));";
     $prevnext = array();
     foreach ($buttons as $event) {
         switch ($event) {
             case 'cancel':
                 $type = 'submit';
                 $attrs = $confirm;
                 break;
             case 'reset':
                 $type = 'reset';
                 $attrs = $confirm;
                 break;
             default:
                 $type = 'submit';
                 $attrs = $attributes;
                 break;
         }
         if (in_array($event, $disable)) {
             $attrs['disabled'] = 'true';
         }
         if ($event == 'dump') {
             $dump = $this->controller->_act[$event];
             if ($dump === false) {
                 continue;
             }
             $opts = array('1' => 'Progress2 dump info', '2' => 'Forms values container', '3' => 'Included Files', '4' => 'Declared Classes', '5' => 'Declared Actions');
             $prevnext[] =& HTML_QuickForm::createElement('select', 'dumpOption', '', $opts);
         }
         $prevnext[] =& HTML_QuickForm::createElement($type, $this->getButtonName($event), ucfirst($event), HTML_Common::_getAttrString($attrs));
     }
     $this->addGroup($prevnext, 'buttons', '', ' ', false);
 }
開發者ID:alexzita,項目名稱:alex_blog,代碼行數:51,代碼來源:pages.php


注:本文中的HTML_Common::_getAttrString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。