コード例 #1
0
ファイル: Drupal.php プロジェクト: bhirsch/voipdev
 /**
  * sets the title of the page
  *
  * @param string $title
  * @paqram string $pageTitle
  *
  * @return void
  * @access public
  */
 function setTitle($title, $pageTitle = null)
 {
     if ($pageTitle) {
         $title = $pageTitle;
     }
     drupal_set_title($title);
 }
コード例 #2
0
ファイル: template.php プロジェクト: eigentor/sbl
function quatro_preprocess_page(&$vars)
{
    // Set the page title for the "Verein" Panels Page
    if (arg(0) == 'verein' && is_numeric(arg(1))) {
        //dpm($vars);
        $nid = arg(1);
        // Search for the "Mannschaft" Node matching the argument
        $query = new EntityFieldQuery();
        $query->entityCondition('entity_type', 'node')->entityCondition('bundle', 'mannschaft')->propertyCondition('status', NODE_PUBLISHED)->propertyCondition('nid', $nid, '=')->addTag('DANGEROUS_ACCESS_CHECK_OPT_OUT');
        $result = $query->execute();
        // Set the page title to the Node Title of the "Mannschaft" Node
        if (isset($result['node'])) {
            $node_ids = array_keys($result['node']);
            $node_id = $node_ids[0];
            $node = node_load($node_id);
            drupal_set_title($node->title);
        }
    }
    // Set the page title for the "Spieler" Panels Page
    if (arg(0) == 'spieler' && is_numeric(arg(1))) {
        //dpm($vars);
        $nid = arg(1);
        // Search for the ticket matching the Rabattcode
        $query = new EntityFieldQuery();
        $query->entityCondition('entity_type', 'node')->entityCondition('bundle', 'spieler')->propertyCondition('status', NODE_PUBLISHED)->propertyCondition('nid', $nid, '=')->addTag('DANGEROUS_ACCESS_CHECK_OPT_OUT');
        $result = $query->execute();
        // If a ticket was found, set the price field to the ticket price
        if (isset($result['node'])) {
            $node_ids = array_keys($result['node']);
            $node_id = $node_ids[0];
            $node = node_load($node_id);
            drupal_set_title($node->title);
        }
    }
}
コード例 #3
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;
}
コード例 #4
0
function bluemod_init()
{
    //theme ( 'bluemod_javascript' );
    error_reporting(0);
    // Redirecciona a la pantalla de ingreso
    global $user;
    //Redirecciona a home a los usuarios anónimos.
    $curr = current_path();
    $anon_main = 0;
    $link_de_registro = substr_count($curr, 'user/reset/');
    $link_de_invitacion = substr_count($curr, 'invite/accept/');
    //echo $link_de_registro.','.$curr;
    if ($user->roles[1] == 'anonymous user' && $curr != 'escritorio') {
        //echo $curr;
        //Lista de excepciones que un usuario anónimo puede ver
        if ($curr != 'user/register' && $curr != 'user/password' && $curr != 'user/reset' && $curr != 'elegir-contactos' && $curr != 'node/374' && $curr != 'node/381' && $curr != 'node/228' && $curr != 'contact' && $curr != "system/ajax" && $link_de_registro == 0 && $link_de_invitacion == 0) {
            //echo $link_de_registro.','.$curr;
            //solo si no fuera el link de registro que tiene la forma user/reset/*
            // header("Location: /");
            //$mensaje = drupal_get_message(null,false);
            //drupal_set_message($mensaje);
            drupal_goto("<front>");
        }
    }
    if (arg(0) == 'user' && arg(1) == 'password') {
        drupal_set_title(t('Recupera tu Contraseña'));
    }
    if (arg(0) == 'user' && arg(1) == 'register') {
        drupal_set_title(t('Solicitar Invitación'));
    }
}
コード例 #5
0
 /**
  * {@inheritdoc}
  */
 public function form(array $form, array &$form_state)
 {
     $feed = $this->entity;
     $importer = $feed->getImporter();
     $args = array('@importer' => $importer->label(), '@title' => $feed->label());
     if ($this->operation == 'update') {
         drupal_set_title($this->t('<em>Edit @importer</em> @title', $args), PASS_THROUGH);
     } elseif ($this->operation == 'create') {
         drupal_set_title($this->t('<em>Add @importer</em>', $args), PASS_THROUGH);
     }
     $user_config = \Drupal::config('user.settings');
     $form['title'] = array('#type' => 'textfield', '#title' => $this->t('Title'), '#default_value' => $feed->label(), '#required' => TRUE);
     foreach ($importer->getPlugins() as $plugin) {
         if ($plugin instanceof FeedPluginFormInterface) {
             // Store the plugin for validate and submit.
             $this->configurablePlugins[] = $plugin;
             $form = $plugin->buildFeedForm($form, $form_state, $feed);
         }
     }
     $form['advanced'] = array('#type' => 'vertical_tabs', '#weight' => 99);
     // Feed author information for administrators.
     $form['author'] = array('#type' => 'details', '#access' => $this->currentUser()->hasPermission('administer feeds'), '#title' => $this->t('Authoring information'), '#collapsed' => TRUE, '#group' => 'advanced', '#weight' => 90);
     $form['author']['name'] = array('#type' => 'textfield', '#title' => $this->t('Authored by'), '#maxlength' => 60, '#autocomplete_path' => 'user/autocomplete', '#default_value' => $feed->getAuthor()->getUsername(), '#description' => $this->t('Leave blank for %anonymous.', array('%anonymous' => $user_config->get('anonymous'))));
     $form['author']['date'] = array('#type' => 'textfield', '#title' => $this->t('Authored on'), '#maxlength' => 25, '#description' => $this->t('Format: %time. The date format is YYYY-MM-DD and %timezone is the time zone offset from UTC. Leave blank to use the time of form submission.', array('%time' => format_date($feed->getCreatedTime(), 'custom', 'Y-m-d H:i:s O'), '%timezone' => format_date($feed->getCreatedTime(), 'custom', 'O'))));
     // Feed options for administrators.
     $form['options'] = array('#type' => 'details', '#access' => $this->currentUser()->hasPermission('administer feeds'), '#title' => $this->t('Import options'), '#collapsed' => TRUE, '#group' => 'advanced');
     $form['options']['status'] = array('#type' => 'checkbox', '#title' => $this->t('Active'), '#default_value' => $feed->isActive());
     return parent::form($form, $form_state);
 }
