Example #1
0
File: 1_8.php Project: n8b/VMN
 function elgg_format_element($tag_name, array $attributes = array(), $text = '', array $options = array())
 {
     if (!is_string($tag_name)) {
         throw new \InvalidArgumentException('$tag_name is required');
     }
     if (isset($options['is_void'])) {
         $is_void = $options['is_void'];
     } else {
         // from http://www.w3.org/TR/html-markup/syntax.html#syntax-elements
         $is_void = in_array(strtolower($tag_name), array('area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr'));
     }
     if (!empty($options['encode_text'])) {
         $double_encode = empty($options['double_encode']) ? false : true;
         $text = htmlspecialchars($text, ENT_QUOTES, 'UTF-8', $double_encode);
     }
     if ($attributes) {
         $attrs = elgg_format_attributes($attributes);
         if ($attrs !== '') {
             $attrs = " {$attrs}";
         }
     } else {
         $attrs = '';
     }
     if ($is_void) {
         return empty($options['is_xml']) ? "<{$tag_name}{$attrs}>" : "<{$tag_name}{$attrs} />";
     } else {
         return "<{$tag_name}{$attrs}>{$text}</{$tag_name}>";
     }
 }
Example #2
0
/**
 * Replace default src Embed content with an ECML tag
 *
 * @param string $hook		Equals 'prepare:src'
 * @param string $type		Equals 'embed'
 * @param string $content	HTML markup to inject into the longtext input
 * @param array $params		Additional params
 * @uses ElggEntity $params['entity']
 * @return type
 */
function prepare_src_embed($hook, $type, $content, $params)
{
    $allowed_attributes = elgg_trigger_plugin_hook('ecml:attributes:src', 'embed', $params, array());
    // src attribute is required
    $allowed_attributes[] = 'src';
    // strip attributes that are not allowed
    $attributes = array();
    foreach ($allowed_attributes as $key) {
        $attributes[$key] = $params[$key];
    }
    if (!$attributes['src']) {
        return $content;
    }
    $attrs = elgg_format_attributes($attributes);
    $content = "[embed {$attrs}]";
    return $content;
}
Example #3
0
<?php

namespace hypeJunction\Places;

$entity = elgg_extract('entity', $vars);
$container = elgg_extract('container', $vars);
$required = elgg_format_attributes(array('title' => elgg_echo('places:required'), 'class' => 'required'));
?>
<fieldset class="has-legend">
	<legend><?php 
echo elgg_echo('places:place:about');
?>
</legend>
	<div>
		<label <?php 
echo $required;
?>
><?php 
echo elgg_echo('places:place:title');
?>
</label>
		<?php 
echo elgg_view('input/text', array('name' => 'title', 'value' => elgg_extract('title', $vars, $entity->title), 'required' => true));
?>
	</div>
	<div>
		<label><?php 
echo elgg_echo('places:place:icon');
?>
</label>
		<?php 
Example #4
0
<?php

/**
* Display an icon from the elgg icons sprite.
*
* @package Elgg
* @subpackage Core
*
* @uses $vars['class'] Class of elgg-icon
*/
$class = (array) elgg_extract("class", $vars);
$class[] = "elgg-icon";
$vars["class"] = $class;
$attributes = elgg_format_attributes($vars);
echo "<span {$attributes}></span>";
Example #5
0
<?php

$entity = elgg_extract('entity', $vars);
if (!elgg_instanceof($entity, 'object', 'file')) {
    return;
}
$url = urlencode(elgg_file_viewer_get_public_url($entity));
$iframe_url = "https://docs.google.com/viewer?url={$url}&embedded=true&overridemobile=true";
$attr = elgg_format_attributes(array('src' => $iframe_url, 'name' => $entity->title, 'height' => 780, 'width' => "100%", 'seamless' => true));
echo '<div class="elgg-col elgg-col-1of1 clearfloat">';
echo "<iframe {$attr}></iframe>";
echo '</div>';
Example #6
0
 * 	'link_id' => string, // ID to pass to the link
 * )
 */
