コード例 #1
1
ファイル: template.php プロジェクト: Olsanking/good_boy
/**
 * Preprocessor for page.tpl.php template file.
 */
function goodboymytheme_preprocess_page(&$vars, $hook)
{
    //----------------------------------------------------Goodboy my custom Stage 4 p.5
    if (arg(0) == 'node') {
        if ($vars['node']->type == 'film') {
            $vars['title'] = 'Films Films Films';
        }
    }
    // For easy printing of variables.
    $vars['logo_img'] = '';
    if (!empty($vars['logo'])) {
        $vars['logo_img'] = theme('image', array('path' => $vars['logo'], 'alt' => t('Home'), 'title' => t('Home')));
    }
    $vars['linked_logo_img'] = '';
    if (!empty($vars['logo_img'])) {
        $vars['linked_logo_img'] = l($vars['logo_img'], '<front>', array('attributes' => array('rel' => 'home', 'title' => t('Home')), 'html' => TRUE));
    }
    $vars['linked_site_name'] = '';
    if (!empty($vars['site_name'])) {
        $vars['linked_site_name'] = l($vars['site_name'], '<front>', array('attributes' => array('rel' => 'home', 'title' => t('Home'))));
    }
    // Site navigation links.
    $vars['main_menu_links'] = '';
    if (isset($vars['main_menu'])) {
        $vars['main_menu_links'] = theme('links__system_main_menu', array('links' => $vars['main_menu'], 'attributes' => array('id' => 'main-menu', 'class' => array('inline', 'main-menu')), 'heading' => array('text' => t('Main menu'), 'level' => 'h2', 'class' => array('element-invisible'))));
    }
    $vars['secondary_menu_links'] = '';
    if (isset($vars['secondary_menu'])) {
        $vars['secondary_menu_links'] = theme('links__system_secondary_menu', array('links' => $vars['secondary_menu'], 'attributes' => array('id' => 'secondary-menu', 'class' => array('inline', 'secondary-menu')), 'heading' => array('text' => t('Secondary menu'), 'level' => 'h2', 'class' => array('element-invisible'))));
    }
}
コード例 #2
0
 public function getHtmlContent()
 {
     $result = $this->getHtmlList();
     $result .= '<hr/><p>' . l('[XML]', 'tour/' . $this->getId() . '/xml') . '</p>';
     return $result;
     return theme('chgk_db_champ_full', $this);
 }
コード例 #3
0
/**
 * Implements theme_form_element_label().
 */
function tibco_styles_form_element_label($variables)
{
    $element = $variables['element'];
    // This is also used in the installer, pre-database setup.
    $t = get_t();
    // If title and required marker are both empty, output no label.
    if ((!isset($element['#title']) || $element['#title'] === '') && empty($element['#required'])) {
        return '';
    }
    // If the element is required, a required marker is appended to the label.
    $required = !empty($element['#required']) ? theme('form_required_marker', array('element' => $element)) : '';
    $title = filter_xss_admin($element['#title']);
    $attributes = array();
    // Style the label as class option to display inline with the element.
    if ($element['#title_display'] == 'after') {
        $attributes['class'] = 'option';
    } elseif ($element['#title_display'] == 'invisible') {
        $attributes['class'] = 'element-invisible';
    }
    if (!empty($element['#id'])) {
        $attributes['for'] = $element['#id'];
    }
    $help = '';
    if ($element['#type'] == 'checkbox' && $element['#entity_type'] == 'entityform') {
        $help = $element['#checkbox_suffix'];
    }
    // The leading whitespace helps visually separate fields from inline labels.
    return ' <label' . drupal_attributes($attributes) . '>' . $t('!title !required', array('!title' => $title, '!required' => $required)) . $help . "</label>\n";
}
コード例 #4
0
ファイル: template.php プロジェクト: blipp/drupal
/**
 * Override or insert variables into the page template.
 */
function garland_preprocess_page(&$vars)
{
    $vars['tabs2'] = menu_secondary_local_tasks();
    if (isset($vars['main_menu'])) {
        $vars['primary_nav'] = theme('links', array('links' => $vars['main_menu'], 'attributes' => array('class' => array('links', 'main-menu')), 'heading' => array('text' => t('Main menu'), 'level' => 'h2', 'class' => array('element-invisible'))));
    } else {
        $vars['primary_nav'] = FALSE;
    }
    if (isset($vars['secondary_menu'])) {
        $vars['secondary_nav'] = theme('links', array('links' => $vars['secondary_menu'], 'attributes' => array('class' => array('links', 'secondary-menu')), 'heading' => array('text' => t('Secondary menu'), 'level' => 'h2', 'class' => array('element-invisible'))));
    } else {
        $vars['secondary_nav'] = FALSE;
    }
    // Prepare header
    $site_fields = array();
    if (!empty($vars['site_name'])) {
        $site_fields[] = check_plain($vars['site_name']);
    }
    if (!empty($vars['site_slogan'])) {
        $site_fields[] = check_plain($vars['site_slogan']);
    }
    $vars['site_title'] = implode(' ', $site_fields);
    if (!empty($site_fields)) {
        $site_fields[0] = '<span>' . $site_fields[0] . '</span>';
    }
    $vars['site_html'] = implode(' ', $site_fields);
}
コード例 #5
0
ファイル: graphapi.api.php プロジェクト: alauzon/pf
/**
 * Example function: creates a graph of user logins by day.
 */