コード例 #6
0
ファイル: template.php プロジェクト: freighthouse/code
function iha_preprocess_page(&$variables)
{
    $search_box = drupal_render(drupal_get_form('search_form'));
    $variables['search_box'] = $search_box;
    if (drupal_is_front_page()) {
        unset($variables['page']['content']['system_main']['default_message']);
        //will remove message "no front page content is created"
        drupal_set_title('');
        //removes welcome message (page title)
    }
    if (arg(0) == 'node') {
        $variables['node_content'] =& $variables['page']['content']['system_main']['nodes'][arg(1)];
    }
    if (isset($variables['node']->type)) {
        $variables['theme_hook_suggestions'][] = 'page__' . $variables['node']->type;
    }
    // Prepare the mobile menu.
    $user_menu = menu_tree('user-menu');
    $main_menu = menu_tree('main-menu');
    $menu_tree = array_merge($main_menu, $user_menu);
    // FYI for future dev's - If need to add more menu items, then load the other menu through menu tree as well and do a
    // array merge or for loop to attach the items to the $menu_tree.
    $mobile_menu = '<ul class="list-unstyled main-menu">';
    foreach ($menu_tree as $mlid => $mm) {
        if (is_int($mlid)) {
            $mobile_menu .= iha_render_mobile_menu($mm);
        }
    }
    $mobile_menu .= '</ul>';
    $variables['mobile_menu'] = $mobile_menu;
}
コード例 #7
0
ファイル: authorize.php プロジェクト: aslakhellesoy/drupal
/**
 * Render a 403 access denied page for authorize.php
 */
function authorize_access_denied_page()
{
    drupal_add_http_header('Status', '403 Forbidden');
    watchdog('access denied', 'authorize.php', NULL, WATCHDOG_WARNING);
    drupal_set_title('Access denied');
    return t('You are not allowed to access this page.');
}
コード例 #8
0
ファイル: template.php プロジェクト: cap-mayank/intranet
function intranet_preprocess_page(&$vars)
{
    if (isset($vars['node'])) {
        $vars['theme_hook_suggestions'][] = 'page__' . $vars['node']->type;
        if ($vars['node']->type == 'cxo_messages') {
            drupal_set_title('');
        }
    }
    //404 page
    $status = drupal_get_http_header("status");
    if ($status == "404 Not Found") {
        $vars['theme_hook_suggestions'][] = 'page__404';
    }
    $br_banner_var = array('path' => theme_get_setting('bg_image_path', 'intranet'));
    $vars['bg_image'] = theme('image', $br_banner_var);
    $header_banner_var = array('style_name' => 'header_banner', 'path' => theme_get_setting('header_image_path', 'intranet'), 'alt' => 'header_banner', 'title' => 'Sakal header banner', 'attributes' => array('class' => 'headerImage'));
    $vars['header_image'] = theme('image_style', $header_banner_var);
    $footer_banner_var = array('style_name' => 'footer_banner', 'path' => theme_get_setting('footer_image_path', 'intranet'), 'alt' => 'footer_banner', 'title' => 'Sakal footer banner', 'attributes' => array('class' => 'footerImage'));
    $vars['footer_image'] = theme('image_style', $footer_banner_var);
    //set page title
    if (isset($vars['node'])) {
        $default_value = ucfirst(str_replace("_", " ", $vars['node']->type));
        drupal_set_title(variable_get('page_title_' . $vars['node']->type, $default_value));
    }
}
コード例 #9
0
ファイル: template.php プロジェクト: cableman/ereolen
/**
 * Implements hook_preprocess_ting_object().
 *
 * Add extra information form elib to the ting object.
 */
