Commit e0dc66a6 authored by Mindiell's avatar Mindiell

First commit

parents
; $Id$
name = "Modifie le champ date pour la revue de presse"
description = Modifie le champ date pour la revue de presse
core = 6.x
package = "La Quadrature"
<?php
function lqdn_rp_form_revue_de_presse_node_form_alter(&$form, &$form_state, $form_id) {
$node = $form['#node'];
$form['author']['date'] = array(
'#type' => 'textfield',
'#title' => t('Authored on') . ' (' . t('date') . ')',
'#maxlength' => 25,
'#description' => t('Format: %time. Leave blank to use the time of form submission.', array('%time' => format_date($node->created, 'custom', 'Y-m-d'))),
);
$form['author']['date_time'] = array(
'#type' => 'textfield',
'#title' => t('Authored on') . ' (' . t('time') . ')',
'#maxlength' => 25,
'#description' => t('Format: %time. Leave blank to use the time of form submission.', array('%time' => format_date($node->created, 'custom', 'H:i:s O'))),
);
if (isset($node->date)) {
$form['author']['date']['#default_value'] = format_date($node->created, 'custom', 'Y-m-d');
$form['author']['date_time']['#default_value'] = format_date($node->created, 'custom', 'H:i:s O');
}
$form['#submit'][] = 'lqdn_rp_date_submit';
}
function lqdn_rp_date_submit($form, &$form_state) {
$form_state['values']['date'] .= ' ' . $form_state['values']['date_time'];
unset($form_state['values']['date_time']);
}
function lqdn_rp_db_rewrite_sql($query, $primary_table, $primary_field, $args) {
if ($primary_table == 'n' && $primary_field == 'nid' &&
substr($_GET['q'], 0, 14) == 'taxonomy/term/') {
$rp= trim($_GET['rp']);
switch ($rp)
{
case 'only':
$return['where'] = "n.type = 'revue_de_presse'";
return $return;
break;
case 'yes':
break;
default:
$return['where'] = "n.type <> 'revue_de_presse'";
return $return;
}
}
}
function lqdn_rp_block ($op = 'list', $delta = 0, $edit = array()) {
if ($op == 'list') {
$blocks[0]['info'] = t('Press Review of a tag');
$blocks[0]['region'] = 'region-right';
$blocks[0]['visibility'] = 1;
$blocks[0]['pages'] = 'taxonomy/term/*';
//t: Revue de presse d'une étiquette
return $blocks;
}
elseif ($op == 'view' && $delta == 0 && substr($_GET['q'], 0, 14) == 'taxonomy/term/') {
$tid = intval(substr($_GET['q'], 14));
if ($tid > 0) {
$dossier = new stdClass;
$dossier->name = '';
$dossier->tags = $tid;
$content = lqdn_latest_nodes_list('rp', $dossier, '', 50);
if (!empty($content)) {
$block = array();
$block['subject'] = t('Press review'); //t: Revue de presse
$block['content'] = $content;
return $block;
}
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment