Skip to content

Commit

Permalink
expiretime save
Browse files Browse the repository at this point in the history
  • Loading branch information
juhasz committed Apr 12, 2012
1 parent c80341f commit afb0be1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion shrtr.install
Expand Up @@ -32,7 +32,7 @@ function shrtr_schema() {
'default' => 0,
),
'expire' => array(
'description' => 'Exipre time',
'description' => 'Expire time',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
Expand Down
8 changes: 5 additions & 3 deletions shrtr.module
Expand Up @@ -40,8 +40,8 @@ function shrtr_new_form($form = array(), &$form_state) {
'#title' => t('Expire'),
'#options' => array(
0 => t('Never'),
1 => '10' . t('min'),
2 => '20' . t('min'),
600 => '10' . t('min'),
1200 => '20' . t('min'),
),
'#default_value' => 0,
'#description' => t('Time to expire'),
Expand All @@ -65,6 +65,7 @@ function shrtr_new_form_submit($form, &$form_state) {
'url' => $form_state['values']['url'],
'uid' => $user->uid,
'created' => REQUEST_TIME,
'expire' => REQUEST_TIME + $form_state['values']['expire'],
);

drupal_write_record('shrtr_urls', $record);
Expand Down Expand Up @@ -113,7 +114,7 @@ function shrtr_list_page() {
->fields('s')
->execute();

$header = array(t('ID'), t('User'), t('Original URL'), t('New URL'), t('Subbmitted'));
$header = array(t('ID'), t('User'), t('Original URL'), t('New URL'), t('Subbmitted'), t('Expire time'));
$rows = array();

while ($url = $urls->fetchAssoc()) {
Expand All @@ -124,6 +125,7 @@ function shrtr_list_page() {
$row[] = l($url['url'], $url['url']);
$row[] = l($new_url, $new_url);
$row[] = format_date($url['created']);
$row[] = format_date($url['expire']);
$rows[] = $row;
}

Expand Down

0 comments on commit afb0be1

Please sign in to comment.