コード例 #1
0
ファイル: template.php プロジェクト: navster/camp-adair
function aut_preprocess_page(&$vars)
{
    // Add page template suggestions based on the aliased path. For instance, if the current page has an alias of about/history/early, we'll have templates of:
    // page-about-history-early.tpl.php, page-about-history.tpl.php, page-about.tpl.php
    // Whichever is found first is the one that will be used.
    if (module_exists('path')) {
        $alias = drupal_get_path_alias(str_replace('/edit', '', $_GET['q']));
        if ($alias != $_GET['q']) {
            $template_filename = 'page';
            foreach (explode('/', $alias) as $path_part) {
                $template_filename = $template_filename . '-' . $path_part;
                $vars['template_files'][] = $template_filename;
            }
        }
    }
    // Get the entire main menu tree
    $main_menu_tree = menu_tree_all_data('main-menu');
    // Add the rendered output to the $main_menu_expanded variables
    //$vars['main_menu_expanded'] = menu_tree_output($main_menu_tree);
    $vars['main_menu_expanded'] = aut_return_menu_markup('main-menu');
    // Search Toggle
    $vars['search'] = FALSE;
    if (theme_get_setting('toggle_search') && module_exists('search')) {
        $vars['search'] = drupal_get_form('aut_search_form');
    }
}
コード例 #2
0
ファイル: connect_blocks.php プロジェクト: rnao/Connect
function connect_block_view($nid = 0)
{
    $return = array();
    $parent_node = node_load($nid);
    if ($parent_node) {
        $parent_node =& _connect_parent_node($parent_node);
        // only display if the block option is turned on
        //$parent_actions = connect_get_actions($nid);
        if (!in_array('connect_action_provide_block', connect_get_actions($nid))) {
            return;
        }
        // require a CAPTCHA on the form?
        if (!_connect_captcha_test('connect_form_block')) {
            return;
        }
        // visibility control
        $visibility = connect_node_options($nid, 'provide_block_visibility');
        if ($visibility > 0) {
            $parent_path = "node/{$nid}";
            $current_path = arg(0) . '/' . arg(1);
            if ($visibility == CONNECT_BLOCK_NOT_PARENT && $parent_path == $current_path || $visibility == CONNECT_BLOCK_PARENT_ONLY && $parent_path != $current_path) {
                return;
            }
        }
        $form = drupal_get_form('connect_form_block', 'block', $nid);
        $text = connect_node_options($nid, 'provide_block_text');
        $link = empty($text) ? '' : '<p>&raquo;&nbsp;' . l($text, "node/{$nid}") . '</p>';
        $return['subject'] = $parent_node->title;
        $return['content'] = $form . $link;
    }
    return $return;
}
コード例 #3
0
    return $output;
}
function storelocator_app_block_filter_opening($language)
{
    drupal_add_css(drupal_get_path('module', 'storelocator_app') . '/css/storelocator_app.form.css');
    $output = theme_block_filter_opening(drupal_get_form('storelocator_app_block_filter_form_opening', $language), $language);
    //theme_block_filter_opening(drupal_get_form('storelocator_app_block_filter_form_opening', $language), $language);
コード例 #4
0
/**
 * Registers forms with Bootstrap to be displayed as modals.
 *
 * This example registers the sitewide "Contact Us" form.
 *
 * @return array
 */
function hook_bootstrap_modal_forms()
{
    module_load_include('inc', 'contact', 'contact.pages');
    $items = array();
    $items['contact_modal_form'] = array('form' => drupal_get_form('contact_site_form'), 'title' => t('Contact Us'), 'action' => 'contact');
    return $items;
}
コード例 #5
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;
}
コード例 #6
0
ファイル: update.php プロジェクト: berkes/sympal
function update_selection_page()
{
    drupal_set_title('Drupal database update');
    $output = drupal_render(drupal_get_form('update_script_selection_form'));
    update_task_list('select');
    return $output;
}
コード例 #7
0
ファイル: template.php プロジェクト: freighthouse/code
function apigee_bootstrap_preprocess_page(&$vars)
{
    if (isset($vars['node']->type)) {
        $vars['theme_hook_suggestions'][] = 'page__' . $vars['node']->type;
    }
    $search_box = drupal_render(drupal_get_form('search_form'));
    $vars['search_box'] = $search_box;
}
コード例 #8
0
 public function test_osha_workflow_workbench_project_managers_form()
 {
     $_GET['q'] = 'admin/config/workbench/access/managers';
     module_load_include('inc', 'osha_workflow', 'osha_workflow.admin');
     $form = drupal_get_form('osha_workflow_workbench_project_managers_form');
     $this->assertNotNull($form);
     $this->assertArrayHasKey('main-menu', $form['rows']);
 }
