當前位置: 首頁>>代碼示例>>PHP>>正文


PHP JCck::getUser方法代碼示例

本文整理匯總了PHP中JCck::getUser方法的典型用法代碼示例。如果您正苦於以下問題:PHP JCck::getUser方法的具體用法?PHP JCck::getUser怎麽用?PHP JCck::getUser使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在JCck的用法示例。


在下文中一共展示了JCck::getUser方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: apply

 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;
 }
開發者ID:densem-2013,項目名稱:exikom,代碼行數:29,代碼來源:tax.php

示例2: apply

 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;
 }
開發者ID:densem-2013,項目名稱:exikom,代碼行數:60,代碼來源:promotion.php

示例3: saveOrder

 public function saveOrder($pks = array(), $lft = array())
 {
     JPluginHelper::importPlugin('cck_storage_location');
     if (!count($pks)) {
         return false;
     }
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $query->select('a.id, a.pk, a.storage_location, b.id AS type_id')->from('#__cck_core AS a')->join('LEFT', '#__cck_core_types AS b ON b.name = a.cck')->where('a.id IN (' . implode(',', $pks) . ')');
     $db->setQuery($query);
     $results = $db->loadAssocList('id');
     if (!empty($results)) {
         $ids = array();
         $location = null;
         $user = JCck::getUser();
         $user_id = $user->get('id');
         foreach ($pks as $i => $pk) {
             $canEdit = $user->authorise('core.edit', 'com_cck.form.' . $results[$pk]['type_id']);
             $canEditOwn = $user->authorise('core.edit.own', 'com_cck.form.' . $results[$pk]['type_id']);
             // Check Permissions
             if (!($canEdit && $canEditOwn || $canEdit && !$canEditOwn && $results[$pk]['author_id'] != $user_id || $canEditOwn && $results[$pk]['author_id'] == $user_id)) {
                 unset($lft[$i]);
                 continue;
             }
             $ids[] = $results[$pk]['pk'];
             if (null === $location) {
                 $location = $results[$pk]['storage_location'];
             }
         }
         if ($location && count($ids)) {
             return JCck::callFunc_Array('plgCCK_Storage_Location' . $location, 'onCCK_Storage_LocationSaveOrder', array($ids, $lft));
         }
     }
     return false;
 }
開發者ID:hamby,項目名稱:SEBLOD,代碼行數:35,代碼來源:list.php

示例4: _link

 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 : '') : '';
 }
開發者ID:codigoaberto,項目名稱:SEBLOD,代碼行數:58,代碼來源:content_delete.php

示例5: authorise

 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;
     }
 }
開發者ID:codigoaberto,項目名稱:SEBLOD,代碼行數:10,代碼來源:restriction.php

示例6: countItems

 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];
 }
開發者ID:densem-2013,項目名稱:exikom,代碼行數:10,代碼來源:cart.php

示例7: onCCK_Field_LivePrepareForm

 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;
 }
開發者ID:hamby,項目名稱:SEBLOD,代碼行數:52,代碼來源:joomla_user.php

示例8: apply

 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;
 }
開發者ID:codigoaberto,項目名稱:SEBLOD,代碼行數:49,代碼來源:tax.php

示例9: defined

<?php

/**
* @version 			SEBLOD 3.x More
* @package			SEBLOD (App Builder & CCK) // SEBLOD nano (Form Builder)
* @url				http://www.seblod.com
* @editor			Octopoos - www.octopoos.com
* @copyright		Copyright (C) 2013 SEBLOD. All Rights Reserved.
* @license 			GNU General Public License version 2 or later; see _LICENSE.php
**/
defined('_JEXEC') or die;
global $user;
$app = JFactory::getApplication();
$path_lib = JPATH_SITE . '/libraries/cck/rendering/rendering.php';
$user = JCck::getUser();
if (!file_exists($path_lib)) {
    print '/libraries/cck/rendering/rendering.php file is missing.';
    die;
}
require_once $path_lib;
開發者ID:kenyonjohnston,項目名稱:hott_theater,代碼行數:20,代碼來源:config.php