function user_last_login_by_day($n = 40)
{
    $query = db_select('users');
    $query->addField('users', 'name');
    $query->addField('users', 'uid');
    $query->addField('users', 'created');
    $query->condition('uid', 0, '>');
    $query->orderBy('created', 'DESC');
    $query->range(0, $n);
    $result = $query->execute();
    $g = graphapi_new_graph();
    $now = time();
    $days = array();
    foreach ($result as $user) {
        $uid = $user->uid;
        $user_id = 'user_' . $uid;
        $day = intval(($now - $user->created) / (24 * 60 * 60));
        $day_id = 'data_' . $day;
        graphapi_set_node_title($g, $user_id, l($user->name, "user/" . $uid));
        graphapi_set_node_title($g, $day_id, "Day " . $day);
        graphapi_set_link_data($g, $user_id, $day_id, array('color' => '#F0F'));
    }
    $options = array('width' => 400, 'height' => 400, 'item-width' => 50, 'engine' => 'graph_phyz');
    return theme('graphapi_dispatch', array('graph' => $g, 'config' => $options));
}
コード例 #6
0
ファイル: theme-settings.php プロジェクト: szczym/tutturu
/**
 * Implementation of hook_settings() for themes.
 */
function singular_settings($settings)
{
    // Add js & css
    drupal_add_css('misc/farbtastic/farbtastic.css', 'module', 'all', FALSE);
    drupal_add_js('misc/farbtastic/farbtastic.js');
    drupal_add_js(drupal_get_path('theme', 'singular') . '/js/settings.js');
    drupal_add_css(drupal_get_path('theme', 'singular') . '/css/settings.css');
    file_check_directory(file_directory_path(), FILE_CREATE_DIRECTORY, 'file_directory_path');
    // Check for a new uploaded logo, and use that instead.
    if ($file = file_save_upload('background_file', array('file_validate_is_image' => array()))) {
        $parts = pathinfo($file->filename);
        $filename = 'singular_background.' . $parts['extension'];
        if (file_copy($file, $filename, FILE_EXISTS_REPLACE)) {
            $settings['background_path'] = $file->filepath;
        }
    }
    $form = array();
    $form['layout'] = array('#title' => t('Layout'), '#type' => 'select', '#options' => array('fixed' => t('Fixed width'), 'fluid' => t('Fluid width')), '#default_value' => !empty($settings['layout']) ? $settings['layout'] : 'fixed');
    $form['messages'] = array('#type' => 'fieldset', '#tree' => FALSE, '#title' => t('Autoclose messages'), '#descriptions' => t('Select the message types to close automatically after a few seconds.'));
    $form['messages']['autoclose'] = array('#type' => 'checkboxes', '#options' => array('status' => t('Status'), 'warning' => t('Warning'), 'error' => t('Error')), '#default_value' => !empty($settings['autoclose']) ? $settings['autoclose'] : array('status'));
    $form['style'] = array('#title' => t('Styles'), '#type' => 'select', '#options' => singular_get_styles(), '#default_value' => !empty($settings['style']) ? $settings['style'] : 'sea');
    $form['custom'] = array('#tree' => FALSE, '#type' => 'fieldset', '#attributes' => array('class' => $form['style']['#default_value'] == 'custom' ? 'singular-custom-settings' : 'singular-custom-settings hidden'));
    $form['custom']['background_file'] = array('#type' => 'file', '#title' => t('Background image'), '#maxlength' => 40);
    if (!empty($settings['background_path'])) {
        $form['custom']['background_preview'] = array('#type' => 'markup', '#value' => !empty($settings['background_path']) ? theme('image', $settings['background_path'], NULL, NULL, array('width' => '100'), FALSE) : '');
    }
    $form['custom']['background_path'] = array('#type' => 'value', '#value' => !empty($settings['background_path']) ? $settings['background_path'] : '');
    $form['custom']['background_color'] = array('#title' => t('Background color'), '#type' => 'textfield', '#size' => '7', '#maxlength' => '7', '#default_value' => !empty($settings['background_color']) ? $settings['background_color'] : '#888888', '#suffix' => '<div id="singular-colorpicker"></div>');
    $form['custom']['background_repeat'] = array('#title' => t('Tile'), '#type' => 'select', '#options' => array('no-repeat' => t('Don\'t tile'), 'repeat-x' => t('Horizontal'), 'repeat-y' => t('Vertical'), 'repeat' => t('Both')), '#default_value' => !empty($settings['background_repeat']) ? $settings['background_repeat'] : 'no-repeat');
    return $form;
}
コード例 #7
0
ファイル: template.php プロジェクト: rlhardrock/drupalxtr
function fever_links__system_main_menu($vars)
{
    $class = implode($vars['attributes']['class'], ' ');
    $html = '<ul class="' . $class . '">';
    foreach ($vars['links'] as $key => $link) {
        if (is_numeric($key)) {
            $sub_menu = '';
            $link_class = '';
            $link_title = '<span>';
            $link_title .= $link['#title'];
            // Check for sub menu - note I've only checked this for 2 levels
            // it might not work for 3 level menus.
            if (!empty($link['#below'])) {
                $link_class = ' class="dropdown"';
                $link['#attributes']['class'][] = 'dropdown-toggle';
                $link['#attributes']['data-toggle'][] = 'dropdown';
                // And recurse.
                $sub_menu = theme('links__system_main_menu', array('links' => $link['#below'], 'attributes' => array('class' => array('dropdown-menu'))));
            }
            $html .= '<li' . $link_class . '>' . l($link_title, $link['#href'], array('html' => 'true', 'attributes' => $link['#attributes'])) . '</span>' . $sub_menu . '</li>';
        }
    }
    $html .= '</ul>';
    return $html;
}
コード例 #8
0
ファイル: settings.php プロジェクト: novasarii/dabr
function settings_page($args)
{
    if ($args[1] == 'save') {
        $settings['browser'] = $_POST['browser'];
        $settings['gwt'] = $_POST['gwt'];
        $settings['colours'] = $_POST['colours'];
        $settings['reverse'] = $_POST['reverse'];
        setcookie_year('settings', base64_encode(serialize($settings)));
        twitter_refresh('');
    }
    $modes = array('mobile' => 'Normal phone', 'touch' => 'Touch phone', 'desktop' => 'PC/Laptop', 'text' => 'Text only', 'worksafe' => 'Work Safe', 'bigtouch' => 'Big Touch');
    $gwt = array('off' => 'direct', 'on' => 'via GWT');
    $colour_schemes = array();
    foreach ($GLOBALS['colour_schemes'] as $id => $info) {
        list($name, $colours) = explode('|', $info);
        $colour_schemes[$id] = $name;
    }
    $content .= '<form action="settings/save" method="post"><p>Colour scheme:<br /><select name="colours">';
    $content .= theme('options', $colour_schemes, setting_fetch('colours', 1));
    $content .= '</select></p><p>Mode:<br /><select name="browser">';
    $content .= theme('options', $modes, $GLOBALS['current_theme']);
    $content .= '</select></p><p>External links go:<br /><select name="gwt">';
    $content .= theme('options', $gwt, setting_fetch('gwt', $GLOBALS['current_theme'] == 'text' ? 'on' : 'off'));
    $content .= '</select><small><br />Google Web Transcoder (GWT) converts third-party sites into small, speedy pages suitable for older phones and people with less bandwidth.</small></p>';
    $content .= '<p><label><input type="checkbox" name="reverse" value="yes" ' . (setting_fetch('reverse') == 'yes' ? ' checked="checked" ' : '') . ' /> Attempt to reverse the conversation thread view.</label></p>';
    $content .= '<p><input type="submit" value="Save" /></p></form>';
    $content .= '<hr /><p>Visit <a href="reset">Reset</a> if things go horribly wrong - it will log you out and clear all settings.</p>';
    return theme('page', 'Settings', $content);
}
コード例 #9
0
ファイル: template.php プロジェクト: Jax24135/d740ftp
function colourise_preprocess_page(&$vars)
{
    // Theme Main and secondary links.
    if (isset($vars['main_menu'])) {
        $vars['primary_nav'] = theme('links__system_main_menu', array('links' => $vars['main_menu'], 'attributes' => array('class' => array('links', 'inline', 'main-menu'))));
    } else {
        $vars['primary_nav'] = FALSE;
    }
    if (isset($vars['secondary_menu'])) {
        $vars['secondary_menus'] = theme('links', $vars['secondary_menu'], array('class' => 'links secondary-menu'));
    }
    // Set Accessibility nav bar
    if (isset($vars['main_menu'])) {
        $vars['nav_access'] = '
    <ul id="nav-access" class="hidden">
      <li><a href="#main-menu" accesskey="N" title="' . t('Skip to Main Menu') . '">' . t('Skip to Main Menu') . '</a></li>
      <li><a href="#main-content" accesskey="M" title="' . t('Skip to Main Content') . '">' . t('Skip to Main Content') . '</a></li>
    </ul>
  ';
    } else {
        $vars['nav_access'] = '
    <ul id="nav-access" class="hidden">
      <li><a href="#main-content" accesskey="M" title="' . t('Skip to Main Content') . '">' . t('Skip to Main Content') . '</a></li>
    </ul>
  ';
    }
}
コード例 #10
0
function _myu_user_dropdown()
{
    global $user;
    global $language;
    $items = array();
    if ($user->uid === 0) {
        $login_link = l('<span>' . t('Login') . '</span>', '', array('attributes' => array('class' => 'login dropdown-toggle', 'data-toggle' => 'modal'), 'fragment' => 'login', 'external' => TRUE, 'html' => TRUE));
        return '<ul class="menu nav navbar-nav user"><li class="dropdown dropdown-user">' . $login_link . '</li></ul>';
    } else {
        $username = '';
        if (!empty($user->picture)) {
            $fid = $user->picture;
            $file = file_load($fid);
            $username = theme('image_style', array('path' => $file->uri, 'style_name' => '29x29', 'attributes' => array('class' => 'img-circle')));
        }
        $username .= '<span class="username username-hide-on-mobile">' . format_username($GLOBALS['user']) . '</span><i class="fa fa-angle-down"></i>';
        $username_link = l($username, 'javascript:;', array('html' => TRUE, 'language' => $language, 'external' => TRUE, 'attributes' => array('class' => 'dropdown-toggle', 'data-close-others' => 'true', 'data-hover' => 'dropdown', 'data-toggle' => 'dropdown')));
        $user_menu = menu_tree('user-menu');
        foreach ($user_menu as $menu_link) {
            if (isset($menu_link['#original_link'])) {
                $items[] = l($menu_link['#original_link']['title'], $menu_link['#original_link']['href'], array('language' => $language));
            }
        }
        $user_menu_list = theme('item_list', array('items' => $items, 'type' => 'ul', 'attributes' => array('class' => 'dropdown-menu dropdown-menu-default')));
        return '<ul class="menu nav navbar-nav user"><li class="dropdown dropdown-user">' . $username_link . $user_menu_list . '</li></ul>';
    }
}
コード例 #11
0
ファイル: popups.php プロジェクト: JLarky/www2popup-gate
/**
 * Parse popup message
 *
 * @param mysql_resource mysql_resource result of mysql_query
 *
 * @return string
 */
