Hello!

Today is the last day I go to my phpmyadmin to look sceduler table when my ~ 100 scheduled nodes will publish. :) I wrote some code to view them alltogether in slicky html table, with dates to publish/unpublish and so on. Screenshot. Well, I think, it would be great to embed this table to the Shedule admin interface (admin/settings/scheduler), may be, display link to this table as tab.

At the moment, I simply create a block, select the "PHP" format filter, an copy-paste the following code to block, and tune it to display only in the admin area. I am not patching the module.

and here is the code:

<?php
$output = '';

$sql = "SELECT s.nid AS nid, n.title AS title, s.publish_on AS publish_on, s.unpublish_on AS unpublish_on, s.timezone AS timezone FROM  {scheduler} AS s, {node} AS n WHERE s.nid = n.nid";
//ORDER BY s.publish_on ASC ";

//prepare the table header
$header = array(
  array('data' => 'nid', 'field' => 'nid'),
  array('data' => t('Title'), 'field' => 'title'),
  array('data' => t('Publish on'), 'field' => 'publish_on', 'sort' => 'asc'),
  array('data' => t('Unpublish on'), 'field' => 'unpublish_on'),
  array('data' => t('Timezone'), 'field' => 'timezone'),
);

//execute table query
$sql .= tablesort_sql($header);
$res = pager_query($sql, 50, 0, NULL, $keys);

//get the total keywords count
global $pager_total_items;
$output .= t('<strong>Total scheduled nodes count: %c</strong><br />', array('%c'=>$pager_total_items[0]));

//prepare the table rows
$rows = array();
$destination = drupal_get_destination();
while ($row = db_fetch_object($res)) {
  $row = array(
    check_plain($row->nid),
    $row->title,
    $row->publish_on ? format_date($row->publish_on) : t('No'),
    $row->unpublish_on ? format_date($row->unpublish_on) : t('No'),
    $row->timezone,
  );
  $rows[] = $row;
}

if (empty($rows)) {
  $empty_message = $keys ? t('No published nodes found.') : t('No published nodes available.') ;
  $rows[] = array(array('data' => $empty_message, 'colspan' => (2)));
}

$output .= theme('table', $header, $rows);
$output .= theme('pager', NULL, 50, 0);

echo $output;
?>

Have a nice day! ;)

CommentFileSizeAuthor
scheduler_table.jpg118.45 KBandyceo

Comments

jonathan1055’s picture

I have done something very much like this. I had a patch already to issue, see #344138: Displaying list of scheduled nodes (contrib), but was waiting on an update to views module, which I think may have been committed now. I've been busy with other things but will get back to this and add it here for you to review.

Jonathan

andyceo’s picture

Jonathan, thanks for reply!

I don't understand, why views? What the reason to wait for Views release? IMHO, it better to add functionality directly to Scheduler, independent for any other module. Anyway, thanks, it would be great to exchange for experience.

jonathan1055’s picture

Hi Andy,
The background to this is that we want both! The current dev version contains additions which give a new tab under 'admin/content/node' which lists the information very much like your code. Eric was also thinking about utilising views to allow more customisation, and at that time I was also working on this. Because of the dependency on views, my addition will be a sub-module which the admin can activate if they want to (and if they have views). Otherwise the built-in version will be shown.

The reason my sub-module is not posted for submission into dev is that I created a new date formatter for times in the future, which is very useful for Scheduler. The views issue is #441520: New date handler format for future dates which has now been committed to views dev but I've not checked whether it is in the latest official release. When it is I will get back to my sub-module, make sure it is all up-to-date and submit a patch.

For now, if you download the dev version you will get the basic scheduled node list.

Jonathan

eric-alexander schaefer’s picture

Status: Active » Closed (duplicate)

This is a dupe of #344138: Displaying list of scheduled nodes (contrib).

Release 6.x-1.4: http://drupal.org/node/516514

Jonathan, please create a new issue when you got your views stuff rolling (if it is still relevant).