rendered paste body<?php
// $Id: alexa.module,v 1.0 2006/07/07 on #drupal : xxx_xxx_ , brainless, advice from #drupal-support: merlinofchaos,heine Exp $
/**
* @file
* Grab the latest info from Alexa
*/
/********************************************************************
* Drupal Hooks
********************************************************************/
/**
* Implementation of hook_help().
*/
function alexa_help($section) {
switch ($section) {
case 'admin/modules#description':
return t('Grab the latest alexa data from www.alexa.com');
}
}
function alexa_perm() {
return array ('access alexa');
}
function alexa_link($type, $node = 0, $main = 0) {
global $user;
$links = array();
if ($type == 'page' && user_access('use alexa')) {
$links[] = l(t('alexa'), 'alexa');
}
return $links;
}
function alexa_menu($may_cache) {
if ($may_cache) {
$items[] = array(
'path' => 'alexa',
'title' => t('Alexa'),
'callback' => 'alexa_page', 'alexa_page2',
'access' => user_access('access alexa'),
);
}
return $items;
}
/**
* trying to add a button so that it can be selected 'reach' 'page view' or 'rank'.
*/
function alexa_page2() {
$form['button6'] = array(
'#type' => 'textfield',
'#title' => t('replace domains, and press submit'),
'#default_value' => 'test',
);
$form['button7'] = array(
'#type' => 'textfield',
'#default_value' => 'test',
);
$form['button8'] = array(
'#type' => 'textfield',
'#default_value' => 'this is a test, module not done' ,
);
$form['button9'] = array(
'#type' => 'textfield',
'#default_value' => 'www.slashdot.org' ,
);
$form['button10'] = array(
'#type' => 'textfield',
'#default_value' => 'www.digg.com' ,
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Get Alexa Charts')
);
return drupal_get_form('alexa_page2',$form);
}
/**
* end of this test
*/
/**
* this actually works. users can enter a text field here and the graph will actually be displayed.
*/
function alexa_page() {
$form['button1'] = array(
'#type' => 'textfield',
'#title' => t('replace domains, and press submit'),
'#default_value' => 'test',
);
$form['button2'] = array(
'#type' => 'textfield',
'#default_value' => 'test',
);
$form['button3'] = array(
'#type' => 'textfield',
'#default_value' => 'this is a test, module not done' ,
);
$form['button4'] = array(
'#type' => 'textfield',
'#default_value' => 'www.slashdot.org' ,
);
$form['button5'] = array(
'#type' => 'textfield',
'#default_value' => 'www.digg.com' ,
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Get Alexa Charts')
);
return drupal_get_form('alexa_page',$form);
}