示例#1
0
 private static function get_browser()
 {
     $browser = null;
     if (!empty($_SERVER['HTTP_USER_AGENT'])) {
         $browser = $_SERVER['HTTP_USER_AGENT'];
     }
     self::$visitor['browser'] = MPut::text($browser);
 }
示例#2
0
 static function add_category($id)
 {
     $contents = array();
     $category = MObject::get('category', $id);
     if ($category && sizeof($category->get_contents()) > 0) {
         $i = 0;
         foreach ($category->get_contents() as $content) {
             $title = '';
             $title .= '<a href="index.php?module=content&object=' . MPut::id($content->get_id()) . '">' . MPut::html($content->get_title()) . '</a>';
             $title .= '<br />';
             $title .= '<small>(' . MPut::text($content->get_address()) . ')</small>';
             $contents[$i] = array('title' => $title, 'text' => substr(strip_tags($content->get_text()), 0, 100) . ' ... <br /><br /><a href="index.php?module=content&object=' . intval($content->get_id()) . '"><small>read more &gt;&gt;</small></a>', 'lat' => $content->get_lat(), 'lng' => $content->get_lng(), 'category' => $category->get_name());
             if ('event' == $content->get_type()) {
                 $contents[$i]['start'] = $content->get_start();
                 $contents[$i]['end'] = $content->get_end();
             }
             $i++;
         }
     }
     return $contents;
 }
示例#3
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>';
 }