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 >></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; }
static function label($title) { echo '<label>' . MPut::html($title) . '</label>'; }
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>'; }
static function show($type = 'all', $element = 'div') { if (!$element || !in_array($element, self::$available_elements)) { $element = 'div'; } if (!self::any() > 0) { return null; } echo '<div class="m-messaging">'; switch ($type) { case 'all': if (self::any_errors() > 0) { foreach (self::$errors as $error) { echo '<' . $element . ' class="alert alert-danger">' . MPut::html($error) . '</' . $element . '>'; } } if (self::any_warnings() > 0) { foreach (self::$warnings as $warning) { echo '<' . $element . ' class="alert alert-warning">' . MPut::html($warning) . '</' . $element . '>'; } } if (self::any_success() > 0) { foreach (self::$success as $succ) { echo '<' . $element . ' class="alert alert-success">' . MPut::html($succ) . '</' . $element . '>'; } } self::clear_from_session(); break; case 'errors': if (self::any_errors() > 0) { foreach (self::$errors as $error) { echo '<' . $element . ' class="alert alert-danger">' . MPut::html($error) . '</' . $element . '>'; } } self::clear_from_session('errors'); break; case 'warnings': if (self::any_warnings() > 0) { foreach (self::$warnings as $warning) { echo '<' . $element . ' class="alert alert-warning">' . MPut::html($warning) . '</' . $element . '>'; } } self::clear_from_session('warnings'); break; case 'success': if (self::any_success() > 0) { foreach (self::$success as $succ) { echo '<' . $element . ' class="alert alert-success">' . MPut::html($succ) . '</' . $element . '>'; } } self::clear_from_session('success'); break; } echo '</div>'; }