当前位置: 首页>>代码示例>>PHP>>正文


PHP HCM::_x方法代码示例

本文整理汇总了PHP中HCM::_x方法的典型用法代码示例。如果您正苦于以下问题:PHP HCM::_x方法的具体用法?PHP HCM::_x怎么用?PHP HCM::_x使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HCM的用法示例。


在下文中一共展示了HCM::_x方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: type

 function type($model, $vlevel = HC_PRESENTER::VIEW_HTML)
 {
     switch ($model->type) {
         case $model->_const('TYPE_TIMEOFF'):
             $type_text = HCM::__('Timeoff');
             $type_icon = 'timeoff';
             break;
         default:
             $type_text = HCM::__('Shift');
             $type_icon = 'shift';
             break;
     }
     switch ($vlevel) {
         case HC_PRESENTER::VIEW_HTML:
             $label_class = $this->status_class($model);
             $return = HC_Html_Factory::widget('titled', 'span')->add_attr('class', array('alert'))->add_attr('class', array('alert-condensed'))->add_child(HC_Html::icon(HC_App::icon_for($type_icon)))->add_child($type_text);
             if (!is_array($label_class)) {
                 $label_class = array($label_class);
             }
             foreach ($label_class as $lc) {
                 $return->add_attr('class', 'alert-' . $lc);
             }
             break;
         case HC_PRESENTER::VIEW_HTML_ICON:
             $return = HC_Html::icon(HC_App::icon_for($type_icon));
             list($label_text, $label_class) = $this->_status_details($model);
             // $return->add_attr('class', 'text-' . $label_class);
             $title = array();
             $title[] = $model->present_type(HC_PRESENTER::VIEW_RAW);
             $title[] = $label_text;
             $title = join(': ', $title);
             $return->add_attr('title', $title);
             break;
         case HC_PRESENTER::VIEW_TEXT:
             $return = HCM::_x('Type', 'noun') . ': ' . $type_text;
             break;
         case HC_PRESENTER::VIEW_RAW:
             $return = $type_text;
             break;
     }
     return $return;
 }
开发者ID:RCMmedia,项目名称:rubicon,代码行数:42,代码来源:shift.php

