本文整理汇总了PHP中SPFactory::user方法的典型用法代码示例。如果您正苦于以下问题:PHP SPFactory::user方法的具体用法?PHP SPFactory::user怎么用?PHP SPFactory::user使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SPFactory
的用法示例。
在下文中一共展示了SPFactory::user方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getSourceEntries
public function getSourceEntries($params)
{
$entries = $this->entries($params);
$entries = $this->entries($params);
$view = new SPEntriesDJMTView();
$view->assign($this->_model, 'section');
$view->assign(SPFactory::user()->getCurrent(), 'visitor');
$view->assign($entries, 'entries');
$view->assign($params, 'params');
return $view->getEntires();
}
示例2: search
protected function search()
{
if (!SPFactory::mainframe()->checkToken()) {
Sobi::Error('Token', SPLang::e('UNAUTHORIZED_ACCESS_TASK', SPRequest::task()), SPC::ERROR, 403, __LINE__, __FILE__);
}
// $selected = SPRequest::int( 'selected', 0 );
$ssid = SPRequest::base64('ssid');
$query = SPRequest::string('q', null);
$session = SPFactory::user()->getUserState('userSelector', null, array());
$setting = $session[$ssid];
/* get the site to display */
$site = SPRequest::int('site', 1);
$eLim = Sobi::Cfg('user_selector.entries_limit', 18);
$eLimStart = ($site - 1) * $eLim;
$params = array();
if ($query) {
$q = '%' . $query . '%';
$params = SPFactory::db()->where(array('name' => $q, 'username' => $q, 'email' => $q), 'OR');
}
try {
$count = SPFactory::db()->select('COUNT(*)', '#__users', $params, $setting['ordering'])->loadResult();
$data = SPFactory::db()->select(array('id', 'name', 'username', 'email', 'registerDate', 'lastvisitDate'), '#__users', $params, $setting['ordering'], $eLim, $eLimStart)->loadAssocList();
} catch (SPException $x) {
echo $x->getMessage();
exit;
}
$response = array('sites' => ceil($count / $eLim), 'site' => $site);
if (count($data)) {
$replacements = array();
preg_match_all('/\\%[a-z]*/', $setting['format'], $replacements);
$placeholders = array();
if (isset($replacements[0]) && count($replacements[0])) {
foreach ($replacements[0] as $placeholder) {
$placeholders[] = str_replace('%', null, $placeholder);
}
}
if (count($replacements)) {
foreach ($data as $index => $user) {
$txt = $setting['format'];
foreach ($placeholders as $attribute) {
if (isset($user[$attribute])) {
$txt = str_replace('%' . $attribute, $user[$attribute], $txt);
}
}
$data[$index]['text'] = $txt;
}
}
$response['users'] = $data;
}
SPFactory::mainframe()->cleanBuffer();
echo json_encode($response);
exit;
}
示例3: view
/**
*/
protected function view()
{
/* determine template package */
$tplPackage = Sobi::Cfg('section.template', SPC::DEFAULT_TEMPLATE);
Sobi::ReturnPoint();
/* load template config */
$this->template();
$this->tplCfg($tplPackage);
/* get limits - if defined in template config - otherwise from the section config */
$eLimit = $this->tKey($this->template, 'entries_limit', Sobi::Cfg('list.entries_limit', 2));
$eInLine = $this->tKey($this->template, 'entries_in_line', Sobi::Cfg('list.entries_in_line', 2));
$cInLine = $this->tKey($this->template, 'categories_in_line', Sobi::Cfg('list.categories_in_line', 2));
$cLim = $this->tKey($this->template, 'categories_limit', -1);
$entriesRecursive = $this->tKey($this->template, 'entries_recursive', Sobi::Cfg('list.entries_recursive', false));
/* get the site to display */
$site = SPRequest::int('site', 1);
$eLimStart = ($site - 1) * $eLimit;
/* get the right ordering */
$eOrder = $this->parseOrdering('entries', 'eorder', $this->tKey($this->template, 'entries_ordering', Sobi::Cfg('list.entries_ordering', 'name.asc')));
$cOrder = $this->parseOrdering('categories', 'corder', $this->tKey($this->template, 'categories_ordering', Sobi::Cfg('list.categories_ordering', 'name.asc')));
$orderings = array('entries' => $eOrder, 'categories' => $cOrder);
/* get entries */
$eCount = count($this->getEntries($eOrder, 0, 0, true, null, $entriesRecursive));
$entries = $this->getEntries($eOrder, $eLimit, $eLimStart, false, null, $entriesRecursive);
$categories = array();
if ($cLim) {
$categories = $this->getCats($cOrder, $cLim);
}
/* create page navigation */
$url = array('sid' => SPRequest::sid(), 'title' => Sobi::Cfg('sef.alias', true) ? $this->_model->get('nid') : $this->_model->get('name'));
if (SPRequest::cmd('sptpl')) {
$url['sptpl'] = SPRequest::cmd('sptpl');
}
$pnc = SPLoader::loadClass('helpers.pagenav_' . $this->tKey($this->template, 'template_type', 'xslt'));
/* @var SPPageNavXSLT $pn */
$pn = new $pnc($eLimit, $eCount, $site, array('sid' => SPRequest::sid(), 'title' => Sobi::Cfg('sef.alias', true) ? $this->_model->get('nid') : $this->_model->get('name')));
/* handle meta data */
SPFactory::header()->objMeta($this->_model);
/* add pathway */
SPFactory::mainframe()->addObjToPathway($this->_model, array(ceil($eCount / $eLimit), $site));
$this->_model->countVisit();
/* get view class */
// $class = SPLoader::loadView( $this->_type );
$view = SPFactory::View($this->_type);
// $view = new $class( $this->template );
$view->assign($eLimit, '$eLimit')->assign($eLimStart, '$eLimStart')->assign($eCount, '$eCount')->assign($cInLine, '$cInLine')->assign($eInLine, '$eInLine')->assign($this->_task, 'task')->assign($this->_model, $this->_type)->setConfig($this->_tCfg, $this->template)->setTemplate($tplPackage . '.' . $this->templateType . '.' . $this->template)->assign($categories, 'categories')->assign($pn->get(), 'navigation')->assign(SPFactory::user()->getCurrent(), 'visitor')->assign($entries, 'entries')->assign($orderings, 'orderings');
Sobi::Trigger($this->name(), 'View', array(&$view));
$view->display($this->_type);
}
示例4: userSelector
public static function userSelector($name, $value, $groups = null, $params = null, $icon = 'user', $header = 'USER_SELECT_HEADER', $format = '%user', $orderBy = 'id')
{
static $count = 0;
static $session = null;
if (!$session) {
$session = SPFactory::user()->getUserState('userSelector', null, array());
}
$params = self::checkArray($params);
if (!isset($params['id'])) {
$params['id'] = SPLang::nid($name);
}
$user = null;
SPFactory::header()->addJsFile('user_selector');
$user = SPUser::getBaseData((int) $value);
$settings = array('groups' => $groups, 'format' => $format, 'user' => Sobi::My('id'), 'ordering' => $orderBy, 'time' => microtime(true));
if (count($session)) {
foreach ($session as $id => $data) {
if (microtime(true) - $data['time'] > 3600) {
unset($session[$id]);
}
}
}
$ssid = md5(microtime() . Sobi::My('id') . ++$count);
$session[$ssid] =& $settings;
SPFactory::user()->setUserState('userSelector', $session);
$userData = null;
if ($user) {
$replacements = array();
preg_match_all('/\\%[a-z]*/', $format, $replacements);
$placeholders = array();
if (isset($replacements[0]) && count($replacements[0])) {
foreach ($replacements[0] as $placeholder) {
$placeholders[] = str_replace('%', null, $placeholder);
}
}
if (count($replacements)) {
foreach ($placeholders as $attribute) {
if (isset($user->{$attribute})) {
$format = str_replace('%' . $attribute, $user->{$attribute}, $format);
}
}
$userData = $format;
}
}
$modal = '<div class="response btn-group" data-toggle="buttons-radio"></div><br/><button class="btn btn-block hide more" type="button">' . Sobi::Txt('LOAD_MORE') . '</button>';
$filter = '<input type="text" placeholder="' . Sobi::Txt('FILTER') . '" class="search pull-right spDisableEnter" name="q">';
$id = $params['id'];
$params = self::params($params);
$f = "\n";
$f .= '<div class="spUserSelector">';
$f .= '<div class="input-append">';
$f .= "\n\t";
$f .= '<input type="text" value="' . $userData . '" ' . $params . ' name="' . $name . 'Holder" readonly="readonly" class="trigger user-name"/>';
$f .= '<span class="add-on trigger"><i class="icon-' . $icon . '"></i></span>';
$f .= '</div>';
$f .= '<input type="hidden" value="' . $value . '" name="' . $name . '" rel="selected"/>';
$f .= '<input type="hidden" value="' . $ssid . '" name="' . $name . 'Ssid"/>';
$f .= '<input type="hidden" value="1" name="' . SPFactory::mainframe()->token() . '"/>';
$f .= "\n\t";
$f .= "\n";
$f .= self::modalWindow(Sobi::Txt($header) . $filter, $id . '-window', $modal);
$f .= '</div>';
$f .= "\n";
Sobi::Trigger('Field', ucfirst(__FUNCTION__), array(&$f));
return "\n<!-- User Picker '{$name}' Output -->{$f}<!-- User Picker '{$name}' End -->\n\n";
}
示例5: parseOrdering
/**
*/
protected function parseOrdering()
{
$order = Sobi::GetUserState('sections.order', 'order', 'name.asc');
$ord = $order;
$dir = 'asc';
if (strstr($order, '.')) {
$ord = explode('.', $ord);
$dir = $ord[1];
$ord = $ord[0];
}
if ($ord == 'position') {
$ord = 'name';
}
if ($ord == 'name') {
/* @var SPdb $db */
$db =& SPFactory::db();
try {
$db->select('id', 'spdb_language', array('oType' => 'section', 'sKey' => 'name', 'language' => Sobi::Lang()), 'sValue.' . $dir);
$fields = $db->loadResultArray();
if (!count($fields) && Sobi::Lang() != Sobi::DefLang()) {
$db->select('id', 'spdb_language', array('oType' => 'section', 'sKey' => 'name', 'language' => Sobi::DefLang()), 'sValue.' . $dir);
$fields = $db->loadResultArray();
}
} catch (SPException $x) {
Sobi::Error($this->name(), SPLang::e('DB_REPORTS_ERR', $x->getMessage()), SPC::WARNING, 500, __LINE__, __FILE__);
return false;
}
if (count($fields)) {
$fields = implode(',', $fields);
$ord = "field( id, {$fields} )";
} else {
$ord = 'id.' . $dir;
}
} else {
$ord = isset($dir) && strlen($dir) ? $ord . '.' . $dir : $ord;
}
SPFactory::user()->setUserState('sections.order', $ord);
return $ord;
}
示例6: section
private function section($section, $tab)
{
$v = null;
if (isset($this->_custom[$tab]['before']) && is_array($this->_custom[$tab]['before'])) {
foreach ($this->_custom[$tab]['before'] as $html) {
$v .= "\n\t\t\t{$html}";
}
}
if (count($section)) {
$v .= "\n\t\t\t<ul>";
foreach ($section as $pos => $label) {
if (!SPFactory::user()->can($pos)) {
continue;
}
if (strlen($label) < 3) {
$label = str_replace('.', '_', $pos);
}
$label = Sobi::Txt($label);
if ($this->_sid) {
$url = Sobi::Url(array('task' => $pos, 'pid' => $this->_sid));
} else {
$url = Sobi::Url(array('task' => $pos));
}
if (SPRequest::task() == $pos || $this->_task == $pos) {
$v .= "\n\t\t\t\t<li><a href=\"{$url}\" class=\"SPMenuActive\">{$label}</a></li>";
} else {
$v .= "\n\t\t\t\t<li><a href=\"{$url}\">{$label}</a></li>";
}
}
$v .= "\n\t\t\t</ul>";
}
if (isset($this->_custom[$tab]['after']) && is_array($this->_custom[$tab]['after'])) {
foreach ($this->_custom[$tab]['after'] as $html) {
$v .= "\n\t\t\t{$html}";
}
}
return $v;
}
示例7: view
protected function view()
{
/* determine template package */
$tplPckg = Sobi::Cfg('section.template', SPC::DEFAULT_TEMPLATE);
Sobi::ReturnPoint();
$this->_task = 'alpha';
if (!$this->_model) {
$this->setModel('section');
$this->_model->init(Sobi::Section());
}
$this->visible();
/* load template config */
$this->template();
$this->tplCfg($tplPckg);
/* get limits - if defined in template config - otherwise from the section config */
$eLimit = $this->tKey($this->template, 'entries_limit', Sobi::Cfg('list.entries_limit', 2));
$eInLine = $this->tKey($this->template, 'entries_in_line', Sobi::Cfg('list.entries_in_line', 2));
/* get the site to display */
$site = SPRequest::int('site', 1);
$eLimStart = ($site - 1) * $eLimit;
$eCount = count($this->getEntries(0, 0, true));
$entries = $this->getEntries($eLimit, $site);
$compare = $this->_field ? $this->_field : $this->_nid;
if (strlen($compare) && $compare != Sobi::Cfg('alphamenu.primary_field')) {
$t = 'list.alpha.' . strtolower($this->_letter) . '.' . $this->_nid;
} else {
$t = 'list.alpha.' . strtolower($this->_letter);
}
$pn = SPFactory::Instance('helpers.pagenav_' . $this->tKey($this->template, 'template_type', 'xslt'), $eLimit, $eCount, $site, array('sid' => SPRequest::sid(), 'task' => $t));
$cUrl = array('sid' => SPRequest::sid(), 'task' => $t);
if (SPRequest::int('site', 0)) {
$cUrl['site'] = SPRequest::int('site', 0);
}
SPFactory::header()->addCanonical(Sobi::Url($cUrl, true, true, true));
/* handle meta data */
SPFactory::header()->objMeta($this->_model);
$letter = urldecode(SPRequest::cmd('letter'));
/* add pathway */
if (!$this->_fieldType) {
SPFactory::mainframe()->addToPathway(Sobi::Txt('AL.PATH_TITLE', array('letter' => $letter)), Sobi::Url('current'));
SPFactory::header()->addTitle(Sobi::Txt('AL.TITLE', array('letter' => $letter, 'section' => $this->_model->get('name'))), array(ceil($eCount / $eLimit), $site));
} else {
$field = SPFactory::Model('field');
$field->init($this->_field);
SPFactory::mainframe()->addToPathway(Sobi::Txt('AL.PATH_TITLE_FIELD', array('letter' => $letter, 'field' => $field->get('name'))), Sobi::Url('current'));
SPFactory::header()->addTitle(Sobi::Txt('AL.TITLE_FIELD', array('letter' => $letter, 'section' => $this->_model->get('name'), 'field' => $field->get('name'))), array(ceil($eCount / $eLimit), $site));
}
/* get view class */
$view = SPFactory::View('listing');
$view->assign($eLimit, '$eLimit');
$view->assign($eLimStart, '$eLimStart');
$view->assign($eCount, '$eCount');
$view->assign($eInLine, '$eInLine');
$view->assign($this->_task, 'task');
$view->assign($this->_model, 'section');
$view->assign(Sobi::Txt('AL.PATH_TITLE', array('letter' => $this->_letter)), 'listing_name');
$view->setConfig($this->_tCfg, $this->template);
$view->setTemplate($tplPckg . '.' . $this->templateType . '.' . $this->template);
$view->assign($pn->get(), 'navigation');
$view->assign(SPFactory::user()->getCurrent(), 'visitor');
$view->assign($entries, 'entries');
Sobi::Trigger('AlphaListing', 'View', array(&$view));
$view->display();
}
示例8: checkAccess
/**
* Check access permissions
* @return bool
*/
private function checkAccess()
{
$this->_user =& SPFactory::user();
/* authorise access permissions */
if (!$this->_user->can('panel')) {
Sobi::Error('CoreCtrl', 'UNAUTHORIZED_ACCESS', SPC::ERROR, 403, __LINE__, __FILE__);
exit;
}
/* authorise task permissions */
if (SPRequest::task()) {
if (!$this->_user->can(SPRequest::task())) {
Sobi::Error('CoreCtrl', 'UNAUTHORIZED_ACCESS', SPC::ERROR, 403, __LINE__, __FILE__);
// Sobi::Error( 'CoreCtrl', SPLang::e( 'UNAUTHORIZED_ACCESS_TASK', SPRequest::task() ), SPC::ERROR, 403, __LINE__, __FILE__ );
exit;
}
}
}
示例9: parseXml
protected function parseXml()
{
$header = $this->_xml->getElementsByTagName('header')->item(0);
if ($header->hasChildNodes()) {
foreach ($header->childNodes as $node) {
if (!strstr($node->nodeName, '#')) {
$params = array();
$this->parseParams($node, $params);
$this->callHeader($node->nodeName, $params[$node->nodeName]);
}
}
}
$data = $this->_xml->getElementsByTagName('cache-data')->item(0);
if ($data && $data->hasChildNodes()) {
foreach ($data->childNodes as $node) {
if (!strstr($node->nodeName, '#')) {
$params = array();
$this->parseParams($node, $params);
if (isset($params['hidden']) && is_array($params['hidden']) && count($params['hidden'])) {
foreach ($params['hidden'] as $k => $v) {
$this->addHidden($v, $k);
}
}
if (isset($params['request']) && is_array($params['request']) && count($params['request'])) {
foreach ($params['request'] as $k => $v) {
SPRequest::set($k, $v, 'get');
}
}
if (isset($params['pathway']) && is_array($params['pathway']) && count($params['pathway'])) {
foreach ($params['pathway'] as $v) {
SPFactory::mainframe()->addToPathway($v['name'], $v['url']);
}
}
}
}
}
$visitor = $this->visitorArray(SPFactory::user()->getCurrent());
if (is_array($visitor) && isset($visitor['_data'])) {
$this->importData($this->_xml->documentElement, $visitor, 'visitor');
}
$messages = SPFactory::message()->getMessages();
$info = array();
if (count($messages)) {
foreach ($messages as $type => $content) {
$info[$type] = array_values($content);
}
}
if (is_array($info)) {
$this->importData($this->_xml->documentElement, $info, 'messages');
}
$this->_xml->formatOutput = true;
}
示例10: view
protected function view()
{
/* determine template package */
$tplPackage = Sobi::Cfg('section.template', SPC::DEFAULT_TEMPLATE);
Sobi::ReturnPoint();
$this->_task = 'user';
if (!$this->_model) {
$this->setModel('section');
$this->_model->init(Sobi::Section());
}
$this->visible();
/* load template config */
$this->template();
$this->tplCfg($tplPackage);
/* get limits - if defined in template config - otherwise from the section config */
$eLimit = $this->tKey($this->template, 'entries_limit', Sobi::Cfg('list.entries_limit', 2));
$eInLine = $this->tKey($this->template, 'entries_in_line', Sobi::Cfg('list.entries_in_line', 2));
$url = array('sid' => SPRequest::sid(), 'task' => 'list.user');
if (SPRequest::int('uid')) {
$url['uid'] = SPRequest::int('uid');
$this->uid = (int) SPRequest::int('uid');
} else {
$this->uid = (int) Sobi::My('id');
}
$this->user = SPJoomlaUser::getBaseData((int) $this->uid);
if (!$this->user) {
throw new SPException(SPLang::e('UNAUTHORIZED_ACCESS'));
}
/* get the site to display */
$site = SPRequest::int('site', 1);
$eLimStart = ($site - 1) * $eLimit;
$eOrder = $this->parseOrdering('entries', 'eorder', $this->tKey($this->template, 'entries_ordering', Sobi::Cfg('list.entries_ordering', 'name.asc')));
$eCount = count($this->getEntries($eOrder, 0, 0, true, array('spo.owner' => $this->uid), true, Sobi::Section()));
$entries = $this->getEntries($eOrder, $eLimit, $eLimStart, true, array('spo.owner' => $this->uid), true, Sobi::Section());
// $eCount = count( $this->_getEntries( 0, 0, true ) );
// $entries = $this->_getEntries( $eLimit, $site );
$pn = SPFactory::Instance('helpers.pagenav_' . $this->tKey($this->template, 'template_type', 'xslt'), $eLimit, $eCount, $site, $url);
if (SPRequest::int('site', 0)) {
$url['site'] = SPRequest::int('site', 0);
}
SPFactory::header()->addCanonical(Sobi::Url($url, true, true, true));
/* handle meta data */
SPFactory::header()->objMeta($this->_model);
SPFactory::mainframe()->addToPathway(Sobi::Txt('UL.PATH_TITLE', array('username' => $this->user->username, 'user' => $this->user->name)), Sobi::Url('current'));
SPFactory::header()->addTitle(Sobi::Txt('UL.TITLE', array('username' => $this->user->username, 'user' => $this->user->name, 'section' => $this->_model->get('name'))), array(ceil($eCount / $eLimit), $site));
/* add pathway */
/* get view class */
$view = SPFactory::View('listing');
$view->assign($eLimit, '$eLimit');
$view->assign($eLimStart, '$eLimStart');
$view->assign($eCount, '$eCount');
$view->assign($eInLine, '$eInLine');
$view->assign($this->_task, 'task');
$view->assign($this->_model, 'section');
$view->setConfig($this->_tCfg, $this->template);
$view->setTemplate($tplPackage . '.' . $this->templateType . '.' . $this->template);
$view->assign($pn->get(), 'navigation');
$view->assign(SPFactory::user()->getCurrent(), 'visitor');
$view->assign($entries, 'entries');
Sobi::Trigger('UserListing', 'View', array(&$view));
$view->display();
}
示例11: listRules
/**
*/
private function listRules()
{
Sobi::ReturnPoint();
$order = SPFactory::user()->getUserState('acl.order', 'position', 'rid.asc');
try {
$rules = SPFactory::db()->select('*', 'spdb_permissions_rules', null, $order)->loadObjectList();
} catch (SPException $x) {
Sobi::Error('ACL', SPLang::e('Db reports %s.', $x->getMessage()), SPC::WARNING, 0, __LINE__, __FILE__);
}
$menu = $this->createMenu('acl');
/** @var $view SPAclView */
SPFactory::View('acl', true)->assign($this->_task, 'task')->assign($rules, 'rules')->assign($menu, 'menu')->determineTemplate('acl', 'list')->display();
}
示例12: view
protected function view()
{
/* determine template package */
$tplPackage = Sobi::Cfg('section.template', SPC::DEFAULT_TEMPLATE);
Sobi::ReturnPoint();
$this->_task = 'date';
if (!$this->_model) {
$this->setModel('section');
$this->_model->init(Sobi::Section());
}
$this->visible();
/* load template config */
$this->template();
$this->tplCfg($tplPackage);
/* get limits - if defined in template config - otherwise from the section config */
$eLimit = $this->tKey($this->template, 'entries_limit', Sobi::Cfg('list.entries_limit', 2));
$eInLine = $this->tKey($this->template, 'entries_in_line', Sobi::Cfg('list.entries_in_line', 2));
$date = explode('.', SPRequest::cmd('date'));
$this->date['year'] = isset($date[0]) && $date[0] ? $date[0] : null;
$this->date['month'] = isset($date[1]) && $date[1] ? $date[1] : null;
$this->date['day'] = isset($date[2]) && $date[2] ? $date[2] : null;
if (!$this->date['year'] || !(int) $this->date['year']) {
throw new SPException(SPLang::e('INVALID_DATE_GIVEN'));
}
/* get the site to display */
$site = SPRequest::int('site', 1);
$eLimStart = ($site - 1) * $eLimit;
$conditions = array('spo.oType' => 'entry', 'year(createdTime)' => $this->date['year']);
$listing = 'year';
if ($this->date['month'] && $this->date['month'] < 13 && $this->date['month'] > 0) {
$conditions['month(createdTime)'] = $this->date['month'];
$listing = 'month';
}
if ($this->date['day'] && $this->date['day'] < 13 && $this->date['day'] > 0) {
$conditions['day(createdTime)'] = $this->date['day'];
$listing = 'date';
}
$eOrder = 'createdTime';
$eCount = count($this->getEntries($eOrder, 0, 0, true, $conditions, true, Sobi::Section()));
$entries = $this->getEntries($eOrder, $eLimit, $eLimStart, true, $conditions, true, Sobi::Section());
$url = array('sid' => SPRequest::sid(), 'task' => 'list.date', 'date' => SPRequest::cmd('date'));
$pn = SPFactory::Instance('helpers.pagenav_' . $this->tKey($this->template, 'template_type', 'xslt'), $eLimit, $eCount, $site, $url);
if (SPRequest::int('site', 0)) {
$url['site'] = SPRequest::int('site', 0);
}
SPFactory::header()->addCanonical(Sobi::Url($url, true, true, true));
/* handle meta data */
SPFactory::header()->objMeta($this->_model);
$date = $this->date;
$monthsNames = explode(',', Sobi::Txt('JS_CALENDAR_MONTHS'));
$date['month'] = isset($monthsNames[$date['month'] - 1]) ? trim($monthsNames[$date['month'] - 1]) : null;
SPFactory::mainframe()->addToPathway(Sobi::Txt('DL.PATH_TITLE_' . strtoupper($listing), $date), Sobi::Url('current'));
SPFactory::header()->addTitle(Sobi::Txt('DL.TITLE_' . strtoupper($listing), $date), array(ceil($eCount / $eLimit), $site));
/* get view class */
$view = SPFactory::View('listing');
$view->assign($eLimit, '$eLimit');
$view->assign($eLimStart, '$eLimStart');
$view->assign($eCount, '$eCount');
$view->assign($eInLine, '$eInLine');
$view->assign($this->_task, 'task');
$view->assign($this->_model, 'section');
$view->setConfig($this->_tCfg, $this->template);
$view->setTemplate($tplPackage . '.' . $this->templateType . '.' . $this->template);
$view->assign($pn->get(), 'navigation');
$view->assign(SPFactory::user()->getCurrent(), 'visitor');
$view->assign($entries, 'entries');
Sobi::Trigger('UserListing', 'View', array(&$view));
$view->display();
}
示例13: details
/**
* Details view
* @return void
*/
private function details()
{
/* determine template package */
$tplPackage = Sobi::Cfg('section.template', SPC::DEFAULT_TEMPLATE);
/* load template config */
$this->template();
$this->tplCfg($tplPackage);
if ($this->_model->get('oType') != 'entry') {
Sobi::Error('Entry', sprintf('Serious security violation. Trying to save an object which claims to be an entry but it is a %s. Task was %s', $this->_model->get('oType'), SPRequest::task()), SPC::ERROR, 403, __LINE__, __FILE__);
exit;
}
/* add pathway */
SPFactory::mainframe()->addObjToPathway($this->_model);
$this->_model->countVisit();
$this->_model->loadFields(Sobi::Reg('current_section'));
$class = SPLoader::loadView('entry');
$view = new $class($this->template);
$view->assign($this->_model, 'entry');
$view->assign(SPFactory::user()->getCurrent(), 'visitor');
$view->assign($this->_task, 'task');
$view->setConfig($this->_tCfg, $this->template);
$view->setTemplate($tplPackage . '.' . $this->templateType . '.' . $this->template);
Sobi::Trigger($this->name(), __FUNCTION__, array(&$view));
SPFactory::header()->objMeta($this->_model);
$view->display();
SPFactory::cache()->addObj($this->_model, 'entry', $this->_model->get('id'));
}
示例14: form
protected function form()
{
$ssid = 0;
/* determine template package */
$tplPackage = Sobi::Cfg('section.template', SPC::DEFAULT_TEMPLATE);
/* load template config */
$this->template();
$this->tplCfg($tplPackage, 'search');
if ($this->template == 'results') {
$this->template = 'view';
}
if (!$this->_model) {
$this->setModel('section');
$this->_model->init(Sobi::Section());
}
/* handle meta data */
SPFactory::header()->objMeta($this->_model);
$section = SPFactory::Section(Sobi::Section());
SPFactory::header()->addKeyword($section->get('sfMetaKeys'))->addDescription($section->get('sfMetaDesc'));
/* add pathway */
SPFactory::mainframe()->addToPathway(Sobi::Txt('SH.PATH_TITLE'), Sobi::Url('current'));
SPFactory::mainframe()->setTitle(Sobi::Txt('SH.TITLE', array('section' => $this->_model->get('name'))));
Sobi::Trigger('OnFormStart', 'Search');
SPLoader::loadClass('mlo.input');
$view = SPFactory::View('search');
/* if we cannot transfer the search id in cookie */
if (!$this->session($ssid)) {
$view->addHidden($ssid, 'ssid');
}
if ($this->_task == 'results' && $ssid) {
/* get limits - if defined in template config - otherwise from the section config */
$eLimit = $this->tKey($this->template, 'entries_limit', Sobi::Cfg('search.entries_limit', Sobi::Cfg('list.entries_limit', 2)));
$eInLine = $this->tKey($this->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;
$view->assign($eLimit, '$eLimit');
$view->assign($eLimStart, '$eLimStart');
$view->assign($eInLine, '$eInLine');
$entries = $this->getResults($ssid, $this->template);
$view->assign(count($this->_results), '$eCount');
$view->assign($this->_resultsByPriority, 'priorities');
$view->assign($entries, 'entries');
/* create page navigation */
$pnc = SPLoader::loadClass('helpers.pagenav_' . $this->tKey($this->template, 'template_type', 'xslt'));
$url = array('task' => 'search.results', 'sid' => SPRequest::sid());
if (!SPRequest::cmd('ssid', null, 'cookie')) {
$url['ssid'] = $ssid;
}
/* @var SPPageNavXSLT $pn */
$pn = new $pnc($eLimit, $this->_resultsCount, $site, $url);
$view->assign($pn->get(), 'navigation');
/**
* this is te special case:
* no matter what task we currently have - if someone called this we need the data for the V-Card
* Soe we have to trigger all these plugins we need and therefore also fake the task
*/
$task = 'list.custom';
SPFactory::registry()->set('task', $task);
} else {
$eLimit = -1;
$view->assign($eLimit, '$eCount');
}
/* load all fields */
$fields = $this->loadFields();
if (isset($this->_request['search_for'])) {
$view->assign($this->_request['search_for'], 'search_for');
$view->assign($this->_request['phrase'], 'search_phrase');
}
$view->assign($fields, 'fields');
$view->assign(SPFactory::user()->getCurrent(), 'visitor');
$view->assign($this->_task, 'task');
$view->addHidden(Sobi::Section(), 'sid');
$view->addHidden('search.search', 'task');
$view->setConfig($this->_tCfg, $this->template);
$view->setTemplate($tplPackage . '.' . $this->templateType . '.' . $this->template);
Sobi::Trigger('OnCreateView', 'Search', array(&$view));
$view->display();
}
示例15:
/**
*
* @param int $id
* @return \JUser
* @internal param $id
*/
public function &getUser($id = 0)
{
return SPFactory::user()->getInstance($id);
}