示例#1
0
 static function list_group($objects, $item, $actions = null)
 {
     if (!is_array($objects) || !sizeof($objects) > 0) {
         return null;
     }
     if (!$item || !strlen($item) > 0) {
         return null;
     }
     echo '<ul class="list-group">';
     foreach ($objects as $object) {
         if (isset($object->{$item})) {
             echo '<li class="list-group-item" >';
             if (isset($object->text)) {
                 echo '<h4 class="list-group-item-heading">';
             }
             echo MPut::text($object->{$item});
             if (is_array($actions) && sizeof($actions) > 0) {
                 foreach ($actions as $key => $value) {
                     echo '<button type="button" class="btn btn-xs btn-action" onclick=' . MPut::js(self::action($value, $object)) . ' style="float: right;">' . MPut::html($key) . '</button> ';
                 }
             }
             if (isset($object->text)) {
                 echo '</h4>';
             }
             if (isset($object->text)) {
                 echo '<p class="list-group-item-text">' . MPut::text($object->text) . '</p>';
             }
             echo '</li>';
         }
     }
     echo '</ul>';
 }
示例#2
0
 static function put_action($title, $js, $object = null)
 {
     if ($object && !is_object($object)) {
         return null;
     }
     if ($object) {
         $js = MHTML::action($js, $object);
     }
     echo '<button type="button" class="btn btn-xs" onclick=' . MPut::js($js) . ' style="float: right;">' . MPut::html($title) . '</button>';
 }