$options = _elgg_clean_vars($vars);
$type = elgg_extract('type', $vars, 'horizontal');
if ($type == 'horizontal') {
    $options['class'] = "elgg-tabs elgg-htabs elgg-menu elgg-menu-page nav nav-tabs mrgn-bttm-md elgg-menu-page-default";
} else {
    $options['class'] = "elgg-tabs elgg-vtabs elgg-menu elgg-menu-page nav nav-tabs mrgn-bttm-md elgg-menu-page-default";
}
if (isset($vars['class'])) {
    $options['class'] = "{$options['class']} {$vars['class']}";
}
unset($options['tabs']);
unset($options['type']);
$attributes = elgg_format_attributes($options);
if (isset($vars['tabs']) && is_array($vars['tabs']) && !empty($vars['tabs'])) {
    ?>
	<ul <?php 
    echo $attributes;
    ?>
>
		<?php 
    foreach ($vars['tabs'] as $info) {
        $class = elgg_extract('class', $info, '');
        $id = elgg_extract('id', $info, '');
        $selected = elgg_extract('selected', $info, FALSE);
        if ($selected) {
            $class .= ' elgg-state-selected active';
        }
        $class_str = $class ? "class=\"{$class}\"" : '';
Example #7
0
<?php

namespace Events\UI;

use Events\API\Calendar;
$calendar = elgg_extract('entity', $vars);
if (!$calendar instanceof Calendar) {
    return;
}
$container = $calendar->getContainerEntity();
$attr = array('id' => "js-events-ui-calendar-{$calendar->guid}", 'class' => 'js-events-ui-fullcalendar', 'data-guid' => $calendar->guid, 'data-editable' => $calendar->canAddEvent() ? 1 : 0);
echo '<div ' . elgg_format_attributes($attr) . '></div>';
$form_attr = array('id' => "js-events-ui-form-{$calendar->guid}", 'class' => 'js-events-ui-form hidden', 'data-guid' => $calendar->guid);
echo '<div ' . elgg_format_attributes($form_attr) . '>';
echo elgg_view_form('events/edit', array('enctype' => 'multipart/form-data', 'class' => 'events-ui-form'), array('calendar' => $calendar, 'container' => $container));
echo '</div>';
Example #8
0
<?php

$attrs = elgg_format_attributes(array('width' => $vars['width'], 'height' => $vars['height'], 'src' => $vars['src'], 'frameborder' => '0'));
echo "<iframe {$attrs} allowFullScreen webkitallowfullscreen mozallowfullscreen oallowfullscreen msallowfullscreen></iframe>";
Example #9
0
$value = elgg_extract('value', $vars, false);
$multiple = elgg_extract('multiple', $vars, false);
$class = 'userpicker-glossary';
if (isset($vars['class'])) {
    $class = "{$class} {$vars['class']}";
    unset($vars['class']);
}
$alphabet = range('a', 'z');
$alphabet[] = '*';
if (!is_array($value)) {
    $value = array();
}
foreach ($alphabet as $letter) {
    $link = elgg_view('output/url', array('text' => $letter, 'title' => $letter, 'href' => elgg_http_add_url_query_elements($endpoint, array('letter' => $letter)), 'rel' => false, 'data-glossary' => $letter, 'data-limit' => HYPEINBOX_USERPICKER_BATCH_SIZE));
    $tabs .= <<<__TAB
<li class="elgg-tab">
\t{$link}
\t<div data-glossary-info="{$letter}" class="elgg-content"></div>
</li>
__TAB;
}
$hidden = elgg_view('input/hidden', array('name' => $name, 'value' => 0));
$attr = elgg_format_attributes(array('class' => $class, 'id' => str_replace(array(' ', '.'), '-', microtime()), 'data-endpoint' => $endpoint, 'data-name' => $name, 'data-value' => $value ? json_encode($value) : '[]', 'data-limit' => HYPEINBOX_USERPICKER_BATCH_SIZE, 'data-multiple' => $multiple));
echo <<<__HTML
{$hidden}
<div {$attr}>
\t<ul data-tabs class="elgg-tabs">{$tabs}</ul>
</div>

__HTML
;
*	Licence: 	CC-ByNCSA
*	Reference:	Microproyecto CEI BioTIC Ref. 11-2015
* 	Project coordinator: @rosanamontes
*	Website: http://lsi.ugr.es/rosana
* 	Project colaborator: Antonio Moles 
*	
*   Project Derivative:
*	TFG: Desarrollo de un sistema de gestión de paquetería para Teranga Go
*   Advisor: Rosana Montes
*   Student: Ricardo Luzón Fernández
*
*/
$value = elgg_extract("value", $vars);
unset($vars["value"]);
$spacers = array("new_line", "space", "dash", "teranga_car", "teranga_asientos");
$field_selector = "<select " . elgg_format_attributes($vars) . " class='elgg-input-dropdown profile-manager-user-summary-config-options'>";
$field_selector .= "<option></option>";
$profile_fields = elgg_get_config("profile_fields");
if ($profile_fields) {
    $field_options = array();
    foreach ($profile_fields as $metadata_name => $type) {
        $label = $metadata_name;
        $translation_key = "profile:" . $metadata_name;
        $translated_label = elgg_echo($translation_key);
        if ($translated_label !== $translation_key) {
            $label = $translated_label;
        }
        $field_options[$metadata_name] = $label;
    }
    ksort($field_options);
    $field_selector .= "<opttrip label='" . elgg_echo("profiles_go:profile_fields:list:title") . "'>";
Example #11
0
/**
 * Table output
 *
 * @package Video
 *
 * @uses $vars['table_class] The classes for table element
 * @uses $vars['headers'] The column headers
 * @uses $vars['rows'] Two dimensional array with rows and cells
 *
 */
$table_class = array('class' => 'elgg-table');
if (isset($vars['table_class'])) {
    $table_class['class'] = $vars['table_class'];
}
$table_class = elgg_format_attributes($table_class);
$header = '';
if (isset($vars['headers'])) {
    foreach ($vars['headers'] as $header) {
        $headers .= "<th>{$header}</th>";
    }
    $headers = "<tr>{$headers}</tr>";
}
$rows = '';
if (isset($vars['rows'])) {
    foreach ($vars['rows'] as $row) {
        $cells = '';
        foreach ($row as $value) {
            $cells .= "<td>{$value}</td>";
        }
        $rows .= "<tr>{$cells}</tr>";
Example #12
0
/**
 * Navigation menu for a user's or a group's pages
 *
 * @uses $vars['page'] Page object if manually setting selected item
 */
$page_guid = (int) get_input("guid");
$page = false;
if (!empty($page_guid)) {
    $page = get_entity($page_guid);
}
$selected_page = elgg_extract("page", $vars, $page);
// do we have a selected page
if (pages_tools_is_valid_page($selected_page)) {
    // make the navigation tree
    if (pages_tools_register_navigation_tree($selected_page)) {
        $title = elgg_echo("pages:navigation");
        $title .= "<span " . elgg_format_attributes(array("class" => "float-alt", "title" => elgg_echo("pages_tools:navigation:tooltip"))) . ">";
        $title .= elgg_view_icon("info");
        $title .= "</span>";
        // get the navigation menu
        $menu = "<div id='pages-tools-navigation' class='hidden'>";
        $menu .= elgg_view_menu("pages_nav", array("class" => "pages-nav", "sort_by" => "priority"));
        $menu .= "</div>";
        $menu .= elgg_view("graphics/ajax_loader", array("hidden" => false));
        // load the correct JS/css
        elgg_load_js("jquery.tree");
        elgg_load_css("jquery.tree");
        // draw everything
        echo elgg_view_module("aside", $title, $menu);
    }
}
Example #13
0
    $vars['class'] = "elgg-button";
}
$defaults = array('type' => 'button');
$vars = array_merge($defaults, $vars);
switch ($vars['type']) {
    case 'button':
    case 'reset':
    case 'submit':
    case 'image':
    case 'group_search':
        break;
    default:
        $vars['type'] = 'button';
        break;
}
// blank src if trying to access an offsite image. @todo why?
if (isset($vars['src']) && strpos($vars['src'], elgg_get_site_url()) === false) {
    $vars['src'] = "";
}
//Nick I modified the button input to test for group search button so I can put the icon in the button.
//Existing buttons should not be affected
if ($vars['type'] == 'group_search') {
    $button_input = '<button type="submit" ' . elgg_format_attributes($vars) . '><i class="fa fa-search" aria-hidden="true"></i></button>';
} else {
    $button_input = '<input ' . elgg_format_attributes($vars) . '>';
}
echo $button_input;
?>


Example #14
0
    unset($vars['options']);
    $value = is_array($vars['value']) ? $vars['value'] : array($vars['value']);
    $value = array_map('strval', $value);
    unset($vars['value']);
    $vars['multiple'] = !empty($vars['multiple']);
    // Add trailing [] to name if multiple is enabled to allow the form to send multiple values
    if ($vars['multiple'] && !empty($vars['name']) && is_string($vars['name'])) {
        if (substr($vars['name'], -2) != '[]') {
            $vars['name'] = $vars['name'] . '[]';
        }
    }
    ?>
<select <?php 
    echo elgg_format_attributes($vars);
    ?>
>
<?php 
    foreach ($optgroups as $groupLabel => $options_values) {
        if (!empty($options_values)) {
            echo '<optgroup label="' . $groupLabel . '">';
            foreach ($options_values as $opt_value => $option) {
                $option_attrs = elgg_format_attributes(array('value' => $opt_value, 'selected' => in_array((string) $opt_value, $value)));
                echo "<option {$option_attrs}>{$option}</option>";
            }
            echo '</optgroup>';
        }
    }
    ?>
</select>
<?php 
}
Example #15
0
$excerpt = false;
if ($widget->excerpt == "yes") {
    $excerpt = true;
}
$show_item_icon = false;
if ($widget->show_item_icon == "yes") {
    $show_item_icon = true;
}
$show_in_lightbox = false;
if ($widget->show_in_lightbox == "yes") {
    $show_in_lightbox = true;
}
if ($feed_url) {
    $attributes = array("id" => "widget-manager-rss-" . $widget->guid, "data-feed-url" => $feed_url, "data-limit" => $limit, "data-post-date" => $post_date, "data-show-feed-title" => $show_feed_title, "data-show-excerpt" => $excerpt, "data-show-item-icon" => $show_item_icon, "data-show-in-lightbox" => $show_in_lightbox);
    ?>
	<div <?php 
    echo elgg_format_attributes($attributes);
    ?>
"></div>
	<script>
	require(["widget_manager/widgets/rss"], function (rss) {
		rss("#widget-manager-rss-<?php 
    echo $widget->guid;
    ?>
");
	});
	</script>
	<?php 
} else {
    echo elgg_echo("widgets:rss:error:notset");
}
 /**
  * @param string $hook
  * @param string $type
  * @param string $value
  * @param array $params
  * @return string
  */
 function ecmlBr($hook, $type, $value, $params)
 {
     return '<br ' . elgg_format_attributes($params['attributes']) . '>';
 }
Example #17
0
 public function testLowercasesAllAttributes()
 {
     $attrs = ['A-B' => true, 'C-D' => 'C-D'];
     $expected = 'a-b="a-b" c-d="C-D"';
     $this->assertEquals($expected, elgg_format_attributes($attrs));
 }
Example #18
0
}
$type = $item->getType();
$subtype = $item->getSubtype();
$view = "object/{$type}/{$subtype}/grids/gallery";
if (elgg_view_exists($view)) {
    echo elgg_view($view, $vars);
    return true;
}
$class = "{$class} elgg-{$type} elgg-{$type}-{$subtype}";
$id = false;
if (elgg_instanceof($item)) {
    $id = "elgg-entity-{$item->guid}";
    $uid = $item->guid;
    $ts = max(array($item->time_created, $item->time_updated, $item->last_action));
} elseif ($item instanceof ElggRiverItem) {
    $id = "elgg-river-{$item->id}";
    $uid = $item->id;
    $ts = $item->posted;
} elseif ($item instanceof ElggAnnotation) {
    // Thanks to Matt Beckett for the fix
    $id = "item-{$item->name}-{$item->id}";
    $uid = $item->id;
    $ts = $item->time_created;
}
if (!$id) {
    return true;
}
$attr = array('id' => $id, 'class' => $class, 'data-uid' => $uid, 'data-ts' => $ts);
$attributes = elgg_format_attributes($attr);
$item_view = elgg_view_list_item($item, $vars);
echo "<li {$attributes}>{$item_view}</li>";
Example #19
0
<?php

/**
 * Elgg Input Hint View
 *
 * @uses $vars['hint'] Hint options
 */
if (!isset($vars['text'])) {
    return true;
}
$vars['title'] = $text = $vars['text'];
unset($vars['text']);
//$text = elgg_view_icon('info');
if (isset($vars['class'])) {
    $vars['class'] = "elgg-text-help elgg-input-hint {$vars['class']}";
} else {
    $vars['class'] = "elgg-text-help elgg-input-hint";
}
echo '<span ' . elgg_format_attributes(elgg_clean_vars($vars)) . '>' . $text . '</span>';
Example #20
0
<?php

/**
 * Photo tag view
 *
 * @uses $vars['tag'] Tag object
 *
 * @author Cash Costello
 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2
 */
$coords = json_decode('{' . $vars['tag']->coords . '}');
$attributes = elgg_format_attributes(array('class' => 'tidypics-tag', 'data-x1' => $coords->x1, 'data-y1' => $coords->y1, 'data-width' => $coords->width, 'data-height' => $coords->height));
$annotation = elgg_get_annotation_from_id($vars['tag']->annotation_id);
if ($vars['tag']->type == 'user') {
    $user = get_entity($vars['tag']->value);
    $user_link = elgg_view('output/url', array('text' => $user->name, 'href' => $user->getURL()));
    $tagger = get_entity($annotation->owner_guid);
    $tagger_link = elgg_view('output/url', array('text' => $tagger->name, 'href' => $tagger->getURL()));
    $label = elgg_echo('tidypics:tags:membertag') . $user_link . elgg_echo('tidypics:tags:taggedby', array($tagger_link));
} else {
    $label = elgg_echo('tidypics:tags:wordtags') . $vars['tag']->value;
}
$delete = '';
if ($annotation->canEdit()) {
    $url = elgg_http_add_url_query_elements('action/photos/image/untag', array('annotation_id' => $vars['tag']->annotation_id));
    $delete = elgg_view('output/url', array('href' => $url, 'text' => elgg_view_icon('delete', 'float mas'), 'confirm' => elgg_echo('tidypics:phototagging:delete:confirm')));
}
echo <<<HTML
<div class="tidypics-tag-wrapper">
\t<div {$attributes}>{$delete}</div>
\t<div class="elgg-module-popup tidypics-tag-label">{$label}</div>
Example #21
0
}
if (!$vars['user']) {
    $vars['user'] = elgg_get_logged_in_user_entity();
}
$client_tz = Util::getClientTimezone($vars['user']);
$dt_start = new DateTime("@{$start}", new DateTimeZone($timezone));
$start_at_org_tz = $dt_start->format('D, F j, Y H:ia T');
$dt_start->setTimezone(new DateTimeZone($client_tz));
$dt_end = new DateTime("@{$end}", new DateTimeZone($timezone));
$end_at_org_tz = $dt_end->format('D, F j, Y H:ia T');
$dt_end->setTimezone(new DateTimeZone($client_tz));
$output = '';
if ($dt_start->format('Y-m-d') == $dt_end->format('Y-m-d')) {
    if (date('Y') == $dt_start->format('Y')) {
        $output .= $dt_start->format('D, F j');
    } else {
        $output .= $dt_start->format('D, F j, Y');
    }
    $output .= ', ' . $dt_start->format('g:ia') . ' - ' . $dt_end->format('g:ia');
} else {
    if (date('Y') == $dt_start->format('Y')) {
        $output .= $dt_start->format('D, F j g:ia');
        $output .= ' - ' . $dt_end->format('D, F j g:ia');
    } else {
        $output .= $dt_start->format('D, F j, Y g:ia');
        $output .= ' - ' . $dt_end->format('D, F j, Y g:ia');
    }
}
$output .= ', ' . $dt_start->format('T');
$attrs = elgg_format_attributes(array('class' => 'events-date-range', 'title' => "{$start_at_org_tz} - {$end_at_org_tz}"));
echo "<span {$attrs}>{$output}</span>";
Example #22
0
 /**
  * Display an html list of the entities
  * @param string $class		CSS class to attach to the table
  * @return string
  */
 public function viewList()
 {
     $context = isset($this->options['list_type']) ? $this->options['list_type'] : 'list';
     elgg_push_context($context);
     $items = $this->getItems();
     $options = $this->getOptions();
     $count = $this->getCount();
     $offset = elgg_extract('offset', $options);
     $limit = elgg_extract('limit', $options);
     $base_url = elgg_extract('base_url', $options, '');
     $pagination = elgg_extract('pagination', $options, true);
     $offset_key = elgg_extract('offset_key', $options, 'offset');
     $position = elgg_extract('position', $options, 'after');
     if ($pagination && $count) {
         $nav = elgg_view('navigation/pagination', array('base_url' => $base_url, 'offset' => $offset, 'count' => $count, 'limit' => $limit, 'offset_key' => $offset_key));
     }
     $html .= '<div class="elgg-list-container">';
     if ($position == 'before' || $position == 'both') {
         $html .= $nav;
     }
     $list_attrs = elgg_format_attributes($this->getListAttributes());
     $html .= "<ul {$list_attrs}>";
     foreach ($items as $item) {
         $view = elgg_view_list_item($item, $options);
         if (!$view) {
             continue;
         }
         $has_items = true;
         $item_attrs = elgg_format_attributes($this->getItemAttributes($item));
         $html .= "<li {$item_attrs}>{$view}</li>";
     }
     if (!$has_items) {
         $html .= '<li class="elgg-list-placeholder">' . elgg_echo('list:empty') . '</li>';
     }
     $html .= '</ul>';
     if ($position == 'after' || $position == 'both') {
         $html .= $nav;
     }
     $html .= '</div>';
     elgg_pop_context();
     return $html;
 }
Example #23
0
if ($placeholder) {
    if (!$value) {
        echo "<option disabled selected>{$placeholder}</option>";
    } else {
        echo "<option disabled>{$placeholder}</option>";
    }
} else {
    if (!$value) {
        if ($options_values) {
            $value = array_keys($options_values)[0];
        } else {
            $value = array_keys($options)[0];
        }
    }
}
if ($options_values) {
    foreach ($options_values as $opt_value => $option) {
        $option_attrs = elgg_format_attributes(array('value' => $opt_value, 'selected' => (string) $opt_value == (string) $value));
        echo "<option {$option_attrs}>{$option}</option>";
    }
} else {
    if (is_array($options)) {
        foreach ($options as $option) {
            $option_attrs = elgg_format_attributes(array('value' => $option, 'selected' => (string) $option == (string) $value));
            echo "<option {$option_attrs}>{$option}</option>";
        }
    }
}
?>
</select>
Example #24
0
<?php

$field = elgg_extract('field', $vars);
$entity = elgg_extract('entity', $vars);
if (!$field instanceof \hypeJunction\Prototyper\Elements\AttributeField) {
    return;
}
$name = $field->getShortname();
if (!$entity || !$name) {
    return;
}
$label = $field->getLabel();
$help = $field->getHelp();
$required = $field->isRequired();
if ($required) {
    $label_attrs = elgg_format_attributes(array('class' => 'required', 'title' => elgg_echo('prototyper:required')));
}
$input_vars = $field->getInputVars($entity);
$input_vars['name'] = $name;
$input_vars['placeholder'] = $label;
$value = $field->getValues($entity);
if ($value) {
    $input_vars['value'] = $value;
}
$type = $field->getType();
$view = $field->getInputView();
$input = elgg_view($view, $input_vars);
if ($type == 'hidden') {
    echo $input;
    return;
}
Example #25
0
<?php

/**
 * Page shell for all HTML pages
 *
 * @uses $vars['head']        Parameters for the <head> element
 * @uses $vars['body_attrs']  Attributes of the <body> tag
 * @uses $vars['body']        The main content of the page
 */
// Set the content type
header("Content-type: text/html; charset=UTF-8");
$lang = get_current_language();
$attrs = " vocab='https://schema.org/' typeof='WebPage'";
if (isset($vars['body_attrs'])) {
    $attrs = elgg_format_attributes($vars['body_attrs']);
    if ($attrs) {
        $attrs = " {$attrs}";
    }
}
?>
<!DOCTYPE html><!--[if lt IE 9]><html class="no-js lt-ie9" lang="<?php 
echo $lang;
?>
" dir="ltr"><![endif]--><!--[if gt IE 8]><!-->
<html class="no-js" lang="<?php 
echo $lang;
?>
" dir="ltr">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<!--<![endif]-->
<head>
Example #26
0
File: dropzone.php Project: n8b/VMN
    $options['data-accepted-files'] = $vars['accept'];
}
if (isset($vars['action'])) {
    $options['data-url'] = elgg_add_action_tokens_to_url(elgg_normalize_url($vars['action']));
    unset($vars['action']);
}
if (isset($vars['container_guid'])) {
    $options['data-container-guid'] = $vars['container_guid'];
}
if (isset($vars['subtype'])) {
    $options['data-subtype'] = $vars['subtype'];
}
$options['data-clickable'] = "#{$options['id']} .elgg-dropzone-fallback-control,#{$options['id']} .elgg-dropzone-instructions";
$language = array('data-dict-default-message' => elgg_echo('dropzone:default_message'), 'data-dict-fallback-message' => elgg_echo('dropzone:fallback_message'), 'data-dict-fallback-text' => elgg_echo('dropzone:fallback_text'), 'data-dict-invalid-filetype' => elgg_echo('dropzone:invalid_filetype'), 'data-dict-file-toobig' => elgg_echo('dropzone:file_too_big'), 'data-dict-response-error' => elgg_echo('dropzone:response_error'), 'data-dict-cancel-upload' => elgg_echo('dropzone:cancel_upload'), 'data-dict-cancel-upload-confirmation' => elgg_echo('dropzone:cancel_upload_confirmation'), 'data-dict-remove-file' => elgg_echo('dropzone:remove_file'), 'data-dict-max-files-exceeded' => elgg_echo('dropzone:max_files_exceeded'));
$options = array_merge($language, $options);
$dropzone_attributes = elgg_format_attributes($options);
// Add a hidden field to use in the action hook to unserialize the values
echo elgg_view('input/hidden', array('name' => 'dropzone_fields[]', 'value' => $vars['name']));
$file_input = elgg_view('input/file', $vars);
$template = elgg_view('dropzone/template');
echo <<<HTML
<div class="elgg-dropzone">
\t<div {$dropzone_attributes}>
\t\t<span class="elgg-dropzone-instructions dz-default dz-message">
\t\t\t{$language['data-dict-default-message']}
\t\t</span>
\t</div>
\t<div data-template>{$template}</div>
</div>
{$file_input}
HTML
Example #27
0
<?php

/**
 * Elgg AJAX loader
 *
 * @package Elgg
 * @subpackage Core
 *
 * @uses $vars['id']     CSS id
 * @uses $vars['class']  Optional additional CSS class
 * @uses $vars['hidden'] Begin hidden? (true)
 */
$attributes = array();
if (isset($vars['id'])) {
    $attributes['id'] = $vars['id'];
}
$class = 'elgg-ajax-loader';
if (isset($vars['class'])) {
    $class = "{$class} {$vars['class']}";
}
if (elgg_extract('hidden', $vars, true)) {
    $class = "{$class} hidden";
}
$attributes['class'] = $class;
$attrs = elgg_format_attributes($attributes);
$loader = <<<END

<div {$attrs}></div>

END;
echo $loader;
Example #28
0
<?php

$type = elgg_extract('type', $vars);
if (!elgg_is_xhr()) {
    echo elgg_view('framework/db_explorer/filter', array('filter_context' => $type));
}
$attr = elgg_format_attributes(array('id' => "dbexplorer-{$type}", 'class' => 'dbexplorer-grid', 'data-type' => $type, 'data-pager-id' => "pager-{$type}"));
echo '<div class="jqgrid-wrapper">';
echo "<table {$attr}><tr><td></td></tr></table>";
echo "<div id=\"pager-{$type}\"></div>";
echo '</div>';
echo elgg_view_form('db_explorer/batch', array('class' => 'js-dbexplorer-batch-form'));
Example #29
0
    $vars['class'] = "elgg-input-pad {$vars['class']}";
} else {
    $vars['class'] = "elgg-input-pad";
}
if (!isset($vars['options'])) {
    $vars['options'] = array();
}
if (isset($vars['padId'])) {
    $vars['options']['padId'] = $vars['padId'];
}
$json_defaults = array('host' => 'http://localhost:9001', 'baseUrl' => '/p/', 'showControls' => true, 'showChat' => false, 'showLineNumbers' => false, 'userName' => elgg_get_logged_in_user_entity()->username, 'useMonospaceFont' => false, 'noColors' => 'false');
$defaults = array('id' => 'pad');
$vars['options'] = array_merge($json_defaults, $vars['options']);
$vars = array_merge($defaults, $vars);
$json = json_encode($vars['options']);
$id = $vars['id'];
unset($vars['padId']);
unset($vars['options']);
elgg_load_js('vendors:etherpad-lite-jquery');
?>
<div <?php 
echo elgg_format_attributes($vars);
?>
></div>
<script type="text/javascript">
<?php 
echo "\t\$('#{$id}').css({height:'400px'}).pad({$json});\n\t\$('#{$id} iframe').css({width:'100%', height:'100%'});";
?>
</script>

