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


PHP SPLoader::loadModel方法代码示例

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


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

示例1: init

 /**
  * Simple initialisation method
  *
  */
 public function init()
 {
     if (self::$cs) {
         Sobi::Error('config', SPLang::e('CRITICAL_SECTION_VIOLATED'), SPC::ERROR, 500, __LINE__, __CLASS__);
     }
     /* define critical section to avoid infinite loops */
     self::$cs = true;
     $nameField = self::key('entry.name_field');
     if ($nameField) {
         $fc = SPLoader::loadModel('field');
         $field = new $fc();
         $field->init($nameField);
         $this->set('name_field_nid', $field->get('nid'), 'entry');
         $this->set('name_field_id', $field->get('fid'), 'entry');
     }
     if (defined('SOBIPRO_ADM')) {
         if (self::key('language.adm_domain')) {
             SPLang::registerDomain(self::key('language.adm_domain'));
         }
     } else {
         if (self::key('language.domain')) {
             SPLang::registerDomain(self::key('language.domain'));
         }
     }
     /* set allowed request attributes and tags */
     SPRequest::setTagsAllowed($this->key('html.allowed_tags_array'));
     SPRequest::setAttributesAllowed($this->key('html.allowed_attributes_array'));
     $this->_store['general']['root'] = SOBI_ROOT;
     $this->_store['general']['path'] = SOBI_PATH;
     $this->_store['general']['cms'] = SOBI_CMS;
     $this->_store['general']['live_path'] = SOBI_LIVE_PATH;
     /* leave critical section */
     self::$cs = false;
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:38,代码来源:config.php

示例2: initialise

 private function initialise()
 {
     static $loaded = false;
     if (!$loaded || true) {
         defined('DS') || define('DS', DIRECTORY_SEPARATOR);
         require_once JPATH_SITE . '/components/com_sobipro/lib/sobi.php';
         Sobi::Initialise();
         if (SOBI_CMS == 'joomla3') {
             SPFactory::header()->initBase(true)->addJsFile(array('sobipro', 'jqnc', 'adm.sobipro', 'adm.jnmenu', 'jquery-base64'));
         } else {
             SPFactory::header()->initBase(true)->addJsFile(array('sobipro', 'jquery', 'adm.sobipro', 'adm.jnmenu', 'jquery-migrate', 'jquery-base64'))->addCSSCode('#toolbar-box { display: block }');
         }
         $loaded = true;
         SPLoader::loadClass('mlo.input');
         SPLoader::loadClass('models.datamodel');
         SPLoader::loadClass('models.dbobject');
         SPLoader::loadModel('section');
         $model = JModelLegacy::getInstance('MenusModelItem')->getItem();
         self::$mid = $model->id;
         if (isset($model->params['SobiProSettings']) && strlen($model->params['SobiProSettings'])) {
             $this->params = json_decode(base64_decode($model->params['SobiProSettings']));
         }
         $jsString = json_encode(array('component' => Sobi::Txt('SOBI_NATIVE_TASKS'), 'buttonLabel' => Sobi::Txt('SOBI_SELECT_FUNCTIONALITY')));
         SPFactory::header()->addJsCode("SpStrings = {$jsString}; ");
     }
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:26,代码来源:native.php

示例3: getSections

 /**
  */
 private function getSections()
 {
     $order = $this->parseOrdering();
     try {
         $sections = SPFactory::db()->select('*', 'spdb_object', array('oType' => 'section'), $order)->loadObjectList();
     } catch (SPException $x) {
         Sobi::Error($this->name(), SPLang::e('DB_REPORTS_ERR', $x->getMessage()), SPC::WARNING, 500, __LINE__, __FILE__);
     }
     if (count($sections)) {
         SPLoader::loadClass('models.datamodel');
         SPLoader::loadClass('models.dbobject');
         SPLoader::loadModel('section');
         foreach ($sections as $section) {
             if (Sobi::Can('section', 'access', 'any', $section->id)) {
                 $s = new SPSection();
                 $s->extend($section);
                 $this->_sections[] = $s;
             }
         }
     }
 }
开发者ID:pelloq1,项目名称:SobiPro,代码行数:23,代码来源:front.php

示例4: defined

 * Name: Sigrid Suski & Radek Suski, Sigsiu.NET GmbH
 * Email: sobi[at]sigsiu.net
 * Url: http://www.Sigsiu.NET
 * @copyright Copyright (C) 2006 - 2015 Sigsiu.NET GmbH (http://www.sigsiu.net). All rights reserved.
 * @license GNU/LGPL Version 3
 * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 3 as published by the Free Software Foundation, and under the additional terms according section 7 of GPL v3.
 * See http://www.gnu.org/licenses/lgpl.html and http://sobipro.sigsiu.net/licenses.
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
 * $Date: 2015-02-26 12:57:09 +0100 (Thu, 26 Feb 2015) $
 * $Revision: 4391 $
 * $Author: Radek Suski $
 * $HeadURL: file:///opt/svn/SobiPro/Component/branches/SobiPro-1.1/Site/lib/models/entry.php $
 */
defined('SOBIPRO') || exit('Restricted access');
SPLoader::loadModel('datamodel');
SPLoader::loadModel('dbobject');
/**
 * @author Radek Suski
 * @version 1.0
 * @created 10-Jan-2009 5:14:27 PM
 */
class SPEntry extends SPDBObject implements SPDataModel
{
    /**
     * @var array
     */
    private static $types = array('description' => 'html', 'icon' => 'string', 'showIcon' => 'int', 'introtext' => 'string', 'showIntrotext' => 'int', 'parseDesc' => 'int', 'position' => 'int');
    /**
     * @var
     */
    protected $oType = 'entry';
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:31,代码来源:entry.php

示例5:

 /**
  * @return SPSection
  */
 public static function &currentSection()
 {
     SPLoader::loadModel('section');
     return SPSection::getInstance();
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:8,代码来源:factory.php

示例6: array

 protected function &createMenu($task = null)
 {
     if (!$task) {
         $task = 'config.' . $this->_task;
     }
     /* load the menu definition */
     if (Sobi::Section()) {
         /* create menu */
         $menu =& SPFactory::Instance('views.adm.menu', $task, Sobi::Section());
         $cfg = SPLoader::loadIniFile('etc.adm.section_menu');
         /* create new SigsiuTree */
         $tree = SPFactory::Instance('mlo.tree');
         /* 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(Sobi::Section());
         /* add the tree into the menu */
         $menu->addCustom('AMN.ENT_CAT', $tree->getTree());
         $seClass = SPLoader::loadModel('section');
         $cSec = new $seClass();
         $cSec->init(Sobi::Section());
     } else {
         $cfg = SPLoader::loadIniFile('etc.adm.config_menu');
         /* create menu */
         $menu =& SPFactory::Instance('views.adm.menu', $task);
     }
     Sobi::Trigger('Create', 'AdmMenu', array(&$cfg));
     if (count($cfg)) {
         foreach ($cfg as $section => $keys) {
             $menu->addSection($section, $keys);
         }
     }
     if (!Sobi::Section()) {
         $menu->addCustom('GB.CFG.GLOBAL_TEMPLATES', $this->listTemplates());
     }
     Sobi::Trigger('AfterCreate', 'AdmMenu', array(&$menu));
     return $menu;
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:40,代码来源:config.php

示例7:

 /**
  * @param stdClass $obj
  * @param string $ctrlClass
  * @param string $objType
  * @param string $task
  * @return SPControl
  */
 private function &extendObj($obj, $objType, $ctrlClass, $task = null)
 {
     if ($objType == $obj->oType) {
         if ($ctrlClass) {
             /* create controller */
             $ctrl = new $ctrlClass();
             /* set model */
             /** @noinspection PhpUndefinedMethodInspection */
             $ctrl->setModel(SPLoader::loadModel($objType));
             /* extend model of basic data */
             $ctrl->extend($obj);
             /* set task */
             if (strlen($task)) {
                 $ctrl->setTask($task);
             }
         } else {
             Sobi::Error('CoreCtrl', SPLang::e('SUCH_TASK_NOT_FOUND', SPRequest::task()), SPC::NOTICE, 404, __LINE__, __FILE__);
         }
     }
     return $ctrl;
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:28,代码来源:sobipro.php

示例8: defined

 * @license GNU/LGPL Version 3
 * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 3 as published by the Free Software Foundation, and under the additional terms according section 7 of GPL v3.
 * See http://www.gnu.org/licenses/lgpl.html and http://sobipro.sigsiu.net/licenses.
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
 * $Date$
 * $Revision$
 * $Author$
 * $HeadURL$
 */
/**
 * @author Radek Suski
 * @version 1.0
 * @created 09-Mar-2009 12:00:45 PM
 */
defined('SOBIPRO') || exit('Restricted access');
SPLoader::loadModel('field');
final class SPAdmField extends SPField
{
    /**
     * @var array
     */
    private $_translatable = array('name', 'description');
    public function save($attr)
    {
        /* @var SPdb $db */
        $db = SPFactory::db();
        $base = $attr;
        $this->loadType();
        /* clean input */
        if (isset($attr['name'])) {
            $base['name'] = $db->escape($attr['name']);
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:31,代码来源:field.php

示例9: editForm

    /**
     */
    private function editForm()
    {
        $sid = SPRequest::int('pid');
        $sid = $sid ? $sid : SPRequest::sid();
        $view = SPFactory::View('entry', true);
        $this->checkTranslation();
        /* if adding new */
        if (!$this->_model) {
            $this->setModel(SPLoader::loadModel('entry'));
        }
        $this->_model->formatDatesToEdit();
        $id = $this->_model->get('id');
        if (!$id) {
            $this->_model->set('state', 1);
            $this->_model->set('approved', 1);
        } else {
            $view->assign($view->languages(), 'languages-list');
        }
        $this->_model->loadFields(Sobi::Reg('current_section'), true);
        $this->_model->formatDatesToEdit();
        if ($this->_model->isCheckedOut()) {
            SPFactory::message()->error(Sobi::Txt('EN.IS_CHECKED_OUT', $this->_model->get('name')), false);
        } else {
            /* check out the model */
            $this->_model->checkOut();
        }
        /* get fields for this section */
        /* @var SPEntry $this ->_model */
        $fields = $this->_model->get('fields');
        if (!count($fields)) {
            throw new SPException(SPLang::e('CANNOT_GET_FIELDS_IN_SECTION', Sobi::Reg('current_section')));
        }
        $revisionChange = false;
        $rev = SPRequest::cmd('revision');
        $revisionsDelta = array();
        if ($rev) {
            $revision = SPFactory::message()->getRevision(SPRequest::cmd('revision'));
            if (isset($revision['changes']) && count($revision['changes'])) {
                SPFactory::message()->warning(Sobi::Txt('HISTORY_REVISION_WARNING', $revision['changedAt']), false);
                foreach ($fields as $i => $field) {
                    if ($field->get('enabled') && $field->enabled('form')) {
                        if (isset($revision['changes']['fields'][$field->get('nid')])) {
                            $revisionData = $revision['changes']['fields'][$field->get('nid')];
                        } else {
                            $revisionData = null;
                        }
                        $currentData = $field->getRaw();
                        if (is_array($revisionData) && !is_array($currentData)) {
                            try {
                                $currentData = SPConfig::unserialize($currentData);
                            } catch (SPException $x) {
                            }
                        }
                        if ($revisionData || $currentData) {
                            if (md5(serialize($currentData)) != md5(serialize($revisionData))) {
                                $field->revisionChanged()->setRawData($revisionData);
                            }
                        }
                        $fields[$i] = $field;
                    }
                }
                unset($revision['changes']['fields']);
                foreach ($revision['changes'] as $attr => $value) {
                    if ($value != $this->_model->get($attr)) {
                        $revisionsDelta[$attr] = $value;
                        $this->_model->setRevData($attr, $value);
                    }
                }
                $revisionChange = true;
            } else {
                SPFactory::message()->error(Sobi::Txt('HISTORY_REVISION_NOT_FOUND'), false)->setSystemMessage();
            }
        }
        $f = array();
        foreach ($fields as $field) {
            if ($field->get('enabled') && $field->enabled('form')) {
                $f[] = $field;
            }
        }
        /* create the validation script to check if required fields are filled in and the filters, if any, match */
        $this->createValidationScript($fields);
        $view->assign($this->_model, 'entry');
        /* get the categories */
        $cats = $this->_model->getCategories(true);
        if (count($cats)) {
            $tCats = array();
            foreach ($cats as $cid) {
                /* ROTFL ... damn I like arrays ;-) */
                $tCats2 = SPFactory::config()->getParentPath($cid, true);
                if (is_array($tCats2) && count($tCats2)) {
                    $tCats[] = implode(Sobi::Cfg('string.path_separator'), $tCats2);
                }
            }
            if (count($tCats)) {
                $view->assign(implode("\n", $tCats), 'parent_path');
            }
            $view->assign(implode(", ", $cats), 'parents');
        } elseif ($this->_model->get('valid')) {
//.........这里部分代码省略.........
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:101,代码来源:entry.php

示例10: 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

示例11: fetchElement

 public function fetchElement($name)
 {
     static $sid = 0;
     $selected = 0;
     $db = SPFactory::db();
     if (!$sid) {
         $sid = 0;
         if ($this->cid) {
             $link = $this->getLink();
             if (strstr($link, 'sid')) {
                 $query = array();
                 parse_str($link, $query);
                 $sid = $query['sid'];
                 if (isset($query['sptpl'])) {
                     $this->tpl = $query['sptpl'];
                 }
             }
             if ($sid) {
                 $section = SPFactory::object($sid);
                 if ($section->oType == 'section') {
                     $selected = $section->id;
                     $this->section = $selected;
                 } else {
                     $path = array();
                     $id = $sid;
                     while ($id > 0) {
                         try {
                             $db->select('pid', 'spdb_relations', array('id' => $id));
                             $id = $db->loadResult();
                             if ($id) {
                                 $path[] = (int) $id;
                             }
                         } catch (SPException $x) {
                         }
                     }
                     $path = array_reverse($path);
                     $selected = $path[0];
                     $this->section = $selected;
                 }
             } else {
                 // just to not repeating
                 $sid = -1;
             }
         }
     }
     $this->sid = $sid;
     $this->determineObjectType($sid);
     switch ($name) {
         case 'sid':
             $params = array('id' => 'sid', 'class' => 'input-mini', 'style' => 'text-align: center; margin-top: 10px; margin-left: 10px;', 'readonly' => 'readonly');
             return '<div class="SobiPro" id="jform_request_sid">' . SPHtml_Input::text('type', $this->oTypeName, array('id' => 'otype', 'class' => 'input-medium', 'style' => 'text-align: center; margin-top: 10px;', 'readonly' => 'readonly')) . SPHtml_Input::text('urlparams[sid]', $sid, $params) . '</div>';
             break;
         case 'cid':
             return $this->getCat();
             break;
         case 'eid':
             return $this->getEntry();
             break;
         case 'did':
         case 'date':
             return $this->getCalendar();
             break;
         case 'tpl':
         case 'sptpl':
             return $this->getTemplates();
             break;
     }
     $sections = array();
     $sout = array();
     try {
         $sections = $db->select('*', 'spdb_object', array('oType' => 'section'), 'id')->loadObjectList();
     } catch (SPException $x) {
         Sobi::Error($this->name(), $x->getMessage(), SPC::ERROR, 500, __LINE__, __FILE__);
     }
     if (count($sections)) {
         SPLoader::loadClass('models.datamodel');
         SPLoader::loadClass('models.dbobject');
         SPLoader::loadModel('section');
         $sout[] = Sobi::Txt('SOBI_SELECT_SECTION');
         foreach ($sections as $section) {
             if (Sobi::Can('section', 'access', 'valid', $section->id)) {
                 $s = new SPSection();
                 $s->extend($section);
                 $sout[$s->get('id')] = $s->get('name');
             }
         }
     }
     $params = array('id' => 'spsection', 'class' => 'required');
     $field = SPHtml_Input::select('sid', $sout, $selected, false, $params);
     return "<div class=\"SobiPro\" style=\"margin-top: 2px;\">{$field}</div>";
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:91,代码来源:spsection.php

示例12: editForm

 /**
  */
 private function editForm()
 {
     if ($this->_task != 'add') {
         $sid = SPRequest::sid();
         $sid = $sid ? $sid : SPRequest::int('pid');
     } else {
         $this->authorise($this->_task, 'own');
         $this->_model = null;
         $sid = SPRequest::int('pid');
         //			$section = SPFactory::Section( Sobi::Section() );
     }
     if ($this->_model && $this->_model->isCheckedOut()) {
         Sobi::Redirect(Sobi::Url(array('sid' => SPRequest::sid())), Sobi::Txt('EN.IS_CHECKED_OUT', $this->_model->get('name')), SPC::ERROR_MSG, true);
     }
     /* determine template package */
     $tplPackage = Sobi::Cfg('section.template', SPC::DEFAULT_TEMPLATE);
     /* load template config */
     $this->template();
     $this->tplCfg($tplPackage);
     /* check if we have stored last edit in cache */
     $this->getCache(SPRequest::string('editentry', null, false, 'cookie'), 'editcache');
     $section = SPFactory::Model('section');
     $section->init(Sobi::Section());
     SPFactory::cache()->setJoomlaCaching(false);
     if ($this->_model) {
         /* handle meta data */
         SPFactory::header()->objMeta($this->_model);
         /* add pathway */
         SPFactory::mainframe()->addObjToPathway($this->_model);
     } else {
         /* handle meta data */
         SPFactory::header()->objMeta($section);
         if ($this->_task == 'add') {
             SPFactory::header()->addKeyword($section->get('efMetaKeys'))->addDescription($section->get('efMetaDesc'));
         }
         SPFactory::mainframe()->addToPathway(Sobi::Txt('EN.ADD_PATH_TITLE'), Sobi::Url('current'));
         SPFactory::mainframe()->setTitle(Sobi::Txt('EN.ADD_TITLE', array('section' => $section->get('name'))));
         /* add pathway */
         SPFactory::mainframe()->addObjToPathway($section);
         $this->setModel(SPLoader::loadModel('entry'));
     }
     $this->_model->formatDatesToEdit();
     $id = $this->_model->get('id');
     if (!$id) {
         $this->_model->set('state', 1);
     }
     if ($this->_task != 'add' && !$this->authorise($this->_task, $this->_model->get('owner') == Sobi::My('id') ? 'own' : '*')) {
         throw new SPException(SPLang::e('YOU_ARE_NOT_AUTH_TO_EDIT_THIS_ENTRY'));
     }
     $this->_model->loadFields(Sobi::Reg('current_section'));
     /* get fields for this section */
     $fields = $this->_model->get('fields');
     if (!count($fields)) {
         throw new SPException(SPLang::e('CANNOT_GET_FIELDS_IN_SECTION', Sobi::Reg('current_section')));
     }
     /* create the validation script to check if required fields are filled in and the filters, if any, match */
     $this->createValidationScript($fields);
     /* check out the model */
     $this->_model->checkOut();
     $class = SPLoader::loadView('entry');
     $view = new $class($this->template);
     $view->assign($this->_model, 'entry');
     $cache = Sobi::Reg('editcache');
     /* get the categories */
     if (isset($cache) && isset($cache['entry_parent'])) {
         $cats = explode(',', $cache['entry_parent']);
     } else {
         $cats = $this->_model->getCategories(true);
     }
     if (count($cats)) {
         $tCats = array();
         foreach ($cats as $cid) {
             $tCats2 = SPFactory::config()->getParentPath((int) $cid, true);
             if (is_array($tCats2) && count($tCats2)) {
                 $tCats[] = implode(Sobi::Cfg('string.path_separator', ' > '), $tCats2);
             }
         }
         if (count($tCats)) {
             $view->assign(implode("\n", $tCats), 'parent_path');
         }
         $view->assign(implode(", ", $cats), 'parents');
     } else {
         $parent = $sid == Sobi::Reg('current_section') ? 0 : $sid;
         if ($parent) {
             $view->assign(implode(Sobi::Cfg('string.path_separator', ' > '), SPFactory::config()->getParentPath($parent, true)), 'parent_path');
         }
         $view->assign($parent, 'parents');
     }
     $view->assign($this->_task, 'task');
     $view->assign($fields, 'fields');
     $view->assign($id, 'id');
     $view->assign($id, 'sid');
     $view->assign(SPFactory::user()->getCurrent(), 'visitor');
     $view->setConfig($this->_tCfg, $this->template);
     $view->setTemplate($tplPackage . '.' . $this->templateType . '.' . ($this->template == 'add' ? 'edit' : $this->template));
     $view->addHidden($sid ? $sid : SPRequest::sid(), 'pid');
     $view->addHidden($id, 'sid');
     $view->addHidden(SPRequest::int('pid') && SPRequest::int('pid') != $id ? SPRequest::int('pid') : Sobi::Section(), 'pid');
//.........这里部分代码省略.........
开发者ID:pelloq1,项目名称:SobiPro,代码行数:101,代码来源:entry.php

示例13: getSection

 /**
  * @param int $sid
  * @return SPSection
  */
 private function getSection($sid)
 {
     SPLoader::loadModel('section');
     $section = new SPSection();
     $section->init($sid);
     return $section;
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:11,代码来源:tree.php

示例14: loadFields

 protected function loadFields()
 {
     $fields = null;
     $fmod = SPLoader::loadModel('field');
     /* get fields */
     try {
         $this->_db->select('*', 'spdb_field', array('section' => Sobi::Section(), 'inSearch' => 1, 'enabled' => 1), 'position');
         $fields = $this->_db->loadObjectList();
     } catch (SPException $x) {
         Sobi::Error($this->name(), SPLang::e('CANNOT_GET_FIELDS_DB_ERR', $x->getMessage()), SPC::ERROR, 500, __LINE__, __FILE__);
     }
     if (count($fields)) {
         foreach ($fields as $i => $f) {
             /* @var SPField $field */
             $field = new $fmod();
             $field->extend($f);
             if (count($this->_request) && isset($this->_request[$field->get('nid')])) {
                 $field->setSelected($this->_request[$field->get('nid')]);
             }
             $fields[$i] = $field;
         }
     }
     Sobi::Trigger('LoadFields', 'Search', array(&$fields));
     return $fields;
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:25,代码来源:search.php

示例15: execute

 /**
  * Route task
  */
 public function execute()
 {
     /* parent class executes the plugins */
     $r = false;
     $task = $this->_task;
     if (strstr($this->_task, '.')) {
         $task = explode('.', $this->_task);
         $this->_fieldType = $task[1];
         $task = $task[0];
     }
     switch ($task) {
         case 'list':
             $r = true;
             $this->listFields();
             break;
         case 'add':
         case 'edit':
             $r = true;
             $this->edit();
             break;
         case 'cancel':
             $r = true;
             $this->checkIn();
             $this->response(Sobi::Back());
             break;
         case 'addNew':
             $r = true;
             Sobi::Redirect(Sobi::Url(array('task' => 'field.edit', 'fid' => $this->saveNew(), 'sid' => SPRequest::sid())));
             break;
         case 'apply':
         case 'save':
             $r = true;
             $this->save();
             break;
         case 'clone':
             $r = true;
             $this->save(true);
             break;
         case 'delete':
             $r = true;
             SPFactory::cache()->cleanSection();
             $this->response(Sobi::Url(array('task' => 'field.list', 'pid' => Sobi::Section())), $this->delete(), true);
             break;
         case 'reorder':
             $r = true;
             $this->reorder();
             break;
         case 'revisions':
             $r = true;
             $this->revisions();
             break;
         case 'up':
         case 'down':
             $r = true;
             $this->singleReorder($this->_task == 'up');
             break;
         case 'hide':
         case 'publish':
         case 'setRequired':
         case 'setNotRequired':
         case 'setEditable':
         case 'setNotEditable':
         case 'setFee':
         case 'setFree':
         case 'toggle':
             $r = true;
             $this->authorise($this->_task);
             SPFactory::cache()->cleanSection();
             $this->response(Sobi::Back(), $this->changeState($task), true);
             break;
         default:
             /* case plugin didn't registered this task, it was an error */
             if (!Sobi::Trigger('Execute', $this->name(), array(&$this))) {
                 $fid = SPRequest::int('fid');
                 $method = $this->_task;
                 if ($fid) {
                     SPLoader::loadModel('field', true);
                     $fdata = $this->loadField($fid);
                     $field = new SPAdmField();
                     $field->extend($fdata);
                     try {
                         $field->{$method}();
                     } catch (SPException $x) {
                         Sobi::Error($this->name(), SPLang::e('SUCH_TASK_NOT_FOUND', SPRequest::task()), SPC::NOTICE, 404, __LINE__, __FILE__);
                     }
                 } elseif (!parent::execute()) {
                     Sobi::Error($this->name(), SPLang::e('SUCH_TASK_NOT_FOUND', SPRequest::task()), SPC::NOTICE, 404, __LINE__, __FILE__);
                 }
             }
             break;
     }
     return $r;
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:96,代码来源:field.php


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