function popup_parse($mysql_resource)
{
    static $pcont = 0;
    $output = '';
    $vars = array();
    while ($s = @mysql_fetch_row($mysql_resource)) {
        $pcont++;
        $vars["ID"] = $s[0];
        $vars["MAC"] = $s[1];
        $vars["IP"] = $s[2];
        $vars["COMP"] = htmlspecialchars($s[3]);
        $vars["NICK"] = htmlspecialchars($s[4]);
        $vars["DATE"] = $s[9];
        $vars["TO"] = htmlspecialchars($s[6]);
        $s[8] = str_replace("http://remont.lvs.ru", "_DND мудак_", $s[8]);
        $s[8] = str_replace("http://www.evrostroika.ru", "_DND мудак_", $s[8]);
        $vars["MESSAGE"] = popup_messageparse($s[8], $pcont == 2);
        if ($s[1] == '00:11:22:22:11:00') {
            $vars["MESSAGE"] = "Здравствуйте! Мне двадцать лет, я бородат, живу с мамой, тролль, лжец и девственник. Вот и сейчас...\n\nP.S. Извените за неровный почерк.";
        }
        $vars["spam"] = $s[1] == '00:11:22:22:11:00';
        $vars["spam"] = 'spambot' == $vars["NICK"] || $vars['spam'];
        $vars["spam"] = $vars['spam'] || strrpos($vars["MESSAGE"], "У кого есть эти файлы ? :") !== false;
        //$vars["spam"]   = $vars['spam'] || ('satt'==strtolower($vars["NICK"]));
        $output .= theme("popup", $vars);
    }
    return $output;
}
コード例 #12
0
ファイル: Base.php プロジェクト: prashantgajare/civicrm-core
 /**
  * if we are using a theming system, invoke theme, else just print the
  * content
  *
  * @param string  $content the content that will be themed
  * @param boolean $print   are we displaying to the screen or bypassing theming?
  * @param boolean $maintenance  for maintenance mode
  *
  * @return void           prints content on stdout
  * @access public
  */
 function theme(&$content, $print = FALSE, $maintenance = FALSE)
 {
     $ret = FALSE;
     // TODO: Split up; this was copied verbatim from CiviCRM 4.0's multi-UF theming function
     // but the parts should be copied into cleaner subclass implementations
     $config = CRM_Core_Config::singleton();
     if ($config->userSystem->is_drupal && function_exists('theme') && !$print) {
         if ($maintenance) {
             drupal_set_breadcrumb('');
             drupal_maintenance_theme();
             if ($region = CRM_Core_Region::instance('html-header', FALSE)) {
                 CRM_Utils_System::addHTMLHead($region->render(''));
             }
             print theme('maintenance_page', array('content' => $content));
             exit;
         }
         $ret = TRUE;
         // TODO: Figure out why D7 returns but everyone else prints
     }
     $out = $content;
     $config =& CRM_Core_Config::singleton();
     if (!$print && $config->userFramework == 'WordPress') {
         if (is_admin()) {
             require_once ABSPATH . 'wp-admin/admin-header.php';
         } else {
             // FIX ME: we need to figure out to replace civicrm content on the frontend pages
         }
     }
     if ($ret) {
         return $out;
     } else {
         print $out;
     }
 }
