Пример #1
0
 /**
  * Creates the Group Listing
  * 
  * @param string $code the results code string
  */
 function listGroups($code = '')
 {
     require_once ABSPATH . $this->pluginBase . DIRECTORY_SEPARATOR . 'suitex_list.php';
     $text .= "<div class=\"wrap\">";
     $text .= "<h2>User Groups</h2>";
     $text .= "<span style=\"color: #FF0000; font-weight: bold;\">{$code}</span>";
     $text .= $this->status;
     $headers["group_name"] = "Group Name";
     $headers["members"] = "# of Members";
     $headers["pages"] = "# of Pages";
     $order = "usecurex_group_name";
     $sort = "asc";
     if ($_GET["limit"]) {
         $limit = $_GET["limit"];
     } else {
         $limit = 0;
     }
     $query = "select usecurex_group_id, usecurex_group_name from " . $this->wpdb->prefix . "usecurex_group order by {$order} {$sort}";
     $count = 0;
     $result = $this->wpdb->get_results($query);
     foreach ($result as $row) {
         $count++;
         $memberCount = $this->wpdb->get_var("select count(usecurex_group_id) from " . $this->wpdb->prefix . "usecurex_link where usecurex_group_id = '" . $row->usecurex_group_id . "' and usecurex_field_name = 'user_id'");
         $pageCount = $this->wpdb->get_var("select count(usecurex_group_id) from " . $this->wpdb->prefix . "usecurex_link where usecurex_group_id = '" . $row->usecurex_group_id . "' and usecurex_field_name = 'page_id'");
         $rows[$row->usecurex_group_id] = array($row->usecurex_group_name, $memberCount, $pageCount);
     }
     $url = $this->baseURL . "&sub=form&id=";
     $list = new suitex_list();
     $list->search = false;
     $list->orderForm = false;
     $list->filters = false;
     //$list->omit         = array("cb");
     //$list->paging       = true;
     //$this->pluginPath   = $this->pluginBase;
     $list->setNum = $this->numberPerPage;
     $list->startList($headers, $url, $order, $sort, $rows, $limit, $count);
     $text .= $list->text;
     $text .= "</div>";
     $this->text = $text;
 }
Пример #2
0
 /**
  * Shows a list of books
  * 
  */
 function bookx_listItems()
 {
     $link = get_page_link($this->var->options["page_id"]);
     if ($_POST["order"]) {
         $order = $_POST["order"];
     } else {
         if ($_GET["order"]) {
             $order = $_GET["order"];
         } else {
             $order = $this->var->options['list_order_default'];
         }
     }
     if ($_POST["sort"]) {
         $sort = $_POST["sort"];
     } else {
         if ($_GET["sort"]) {
             $sort = $_GET["sort"];
         } else {
             $sort = $this->var->options['list_sort_default'];
         }
     }
     $text = "<div id=\"bookx_content\">";
     if ($this->var->options["list_filter"] == 1) {
         $text .= "<div id=\"bookx_filter\">";
         $text .= "<form id=\"bookx_filter\" action=\"{$link}\" method=\"post\">";
         $text .= "Field: <select name=\"order\">";
         foreach (array_keys($this->var->fieldArray) as $f) {
             if ($f == $order) {
                 $s = "selected";
             } else {
                 $s = '';
             }
             $text .= "<option value=\"{$f}\" {$s}>" . $this->var->fieldArray[$f] . "</option>";
         }
         $text .= "</select>";
         $text .= "&nbsp;&nbsp;Order: <select name=\"sort\">";
         foreach (array_keys($this->var->sortArray) as $f) {
             if ($f == $sort) {
                 $s = "selected";
             } else {
                 $s = '';
             }
             $text .= "<option value=\"{$f}\" {$s}>" . $this->var->sortArray[$f] . "</option>";
         }
         $text .= "</select>";
         $text .= "<input type=\"submit\" value=\"Set\" />";
         $text .= "</form>";
         $text .= "</div>";
     }
     if ($_GET["limit"]) {
         $limit = $_GET["limit"];
     } else {
         $limit = 0;
     }
     $count = $this->wpdb->get_var("select count(bx_item_id) from " . $this->wpdb->prefix . "bx_item");
     $setnum = $this->var->options["per_page"];
     if ($this->var->options["per_page"] != 0 && $count > $setnum) {
         $paging = true;
         require_once BOOKX_DIR . 'suitex/suitex_list.php';
         $listObj = new suitex_list();
         $listObj->setNum = $setnum;
         $url = $link . "?&order={$order}&sort={$sort}";
         $pager = $listObj->createPaging($limit, $count, $url);
         $text .= "<div id=\"bookx_pager\">{$pager}</div>";
     }
     $sql = "select bx_item_publisher, bx_item_price, bx_item_date, bx_item_summary, bx_item_comments, ";
     $sql .= "bx_item_id, bx_item_name, bx_item_isbn, bx_item_format, bx_item_pages, bx_item_author, bx_item_image";
     $sql .= " from " . $this->wpdb->prefix . "bx_item ";
     $sql .= "order by {$order} {$sort}";
     $sql .= " limit {$limit}, {$setnum}";
     $results = $this->wpdb->get_results($sql);
     if (substr_count($this->var->options["listTemplate"], "::IMAGE::")) {
         $doImage = true;
     }
     foreach ($results as $row) {
         $image = $row->bx_item_image;
         if ($doImage && $image != '') {
             $sourceWidth = substr($image, strpos($image, "width=\"") + 7);
             $sourceWidth = substr($sourceWidth, 0, strpos($sourceWidth, "\""));
             $sourceHeight = substr($image, strpos($image, "height=\"") + 8);
             $sourceHeight = substr($sourceHeight, 0, strpos($sourceHeight, "\""));
             if ($sourceWidth > $this->var->options["list_image_width"]) {
                 $newWidth = $this->var->options["list_image_width"];
                 $newHeight = (int) ($sourceHeight * ($this->var->options["list_image_width"] / $sourceWidth));
             } else {
                 if ($sourceHeight > $this->var->options["list_image_height"]) {
                     $newWidth = (int) ($sourceWidth * ($this->var->options["list_image_height"] / $sourceHeight));
                     $newHeight = $this->var->options["list_image_height"];
                 } else {
                     $newWidth = $sourceWidth;
                     $newHeight = $sourceHeight;
                 }
             }
             $image = str_replace('width="' . $sourceWidth . '"', 'width="' . $newWidth . '"', $image);
             $image = str_replace('height="' . $sourceHeight . '"', 'height="' . $newHeight . '"', $image);
             if ($this->var->options["list_image_align"] != '') {
                 $image = str_replace("src", "align=\"" . $this->var->options['list_image_align'] . "\" src", $image);
             }
         }
         $trans["::ELINK::"] = $row->bx_item_link;
         $trans["::TITLE::"] = $row->bx_item_name;
         $trans["::AUTHOR::"] = $row->bx_item_author;
         $trans["::ISBN::"] = $row->bx_item_isbn;
         $trans["::PUBLISHER::"] = $row->bx_item_publisher;
         $trans["::DATE::"] = $row->bx_item_date;
         $trans["::PAGES::"] = $row->bx_item_pages;
         $trans["::FORMAT::"] = $row->bx_item_format;
         $trans["::LINK::"] = $link . "?&book_id=" . $row->bx_item_id;
         $trans["::IMAGE::"] = $image;
         $trans["::PRICE::"] = $row->bx_item_price;
         $trans["::SUMMARY::"] = substr(strip_tags($row->bx_item_summary), 0, $this->var->options["list_characters"]) . "...";
         $trans["::COMMENTS::"] = substr(strip_tags($row->bx_item_comments), 0, $this->var->options["list_characters"]) . "...";
         $trans["::MORE::"] = " <a href=\"" . $link . "?&book_id=" . $row->bx_item_id . "\">More</a>";
         $text .= "<div class=\"bookx_list_entry\">" . strtr(stripslashes($this->var->options["listTemplate"]), $trans) . "</div>";
     }
     if ($pager) {
         $text .= "<div id=\"bookx_pager\">{$pager}</div>";
     }
     $text .= "</div>";
     $this->text = $text;
 }
