/**
 * Implements hook_form_FORM_ID_alter().
 */
function foundation_access_form_system_theme_settings_alter(&$form, &$form_state)
{
    $form['zurb_foundation']['foundation_access'] = array('#type' => 'fieldset', '#title' => t('Foundation Access'));
    // system label
    $distro = variable_get('install_profile', 'standard');
    $reg = _cis_connector_build_registry($distro);
    $system = theme_get_setting('foundation_access_system_label');
    $form['zurb_foundation']['foundation_access']['foundation_access_system_label'] = array('#type' => 'textfield', '#title' => t('Service label'), '#description' => t('The name displayed at the top left to indicate to users what system they are using. Defaults to the one provided by the registry.'), '#default_value' => empty($system) ? $reg['default_title'] : $system);
    // allow for jquery colorpicker selection widget
    if (module_exists('jquery_colorpicker')) {
        $fieldtype = 'jquery_colorpicker';
    } else {
        $fieldtype = 'textfield';
    }
    $form['zurb_foundation']['foundation_access']['foundation_access_primary_color'] = array('#type' => $fieldtype, '#size' => 6, '#maxlength' => 6, '#title' => t('Primary Color'), '#description' => t('Primary color to apply throughout the system'), '#default_value' => theme_get_setting('foundation_access_primary_color'));
}
Exemple #2
0
/**
 * Implements hook_form_FORM_ID_alter().
 */
function foundation_access_form_system_theme_settings_alter(&$form, &$form_state)
{
    $form['zurb_foundation']['foundation_access'] = array('#type' => 'fieldset', '#title' => t('Foundation Access'));
    // system label
    $distro = variable_get('install_profile', 'standard');
    $reg = _cis_connector_build_registry($distro);
    $system = theme_get_setting('foundation_access_system_label');
    $form['zurb_foundation']['foundation_access']['foundation_access_system_label'] = array('#type' => 'textfield', '#title' => t('Service label'), '#description' => t('The name displayed at the top left to indicate to users what system they are using. Defaults to the one provided by the registry.'), '#default_value' => empty($system) ? $reg['default_title'] : $system);
    // allow for jquery colorpicker selection widget
    if (module_exists('jquery_colorpicker')) {
        $fieldtype = 'jquery_colorpicker';
    } else {
        $fieldtype = 'textfield';
    }
    $form['zurb_foundation']['foundation_access']['foundation_access_primary_color'] = array('#type' => $fieldtype, '#size' => 6, '#maxlength' => 6, '#title' => t('Primary Color'), '#description' => t('Primary color to apply throughout the system'), '#default_value' => theme_get_setting('foundation_access_primary_color'));
    $form['zurb_foundation']['foundation_access']['foundation_access_secondary_color'] = array('#type' => $fieldtype, '#size' => 6, '#maxlength' => 6, '#title' => t('Secondary Color'), '#description' => t('A Secondary color to apply throughout the system'), '#default_value' => theme_get_setting('foundation_access_secondary_color'));
    $form['zurb_foundation']['foundation_access']['foundation_access_required_color'] = array('#type' => $fieldtype, '#size' => 6, '#maxlength' => 6, '#title' => t('Required Color'), '#description' => t('Tasks and lists that are required will pick up this color'), '#default_value' => theme_get_setting('foundation_access_required_color'));
    $form['zurb_foundation']['foundation_access']['foundation_access_optional_color'] = array('#type' => $fieldtype, '#size' => 6, '#maxlength' => 6, '#title' => t('Optional Color'), '#description' => t('Tasks and lists that are optional will pick up this color'), '#default_value' => theme_get_setting('foundation_access_optional_color'));
    $form['zurb_foundation']['foundation_access']['foundation_access_logo_options'] = array('#type' => 'radios', '#options' => array('fullwidth' => 'Full Width', 'left' => 'Left', 'center' => 'Center', 'right' => 'Right'), '#title' => t('Logo Style Options'), '#description' => t('Choose a logo style that you prefer.'), '#default_value' => theme_get_setting('foundation_access_logo_options'));
}
/**
 * Implements hook_form_FORM_ID_alter().
 */
