t('Arteleku'), 'help' => t('Cambia la saturación, el contraste y la opacidad.'), 'dimensions passthrough' => TRUE, 'effect callback' => 'arteleku_special_effect' ); return $effects; } function arteleku_special_effect($image, $data = array()){ return image_toolkit_invoke('arteleku', $image, array($data)); } function image_gd_arteleku($image, $data = array()){ // imagefilter($image->resource, IMG_FILTER_CONTRAST, 30); //imagefilter($image->resource, IMG_FILTER_BRIGHTNESS, 75); imagefilter($image->resource, IMG_FILTER_GRAYSCALE); return TRUE; } function arteleku_views_slideshow_widget_pager_info($view) { return array( 'arteleku_simple_pager' => array( 'name' => t('Simple counter'), ), ); } /** * Implements hook_theme(). */ function arteleku_theme($existing, $type, $theme, $path) { return array( 'arteleku_simple_pager' => array( 'variables' => array('vss_id' => NULL, 'view' => NULL, 'settings' => array(), 'location' => NULL, 'attributes' => array()), 'template' => 'theme/views-slideshow-pager-fields', 'path' => drupal_get_path('module', 'views_slideshow'), ), ); } /** * Template preprocess function for Views Slideshow simple pager. */ function template_preprocess_arteleku_simple_pager(&$vars) { // Call the fields pager preprocess function. _views_slideshow_preprocess_views_slideshow_pager_fields($vars); // Override the (empty) rendered field items with our simple pager. $vars['rendered_field_items'] = ''; foreach ($vars['view']->result as $count => $node) { $vars['rendered_field_items'] .= theme('views_slideshow_pager_field_item', array('vss_id' => $vars['vss_id'], 'item' => " ", 'count' => $count, 'location' => $vars['location'])); } // Clone the pager fields JavaScript object and methods. drupal_add_js('Drupal.artelekuSimplePager = Drupal.viewsSlideshowPagerFields || {};', 'inline'); drupal_add_css(drupal_get_path('module', 'arteleku') . '/css/slideshow_pager.css'); // var_dump($vars); } /** * Implements hook_block_info(). */ function arteleku_block_info() { $blocks = array(); $blocks['historico'] = array( 'info' => t('Histórico de años'), 'cache' => DRUPAL_CACHE_GLOBAL, ); $blocks['alfabeto'] = array( 'info' => t('Alfabeto'), 'cache' => DRUPAL_CACHE_GLOBAL, ); return $blocks; } /** * Implements hook_block_configure(). */ function arteleku_block_configure($delta='') { $form = array(); switch($delta) { case 'historico' : // Text field form element $form['inicio'] = array( '#type' => 'textfield', '#title' => t('Fecha de inicio del listado histórico'), '#size' => 60, '#maxlength' => 128, '#default_value' => variable_get('arteleku_historico_inicio', '2000'), ); $form['vista'] = array( '#type' => 'textfield', '#title' => t('path de la vista'), '#size' => 60, '#maxlength' => 128, '#default_value' => variable_get('arteleku_historico_vista', 'historico'), ); break; } return $form; } /** * Implements hook_block_save(). */ function arteleku_block_save($delta = '', $edit = array()) { switch($delta) { case 'historico' : variable_set('arteleku_historico_inicio', $edit['inicio']); variable_set('arteleku_historico_vista', $edit['vista']); break; } } /** * Implements hook_block_view(). */ function arteleku_block_view($delta='') { $block = array(); switch($delta) { case 'historico' : $block['content'] = _arteleku_historico_view(); break; case 'alfabeto': $block['content'] = _arteleku_alfabeto_view(); break; } return $block; } /** * Implements hook_field_formatter_info(). */ function arteleku_field_formatter_info() { return array( 'arteleku_mime' => array( 'label' => t('Tipo de archivo'), 'field types' => array('file') ), 'arteleku_registration' => array( 'label' => t('Registration Arteleku Type'), 'field types' => array('registration') ), 'arteleku_file_tarjeta' => array( 'label' => t('Tarjeta'), 'field types' => array('file') ), 'arteleku_document' => array( 'label' => t('Link to Document'), 'field types' => array('file') ) ); } function arteleku_file_formatter_info(){ $formatters['arteleku_hover_image'] = array( 'label' => t('Hover'), 'file types' => array('video', 'image'), 'default settings' => array( 'image_style_back' => '', 'image_style_front' => '' ), 'view callback' => 'arteleku_hover_image_formatter_image_view', 'settings callback' => 'arteleku_hover_image_formatter_image_settings', ); return $formatters; } function arteleku_hover_image_formatter_image_view($file, $display, $langcode){ $scheme = file_uri_scheme($file->uri); $tipo = $file->type; $current_node = arg(1); $image_style = $display['settings']['image_style_back']; $image_style_front = $display['settings']['image_style_front']; $link_to_node = $display['settings']['link_to_reference']; $valid_image_styles = image_style_options(FALSE); $referencing_node = $file->referencing_entity->nid; $nodeurl = ''; if ($referencing_node != $current_node){ $nodeurl = url('node/'. $referencing_node); //Load the entity $entity = entity_load('node', array($referencing_node)); //Get the entity type if($entity){ $ent = $entity[$referencing_node]; $e_type = $ent->type; $langcode_s = entity_language('node', $ent); if ($e_type == "enlace"){ //Aquí es donde tenemos que cambiar el enlace del nodo!!! if (isset($ent->field_enlace[$langcode][0])){ $nodeurl = url($ent->field_enlace[$langcode][0]['url']); }elseif (isset($ent->field_enlace[$langcode_s][0])) { $nodeurl = url($ent->field_enlace[$langcode_s][0]['url']); } } } } $fondo=""; $frente=""; if($type = 'image'){ $alt = ""; if( isset($file->field_file_image_alt_text['und'][0]['value']) ){ $alt = $file->field_file_image_alt_text['und'][0]['value']; } $fondo = theme('image_style', array('path' => $file->uri, 'style_name' => $image_style, 'alt' => $alt)); $frente = theme('image_style', array('path' => $file->uri, 'style_name' => $image_style_front, 'title' => $alt)); }else{ if ($scheme == 'vimeo') { $wrapper = file_stream_wrapper_get_instance_by_uri($file->uri); $fondo = theme('image_style', array('path' => $wrapper->getLocalThumbnailPath(), 'style_name' => $image_style, 'title' => $file->alt)); $frente = theme('image_style', array('path' => $wrapper->getLocalThumbnailPath(), 'style_name' => $image_style_front, 'title' => $file->alt)); } } $marcado = ""; if($fondo != '' && $frente != ""){ $marcado = "
$fondo
"; if($nodeurl != ''){ $marcado .= "$frente
"; }else{ $marcado .= "$frente"; } } $element[] = array( '#markup' => $marcado ); return $element; } function arteleku_hover_image_formatter_image_settings($form, &$form_state, $settings){ $element = array(); $element['image_style_back'] = array( '#title' => t('Image style Back'), '#type' => 'select', '#options' => image_style_options(FALSE), '#default_value' => $settings['image_style_back'], '#empty_option' => t('None (original image)'), ); $element['image_style_front'] = array( '#title' => t('Image style Front'), '#type' => 'select', '#options' => image_style_options(FALSE), '#default_value' => $settings['image_style_front'], '#empty_option' => t('None (original image)'), ); return $element; } /** * Implements hook_field_formatter_view(). */ function arteleku_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) { $element = array(); // Initialize the var switch ($display['type']) { case 'arteleku_mime': foreach ($items as $item) { $mime = ucwords($item['type']); $element[] = array( '#markup' => "
$mime
" ); } break; case 'arteleku_file_tarjeta': foreach ($items as $item) { $mime = file_get_mimetype($item['uri']); $mime = explode('/',$mime); $mime = ucwords(array_pop($mime)); $title = field_get_items($entity_type, $entity,'title_field'); $uri = file_create_url($item['uri']); $link = l($title[0]['value'], $uri); if ($mime == "Vimeo"){ $uri = entity_uri($entity_type, $entity); $link = l($title[0]['value'], $uri['path']); } $element[] = array( '#markup' => "

$link

$mime
" ); } break; case 'arteleku_registration'; list($entity_id) = entity_extract_ids($entity_type, $entity); $settings = registration_entity_settings($entity_type, $entity_id); //dpm($settings); /*Fechas: OPEN: $settings[open]; CLOSE: $settings[close]; */ // Enable registration link if accessible. $mostrar = FALSE; $espacio = registration_has_room($entity_type, $entity_id); $estado = $settings['status']; $texto = ""; $registro = FALSE; if (!$estado){ break; } if($settings['close'] && $settings['open']){ $format = "Y-m-d H:i:s"; $open = DateTime::createFromFormat($format, $settings['open']); $close = DateTime::createFromFormat($format, $settings['close']); $now = new DateTime(); if(($open <= $now) && ($now<=$close) && $espacio){ $mostrar = TRUE; $formato = variable_get('date_format_corto_sin_hora', 'm/d/Y'); $desde = $open->format($formato); $hasta = $close->format($formato); //$texto = '

' . t('Abierta hasta el') . ' ' . $hasta . '

'; $texto = '

' . t("Open until !fecha", array('!fecha' => '' . $hasta . '')) .'

'; $registro = TRUE; }elseif (($open <= $now) && ($now<=$close) && !$espacio){ $texto = '

' . t('Full event') . '

'; $registro = FALSE; }else{ $texto = '

' . t('Closed') . '

'; $registro = FALSE; } } if (registration_register_page_access($entity_type, $entity) && $registro) { $uri = entity_uri($entity_type, $entity); $element[0] = array( '#markup' => $texto . theme('registration_link', array( 'label' => t('Register'), 'path' => $uri['path'] . '/register', ) ) ); }elseif($registro && !user_is_logged_in()){ $texto .= '

' . t('You need to be logged in for register.') . '

'; $current = current_path(); $element[0] = array('#markup' => $texto . l(t('Register'), "user", array( 'query'=>array('current'=>$current), 'html' => TRUE, 'attributes' => array('class'=>'register-link')))); }elseif (!$registro){ $element[0] = array('#markup' => $texto); }else{ $texto = '

' . t('You are already registered.') . '

'; $element[0] = array('#markup' => $texto); } break; case 'arteleku_document': //var_dump($items); foreach ($items as $item) { $uri = file_create_url($item['uri']); $texto = t('Download'); $element[] = array( '#markup' => "$texto" ); } break; default: # code... break; } return $element; } function arteleku_form_alter(&$form, &$form_state, $form_id) { if ($form_id == "registration_entity_settings_form"){ $form['scheduling']['open']['#type'] = 'date_popup'; $form['scheduling']['open']['#date_format'] = 'Y-m-d'; $form['scheduling']['close']['#type'] = 'date_popup'; $form['scheduling']['close']['#date_format'] = 'Y-m-d'; $form['reminder']['reminder_settings']['reminder_date']['#type'] = 'date_popup'; $form['reminder']['reminder_settings']['reminder_date']['#date_format'] = 'Y-m-d'; }elseif ($form_id =="galleria_form_optionset_edit") { $estilos = file_entity_view_mode_labels(); $form['image_styles']['thumb']['#options'] = $estilos; $form['image_styles']['normal']['#options'] = $estilos; $form['image_styles']['big']['#options'] = $estilos; } } /** * Custom function to assemble renderable array for block content. * Returns a renderable array with the block content. * @return * returns a renderable array of block content. */ function _arteleku_historico_view() { $block = ''; return $block; } function _arteleku_alfabeto_view() { $block = '
'; return $block; }