Пример #3
0
 /**
  * The administration view of the book list.
  * 
  */
 function bookx_list()
 {
     require_once BOOKX_DIR . 'suitex/suitex_list.php';
     $text .= "<div class=\"wrap\">";
     $text .= "<h2>BookX</h2>";
     $text .= $this->status;
     $headers["bx_item_name"] = "Title";
     $headers["bx_item_author"] = "Author";
     $headers["bx_item_isbn"] = "ISBN";
     $headers["bx_item_sidebar"] = "Sidebar";
     $order = "bx_item_name";
     $sort = "asc";
     if ($_GET["limit"]) {
         $limit = $_GET["limit"];
     } else {
         $limit = 0;
     }
     $query = "select count(bx_item_id) from " . $this->wpdb->prefix . "bx_item";
     $count = $this->wpdb->get_var($query);
     $query = "select ";
     $query .= "bx_item_name as item, ";
     $query .= "bx_item_author as author, ";
     $query .= "bx_item_isbn as isbn, ";
     $query .= "bx_item_sidebar as sidebar, ";
     $query .= "bx_item_id as id ";
     $query .= "from " . $this->wpdb->prefix . "bx_item ";
     $query .= "order by {$order} {$sort} limit {$limit}, " . $this->numberPerPage;
     $result = $this->wpdb->get_results($query);
     foreach ($result as $row) {
         $sidebar = $this->var->filter[$row->sidebar];
         if ($row->item) {
             $itemName = $row->item;
         } else {
             $itemName = "Import Failed";
         }
         $rows[$row->id] = array($itemName, $row->author, $row->isbn, $sidebar);
     }
     $url = $this->baseURL . "&sub=form&id=";
     $list = new suitex_list();
     $list->search = false;
     $list->orderForm = false;
     $list->filters = false;
     $list->omit = array("cb");
     $list->paging = true;
     $list->pluginPath = BOOKX_URL;
     $list->setNum = $this->numberPerPage;
     $list->startList($headers, $url, $order, $sort, $rows, $limit, $count);
     $text .= $list->text;
     $text .= "</div>";
     $this->bookx_stroke($text);
 }
Пример #4
0
 /**
  * The administration view of the book list.
  * 
  */
 function svnx_list()
 {
     require_once SVNX_DIR . 'includes/suitex_list.php';
     $text .= "<div class=\"wrap\">";
     $text .= "<h2>SVNX</h2>";
     $text .= $this->status;
     $headers["name"] = "Name";
     $headers["url"] = "URL";
     $headers["username"] = "******";
     $headers["id"] = "ID";
     foreach (array_keys($this->options["repo"]) as $key) {
         $rows[$key] = array($this->options["repo"][$key]["name"], $this->options["repo"][$key]["url"], $this->options["repo"][$key]["username"], $key);
     }
     $url = $this->baseURL . "&sub=form&id=";
     $list = new suitex_list();
     $list->search = false;
     $list->orderForm = false;
     $list->filters = false;
     $list->omit = array("cb");
     $this->paging = true;
     $this->pluginPath = SVNX_URL;
     $list->startList($headers, $url, $order, $sort, $rows, $limit, $this->numberPerPage);
     $text .= $list->text;
     $text .= "</div>";
     $this->svnx_stroke($text);
 }
Пример #5
0
 function monitorx_list()
 {
     print_r($this->options);
     if ($this->options["site_type"] == "client") {
         //CLIENT, do you want me to be a serveer?
     } else {
         require_once MONITORX_DIR . 'includes/suitex_list.php';
         $text .= "<div class=\"wrap\">";
         $text .= "<h2>MonitorX</h2>";
         $headers["site"] = "Site";
         $headers["status"] = "Status";
         $headers["version"] = "Wordpress Version";
         $headers["plugin"] = "Plugin Status";
         $headers["url"] = "Link";
         $order = "monitorx_site_name";
         $sort = "asc";
         $query = "select ";
         $query .= "bx_item_name as item, ";
         $query .= "bx_item_author as author, ";
         $query .= "bx_item_isbn as isbn, ";
         $query .= "bx_item_sidebar as sidebar, ";
         $query .= "bx_item_id as id ";
         $query .= "from " . $this->wpdb->prefix . "bx_item ";
         $query .= "order by {$order} {$sort} limit {$limit}, " . $this->numberPerPage;
         $result = $this->wpdb->get_results($query);
         foreach ($result as $row) {
             $sidebar = $this->filter[$row->sidebar];
             if ($row->item) {
                 $itemName = $row->item;
             } else {
                 $itemName = "Import Failed";
             }
             $rows[$row->id] = array($itemName, $row->author, $row->isbn, $sidebar);
         }
         $url = $this->baseURL . "&sub=form&id=";
         $list = new suitex_list();
         $list->search = false;
         $list->orderForm = false;
         $list->filters = false;
         $list->omit = array("cb");
         $this->paging = true;
         $this->pluginPath = BOOKX_URL;
         $list->startList($headers, $url, $order, $sort, $rows, $limit, $this->numberPerPage);
         $text .= $list->text;
         $text .= "</div>";
     }
     $this->monitorx_stroke($text);
 }