コード例 #13
0
ファイル: template.php プロジェクト: keylorm/importacionesgm
/**
 * Implements hook_preprocess_html().
 * Meta tags https://drupal.org/node/1468582#comment-5698732
 */
function importacionesgm_preprocess_html(&$variables)
{
    $meta_charset = array('#tag' => 'meta', '#attributes' => array('charset' => 'utf-8'));
    drupal_add_html_head($meta_charset, 'meta_charset');
    $meta_x_ua_compatible = array('#tag' => 'meta', '#attributes' => array('http-equiv' => 'x-ua-compatible', 'content' => 'ie=edge, chrome=1'));
    drupal_add_html_head($meta_x_ua_compatible, 'meta_x_ua_compatible');
    $meta_mobile_optimized = array('#tag' => 'meta', '#attributes' => array('name' => 'MobileOptimized', 'content' => 'width'));
    drupal_add_html_head($meta_mobile_optimized, 'meta_mobile_optimized');
    $meta_handheld_friendly = array('#tag' => 'meta', '#attributes' => array('name' => 'HandheldFriendly', 'content' => 'true'));
    drupal_add_html_head($meta_handheld_friendly, 'meta_handheld_friendly');
    $meta_viewport = array('#tag' => 'meta', '#attributes' => array('name' => 'viewport', 'content' => 'width=device-width, initial-scale=1'));
    drupal_add_html_head($meta_viewport, 'meta_viewport');
    $meta_cleartype = array('#tag' => 'meta', '#attributes' => array('http-equiv' => 'cleartype', 'content' => 'on'));
    drupal_add_html_head($meta_cleartype, 'meta_cleartype');
    // Use html5shiv.
    if (theme_get_setting('html5shim')) {
        $element = array('element' => array('#tag' => 'script', '#value' => '', '#attributes' => array('type' => 'text/javascript', 'src' => file_create_url(drupal_get_path('theme', 'importacionesgm') . '/js/html5shiv-printshiv.js'))));
        $html5shim = array('#type' => 'markup', '#markup' => "<!--[if lt IE 9]>\n" . theme('html_tag', $element) . "<![endif]-->\n");
        drupal_add_html_head($html5shim, 'sonambulo_html5shim');
    }
    // Use Respond.js.
    if (theme_get_setting('respond_js')) {
        drupal_add_js(drupal_get_path('theme', 'importacionesgm') . '/js/respond.min.js', array('group' => JS_LIBRARY, 'weight' => -100));
    }
    // Use normalize.css
    if (theme_get_setting('normalize_css')) {
        drupal_add_css(drupal_get_path('theme', 'importacionesgm') . '/css/normalize.css', array('group' => CSS_SYSTEM, 'weight' => -100));
    }
}
コード例 #14
0
 /**
  * if we are using a theming system, invoke theme, else just print the
  * content
  *
  * @param string  $type    name of theme object/file
  * @param string  $content the content that will be themed
  * @param array   $args    the args for the themeing function if any
  * @param boolean $print   are we displaying to the screen or bypassing theming?
  * @param boolean $ret     should we echo or return output
  * @param boolean $maintenance  for maintenance mode
  *
  * @return void           prints content on stdout
  * @access public
  */
 function theme($type, &$content, $args = NULL, $print = FALSE, $ret = FALSE, $maintenance = FALSE)
 {
     // TODO: Split up; this was copied verbatim from CiviCRM 4.0's multi-UF theming function
     // but the parts should be copied into cleaner subclass implementations
     if (function_exists('theme') && !$print) {
         if ($maintenance) {
             drupal_set_breadcrumb('');
             drupal_maintenance_theme();
             print theme('maintenance_page', array('content' => $content));
             exit;
         }
         $out = $content;
         $ret = TRUE;
     } else {
         $out = $content;
     }
     $config =& CRM_Core_Config::singleton();
     if (!$print && $config->userFramework == 'WordPress') {
         if (is_admin()) {
             require_once ABSPATH . 'wp-admin/admin-header.php';
         } else {
             // FIX ME: we need to figure out to replace civicrm content on the frontend pages
         }
     }
     if ($ret) {
         return $out;
     } else {
         print $out;
     }
 }
