本文整理汇总了PHP中Sobi::SetUserData方法的典型用法代码示例。如果您正苦于以下问题:PHP Sobi::SetUserData方法的具体用法?PHP Sobi::SetUserData怎么用?PHP Sobi::SetUserData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sobi
的用法示例。
在下文中一共展示了Sobi::SetUserData方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: view
protected function view()
{
$msg = null;
$store = array();
Sobi::SetUserData('requirements', $store);
$home = SPRequest::int('init') ? Sobi::Url(null, true) : Sobi::Url('config', true);
/** @var $view SPAdmView */
// header( 'Cache-Control: no-cache, must-revalidate' );
// header( 'Expires: Sat, 26 Jul 1997 05:00:00 GMT' );
SPFactory::View('view', true)->assign(SPRequest::int('init'), 'init')->addHidden($home, 'redirect')->determineTemplate('config', 'requirements')->display();
}
示例2: storeMessages
/**
* @return void
*/
public function storeMessages()
{
Sobi::SetUserData('messages-queue', $this->messages);
}
示例3: getEntries
//.........这里部分代码省略.........
$eOr = explode('.', $eOrder);
$eOrder = array_shift($eOr);
$eDir = implode('.', $eOr);
}
$pid = $pid ? $pid : SPRequest::sid();
/* if sort by name, then sort by the name field */
if ($eOrder == 'name') {
$eOrder = SPFactory::config()->nameField()->get('fid');
}
if ($entriesRecursive) {
$pids = $this->_model->getChilds('category', true);
if (is_array($pids)) {
$pids = array_keys($pids);
}
$pids[] = SPRequest::sid();
$conditions['sprl.pid'] = $pids;
} else {
$conditions['sprl.pid'] = $pid;
}
if ($pid == -1) {
unset($conditions['sprl.pid']);
}
/* sort by field */
if (strstr($eOrder, 'field_')) {
static $field = null;
$specificMethod = false;
if (!$field) {
try {
$fType = $db->select('fieldType', 'spdb_field', array('nid' => $eOrder, 'section' => Sobi::Section()))->loadResult();
} catch (SPException $x) {
Sobi::Error($this->name(), SPLang::e('CANNOT_DETERMINE_FIELD_TYPE', $x->getMessage()), SPC::WARNING, 0, __LINE__, __FILE__);
}
if ($fType) {
$field = SPLoader::loadClass('opt.fields.' . $fType);
}
}
if ($field && method_exists($field, 'customOrdering')) {
$table = null;
$oPrefix = null;
$specificMethod = call_user_func_array(array($field, 'customOrdering'), array(&$table, &$conditions, &$oPrefix, &$eOrder, &$eDir));
} elseif ($field && method_exists($field, 'sortBy')) {
$table = null;
$oPrefix = null;
$specificMethod = call_user_func_array(array($field, 'sortBy'), array(&$table, &$conditions, &$oPrefix, &$eOrder, &$eDir));
}
if (!$specificMethod) {
$table = $db->join(array(array('table' => 'spdb_field', 'as' => 'fdef', 'key' => 'fid'), array('table' => 'spdb_field_data', 'as' => 'fdata', 'key' => 'fid'), array('table' => 'spdb_object', 'as' => 'spo', 'key' => array('fdata.sid', 'spo.id')), array('table' => 'spdb_relations', 'as' => 'sprl', 'key' => array('fdata.sid', 'sprl.id'))));
$oPrefix = 'spo.';
$conditions['spo.oType'] = 'entry';
$conditions['fdef.nid'] = $eOrder;
$eOrder = 'baseData.' . $eDir;
}
} elseif (strstr($eOrder, 'counter')) {
$table = $db->join(array(array('table' => 'spdb_object', 'as' => 'spo', 'key' => 'id'), array('table' => 'spdb_relations', 'as' => 'sprl', 'key' => array('spo.id', 'sprl.id')), array('table' => 'spdb_counter', 'as' => 'spcounter', 'key' => array('spo.id', 'spcounter.sid'))));
$oPrefix = 'spo.';
$conditions['spo.oType'] = 'entry';
if (strstr($eOrder, '.')) {
$cOrder = explode('.', $eOrder);
$eOrder = 'spcounter.counter.' . $cOrder[1];
} else {
$eOrder = 'spcounter.counter.desc';
}
} else {
$table = $db->join(array(array('table' => 'spdb_relations', 'as' => 'sprl', 'key' => 'id'), array('table' => 'spdb_object', 'as' => 'spo', 'key' => 'id')));
$conditions['spo.oType'] = 'entry';
$eOrder = $eOrder . '.' . $eDir;
$oPrefix = 'spo.';
if (strstr($eOrder, 'valid')) {
$eOrder = $oPrefix . $eOrder;
}
}
/* check user permissions for the visibility */
if (Sobi::My('id')) {
$this->userPermissionsQuery($conditions, $oPrefix);
if (isset($conditions[$oPrefix . 'state']) && $conditions[$oPrefix . 'state']) {
$conditions['sprl.copy'] = 0;
}
} else {
$conditions = array_merge($conditions, array($oPrefix . 'state' => '1', '@VALID' => $db->valid($oPrefix . 'validUntil', $oPrefix . 'validSince')));
$conditions['sprl.copy'] = '0';
}
try {
$results = $db->select($oPrefix . 'id', $table, $conditions, $eOrder, $eLimit, $eLimStart, true)->loadResultArray();
} catch (SPException $x) {
Sobi::Error($this->name(), SPLang::e('DB_REPORTS_ERR', $x->getMessage()), SPC::WARNING, 0, __LINE__, __FILE__);
}
Sobi::Trigger($this->name(), 'AfterGetEntries', array(&$results, $count));
if (count($results) && !$count) {
foreach ($results as $i => $sid) {
// it needs too much memory moving the object creation to the view
//$entries[ $i ] = SPFactory::Entry( $sid );
$entries[$i] = $sid;
}
}
if ($count) {
Sobi::SetUserData('currently-displayed-entries', $results);
return $results;
}
return $entries;
}
示例4: getEntries
public function getEntries($eLimit, $site, $ids = false)
{
$conditions = array();
$entries = array();
/* get the site to display */
$eLimStart = ($site - 1) * $eLimit;
if (isset($this->_letter[1]) && $this->_letter[1] == '-') {
$this->_letter = "[{$this->_letter[0]}-{$this->_letter[2]}]";
}
$db = SPFactory::db();
/*
* Don't know exactly why but on Windows servers there seems to be some problem with unicode chars
* - strtolower/strtoupper is destroying these chars completely
* - MySQL seems to be suddenly case sensitive with non-latin chars so we need to ask both
*
* Wed, Apr 4, 2012: Apparently it's not only Windows related
*/
if (!preg_match('/^[\\x20-\\x7f]*$/D', $this->_letter) && function_exists('mb_strtolower')) {
// if we have multibyte string support - ask both cases ...
$baseCondition = "REGEXP:^{$this->_letter}|^" . mb_strtoupper($this->_letter);
} else {
// if no unicode - great, it'll work.
// if we don't have MB - shit happens
$baseCondition = "REGEXP:^{$this->_letter}";
}
switch ($this->_fieldType) {
case 'chbxgroup':
case 'select':
case 'multiselect':
$eOrder = 'sValue';
$table = $db->join(array(array('table' => 'spdb_field_option_selected', 'as' => 'opts'), array('table' => 'spdb_language', 'as' => 'lang', 'key' => array('opts.optValue', 'lang.sKey')), array('table' => 'spdb_object', 'as' => 'spo', 'key' => array('opts.sid', 'spo.id')), array('table' => 'spdb_relations', 'as' => 'sprl', 'key' => array('opts.sid', 'sprl.id'))));
$oPrefix = 'spo.';
$conditions['spo.oType'] = 'entry';
$conditions['opts.fid'] = $this->_field;
$conditions['lang.sValue'] = $baseCondition;
break;
default:
$eOrder = 'baseData';
$table = $db->join(array(array('table' => 'spdb_field', 'as' => 'fdef', 'key' => 'fid'), array('table' => 'spdb_field_data', 'as' => 'fdata', 'key' => 'fid'), array('table' => 'spdb_object', 'as' => 'spo', 'key' => array('fdata.sid', 'spo.id')), array('table' => 'spdb_relations', 'as' => 'sprl', 'key' => array('fdata.sid', 'sprl.id'))));
$oPrefix = 'spo.';
$conditions['spo.oType'] = 'entry';
$conditions['fdef.fid'] = $this->_field;
$conditions['fdata.baseData'] = $baseCondition;
break;
}
$this->_field = $this->_field ? $this->_field : Sobi::Cfg('alphamenu.primary_field', SPFactory::config()->nameField()->get('id'));
/* check user permissions for the visibility */
if (Sobi::My('id')) {
$this->userPermissionsQuery($conditions, $oPrefix);
} else {
$conditions = array_merge($conditions, array($oPrefix . 'state' => '1', '@VALID' => $db->valid($oPrefix . 'validUntil', $oPrefix . 'validSince')));
}
$conditions['sprl.copy'] = '0';
try {
$db->select($oPrefix . 'id', $table, $conditions, $eOrder, $eLimit, $eLimStart, true);
$results = $db->loadResultArray();
} catch (SPException $x) {
Sobi::Error('AlphaListing', SPLang::e('DB_REPORTS_ERR', $x->getMessage()), SPC::WARNING, 0, __LINE__, __FILE__);
}
if ($ids) {
Sobi::SetUserData('currently-displayed-entries', $results);
return $results;
}
if (count($results)) {
foreach ($results as $i => $sid) {
// it needs too much memory moving the object creation to the view
//$entries[ $i ] = SPFactory::Entry( $sid );
$entries[$i] = $sid;
}
}
Sobi::Trigger($this->name(), 'AfterGetEntries', array(&$entries, false));
return $entries;
}
示例5: getResults
protected function getResults($ssid, $template)
{
$results = array();
/* case some plugin overwrites this method */
Sobi::Trigger('GetResults', 'Search', array(&$results, &$ssid, &$template));
if (count($results)) {
return $results;
}
/* get limits - if defined in template config - otherwise from the section config */
$eLimit = $this->tKey($template, 'entries_limit', Sobi::Cfg('search.entries_limit', Sobi::Cfg('list.entries_limit', 2)));
$eInLine = $this->tKey($template, 'entries_in_line', Sobi::Cfg('search.entries_in_line', Sobi::Cfg('list.entries_in_line', 2)));
/* get the site to display */
$site = SPRequest::int('site', 1);
$eLimStart = ($site - 1) * $eLimit;
try {
$this->_db->select(array('entriesResults', 'requestData'), 'spdb_search', array('ssid' => $ssid));
$r = $this->_db->loadAssocList();
if (strlen($r[0]['entriesResults'])) {
$store = SPConfig::unserialize($r[0]['entriesResults']);
if ($store['results']) {
$this->_results = array_unique(explode(',', $store['results']));
$this->_resultsByPriority = $store['resultsByPriority'];
}
$this->_resultsCount = count($this->_results);
}
$this->_request = SPConfig::unserialize($r[0]['requestData']);
SPFactory::registry()->set('requestcache', $this->_request);
if (count($this->_results)) {
$r = array_slice($this->_results, $eLimStart, $eLimit);
/* so we have a results */
foreach ($r as $i => $sid) {
$results[$i] = (int) $sid;
//$results[ $i ] = new $eClass();
//$results[ $i ]->init( $sid );
}
}
} catch (SPException $x) {
Sobi::Error($this->name(), SPLang::e('CANNOT_GET_SESSION_DB_ERR', $x->getMessage()), SPC::ERROR, 500, __LINE__, __FILE__);
}
Sobi::SetUserData('currently-displayed-entries', $results);
return $results;
}