当前位置: 首页>>代码示例>>PHP>>正文


PHP Sobi::GetUserState方法代码示例

本文整理汇总了PHP中Sobi::GetUserState方法的典型用法代码示例。如果您正苦于以下问题:PHP Sobi::GetUserState方法的具体用法?PHP Sobi::GetUserState怎么用?PHP Sobi::GetUserState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sobi的用法示例。


在下文中一共展示了Sobi::GetUserState方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: delete

 /**
  */
 public function delete()
 {
     $childs = $this->getChilds('all', true);
     Sobi::Trigger('Section', ucfirst(__FUNCTION__), array(&$this->id));
     if (count($childs)) {
         Sobi::Redirect(Sobi::GetUserState('back_url', Sobi::Url()), Sobi::Txt('SEC.DEL_WARN'), SPC::ERROR_MSG, true);
     } else {
         Sobi::Trigger('delete', $this->name(), array(&$this));
         $db = SPFactory::db();
         try {
             $db->delete('spdb_relations', "id = {$this->id} OR pid = {$this->id}");
         } catch (SPException $x) {
             Sobi::Error($this->name(), SPLang::e('DB_REPORTS_ERR', $x->getMessage()), SPC::WARNING, 0, __LINE__, __FILE__);
         }
         try {
             $db->delete('spdb_config', array('section' => $this->id));
             $db->delete('spdb_plugin_section', array('section' => $this->id));
         } catch (SPException $x) {
             Sobi::Error($this->name(), SPLang::e('DB_REPORTS_ERR', $x->getMessage()), SPC::WARNING, 0, __LINE__, __FILE__);
         }
         try {
             $fids = $db->select('fid', 'spdb_field', array('section' => $this->id))->loadResultArray();
             if (count($fids)) {
                 foreach ($fids as $fid) {
                     try {
                         $db->select('*', $db->join(array(array('table' => 'spdb_field', 'as' => 'sField', 'key' => 'fieldType'), array('table' => 'spdb_field_types', 'as' => 'sType', 'key' => 'tid'))), array('fid' => $fid));
                         $f = $db->loadObject();
                     } catch (SPException $x) {
                         Sobi::Error($this->name(), SPLang::e('DB_REPORTS_ERR', $x->getMessage()), SPC::WARNING, 0, __LINE__, __FILE__);
                     }
                     $field =& SPFactory::Model('field', true);
                     $field->extend($f);
                     $field->delete();
                 }
             }
         } catch (SPException $x) {
             Sobi::Error($this->name(), SPLang::e('DB_REPORTS_ERR', $x->getMessage()), SPC::WARNING, 0, __LINE__, __FILE__);
         }
         parent::delete();
         Sobi::Trigger('afterDelete', $this->name(), array(&$this));
     }
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:44,代码来源:section.php

示例2: getBack

 /**
  * @return string
  */
 public function getBack()
 {
     $r = Sobi::GetUserState('back_url', Sobi::Url());
     if (!$r) {
         $r = SPRequest::string('HTTP_REFERER', self::url(), false, 'SERVER');
     }
     return $r;
 }
开发者ID:pelloq1,项目名称:SobiPro,代码行数:11,代码来源:mainframe.php

示例3: execute

 /**
  */
 public function execute()
 {
     switch ($this->_task) {
         case 'panel':
             $this->getSections();
             /** @var $view SPAdmPanelView */
             $view = SPFactory::View('front', true)->assign($acl, 'acl')->assign($this->_sections, 'sections')->assign($this->getNews(), 'news')->assign(Sobi::GetUserState('sections.order', 'order', 'name.asc'), 'order')->assign(SPFactory::CmsHelper()->myVersion(true), 'version')->assign(Sobi::Cfg('cpanel.show_entries', false), 'show-entries')->assign($this->getState(), 'system-state');
             if (Sobi::Cfg('cpanel.show_entries', false)) {
                 $view->assign($this->getEntries(), 'entries');
             }
             SPLang::load('com_sobipro.about');
             $view->determineTemplate('front', 'cpanel');
             Sobi::Trigger('Panel', 'View', array(&$view));
             $view->display();
             break;
         default:
             /* case plugin didn't registered this task, it was an error */
             if (!parent::execute()) {
                 Sobi::Error($this->name(), SPLang::e('SUCH_TASK_NOT_FOUND', SPRequest::task()), SPC::NOTICE, 404, __LINE__, __FILE__);
             }
             break;
     }
 }
开发者ID:pelloq1,项目名称:SobiPro,代码行数:25,代码来源:front.php

示例4: getView

 /**
  * @param string
  * @return SPConfigAdmView
  */
 protected function getView($task)
 {
     SPLoader::loadClass('html.input');
     $sid = Sobi::Reg('current_section');
     /* create menu */
     $class = SPLoader::loadClass('views.adm.menu');
     $menu = new $class($task, $sid);
     /* load the menu definition */
     if ($sid) {
         $cfg = SPLoader::loadIniFile('etc.adm.section_menu');
     } else {
         $cfg = SPLoader::loadIniFile('etc.adm.config_menu');
     }
     Sobi::Trigger('Create', 'AdmMenu', array(&$cfg));
     if (count($cfg)) {
         foreach ($cfg as $section => $keys) {
             $menu->addSection($section, $keys);
         }
     }
     Sobi::Trigger('AfterCreate', 'AdmMenu', array(&$menu));
     if ($sid) {
         if (Sobi::Cfg('section.template') == SPC::DEFAULT_TEMPLATE && strstr(SPRequest::task(), 'config')) {
             SPFactory::message()->warning(Sobi::Txt('TP.DEFAULT_WARN', 'https://www.sigsiu.net/help_screen/template.info'), false)->setSystemMessage();
         }
         /* create new SigsiuTree */
         $tree = SPLoader::loadClass('mlo.tree');
         $tree = new $tree(Sobi::GetUserState('categories.order', 'corder', 'position.asc'));
         /* set link */
         $tree->setHref(Sobi::Url(array('sid' => '{sid}')));
         $tree->setId('menuTree');
         /* set the task to expand the tree */
         $tree->setTask('category.expand');
         $tree->init($sid);
         /* add the tree into the menu */
         $menu->addCustom('AMN.ENT_CAT', $tree->getTree());
         $seClass = SPLoader::loadModel('section');
         $cSec = new $seClass();
         $cSec->init($sid);
     } else {
         $cSec = array('name' => Sobi::Txt('GB.CFG.GLOBAL_CONFIGURATION'));
         $menu->addCustom('GB.CFG.GLOBAL_TEMPLATES', $this->listTemplates());
     }
     $view = SPFactory::View('config', true);
     $view->assign($task, 'task');
     $view->assign($cSec, 'section');
     $view->assign($menu, 'menu');
     $view->addHidden(SPFactory::registry()->get('current_section'), 'sid');
     return $view;
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:53,代码来源:config.php

示例5: initialiseTree

 /**
  * @return SigsiuTree
  */
 protected function initialiseTree()
 {
     /** @var SigsiuTree $tree */
     $tree = SPFactory::Instance('mlo.tree', Sobi::GetUserState('categories.order', 'corder', 'position.asc'));
     $tree->setHref("javascript:SP_selectCat( '{sid}' )");
     $tree->setTask('category.chooser');
     return $tree;
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:11,代码来源:menu.php

示例6: routeTask

 /**
  * Route by task
  * @return bool
  */
 private function routeTask()
 {
     $r = true;
     if (strstr($this->_task, '.')) {
         /* task consist of the real task and the object type */
         $task = explode('.', $this->_task);
         $obj = trim(array_shift($task));
         $task = trim(implode('.', $task));
         /* load the controller class definition and get the class name */
         $ctrl = SPLoader::loadController($obj, true);
         /* route task for multiple objects - e.g removing or publishing elements from a list */
         $sids = SPRequest::arr('sid');
         $csids = SPRequest::arr('c_sid');
         $esids = SPRequest::arr('e_sid');
         if (count($sids) || count($csids) || count($esids)) {
             $sid = array_key_exists('sid', $_REQUEST) && is_array($_REQUEST['sid']) ? 'sid' : (array_key_exists('c_sid', $_REQUEST) ? 'c_sid' : 'e_sid');
             if (count(SPRequest::arr($sid))) {
                 /* @var SPdb $db */
                 $db =& SPFactory::db();
                 $objects = null;
                 try {
                     $db->select('*', 'spdb_object', array('id' => SPRequest::arr($sid)));
                     $objects = $db->loadObjectList();
                 } catch (SPException $x) {
                     Sobi::Error('CoreCtrl', SPLang::e('DB_REPORTS_ERR', $x->getMessage()), SPC::ERROR, 500, __LINE__, __FILE__);
                     $r = false;
                 }
                 /** @noinspection PhpUndefinedVariableInspection */
                 if (count($objects)) {
                     $this->_ctrl = array();
                     foreach ($objects as $object) {
                         $o = $this->extendObj($object, $obj, $ctrl, $task);
                         if ($o) {
                             $this->_ctrl[] = $o;
                         }
                     }
                     if (!count($this->_ctrl)) {
                         Sobi::Error('CoreCtrl', SPLang::e('IDENTIFIER_EXPECTED'), SPC::WARNING, 0, __LINE__, __FILE__);
                         Sobi::Redirect(Sobi::GetUserState('back_url', Sobi::Url()), SPLang::e('IDENTIFIER_EXPECTED'), SPC::ERROR_MSG);
                     }
                 } else {
                     Sobi::Error('CoreCtrl', SPLang::e('IDENTIFIER_EXPECTED'), SPC::WARNING, 0, __LINE__, __FILE__);
                     Sobi::Redirect(Sobi::GetUserState('back_url', Sobi::Url()), SPLang::e('IDENTIFIER_EXPECTED'), SPC::ERROR_MSG);
                     $r = false;
                     //break;
                 }
             } else {
                 Sobi::Error('CoreCtrl', SPLang::e('IDENTIFIER_EXPECTED'), SPC::WARNING, 0, __LINE__, __FILE__);
                 Sobi::Redirect(Sobi::GetUserState('back_url', Sobi::Url()), SPLang::e('IDENTIFIER_EXPECTED'), SPC::ERROR_MSG);
                 $r = false;
                 //break;
             }
         } else {
             /* set controller and model */
             try {
                 $ctrl = new $ctrl();
                 $this->setController($ctrl);
                 if ($ctrl instanceof SPController) {
                     $model = SPLoader::loadModel($obj, false, false);
                     if ($model) {
                         $this->_ctrl->setModel($model);
                     }
                 }
             } catch (SPException $x) {
                 Sobi::Error('CoreCtrl', SPLang::e('DB_REPORTS_ERR', $x->getMessage()), SPC::ERROR, 500, __LINE__, __FILE__);
             }
             if ($this->_sid) {
                 $this->_model =& SPFactory::object($this->_sid);
             }
             /* if the basic object we got from the #getSection method is the same one ... */
             if ($this->_model instanceof stdClass && $this->_model->oType == $obj) {
                 /*... extend the empty model of these data we've already got */
                 /** @noinspection PhpParamsInspection */
                 $this->_ctrl->extend($this->_model);
             }
             /* ... and so on... */
             $this->_ctrl->setTask($task);
         }
     } else {
         /** Special controllers not inherited from object and without model */
         $task = $this->_task;
         $ctrl = SPLoader::loadController($task, true);
         try {
             $this->setController(new $ctrl());
         } catch (SPException $x) {
             Sobi::Error('CoreCtrl', SPLang::e('Cannot set controller. %s.', $x->getMessage()), SPC::ERROR, 500, __LINE__, __FILE__);
         }
     }
     return $r;
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:94,代码来源:sobipro.php

示例7: reorder

 /**
  */
 private function reorder()
 {
     /* @var SPdb $db */
     $db =& SPFactory::db();
     $sids = SPRequest::arr('ep_sid', array());
     /* re-order it to the valid ordering */
     $order = array();
     asort($sids);
     $eLimStart = SPRequest::int('eLimStart', 0);
     $eLimit = Sobi::GetUserState('adm.entries.limit', 'elimit', Sobi::Cfg('adm_list.entries_limit', 25));
     $LimStart = $eLimStart ? ($eLimStart - 1) * $eLimit : $eLimStart;
     if (count($sids)) {
         $c = 0;
         foreach ($sids as $sid => $pos) {
             $order[++$c] = $sid;
         }
     }
     $pid = SPRequest::int('sid');
     foreach ($order as $sid) {
         try {
             $db->update('spdb_relations', array('position' => ++$LimStart), array('id' => $sid, 'oType' => 'entry', 'pid' => $pid));
             SPFactory::cache()->deleteObj('entry', $sid);
         } catch (SPException $x) {
             Sobi::Error($this->name(), SPLang::e('DB_REPORTS_ERR', $x->getMessage()), SPC::WARNING, 0, __LINE__, __FILE__);
         }
     }
     $this->response(Sobi::Back(), Sobi::Txt('EMN.REORDERED'), true, SPC::SUCCESS_MSG);
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:30,代码来源:entry.php

示例8: parseOrdering

 /**
  * @param string $subject
  * @param string $col
  * @param string $def
  * @param int $lim
  * @param int $lStart
  * @param $sids
  * @return string
  */
 protected function parseOrdering($subject, $col, $def, &$lim, &$lStart, &$sids)
 {
     $ord = Sobi::GetUserState($subject . '.order', $col, Sobi::Cfg('admin.' . $subject . '-order', $def));
     $ord = str_replace(array('e_s', 'c_s'), null, $ord);
     if (strstr($ord, '.')) {
         $ord = explode('.', $ord);
         $dir = $ord[1];
         $ord = $ord[0];
     } else {
         $dir = 'asc';
     }
     if ($ord == 'order' || $ord == 'position') {
         $subject = $subject == 'categories' ? 'category' : 'entry';
         /* @var SPdb $db */
         $db = SPFactory::db();
         $db->select('id', 'spdb_relations', array('oType' => $subject, 'pid' => $this->_model->get('id')), 'position.' . $dir, $lim, $lStart);
         $fields = $db->loadResultArray();
         if (count($fields)) {
             $sids = $fields;
             $fields = implode(',', $fields);
             $ord = "field( id, {$fields} )";
             $lStart = 0;
             $lim = 0;
         } else {
             $ord = 'id.' . $dir;
         }
     } elseif ($ord == 'name') {
         $subject = $subject == 'categories' ? 'category' : 'entry';
         /* @var SPdb $db */
         $db =& SPFactory::db();
         $db->select('id', 'spdb_language', array('oType' => $subject, 'sKey' => 'name', 'language' => Sobi::Lang()), 'sValue.' . $dir);
         $fields = $db->loadResultArray();
         if (!count($fields) && Sobi::Lang() != Sobi::DefLang()) {
             $db->select('id', 'spdb_language', array('oType' => $subject, 'sKey' => 'name', 'language' => Sobi::DefLang()), 'sValue.' . $dir);
             $fields = $db->loadResultArray();
         }
         if (count($fields)) {
             $fields = implode(',', $fields);
             $ord = "field( id, {$fields} )";
         } else {
             $ord = 'id.' . $dir;
         }
     } elseif (strstr($ord, 'field_')) {
         $db = SPFactory::db();
         static $field = null;
         if (!$field) {
             try {
                 $db->select('fieldType', 'spdb_field', array('nid' => $ord, 'section' => Sobi::Section()));
                 $fType = $db->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);
             }
         }
         /* *
          * @TODO The whole sort by custom field method in admin panel has to be re-implemented -
          * We could use the same field 'sortBy' method for backend and frontend.
          * The current method could be very inefficient !!!
          */
         if ($field && method_exists($field, 'sortByAdm')) {
             $fields = call_user_func_array(array($field, 'sortByAdm'), array(&$ord, &$dir));
         } else {
             $join = array(array('table' => 'spdb_field', 'as' => 'def', 'key' => 'fid'), array('table' => 'spdb_field_data', 'as' => 'fdata', 'key' => 'fid'));
             $db->select('sid', $db->join($join), array('def.nid' => $ord, 'lang' => Sobi::Lang()), 'baseData.' . $dir);
             $fields = $db->loadResultArray();
         }
         if (count($fields)) {
             $fields = implode(',', $fields);
             $ord = "field( id, {$fields} )";
         } else {
             $ord = 'id.' . $dir;
         }
     } elseif ($ord == 'state') {
         $ord = $ord . '.' . $dir . ', validSince.' . $dir . ', validUntil.' . $dir;
     } else {
         $ord = $ord . '.' . $dir;
     }
     return $ord;
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:90,代码来源:section.php

示例9: screen

 private function screen()
 {
     $eLimit = Sobi::GetUserState('adm.errors.limit', 'elimit', Sobi::Cfg('adm_list.entries_limit', 25));
     $eLimStart = SPRequest::int('errSite', 1);
     $LimStart = $eLimStart ? ($eLimStart - 1) * $eLimit : $eLimStart;
     $eCount = 0;
     try {
         $eCount = SPFactory::db()->select('COUNT(eid)', 'spdb_errors')->loadResult();
     } catch (SPException $x) {
     }
     if ($eLimit == -1) {
         $eLimit = $eCount;
     }
     try {
         $errors = SPFactory::db()->select(array('eid', 'date', 'errNum', 'errCode', 'errFile', 'errLine', 'errMsg', 'errUid', 'errSect', 'errReq'), 'spdb_errors', null, 'eid.desc', $eLimit, $LimStart)->loadAssocList();
     } catch (SPException $x) {
     }
     $l = $this->levels();
     $menu = $this->createMenu('error');
     /** @var $view SPAdmView */
     SPFactory::View('error', true)->assign($this->_task, 'task')->assign($menu, 'menu')->assign($errors, 'errors')->assign($l, 'levels')->assign($eLimit, 'errors-limit')->assign($eCount, 'errors-count')->assign($eLimStart, 'errors-site')->display();
 }
开发者ID:pelloq1,项目名称:SobiPro,代码行数:22,代码来源:error.php

示例10: parseOrdering

 /**
  * @param string $col
  * @param string $def
  * @return string
  */
 protected function parseOrdering($col, $def)
 {
     $order = Sobi::GetUserState('fields.order', $col, Sobi::Cfg('admin.fields-order', $def));
     $ord = $order;
     $dir = 'asc';
     /** legacy - why the hell I called it order?! */
     $ord = str_replace('order', 'position', $ord);
     if (strstr($ord, '.')) {
         $ord = explode('.', $ord);
         $dir = $ord[1];
         $ord = $ord[0];
     }
     $ord = $ord == 'state' ? 'enabled' : $ord;
     //		$ord = ( $ord == 'position' ) ? 'position' : $ord;
     if ($ord == 'name') {
         /* @var SPdb $db */
         $db = SPFactory::db();
         $fields = $db->select('fid', 'spdb_language', array('oType' => 'field', 'sKey' => 'name', 'language' => Sobi::Lang()), 'sValue.' . $dir)->loadResultArray();
         if (!count($fields) && Sobi::Lang() != Sobi::DefLang()) {
             $fields = $db->select('id', 'spdb_language', array('oType' => 'field', 'sKey' => 'name', 'language' => Sobi::DefLang()), 'sValue.' . $dir)->loadResultArray();
         }
         if (count($fields)) {
             $fields = implode(',', $fields);
             $ord = "field( fid, {$fields} )";
         } else {
             $ord = 'fid.' . $dir;
         }
     } else {
         $ord = $ord . '.' . $dir;
     }
     Sobi::setUserState('fields.order', $order);
     return $ord;
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:38,代码来源:field.php

示例11: chooser

 /**
  * Show category chooser
  *
  */
 protected function chooser($menu = false)
 {
     $out = SPRequest::cmd('out', null);
     $exp = SPRequest::int('expand', 0);
     $multi = SPRequest::int('multiple', 0);
     $tpl = SPRequest::word('treetpl', null);
     /* load the SigsiuTree class */
     $tree = SPLoader::loadClass('mlo.tree');
     $ordering = defined('SOBI_ADM_PATH') ? Sobi::GetUserState('categories.order', 'corder', 'position.asc') : Sobi::Cfg('list.categories_ordering');
     /* create new instance */
     $tree = new $tree($ordering);
     /* set link */
     if ($menu) {
         $tree->setId('menuTree');
         if (defined('SOBIPRO_ADM')) {
             $link = Sobi::Url(array('sid' => '{sid}'), false, false, true);
         } else {
             $link = Sobi::Url(array('sid' => '{sid}'));
         }
     } else {
         $link = "javascript:SP_selectCat( '{sid}' )";
     }
     $tree->setHref($link);
     /* set the task to expand the tree */
     $tree->setTask('category.chooser');
     /* disable the category which is currently edited - category cannot be within it self */
     if (!$multi) {
         if (SPRequest::sid() != Sobi::Section()) {
             $tree->disable(SPRequest::sid());
         }
         $tree->setPid(SPRequest::sid());
     } else {
         $tree->disable(Sobi::Reg('current_section'));
     }
     /* case we extending existing tree */
     if ($out == 'xml' && $exp) {
         $pid = SPRequest::int('pid', 0);
         $pid = $pid ? $pid : SPRequest::sid();
         $tree->setPid($pid);
         $tree->disable($pid);
         $tree->extend($exp);
     } else {
         /* init the tree for the current section */
         $tree->init(Sobi::Reg('current_section'));
         /* load model */
         if (!$this->_model) {
             $this->setModel(SPLoader::loadModel('category'));
         }
         /* create new view */
         $class = SPLoader::loadView('category');
         $view = new $class();
         /* assign the task and the tree */
         $view->assign($this->_task, 'task');
         $view->assign($tree, 'tree');
         $view->assign($this->_model, 'category');
         /* select template to show */
         if ($tpl) {
             $view->setTemplate('category.' . $tpl);
         } elseif ($multi) {
             $view->setTemplate('category.mchooser');
         } else {
             $view->setTemplate('category.chooser');
         }
         Sobi::Trigger('Category', 'ChooserView', array(&$view));
         $view->chooser();
     }
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:71,代码来源:category.php

示例12: checkIn

 /**
  * @param int $sid
  * @param bool $redirect
  * @return void
  */
 protected function checkIn($sid, $redirect = true)
 {
     if ($sid) {
         $this->setModel(SPLoader::loadModel($this->_type));
         $this->_model->load($sid);
         $this->_model->checkIn();
     }
     if ($redirect) {
         Sobi::Redirect(Sobi::GetUserState('back_url', Sobi::Url()));
     }
 }
开发者ID:pelloq1,项目名称:SobiPro,代码行数:16,代码来源:controller.php


注:本文中的Sobi::GetUserState方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。