コード例 #15
0
ファイル: Artists__1_0.php プロジェクト: adam-s/954live
 public function renderImage($image)
 {
     $variables = array();
     $variables['style_name'] = 'xl';
     $variables['path'] = $image['uri'];
     return theme('image_style', $variables);
 }
コード例 #16
0
ファイル: Map.php プロジェクト: josemrc/ae2web
 /**
  * {@inheritdoc}
  */
 public function build(array $build = array())
 {
     $map = $this;
     // Run prebuild hook to all objects who implements it.
     $map->preBuild($build, $map);
     $asynchronous = 0;
     foreach ($map->getCollection()->getFlatList() as $object) {
         // Check if this object is asynchronous.
         $asynchronous += (int) $object->isAsynchronous();
     }
     // If this is asynchronous flag it as such.
     if ($asynchronous) {
         $settings['data']['openlayers']['maps'][$map->getId()]['map']['async'] = $asynchronous;
     }
     $styles = array('width' => $map->getOption('width'), 'height' => $map->getOption('height'));
     $styles = implode(array_map(function ($k, $v) {
         return $k . ':' . $v . ';';
     }, array_keys($styles), $styles));
     $build['openlayers'] = array('#type' => 'container', '#attributes' => array('id' => 'openlayers-container-' . $map->getId(), 'class' => array('contextual-links-region', 'openlayers-container')), 'map-container' => array('#type' => 'container', '#attributes' => array('id' => 'map-container-' . $map->getId(), 'style' => $styles, 'class' => array('openlayers-map-container')), 'map' => array('#type' => 'container', '#attributes' => array('id' => $map->getId(), 'class' => array('openlayers-map', $map->getMachineName())), '#attached' => $map->getCollection()->getAttached())));
     // If this is an asynchronous map flag it as such.
     if ($asynchronous) {
         $build['openlayers']['map-container']['map']['#attributes']['class'][] = 'asynchronous';
     }
     if ((bool) $this->getOption('capabilities', FALSE) === TRUE) {
         $items = array_values($this->getOption(array('capabilities', 'options', 'table'), array()));
         array_walk($items, 'check_plain');
         $build['openlayers']['capabilities'] = array('#weight' => 1, '#type' => $this->getOption(array('capabilities', 'options', 'container_type'), 'fieldset'), '#title' => $this->getOption(array('capabilities', 'options', 'title'), NULL), '#description' => $this->getOption(array('capabilities', 'options', 'description'), NULL), '#collapsible' => $this->getOption(array('capabilities', 'options', 'collapsible'), TRUE), '#collapsed' => $this->getOption(array('capabilities', 'options', 'collapsed'), TRUE), 'description' => array('#type' => 'container', '#attributes' => array('class' => array('description')), array('#markup' => theme('item_list', array('items' => $items, 'title' => '', 'type' => 'ul')))));
     }
     $map->postBuild($build, $map);
     return $build;
 }
コード例 #17
0
 public function list_build_row($item, &$form_state, $operations)
 {
     // Set up sorting
     $name = $item->name;
     $schema = ctools_export_get_schema($this->plugin['schema']);
     switch ($form_state['values']['order']) {
         case 'disabled':
             $this->sorts[$name] = $item->weight;
             break;
         case 'disabled_title':
             $this->sorts[$name] = empty($item->disabled) . $item->admin_title;
             break;
         case 'title':
             $this->sorts[$name] = $item->admin_title;
             break;
         case 'name':
             $this->sorts[$name] = $name;
             break;
         case 'storage':
             $this->sorts[$name] = $item->{$schema['export']['export type string']} . $name;
             break;
     }
     $ops = theme('links__ctools_dropbutton', array('links' => $operations, 'attributes' => array('class' => array('links', 'inline'))));
     $role_list = $this->buildRoleList($item->role_rids);
     $this->rows[$name] = array('data' => array(array('data' => check_plain($item->admin_title), 'class' => array('ctools-export-ui-title')), array('data' => check_plain($name), 'class' => array('ctools-export-ui-name')), array('data' => check_plain($item->{$schema['export']['export type string']}), 'class' => array('ctools-export-ui-storage')), array('data' => check_plain($role_list), 'class' => array('ctools-export-ui-roles')), array('data' => check_plain($item->weight), 'class' => array('ctools-export-ui-weight')), array('data' => $ops, 'class' => array('ctools-export-ui-operations'))), 'class' => array(!empty($item->disabled) ? 'ctools-export-ui-disabled' : 'ctools-export-ui-enabled'));
 }
コード例 #18
0
ファイル: touch.php プロジェクト: xctcc/npt
function touch_theme_menu_top()
{
    $links = $main_menu_titles = array();
    if (setting_fetch('tophome', 'yes') == 'yes') {
        $main_menu_titles[] = __("Home");
    }
    if (setting_fetch('topreplies', 'yes') == 'yes') {
        $main_menu_titles[] = __("Replies");
    }
    if (setting_fetch('topdirects', 'yes') == 'yes') {
        $main_menu_titles[] = __("Directs");
    }
    if (setting_fetch('topsearch') == 'yes') {
        $main_menu_titles[] = __("Search");
    }
    foreach (menu_visible_items() as $url => $page) {
        $title = $url ? $page['title'] : __("Home");
        $type = in_array($title, $main_menu_titles) ? 'main' : 'extras';
        $links[$type][] = "<a href='" . BASE_URL . "{$url}'>{$title}</a>";
    }
    if (user_is_authenticated()) {
        $user = user_current_username();
        if (setting_fetch('topuser') == 'yes') {
            array_unshift($links['main'], "<b><a href='" . BASE_URL . "user/{$user}'>{$user}</a></b>");
        }
        array_unshift($links['extras'], "<b><a href='" . BASE_URL . "user/{$user}'>{$user}</a></b>");
    }
    array_push($links['main'], '<a href="#" onclick="return toggleMenu()">' . __('More') . '</a>');
    $html = '<div id="menu" class="menu">';
    $html .= theme('list', $links['main'], array('id' => 'menu-main'));
    $html .= theme('list', $links['extras'], array('id' => 'menu-extras'));
    $html .= '</div>';
    return $html;
}
コード例 #19
0
/**
 * Override or insert variables into the page template.
 */