function ebog_preprocess_ting_object(&$vars)
{
    $isbn = $vars['object']->record['dc:identifier']['oss:PROVIDER-ID'][0];
    // Override ting object page title.
    drupal_set_title(check_plain($vars['object']->title . ' ' . t('af') . ' ' . $vars['object']->creators_string));
    // Create the author field.
    $vars['author'] = publizon_get_authors($vars['object']);
    // Load the product.
    try {
        $product = new PublizonProduct($isbn);
        // Get cover image.
        $vars['cover'] = $product->getCover('170_x');
        // Get ebook sample link.
        if (!empty($product->teaser_link)) {
            $vars['elib_sample_link'] = 'stream/' . $isbn . '/preview/';
        }
        if ($product->getFormat()) {
            $vars['elib_format'] = $product->getFormat();
        }
        // Check if the book is loaned by the user.
        global $user;
        if ($user->uid > 0) {
            $user_loans = new PublizonUserLoans($user->uid);
            $vars['is_loan'] = $user_loans->isLoan($isbn, TRUE);
            if ($vars['is_loan']) {
                $vars['cvo'] = $user_loans->loans[$isbn]->internal_order_number;
            }
        }
    } catch (Exception $e) {
        drupal_set_message($e->getMessage(), 'error');
    }
}
コード例 #10
0
ファイル: template.php プロジェクト: bikramth19/wordpress
/**
 * @file
 * template.php
 */
function corporatex3_preprocess_page(&$vars)
{
    $path = drupal_get_path_alias();
    if ($path == 'contact') {
        $vars['title'] = t('Contact us');
        drupal_set_title(t('Contact us'));
    }
}
コード例 #11
0
/**
 * Implements template_preprocess_page.
 */