コード例 #9
0
 /**
  * Implements CqQuestionAbstract::getOutput()
  */
 public function getOutput()
 {
     $this->initialise();
     $retval = drupal_get_form('closedquestion_get_form_for', $this->node);
     $retval['#prefix'] = $this->prefix;
     $retval['#suffix'] = $this->postfix;
     return $retval;
 }
コード例 #10
0
ファイル: template.php プロジェクト: NISR/web_d7
function porto_sub_preprocess_page(&$variables)
{
    if ($variables['is_front']) {
        //Add the search box on the frontpage
        $form = drupal_get_form('search_block_form');
        $variables['search'] = drupal_render($form);
    }
}
コード例 #11
0
function update_selection_page()
{
    $output = '<p>The version of Drupal you are updating from has been automatically detected. You can select a different version, but you should not need to.</p>';
    $output .= '<p>Click Update to start the update process.</p>';
    drupal_set_title('Drupal database update');
    $output .= drupal_get_form('update_script_selection_form');
    update_task_list('select');
    return $output;
}
コード例 #12
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'];

}
コード例 #13
0
ファイル: template.php プロジェクト: singhneeraj/im-portal
/**
 * Implements template_preprocess_views_view().
 * Change the "Change to Draft" link open in Popup mode.
 * IM-13 : Action: Return the Publication
 * @param $vars
 */
function adaptivetheme_admin_preprocess_views_view(&$vars)
{
    $view = $vars['view'];
    if ($view->name == "workbench_moderation") {
        $output = !empty($vars['rows']) ? $vars['rows'] : $vars['empty'];
        $form = drupal_get_form(views_form_id($view), $view, $output);
        $vars['rows'] = $form;
    }
}
コード例 #14
0
 /**
  * {@inheritdoc}
  */
 public function postBuild(array &$build, ObjectInterface $context = NULL)
 {
     if ($context instanceof MapInterface) {
         $olebs_blockswitcher_form = drupal_get_form('olebs_blockswitcher_form', $context);
         // This can rely in the id of the map instead of the css class.
         $olebs_blockswitcher_form['map']['#value'] = $context->getId();
         $build['BlockLayerSwitcher'] = array('#type' => 'fieldset', '#title' => 'Layer Switcher', '#collapsible' => TRUE, '#collapsed' => TRUE, 'form' => $olebs_blockswitcher_form);
     }
 }