示例10: onCCK_Storage_LocationDelete

 public static function onCCK_Storage_LocationDelete($pk, &$config = array())
 {
     $app = JFactory::getApplication();
     $dispatcher = JDispatcher::getInstance();
     $item = JCckDatabase::loadObject('SELECT id, cck as type, pk, storage_table FROM #__cck_core WHERE cck = "' . $config['type'] . '" AND pk = ' . (int) $pk);
     if (!is_object($item)) {
         return false;
     }
     $table = JCckTable::getInstance($item->storage_table, 'id');
     $table->load($pk);
     if (!$table) {
         return false;
     }
     // 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')) {
         $app->enqueueMessage(JText::_('COM_CCK_ERROR_DELETE_NOT_PERMITTED'), 'error');
         return;
     }
     // Process
     // -- onContentBeforeDelete?
     if (!$table->delete($pk)) {
         return false;
     }
     // Delete Core
     if ($item->id) {
         $table = JCckTable::getInstance('#__cck_core', 'id', $item->id);
         $table->delete();
     }
     // Delete More
     $base = str_replace('#__', '', $item->storage_table);
     $tables = JCckDatabase::loadColumn('SHOW TABLES');
     $prefix = JFactory::getConfig()->get('dbprefix');
     if (in_array($prefix . 'cck_store_item_' . $base, $tables)) {
         $table = JCckTable::getInstance('#__cck_store_item_' . $base, 'id', $pk);
         if ($table->id) {
             $table->delete();
         }
     }
     if (in_array($prefix . 'cck_store_form_' . $item->type, $tables)) {
         $table = JCckTable::getInstance('#__cck_store_form_' . $item->type, 'id', $pk);
         if ($table->id) {
             $table->delete();
         }
     }
     // -- onContentAfterDelete?
     return true;
 }
開發者ID:codigoaberto,項目名稱:SEBLOD,代碼行數:50,代碼來源:free.php

示例11: onCCK_Storage_LocationDelete

 public static function onCCK_Storage_LocationDelete($pk, &$config = array())
 {
     $app = JFactory::getApplication();
     $dispatcher = JDispatcher::getInstance();
     $table = self::_getTable($pk);
     if (!$table) {
         return false;
     }
     // 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')) {
         $app->enqueueMessage(JText::_('COM_CCK_ERROR_DELETE_NOT_PERMITTED'), 'error');
         return;
     }
     // Process
     $result = $dispatcher->trigger('onContentBeforeDelete', array(self::$context, $table));
     if (in_array(false, $result, true)) {
         return false;
     }
     if (!$table->delete($pk)) {
         return false;
     }
     $dispatcher->trigger('onContentAfterDelete', array(self::$context, $table));
     return true;
 }
開發者ID:pctechnikch,項目名稱:SEBLOD,代碼行數:27,代碼來源:joomla_category.php

示例12: getUserZones

 public static function getUserZones()
 {
     $user = JCck::getUser();
     $zones = array();
     if (!(isset($user->country) && $user->country != '')) {
         return $zones;
     }
     $where = 'countries = "' . $user->country . '" OR countries LIKE "' . $user->country . '||%" OR countries LIKE "%||' . $user->country . '" OR countries LIKE "%||' . $user->country . '||%"';
     $zones = JCckDatabase::loadColumn('SELECT id FROM #__cck_more_ecommerce_zones WHERE published = 1 AND (' . $where . ') ORDER BY CHARACTER_LENGTH(countries) ASC');
     return $zones;
 }
開發者ID:hamby,項目名稱:SEBLOD,代碼行數:11,代碼來源:ecommerce.php

示例13: onCCK_FieldAfterStore


