/[drupal]/contributions/modules/follow/follow.module
ViewVC logotype

Diff of /contributions/modules/follow/follow.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.3, Fri Oct 30 21:09:28 2009 UTC revision 1.4, Fri Oct 30 21:13:50 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: follow.module,v 1.1.2.14 2009/10/06 15:19:26 q0rban Exp $  // $Id: follow.module,v 1.3 2009/10/30 21:09:28 pwolanin Exp $
3    
4  /**  /**
5   * @file   * @file
# Line 36  function follow_init() { Line 36  function follow_init() {
36  function follow_menu() {  function follow_menu() {
37    $items = array();    $items = array();
38    
39    $items['admin/build/follow'] = array(    $items['admin/config/services/follow'] = array(
40      'title' => 'Site follow links',      'title' => 'Site follow links',
41      'description' => 'Add sitewide follow links',      'description' => 'Add sitewide follow links',
42      'page callback' => 'drupal_get_form',      'page callback' => 'drupal_get_form',
# Line 76  function follow_links_user_access($uid) Line 76  function follow_links_user_access($uid)
76  /**  /**
77   * Implementation of hook_perm().   * Implementation of hook_perm().
78   */   */
79  function follow_perm() {  function follow_permission() {
80    return array('edit own follow links', 'edit site follow links', 'edit any user follow links', 'administer follow');    return array(
81        'edit own follow links' => array(
82          'title' => t('Edit own follow links'),
83          'description' => t(''),
84        ),
85        'edit site follow links' => array(
86          'title' => t('Edit the site-wide follow links'),
87          'description' => t(''),
88        ),
89        'edit any user follow links' => array(
90          'title' => t("Edit any user's follow links"),
91          'description' => t(''),
92        ),
93        'administer follow' => array(
94          'title' => t('Administer follow'),
95          'description' => t(''),
96        ),
97      );
98  }  }
99    
100  /**  /**
# Line 87  function follow_theme() { Line 104  function follow_theme() {
104    $items = array();    $items = array();
105    
106    $items['follow_links_form'] = array(    $items['follow_links_form'] = array(
107      'arguments' => array('form' => array()),      'variables' => array('form' => array()),
108    );    );
109    $items['follow_links'] = array(    $items['follow_links'] = array(
110      'arguments' => array('links' => array(), 'networks' => array()),      'variables' => array('links' => array(), 'networks' => array()),
111    );    );
112    $items['follow_link'] = array(    $items['follow_link'] = array(
113      'arguments' => array('link' => NULL, 'title' => NULL),      'variables' => array('link' => NULL, 'title' => NULL),
114    );    );
115    
116    return $items;    return $items;
# Line 248  function _follow_block_content($uid = 0) Line 265  function _follow_block_content($uid = 0)
265   *   *
266   * @ingroup themeable   * @ingroup themeable
267   */   */
268  function theme_follow_links($links, $networks) {  function theme_follow_links($variables) {
269      $links = $variables['links'];
270      $networks = $variables['networks'];
271    $output = '<div class="follow-links clear-block">';    $output = '<div class="follow-links clear-block">';
272    
273    foreach($links as $link) {    foreach($links as $link) {
# Line 332  function _follow_block_config_links($uid Line 351  function _follow_block_config_links($uid
351   *   *
352   * @ingroup forms   * @ingroup forms
353   */   */
354  function follow_links_form(&$form_state, $uid = 0) {   function follow_links_form($form, &$form_state, $uid = 0) {
355    $form = array();    $form = array();
356    
357    $form['uid'] = array('#type' => 'hidden', '#value' => $uid);    $form['uid'] = array('#type' => 'hidden', '#value' => $uid);
# Line 438  function follow_links_form_submit($form, Line 457  function follow_links_form_submit($form,
457   * @ingroup forms   * @ingroup forms
458   */   */
459  function theme_follow_links_form($form) {  function theme_follow_links_form($form) {
460      $form = $form['form'];
461    $rows = array();    $rows = array();
462    $disabled_rows = array();    $disabled_rows = array();
463    
# Line 470  function theme_follow_links_form($form) Line 490  function theme_follow_links_form($form)
490    
491    $output = '';    $output = '';
492    if (count($rows)) {    if (count($rows)) {
493      $output .= theme('table', $header, $rows, array('id' => 'follow-links-weighted-form'));      $output .= theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => 'follow-links-weighted-form')));
494    }    }
495    if (count($disabled_rows)) {    if (count($disabled_rows)) {
496      $output .= theme('table', $disabled_header, $disabled_rows);      $output .= theme('table', array('header' => $disabled_header, 'rows' => $disabled_rows));
497    }    }
498    $output .= drupal_render($form);    $output .= drupal_render($form);
499    
# Line 505  function follow_settings_form() { Line 525  function follow_settings_form() {
525  function follow_links_load($uid = 0) {  function follow_links_load($uid = 0) {
526    $links = array();    $links = array();
527    
528    $sql = "SELECT * FROM {follow_links} WHERE uid = %d ORDER BY weight ASC";    $sql = "SELECT * FROM {follow_links} WHERE uid = :uid ORDER BY weight ASC";
529    $result = db_query($sql, $uid);    $result = db_query($sql, array(':uid' => $uid));
530    
531    while ($link = db_fetch_object($result)) {    foreach ($result as $link) {
532      $links[$link->name] = $link;      $links[$link->name] = $link;
533    }    }
534    

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

  ViewVC Help
Powered by ViewVC 1.1.2