コード例 #15
0
function brukar_server_admin_applications_users($app)
{
    $res['add'] = drupal_get_form('brukar_server_admin_applications_users_add', $app);
    $res['users'] = array('#theme' => 'table', '#header' => array(t('Name'), t('Level'), t('Status'), t('Operations')), '#rows' => array());
    foreach (db_select('brukar_access', 'a')->fields('a')->execute() as $row) {
        $res['users']['#rows'][] = array(array('data' => user_load($row->uid)->name), array('data' => '-'), array('data' => $row->active == 0 ? t('Inactive') : t('Active')), array('data' => array('#theme' => 'links', '#attributes' => array('class' => array('links', 'inline')), '#links' => array('change' => array('title' => t('change'), 'href' => 'admin/structure/brukar/application/' . $app->id . '/users/change/' . $row->id), 'remove' => array('title' => t('remove'), 'href' => 'admin/structure/brukar/application/' . $app->id . '/users/remove/' . $row->id)))));
    }
    return $res;
}
コード例 #16
0
function storelocator_app_block_overlay_store($language)
{
    drupal_add_css(drupal_get_path('module', 'storelocator_app') . '/css/storelocator_app.form.css');
    drupal_add_js(drupal_get_path('module', 'storelocator_app') . '/js/storelocator_block_search_overlay.js');
    drupal_add_js(drupal_get_path('module', 'storelocator_app') . '/js/plugins/jquery.maphilight.min.js');
    drupal_add_js(drupal_get_path('module', 'storelocator_app') . '/js/plugins/jquery.bgiframe.min.js');
    $output = '';
    $output .= theme_block_overlay_store_form(drupal_get_form('storelocator_app_block_overlay_store_form', $language), $language);
    return $output;
}
コード例 #17
0
function brukar_client_403_admin()
{
    $page['variables'] = drupal_get_form('brukar_client_403_admin_values');
    $page['rules'] = array('#theme' => 'table', '#header' => array('Token', 'URL'), '#rows' => array());
    foreach (db_select('brukar_client_403', 'm')->fields('m')->execute() as $message) {
        $page['rules']['#rows'][] = array(l($message->token, 'admin/config/people/brukar/403/' . $message->id), l('brukar/403/' . $message->token, 'brukar/403/' . $message->token));
    }
    $page['create'] = drupal_get_form('brukar_client_403_admin_form');
    return $page;
}
コード例 #18
0
ファイル: template.php プロジェクト: eganr/nba-draft-lookup
/**
 * Implements template_preprocess_page().
 */
function nbadraft_preprocess_page(&$variables)
{
    // Add copyright to theme.
    if ($copyright = theme_get_setting('copyright')) {
        $variables['copyright'] = check_markup($copyright['value'], $copyright['format']);
    }
    if (drupal_is_front_page()) {
        $variables['main_form'] = drupal_render(drupal_get_form('nbadraft_main_form'));
    }
}
コード例 #19
0
function bootstrap_sauvages_preprocess_page(&$vars)
{
    if (isset($vars['node']->type)) {
        $vars['theme_hook_suggestions'][] = 'page__' . $vars['node']->type;
        if (module_exists('comment')) {
            //$vars['comments'] = comment_node_view($vars['node'],'full');
            $vars['comment_form'] = drupal_get_form("comment_node_{$vars['node']->type}_form", (object) array('nid' => $vars['node']->nid));
        }
    }
}
コード例 #20
0
function bootstrap_theme_messages_list($form = null, $form_state = null)
{
    if ($form == null && $form_state == null) {
        $form = drupal_get_form('bootstrap_theme_messages_list_form');
        $form_output = drupal_render($form);
    } else {
        $form_output = drupal_render(drupal_rebuild_form('bootstrap_theme_messages_list_form', $form_state));
    }
    return '<div id="messages-list">' . $form_output . '</div>';
}
コード例 #21
0
 public function drupal_form($form_name = null, $args = array())
 {
     // @drupal API (v6)
     $file = drupal_get_path('module', $this->module_name) . '/form/' . $form_name . '.inc';
     if (file_exists($file)) {
         require_once $file;
         // @drupal API (v6)
         return drupal_get_form($this->module_name . '_' . $form_name . '_form', $args);
     }
     return FALSE;
 }
コード例 #22
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);
}
コード例 #23
0
ファイル: admin.php プロジェクト: ryne-andal/ablecore
function action_delete($identifier)
{
    // Load the item.
    $relationship = MenuPathRelationship::load($identifier);
    if ($relationship === false) {
        drupal_not_found();
        return '';
    }
    // Prepare the form.
    return drupal_get_form('ablecore_menu_delete_relationship', $relationship);
}
コード例 #24
0
ファイル: template.php プロジェクト: nningego/townsquare
/**
 * Implements theme_preprocess_page().
 */
