public function render($params = array()) { $params = new YArray($params); // include assets css JHTML::stylesheet('itemprint.css', 'administrator/components/com_zoo/elements/itemprint/assets/css/'); if (YRequest::getBool('print', 0)) { return '<a class="element-print-button" onclick="window.print();return false;" href="#"></a>'; } else { JHTML::_('behavior.modal', 'a.modal'); $text = $params->get('showicon') ? '' : JText::_('Print'); $class = $params->get('showicon') ? 'modal element-print-button' : 'modal'; return '<a href="' . JRoute::_(RouteHelper::getItemRoute($this->_item) . '&tmpl=component&print=1') . '" title="' . JText::_('Print') . '" rel="{handler: \'iframe\', size: {x: 850, y: 500}}" class="' . $class . '">' . $text . '</a>'; } }
public function render($params) { // init vars $params = new YArray($params); $height = $params->get('height'); $width = $params->get('width'); $enabled = $this->_data->get('value'); // render html if ($width && $height && $enabled) { $permalink = urlencode(JRoute::_(RouteHelper::getItemRoute($this->_item), true, -1)); $href = 'http://www.facebook.com/plugins/like.php?href=' . $permalink . '&layout=standard&show_faces=false&width=300&action=like&colorscheme=light&height=' . $height; $html = '<iframe src="' . $href . '" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width: ' . $width . 'px; height: ' . $height . 'px;" ></iframe>'; return $html; } return null; }
public function render($params = array()) { // init vars $params = new YArray($params); $items = array(); $output = array(); $layout_path = $params->get('layout_path'); $renderer = new ItemRenderer(); $renderer->addPath($layout_path); $layout = $params->get('layout'); $items = $this->_getRelatedItems(); // sort items $order = $params->get('order'); if (in_array($order, array('alpha', 'ralpha'))) { usort($items, create_function('$a,$b', 'return strcmp($a->name, $b->name);')); } elseif (in_array($order, array('date', 'rdate'))) { usort($items, create_function('$a,$b', 'return (strtotime($a->created) == strtotime($b->created)) ? 0 : (strtotime($a->created) < strtotime($b->created)) ? -1 : 1;')); } elseif (in_array($order, array('hits', 'rhits'))) { usort($items, create_function('$a,$b', 'return ($a->hits == $b->hits) ? 0 : ($a->hits < $b->hits) ? -1 : 1;')); } elseif ($order == 'random') { shuffle($items); } else { } if (in_array($order, array('ralpha', 'rdate', 'rhits'))) { $items = array_reverse($items); } // create output foreach ($items as $item) { $path = 'item'; $prefix = 'item.'; $type = $item->getType()->id; if ($renderer->pathExists($path . DIRECTORY_SEPARATOR . $type)) { $path .= DIRECTORY_SEPARATOR . $type; $prefix .= $type . '.'; } if (in_array($layout, $renderer->getLayouts($path))) { $output[] = $renderer->render($prefix . $layout, array('item' => $item)); } elseif ($params->get('link_to_item', false) && $item->getState()) { $url = RouteHelper::getItemRoute($item); $output[] = '<a href="' . JRoute::_($url) . '" title="' . $item->name . '">' . $item->name . '</a>'; } else { $output[] = $item->name; } } return ElementHelper::applySeparators($params->get('separated_by'), $output); }
public function render($params = array()) { if (!empty($this->_item)) { $params = new YArray($params); if ($params->get('link_to_item', false) && $this->_item->getState()) { $url = RouteHelper::getItemRoute($this->_item); return '<a title="' . $this->_item->name . '" href="' . JRoute::_($url) . '">' . $this->_item->name . '</a>'; } else { return $this->_item->name; } } }
public function _renderSubmission($params = array()) { // get params $params = new YArray($params); $trusted_mode = $params->get('trusted_mode'); if ($layout = $this->getLayout('submission.php')) { return self::renderLayout($layout, array('element' => $this->identifier, 'index' => $this->index(), 'text' => $this->_data->get('text'), 'link' => $this->_data->get('value'), 'target' => $this->_data->get('target'), 'title' => $this->_data->get('custom_title'), 'rel' => $this->_data->get('rel'), 'trusted_mode' => $trusted_mode)); } }
public function _renderSubmission($params = array()) { // get params $params = new YArray($params); $trusted_mode = $params->get('trusted_mode'); if ($layout = $this->getLayout('submission.php')) { return self::renderLayout($layout, array('element' => $this->identifier, 'index' => $this->index(), 'text' => $this->_data->get('text'), 'email' => $this->_data->get('value'), 'subject' => $this->_data->get('subject', ''), 'body' => $this->_data->get('body', ''), 'trusted_mode' => $trusted_mode)); } }
protected function _renderRepeatable($params = array()) { $params = new YArray($params); $trusted_mode = $params->get('trusted_mode', false); if ($repeatable = $this->_config->get('repeatable')) { // create repeat-elements $html = array(); $html[] = '<div id="' . $this->identifier . '" class="repeat-elements">'; $html[] = '<ul class="repeatable-list">'; foreach ($this as $self) { $html[] = '<li class="repeatable-element">'; $html[] = $self->_addEditor($this->index(), $this->_data->get('value'), $trusted_mode); $html[] = '</li>'; } for ($index = count($this->_data_array); $index < count($this->_data_array) + self::MAX_HIDDEN_EDITORS; $index++) { $html[] = '<li class="repeatable-element hidden">'; $html[] = $this->_addEditor($index, '', $trusted_mode); $html[] = '</li>'; } $html[] = '</ul>'; $html[] = '<p class="add"><a href="javascript:void(0);">' . JText::sprintf('Add another %s', JString::ucfirst($this->getElementType())) . '</a></p>'; $html[] = '</div>'; // create js $javascript = "jQuery('#{$this->identifier}').ElementRepeatableTextarea({ msgDeleteElement : '" . JText::_('Delete Element') . "' });"; $javascript = "<script type=\"text/javascript\">\n//<!--\n{$javascript}\n// -->\n</script>\n"; return implode("\n", $html) . $javascript; } else { return $this->_addEditor(0, $this->_data->get('value'), $trusted_mode); } }
public function render($params = array()) { // init vars $location = $this->_data->get('location'); $locale = $this->_config->get('locale'); // init display params $params = new YArray($params); $layout_path = $params->get('layout_path'); $layout = $params->get('layout'); $width = $params->get('width'); $width_unit = $params->get('width_unit'); $height = $params->get('height'); $marker_popup = $params->get('marker_popup'); $zoom_level = $params->get('zoom_level'); $map_controls = $params->get('map_controls'); $scroll_wheel_zoom = $params->get('scroll_wheel_zoom'); $map_type = $params->get('map_type'); $map_controls = $params->get('map_controls'); $type_controls = $params->get('type_controls'); $directions = $params->get('directions'); $main_icon = $params->get('main_icon'); $information = $params->get('information'); // determine locale if (empty($locale) || $locale == 'auto') { $locale = UserHelper::getBrowserDefaultLanguage(); } // get marker text $marker_text = ''; $renderer = new ItemRenderer(); $renderer->addPath($layout_path); if ($item = $this->getItem()) { $path = 'item'; $prefix = 'item.'; $type = $item->getType()->id; if ($renderer->pathExists($path . DIRECTORY_SEPARATOR . $type)) { $path .= DIRECTORY_SEPARATOR . $type; $prefix .= $type . '.'; } if (in_array($layout, $renderer->getLayouts($path))) { $marker_text = $renderer->render($prefix . $layout, array('item' => $item)); } else { $marker_text = $item->name; } } // get geocode cache $cache = new YCache(ZOO_CACHE_PATH . DS . 'geocode_cache.txt'); if (!$cache->check()) { return "<div class=\"alert\"><strong>Cache not writeable please update the file permissions! (geocode_cache.txt)</strong></div>\n"; } // get map center coordinates $center = GooglemapsHelper::locate($location, $cache); if (!$center) { return "<div class=\"alert\"><strong>Unable to get map center coordinates, please verify your location! (" . $location . ")</strong></div>\n"; } // save location to geocode cache if ($cache) { $cache->save(); } // css parameters $maps_id = 'googlemaps-' . $this->_item->id; $css_module_width = 'width: ' . $width . $width_unit . ';'; $css_module_height = 'height: ' . $height . 'px;'; $from_address = JText::_('From address:'); $get_directions = JText::_('Get directions'); $empty = JText::_('Please fill in your address.'); $not_found = JText::_('Sorry, address not found!'); $address_not_found = ', ' . JText::_('not found!'); // js parameters $javascript = "\$('#{$maps_id}').Googlemaps({ lat:" . $center['lat'] . ", lng:" . $center['lng'] . ", popup: " . $marker_popup . ", text: '" . GooglemapsHelper::stripText($marker_text) . "', zoom: " . $zoom_level . ", mapCtrl: " . $map_controls . ", zoomWhl: " . $scroll_wheel_zoom . ", mapType: " . $map_type . ", typeCtrl: " . $type_controls . ", directions: " . $directions . ", locale: '" . $locale . "', mainIcon:'" . $main_icon . "', msgFromAddress: '" . $from_address . "', msgGetDirections: '" . $get_directions . "', msgEmpty: '" . $empty . "', msgNotFound: '" . $not_found . "', msgAddressNotFound: '" . $address_not_found . "' });"; $javascript = "jQuery(function(\$) { {$javascript} });"; // render layout if ($layout = $this->getLayout()) { return self::renderLayout($layout, array('maps_id' => $maps_id, 'javascript' => $javascript, 'css_module_width' => $css_module_width, 'css_module_height' => $css_module_height, 'information' => $information, 'locale' => $locale)); } return null; }
public function renderSubmission($params = array()) { // load js JHTML::script('image.js', 'administrator/components/com_zoo/elements/image/assets/js/'); // init vars $image = $this->_data->get('file'); // is uploaded file $image = is_array($image) ? '' : $image; // get params $params = new YArray($params); $trusted_mode = $params->get('trusted_mode'); // build image select $lists = array(); if ($trusted_mode) { $options = array(JHTML::_('select.option', '', '- ' . JText::_('Select Image') . ' -')); if (!empty($image) && !$this->_inUploadPath($image)) { $options[] = JHTML::_('select.option', $image, '- ' . JText::_('No Change') . ' -'); } $img_ext = str_replace(',', '|', trim(JComponentHelper::getParams('com_media')->get('image_extensions'), ',')); foreach (YFile::readDirectoryFiles(JPATH_ROOT . '/' . $this->_getUploadImagePath() . '/', $this->_getUploadImagePath() . '/', '/\\.(' . $img_ext . ')$/i', false) as $file) { $options[] = JHTML::_('select.option', $file, basename($file)); } $lists['image_select'] = JHTML::_('select.genericlist', $options, 'elements[' . $this->identifier . '][image]', 'class="image"', 'value', 'text', $image); } else { if (!empty($image)) { $image = ZooHelper::resizeImage(JPATH_ROOT . DS . $image, 0, 0); $image = trim(str_replace('\\', '/', preg_replace('/^' . preg_quote(JPATH_ROOT, '/') . '/i', '', $image)), '/'); } } if (!empty($image)) { $image = JURI::root() . $image; } if ($layout = $this->getLayout('submission.php')) { return self::renderLayout($layout, array('element' => $this->identifier, 'lists' => $lists, 'image' => $image)); } }
<?php /** * @package ZOO Component * @file block.php * @version 2.3.0 December 2010 * @author YOOtheme http://www.yootheme.com * @copyright Copyright (C) 2007 - 2011 YOOtheme GmbH * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 only */ // no direct access defined('_JEXEC') or die('Restricted access'); $params = new YArray($params); // add tooltip $tooltip = ''; if ($params->get('show_tooltip') && ($description = $element->getConfig()->get('description'))) { $tooltip = ' class="hasTip" title="' . $description . '"'; } // create label $label = '<strong' . $tooltip . '>'; $label .= $params->get('altlabel') ? $params->get('altlabel') : $element->getConfig()->get('name'); $label .= '</strong>'; // create error $error = ''; if ($field->hasError()) { $error = '<p class="error-message">' . (string) $field->getError() . '</p>'; } // create class attribute $class = 'element element-' . $element->getElementType() . ($params->get('first') ? ' first' : '') . ($params->get('last') ? ' last' : '') . ($params->get('required') ? ' required' : '') . ($field->hasError() ? ' error' : ''); $element->loadAssets(); ?>
public function renderSubmission($params = array()) { // get params $params = new YArray($params); $trusted_mode = $params->get('trusted_mode'); // init vars $upload = $this->_data->get('file'); $download_limit = $this->_data->get('download_limit'); if (empty($upload) && $trusted_mode) { $upload = $this->_data->get('upload'); } // is uploaded file $upload = is_array($upload) ? '' : $upload; // build upload select $lists = array(); if ($trusted_mode) { $options = array(JHTML::_('select.option', '', '- ' . JText::_('Select File') . ' -')); if (!empty($upload) && !$this->_inUploadPath($upload)) { $options[] = JHTML::_('select.option', $upload, '- ' . JText::_('No Change') . ' -'); } foreach (YFile::readDirectoryFiles(JPATH_ROOT . '/' . $this->_getUploadPath() . '/', $this->_getUploadPath() . '/', false, false) as $file) { $options[] = JHTML::_('select.option', $file, basename($file)); } $lists['upload_select'] = JHTML::_('select.genericlist', $options, 'elements[' . $this->identifier . '][upload]', 'class="upload"', 'value', 'text', $upload); } if (!empty($upload)) { $upload = basename($upload); } if ($layout = $this->getLayout('submission.php')) { return self::renderLayout($layout, array('element' => $this->identifier, 'lists' => $lists, 'upload' => $upload, 'trusted_mode' => $trusted_mode, 'download_limit' => $download_limit)); } }
public function renderSubmission($params = array()) { // init vars $width = $this->_data->get('width'); $height = $this->_data->get('height'); $autoplay = $this->_data->get('autoplay', false); // get params $params = new YArray($params); $trusted_mode = $params->get('trusted_mode'); if ($layout = $this->getLayout('submission.php')) { return self::renderLayout($layout, array('element' => $this->identifier, 'url' => $this->_data->get('url'), 'trusted_mode' => $trusted_mode, 'width' => $width, 'height' => $height, 'autoplay' => $autoplay)); } return null; }