function garland_preprocess_page(&$vars)
{
    // Move secondary tabs into a separate variable.
    $vars['tabs2'] = array('#theme' => 'menu_local_tasks', '#secondary' => $vars['tabs']['#secondary']);
    unset($vars['tabs']['#secondary']);
    if (isset($vars['main_menu'])) {
        $vars['primary_nav'] = theme('links__system_main_menu', array('links' => $vars['main_menu'], 'attributes' => array('class' => array('links', 'inline', 'main-menu')), 'heading' => array('text' => t('Main menu'), 'level' => 'h2', 'class' => array('element-invisible'))));
    } else {
        $vars['primary_nav'] = FALSE;
    }
    if (isset($vars['secondary_menu'])) {
        $vars['secondary_nav'] = theme('links__system_secondary_menu', array('links' => $vars['secondary_menu'], 'attributes' => array('class' => array('links', 'inline', 'secondary-menu')), 'heading' => array('text' => t('Secondary menu'), 'level' => 'h2', 'class' => array('element-invisible'))));
    } else {
        $vars['secondary_nav'] = FALSE;
    }
    // Prepare header.
    $site_fields = array();
    if (!empty($vars['site_name'])) {
        $site_fields[] = $vars['site_name'];
    }
    if (!empty($vars['site_slogan'])) {
        $site_fields[] = $vars['site_slogan'];
    }
    $vars['site_title'] = implode(' ', $site_fields);
    if (!empty($site_fields)) {
        $site_fields[0] = '<span>' . $site_fields[0] . '</span>';
    }
    $vars['site_html'] = implode(' ', $site_fields);
    // Set a variable for the site name title and logo alt attributes text.
    $slogan_text = $vars['site_slogan'];
    $site_name_text = $vars['site_name'];
    $vars['site_name_and_slogan'] = $site_name_text . ' ' . $slogan_text;
}
コード例 #20
0
ファイル: template.php プロジェクト: Reflie/drupal
/**
 * Preprocessor for page.tpl.php template file.
 */
function bodia_my_theme_preprocess_page(&$vars, $hook)
{
    // For change title in node 3
    if (arg(1) == 3 && arg(0) == 'node') {
        $vars['title'] = 'Example template_preprocess_page';
    }
    // For easy printing of variables.
    $vars['logo_img'] = '';
    if (!empty($vars['logo'])) {
        $vars['logo_img'] = theme('image', array('path' => $vars['logo'], 'alt' => t('Home'), 'title' => t('Home')));
    }
    $vars['linked_logo_img'] = '';
    if (!empty($vars['logo_img'])) {
        $vars['linked_logo_img'] = l($vars['logo_img'], '<front>', array('attributes' => array('rel' => 'home', 'title' => t('Home')), 'html' => TRUE));
    }
    $vars['linked_site_name'] = '';
    if (!empty($vars['site_name'])) {
        $vars['linked_site_name'] = l($vars['site_name'], '<front>', array('attributes' => array('rel' => 'home', 'title' => t('Home'))));
    }
    // Site navigation links.
    $vars['main_menu_links'] = '';
    if (isset($vars['main_menu'])) {
        $vars['main_menu_links'] = theme('links__system_main_menu', array('links' => $vars['main_menu'], 'attributes' => array('id' => 'main-menu', 'class' => array('inline', 'main-menu')), 'heading' => array('text' => t('Main menu'), 'level' => 'h2', 'class' => array('element-invisible'))));
    }
    $vars['secondary_menu_links'] = '';
    if (isset($vars['secondary_menu'])) {
        $vars['secondary_menu_links'] = theme('links__system_secondary_menu', array('links' => $vars['secondary_menu'], 'attributes' => array('id' => 'secondary-menu', 'class' => array('inline', 'secondary-menu')), 'heading' => array('text' => t('Secondary menu'), 'level' => 'h2', 'class' => array('element-invisible'))));
    }
}
コード例 #21
0
/**
 * Implements theme_bootstrap_btn_dropdown().
 */
function theme_bootstrap_btn_dropdown($variables)
{
    $type_class = '';
    $sub_links = '';
    $variables['attributes']['class'][] = 'btn-group';
    // Type class.
    if (isset($variables['type'])) {
        $type_class .= ' btn-' . $variables['type'];
    } else {
        $type_class .= ' btn-default';
    }
    // Start markup.
    $output = '<div' . drupal_attributes($variables['attributes']) . '>';
    // Add as string if its not a link.
    if (is_array($variables['label'])) {
        $output .= l($variables['label']['title'], ${$variables}['label']['href'], $variables['label']);
    }
    $output .= '<a class="btn' . $type_class . ' dropdown-toggle" data-toggle="dropdown" href="#">';
    // It is a link, create one.
    if (is_string($variables['label'])) {
        $output .= check_plain($variables['label']);
    }
    if (is_array($variables['links'])) {
        $sub_links = theme('links', array('links' => $variables['links'], 'attributes' => array('class' => array('dropdown-menu'))));
    }
    // Finish markup.
    $output .= '<span class="caret"></span></a>' . $sub_links . '</div>';
    return $output;
}
コード例 #22
0
 public function overviewForm($form, &$form_state)
 {
     // Add table and pager.
     $form = parent::overviewForm($form, $form_state);
     // Allow modules to insert their own action links to the 'table', like cleanup module.
     $top_actions = module_invoke_all('workflow_operations', 'top_actions', NULL);
     // Allow modules to insert their own workflow operations.
     foreach ($form['table']['#rows'] as &$row) {
         $url = $row[0]['data']['#url'];
         $workflow = $url['options']['entity'];
         foreach ($actions = module_invoke_all('workflow_operations', 'workflow', $workflow) as $action) {
             $action['attributes'] = isset($action['attributes']) ? $action['attributes'] : array();
             $row[] = l(strtolower($action['title']), $action['href'], $action['attributes']);
         }
     }
     // @todo: add these top actions next to the core 'Add workflow' action.
     $top_actions_args = array('links' => $top_actions, 'attributes' => array('class' => array('inline', 'action-links')));
     $form['action-links'] = array('#type' => 'markup', '#markup' => theme('links', $top_actions_args), '#weight' => -1);
     if (module_exists('workflownode')) {
         // Append the type_map form, changing the form by reference.
         // The 'type_map' form is only valid for Workflow Node API.
         module_load_include('inc', 'workflow_admin_ui', 'workflow_admin_ui.page.type_map');
         workflow_admin_ui_type_map_form($form);
     }
     // Add a submit button. The submit functions are added in the sub-forms.
     $form['submit'] = array('#type' => 'submit', '#value' => t('Save'), '#weight' => 100);
     return $form;
 }
