tid); if ($channel['editions_enable']) { $select['channel/' . $term->tid] = t($term->name); } else { $select[taxonomy_term_path($term)] = t($term->name); } } if (!array_key_exists($frontpage, $select)) { $select[$frontpage] = t('Unknown value. Don\'t change my front page.'); } $form['site_frontpage'] = array( '#title' => t('Which channel do you want your front page to display?'), '#type' => 'radios', '#options' => $select, '#default_value' => $frontpage, ); return system_settings_form($form); } /************************************************************ * DASHBOARD * ************************************************************/ function _pp_dashboard() { // Borrow the admin styles from system.module drupal_add_css(drupal_get_path('module', 'system') .'/admin.css', 'module'); $blocks = array(); // Stories dashpane $blocks['stories'] = _pp_dashboard_pane_stories(); $blocks['editions'] = _pp_dashboard_pane_editions(); $blocks['channels'] = _pp_dashboard_pane_channels(); $blocks['quick-links'] = _pp_dashboard_pane_quick_links(); $blocks['docs'] = _pp_dashboard_pane_docs(); // Some manual positioning $positions = array( 'left' => array('stories', 'docs'), 'right' => array('editions', 'channels', 'quick-links'), ); foreach ($positions as $position => $list) { foreach ($list as $block) { if ($blocks[$block]['content']) { $blocks[$block]['position'] = $position; } } } return theme('admin_page', $blocks); } function _pp_dashboard_pane_stories() { if (module_exists('workflow')) { $wid = variable_get('pp_publishing_wid', FALSE); if ($wid) { $states = workflow_get_states($wid); $story_manager_path = 'admin/content/stories'; $header = array( array('data' => t('Workflow'), 'class' => 'label'), array('data' => t('Number'), 'class' => 'value'), ); $rows = array(); foreach ($states as $value => $label) { $result = db_query("SELECT COUNT(*) FROM {node} node LEFT JOIN {workflow_node} workflow_node ON node.nid = workflow_node.nid WHERE node.type = 'story' AND workflow_node.sid = %d", $value); $result = db_result($result); $link = l($result, $story_manager_path, array('query' => 'sid[]=' . $value)); $rows[] = array( array('data' => $label, 'class' => 'label'), array('data' => $link, 'class' => 'value'), ); } // Total stories $result = db_query("SELECT COUNT(*) FROM {node} node WHERE node.type = 'story'"); $result = db_result($result); $link = l($result, $story_manager_path); $rows[] = array(t('Total stories'), $link); $output = theme('table', $header, $rows, array('class' => 'story-count-table')); if (user_access('access administration pages')) { $output .= l(t('Story Manager'), $story_manager_path); } } else { $output = t('Sorry, unable to locate publishing workflow.'); } } else { $output = t('Sorry, you must have the Workflow module enabled for this pane.'); } return array( 'title' => t('Stories'), 'description' => t('A snapshot of the stories on this site.'), 'content' => $output, ); } function _pp_dashboard_pane_editions() { if (user_access('access administration pages')) { $output = l(t('Editions Manager'), 'admin/content/editions'); return array( 'title' => t('Editions'), 'content' => $output, ); } } function _pp_dashboard_pane_channels() { if (user_access('access administration pages')) { $output = l(t('Channels'), 'admin/content/channels'); return array( 'title' => t('Channels'), 'content' => $output, ); } } function _pp_dashboard_pane_quick_links() { // node create links $links = array(); foreach (node_get_types('types', NULL, TRUE) as $type) { if (node_access('create', $type->type)) { $type_url_str = str_replace('_', '-', $type->type); $links['node_add_' . $type->type] = array( 'title' => t('Create a @name', array('@name' => t($type->name))), 'href' => 'node/add/'. $type_url_str, ); } } $output = theme('links', $links, array()); // Create user link if (user_access('administer users')) { $links = array( 'add_user' => array( 'title' => t('Add new user'), 'href' => 'admin/user/user/create', ), ); $output .= theme('links', $links, array()); } return array( 'title' => t('Quick Links'), 'description' => t('Some useful shortcut links.'), 'content' => $output, ); } function _pp_dashboard_pane_docs() { $links = array(); $links['user_guide'] = array( 'title' => t('ProsePoint User Guide'), 'href' => 'http://www.prosepoint.org/docs', ); $links['website'] = array( 'title' => t('ProsePoint Website'), 'href' => 'http://www.prosepoint.org', ); $output .= theme('links', $links, array()); return array( 'title' => t('Documentation'), 'content' => $output, ); }