function townsquare_bootstrap_preprocess_page(&$vars)
{
    global $user;
    $vars['primary_local_tasks'] = menu_primary_local_tasks();
    $vars['secondary_local_tasks'] = menu_secondary_local_tasks();
    // The following menu stuff is lame
    foreach ($vars['main_menu'] as $item => $options) {
        $vars['main_menu'][$item]['html'] = TRUE;
        $vars['main_menu'][$item]['attributes']['id'] = 'menu-link-' . drupal_clean_css_identifier($options['href']);
    }
    $admin_menu = menu_tree_all_data('management');
    $children = array_pop($admin_menu);
    if ($children) {
        foreach ($children['below'] as $key => $value) {
            $children['below'][$key]['below'] = array();
        }
        $vars['admin_menu'] = menu_tree_output($children['below']);
    }
    // Add user picture if logged in
    if ($user->uid) {
        $vars['user_name'] = check_plain($user->name);
        if (!empty($user->picture)) {
            if (is_numeric($user->picture)) {
                $user->picture = file_load($user->picture);
            }
            if (!empty($user->picture->uri)) {
                $filepath = $user->picture->uri;
            }
        } elseif (variable_get('user_picture_default', '')) {
            $filepath = variable_get('user_picture_default', '');
        }
        if (isset($filepath)) {
            $alt = t("@user's picture", array('@user' => format_username($user)));
            if (module_exists('image') && file_valid_uri($filepath) && ($style = variable_get('user_picture_style', ''))) {
                $vars['user_picture'] = theme('image_style', array('style_name' => $style, 'path' => $filepath, 'alt' => $alt, 'title' => $alt));
            } else {
                $vars['user_picture'] = theme('image', array('path' => $filepath, 'alt' => $alt, 'title' => $alt));
            }
        } else {
            $vars['user_picture'] = '<i class="icon-user"></i>';
        }
    } else {
        unset($vars['secondary_menu']);
        $vars['login'] = drupal_get_form('user_login_block');
    }
    // Add Bootstrap
    $path = libraries_get_path('bootstrap');
    drupal_add_css($path . '/css/bootstrap.css');
    drupal_add_css($path . '/css/bootstrap-responsive.css');
    drupal_add_js($path . '/js/bootstrap.js');
    $path = libraries_get_path('font-awesome');
    drupal_add_css($path . '/css/font-awesome.css');
}
コード例 #25
0
 public function getForm()
 {
     $node = $this->getNode();
     if (!$this->canEdit()) {
         return '';
     }
     if (!$node) {
         $node = array('type' => 'question_meta', 'uid' => $user->uid, 'name' => $user->name);
     }
     $form = drupal_get_form('question_meta_node_form', $node);
     return $form;
 }
コード例 #26
0
function seotools_wordstream_wordstream_free_embed_id()
{
    $setting = array();
    $setting['title'] = 'Free widgets embed id';
    if (variable_get('wordstream_free_embed_id', '') == '') {
        $setting['value'] = drupal_get_form('seotools_wordstream_wordstream_free_embed_id_form');
        $setting['severity'] = REQUIREMENT_ERROR;
    } else {
        $setting['value'] = 'Wordstream Free widgets embed id: ' . variable_get('wordstream_free_embed_id', '');
        $setting['severity'] = REQUIREMENT_OK;
    }
    return $setting;
}
コード例 #27
0
ファイル: template.php プロジェクト: Akenward/sand_theme
/**
 * Implements template_preprocess_node, replacing selected static 
 * field values with form elements that allow them to be edited.
 */
