protected function prepareDisplay($preconfig) { if (JCck::getConfig_Param('debug', 0)) { jimport('joomla.error.profiler'); $profiler = new JProfiler(); } $app = JFactory::getApplication(); $this->form = $this->get('Form'); $this->option = $app->input->get('option', ''); $this->item = $this->get('Item'); $this->state = $this->get('State'); $option = $this->option; $params = new JRegistry(); $view = $this->getName(); $isNew = 1; $live = ''; $lives = array(); $variation = ''; jimport('cck.base.form.form'); include_once JPATH_LIBRARIES_CCK . '/base/form/form_inc.php'; if (isset($config['id'])) { JFactory::getSession()->set('cck_hash_seblod_form', JApplication::getHash($id . '|' . $type->name . '|' . $config['id'])); } $this->config =& $config; $this->data =& $data; $this->id =& $id; $this->isNew =& $isNew; $this->params =& $params; $this->stage =& $stage; $this->type =& $type; $title = isset($type->title) ? $type->title : ''; $name = isset($type->name) ? $type->name : ''; $this->addToolbar($title, $name); }
function display($tpl = null) { switch ($this->getlayout()) { case 'delete': $this->prepareDelete(); break; case 'edit': case 'error': $this->prepareDisplay(); break; case 'edit2': $this->prepareDisplay(); $this->prepareDisplay_Ajax(); break; default: break; } if (JCck::on()) { $this->css = array('_' => '', 'panel_height' => '89px', 'w30' => 'span4', 'w70' => 'span8', 'wrapper' => 'container', 'wrapper2' => 'row-fluid', 'wrapper_tmpl' => 'span'); $this->js = array('_' => '', 'tooltip' => '$(".hasTooltip").tooltip({});'); } else { $this->css = array('_' => '', 'panel_height' => '65px', 'w30' => 'width-30', 'w70' => 'width-70 fltlft', 'wrapper' => 'sebwrapper', 'wrapper2' => 'seb-wrapper workshop', 'wrapper_tmpl' => 'width-100 bg-dark fltlft'); $this->js = array('_' => '', 'tooltip' => ''); } $this->uix = 'full'; parent::display($tpl); }
function display($tpl = NULL) { $app = JFactory::getApplication(); $this->item = new stdClass(); $this->state = $this->get('State'); $this->option = $app->input->get('option', ''); $this->file = $this->state->get('file', ''); $this->item->id = $this->state->get('bx.id', ''); $this->item->name = $this->state->get('bx.name', ''); $this->item->alt = $this->state->get('alt', 0); if ($this->getLayout() != 'raw') { $this->function = $this->state->get('function', ''); $this->item->title = $this->state->get('bx.title', ''); $this->item->type = $this->state->get('bx.type', ''); $this->item->params = $this->state->get('bx.params', ''); $this->doValidation = $this->state->get('validation', 0); } if (JCck::on()) { $this->css = array('items' => 'seblod-manager', 'table' => 'table table-striped', 'wrapper_tmpl' => 'span12'); } else { $this->css = array('items' => 'seblod', 'table' => 'adminlist', 'wrapper_tmpl' => 'width-100 bg-dark fltlft'); } JFactory::getApplication()->input->set('hidemainmenu', true); parent::display($tpl); }
public static function apply($type, &$total) { $user = JCck::getUser(); $my_groups = $user->getAuthorisedGroups(); $my_zones = JCckEcommerce::getUserZones(); $currency = JCckEcommerce::getCurrency(); $tax = ''; $taxes = JCckEcommerce::getTaxes($type, $my_zones); if (count($taxes)) { foreach ($taxes as $p) { $groups = explode(',', $p->groups); if (count(array_intersect($my_groups, $groups)) > 0) { switch ($p->tax) { case 'plus': $tax = $p->tax_amount; $total += $tax; break; case 'percentage': $tax = $total * $p->tax_amount / 100; $total += $tax; break; default: break; } } } } return $tax; }
public static function setHead(&$head) { $app = JFactory::getApplication(); $doc = JFactory::getDocument(); if (isset($app->cck_document)) { if (isset($app->cck_document['styleSheets']) && count($app->cck_document['styleSheets'])) { foreach ($app->cck_document['styleSheets'] as $k => $v) { $head['styleSheets'][$k] = $v; } if (JCck::on()) { $doc->setHeadData(array('styleSheets' => $head['styleSheets'])); } else { $doc->_styleSheets = $head['styleSheets']; } } if (isset($app->cck_document['scripts']) && count($app->cck_document['scripts'])) { foreach ($app->cck_document['scripts'] as $k => $v) { $head['scripts'][$k] = $v; } if (JCck::on()) { $doc->setHeadData(array('scripts' => $head['scripts'])); } else { $doc->_scripts = $head['scripts']; } } } }
public static function onCCK_Storage_LocationAfterRender(&$buffer, &$data, $uri = array()) { $app = JFactory::getApplication(); if ($uri['layout']) { return; } if ($uri['view'] == 'featured') { $data['return_view'] = 'featured'; $tag = '&return=featured'; } else { $data['return_view'] = ''; $tag = ''; } $class = JCck::on('3.4') ? ' class="hasTooltip"' : ''; $data['doIntegration'] = false; $data['multilanguage'] = $data['options']->get('multilanguage', 0); if ($data['multilanguage']) { $data['search'] = '#<a' . $class . ' href="(.*)index.php\\?option=com_content&task=article.edit' . $tag . '&id=([0-9]*)" (.*)>#U'; } else { $data['search'] = '#<a' . $class . ' href="(.*)index.php\\?option=com_content&task=article.edit' . $tag . '&id=([0-9]*)"#'; } $data['search_alt'] = '#<a href = "javascript://" onclick="listItemTask\\(\'cb([0-9]*)\', \'articles.archive\'\\)">(.*)</a>#sU'; if (JCckDevHelper::hasLanguageAssociations() && $data['multilanguage']) { $query = 'SELECT a.pk, a.cck, b.key, c.language FROM #__cck_core AS a' . ' LEFT JOIN #__associations AS b ON ( b.id = a.pk AND context = "com_content.item" )' . ' LEFT JOIN #__content AS c ON c.id = a.pk' . ' WHERE storage_location="joomla_article"'; $list_assoc = JCckDatabase::loadObjectListArray('SELECT a.id, a.key, b.language FROM #__associations AS a LEFT JOIN #__content AS b ON ( b.id = a.id AND a.context = "com_content.item" )', 'key', 'language'); } else { $query = 'SELECT pk, cck FROM #__cck_core WHERE storage_location="joomla_article"'; $list_assoc = array(); } $list = JCckDatabase::loadObjectList($query, 'pk'); $buffer = JCckDevIntegration::rewriteBuffer($buffer, $data, $list, $list_assoc); }
public function save($key = null, $urlVar = null) { JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); $app = JFactory::getApplication(); $model = $this->getModel('form'); $preconfig = $app->input->post->get('config', array(), 'array'); $task = $this->getTask(); $config = $model->store($preconfig); $id = $config['pk']; if ($config['validate'] == 'retry') { parent::display(); return true; } if ($id) { if ($config['stage'] > -1) { $link = 'index.php?option=' . CCK_COM . '&view=form&type=' . $preconfig['type'] . '&id=' . $id . $this->_getRedirectQuery(); if ($config['stage'] > 0) { $link .= '&stage=' . $config['stage']; } $this->setRedirect(htmlspecialchars_decode($link)); return; } if ($config['message_style']) { if (isset($config['message'])) { $msg = $config['doTranslation'] ? JText::_('COM_CCK_' . str_replace(' ', '_', trim($config['message']))) : $config['message']; } else { $msg = JText::_('COM_CCK_SUCCESSFULLY_SAVED'); } $msgType = $config['message_style']; } else { $msg = ''; $msgType = ''; } } else { $msg = JText::_('JERROR_AN_ERROR_HAS_OCCURRED'); $msgType = 'error'; } switch ($task) { case 'apply': $link = 'index.php?option=' . CCK_COM . '&view=form&type=' . $preconfig['type'] . '&id=' . $id . $this->_getRedirectQuery(); break; case 'save2new': $link = 'index.php?option=' . CCK_COM . '&view=form&type=' . $preconfig['type'] . $this->_getRedirectQuery(); break; case 'save2view': $location = JCckDatabase::loadResult('SELECT storage_location FROM #__cck_core WHERE id = ' . (int) $id); $sef = 0; $itemId2 = 0; if ($location) { require_once JPATH_SITE . '/plugins/cck_storage_location/' . $location . '/' . $location . '.php'; $link = JCck::callFunc_Array('plgCCK_Storage_Location' . $location, 'getRoute', array($config['pk'], $sef, $itemId2, array('type' => $config['type']))); $link = str_replace('/administrator/', '/', $link); break; } default: $link = $this->_getRedirectQuery(true); break; } $this->setRedirect(htmlspecialchars_decode($link), $msg, $msgType); }
public function prepareToolbar() { Helper_Admin::addToolbar($this->vName, $this->vTitle, $this->state->get('filter.folder')); if (JCck::on()) { JHtmlSidebar::setAction('index.php?option=com_cck&view=templates'); } }
protected function getInput() { JPluginHelper::importPlugin('cck_field'); require_once JPATH_PLUGINS . '/cck_field_validation/required/required.php'; $name = 'core_options'; $override = array('rows' => 1); $storage = (string) $this->element['cck_storage_field_prefix']; $and = $storage != '' ? ' AND a.storage_field LIKE "' . $storage . '%"' : ''; $fields = JCckDatabase::loadObjectList('SELECT a.title as text, a.name as value FROM #__cck_core_fields AS a' . ' WHERE a.storage = "dev" AND a.id > 500' . $and . ' ORDER BY text'); $fields = is_array($fields) ? array_merge(array(JHtml::_('select.option', '', '- ' . JText::_('COM_CCK_ADD_A_FIELD') . ' -')), $fields) : array(); $html = JHtml::_('select.genericlist', $fields, 'fields_list', 'size="1" class="inputbox select" style="max-width:175px;"', 'value', 'text', '', 'fields_list'); $format = (string) $this->element['js_format']; $lang = JFactory::getLanguage(); $lang->load('com_cck'); $lang->load('com_cck_default', JPATH_SITE); if ($format != 'raw') { JCck::loadjQuery(true, true, true); } $force_id = (string) $this->element['id']; $config = array('asset' => '', 'asset_id' => 0, 'client' => '', 'doTranslation' => 1, 'doValidation' => 2, 'pk' => ''); if ($format == 'raw') { $config['tmpl'] = 'ajax'; } $inherit = $force_id != '' ? array('id' => (string) $this->element['id']) : array(); $field = JCckDevField::getObject($name); if (!$field) { return; } $storage_field = $field->storage_field; $field->storage_field = $this->name; $field = JCckDevField::get($field, $this->value, $config, $inherit, $override); $script = $this->_addScripts((string) $this->element['name'], array('value' => $this->value), $format); return $field->form . $html . $script; }
public static function addValidation($rules, $options, $id = '', &$config = array()) { $doc = JFactory::getDocument(); if (!$id) { $id = 'seblod_form'; } if (empty($rules)) { $rules = ''; } $rules = str_replace(array("\r\n", "\r", "\n", "\t", ' ', ' ', ' '), '', $rules); if (is_object($options)) { $bgcolor = $options->get('validation_background_color', JCck::getConfig_Param('validation_background_color', '')); $color = $options->get('validation_color', JCck::getConfig_Param('validation_color', '')); $position = $options->get('validation_position', JCck::getConfig_Param('validation_position', 'topRight')); $scroll = $options->get('validation_scroll', JCck::getConfig_Param('validation_scroll', 1)) ? 'scroll:true' : 'scroll:false'; if ($color != '') { if ($position == 'inline') { $doc->addStyleDeclaration('#' . $id . ' .formError .formErrorContent{color: ' . $color . '}'); } else { $doc->addStyleDeclaration('.formError .formErrorContent{color: ' . $color . '}'); } } if ($position != 'inline' && $bgcolor != '') { $doc->addStyleDeclaration('.formError .formErrorContent, .formError .formErrorArrow div{background: ' . $bgcolor . '}'); } $options = '{' . $scroll . ',promptPosition:"' . $position . '"}'; } else { $options = '{}'; } $doc->addStyleSheet(JURI::root(true) . '/media/cck/css/cck.validation.css'); $doc->addScript(JURI::root(true) . '/media/cck/js/cck.validation-3.2.0.min.js'); $js = 'jQuery(document).ready(function($){ $.validationEngineLanguage.newLang({' . $rules . '}); $("#' . $id . '").validationEngine(' . $options . '); });'; $doc->addScriptDeclaration($js); }
public static function onCCK_Field_ValidationPrepareForm(&$field, $fieldId, &$config) { if (self::$type != $field->validation) { return; } $and = ''; $extra = ''; $extraData2 = ''; $name = 'availability_' . $fieldId; $validation = parent::g_getValidation($field->validation_options); $alert = self::_alert($validation, 'alert', $config); $alert2 = self::_alert($validation, 'alert2', $config); $alert3 = self::_alert($validation, 'alert3', $config); $prefix = JCck::getConfig_Param('validation_prefix', '* '); if (isset($validation->fieldnames) && $validation->fieldnames) { $extra .= '&avWhere=' . str_replace('||', ',', $validation->fieldnames); $extraData2 = '"extraDataDynamic": "#' . str_replace('||', ',#', $validation->fieldnames) . '",'; $and = self::_where($validation->table, $validation->fieldnames, $config['storages'][$validation->table], 'object'); } if ($field->value) { $pk = (int) JCckDatabase::loadResult('SELECT ' . $validation->key . ' FROM ' . $validation->table . ' WHERE ' . $validation->column . '="' . JCckDatabase::escape($field->value) . '"' . $and); $extra .= '&avKey=' . $validation->key . '&avPk=' . $pk . '&avPv=' . htmlspecialchars(str_replace(array('<', '>', "'"), array('%26lt;', '%26gt;', '%27'), $field->value)); } $rule = ' "' . $name . '":{ "url": "' . JUri::base() . 'index.php?option=com_cck&task=ajax&format=raw&file=/plugins/cck_field_validation/ajax_availability/assets/ajax/script.php", "extraData": "avTable=' . str_replace('#__', '', $validation->table) . '&avColumn=' . $validation->column . $extra . '", ' . $extraData2 . ' "alertText": "' . $prefix . $alert . '", "alertTextOk": "' . $prefix . $alert2 . '", "alertTextLoad": "' . $prefix . $alert3 . '"} '; $config['validation'][$name] = $rule; $field->validate[] = 'ajax[' . $name . ']'; }
public static function apply($type, &$total, $params = array()) { $user = JCck::getUser(); $my_groups = $user->getAuthorisedGroups(); $currency = JCckEcommerce::getCurrency(); $discount = ''; $promotions = JCckEcommerce::getPromotions($type); if (count($promotions)) { foreach ($promotions as $p) { if (isset($params['target']) && $params['target']) { if ($params['target'] == 'order' && $p->target == 0) { // OK } elseif ($params['target'] == 'product') { if ($p->target == 1) { // OK } elseif ($p->target == 2) { $products = self::getTargets($p->id); if (!isset($products[$params['target_id']])) { continue; } } elseif ($p->target == -2) { $products = self::getTargets($p->id); if (isset($products[$params['target_id']])) { continue; } } else { continue; } } else { continue; } } if ($p->type == 'coupon') { if ($p->code && $p->code != @$params['code']) { continue; } } $groups = explode(',', $p->groups); if (count(array_intersect($my_groups, $groups)) > 0) { switch ($p->discount) { case 'free': $discount = 'FREE'; $total = 0; break; case 'minus': $discount = '- ' . $currency->lft . $p->discount_amount . $currency->right; $total -= $p->discount_amount; break; case 'percentage': $discount = '- ' . $p->discount_amount . ' %'; $total = $total - $total * $p->discount_amount / 100; break; default: break; } } } } return $discount; }
public function prepareUI() { if (JCck::on()) { $this->css = array('w30' => 'span4', 'w70' => 'span8', 'wrapper' => 'container', 'wrapper2' => 'row-fluid', 'wrapper_tmpl' => 'span'); } else { $this->css = array('w30' => 'width-30', 'w70' => 'width-70 fltlft', 'wrapper' => 'sebwrapper', 'wrapper2' => 'seb-wrapper', 'wrapper_tmpl' => 'width-100 bg-dark fltlft'); } }
protected function prepareUI() { if (JCck::on()) { $this->css = array('items' => 'seblod-manager', 'table' => 'table table-striped', 'w33' => 'span4', 'w50' => 'span6', 'w66' => 'span8', 'w100' => 'span12', 'wrapper' => 'row-fluid'); } else { $this->css = array('items' => 'seblod', 'table' => 'adminlist', 'w33' => 'width-30', 'w50' => 'width-50 fltlft', 'w66' => 'width-100', 'w100' => 'width-100', 'wrapper' => 'sebwrapper'); } }
public function g_onCCK_Storage_LocationStore($location, $default, $pk, &$config, $params = array()) { if (!$pk) { return; } static $already = 0; $config['author'] = (int) $config['author'] > 0 ? $config['author'] : JCck::getConfig_Param('integration_user_default_author', 42); $config['parent'] = isset($config['parent']) && (int) $config['parent'] > 0 ? $config['parent'] : 0; $table = $location['_']->table; // Core if (!$already) { if (isset($params['bridge']) && $params['bridge']) { if (!isset($params['bridge_default_title'])) { $params['bridge_default_title'] = ''; } if (!isset($params['bridge_default_title_mode'])) { $params['bridge_default_title_mode'] = 0; } if ($params['bridge'] == 1) { self::g_doBridge('joomla_article', $pk, $location, $config, $params); } elseif ($params['bridge'] == 2) { self::g_doBridge('joomla_category', $pk, $location, $config, $params); } } else { $core = JCckTable::getInstance('#__cck_core', 'id'); $core->load($config['id']); $core->cck = $config['type']; if (!$core->pk) { $core->date_time = JFactory::getDate()->toSql(); } $core->pk = $pk; $core->storage_location = isset($location['_']->location) ? $location['_']->location : JCckDatabase::loadResult('SELECT storage_location FROM #__cck_core_types WHERE name = "' . $config['type'] . '"'); $core->author_id = $config['author']; $core->parent_id = $config['parent']; if (isset($config['storages']['#__cck_core']['store_id'])) { $core->store_id = $config['storages']['#__cck_core']['store_id']; } $core->storeIt(); } if (!(isset($config['component']) && $config['component'] == 'com_cck_importer')) { $already = 1; } } // More if ($table && $table != $default) { $more = JCckTable::getInstance($table, 'id'); $more->load($pk, true); if (isset($more->cck)) { $more->cck = $config['type']; } $more->bind($config['storages'][$table]); $more->check(); $more->store(); } if (!isset($config['primary'])) { $config['primary'] = $location['_']->location; } }
protected static function _link($link, &$field, &$config) { $app = JFactory::getApplication(); $form = $config['type']; $id = $config['id']; $itemId = $link->get('itemid', $app->input->getInt('Itemid', 0)); $redirection = $link->get('redirection', ''); $return = ''; $task = JFactory::getApplication()->isAdmin() ? 'list.delete' : 'delete'; $uri = (string) JFactory::getURI(); // Return if ($redirection == 'url') { $url = $link->get('redirection_url', ''); if (strpos($url, 'Itemid=') !== false) { $url = JRoute::_($url); } elseif ($url && strpos($url, 'http') === false) { $url = JUri::base() . ($url[0] == '/' ? substr($url, 1) : $url); } $return = base64_encode($url); } elseif ($config['client'] == 'content') { $return = base64_encode(JRoute::_('index.php?Itemid=' . $itemId)); } else { $return2 = $link->get('redirection_custom', ''); if ($return2 != '') { if ($return2[0] == '#') { $uri .= $return2; } else { $uri .= (strpos($return2, '?') !== false ? '&' : '?') . $return2; } } $return = base64_encode($uri); } if ($return) { $return = '&return=' . $return; } // Check $user = JCck::getUser(); $canDelete = $user->authorise('core.delete', 'com_cck.form.' . $config['type_id']); $canDeleteOwn = $user->authorise('core.delete.own', 'com_cck.form.' . $config['type_id']); if (!$canDelete && !$canDeleteOwn || !$canDelete && $canDeleteOwn && $config['author'] != $user->get('id') || $canDelete && !$canDeleteOwn && $config['author'] == $user->get('id')) { if (!$link->get('no_access', 0)) { $field->display = 0; } return; } // Prepare $link_class = $link->get('class', ''); $link_title = $link->get('title', ''); $link_title2 = $link->get('title_custom', ''); $field->link = 'index.php?option=com_cck&task=' . $task . '&cid=' . $id . '&Itemid=' . $itemId . $return; $field->link = JRoute::_($field->link); $field->link_class = $link_class ? $link_class : (isset($field->link_class) ? $field->link_class : ''); if ($link->get('confirm', 1)) { $field->link_onclick = 'if(!confirm(\'' . addslashes(JText::_('COM_CCK_CONFIRM_DELETE')) . '\')){return false;}'; } $field->link_state = $link->get('state', 1); $field->link_title = $link_title ? $link_title == '2' ? $link_title2 : (isset($field->link_title) ? $field->link_title : '') : ''; }
protected function getInput() { JPluginHelper::importPlugin('cck_field'); require_once JPATH_PLUGINS . '/cck_field_validation/required/required.php'; $attributes = isset($this->element['cck_attributes']) ? (string) $this->element['cck_attributes'] : ''; $name = (string) $this->element['construction']; $name2 = (string) $this->element['construction2']; $options = isset($this->element['cck_options']) ? (string) $this->element['cck_options'] : ''; $suffix = (string) $this->element['more'] ? '<span class="variation_value">' . (string) $this->element['more'] . '</span>' : ''; $suffix2 = (string) $this->element['more2'] ? '<span class="variation_value">' . (string) $this->element['more2'] . '</span>' : ''; $selectlabel = isset($this->element['cck_selectlabel']) ? (string) $this->element['cck_selectlabel'] : 'undefined'; if (!$name) { return; } $format = (string) $this->element['js_format']; $lang = JFactory::getLanguage(); $lang->load('com_cck'); $lang->load('com_cck_default', JPATH_SITE); if ($format != 'raw') { JCck::loadjQuery(true, true, array('cck.dev-3.3.0.min.js', 'jquery.json.min.js', 'jquery.ui.effects.min.js')); } $force_id = (string) $this->element['id']; $config = array('asset' => '', 'asset_id' => 0, 'client' => '', 'doTranslation' => 1, 'doValidation' => 2, 'pk' => ''); if ($format == 'raw') { $config['tmpl'] = 'ajax'; } $inherit = $force_id != '' ? array('id' => (string) $this->element['id']) : array(); $field = JCckDevField::getObject($name); if (!$field) { return; } $storage_field = $field->storage_field; $field->storage_field = $this->name; if ($attributes != '') { if ($field->attributes) { $field->attributes .= ' ' . htmlspecialchars(str_replace("'", '"', $attributes)); } else { $field->attributes = htmlspecialchars(str_replace("'", '"', $attributes)); } } if ($options != '') { $field->options = $options; } if ($selectlabel != 'undefined') { $field->selectlabel = $selectlabel; } $field = JCckDevField::get($field, $this->value, $config, $inherit); $more = ''; if ($name2) { $field2 = JCckDevField::getObject($name2); $storage_field2 = $field2->storage_field; $field2->storage_field = str_replace($storage_field, $storage_field2, $this->name); $field2 = JCckDevField::get($field2, (string) $this->element['value2'], $config, $inherit); $more = $field2->form; } $script = $this->_addScripts($this->id, array('appendTo' => (string) $this->element['js_appendto'], 'isVisibleWhen' => (string) $this->element['js_isvisiblewhen'], 'isDisabledWhen' => (string) $this->element['js_isdisabledwhen']), $format); return $field->form . $suffix . $more . $suffix2 . $script; }
protected function _getHTML($text, $url, $class = '') { if (JCck::on()) { $html = '<a href="' . $url . '" class="btn' . $class . '">' . '<span class="icon-download"></span>' . "\n" . $text . '</a>'; } else { $html = '<a href="' . $url . '">' . $text . ' ⇓</a>'; } return $html; }
public static function countItems($definition) { static $cache = array(); $count = 0; $user = JCck::getUser(); if (!isset($cache[$definition])) { $cache[$definition] = JCckDatabase::loadResult('SELECT COUNT(a.id) FROM #__cck_more_ecommerce_cart_product AS a' . ' LEFT JOIN #__cck_more_ecommerce_carts AS b ON b.id = a.cart_id WHERE b.type = "' . $definition . '" AND b.' . (string) $user->where_clause . ' AND b.state = 1'); } return $cache[$definition]; }
public static function authorise(&$field, &$config) { $user = JCck::getUser(); $check = JCckDatabase::loadResult('SELECT COUNT(a.id) FROM #__cck_more_ecommerce_order_product AS a LEFT JOIN #__cck_more_ecommerce_orders AS b ON b.id = a.order_id' . ' WHERE a.product_id = ' . $config['pk'] . ' AND b.user_id =' . $user->id); if ((int) $check > 0) { // } else { $field->display = 0; } }
function __construct($path) { $this->_quality_jpg = JCck::getConfig_Param('media_quality_jpeg', 90); $this->_quality_png = JCck::getConfig_Param('media_quality_png', 3); $this->_pathinfo = pathinfo($path); $this->_extension = strtolower($this->_pathinfo['extension']); $this->_resource = $this->_createResource($this->_extension, $path); list($this->_width, $this->_height) = getimagesize($path); $this->_ratio = $this->_width / $this->_height; }
public function fetchButton($type = 'CckModalBox', $name = '', $text = '', $url = '', $width = 820, $height = 400, $top = 0, $left = 0) { JCck::loadjQuery(); // Helper_Include::addColorbox( $width, $height, true, 'cbox_button', ', scrolling:false' ); $class = $this->fetchIconClass($name); $class2 = $name == 'apply' || $name == 'new' ? 'btn btn-small btn-success' : 'btn btn-small'; $text = JText::_($text); $url = $this->_getCommand($name, $url, $width, $height, $top, $left); $html = '<a class="cbox_button ' . $class2 . '" href="' . $url . '">' . '<span class="' . $class . '"></span>' . "\n" . $text . '</a>'; return $html; }
function uninstall($parent) { // Post Install Log self::_postInstallMessage('uninstall', $parent); $app = JFactory::getApplication(); $db = JFactory::getDbo(); $db->setQuery('SELECT extension_id FROM #__extensions WHERE type = "package" AND element = "pkg_cck"'); $eid = $db->loadResult(); $db->setQuery('SELECT extension_id FROM #__extensions WHERE type = "plugin" AND element = "cck" AND folder="system"'); $cck = $db->loadResult(); // Backup or Drop SQL Tables $prefix = $db->getPrefix(); $tables = $db->getTableList(); $tables = array_flip($tables); $uninstall_sql = (int) JCck::getConfig_Param('uninstall_sql', ''); if (count($tables)) { $length = strlen($prefix); $app->cck_nosql = true; foreach ($tables as $k => $v) { $pos = strpos($k, $prefix . 'cck_'); if ($pos !== false && $pos == 0) { $k2 = $prefix . '_' . substr($k, $length); if (isset($tables[$k2])) { $db->setQuery('DROP TABLE ' . $k2); $db->execute(); } if ($uninstall_sql == 1) { $db->setQuery('DROP TABLE ' . $k); $db->execute(); } else { $db->setQuery('RENAME TABLE ' . $k . ' TO ' . $k2); $db->execute(); } } } } // Uninstall FULL PACKAGE only if package exists && system plugin exists.. if ($eid && $cck) { $manifest = JPATH_ADMINISTRATOR . '/manifests/packages/pkg_cck.xml'; if (JFile::exists($manifest)) { $xml = JFactory::getXML($manifest); // Keep it this way until platform 13.x } if (isset($xml->files)) { unset($xml->files->file[3]); $xml->asXML($manifest); } jimport('joomla.installer.installer'); $installer = JInstaller::getInstance(); $installer->uninstall('package', $eid); } }
public function onCCK_Field_LivePrepareForm(&$field, &$value = '', &$config = array()) { if (self::$type != $field->live) { return; } // Init $live = ''; $options = parent::g_getLive($field->live_options); // Prepare $default = $options->get('default_value', ''); $excluded = $options->get('excluded'); $property = $options->get('property'); if ($property) { $user = JCck::getUser(); if ($user->id > 0 && $user->guest == 1) { if (!($property == 'ip' || $property == 'session_id')) { $user = new JUser(0); } } if ($property == 'access') { $viewlevels = $user->getAuthorisedViewLevels(); if ($excluded != '') { $excluded = explode(',', $excluded); $viewlevels = array_diff($viewlevels, $excluded); } if (empty($viewlevels)) { $live = $default; } else { $live = implode(',', $viewlevels); } } elseif (isset($user->{$property})) { $live = $user->{$property}; if (is_array($live)) { if ($excluded != '') { $excluded = explode(',', $excluded); $live = array_diff($live, $excluded); } if (empty($live)) { $live = $default; } else { $live = implode(',', $live); } } elseif ($live == '') { $live = $default; } } else { $live = $default; } } // Set $value = (string) $live; }
public function onCCK_FieldPrepareForm(&$field, $value = '', &$config = array(), $inherit = array(), $return = false) { if (self::$type != $field->type) { return; } self::$path = parent::g_getPath(self::$type . '/'); parent::g_onCCK_FieldPrepareForm($field, $config); // Init if (count($inherit)) { $id = isset($inherit['id']) && $inherit['id'] != '' ? $inherit['id'] : $field->name; $name = isset($inherit['name']) && $inherit['name'] != '' ? $inherit['name'] : $field->name; } else { $id = $field->name; $name = $field->name; } $value = $value != '' ? $value : $field->defaultvalue; $value = $value != ' ' ? $value : ''; // Validate $validate = ''; if ($config['doValidation'] > 1) { plgCCK_Field_ValidationRequired::onCCK_Field_ValidationPrepareForm($field, $id, $config); $validate = count($field->validate) ? ' validate[' . implode(',', $field->validate) . ']' : ''; } // Prepare $assoc = JCckDevHelper::hasLanguageAssociations(); $form = ''; if ($assoc && $config['pk']) { if (isset($config['base']->location) && $config['base']->location) { $location = $config['base']->location; } else { $location = JCckdatabase::loadResult('SELECT storage_location FROM #__cck_core_types WHERE name = "' . $config['type'] . '"'); } if (is_file(JPATH_SITE . '/plugins/cck_storage_location/' . $location . '/classes/helper.php')) { require_once JPATH_SITE . '/plugins/cck_storage_location/' . $location . '/classes/helper.php'; $form = JCck::callFunc_Array('plgCCK_Storage_Location' . $location . '_Helper', 'getAssociationsForm', array($id, $name, $config)); } } // Set if (!$field->variation) { $field->form = $form; if ($field->script) { parent::g_addScriptDeclaration($field->script); } } else { // } $field->value = $value; // Return if ($return === true) { return $field; } }
function __construct($path) { $this->_quality_jpg = JCck::getConfig_Param('media_quality_jpeg', 90); $this->_quality_png = JCck::getConfig_Param('media_quality_png', 3); $this->_pathinfo = pathinfo($path); $this->_extension = strtolower($this->_pathinfo['extension']); if (in_array($this->_extension, array('jpg', 'jpeg', 'tiff'))) { $this->_exif = exif_read_data($path, 0, true); } $this->_resource = $this->_createResource($this->_extension, $path); list($this->_width, $this->_height) = getimagesize($path); $this->_ratio = $this->_width / $this->_height; }
public function prepareUI() { if (JCck::on()) { $this->css = array('batch' => 'modal modal-small hide fade', 'filter' => 'btn-toolbar', 'filter_search' => 'filter-search btn-group pull-left hidden-phone input-append', 'filter_search_button' => 'tip hasTooltip', 'filter_search_buttons' => 'btn-group pull-left hidden-phone', 'filter_search_list' => 'pull-right hidden-phone', 'filter_select' => 'filter-select hidden-phone hidden-important', 'items' => 'seblod-manager clearfix', 'joomla3' => ' hide', 'table' => 'table table-striped', 'w50' => 'span6', 'wrapper' => 'row-fluid'); $this->html = array('filter_select_header' => '<h4 class="page-header">' . JText::_('JSEARCH_FILTER_LABEL') . '</h4>', 'filter_select_header_custom' => '<h4 class="page-header">*title*</h4>', 'filter_select_separator' => '<hr class="hr-condensed" />'); $this->js = array('filter' => 'jQuery(document).ready(function($) { $("#sidebar div.sidebar-nav").append("<hr />"); $("div.filter-select").appendTo("#sidebar div.sidebar-nav").removeClass("hidden-important");' . 'var w = $("div.sidebar-nav").width()-28; $("div.filter-select,div.sidebar-nav div.chzn-container").css("width",w+"px"); $("div.sidebar-nav div.chzn-drop").css("width",(w)+"px"); $("div.sidebar-nav div.chzn-search > input").css("width",(w-10)+"px"); });'); $this->sidebar = JHtmlSidebar::render(); } else { $this->css = array('batch' => 'seblod', 'filter' => 'seblod first', 'filter_search' => 'filter-search fltlft', 'filter_search_button' => 'inputbutton', 'filter_search_buttons' => 'filter-search fltlft', 'filter_search_list' => 'hide', 'filter_select' => 'filter-select fltrt', 'items' => 'seblod', 'joomla3' => '', 'table' => 'adminlist', 'w50' => 'width-50 fltlft', 'wrapper' => 'sebwrapper'); $this->html = array('filter_select_header' => '', 'filter_select_header_custom' => '', 'filter_select_separator' => ''); $this->js = array('filter' => ''); } }
function CckParseRoute($segments) { $app = JFactory::getApplication(); $count = count($segments); $menu = $app->getMenu(); $menuItem = $menu->getActive(); $vars = array(); if ($segments[0] == 'form') { $menu->setActive($app->input->getInt('Itemid', 0)); $vars['option'] = 'com_cck'; $vars['view'] = 'form'; $vars['layout'] = 'edit'; $vars['type'] = $segments[1]; } else { $legacy = 0; // check later if (!($menuItem->query['option'] == 'com_cck' && $menuItem->query['view'] == 'list')) { $legacy = 0; } if (!$legacy) { if (isset($menuItem->query['search'])) { $params = JCckDevHelper::getRouteParams($menuItem->query['search']); } if (isset($params['location']) && $params['location'] && is_file(JPATH_SITE . '/plugins/cck_storage_location/' . $params['location'] . '/' . $params['location'] . '.php')) { require_once JPATH_SITE . '/plugins/cck_storage_location/' . $params['location'] . '/' . $params['location'] . '.php'; JCck::callFunc_Array('plgCCK_Storage_Location' . $params['location'], 'parseRoute', array(&$vars, $segments, $count, $params)); } else { $legacy = 1; } } if ($legacy) { if ($count == 2) { $vars['option'] = 'com_content'; $vars['view'] = 'article'; $vars['catid'] = $segments[0]; $vars['id'] = $segments[1]; } elseif ($count == 1) { $vars['option'] = 'com_content'; @(list($id, $alias) = explode(':', $segments[0], 2)); $category = JCategories::getInstance('Content')->get($id); if ($category && $category->id == $id && $category->alias == $alias) { $vars['view'] = 'categories'; } else { $vars['view'] = 'article'; } $vars['id'] = $segments[0]; } } } return $vars; }
public static function quickSession($options, $id = 'featured_session') { $doc = JFactory::getDocument(); $css = ' ul.toolbar-tiplist {padding: 0px; margin-left:0px; margin-right:0px;} ul.toolbar-tiplist li { list-style: none; padding: 5px;} ul.toolbar-tiplist li:hover {background-color: #ffffff; -webkit-border-radius: 1px; -moz-border-radius: 1px; border-radius: 1px;} .ui-tooltip-grey .ui-tooltip-content{background-color: #ffffff;} .ui-tooltip-rounded .ui-tooltip-titlebar{-webkit-border-radius: 2px; -moz-border-radius: 2px; border-radius: 2px;} .ui-tooltip-rounded .ui-tooltip-titlebar + .ui-tooltip-content{-webkit-border-radius: 2px; -moz-border-radius: 2px; border-radius: 2px;} '; $doc->addStyleDeclaration($css); $doc->addStyleSheet(JURI::root(true) . '/media/cck/scripts/jquery-qtip/css/jquery.qtip.css'); JCck::loadjQuery(); $doc->addScript(JURI::root(true) . '/media/cck/scripts/jquery-qtip/js/jquery.qtip.min.js'); $title = JText::_('COM_CCK_SESSIONS_SAVE_SELECT'); $html = ''; $where = 'extension="' . $options['extension'] . '"'; if (isset($options['folder'])) { $where .= 'type="' . $options['folder'] . '"'; } if (isset($options['type'])) { $where .= 'type="' . $options['type'] . '"'; } $items = JCckDatabase::loadObjectList('SELECT id, title, type, options FROM #__cck_more_sessions WHERE ' . $where . ' ORDER BY title'); if (!count($items)) { return; } foreach ($items as $item) { $html .= '<li><a class="featured_sessions" href="javascript:void(0);" mydata="' . $item->type . '"' . 'mydata2="' . htmlspecialchars($item->options) . '">' . $item->title . '</a>' . '<img class="featured_sessions_del" src="' . JROOT_MEDIA_CCK . '/images/14/icon-14-trash.png" mydata="' . $item->id . '" /></li>'; } // Tooltip $html = '<div><ul class="toolbar-tiplist">' . $html . '</ul></div>' . '<div class="clr"></div>'; $search = array('.', '<', '>', '"', '%', ';'); $replace = array('\\.', '\\<', '\\>', '\\"', '\\%', '\\;'); $html = preg_replace("/(\r\n|\n|\r)/", " ", $html); $html = str_replace($search, $replace, $html); $js = ' jQuery(document).ready(function($){ $("#' . $id . '").qtip({ prerender: true, content: { text: "' . $html . '", title: { text: "' . $title . '" } }, hide: { event: "unfocus" }, style: { tip: true, classes: "ui-tooltip-grey ui-tooltip-rounded" }, position: { at: "right center", my: "left center", adjust: { x: 23 } } }); }); '; $doc->addScriptDeclaration($js); }
public static function apply($type, &$total, $params = array()) { $user = JCck::getUser(); $my_groups = $user->groups; /* $user->getAuthorisedGroups(); */ $my_zones = JCckEcommerce::getUserZones(); $currency = JCckEcommerce::getCurrency(); $res = 0; $results = array('items' => array()); $tax = ''; $taxes = JCckEcommerce::getTaxes($type, $my_zones); if (count($taxes)) { foreach ($taxes as $p) { if (isset($params['target']) && $params['target']) { if ($params['target'] == 'order' && $p->target == 0) { // OK } elseif ($params['target'] == 'product' && $p->target == 1) { // OK } else { continue; } } $groups = explode(',', $p->groups); if (count(array_intersect($my_groups, $groups)) > 0) { switch ($p->tax) { case 'plus': $tax = $p->tax_amount; $res += $tax; $total += $tax; $results['items'][$p->id] = array('type' => $p->type, 'tax' => $p->tax, 'tax_amount' => (string) $tax, 'title' => $p->title); break; case 'percentage': $tax = $total * $p->tax_amount / 100; $res += $tax; $total += $tax; $results['items'][$p->id] = array('type' => $p->type, 'tax' => $p->tax, 'tax_amount' => (string) $tax, 'title' => $p->title); break; default: break; } } } } if ($res) { $results['total'] = (double) $res; return (object) $results; } return null; }