'; global $user; if ($user->uid) { $output .= l('Профиль','user/'.$user->uid, array('attributes' => array('class' => 'profile'))); $output .= l('Выход','logout', array('attributes' => array('class' => 'logout'))); } else { $output .= l('Вход','user', array('attributes' => array('class' => 'login'))); $output .= l('Регистрация','user/register', array('attributes' => array('class' => 'register'))); $block = module_invoke('user', 'block', 'view', 0); $output .= '
'. $block['content'] .'
'; } $output .= ''; return $output; } //function tells drupal that the developer is going to change the form of user login block function IMvmoskve_theme(){ return array( 'user_login_block' => array( 'arguments' => array('form' => NULL), ), 'comment_form' => array( 'arguments' => array('form' => NULL), ), ); } //function, changing the form of user login block function IMvmoskve_user_login_block($form) { $form['name']['#title'] = 'Логин'; $form['name']['#required'] = false; $form['pass']['#required'] = false; $form['submit']['#value'] = 'Войти'; return drupal_render($form); } //function, changing the form of comment form function IMvmoskve_comment_form($form) { unset($form['homepage']); unset ($form['mail']); return drupal_render($form); } //function, pretreatment of the page function phptemplate_preprocess_page(&$vars) { if ($vars['is_front']) { $vars['template_file'] = 'page-unfront'; } } function IMvmoskve_username($object) { if ($object->uid && $object->name) { // Shorten the name when it is too long or it will break many tables. if (drupal_strlen($object->name) > 20) { $name = drupal_substr($object->name, 0, 15) .'...'; } else { $name = $object->name; } if (user_access('access user profiles')) { $output = l($name, 'user/'. $object->uid, array('attributes' => array('title' => t('View user profile.')))); } else { $output = check_plain($name); } } else if ($object->name) { // Sometimes modules display content composed by people who are // not registered members of the site (e.g. mailing list or news // aggregator modules). This clause enables modules to display // the true author of the content. if (!empty($object->homepage)) { $output = l($object->name, $object->homepage, array('attributes' => array('rel' => 'nofollow'))); } else { $output = check_plain($object->name); } } else { $output = check_plain(variable_get('anonymous', t('Anonymous'))); } return $output; } //function, pretreatment of the poll vote function IMvmoskve_preprocess_poll_vote(&$variables) { $variables['links'] = l('Все опросы', 'poll', array('attributes' => array('title' => 'Посмотреть список голосований на этом сайте.', 'class' => 'links-poll'))); } // Function, which changes the pager function IMvmoskve_pager($tags = array(), $limit = 15, $element = 0, $parameters = array(), $quantity = 14) { global $pager_page_array, $pager_total; $pager_middle = ceil($quantity / 2); $pager_current = $pager_page_array[$element] + 1; $pager_first = $pager_current - $pager_middle + 1; $pager_last = $pager_current + $quantity - $pager_middle; $pager_max = $pager_total[$element]; $i = $pager_first; if ($pager_last > $pager_max) { $i = $i + ($pager_max - $pager_last); $pager_last = $pager_max; } if ($i <= 0) { $pager_last = $pager_last + (1 - $i); $i = 1; } $li_previous = theme('pager_previous', (isset($tags[1]) ? $tags[1] : t('<')), $limit, $element, 1, $parameters); $li_next = theme('pager_next', (isset($tags[3]) ? $tags[3] : t('>')), $limit, $element, 1, $parameters); $li_first = theme('pager_first', 1, $limit, $element, $parameters); $li_last = theme('pager_last', $pager_max, $limit, $element, $parameters); $show_first = ( $i > 1 ) ? true : false ; if ($pager_total[$element] > 1) { if ( $li_previous ) $items[] = array( 'class' => 'pager-previous', 'data' => $li_previous ); if ( $show_first && $li_first ) $items[] = array( 'class' => 'pager-first', 'data' => $li_first ); if ($i != $pager_max) { if ($i > 2) $items[] = array( 'class' => 'pager-ellipsis', 'data' => '...' ); for (; $i <= $pager_last && $i <= $pager_max; $i++) { if ($i < $pager_current ) $items[] = array( 'class' => 'pager-item', 'data' => theme('pager_previous', $i, $limit, $element, ($pager_current - $i), $parameters) ); if ($i == $pager_current) $items[] = array( 'class' => 'pager-current', 'data' => '' . $i . '' ); if ($i > $pager_current) $items[] = array( 'class' => 'pager-item', 'data' => theme('pager_next', $i, $limit, $element, ($i - $pager_current), $parameters) ); } if ($i < $pager_max) $items[] = array( 'class' => 'pager-ellipsis', 'data' => '...' ); } $show_last = ( $pager_max> ($i-1) ) ? true : false ; if ( $show_last && $li_last) $items[] = array( 'class' => 'pager-last', 'data' => $li_last ); if ( $li_next) $items[] = array( 'class' => 'pager-next', 'data' => $li_next ); return theme('item_list', $items, NULL, 'ul', array('class' => 'pager')); } } function get_menu() { $output = ''; return $output; } //function, pretreatment of the node function IMvmoskve_preprocess_node(&$vars, $hook) { $node = $vars['node']; $vars['node_region'] = theme('blocks', 'node_region'); } function IMvmoskve_date_nav_title($granularity, $view, $link = FALSE, $format = NULL) { $format = ($granularity == 'week') ? 'с d.m.Y' : NULL; switch ($granularity) { case 'year': $title = $view->date_info->year; $date_arg = $view->date_info->year; break; case 'month': $format = !empty($format) ? $format : (empty($view->date_info->mini) ? 'F Y' : 'F'); $title = date_format_date($view->date_info->min_date, 'custom', $format); $date_arg = $view->date_info->year .'-'. date_pad($view->date_info->month); break; case 'day': $format = !empty($format) ? $format : (empty($view->date_info->mini) ? 'l, F j Y' : 'l, F j'); $title = date_format_date($view->date_info->min_date, 'custom', $format); $date_arg = $view->date_info->year .'-'. date_pad($view->date_info->month) .'-'. date_pad($view->date_info->day); break; case 'week': $format = !empty($format) ? $format : (empty($view->date_info->mini) ? 'F j Y' : 'F j'); $next_week = strtotime(date_format($view->date_info->max_date, 'd.m.Y H:i')) - 1; $title = date_format_date($view->date_info->min_date, 'custom', $format) .' - по '. date('d.m.Y', $next_week); $date_arg = $view->date_info->year .'-W'. date_pad($view->date_info->week); break; } if (!empty($view->date_info->mini) || $link) { // Month navigation titles are used as links in the mini view. $attributes = array('title' => t('View full page month')); $url = date_real_url($view, $granularity, $date_arg, TRUE); return l($title, $url, array('attributes' => $attributes)); } else { return $title; } }