//.........這裏部分代碼省略.........
         // $cck->getAttr('fieldname');
         if ($body != '' && strpos($body, '$cck->get') !== false) {
             $matches = '';
             $search = '#\\$cck\\->get([a-zA-Z0-9_]*)\\( ?\'([a-zA-Z0-9_]*)\' ?\\)(;)?#';
             preg_match_all($search, $body, $matches);
             if (count($matches[1])) {
                 for ($i = 0, $n = count($matches); $i <= $n; $i++) {
                     $attr = strtolower($matches[1][$i]);
                     $match = $matches[2][$i];
                     if (isset($fields[$match]->{$attr}) && trim($fields[$match]->{$attr}) != '') {
                         $body = str_replace($matches[0][$i], $fields[$match]->{$attr}, $body);
                     } else {
                         $body = str_replace($matches[0][$i], '', $body);
                     }
                 }
             }
         }
         // J(translate)
         if ($body != '' && strpos($body, 'J(') !== false) {
             $matches = '';
             $search = '#J\\((.*)\\)#U';
             preg_match_all($search, $body, $matches);
             if (count($matches[1])) {
                 foreach ($matches[1] as $text) {
                     $body = str_replace('J(' . $text . ')', JText::_('COM_CCK_' . str_replace(' ', '_', trim($text))), $body);
                 }
             }
         }
         $body = str_replace('[id]', $config['id'], $body);
         $body = str_replace('[pk]', $config['pk'], $body);
         $body = str_replace('[sitename]', $config2->get('sitename'), $body);
         $body = str_replace('[siteurl]', JURI::base(), $body);
         if ($body != '' && strpos($body, '$user->') !== false) {
             $user = JCck::getUser();
             $matches = '';
             $search = '#\\$user\\->([a-zA-Z0-9_]*)#';
             preg_match_all($search, $body, $matches);
             if (count($matches[1])) {
                 foreach ($matches[1] as $k => $v) {
                     $body = str_replace($matches[0][$k], $user->{$v}, $body);
                 }
             }
         }
         // [date(.*)]
         if ($body != '' && strpos($body, '[date') !== false) {
             $matches = NULL;
             preg_match_all('#\\[date(.*)\\]#U', $body, $matches);
             if (count($matches[1])) {
                 foreach ($matches[1] as $match) {
                     $date = date($match);
                     $body = str_replace('[date' . $match . ']', $date, $body);
                 }
             }
         }
         // [fields]
         if (strpos($body, '[fields]') !== false) {
             $bodyF = NULL;
             if (count($fields)) {
                 foreach ($fields as $field) {
                     $fieldName = $field->name;
                     if (!($field->type == 'password' && $field->value == 'XXXX') && isset($field->value) && trim($field->value) != '' && $field->variation != 'hidden') {
                         $valF = isset($field->text) && trim($field->text) != '' ? trim($field->text) : trim($field->value);
                         $bodyF .= '- ' . $field->label . ' : ' . $valF . '<br /><br />';
                     }
                 }
             }
開發者ID:kolydart,項目名稱:SEBLOD,代碼行數:67,代碼來源:email.php

示例14: _link

 protected static function _link($link, &$field, &$config)
 {
     $app = JFactory::getApplication();
     $custom = $link->get('custom', '');
     $form = $link->get('form', '');
     $edit = $link->get('form_edition', 1);
     $edit = !$form && $edit ? '&id=' . $config['pk'] : '';
     $form = $form ? $form : $config['type'];
     $itemId = $link->get('itemid', $app->input->getInt('Itemid', 0));
     $redirection = $link->get('redirection', '');
     $uri = (string) JFactory::getUri();
     if (strpos($uri, 'format=raw&infinite=1') !== false) {
         $return = $app->input->get('return');
     } else {
         $return = base64_encode($uri);
     }
     if (!$form) {
         return;
     }
     // Check
     if ($edit != '') {
         static $cache = array();
         $stage = $link->get('form_edition_stage', '');
         if ($stage != '') {
             $edit .= '&stage=' . (int) $stage;
         }
         $user = JCck::getUser();
         $canEdit = $user->authorise('core.edit', 'com_cck.form.' . $config['type_id']);
         // if ( $user->id && !$user->guest ) {
         $canEditOwn = $user->authorise('core.edit.own', 'com_cck.form.' . $config['type_id']);
         // } else {
         //	$canEditOwn		=	false; // todo: guest
         // }
         $canEditOwnContent = '';
         // canEditOwnContent
         jimport('cck.joomla.access.access');
         $canEditOwnContent = CCKAccess::check($user->id, 'core.edit.own.content', 'com_cck.form.' . $config['type_id']);
         if ($canEditOwnContent) {
             $field2 = JCckDatabaseCache::loadObject('SELECT storage, storage_table, storage_field FROM #__cck_core_fields WHERE name = "' . $canEditOwnContent . '"');
             $canEditOwnContent = false;
             if (is_object($field2) && $field2->storage == 'standard') {
                 $pks = isset($config['pks']) ? $config['pks'] : $config['pk'];
                 $query = 'SELECT ' . $field2->storage_field . ' as map, id FROM ' . $field2->storage_table . ' WHERE id IN (' . $pks . ')';
                 $index = md5($query);
                 if (!isset($cache[$index])) {
                     $cache[$index . '_pks'] = JCckDatabase::loadObjectList($query, 'id');
                     $values = array();
                     if (count($cache[$index . '_pks'])) {
                         foreach ($cache[$index . '_pks'] as $p) {
                             $values[] = $p->map;
                         }
                     }
                     $values = count($values) ? implode(',', $values) : '0';
                     $cache[$index] = JCckDatabase::loadObjectList('SELECT author_id, pk FROM #__cck_core WHERE storage_location = "joomla_article" AND pk IN ( ' . $values . ' )', 'pk');
                 }
                 if (isset($cache[$index . '_pks'][$config['pk']]) && isset($cache[$index][$cache[$index . '_pks'][$config['pk']]->map]) && $cache[$index][$cache[$index . '_pks'][$config['pk']]->map]->author_id == $user->get('id')) {
                     $canEditOwnContent = true;
                 }
             }
         } else {
             $canEditOwnContent = '';
         }
         // Check Permissions
         if (!($canEdit && $canEditOwn || $canEdit && !$canEditOwn && $config['author'] != $user->get('id') || $canEditOwn && $config['author'] == $user->get('id') || $canEditOwnContent)) {
             if (!$link->get('no_access', 0)) {
                 $field->display = 0;
             }
             return;
         }
     } elseif ($form != '') {
         $user = JCck::getUser();
         $type_id = (int) JCckDatabase::loadResult('SELECT id FROM #__cck_core_types WHERE name = "' . $form . '"');
         $canCreate = $type_id ? $user->authorise('core.create', 'com_cck.form.' . $type_id) : false;
         // Check Permissions
         if (!$canCreate) {
             return;
         }
     }
     // Prepare
     $link_class = $link->get('class', '');
     $link_rel = $link->get('rel', '');
     $link_target = $link->get('target', '');
     $link_title = $link->get('title', '');
     $link_title2 = $link->get('title_custom', '');
     $tmpl = $link->get('tmpl', '');
     $tmpl = $tmpl ? '&tmpl=' . $tmpl : '';
     $vars = $tmpl;
     // + live
     /*
     if ( $config['client'] == 'admin' || $config['client'] == 'site' || $config['client'] == 'search' ) {
     	$redirection		=	'-1'; // todo
     }
     */
     // Set
     if (is_array($field->value)) {
         foreach ($field->value as $f) {
             $c = $custom;
             $c = parent::g_getCustomSelfVars(self::$type, $f, $c, $config);
             $c = $c ? '&' . $c : '';
             $f->link = 'index.php?option=com_cck&view=form&layout=edit&type=' . $form . $edit . $vars . '&Itemid=' . $itemId . $c;
//.........這裏部分代碼省略.........
開發者ID:kenyonjohnston,項目名稱:hott_theater,代碼行數:101,代碼來源:cck_form.php

示例15: onContentSearch

 public function onContentSearch($text = '', $phrase = '', $ordering = '', $areas = NULL, $fields = array(), $fields_order = array(), &$config = array(), $current = array(), $options = NULL, $user = NULL)
 {
     if (is_array($areas)) {
         if (!array_intersect($areas, array_keys($this->onContentSearchAreas()))) {
             return array();
         }
     } else {
         return array();
     }
     if (!count($fields)) {
         return array();
     }
     if (!$user) {
         $user = JCck::getUser();
     }
     if (!is_object($options)) {
         $options = new JRegistry();
     }
     $app = JFactory::getApplication();
     $db = JFactory::getDbo();
     $dispatcher = JDispatcher::getInstance();
     $doClean = false;
     $doCount = (int) $options->get('count');
     $doLimit = false;
     $limit = (int) $options->get('limit');
     $doLimit = $limit > 0 ? false : true;
     $isLoadingMore = $app->input->get('format') == 'raw' && $app->input->get('infinite') > 0 ? 1 : 0;
     $glues = 1;
     $order = '';
     $order_string = '';
     $where = '';
     $w = -1;
     $where2 = array();
     $t = 1;
     $t2 = 1;
     $tables = array('#__cck_core' => array('_' => 't0', 'fields' => array(), 'join' => 1));
     $colums = array();
     if (isset($config['joins'][$current['stage']]) && is_array($config['joins'][$current['stage']])) {
         foreach ($config['joins'][$current['stage']] as $j) {
             if ($j->table) {
                 if (!isset($tables[$j->table])) {
                     $tables[$j->table] = array('_' => 't' . $t++, 'fields' => array(), 'key' => $j->column, 'join' => 2, 'join_key' => $j->column2, 'join_table' => $j->table2, 'join_and' => @$j->and, 'join_type' => @$j->type, 'join_mode' => @$j->mode, 'join_query' => @$j->query);
                 } elseif (@$j->and != '') {
                     $tables[$j->table . '@' . md5($j->and)] = array('_' => 't' . $t++, 'fields' => array(), 'key' => $j->column, 'join' => 2, 'join_key' => $j->column2, 'join_table' => $j->table2, 'join_and' => $j->and, 'join_type' => @$j->type, 'join_mode' => @$j->mode, 'join_query' => @$j->query);
                 }
             }
         }
         $t2 = count($tables);
     }
     foreach ($fields as $field) {
         if (!$field->state) {
             continue;
         }
         if ($current['stage'] != (int) $field->stage) {
             continue;
         }
         $hasSQL = true;
         $name2 = $field->match_collection != '' ? '\\\\|[0-9]+\\\\|' . $field->match_collection : '';
         // -
         if ($field->live == 'stage') {
             $live_options = new JRegistry();
             $live_options->loadString($field->live_options);
             $live_value = $live_options->get('value', $field->live_value);
             $live_value = $live_value ? $live_value : 1;
             $value = $current['stages'][$live_value];
             if ($value == '' && $live_options->get('default_value') != '') {
                 $value = (string) $live_options->get('default_value');
             }
         } else {
             $value = $field->value;
         }
         // -
         $Pf = $field->storage_field;
         $Pt = $field->storage_table;
         if (($value !== '' && $field->match_mode != 'none' || ($field->match_mode == 'empty' || $field->match_mode == 'not_empty' || $field->match_mode == 'not_null')) && $field->storage != 'none' || $field->type == 'search_operator' && $field->match_mode != 'none') {
             $glue = '';
             $sql = '';
             if ($field->match_options != '') {
                 $field->match_options = new JRegistry($field->match_options);
             }
             // Glue
             if ($glues == 1) {
                 $glue = $where != '' ? 'AND' : '';
                 $where .= $glue;
                 if ($glue != '') {
                     $where2[++$w] = $glue;
                 }
                 $glue = '';
             }
             // Sql
             if ($field->type == 'search_generic') {
                 if (count($field->children)) {
                     $sql = '(';
                     $k = 0;
                     foreach ($field->children as $child) {
                         if ($k > 0) {
                             $sql .= ' OR ';
                         }
                         $child->match_mode = $field->match_mode;
                         $child->match_options = $field->match_options;
//.........這裏部分代碼省略.........
開發者ID:codigoaberto,項目名稱:SEBLOD,代碼行數:101,代碼來源:cck.php


注:本文中的JCck::getUser方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。