function sand_theme_preprocess_node(&$variables)
{
    // Only applies to specific node type 'request'
    if ($variables['type'] == 'request') {
        //We don't need to show comments or links with this form
        if (isset($variables['content']['comments'])) {
            unset($variables['content']['comments']);
        }
        if (isset($variables['content']['links'])) {
            unset($variables['content']['links']);
        }
        // Call the form builder function for 'request_updater'
        // with current node->nid as an extra parameter
        $status_form = drupal_get_form('request_updater', $variables['nid']);
        $weight_max = -999;
        // Check whether there is a returned form that can be displayed
        if ($status_form['#access']) {
            foreach ($status_form['fields_replaced']['#value'] as $field) {
                // For each field in the form with a corresponding static field that has
                // been populated, copy the weight of the static field to the form
                // element and delete the static element.
                if (isset($variables['content'][$field])) {
                    $status_form[$field]['#weight'] = $variables['content'][$field]['#weight'];
                    $weight_max = max($weight_max, $status_form[$field]['#weight']);
                    unset($variables['content'][$field]);
                } else {
                    $inst = field_info_instance('node', $field, 'request');
                    $status_form[$field]['#weight'] = $inst['display']['default']['weight'];
                    $weight_max = max($weight_max, $status_form[$field]['#weight']);
                }
            }
            // Node fields that have been populated and not matched to a form element just stay
            // as they are
            foreach ($variables['content'] as $field => $status) {
                if (isset($variables['content'][$field]['#weight'])) {
                    $weight_max = max($weight_max, $variables['content'][$field]['#weight']);
                }
            }
            // Merge the elements of the form with the remaining content elements into
            // the content array.
            $variables['content'] = array_merge($status_form, $variables['content']);
            // $weight_max should now equal to the largest weight of any content element
            // so add 1 to make sure that the 'Save' button appears at the bottom
            $variables['content']['submit_button']['#weight'] = $weight_max + 1;
        } else {
            // If there's no form to be displayed, no change is made to the content array
            // and we still have the regular static display for the node
        }
    }
}
コード例 #28
0
ファイル: template.php プロジェクト: e2thex/lalalemonade
function flower_user_bar()
{
    global $user;
    $output = '';
    if (!$user->uid) {
        $output .= t('<p class="welcome">Welcome, Guest.<br />Please login or <a href="' . $base_path . 'user/register">register</a>.<br /><a href="' . $base_path . 'user/password">Request Password</a></p>');
        $output .= drupal_get_form('user_login_block');
    } else {
        $output .= t('<p class="user-info">Welcome !user.</p>', array('!user' => theme('username', $user)));
        $output .= theme('item_list', array(l(t('Your account'), 'user/' . $user->uid, array('title' => t('Edit your account'))), l(t('Logout'), 'logout')));
    }
    $output = '<div id="user-bar">' . $output . '</div>';
    return $output;
}
コード例 #29
0
ファイル: DbPeople.class.php プロジェクト: chgk/db.chgk.info
 public function getAllHtml()
 {
     #        $this->loadPeople();
     $output = '';
     $output .= drupal_get_form('chgk_db_people_filter_form');
     $output .= $this->getTableHtml();
     /*                $output .= '<table><tr><th>Фамилия, имя</th><th>Количество турниров</th><th>Количество вопросов</th></tr>'."\n";
             $i=1;
             foreach ($this->people as $person) {
     #          $output.=get_tr(        <td>".$person->getLink()."</td><td>".$person->getToursNumber()."</td><td>".$person->getQuestionsNumber()
             }
             $output.="</table>";*/
     return $output;
 }
コード例 #30
0
ファイル: blockSupport.php プロジェクト: ChapResearch/CROMA
function blockLoadForms(&$blockInfo, &$blockViewFns, $blocksArray)
{
    foreach ($blocksArray as $block) {
        $subject = t($block["title"]);
        if (isset($block["subject"])) {
            $subject = t($block["subject"]);
        }
        $blockInfo[$block["id"]] = array("info" => t($block["title"]), "cache" => DRUPAL_CACHE_GLOBAL);
        $blockViewFns[$block["id"]] = function (&$b) use($block, $subject) {
            $b['subject'] = $subject;
            $b['content'] = drupal_get_form($block["form"]);
        };
    }
}