コード例 #23
0
ファイル: spreads.php プロジェクト: dheere/twitubas
function twitter_spreads_page($text)
{
    $date_joined = date('jS M Y', $raw_date_joined);
    $tweets_per_day = twitter_tweets_per_day($user, 1);
    $content .= '<fieldset><legend><img src="http://si0.twimg.com/images/dev/cms/intents/bird/bird_blue/bird_16_blue.png" width="16" height="16" /> What\'s Happening?</legend><div class="ss"><div class="form"><form method="post" action="update">
  <div style="margin:0;padding:0;display:inline"><textarea id="status" name="status" cols="44" style="width:100%">I\'m using #twitUBAS. Wanna try mobile twitter with fast access & rich of features? Try #twitUBe now. http://twit.basko.ro</textarea><input name="in_reply_to_id" value="' . $in_reply_to_id . '" type="hidden" /><input type="submit" value="Tweet" class="buttons" /></form></span><span id="remaining">140</span> 
  <span id="geo" style="display: none;"><input onclick="goGeo()" type="checkbox" id="geoloc" name="location" /> <label for="geoloc" id="lblGeo"></label></span></div></div></div></fieldset>  <script type="text/javascript">
started = false;
chkbox = document.getElementById("geoloc");
if (navigator.geolocation) {
    geoStatus("Tweet my location");
    if ("' . $_COOKIE['geo'] . '"=="Y") {
        chkbox.checked = true;
        goGeo();
    }
}
function goGeo(node) {
    if (started) return;
    started = true;
    geoStatus("Locating...");
    navigator.geolocation.getCurrentPosition(geoSuccess, geoStatus);
}
function geoStatus(msg) {
    document.getElementById("geo").style.display = "inline";
    document.getElementById("lblGeo").innerHTML = msg;
}
function geoSuccess(position) {
    geoStatus("Tweet my <a href=\'http://maps.google.co.uk/m?q=" + position.coords.latitude + "," + position.coords.longitude + "\' target=\'blank\'>location</a>");
    chkbox.value = position.coords.latitude + "," + position.coords.longitude;
}
  </script>';
    theme('page', "Spreads", $content);
}
コード例 #24
0
ファイル: functions.php プロジェクト: iceanothers/wp-skillet
function wp_IEhtml5_js()
{
    global $is_IE;
    if ($is_IE) {
        echo '<!--[if lt IE 9]><script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script><script src="//css3-mediaqueries-js.googlecode.com/svn/trunk/css3-mediaqueries.js"></script><![endif]--><!--[if lte IE 9]><link href="' . theme() . '/style/animations-ie-fix.css" rel="stylesheet" /><![endif]-->';
    }
}
コード例 #25
0
/**
 * Overrides theme_form_element_label().
 */
function bootstrap_psdpt_form_element_label(&$variables)
{
    $element = $variables['element'];
    // This is also used in the installer, pre-database setup.
    $t = get_t();
    // Determine if certain things should skip for checkbox or radio elements.
    $skip = isset($element['#type']) && ('checkbox' === $element['#type'] || 'radio' === $element['#type']);
    // If title and required marker are both empty, output no label.
    if ((!isset($element['#title']) || $element['#title'] === '' && !$skip) && empty($element['#required'])) {
        return '';
    }
    // If the element is required, a required marker is appended to the label.
    $required = !empty($element['#required']) ? theme('form_required_marker', array('element' => $element)) : '';
    $title = filter_xss_admin($element['#title']);
    $attributes = array();
    // Style the label as class option to display inline with the element.
    if ($element['#title_display'] == 'after' && !$skip) {
        $attributes['class'][] = $element['#type'];
    } elseif ($element['#title_display'] == 'invisible') {
        $attributes['class'][] = 'element-invisible';
    }
    if (!empty($element['#id'])) {
        $attributes['for'] = $element['#id'];
    }
    // Insert radio and checkboxes inside label elements.
    $output = '';
    if (isset($variables['#children'])) {
        $output .= $variables['#children'];
    }
    // Append label.
    $output .= $t('!title !required', array('!title' => $title, '!required' => $required));
    // The leading whitespace helps visually separate fields from inline labels.
    return ' <label' . drupal_attributes($attributes) . '>' . $output . "</label>\n";
}
コード例 #26
0
/**
 * Implements template_preprocess_page().
 */