function foundation_access_form_system_theme_settings_alter(&$form, &$form_state)
{
    $form['zurb_foundation']['foundation_access'] = array('#type' => 'fieldset', '#title' => t('Foundation Access'));
    // system label
    $distro = elmsln_core_get_profile_key();
    $reg = _cis_connector_build_registry($distro);
    $system = theme_get_setting('foundation_access_system_label');
    $form['zurb_foundation']['foundation_access']['foundation_access_system_label'] = array('#type' => 'textfield', '#title' => t('Service label'), '#description' => t('The name displayed at the top left to indicate to users what system they are using. Defaults to the one provided by the registry.'), '#default_value' => empty($system) ? $reg['default_title'] : $system);
    // allow for jquery colorpicker selection widget
    if (module_exists('jquery_colorpicker')) {
        $fieldtype = 'jquery_colorpicker';
    } else {
        $fieldtype = 'textfield';
    }
    $form['zurb_foundation']['foundation_access']['foundation_access_primary_color'] = array('#type' => $fieldtype, '#size' => 6, '#maxlength' => 6, '#title' => t('Primary Color'), '#description' => t('Primary color to apply throughout the system'), '#default_value' => theme_get_setting('foundation_access_primary_color'), '#id' => 'foundation_access_primary_color', '#suffix' => '<div>' . l(t('Clear'), '#', array('html' => TRUE, 'attributes' => array('onclick' => 'jQuery(\'#foundation_access_primary_color\').val(\'\'); jQuery(\'#foundation_access_primary_color\').parents(\'.color_picker\').css("backgroundColor", "#FFF"); return false'))) . '</div>');
    $form['zurb_foundation']['foundation_access']['foundation_access_secondary_color'] = array('#type' => $fieldtype, '#size' => 6, '#maxlength' => 6, '#title' => t('Secondary Color'), '#description' => t('A Secondary color to apply throughout the system'), '#default_value' => theme_get_setting('foundation_access_secondary_color'), '#id' => 'foundation_access_secondary_color', '#suffix' => '<div>' . l(t('Clear'), '#', array('html' => TRUE, 'attributes' => array('onclick' => 'jQuery(\'#foundation_access_secondary_color\').val(\'\'); jQuery(\'#foundation_access_secondary_color\').parents(\'.color_picker\').css("backgroundColor", "#FFF"); return false'))) . '</div>');
    $form['zurb_foundation']['foundation_access']['foundation_access_required_color'] = array('#type' => $fieldtype, '#size' => 6, '#maxlength' => 6, '#title' => t('Required Color'), '#description' => t('Tasks and lists that are required will pick up this color'), '#default_value' => theme_get_setting('foundation_access_required_color'), '#id' => 'foundation_access_required_color', '#suffix' => '<div>' . l(t('Clear'), '#', array('html' => TRUE, 'attributes' => array('onclick' => 'jQuery(\'#foundation_access_required_color\').val(\'\'); jQuery(\'#foundation_access_required_color\').parents(\'.color_picker\').css("backgroundColor", "#FFF"); return false'))) . '</div>');
    $form['zurb_foundation']['foundation_access']['foundation_access_optional_color'] = array('#type' => $fieldtype, '#size' => 6, '#maxlength' => 6, '#title' => t('Optional Color'), '#description' => t('Tasks and lists that are optional will pick up this color'), '#id' => 'foundation_access_optional_color', '#suffix' => '<div>' . l(t('Clear'), '#', array('html' => TRUE, 'attributes' => array('onclick' => 'jQuery(\'#foundation_access_optional_color\').val(\'\'); jQuery(\'#foundation_access_optional_color\').parents(\'.color_picker\').css("backgroundColor", "#FFF"); return false'))) . '</div>');
    $form['zurb_foundation']['foundation_access']['foundation_access_logo_options'] = array('#type' => 'radios', '#options' => array('fullwidth' => 'Full Width', 'left' => 'Left', 'center' => 'Center', 'right' => 'Right'), '#title' => t('Logo Style Options'), '#description' => t('Choose a logo style that you prefer.'), '#default_value' => theme_get_setting('foundation_access_logo_options'));
}
/**
 * This is an example call that will snake a vset across everything in the network.
 * The example is silly but it illustrates a non-blocking snake that you can kick off
 * for high performance network propegation of data without invoking N+1 load
 * against the system. This is an intentional recursive call that will spider
 * the call against everything in the snake that kicks it off. This is awesome.
 *
 * In your data you need
 * __snake_stack      array   array of tool machine names to hit in the order of occurance
 * __course_context   string  the initial course context to send the call from.
 */
function _example_module_to_snake_a_call()
{
    // grab the registry keys
    $settings = _cis_connector_build_registry();
    // remove the current item
    unset($settings[elmsln_core_get_profile_key()]);
    // build the snake off the keys
    $snake = array_keys($settings);
    // abstract the first bucket to call our snake
    $bucket = array_pop($snake);
    // if a service, hit service address, if not hit root
    if (_cis_connector_system_type($bucket) == 'service') {
        $path = '/' . _cis_connector_course_context() . '/';
    } else {
        $path = '/';
    }
    // prep the head of the snake
    $request = array('method' => 'POST', 'api' => '1', 'bucket' => $bucket, 'path' => $path, 'data' => array('elmsln_module' => 'elmsln_api', 'elmsln_callback' => 'vset', 'name' => 'site_name', 'value' => 'asdd', '__snake_stack' => $snake, '__course_context' => _cis_connector_course_context()));
    _elmsln_api_request($request);
}
Exemple #5
0
/**
 * Implementation of hook_preprocess_node().
 */
function foundation_access_preprocess_node(&$variables)
{
    $type = 'node';
    $bundle = $variables['type'];
    $viewmode = $variables['view_mode'];
    // add the view mode name to the classes array.
    if (isset($viewmode)) {
        $variables['classes_array'][] = str_replace('_', '-', $viewmode);
    }
    // hook on the iframe mode stuff
    if (module_exists('cis_connector') && module_exists('entity_iframe')) {
        $settings = _cis_connector_build_registry(elmsln_core_get_profile_key());
        $variables['iframe_path'] = _cis_connector_format_address($settings, '/', 'front') . 'entity_iframe/node/' . $variables['nid'];
    }
    // create inheritance templates and preprocess functions for this entity
    if (module_exists('display_inherit')) {
        display_inherit_inheritance_factory($type, $bundle, $viewmode, 'foundation_access', $variables);
    }
}
Exemple #6
0
/**
 * Implements template_preprocess_page.
 */
