Example #1
0
 private function buildTableRowHTML($term, $level)
 {
     global $connections;
     $form = new cnFormObjects();
     $category = new cnCategory($term);
     $pad = str_repeat('— ', max(0, $level));
     $this->rowClass = 'alternate' == $this->rowClass ? '' : 'alternate';
     /*
      * Genreate the edit & delete tokens.
      */
     $editToken = $form->tokenURL('admin.php?page=connections_categories&action=edit&id=' . $category->getId(), 'category_edit_' . $category->getId());
     $deleteToken = $form->tokenURL('admin.php?page=connections_categories&action=delete&id=' . $category->getId(), 'category_delete_' . $category->getId());
     $out = '<tr id="cat-' . $category->getId() . '" class="' . $this->rowClass . '">';
     $out .= '<th class="check-column">';
     $out .= '<input type="checkbox" name="category[]" value="' . $category->getId() . '"/>';
     $out .= '</th>';
     $out .= '<td class="name column-name"><a class="row-title" href="' . $editToken . '">' . $pad . $category->getName() . '</a><br />';
     $out .= '<div class="row-actions">';
     $out .= '<span class="edit"><a href="' . $editToken . '">Edit</a> | </span>';
     $out .= '<span class="delete"><a onclick="return confirm(\'You are about to delete this category. \\\'Cancel\\\' to stop, \\\'OK\\\' to delete\');" href="' . $deleteToken . '">Delete</a></span>';
     $out .= '</div>';
     $out .= '</td>';
     $out .= '<td class="description column-description">' . $category->getDescription() . '</td>';
     $out .= '<td class="slug column-slug">' . $category->getSlug() . '</td>';
     $out .= '<td>';
     /*
      * Genreate the category link token URL.
      */
     $categoryFilterURL = $form->tokenURL('admin.php?page=connections&action=filter&category_id=' . $category->getId(), 'filter');
     if ((int) $category->getCount() > 0) {
         $out .= '<strong>Count:</strong> ' . '<a href="' . $categoryFilterURL . '">' . $category->getCount() . '</a><br />';
     } else {
         $out .= '<strong>Count:</strong> ' . $category->getCount() . '<br />';
     }
     $out .= '<strong>ID:</strong> ' . $category->getId();
     $out .= '</td>';
     $out .= '</tr>';
     return $out;
 }