示例2: render

 function render()
 {
     if (!($link = $this->link())) {
         return 'HC_Html_Widget_Filter: link is not set!';
     }
     // $this->set_panel('default');
     $add_title = $this->title();
     $readonly = $this->readonly();
     $allow_multiple = $this->allow_multiple();
     $require_one = $this->require_one();
     $fixed = $this->fixed();
     $title = $add_title;
     $selected = $this->selected();
     if ($selected) {
         $title = array();
         foreach ($selected as $sel) {
             $title[] = $this->option($sel);
         }
         $title = join(' ', $title);
     }
     $filter_icon = HC_Html_Factory::element('span')->add_attr('class', 'btn')->add_attr('class', 'btn-default')->add_child(HC_Html::icon('glass'));
     $filter_icon = '';
     if ($readonly && !$this->selected()) {
         return NULL;
     }
     $title = $filter_icon . $title;
     $this->set_title($title);
     $content = HC_Html_Factory::widget('list')->add_attr('class', 'list-inline')->add_attr('class', 'list-separated')->add_attr('class', 'list-separated-ver');
     $btn_size = $this->btn_size();
     $btn_size = 'btn-' . $btn_size;
     /* remaining possible options */
     $remain_options = FALSE;
     if (!$this->selected() or $allow_multiple) {
         $param_name = $this->param_name();
         foreach ($this->options() as $id => $label) {
             if (!in_array($id, $this->selected())) {
                 $option_wrap = HC_Html_Factory::widget('titled', 'a')->add_attr('class', 'btn')->add_attr('class', $btn_size)->add_attr('class', 'btn-default')->add_attr('class', 'squeeze-in')->add_attr('class', 'text-left')->add_attr('style', 'width: 10em;')->add_attr('style', 'text-align: left;');
                 if ($param_name === NULL) {
                     $option_wrap->add_attr('href', $link->url($id, array()));
                 } else {
                     $option_wrap->add_attr('href', $link->url(array($param_name . '+' => $id)));
                 }
                 $option_wrap->add_child($label);
                 $attr = isset($this->option_attr[$id]) ? $this->option_attr[$id] : array();
                 foreach ($attr as $attr_k => $attr_v) {
                     $option_wrap->add_attr($attr_k, $attr_v);
                 }
                 $content->add_item($id, $option_wrap);
                 $remain_options = TRUE;
             }
         }
     }
     $this->set_content($content);
     $panel = $this->panel();
     $out = HC_Html_Factory::widget('list')->add_attr('class', 'list-unstyled')->add_attr('class', 'collapse-panel');
     if ($panel) {
         $out->add_attr('class', array('panel', 'panel-' . $panel));
         $out->add_attr('class', array('panel-condensed'));
     }
     /* build trigger */
     $title = HC_Html_Factory::widget('list')->add_attr('class', 'list-separated')->add_attr('class', 'list-inline');
     /* current selection */
     $selected = $this->selected();
     if ($selected) {
         foreach ($selected as $sel) {
             if ($require_one) {
                 $option_wrap = HC_Html_Factory::widget('titled', 'a')->add_attr('href', '#')->add_attr('class', 'hc-collapse-next');
             } else {
                 $option_wrap = HC_Html_Factory::widget('titled', 'div');
                 if (!$fixed) {
                     $option_wrap->add_child(HC_Html_Factory::element('a')->add_attr('href', $link->url(array($this->param_name() . '-' => $sel)))->add_attr('class', 'btn-close')->add_attr('class', 'btn')->add_attr('class', 'btn-danger-o')->add_child(HC_Html::icon('times')));
                 }
             }
             $option_wrap->add_attr('class', 'btn')->add_attr('class', $btn_size)->add_attr('class', 'btn-default')->add_attr('class', 'btn')->add_attr('class', 'squeeze-in')->add_attr('class', 'text-left')->add_attr('style', 'width: 10em;')->add_attr('style', 'text-align: left;');
             $option_label = $this->option($sel);
             $option_wrap->add_child($option_label);
             if ($require_one) {
                 $option_wrap->add_child(' ')->add_child(HC_Html_Factory::element('b')->add_attr('class', 'caret'));
             }
             $attr = isset($this->option_attr[$sel]) ? $this->option_attr[$sel] : array();
             foreach ($attr as $attr_k => $attr_v) {
                 $option_wrap->add_attr($attr_k, $attr_v);
             }
             $title->add_item($sel, $option_wrap);
         }
     }
     if ($remain_options && !$require_one) {
         $trigger = HC_Html_Factory::element('a')->add_child(HC_Html::icon('plus') . HCM::_x('Filter', 'noun') . ': ' . $add_title)->add_attr('href', '#')->add_attr('class', 'hc-collapse-next')->add_attr('class', 'btn')->add_attr('class', 'btn-success-o')->add_attr('class', $btn_size);
         $title->add_item($trigger);
     }
     $out->add_item('header', $title);
     if ($panel) {
         $out->add_item_attr('header', 'class', 'panel-heading');
     }
     $out->add_item_attr('content', 'class', 'collapse');
     if ($panel) {
         $out->add_item_attr('content', 'class', 'panel-collapse');
     }
     if ($this->default_in()) {
         $out->add_item_attr('content', 'class', 'in');
//.........这里部分代码省略.........
开发者ID:RCMmedia,项目名称:rubicon,代码行数:101,代码来源:filter.php

示例3: label

 function label($model, $vlevel = HC_PRESENTER::VIEW_HTML)
 {
     $return = HCM::_x('Comment', 'noun');
     return $return;
 }
开发者ID:RCMmedia,项目名称:rubicon,代码行数:5,代码来源:note.php


注:本文中的HCM::_x方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。