function foundation_access_preprocess_page(&$variables)
{
    $menu_item = menu_get_item();
    // sniff out if this is a view
    if ($menu_item['page_callback'] == 'views_page') {
        // try and auto append exposed filters to our local_subheader region
        $bid = '-exp-' . $menu_item['page_arguments'][0] . '-' . (is_array($menu_item['page_arguments'][1]) ? $menu_item['page_arguments'][1][0] : $menu_item['page_arguments'][1]);
        $block = module_invoke('views', 'block_view', $bid);
        $variables['page']['local_subheader'][$bid] = $block['content'];
    }
    $variables['distro'] = variable_get('install_profile', 'standard');
    // load registry for this distro
    $settings = _cis_connector_build_registry($variables['distro']);
    $home_text = isset($settings['default_title']) ? $settings['default_title'] : $variables['distro'];
    $variables['home'] = l('<div class="' . $variables['distro'] . '-home elmsln-home-icon icon-' . $variables['distro'] . '-black etb-modal-icons"></div><span>' . $home_text . '</span>', '<front>', array('html' => TRUE, 'attributes' => array('class' => array($variables['distro'] . '-home-button', 'elmsln-home-button-link'))));
    // ensure header has something in it in the first place
    if (isset($variables['page']['header'])) {
        $keys = array_keys($variables['page']['header']);
        $keyname = array_shift($keys);
        $variables['page']['header'][$keyname]['#prefix'] = $variables['home'];
    }
    // make sure we have lmsless enabled so we don't WSOD
    $variables['cis_lmsless'] = array('active' => array('title' => ''));
    // support for lmsless since we don't require it
    if (module_exists('cis_lmsless')) {
        $variables['cis_lmsless'] = _cis_lmsless_theme_vars();
    }
    // support for cis_shortcodes
    if (module_exists('cis_shortcodes')) {
        $block = cis_shortcodes_block_view('cis_shortcodes_block');
        if (!empty($block['content'])) {
            $variables['cis_shortcodes'] = $block['content'];
        }
    } else {
        $variables['cis_shortcodes'] = '';
    }
    // support for entity_iframe
    if (module_exists('entity_iframe')) {
        $block = entity_iframe_block_view('entity_iframe_block');
        if (!empty($block['content'])) {
            $variables['cis_shortcodes'] .= $block['content'];
        }
    }
    // wrap non-node content in an article tag
    if (isset($variables['page']['content']['system_main']['main'])) {
        $variables['page']['content']['system_main']['main']['#markup'] = '<article class="large-12 columns view-mode-full">' . $variables['page']['content']['system_main']['main']['#markup'] . '</article>';
    }
    /**
     * @todo Get rid of this logic and put it somewhere else
     *       based on the new design.
     */
    // add a sharing url to view the specific section
    if (module_exists('cis_connector')) {
        $url_options = array('absolute' => TRUE);
        $current_section = _cis_connector_section_context();
        if (isset($current_section) && $current_section) {
            $url_options['query']['elmsln_active_course'] = $current_section;
        }
        $current_page = url(current_path(), $url_options);
        // establish the fieldset container for shortcodes
        $field['cis_section_share'] = array('#type' => 'fieldset', '#collapsed' => FALSE, '#collapsible' => TRUE, '#title' => t('Share this page'));
        $field['cis_section_share']['cis_section_share_link'] = array('#title' => t('Page URL'), '#value' => $current_page, '#type' => 'textfield', '#weight' => 0);
        $variables['cis_section_share'] = $field;
    }
    // attempt to find an edit path for the current page
    if (isset($variables['tabs']) && is_array($variables['tabs']['#primary'])) {
        foreach ($variables['tabs']['#primary'] as $key => $tab) {
            $edit_path = arg(0) . '/' . arg(1) . '/edit';
            if (isset($tab['#link']['href']) && $tab['#link']['href'] == $edit_path) {
                $variables['edit_path'] = base_path() . $edit_path;
                // hide the edit tab cause our on canvas pencil does this
                unset($variables['tabs']['#primary'][$key]);
            }
        }
    }
}
Exemple #7
0
/**
 * Implements hook_cis_remote_entities_insert_alter().
 *
 * @param $return
 *   Do something with the returned data, typically
 *   the `nid` or `uuid` created in the remote bucket.
 * @param $bucket
 *   which bucket this is in reference to.
 */
function hook_cis_remote_entities_insert(&$return, $bucket)
{
    // turn this into a direct link for a node
    $tmp = drupal_json_decode($return);
    $settings = _cis_connector_build_registry($bucket);
    $url = $settings['protocol'] . '://' . $settings['address'] . '/node/' . $return['nid'];
    $return = l(t('click to access item'), $url);
}