function brush_preprocess_page(&$variables)
{
    if (drupal_is_front_page()) {
        unset($variables['page']['content']['system_main']['default_message']);
        //will remove message "no front page content is created"
        drupal_set_title('');
        //removes welcome message (page title)
    }
}
コード例 #12
0
ファイル: group_edit.php プロジェクト: BirenRathod/drupal-6
 /**
  * Return the generated form output.
  * @param array $args List of parameter values passed through to the form depending on how the form has been configured.
  * This array always contains a value for language.
  * @param object $node The Drupal node object.
  * @param array $response When this form is reloading after saving a submission, contains the response from the service call.
  * Note this does not apply when redirecting (in this case the details of the saved object are in the $_GET data).
  * @return Form HTML.
  */
 public static function get_form($args, $node, $response = null)
 {
     if (!hostsite_get_user_field('indicia_user_id')) {
         return 'Please ensure that you\'ve filled in your surname on your user profile before creating or editing groups.';
     }
     iform_load_helpers(array('report_helper', 'map_helper'));
     $args = array_merge(array('include_code' => false, 'include_dates' => false, 'include_report_filter' => true, 'include_private_records' => false, 'include_administrators' => false, 'include_members' => false, 'filter_types' => '{"":"what,where,when","Advanced":"source,quality"}'), $args);
     $args['filter_types'] = json_decode($args['filter_types'], true);
     $reloadPath = self::getReloadPath();
     data_entry_helper::$website_id = $args['website_id'];
     $auth = data_entry_helper::get_read_write_auth($args['website_id'], $args['password']);
     if (!empty($_GET['group_id'])) {
         self::loadExistingGroup($_GET['group_id'], $auth, $args);
     } else {
         if (!empty($args['parent_group_relationship_type']) && empty($_GET['from_group_id'])) {
             return 'This form should be called with a from_group_id parameter to define the parent when creating a new group';
         }
     }
     $r = "<form method=\"post\" id=\"entry_form\" action=\"{$reloadPath}\">\n";
     $r .= $auth['write'] . "<input type=\"hidden\" id=\"website_id\" name=\"website_id\" value=\"" . $args['website_id'] . "\" />\n";
     $r .= data_entry_helper::hidden_text(array('fieldname' => 'group:id'));
     if (!empty($args['group_type'])) {
         $r .= '<input type="hidden" name="group:group_type_id" value="' . $args['group_type'] . '"/>';
         $response = data_entry_helper::get_population_data(array('table' => 'termlists_term', 'extraParams' => $auth['read'] + array('id' => $args['group_type'])));
         self::$groupType = strtolower($response[0]['term']);
     }
     if (!empty(data_entry_helper::$entity_to_load['group:title']) && function_exists('drupal_set_title')) {
         drupal_set_title(lang::get('Edit {1}', data_entry_helper::$entity_to_load['group:title']));
     }
     $r .= data_entry_helper::text_input(array('label' => lang::get('{1} name', ucfirst(self::$groupType)), 'fieldname' => 'group:title', 'validation' => array('required'), 'class' => 'control-width-5', 'helpText' => lang::get('The full title of the {1}', self::$groupType)));
     if ($args['include_code']) {
         $r .= data_entry_helper::text_input(array('label' => lang::get('Code'), 'fieldname' => 'group:code', 'class' => 'control-width-4', 'helpText' => lang::get('A code or abbreviation identifying the {1}', self::$groupType)));
     }
     if (empty($args['group_type'])) {
         $r .= data_entry_helper::select(array('label' => lang::get('Group type'), 'fieldname' => 'group:group_type_id', 'required' => true, 'table' => 'termlists_term', 'valueField' => 'id', 'captionField' => 'term', 'extraParams' => $auth['read'] + array('termlist_external_key' => 'indicia:group_types'), 'class' => 'control-width-4'));
     }
     $r .= self::joinMethodsControl($args);
     $r .= data_entry_helper::textarea(array('label' => ucfirst(lang::get('{1} description', self::$groupType)), 'fieldname' => 'group:description', 'helpText' => lang::get('Description and notes about the {1}.', self::$groupType)));
     $r .= self::dateControls($args);
     if ($args['include_private_records']) {
         $r .= data_entry_helper::checkbox(array('label' => lang::get('Records are private'), 'fieldname' => 'group:private_records', 'helpText' => lang::get('Tick this box if you want to withold the release of the records from this {1} until a ' . 'later point in time, e.g. when a project is completed.', self::$groupType)));
     }
     $r .= self::memberControls($args, $auth);
     $r .= self::reportFilterBlock($args, $auth, $hiddenPopupDivs);
     // auto-insert the creator as an admin of the new group, unless the admins are manually specified
     if (!$args['include_administrators'] && empty($_GET['group_id'])) {
         $r .= '<input type="hidden" name="groups_user:admin_user_id[]" value="' . hostsite_get_user_field('indicia_user_id') . '"/>';
     }
     $r .= '<input type="hidden" name="groups_user:administrator" value="t"/>';
     $r .= '<input type="submit" class="indicia-button" id="save-button" value="' . (empty(data_entry_helper::$entity_to_load['group:id']) ? lang::get('Create {1}', self::$groupType) : lang::get('Update {1} settings', self::$groupType)) . "\" />\n";
     $r .= '</form>';
     $r .= $hiddenPopupDivs;
     data_entry_helper::enable_validation('entry_form');
     // JavaScript to grab the filter definition and store in the form for posting when the form is submitted
     data_entry_helper::$javascript .= "\n\$('#entry_form').submit(function() {\n  \$('#filter-title-val').val('" . lang::get('Filter for user group') . " ' + \$('#group\\\\:title').val());\n  \$('#filter-def-val').val(JSON.stringify(indiciaData.filter.def));\n});\n";
     return $r;
 }
コード例 #13
0
function _scratchy_forum_display($forums, $topics, $parents, $tid, $sortby, $forum_per_page)
{
    global $user;
    // forum list, topics list, topic browser and 'add new topic' link
    $vocabulary = taxonomy_get_vocabulary(variable_get('forum_nav_vocabulary', ''));
    $title = $vocabulary->name;
    // Breadcrumb navigation:
    $breadcrumb = array();
    if ($tid) {
        $breadcrumb[] = array('path' => 'forum', 'title' => $title);
    }
    if ($parents) {
        $parents = array_reverse($parents);
        foreach ($parents as $p) {
            if ($p->tid == $tid) {
                $title = $p->name;
            } else {
                $breadcrumb[] = array('path' => 'forum/' . $p->tid, 'title' => $p->name);
            }
        }
    }
    drupal_set_title(check_plain($title));
    $breadcrumb[] = array('path' => $_GET['q']);
    menu_set_location($breadcrumb);
    if (count($forums) || count($parents)) {
        $output = '<div class="node">
  <div class="boxtop"><div class="bc ctr"></div><div class="bc ctl"></div></div>
  <div class="boxcontent">
    <div class="subboxcontent"><div class="content"><div id="forum"><ul style="margin-top:0">';
        if (user_access('create forum topics')) {
            $output .= '<li>' . l(t('Post new forum topic.'), "node/add/forum/{$tid}") . '</li>';
        } else {
            if ($user->uid) {
                $output .= '<li>' . t('You are not allowed to post a new forum topic.') . '</li>';
            } else {
                $output .= '<li>' . t('<a href="@login">Login</a> to post a new forum topic.', array('@login' => url('user/login', drupal_get_destination()))) . '</li>';
            }
        }
        $output .= '</ul>';
        $output .= theme('forum_list', $forums, $parents, $tid);
        if ($tid && !in_array($tid, variable_get('forum_containers', array()))) {
            $output .= theme('forum_topic_list', $tid, $topics, $sortby, $forum_per_page);
            drupal_add_feed(url('taxonomy/term/' . $tid . '/0/feed'), 'RSS - ' . $title);
        }
        $output .= '</div></div></div>
  </div>
  <div class="boxbtm">
    <div class="bc cbr"></div>
    <div class="bc cbl"></div>
  </div>
</div>';
    } else {
        drupal_set_title(t('No forums defined'));
        $output = '';
    }
    return $output;
}
コード例 #14
0
ファイル: DbIssue.class.php プロジェクト: chgk/db.chgk.info
 public function view()
 {
     if (!$this->isLinkedToQuestion()) {
         return;
     }
     if ($this->page) {
         drupal_set_title($this->getTitle());
     }
 }
