function content_display_content_admin_list

7.x content.module content_display_content_admin_list()
6.x content.module content_display_content_admin_list()
4.x content.module content_display_content_admin_list()
5.x content.module content_display_content_admin_list()

Display a list of content for the administrator

File

modules/content/content.module, line 510

Code

function content_display_content_admin_list() {
  $rtn = "";

  //fp_add_css(fp_get_module_path("content") . "/css/content.css");


  $rtn .= "<br><b>" . t("Create new content:") . "</b>
            <table border='1' width='100%' cellpadding='4'>";
  // Go through all available content types and provide a link.
  $types = content_get_types();
  // We expect types to be returned like this:
  // ["page"]["title"] = "Basic Page";
  // ["page"]["description"] = "This is a standard page.";
  foreach ($types as $type => $details) {
    if (user_has_permission("edit_$type" . "_content")) {
      $rtn .= "<tr>
                <td>" . l($details ["title"], "content/add/$type") . "</td>
                <td>" . $details ["description"] . "</td></tr>";
    }
  }



  $rtn .= "</table>
          
          <hr>";

  // Show a table of current content in the system.
  $rtn .= "<b>" . t("Existing content:") . "</b>";
  @$filter = $_GET ["filter"];

  $rtn .= "<form action='" . fp_url("admin/config/content") . "' method='GET'>
              " . t("Display type:") . " &nbsp; <select name='filter'>
                  <option value=''>" . t(" -- Any --") . "</option>";
  foreach ($types as $type => $details) {
    $sel = ($type == $filter) ? "selected" : "";
    $rtn .= "<option value='$type' $sel>" . $details ["title"] . "</option>";
  }
  $rtn .= "</select><input type='submit' value='-&gt;'> </form>";



  $rtn .= "<table width='100%' border='1' class='tenpt'>
            <tr>
              <th>" . t("Title") . "</th>
              <th>" . t("Edit") . "</th>
              <th>" . t("Type") . "</th>
              <th>" . t("Author") . "</th>
              <th>" . t("Updated") . "</th>
            </tr>";
  if ($filter != "") {
    $res = db_query("SELECT * FROM content WHERE type = '?' ORDER BY title", $filter);
  }
  else {
    $res = db_query("SELECT * FROM content ORDER BY title");
  }

  while ($cur = db_fetch_array($res)) {

    $author = fp_load_user($cur ["user_id"]);
    $author_name = "";
    if ($author && isset($author->name)) {
      $author_name = $author->name;
    }

    $updated = format_date($cur ["updated"]);

    //$rtn .= "<tr><td valign='top'>" . l($cur["title"], "content/{$cur["cid"]}") . "</td>";
    $rtn .= "<tr><td valign='top'>" . $cur ["title"] . "</td>";

    if (user_has_permission("edit_{$cur ["type"]}" . "_content")) {
      $rtn .= "
                <td valign='top'>" . l(t("edit"), "content/{$cur ["cid"]}/edit") . "</td>";
    }
    else {
      $rtn .= "<td>&nbsp;</td>";
    }

    $rtn .= "
                <td valign='top'>" . $cur ["type"] . "</td>
                <td valign='top'>" . $author_name . "</td>
                <td valign='top'>" . $updated . "</td>
             </tr>";
  }

  $rtn .= "</table>";



  return $rtn;
}