Example #30
0
    $has_items = true;
    $view = elgg_view_list_item($item, $options);
    if (!$view) {
        continue;
    }
    $item_attrs = $map->getItemAttributes($item);
    $proximity = '';
    if (!is_null($item_attrs['data-proximity'])) {
        $proximity = elgg_view('output/maps/proximity', array('value' => $item_attrs['data-proximity'], 'class' => 'elgg-text-help maps-item-proximity'));
        $view .= $proximity;
    }
    $pin = '&nbsp;';
    if ($item_attrs['data-pin']) {
        $pin = elgg_view('output/maps/pin', array('value' => $item_attrs['data-pin'], 'class' => 'maps-item-pin', 'alt' => $item_attrs['data-title'], 'title' => $proximity ? elgg_echo('maps:proximity:info', array(strip_tags($proximity), $map->getLocation())) : $item_attrs['data-title']));
    }
    $view = elgg_view_image_block($pin, $view, array('class' => 'maps-item-pin-block'));
    $id = elgg_instanceof($item) ? "elgg-{$item->getType()}-{$item->getGUID()}" : "item-{$item->getType()}-{$item->id}";
    $item_attrs['id'] = $id;
    $item_attrs['class'] = $item_class;
    $item_attrs = elgg_format_attributes($item_attrs);
    echo "<li {$item_attrs}>{$view}</li>";
}
if (!$has_items) {
    echo '<li class="placeholder">' . elgg_echo('maps:empty') . '</li>';
}
echo '</ul>';
if ($position == 'after' || $position == 'both') {
    echo $nav;
}
echo '</div>';
elgg_pop_context();