コード例 #15
0
ファイル: template.php プロジェクト: TommyTran1/excelpoint
/**
 * Implements hook_page_alter().
 */
function excelpoint_page_alter(&$page)
{
    if (drupal_is_front_page()) {
        drupal_set_title('');
    }
    if ($page['#type'] === 'page') {
        drupal_set_title('');
    }
}
コード例 #16
0
function futurium_isa_theme_preprocess_page(&$variables) {

  $item = menu_get_item();

  if (isset($_GET['period'])) {
    if ($_GET['q'] == 'analytics') {
      $period = str_replace('1_', ' ', $_GET['period']);
      $period = str_replace('_', ' ', $period);

      $title = drupal_get_title();
      $title .= ' - Last ' . $period;

      drupal_set_title($title);
    }
  }

  if (!user_is_logged_in()) {
    unset($variables['tabs']);
  }

  unset($variables['navbar_classes_array'][1]);
  $variables['navbar_classes_array'][] = 'container-fullwidth';

  if (!empty($variables['page']['sidebar_first']) && !empty($variables['page']['sidebar_second'])) {
    $variables['content_column_class'] = ' class="col-sm-6"';
  }
  elseif (!empty($variables['page']['sidebar_first']) || !empty($variables['page']['sidebar_second'])) {
    $variables['content_column_class'] = ' class="col-sm-9"';
  }
  else {
    $variables['content_column_class'] = ' class="container-fullwidth"';
  }

  $search_form = drupal_get_form('search_form');
  $search_box = drupal_render($search_form);
  $variables['search_box'] = $search_box;

  $panels_callbacks = array(
    'page_manager_page_execute',
    'page_manager_node_view_page',
    'page_manager_user_view_page',
    'page_manager_user_edit_page',
    'page_manager_node_add',
    'page_manager_node_edit',
    'page_manager_term_view_page',
    'entity_translation_edit_page',
    'user_pages_user_users',
    'user_pages_user_user_login',
    'user_pages_user_user_register',
    'user_pages_user_user_password',
  );

  $variables['content_wrapper'] = !in_array($item['page_callback'], $panels_callbacks, TRUE);

  $variables['show_title'] = $variables['content_wrapper'];

}
コード例 #17
0
ファイル: Drupal.php プロジェクト: hampelm/Ginsberg-CiviDemo
 /**
  * sets the title of the page
  *
  * @param string $title
  * @paqram string $pageTitle
  *
  * @return void
  * @access public
  */
 function setTitle($title, $pageTitle = null)
 {
     if (!$pageTitle) {
         $pageTitle = $title;
     }
     if (arg(0) == 'civicrm') {
         //set drupal title
         drupal_set_title($pageTitle);
     }
 }
コード例 #18
0
ファイル: quotes.inc.php プロジェクト: itorres/drupal-budgets
function budgets_quote_add($provider)
{
    global $user;
    $types = node_get_types();
    $type = 'supplier_quote';
    // Initialize settings:
    $node = array('uid' => $user->uid, 'name' => isset($user->name) ? $user->name : '', 'type' => $type, 'language' => '', 'supplier_id' => $provider->id);
    drupal_set_title(t('Create @name', array('@name' => $types[$type]->name)));
    return drupal_get_form($type . '_node_form', $node);
}
コード例 #19
0
 function list_page($js, $input)
 {
     if ($substitute = $this->entity_handler->get_substitute($this->entity_view_mode, $this->entity_bundle)) {
         $url = $this->plugin['menu']['menu prefix'] . '/' . $substitute;
         drupal_set_message(t('This display is managed by the !view_mode display.', array('!view_mode' => l($substitute, $url))), 'status', FALSE);
         return '';
     }
     drupal_set_title($this->entity_handler->get_bundle_title($this->entity_bundle));
     return parent::list_page($js, $input);
 }