function propeople_preprocess_page(&$variables)
{
    if (isset($variables['node_title'])) {
        $variables['title'] = $variables['node_title'];
    }
    // Since the title and the shortcut link are both block level elements,
    // positioning them next to each other is much simpler with a wrapper div.
    if (!empty($variables['title_suffix']['add_or_remove_shortcut']) && $variables['title']) {
        // Add a wrapper div using the title_prefix and title_suffix render elements.
        $variables['title_prefix']['shortcut_wrapper'] = array('#markup' => '<div class="shortcut-wrapper clearfix">', '#weight' => 100);
        $variables['title_suffix']['shortcut_wrapper'] = array('#markup' => '</div>', '#weight' => -99);
        // Make sure the shortcut link is the first item in title_suffix.
        $variables['title_suffix']['add_or_remove_shortcut']['#weight'] = -100;
    }
    // Add rendered main menu, if available.
    // Borrowed from Easy Clean.
    // @link http://drupal.org/project/easy_clean
    if (isset($variables['main_menu'])) {
        $variables['primary_nav'] = theme('links__system_main_menu', array('links' => $variables['main_menu'], 'attributes' => array('class' => array('links', 'inline', 'main-menu')), 'heading' => array('text' => t('Main menu'), 'level' => 'h2', 'class' => array('element-invisible'))));
    } else {
        $variables['primary_nav'] = FALSE;
    }
    // Add rendered secondary menu, if available.
    // Borrowed from Easy Clean.
    // @link http://drupal.org/project/easy_clean
    if (isset($variables['secondary_menu'])) {
        $variables['secondary_nav'] = theme('links__system_secondary_menu', array('links' => $variables['secondary_menu'], 'attributes' => array('class' => array('links', 'inline', 'secondary-menu')), 'heading' => array('text' => t('Secondary menu'), 'level' => 'h2', 'class' => array('element-invisible'))));
    } else {
        $variables['secondary_nav'] = FALSE;
    }
    // Add extra theme hook suggestions.
    if (isset($variables['node'])) {
        $variables['theme_hook_suggestions'][] = "page__node__type__{$variables['node']->type}";
    }
}
コード例 #27
0
ファイル: excluded.php プロジェクト: exchiller/drupal43
/**
 * An excluded function that should not be in the package.
 */
function excluded_function()
{
    // This is for testing whether we can exclude "drupalisms" from this file.
    $baz = theme('sample_two', $foo);
    // But this should make a link.
    $foo = sample_function();
}
コード例 #28
0
ファイル: template.php プロジェクト: sdboyer/drupal-c2g
/**
 * Override or insert variables into the page template.
 */
function garland_preprocess_page(&$vars)
{
    $vars['tabs2'] = menu_secondary_local_tasks();
    if (isset($vars['main_menu'])) {
        $vars['primary_nav'] = theme('links__system_main_menu', array('links' => $vars['main_menu'], 'attributes' => array('class' => array('links', 'main-menu')), 'heading' => array('text' => t('Main menu'), 'level' => 'h2', 'class' => array('element-invisible'))));
    } else {
        $vars['primary_nav'] = FALSE;
    }
    if (isset($vars['secondary_menu'])) {
        $vars['secondary_nav'] = theme('links__system_secondary_menu', array('links' => $vars['secondary_menu'], 'attributes' => array('class' => array('links', 'secondary-menu')), 'heading' => array('text' => t('Secondary menu'), 'level' => 'h2', 'class' => array('element-invisible'))));
    } else {
        $vars['secondary_nav'] = FALSE;
    }
    // Prepare header.
    $site_fields = array();
    if (!empty($vars['site_name'])) {
        $site_fields[] = check_plain($vars['site_name']);
    }
    if (!empty($vars['site_slogan'])) {
        $site_fields[] = check_plain($vars['site_slogan']);
    }
    $vars['site_title'] = implode(' ', $site_fields);
    if (!empty($site_fields)) {
        $site_fields[0] = '<span>' . $site_fields[0] . '</span>';
    }
    $vars['site_html'] = implode(' ', $site_fields);
    // Set a variable for the site name title and logo alt attributes text.
    $slogan_text = filter_xss_admin(variable_get('site_slogan', ''));
    $site_name_text = filter_xss_admin(variable_get('site_name', 'Drupal'));
    $vars['site_name_and_slogan'] = $site_name_text . ' ' . $slogan_text;
}
コード例 #29
0
ファイル: helpers.php プロジェクト: maxupunk/metin2cms
/**
 * Get the current path to assets stored as a theme
 *
 * @param string $asset
 * @param null $theme
 * @return string
 */
function assetTheme($asset = '', $theme = null)
{
    if ($theme == null) {
        $theme = theme();
    }
    return asset('assets/' . $theme . '/' . $asset);
}
コード例 #30
0
/**
 * Implements theme_hook().
 *
 * Lawmakers Page.
 */
function theme_lawmakers_api(&$variables)
{
    $output = '';
    $node = $variables['node'];
    $full_title = $node->title . ' ' . $node->firstname . ' ' . $node->lastname;
    drupal_set_title($full_title);
    $lawmakers_image_size = '200x250';
    $image_data = array('path' => drupal_get_path('module', 'lawmakers') . '/images/' . $lawmakers_image_size . '/' . $node->bioguide_id . '.jpg');
    $output .= '<div class="image" style="float: left; margin-right: 20px">' . theme('image', $image_data) . '</div>';
    $output .= '<div class="party-info"> ' . $node->party . ' ' . $node->state . '</div>';
    $output .= '<div class="congress-office">' . $node->congress_office . '</div>';
    $output .= '<div class="congress-phone">' . $node->phone . '</div>';
    $output .= '<div class="congress-fax">' . $node->fax . '</div>';
    $output .= '<div class="congress-website">' . $node->website . '</div>';
    $output .= '<div class="congress-contact-form">' . $node->webform . '</div>';
    $output .= '<p/>';
    $output .= '<h3>Committees</h3>';
    $list_items = $variables['committees']['results'];
    $output .= '<ul class="committees-list">';
    foreach ($list_items as $list_item) {
        $output .= '<li class="committee-name"> ' . $list_item['name'] . ' </li>';
    }
    $output .= '</ul>';
    /*$bills = $variables['bills'];
      print_r($bills);
      $votes = $variables['votes'];
      print_r($votes);*/
    return $output;
}