public function menu_ui() { $b = content_database::get_all_node_types(); $k = array(); foreach ($b as $content) { $k[] = array("name" => $content->name, "url" => "node/add/" . $content->type); } return array(array("name" => "add new content", "url" => "/node/add", "submenu" => $k)); }
function home() { $out = "there is actually no content. enable content module to manage this page"; if (module_manager::is_enabled("content")) { $out = ""; $nodes = content_database::node_load_all(); $b = false; if (count($nodes) > 0) { page::title("Home"); foreach ($nodes as $node) { if (content::node_access_read($node->nid)) { $b = true; $out .= "<div class='post'>"; if ($node->title != null) { $out .= "<div class='title'>"; $out .= page::link("node/" . $node->nid, $node->title); $out .= "</div>"; } if ($node->description != null) { $out .= "<div class='content'>"; $node->description = utf8_decode($node->description); if (strlen($node->description) > 200) { $out .= substr($node->description, 0, 200) . "... " . page::link("node/" . $node->nid, t("+ read more")); } else { $out .= $node->description; } $out .= "</div>"; } $out .= "<div class='author'>"; $out .= "<hr/>"; $out .= content_page::post_author_date($node->uid, $node->author, $node->date); $out .= "<hr/>"; $out .= "</div>"; $out .= "</div>"; } } } else { $out .= "there is no content, please add a content first."; } } return $b ? $out : "there is no content."; }
public function save_content($type) { global $user; if (isset($_POST['submit'])) { unset($_POST['submit']); if (isset($_POST['nid'])) { /* EDIT FORM */ } else { $title = ""; $body = ""; if (isset($_POST['title'])) { $title = $_POST['title']; unset($_POST['title']); } if (isset($_POST['body'])) { $body = $_POST['body']; unset($_POST['body']); } $nid = content_database::insert_node($type, $title, $body, $_POST, isset($user->uid) ? $user->uid : 0, isset($user->username) ? $user->username : "******"); page::redirect("/node/{$nid}"); } } }
public function uninstall() { content_database::delete_content_type("news"); }