コード例 #20
0
/**
 * Page to add the node ; this generates a node_add_form page
 *
 */
function _nodereferrer_create_create($node, $referrer_field_idx, $referrer_type, $referrence_field_idx)
{
    global $user;
    drupal_set_title(check_plain($node->title));
    _nodereferrer_create_referrer_signal(array('type' => $referrer_type, 'field' => $node->referrers[$referrer_field_idx]['referrence'][$referrer_type][$referrence_field_idx]['field_name'], 'nid' => $node->nid, 'title' => $node->title, 'add' => false));
    // Make sure we have the pages we want
    module_load_include('pages.inc', 'node');
    //Initialize new node
    $new_node = array('uid' => $user->uid, 'name' => $user->name, 'type' => $referrer_type);
    return drupal_get_form($referrer_type . '_node_form', $new_node);
}
コード例 #21
0
 /**
  * Add entity page.
  */
 function add_entity_page($js, $input, $item, $step = NULL)
 {
     drupal_set_title($this->get_page_title('add_entity', $item));
     $form_state = array('entity' => fieldable_panels_panes_create(array('bundle' => $item->name)), 'add submit' => TRUE, 'plugin' => $this->plugin, 'object' => &$this, 'ajax' => $js, 'item' => $item, 'op' => 'add_entity', 'no_redirect' => TRUE, 'rerender' => TRUE, 'step' => $step, 'function args' => func_get_args());
     // Default these to reusable.
     $form_state['entity']->reusable = TRUE;
     $output = drupal_build_form('fieldable_panels_panes_entity_edit_form', $form_state);
     if (!empty($form_state['executed'])) {
         $this->redirect($form_state['op'], $form_state['item']);
     }
     return $output;
 }
コード例 #22
0
ファイル: page.vars.php プロジェクト: benjohnstone/wwyd
/**
 * Pre-processes variables for the "page" theme hook.
 *
 * See template for list of available variables.
 *
 * @see page.tpl.php
 *
 * @ingroup theme_preprocess
 */
function walk_preprocess_page(&$vars)
{
    // Add information about the number of sidebars.
    if (!empty($vars['page']['sidebar_first']) && !empty($vars['page']['sidebar_second'])) {
        $vars['content_column_class'] = ' class="col-sm-6"';
    } elseif (!empty($vars['page']['sidebar_first']) || !empty($vars['page']['sidebar_second'])) {
        $vars['content_column_class'] = ' class="col-sm-9"';
    } else {
        $vars['content_column_class'] = ' class="col-sm-12"';
    }
    if (bootstrap_setting('fluid_container') == 1) {
        $vars['container_class'] = 'container-fluid';
    } else {
        $vars['container_class'] = 'container';
    }
    // Primary nav.
    $vars['primary_nav'] = FALSE;
    if ($vars['main_menu']) {
        // Build links.
        $vars['primary_nav'] = menu_tree(variable_get('menu_main_links_source', 'main-menu'));
        // Provide default theme wrapper function.
        $vars['primary_nav']['#theme_wrappers'] = array('menu_tree__primary');
    }
    // Secondary nav.
    $vars['secondary_nav'] = FALSE;
    if ($vars['secondary_menu']) {
        // Build links.
        $vars['secondary_nav'] = menu_tree(variable_get('menu_secondary_links_source', 'user-menu'));
        // Provide default theme wrapper function.
        $vars['secondary_nav']['#theme_wrappers'] = array('menu_tree__secondary');
    }
    $vars['navbar_classes_array'] = array('navbar');
    if (bootstrap_setting('navbar_position') !== '') {
        $vars['navbar_classes_array'][] = 'navbar-' . bootstrap_setting('navbar_position');
    } elseif (bootstrap_setting('fluid_container') == 1) {
        $vars['navbar_classes_array'][] = 'container-fluid';
    } else {
        $vars['navbar_classes_array'][] = 'container';
    }
    if (bootstrap_setting('navbar_inverse')) {
        $vars['navbar_classes_array'][] = 'navbar-inverse';
    } else {
        $vars['navbar_classes_array'][] = 'navbar-default';
    }
    if (arg(0) == 'node' && arg(1) == 'add' && arg(2) == 'walk') {
        drupal_set_title('Hosting a Walk');
    }
    if (isset($vars['node']) && $vars['node']->nid == 12) {
        //dpm($vars);
        hide($vars['page']['content']['system_main']['nodes']);
    }
}
コード例 #23
0
ファイル: template.php プロジェクト: charx0r/time
/**
 * Override or insert variables into the page templates.
 *
 * @param $variables
 *   An array of variables to pass to the theme template.
 * @param $hook
 *   The name of the template being rendered ("page" in this case.)
 */
