/** * Displays the footer * * @return unknown_type */ function footer() { // show a generous linkback, TIA $app = DSC::getApp(); $input = JFactory::getApplication()->input; $show_linkback = $app->get('show_linkback', '1'); $name = $app->getName(); $model_name = $name . "ModelDashboard"; $app->load($model_name, "models.dashboard"); $model = new $model_name(); $format = $input->getString('format'); if ($show_linkback == '1' && $format != 'raw') { $view = $this->getView('dashboard', 'html'); $view->hidemenu = true; $view->setTask('footer'); $view->setModel($model, true); $view->setLayout('footer'); $view->assign('style', ''); $view->display(); } elseif ($format != 'raw') { $view = $this->getView('dashboard', 'html'); $view->hidemenu = true; $view->setTask('footer'); $view->setModel($model, true); $view->setLayout('footer'); $view->assign('style', 'style="display: none;"'); $view->display(); } return; }
/** * Displays a url in a lightbox * * @param $url * @param $text * @param array options( * 'width', * 'height', * 'top', * 'left', * 'class', * 'update', * 'img' * ) * @return popup html */ public static function popup($url, $text, $options = array()) { $html = ""; if (!empty($options['update'])) { JHTML::_('behavior.modal', 'a.modal', array('onClose' => '\\function(){Dsc.update();}')); } else { JHTML::_('behavior.modal'); } // set the $handler_string based on the user's browser $handler_string = "{handler:'iframe',size:{x: window.innerWidth-80, y: window.innerHeight-80}, onShow:\$('sbox-window').setStyles({'padding': 0})}"; $browser = DSC::getClass('DSCBrowser', 'library.browser'); if ($browser->getBrowser() == DSCBrowser::BROWSER_IE) { // if IE, use $handler_string = "{handler:'iframe',size:{x:window.getSize().scrollSize.x-80, y: window.getSize().size.y-80}, onShow:\$('sbox-window').setStyles({'padding': 0})}"; } $handler = !empty($options['img']) ? "{handler:'image'}" : $handler_string; if (!empty($options['width'])) { if (empty($options['height'])) { $options['height'] = 480; } $handler = "{handler: 'iframe', size: {x: " . $options['width'] . ", y: " . $options['height'] . "}}"; } $id = !empty($options['id']) ? $options['id'] : ''; $class = !empty($options['class']) ? $options['class'] : ''; $linkclass = !empty($options['linkclass']) ? $options['linkclass'] : ''; $linkclass = $linkclass . ' modal'; $html = "<a class=\"" . $linkclass . "\" href=\"{$url}\" rel=\"{$handler}\" >\n"; $html .= "<span class=\"" . $class . "\" id=\"" . $id . "\" >\n"; $html .= "{$text}\n"; $html .= "</span>\n"; $html .= "</a>\n"; return $html; }
/** * Displays a layout file with room for a left menu bar * @param $tpl * @return unknown_type */ public function displayWithLeftMenu($tpl = null, $menuname) { // TODO This is an ugly, quick hack - fix it echo "<table width='100%'>"; echo "<tr>"; echo "<td style='width: 180px; padding-right: 5px; vertical-align: top;' >"; DSC::load('DSCMenu', 'library.menu'); if ($menu = DSCMenu::getInstance($menuname)) { $menu->display('leftmenu', $menu); } $modules = JModuleHelper::getModules($this->_name . "_left"); $document = JFactory::getDocument(); $renderer = $document->loadRenderer('module'); $attribs = array(); $attribs['style'] = 'xhtml'; foreach ($modules as $mod) { echo $renderer->render($mod, $attribs); } echo "</td>"; echo "<td style='vertical-align: top;' >"; parent::display($tpl); echo "</td>"; echo "</tr>"; echo "</table>"; }
function __construct($config = array()) { $input = JFactory::getApplication()->input; $app = DSC::getApp(); $this->_option = !empty($app) ? 'com_' . $app->getName() : $input->get('option'); parent::__construct($config); }
/** * Displays a layout file * * @param unknown_type $tpl * @return unknown_type */ function display($tpl = null) { //including core JS because it needs to be included in modals and since we have so many including here keeps that from failing. JHTML::_('behavior.modal'); JHTML::_('script', 'core.js', 'media/system/js/'); DSC::loadBootstrap(); DSC::loadJQuery('latest', true, 'tiendaJQ'); JHTML::_('stylesheet', 'common.css', 'media/dioscouri/css/'); parent::display($tpl); }
/** * Displays a layout file * * @param unknown_type $tpl * @return unknown_type */ function display($tpl = null) { $doc = JFactory::getDocument(); //including core JS because it needs to be included in modals and since we have so many including here keeps that from failing. JHTML::_('behavior.modal'); JHtml::_('script', 'media/system/js/core.js', false, false); JHtml::_('script', 'media/citruscart/js/citruscart.js', false, false); //DSC::loadBootstrap(); DSC::loadJQuery('latest', true, 'citruscartJQ'); JHtml::_('stylesheet', 'media/citruscart/css/common.css'); parent::display($tpl); }
public static function enable($enable, $i, $prefix = '', $imgY = 'tick.png', $imgX = 'publish_x.png') { $img = $enable ? $imgY : $imgX; $task = $enable ? 'disable' : 'enable'; $alt = $enable ? JText::_('Enabled') : JText::_('Disabled'); $action = $enable ? JText::_('Disable Item') : JText::_('Enable Item'); $href = ' <a href="javascript:void(0);" onclick="return Dsc.listItemTask(\'cb' . $i . '\',\'' . $prefix . $task . '\')" title="' . $action . '"> <img src="' . DSC::getURL('images') . $img . '" border="0" alt="' . $alt . '" /> </a>'; return $href; }
/** * First displays the submenu, then displays the output * but only if a valid _doTask is set in the view object * * @param $tpl * @return unknown_type */ function display($tpl = null, $perform = true) { // these need to load before jquery to prevent joomla from crying JHTML::_('behavior.modal'); JHTML::_('script', 'core.js', 'media/system/js/'); DSC::loadJQuery('latest', true, 'tiendaJQ'); if ($this->defines->get('use_bootstrap', '0')) { DSC::loadBootstrap(); } JHTML::_('stylesheet', 'common.css', 'media/dioscouri/css/'); if ($this->defines->get('include_site_css', '0')) { JHTML::_('stylesheet', 'tienda.css', 'media/com_tienda/css/'); } parent::display($tpl); }
/** * First displays the submenu, then displays the output * but only if a valid _doTask is set in the view object * * @param $tpl * @return unknown_type */ public function display($tpl = null) { // display() will return null if 'doTask' is not set by the controller // This prevents unauthorized access by bypassing the controllers if (empty($this->_doTask)) { return null; } $this->getLayoutVars($tpl); if (!JRequest::getInt('hidemainmenu') && empty($this->hidemenu)) { $this->displaySubmenu(); } $app = DSC::getApp(); $config = $app::getInstance(); if ($config->get('include_site_css', '1')) { JHTML::_('stylesheet', 'site.css', 'media/' . $this->_option . '/css/'); } parent::display($tpl); }
/** * Protected! Use the getInstance */ protected function DSCHelperImage() { // Parent Helper Construction parent::__construct(); $config = DSCConfig::getInstance(); // Load default Parameters $this->product_img_height = $config->get('product_img_height'); $this->product_img_width = $config->get('product_img_width'); $this->category_img_height = $config->get('category_img_height'); $this->category_img_width = $config->get('category_img_width'); $this->manufacturer_img_width = $config->get('manufacturer_img_width'); $this->manufacturer_img_height = $config->get('manufacturer_img_height'); $this->product_img_path = DSC::getPath('products_images'); $this->category_img_path = DSC::getPath('categories_images'); $this->manufacturer_img_path = DSC::getPath('manufacturers_images'); $this->product_thumb_path = DSC::getPath('products_thumbs'); $this->category_thumb_path = DSC::getPath('categories_thumbs'); $this->manufacturer_thumb_path = DSC::getPath('manufacturers_thumbs'); }
/** * constructor */ function __construct($config = array()) { parent::__construct($config); $input = JFactory::getApplication()->input; $com = $input->get('option'); //$com = JRequest::get('option'); if (!empty($config['com'])) { $com = $config['com']; } //do we really need to get the whole app to get the name or should we strip it from the option?? $app = DSC::getApp(); $this->_name = $app->getName(); $this->_Pluginname = ucfirst($this->_name); $this->set('com', $com); $this->set('suffix', $this->get('default_view')); $this->list_url = "index.php?option=" . $this->get('com') . "&view=" . $this->get('suffix'); // Register Extra tasks $this->registerTask('list', 'display'); $this->registerTask('close', 'cancel'); }
/** * First displays the submenu, then displays the output * but only if a valid _doTask is set in the view object * * @param $tpl * @return unknown_type */ function display($tpl = null, $perform = true) { $doc = JFactory::getDocument(); //$doc->addStyleSheet(JUri::root().'media/citruscart/css/citruscart_checkout_onepage.css'); // these need to load before jquery to prevent joomla from crying JHTML::_('behavior.modal'); $doc->addScript(JUri::root() . 'media/system/js/core.js'); DSC::loadJQuery('latest', true, 'citruscartJQ'); /* if ($this->defines->get('use_bootstrap', '0')) { DSC::loadBootstrap(); } */ //JHTML::_('stylesheet', 'common.css', 'media/citruscart/css/'); $doc->addStyleSheet(JUri::root() . 'media/citruscart/css/common.css'); if ($this->defines->get('include_site_css', '0')) { $doc->addStyleSheet(JUri::root() . 'media/citruscart/css/citruscart.css'); //JHtml::_('stylesheet', 'media/citruscart/css/citruscart.css'); } parent::display($tpl); }
/** * TODO Push this upstream once tested * * @param unknown_type $url * @param unknown_type $text * @param unknown_type $options */ public static function popupbootstrap($url, $text, $options = array()) { $version = isset($options['version']) ? $options['version'] : 'default'; DSC::loadBootstrap(); JHTML::_('script', 'bootstrap-modal.js', 'media/dioscouri/bootstrap/' . $version . '/js/'); $time = time(); $modal_id = isset($options['modal_id']) ? $options['modal_id'] : 'modal-' . $time; $button_class = isset($options['button_class']) ? $options['button_class'] : 'btn'; $label = 'label-' . $time; $button = '<a href="' . $url . '" data-target="#' . $modal_id . '" role="button" class="' . $button_class . '" data-toggle="modal">' . $text . '</a>'; $modal = ''; $modal .= '<div id="' . $modal_id . '" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="' . $label . '" aria-hidden="true">'; $modal .= ' <div class="modal-header">'; $modal .= ' <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>'; $modal .= ' <h3 id="' . $label . '">' . $text . '</h3>'; $modal .= ' </div>'; $modal .= ' <div class="modal-body">'; $modal .= ' </div>'; $modal .= '</div>'; return $button . $modal; }
$package['group'] = $pgroup; $package['element'] = $name; $package['client'] = ''; /* * fire the dioscouriInstaller */ $dscInstaller = new dscInstaller(); $result = $dscInstaller->uninstallExtension($package); // track the message and status of installation from dscInstaller if ($result) { $alt = JText::_("Uninstalled"); $pstatus = "<img src='" . DSC::getURL('images') . "tick.png' border='0' alt='{$alt}' />"; } else { $alt = JText::_("Failed"); $error = $dscInstaller->getError(); $pstatus = "<img src='" . DSC::getURL('images') . "publish_x.png' border='0' alt='{$alt}' /> "; $pstatus .= " - " . $error; } $status->plugins[] = array('name' => $pname, 'group' => $pgroup, 'status' => $pstatus); } } /*********************************************************************************************** * --------------------------------------------------------------------------------------------- * OUTPUT TO SCREEN * --------------------------------------------------------------------------------------------- ***********************************************************************************************/ $rows = 0; ?> <h2><?php echo JText::_('Uninstallation Results');
/** * Method to intelligently load class files in the framework * * @param string $classname The class name * @param string $filepath The filepath ( dot notation ) * @param array $options * @return boolean */ public static function load($classname, $filepath = 'controller', $options = array('site' => 'admin', 'type' => 'components', 'ext' => 'com_mysite')) { return parent::load($classname, $filepath, $options); }
* - added JPEG compression quality setting. Thanks Vad</li> * <li><b>v 0.14</b> 14/03/2005<br> * - reworked the class file to allow parsing with phpDocumentor</li> * <li><b>v 0.13</b> 07/03/2005<br> * - fixed a bug with {@link image_ratio}. Thanks Justin.<br> * - added {@link image_ratio_no_zoom_in} and {@link image_ratio_no_zoom_out} </li> * <li><b>v 0.12</b> 21/01/2005<br> * - added {@link image_ratio} to resize within max values, keeping image ratio</li> * <li><b>v 0.11</b> 22/08/2003<br> * - update for GD2 (changed imageresized() into imagecopyresampled() and imagecreate() into imagecreatetruecolor())</li> * </ul> * * @package cmf * @subpackage external */ DSC::load('DSCImage', 'library.image'); class DSCUpload extends DSCImage { /** * Class version * * @access public * @var string */ var $version; /** * Uploaded file name * * @access public * @var string */
/** * Gets the parsed layout file * * @param string $layout The name of the layout file * @param object $vars Variables to assign to * @param string $plugin The name of the plugin * @param string $group The plugin's group * @return string * @access protected */ protected function _getLayout($layout, $vars = false, $plugin = '', $group = '') { if (empty($group)) { $app = DSC::getApp(); $com_name = $app->getName(); $group = str_replace('com_', '', $com_name); if (empty($group)) { // TODO Try to get it some other way, such as from the name of the plugin? return null; } } if (empty($plugin)) { $plugin = $this->_element; } ob_start(); $layout = $this->_getLayoutPath($plugin, $group, $layout); include $layout; $html = ob_get_contents(); ob_end_clean(); return $html; }
/** * */ public function getDate_Format($default = null) { if (version_compare(JVERSION, '1.6.0', 'ge')) { // Joomla! 1.6+ code here return parent::get('date_format_act', $default); } else { // Joomla! 1.5 code here return parent::get('date_format', $default); } }
/** * Returns * * @param object * @param mixed Boolean * @param mixed Boolean * @return array */ private function getEmailContent($data, $type = 'order') { $mainframe = JFactory::getApplication(); $type = strtolower($type); $lang = JFactory::getLanguage(); $lang->load('com_sample', JPATH_ADMINISTRATOR); $return = new stdClass(); $return->body = ''; $return->subject = ''; // get config settings $config = DSCConfig::getInstance(); $sitename = $config->get('sitename', $mainframe->getCfg('sitename')); $siteurl = $config->get('siteurl', JURI::root()); // get the placeholders array here so the switch statement can add to it $placeholders = $this->getPlaceholderDefaults(); switch ($type) { case "subscription_expiring": $return->subject = JText::_('EMAIL_EXPIRING_SUBSCRIPTION_SUBJECT'); $return->body = JText::_('EMAIL_EXPIRING_SUBSCRIPTION_BODY'); if ($this->use_html) { $return->body = nl2br($return->body); } $placeholders['user.name'] = $data->user_name; $placeholders['product.name'] = $data->product_name; break; case "subscription_expired": $return->subject = JText::_('EMAIL_EXPIRED_SUBSCRIPTION_SUBJECT'); $return->body = JText::_('EMAIL_EXPIRED_SUBSCRIPTION_BODY'); if ($this->use_html) { $return->body = nl2br($return->body); } $placeholders['user.name'] = $data->user_name; $placeholders['product.name'] = $data->product_name; break; case "subscription_new": case "new_subscription": case "subscription": $user = JFactory::getUser($data->user_id); $link = JURI::root() . "index.php?option=com_sample&view=orders&task=view&id=" . $data->order_id; $link = JRoute::_($link, false); if (count($data->history) == 1) { // new order $return->subject = sprintf(JText::_('EMAIL_NEW_ORDER_SUBJECT'), $data->order_id); // set the email body $text = JText::_('EMAIL_DEAR') . " " . $user->name . ",\n\n"; $text .= JText::_("EMAIL_THANKS_NEW_SUBSCRIPTION") . "\n\n"; $text .= JText::_("EMAIL_CHECK") . " " . $link . "\n\n"; $text .= JText::_("EMAIL_RECEIPT_FOLLOWS") . "\n\n"; if ($this->use_html) { $text = nl2br($text); } // get the order body DSC::load('DSCHelperOrder', 'helpers.order'); $text .= DSCHelperOrder::getOrderHtmlForEmail($data->order_id); } else { // Status Change $return->subject = JText::_('EMAIL_SUBSCRIPTION_STATUS_CHANGE'); $last_history = count($data->history) - 1; $text = JText::_('EMAIL_DEAR') . " " . $user->name . ",\n\n"; $text .= sprintf(JText::_("EMAIL_ORDER_UPDATED"), $data->order_id); if (!empty($data->history[$last_history]->comments)) { $text .= sprintf(JText::_("EMAIL_ADDITIONAL_COMMENTS"), $data->history[$last_history]->comments); } $text .= JText::_("EMAIL_CHECK") . " " . $link; if ($this->use_html) { $text = nl2br($text); } } $return->body = $text; $placeholders['user.name'] = $user->get('name'); break; case "new_order": case "order": default: //$user = JUser::getInstance($data->user_id); $user = JFactory::getUser($data->user_id); $link = JURI::root() . "index.php?option=com_sample&view=orders&task=view&id=" . $data->order_id; $link = JRoute::_($link, false); if ($type == 'new_order') { // new order $return->subject = sprintf(JText::_('EMAIL_NEW_ORDER_SUBJECT'), $data->order_id); // set the email body $text = JText::_('EMAIL_DEAR') . " " . $user->name . ",\n\n"; $text .= JText::_("EMAIL_THANKS_NEW_ORDER") . "\n\n"; $text .= JText::_("EMAIL_CHECK") . " " . $link . "\n\n"; $text .= JText::_("EMAIL_RECEIPT_FOLLOWS") . "\n\n"; if ($this->use_html) { $text = nl2br($text); } // get the order body DSC::load('DSCHelperOrder', 'helpers.order'); $text .= DSCHelperOrder::getOrderHtmlForEmail($data->order_id); } else { // Status Change $return->subject = JText::_('EMAIL_ORDER_STATUS_CHANGE'); $last_history = count($data->orderhistory) - 1; $text = JText::_('EMAIL_DEAR') . " " . $user->name . ",\n\n"; $text .= sprintf(JText::_("EMAIL_ORDER_UPDATED"), $data->order_id); $text .= JText::_("EMAIL_NEW_STATUS") . " " . $data->orderhistory[$last_history]->order_state_name . "\n\n"; if (!empty($data->orderhistory[$last_history]->comments)) { $text .= sprintf(JText::_("EMAIL_ADDITIONAL_COMMENTS"), $data->orderhistory[$last_history]->comments); } $text .= JText::_("EMAIL_CHECK") . " " . $link; if ($this->use_html) { $text = nl2br($text); } } $return->body = $text; $placeholders['user.name'] = $user->get('name'); break; } // replace placeholders in language strings - great idea, Oleg $return->subject = $this->replacePlaceholders($return->subject, $placeholders); $return->body = $this->replacePlaceholders($return->body, $placeholders); return $return; }
/** * Nicely format a number * * @param $number * @return unknown_type */ public static function number($number, $options = '') { $config = DSC::getApp(); $options = (array) $options; $thousands = isset($options['thousands']) ? $options['thousands'] : $config->get('number_thousands', ','); $decimal = isset($options['decimal']) ? $options['decimal'] : $config->get('number_decimal', '.'); $num_decimals = isset($options['num_decimals']) ? $options['num_decimals'] : $config->get('number_num_decimals', '0'); $return = number_format($number, $num_decimals, $decimal, $thousands); return $return; }
/** * Displays the menu according to view. * * @return unknown_type */ public function display($layout = 'submenu', $hidemainmenu = '', $type = '') { $input = JFactory::getApplication()->input; jimport('joomla.application.component.view'); // TODO This should be passed as an argument $hide = $input->getInt('hidemainmenu'); if (version_compare(JVERSION, '1.6.0', 'ge')) { // Joomla! 1.6+ code here $items = $this->_menu->getItems(); $name = $this->_name; } else { // Joomla! 1.5 code here $items = $this->_menu->_bar; $name = $this->_name; } // Load the named template, if there are links to display. if (!empty($items)) { $base = JFactory::getApplication()->isAdmin() ? JPATH_ADMINISTRATOR : JPATH_SITE; $app = DSC::getApp(); $template = JFactory::getApplication()->getTemplate(); $lib_path = JPATH_SITE . '/libraries/dioscouri/component/view/dashboard'; $com_template_path = $base . '/components/com_' . $app->getName() . '/views/dashboard/tmpl'; $template_path = $base . '/templates/' . $template . '/html/com_' . $app->getName() . '/dashboard'; $view = new DSCViewBase(array('name' => 'dashboard', 'template_path' => $lib_path)); $view->set('items', $items); $view->set('name', $name); $view->set('layout', $layout); $view->set('hide', $hide); $view->setLayout($layout); $view->addTemplatePath($com_template_path); $view->addTemplatePath($template_path); $view->display(); } }
function onAfterRoute() { $doc = JFactory::getDocument(); if ($this->params->get('activeAdmin') == 1) { $juri = JFactory::getURI(); if (strpos($juri->getPath(), '/administrator/') !== false) { return; } } if ($value = $this->params->get('embedjquery')) { DSC::loadJQuery('latest', $this->params->get('jquerynoconflict')); } JHTML::_('script', 'colorbox.js', 'media/citruscart/colorbox/'); if ($value = $this->params->get('embedbootstrap')) { DSC::loadBootstrap($this->params->get('bootstrapversion'), $this->params->get('bootstrapjoomla')); } }
protected static function _checkedOut(&$row, $overlib = 1) { $hover = ''; if ($overlib) { $text = addslashes(htmlspecialchars($row->editor)); $date = JHTML::_('date', $row->checked_out_time, JText::_('DATE_FORMAT_LC1')); $time = JHTML::_('date', $row->checked_out_time, '%H:%M'); $hover = '<span class="editlinktip hasTip" title="' . JText::_('Checked Out') . '::' . $text . '<br />' . $date . '<br />' . $time . '">'; } $checked = $hover . '<img src="' . DSC::getURL('images') . 'checked_out.png"/></span>'; return $checked; }
/** * * @param string $version * @param int $joomla * @param unknown_type $responsive */ public static function loadBootstrap($version = 'default', $joomla = true, $responsive = false) { // short term backwards compatibility. Update your components if (is_int($version) && in_array($version, array(0, 1)) || strlen($joomla) > 1) { $org_version = $version; $org_joomla = $joomla; $version = $org_joomla; $joomla = $org_version; } static $loaded = false; if ($loaded) { return; } DSC::loadJQuery(); $doc = JFactory::getDocument(); /* $doc->addStyleSheet(JUri::root().'media/citruscart/bootstrap/'.$version.'/css/bootstrap.min.css');*/ //$doc->addScript(JUri::root().'media/citruscart/bootstrap/'.$version.'/js/bootstrap.min.js'); /* if ($joomla) { $doc->addStyleSheet(JUri::root().'media/citruscart/css/joomla.bootstrap.css'); } if ($responsive) { $doc->addStyleSheet(JUri::root().'media/citruscart/bootstrap/'.$version.'/css/bootstrap-responsive.min.css'); //JHTML::_( 'stylesheet', 'bootstrap-responsive.min.css', 'media/citruscart/bootstrap/'.$version.'/css/' ); }*/ $loaded = true; }
/** * Format and convert a number according to currency rules * * @param unknown_type $amount * @param unknown_type $currency * @return unknown_type */ public static function _($amount, $currency = '', $options = '') { // default to whatever is in config $config = DSC::getApp(); $options = (array) $options; $default_currencyid = $config->get('default_currencyid', '1'); $num_decimals = isset($options['num_decimals']) ? $options['num_decimals'] : $config->get('currency_num_decimals', '2'); $thousands = isset($options['thousands']) ? $options['thousands'] : $config->get('currency_thousands', ','); $decimal = isset($options['decimal']) ? $options['decimal'] : $config->get('currency_decimal', '.'); $pre = isset($options['pre']) ? $options['pre'] : $config->get('currency_symbol_pre', '$'); $post = isset($options['post']) ? $options['post'] : $config->get('currency_symbol_post', ''); // Now check the session variable to see if there is a currency setting there $session_currency = DSCHelper::getSessionVariable('currency_id', 0); if ($session_currency) { // Let the code below deal with currency loading $currency = $session_currency; } // if currency is an object, use it's properties if (is_object($currency)) { $table = $currency; $num_decimals = $table->currency_decimals; $thousands = $table->thousands_separator; $decimal = $table->decimal_separator; $pre = $table->symbol_left; $post = $table->symbol_right; if ($default_currencyid != $table->currency_id) { $convertTo = $table->currency_code; } } elseif (!empty($currency) && is_numeric($currency)) { // TODO if currency is an integer, load the object for its id JTable::addIncludePath(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_sample' . DS . 'tables'); $table = JTable::getInstance('Currencies', 'DSCTable'); $table->load((int) $currency); if (!empty($table->currency_id)) { $num_decimals = $table->currency_decimals; $thousands = $table->thousands_separator; $decimal = $table->decimal_separator; $pre = $table->symbol_left; $post = $table->symbol_right; if ($default_currencyid != $currency) { $convertTo = $table->currency_code; } } } elseif (!empty($currency)) { // TODO if currency is a string (currency_code) load the object for its code JTable::addIncludePath(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_sample' . DS . 'tables'); $table = JTable::getInstance('Currencies', 'DSCTable'); $keynames = array(); $keynames['currency_code'] = (string) $currency; $table->load($keynames); if (!empty($table->currency_id)) { $num_decimals = $table->currency_decimals; $thousands = $table->thousands_separator; $decimal = $table->decimal_separator; $pre = $table->symbol_left; $post = $table->symbol_right; if ($default_currencyid != $table->currency_id) { $convertTo = $table->currency_code; } } } // if the currency code we're using is diff from the store-wide currency, then we need to convert the amount if (!empty($convertTo)) { JTable::addIncludePath(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_sample' . DS . 'tables'); $table = JTable::getInstance('Currencies', 'DSCTable'); $table->load((int) $default_currencyid); DSC::load('DSCHelperCurrency', 'helpers.currency'); $amount = DSCHelperCurrency::convert($table->currency_code, $convertTo, $amount); } $return = $pre . number_format($amount, $num_decimals, $decimal, $thousands) . $post; return $return; }
<?php defined('_JEXEC') or die('Restricted access'); JHTML::_('script', 'tienda.js', 'media/com_tienda/js/'); $state = @$this->state; $form = @$this->form; $items = @$this->items; ?> <?php DSC::loadHighcharts(); ?> <?php echo TiendaGrid::pagetooltip(JRequest::getVar('view')); ?> <table style="width: 100%;"> <tr> <td style="width: 70%; max-width: 70%; vertical-align: top; padding: 0px 5px 0px 5px;"> <form action="<?php echo JRoute::_(@$form['action']); ?> " method="post" name="adminForm" enctype="multipart/form-data"> <table class="table table-striped table-bordered" style="margin-bottom: 5px;"> <thead> <tr> <th><?php echo JText::_('COM_TIENDA_RANGE');
/** * get sql ORDER BY part from DSCs * * @param array $sort array of DSC instances * @return string */ protected static function buildSqlOrderBy($sort) { return DSC::buildSqlOrderBy(new self::$CLASS_NAME(), $sort); }
/** * * Get Avatar based on the installed community component * @param int $id - userid * @return object */ function getAvatar($id) { $avatar = ''; $found = false; Citruscart::load('CitruscartHelperAmbra', 'helpers.ambra'); $helper_ambra = CitruscartHelperBase::getInstance('Ambra'); //check if ambra installed if ($helper_ambra->isInstalled() && !$found) { if (!class_exists('Ambra')) { JLoader::register("Ambra", JPATH_ADMINISTRATOR . "/components/com_ambra/defines.php"); } //Get Ambra Avatar if ($image = Ambra::getClass("AmbraHelperUser", 'helpers.user')->getAvatar($id)) { $link = JRoute::_(JURI::root() . 'index.php?option=com_ambra&view=users&id=' . $id, false); $avatar .= "<a href='{$link}' target='_blank'>"; $avatar .= "<img src='{$image}' style='max-width:80px; border:1px solid #ccccce;' />"; $avatar .= "</a>"; } $found = true; } //check if jomsocial installed if (DSC::getApp()->isComponentInstalled('com_community') && !$found) { //Get JomSocial Avatar $database = JFactory::getDBO(); $query = "\r\n\t\t\tSELECT\r\n\t\t\t\t*\r\n\t\t\tFROM\r\n\t\t\t\t#__community_users\r\n\t\t\tWHERE\r\n\t\t\t\t`userid` = '" . $id . "'\r\n\t\t\t"; $database->setQuery($query); $result = $database->loadObject(); if (isset($result->thumb)) { $image = JURI::root() . $result->thumb; } $link = JRoute::_(JURI::root() . 'index.php?option=com_community&view=profile&userid=' . $id, false); $avatar .= "<a href='{$link}' target='_blank'>"; $avatar .= "<img src='{$image}' style='max-width:80px; border:1px solid #ccccce;' />"; $avatar .= "</a>"; $found = true; } //check if community builder is installed if (DSC::getApp()->isComponentInstalled('com_comprofiler') && !$found) { //Get JomSocial Avatar $database = JFactory::getDBO(); $query = "\r\n\t\t\tSELECT\r\n\t\t\t\t*\r\n\t\t\tFROM\r\n\t\t\t\t#__comprofiler\r\n\t\t\tWHERE\r\n\t\t\t\t`id` = '" . $id . "'\r\n\t\t\t"; $database->setQuery($query); $result = $database->loadObject(); if (isset($result->avatar)) { $image = JURI::root() . 'images/comprofiler/' . $result->avatar; } else { $image = JRoute::_(JURI::root() . 'components/com_comprofiler/plugin/templates/default/images/avatar/nophoto_n.png'); } $link = JRoute::_(JURI::root() . 'index.php?option=com_comprofiler&userid=' . $id, false); $avatar .= "<a href='{$link}' target='_blank'>"; $avatar .= "<img src='{$image}' style='max-width:80px; border:1px solid #ccccce;' />"; $avatar .= "</a>"; $found = true; } return $avatar; }
/** * Load the library -- installing it if necessary * * @return boolean result of install & load */ public function getLibrary() { if (!$this->checkPHPVersion()) { $this->setError("You do not meet the minimum system requirements. You must have at least PHP version: " . $this->min_php_required . " but you are using " . PHP_VERSION); return false; } jimport('joomla.filesystem.file'); if (!class_exists('DSC')) { if (!JFile::exists(JPATH_SITE . '/libraries/dioscouri/dioscouri.php')) { JModel::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_installer/models'); if ($this->install('library')) { // if j15, move files if (!version_compare(JVERSION, '1.6.0', 'ge')) { // Joomla! 1.5 code here if (JFile::exists(JPATH_SITE . '/plugins/system/dioscouri/dioscouri.php')) { $this->manuallyInstallLibrary(); } } else { if (!$this->install('plugin')) { $this->setError("Could not install Dioscouri System Plugin"); } } if (!$this->enablePlugin()) { $this->setError("Could not enable the Dioscouri System Plugin"); } if (JFile::exists(JPATH_SITE . '/libraries/dioscouri/dioscouri.php')) { require_once JPATH_SITE . '/libraries/dioscouri/dioscouri.php'; if (!DSC::loadLibrary()) { $this->setError("Could not load Dioscouri Library after installing it"); return false; } return true; } } else { $this->setError("Could not install Dioscouri Library"); return false; } } else { require_once JPATH_SITE . '/libraries/dioscouri/dioscouri.php'; if (!DSC::loadLibrary()) { $this->setError("Could not load Dioscouri Library"); return false; } return true; } } return true; }
/** * */ public static function getItems($option = '') { static $items; if (empty($option)) { $com = DSC::getApp(); $option = 'com_' . $com->getName(); } $app = JApplication::getInstance('site'); $menus = $app->getMenu(); if (empty($menus)) { return array(); } if (empty($items)) { $items = array(); } if (empty($items[$option])) { $component = JComponentHelper::getComponent($option); foreach ($menus->getItems('component', $option) as $item) { if (!is_object($item)) { continue; } if ($item->component_id == $component->id || $item->componentid == $component->id || !empty($item->query['option']) && $item->query['option'] == $option) { $items[$option][] = $item; } } } if (empty($items[$option])) { return array(); } return $items[$option]; }