function itetaps_zen_preprocess_page(&$variables, $hook)
{
    //$variables['sample_variable'] = t('Lorem ipsum.');
    if (isset($variables['page']['content']['system_main']['default_message'])) {
        unset($variables['page']['content']['system_main']['default_message']);
        drupal_set_title('');
    }
    if (isset($variables['node'])) {
        // If the content type's machine name is "my_machine_name" the file
        // name will be "page--my-machine-name.tpl.php".
        $variables['theme_hook_suggestions'][] = 'page__' . $variables['node']->type;
    }
}
コード例 #24
0
function guifi_live_traceroute($device_id)
{
    if (empty($device_id)) {
        $output = t('Target device not specified.');
    } else {
        $gs = guifi_service_load(guifi_graphs_get_server($device_id, 'device'));
        $ipd = guifi_main_ip($device_id);
        $ipf = guifi_main_ip($gs->device_id);
    }
    $title = t('Live traceroute from %from (%ipf) to %dest (%ipd)', array('%ipd' => $ipd['ipv4'], '%dest' => guifi_get_hostname($device_id), '%ipf' => $ipf['ipv4'], '%from' => guifi_get_hostname($gs->device_id)));
    drupal_set_title($title);
    print theme('page', guifi_cnml_live('livetraceroute', $device_id, $ipd['ipv4'], $gs), FALSE);
    exit;
}
コード例 #25
0
/**
 * Implements template_preprocess_page().
 */
function bootstrap_preprocess_page(&$variables)
{
    $left_col = array('col-xs-12', 'col-sm-12', 'col-md-12');
    if (isset($variables['page']['sidebar']) && $variables['page']['sidebar']) {
        $left_col = array('col-xs-12', 'col-sm-8', 'col-md-8');
    }
    $breadcrumb_attr = array('id' => 'breadcrumbs', 'class' => array('col-xs-12', 'col-sm-12', 'col-md-12'));
    $left_col_attr = array('id' => 'left-content', 'class' => $left_col, 'role' => 'main');
    $right_col_attr = array('id' => 'right-content', 'class' => array('col-xs-12', 'col-sm-4', 'col-md-3'), 'role' => 'complementary');
    $variables['breadcrumb_attributes_array'] = $breadcrumb_attr;
    $variables['breadcrumb_attributes'] = drupal_attributes($breadcrumb_attr);
    $variables['left_col_attributes'] = drupal_attributes($left_col_attr);
    $variables['right_col_attributes'] = drupal_attributes($right_col_attr);
    global $user;
    $path = current_path();
    if (user_is_anonymous()) {
        switch ($path) {
            case 'user':
            case 'user/login':
                drupal_set_title(t('Log in'));
                $variables['title'] = t('Log in');
                break;
            case 'user/register':
                drupal_set_title(t('Create new account'));
                $variables['title'] = t('Create new account');
                break;
            case 'user/password':
                drupal_set_title(t('Request new password'));
                $variables['title'] = t('Request new password');
                break;
        }
    } else {
        switch ($path) {
            case 'user':
            case 'user/' . $user->uid . '/edit':
                drupal_set_title('My profile');
                break;
            case 'user/' . $user->uid . '/shortcuts':
                drupal_set_title('My shortcuts');
                break;
            case 'user/' . $user->uid . '/devel':
            case 'user/' . $user->uid . '/devel/load':
                drupal_set_title('User devel load');
                break;
            case 'user/' . $user->uid . '/devel/render':
                drupal_set_title('User devel render');
                break;
        }
    }
}
コード例 #26
0
ファイル: template.php プロジェクト: agroknow/mermix
/**
 * Implements HOOK_preprocess_THEME()
 * @param $variables
 */
function realia_preprocess_page(&$variables)
{
    if (arg(0) == 'node' && arg(2) == 'edit' && isset($variables['node'])) {
        $nodeObj = $variables['node'];
        if ($nodeObj->type == 'apartment') {
            drupal_set_title(t('Edit Machinery @title', array('@title' => $nodeObj->title)));
        }
    }
    if (current_path() == 'node/add/apartment') {
        drupal_set_title(t('Add your machine'));
    }
    $status = drupal_get_http_header("status");
    if ($status == "404 Not Found") {
        $variables['theme_hook_suggestions'][] = 'page__404';
    }
}
コード例 #27
0
function bootstrap_theme_pending_approval_page()
{
    bootstrap_theme_set_page_content_class('pending-approval-page');
    bootstrap_theme_set_page_title_class('only-line');
    drupal_set_title('Pending Approval');
    $output = '';
    $output .= '<div class="contribution-list">';
    $output .= '<h3>Contributions</h3>';
    $output .= _bootstrap_theme_pending_approval_contributions();
    $output .= '</div>';
    $output .= '<div class="reported-list">';
    $output .= '<h3>Reported</h3>';
    $output .= _bootstrap_theme_pending_approval_reported_contents();
    $output .= '</div>';
    return $output;
}
コード例 #28
0
/**
 * Overrides theme_filter_tips().
 */
function bootstrap_subtheme_filter_tips($variables)
{
    global $user;
    drupal_set_title('');
    // Create a place holder for the tabs.
    $build['tabs'] = array('#theme' => 'item_list', '#items' => array(), '#attributes' => array('class' => array('nav', 'nav-tabs'), 'role' => 'tablist'));
    // Create a placeholder for the panes.
    $build['panes'] = array('#theme_wrappers' => array('container'), '#attributes' => array('class' => array('tab-content')));
    $format_id = arg(2);
    $current_path = current_path();
    $formats = filter_formats($user);
    $filter_info = filter_get_filters();
    foreach ($formats as $format) {
        $tab = array('data' => array('#type' => 'link', '#title' => check_plain($format->name), '#href' => $current_path, '#attributes' => array('role' => 'tab', 'data-toggle' => 'tab'), '#options' => array('fragment' => $format->format)));
        if (!$format_id || $format_id === $format->format) {
            $tab['class'][] = 'active';
            $format_id = $format->format;
        }
        $build['tabs']['#items'][] = $tab;
        // Retrieve each filter in the format.
        $tips = array();
        $filters = filter_list_format($format->format);
        foreach ($filters as $name => $filter) {
            if ($filter->status && isset($filter_info[$name]['tips callback']) && is_callable($filter_info[$name]['tips callback'])) {
                $tip = $filter_info[$name]['tips callback']($filter, $format, TRUE);
                if (isset($tip)) {
                    $tips[] = $tip;
                }
            }
        }
        // Construct the pane.
        $pane = array('#theme_wrappers' => array('container'), '#attributes' => array('class' => array('tab-pane', 'fade'), 'id' => $format->format));
        if (count($tips) === 1) {
            $pane['list'] = array('#markup' => $tips[0]);
        } else {
            $pane['list'] = array('#theme' => 'item_list', '#items' => $tips);
        }
        if ($format_id === $format->format) {
            $pane['#attributes']['class'][] = 'active';
            $pane['#attributes']['class'][] = 'in';
            $format_id = $format->format;
        }
        $build['panes'][] = $pane;
    }
    return drupal_render($build);
}
コード例 #29
0
/**
 * Page to add the node ; this generates a node_add_form page
 *
 */
function _nodereferrer_create_create_reference($node, $reference_field_idx, $reference_type)
{
    global $user;
    drupal_set_title(check_plain($node->title));
    _nodereferrer_create_reference_signal(array('type' => $reference_type, 'nid' => $node->nid, 'title' => $node->title));
    // Make sure we have the pages we want
    module_load_include('pages.inc', 'node');
    //Initialize new node
    $form_id = $reference_type . '_node_form';
    $new_node = array('uid' => $user->uid, 'name' => $user->name, 'type' => $reference_type);
    $form = _nodereferrer_create_get_form($form_id, $new_node);
    if (!isset($_SESSION['nodereferrer_create'])) {
        $_SESSION['nodereferrer_create'] = array();
    }
    $_SESSION['nodereferrer_create'][] = array('form_build_id' => $form['form_build_id'], 'nid' => $node->nid, 'reference_field_idx' => $reference_field_idx);
    return $form['form'];
}
コード例 #30
0
ファイル: AssignmentEditor.php プロジェクト: md353/demo
function groupgrade_createproblem_dash()
{
    global $user;
    drupal_set_title(t('Assignment Editor'));
    $assignment_ed = Assignment::where('user_ids', '=', $users->uids)->orderBy('assign_id', 'desc')->get();
    $return = '';
    $return .= '<h3>Assignment Editor</h3>';
    $return .= sprintf('<p><a href="%s">%s</a></p>', url('class/assignmentseditor'), t('Create Assignment'));
    $return .= sprintf('<p>%s</p>', t('Select "View" to manage an existing assignment: edit it, assign it to or remove it from a section, change its start date, etc.'));
    $rows = array();
    if (count($assignment_ed) > 0) {
        foreach ($assignment_ed as $assignee) {
            $rows[] = array($assignee->assignment_name, '<a href="' . url('class/instructor/class/' . $assignee->assign_id) . '">View</a>');
        }
    }
    $return .= theme('table', array('rows' => $rows, 'header' => array('Title', '# of Sections', 'Operations'), 'empty' => 'No assignments found.', 'attributes' => array('width' => '100%')));
    return $return;
}