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


PHP SPFactory::message方法代码示例

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


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

示例1: messages

 protected function messages()
 {
     $messages = SPFactory::message()->getReports(SPRequest::cmd('spsid'));
     $response = array();
     if (count($messages)) {
         foreach ($messages as $type => $content) {
             if (count($content)) {
                 foreach ($content as $message) {
                     $response[] = array('type' => $type, 'text' => $message);
                 }
             }
         }
     }
     $this->response(null, null, false, SPC::INFO_MSG, array('messages' => $response));
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:15,代码来源:txt.php

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

示例3: save

 public function save(&$attr)
 {
     static $lang = null;
     static $defLang = null;
     if (!$lang) {
         $lang = Sobi::Lang();
         $defLang = Sobi::DefLang();
     }
     $file = SPRequest::file('spfieldsopts', 'tmp_name');
     if ($file) {
         $data = parse_ini_file($file, true);
     } elseif (is_string($attr['options'])) {
         $data = parse_ini_string($attr['options'], true);
     } else {
         $data = null;
     }
     $options = $this->parseOptsFile($data);
     if (!count($options) && count($attr['options'])) {
         $p = 0;
         $hold = array();
         foreach ($attr['options'] as $o) {
             if (is_numeric($o['id'])) {
                 $o['id'] = $this->nid . '_' . $o['id'];
             }
             if (isset($o['id'])) {
                 $i = 0;
                 $oid = $o['id'];
                 while (isset($hold[$oid])) {
                     $oid = $o['id'] . '_' . ++$i;
                 }
                 $options[] = array('id' => $oid, 'name' => $o['name'], 'parent' => null, 'position' => ++$p);
                 $hold[$oid] = $oid;
             }
         }
     }
     if (count($options)) {
         unset($attr['options']);
         $optionsArr = array();
         $labelsArr = array();
         $optsIds = array();
         $defLabelsArr = array();
         $duplicates = false;
         foreach ($options as $i => $option) {
             /* check for doubles */
             foreach ($options as $pos => $opt) {
                 if ($i == $pos) {
                     continue;
                 }
                 if ($option['id'] == $opt['id']) {
                     $option['id'] = $option['id'] . '_' . substr((string) microtime(), 2, 8) . rand(1, 100);
                     $duplicates = true;
                 }
             }
             $optionsArr[] = array('fid' => $this->id, 'optValue' => $option['id'], 'optPos' => $option['position'], 'optParent' => $option['parent']);
             $defLabelsArr[] = array('sKey' => $option['id'], 'sValue' => $option['name'], 'language' => $defLang, 'oType' => 'field_option', 'fid' => $this->id);
             $labelsArr[] = array('sKey' => $option['id'], 'sValue' => $option['name'], 'language' => $lang, 'oType' => 'field_option', 'fid' => $this->id);
             $optsIds[] = $option['id'];
         }
         if ($duplicates) {
             SPFactory::message()->warning('FIELD_WARN_DUPLICATE_OPT_ID');
         }
         $db = SPFactory::db();
         /* try to delete the existing labels */
         try {
             $db->delete('spdb_field_option', array('fid' => $this->id));
             $db->delete('spdb_language', array('oType' => 'field_option', 'fid' => $this->id, '!sKey' => $optsIds));
         } catch (SPException $x) {
             Sobi::Error($this->name(), SPLang::e('CANNOT_STORE_FIELD_OPTIONS_DB_ERR', $x->getMessage()), SPC::ERROR, 500, __LINE__, __FILE__);
         }
         /* insert new values */
         try {
             $db->insertArray('spdb_field_option', $optionsArr);
             $db->insertArray('spdb_language', $labelsArr, true);
             if ($defLang != $lang) {
                 $db->insertArray('spdb_language', $defLabelsArr, false, true);
             }
         } catch (SPException $x) {
             Sobi::Error($this->name(), SPLang::e('CANNOT_DELETE_SELECTED_OPTIONS', $x->getMessage()), SPC::ERROR, 500, __LINE__, __FILE__);
         }
     }
     if (!isset($attr['params'])) {
         $attr['params'] = array();
     }
     $myAttr = $this->getAttr();
     $properties = array();
     if (count($myAttr)) {
         foreach ($myAttr as $property) {
             $properties[$property] = isset($attr[$property]) ? $attr[$property] : null;
         }
     }
     $this->sets['field.options'] = SPFactory::Instance('types.array')->toINIString($data);
     /** handle upload of new definition file */
     $XMLFile = SPRequest::file('select-list-dependency', 'tmp_name');
     if ($XMLFile && file_exists($XMLFile)) {
         $XMLFileName = SPRequest::file('select-list-dependency', 'name');
         if (SPFs::getExt($XMLFileName) == 'zip') {
             $arch = SPFactory::Instance('base.fs.archive');
             $name = str_replace('.zip', null, $XMLFileName);
             $path = SPLoader::dirPath('tmp.install.' . $name, 'front', false);
             $c = 0;
//.........这里部分代码省略.........
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:101,代码来源:select.php

示例4: 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;
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:52,代码来源:cache.php

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

示例6: display

 /**
  *
  */
 public function display($o = null)
 {
     if (SPRequest::cmd('format') == 'json' && Sobi::Cfg('output.json_enabled', false)) {
         return $this->jsonDisplay();
     }
     $type = $this->key('template_type', 'xslt');
     $f = null;
     $task = SPRequest::task();
     if ($this->key('functions')) {
         $f = $this->registerFunctions();
     }
     $out = null;
     if ($type != 'php' && Sobi::Cfg('global.disable_xslt', false)) {
         $type = 'php';
     }
     $parserClass = SPLoader::loadClass('mlo.template_' . $type);
     if ($parserClass) {
         /** @var $parser SPTemplateXSLT */
         $parser = new $parserClass();
     } else {
         throw new SPException(SPLang::e('CANNOT_LOAD_PARSER', $type));
     }
     $this->_attr['template_path'] = Sobi::FixPath(str_replace(SOBI_ROOT, Sobi::Cfg('live_site'), $this->_templatePath));
     $messages = SPFactory::message()->getMessages();
     if (count($messages)) {
         foreach ($messages as $type => $content) {
             $this->_attr['messages'][$type] = array_values($content);
         }
     }
     $parser->setProxy($this);
     $parser->setData($this->_attr);
     $parser->setXML($this->_xml);
     $parser->setCacheData(array('hidden' => $this->_hidden));
     $parser->setType($this->_type);
     $parser->setTemplate($this->_template);
     Sobi::Trigger('Display', $this->name(), array($type, &$this->_attr));
     $o = $o ? $o : strtolower($this->key('output', $this->key('output', 'html'), $this->tTask));
     $action = $this->key('form.action');
     if ($action) {
         $opt = SPFactory::mainframe()->form();
         if (is_array($opt) && count($opt)) {
             foreach ($opt as $l => $v) {
                 $this->addHidden($v, $l);
             }
         }
         $form = $this->csection('form');
         $form['method'] = isset($form['method']) && $form['method'] ? $form['method'] : 'post';
         $out .= "\n<form ";
         foreach ($form as $p => $v) {
             $out .= $p . '="' . $v . '" ';
         }
         $out .= ">\n";
     }
     $out .= $parser->display($o, $f);
     $hidden = null;
     if (count($this->_hidden)) {
         $this->_hidden[SPFactory::mainframe()->token()] = 1;
         foreach ($this->_hidden as $name => $value) {
             $hidden .= "\n<input type=\"hidden\" id=\"SP_{$name}\" name=\"{$name}\" value=\"{$value}\"/>";
         }
         // xhtml strict valid
         $hidden = "<div>{$hidden}</div>";
         $out .= $hidden;
     }
     $out .= $action ? "\n</form>\n" : null;
     /* SobiPro type specific content parser */
     Sobi::Trigger('ContentDisplay', $this->name(), array(&$out));
     /* common content parser */
     $cParse = $this->key('parse', -1);
     /* if it was specified in the template config file or it was set in the section config and not disabled in the template config */
     if (!(strstr($task, '.edit') || strstr($task, '.add') || in_array($task, Sobi::Cfg('plugins.content_disable', array())))) {
         if ($cParse == 1 || Sobi::Cfg('parse_template_content', false) && $cParse == -1) {
             Sobi::Trigger('Parse', 'Content', array(&$out));
         }
     }
     header('SobiPro: ' . Sobi::Section());
     if ($o == 'html' && (!strlen(SPRequest::cmd('format')) || SPRequest::cmd('format') == 'html' || SPRequest::int('crawl'))) {
         $out .= $this->pb();
         if ((SPRequest::cmd('dbg') || Sobi::Cfg('debug')) && Sobi::My('id')) {
             $start = Sobi::Reg('start');
             $mem = $start[0];
             $time = $start[1];
             $queries = SPFactory::db()->getCount();
             $mem = number_format(memory_get_usage() - $mem);
             $time = microtime(true) - $time;
             SPConfig::debOut("Memory: {$mem}<br/>Time: {$time}<br/> Queries: {$queries}");
         }
         echo "\n<!-- Start of SobiPro component-->\n<div id=\"SobiPro\" class=\"SobiPro\">\n{$out}\n</div>\n<!-- End of SobiPro component Copyright (C) 2011-2014 Sigsiu.NET GmbH -->\n";
     } else {
         $this->customOutput($out);
     }
     Sobi::Trigger('AfterDisplay', $this->name());
 }
开发者ID:vstorm83,项目名称:propertease,代码行数:96,代码来源:view.php

示例7: save

 public function save(&$attr)
 {
     static $lang = null;
     static $defLang = null;
     if (!$lang) {
         $lang = Sobi::Lang();
         $defLang = Sobi::DefLang();
     }
     $file = SPRequest::file('spfieldsopts', 'tmp_name');
     if ($file) {
         $data = parse_ini_file($file, true);
     } elseif (is_string($attr['options'])) {
         $data = parse_ini_string($attr['options'], true);
     } else {
         $data = null;
     }
     $options = $this->parseOptsFile($data);
     if (!count($options) && count($attr['options'])) {
         $p = 0;
         $hold = array();
         foreach ($attr['options'] as $o) {
             if (is_numeric($o['id'])) {
                 $o['id'] = $this->nid . '_' . $o['id'];
             }
             if (isset($o['id'])) {
                 $i = 0;
                 $oid = $o['id'];
                 while (isset($hold[$oid])) {
                     $oid = $o['id'] . '_' . ++$i;
                 }
                 $options[] = array('id' => $oid, 'name' => $o['name'], 'parent' => null, 'position' => ++$p);
                 $hold[$oid] = $oid;
             }
         }
     }
     if (count($options)) {
         unset($attr['options']);
         $optionsArr = array();
         $labelsArr = array();
         $defLabelsArr = array();
         $optsIds = array();
         foreach ($options as $i => $option) {
             /* check for doubles */
             foreach ($options as $pos => $opt) {
                 if ($i == $pos) {
                     continue;
                 }
                 if ($option['id'] == $opt['id']) {
                     $option['id'] = $option['id'] . '_' . substr((string) microtime(), 2, 8) . rand(1, 100);
                     SPFactory::message()->warning('FIELD_WARN_DUPLICATE_OPT_ID');
                 }
             }
             $optionsArr[] = array('fid' => $this->id, 'optValue' => $option['id'], 'optPos' => $option['position'], 'optParent' => $option['parent']);
             $defLabelsArr[] = array('sKey' => $option['id'], 'sValue' => $option['name'], 'language' => $defLang, 'oType' => 'field_option', 'fid' => $this->id);
             $labelsArr[] = array('sKey' => $option['id'], 'sValue' => $option['name'], 'language' => $lang, 'oType' => 'field_option', 'fid' => $this->id);
             $optsIds[] = $option['id'];
         }
         /* @var SPdb $db */
         $db =& SPFactory::db();
         /* try to delete the existing labels */
         try {
             $db->delete('spdb_field_option', array('fid' => $this->id));
             $db->delete('spdb_language', array('oType' => 'field_option', 'fid' => $this->id, '!sKey' => $optsIds));
         } catch (SPException $x) {
             Sobi::Error($this->name(), SPLang::e('CANNOT_DELETE_SELECTED_OPTIONS', $x->getMessage()), SPC::ERROR, 500, __LINE__, __FILE__);
         }
         /* insert new values */
         try {
             $db->insertArray('spdb_field_option', $optionsArr);
             $db->insertArray('spdb_language', $labelsArr, true);
             if ($defLang != $lang) {
                 $db->insertArray('spdb_language', $defLabelsArr, false, true);
             }
         } catch (SPException $x) {
             Sobi::Error($this->name(), SPLang::e('CANNOT_STORE_FIELD_OPTIONS_DB_ERR', $x->getMessage()), SPC::ERROR, 500, __LINE__, __FILE__);
         }
     }
     if (!isset($attr['params'])) {
         $attr['params'] = array();
     }
     $myAttr = $this->getAttr();
     $properties = array();
     if (count($myAttr)) {
         foreach ($myAttr as $property) {
             $properties[$property] = isset($attr[$property]) ? $attr[$property] : null;
         }
     }
     $attr['params'] = $properties;
     $this->sets['field.options'] = SPFactory::Instance('types.array')->toINIString($data);
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:90,代码来源:chbxgroup.php

示例8: logChanges

 /**
  * @param $action
  * @param null $reason
  */
 protected function logChanges($action, $reason = null)
 {
     $changes = $this->_model->getCurrentBaseData();
     $fields = $this->_model->getFields();
     if (count($fields)) {
         foreach ($fields as $nid => $field) {
             try {
                 $changes['fields'][$nid] = $field->saveHistory();
             } catch (SPException $x) {
                 $changes['fields'][$nid] = $field->getRaw();
             }
         }
     }
     SPFactory::message()->logAction($action, $this->_model->get('id'), $changes, $reason);
 }
开发者ID:pelloq1,项目名称:SobiPro,代码行数:19,代码来源:entry.php

示例9: nameField

 /**
  * Returns the name/title field
  * @return SPField
  */
 public function nameField()
 {
     if (!isset(self::$fields[Sobi::Section()][Sobi::Cfg('entry.name_field')])) {
         if (Sobi::Cfg('entry.name_field')) {
             /* @var SPField $f */
             $f = SPFactory::Model('field', true);
             $f->init(Sobi::Cfg('entry.name_field'));
             self::$fields[Sobi::Section()][Sobi::Cfg('entry.name_field')] = $f;
         } else {
             SPFactory::message()->warning('NO_NAME_FIELD_SELECTED');
         }
     }
     return isset(self::$fields[Sobi::Section()][Sobi::Cfg('entry.name_field')]) ? self::$fields[Sobi::Section()][Sobi::Cfg('entry.name_field')] : SPFactory::Model('field', true);
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:18,代码来源:config.php

示例10: delete

 /**
  */
 public function delete($id = 0)
 {
     $fields = array();
     $m = array();
     if ($id) {
         $fields[] = $id;
     } else {
         if (SPRequest::int('fid', 0)) {
             $fields[] = SPRequest::int('fid', 0);
         } else {
             $fields = SPRequest::arr('p_fid', array());
         }
     }
     if (count($fields)) {
         foreach ($fields as $id) {
             $field = SPFactory::Model('field', true);
             $field->extend($this->loadField($id));
             $msg = $field->delete();
             SPFactory::message()->setMessage($msg, false, SPC::SUCCESS_MSG);
             $m[] = $msg;
         }
     } else {
         $msg = SPLang::e('FMN.STATE_CHANGE_NO_ID');
         SPFactory::message()->setMessage($msg, false, SPC::ERROR_MSG);
         return;
     }
     return $m;
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:30,代码来源:field.php

示例11: search


//.........这里部分代码省略.........
             case 'any':
                 $this->searchWords($this->_request['phrase'] == 'all');
                 break;
         }
         $this->_results = array_unique($this->_results);
     }
     Sobi::Trigger('AfterBasic', 'Search', array(&$this->_results, &$this->_resultsByPriority));
     /* ... now the extended search. Check which data we've received */
     if (count($this->_fields)) {
         $results = null;
         foreach ($this->_fields as $field) {
             if (isset($this->_request[$field->get('nid')]) && $this->_request[$field->get('nid')] != null) {
                 $this->_narrowing = true;
                 $fr = $field->searchData($this->_request[$field->get('nid')], Sobi::Section());
                 $priority = $field->get('priority');
                 if (is_array($fr)) {
                     $this->_resultsByPriority[$priority] = array_merge($this->_resultsByPriority[$priority], $fr);
                 }
                 /* if we didn't got any results before this array contains the results */
                 if (!is_array($results)) {
                     $results = $fr;
                 } else {
                     if (is_array($fr)) {
                         $results = array_intersect($results, $fr);
                     }
                 }
             }
         }
         /** Tue, Oct 21, 2014 10:18:37
          * No result is also a result so no "count"
          * */
         //			if ( is_array( $results ) && count( $results ) ) {
         if (is_array($results)) {
             /* if we had also a string to search we have to get the intersection */
             if ($searchForString) {
                 $this->_results = array_intersect($this->_results, $results);
             } else {
                 $this->_results = $results;
             }
         }
     }
     $this->verify();
     /** @since 1.1 - a method to narrow the search results down */
     if (count($this->_fields)) {
         // If we have any results already - the we are limiting results down
         // if we don't have results but we were already searching then skip - because there is nothing to narrow down
         // if we don't have results but we weren't searching for anything else - then we are narrowing down everything
         if (count($this->_results) || !$this->_narrowing) {
             foreach ($this->_fields as &$field) {
                 $request = isset($this->_request[$field->get('nid')]) ? $this->_request[$field->get('nid')] : null;
                 if ($request) {
                     $field->searchNarrowResults($request, $this->_results, $this->_resultsByPriority);
                 }
             }
         }
     }
     $this->_request['search_for'] = str_replace('%', '*', $this->_request['search_for']);
     if (count($this->_results) > $searchLimit) {
         SPFactory::message()->error(Sobi::Txt('SH.SEARCH_TOO_MANY_RESULTS', count($this->_results), $searchLimit), false);
         $this->_resultsByPriority = array();
         $this->_results = array_slice($this->_results, 0, $searchLimit);
     } else {
         $this->sortPriority();
     }
     Sobi::Trigger('AfterExtended', 'Search', array(&$this->_results, &$this->_resultsByPriority));
     $req = is_array($this->_request) && count($this->_request) ? SPConfig::serialize($this->_request) : null;
     $res = is_array($this->_results) && count($this->_results) ? implode(', ', $this->_results) : null;
     $cre = is_array($this->_categoriesResults) && count($this->_categoriesResults) ? implode(', ', $this->_categoriesResults) : null;
     /* determine the search parameters */
     $attr = array('entriesResults' => array('results' => $res, 'resultsByPriority' => $this->_resultsByPriority), 'catsResults' => $cre, 'uid' => Sobi::My('id'), 'browserData' => SPConfig::serialize(SPBrowser::getInstance()));
     if (strlen($req)) {
         $attr['requestData'] = $req;
     }
     /* finally save */
     try {
         Sobi::Trigger('OnSave', 'Search', array(&$attr, &$ssid));
         $this->_db->update('spdb_search', $attr, array('ssid' => $ssid));
     } catch (SPException $x) {
         Sobi::Error($this->name(), SPLang::e('CANNOT_CREATE_SESSION_DB_ERR', $x->getMessage()), SPC::ERROR, 500, __LINE__, __FILE__);
     }
     $url = array('task' => 'search.results', 'sid' => Sobi::Section());
     // For Peter's Components Anywhere extension and other
     $params = Sobi::Cfg('search.params_to_pass');
     if (count($params)) {
         foreach ($params as $param) {
             $val = SPRequest::raw($param);
             if ($val) {
                 $url[$param] = SPRequest::raw($param);
             }
         }
     }
     /* if we cannot transfer the search id in cookie */
     if (!SPRequest::cmd('ssid', null, 'cookie')) {
         $url['ssid'] = $ssid;
     }
     if (Sobi::Cfg('cache.unique_search_url')) {
         $url['t'] = microtime(true);
     }
     Sobi::Redirect(Sobi::Url($url));
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:101,代码来源:search.php

示例12: editForm

 /**
  */
 private function editForm()
 {
     /* if adding new */
     if (!$this->_model || $this->_task == 'add') {
         $this->setModel(SPLoader::loadModel('category'));
     }
     $this->checkTranslation();
     $this->_model->formatDatesToEdit();
     $id = $this->_model->get('id');
     if (!$id) {
         $this->_model->set('state', 1);
         $this->_model->set('parent', SPRequest::sid());
     }
     if ($this->_model->isCheckedOut()) {
         SPFactory::message()->error(Sobi::Txt('CAT.IS_CHECKED_OUT'), false);
     } else {
         $this->_model->checkOut();
     }
     $view = SPFactory::View('category', true);
     $view->assign($this->_model, 'category')->assign($this->_task, 'task')->assign(SPFactory::CmsHelper()->userSelect('category.owner', $this->_model->get('owner') ? $this->_model->get('owner') : ($this->_model->get('id') ? 0 : Sobi::My('id')), true), 'owner')->assign($id, 'cid')->addHidden(Sobi::Section(), 'pid');
     Sobi::Trigger('Category', 'EditView', array(&$view));
     $view->display();
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:25,代码来源:category.php

示例13: elseif

 /**
  * Clean cache of a section
  * @param $section - section id. If not given, current section will be used
  * @param bool $system
  * @return SPCache
  */
 public function &cleanSection($section = 0, $system = true)
 {
     $sid = $section ? $section : $this->_section;
     $this->cleanJCache();
     if ($section == Sobi::Section() && $this->enabled()) {
         $this->Exec("BEGIN; DELETE FROM vars; COMMIT;");
         $this->Exec("BEGIN; DELETE FROM objects; COMMIT;");
     } elseif (SPFs::exists($this->_store . '.htCache_' . $sid . '.db')) {
         // we need an exception because this files are owned by Apache probably
         @unlink($this->_store . '.htCache_' . $sid . '.db');
         if (SPFs::exists($this->_store . '.htCache_' . $sid . '.db')) {
             SPFs::delete($this->_store . '.htCache_' . $sid . '.db');
         }
     }
     if ($sid > 0) {
         $this->cleanSection(-1);
         $this->cleanApc();
     }
     if ($system) {
         SPFactory::message()->resetSystemMessages();
     }
     $this->cleanSectionXML($this->_section);
     return $this;
 }
开发者ID:pelloq1,项目名称:SobiPro,代码行数:30,代码来源:cache.php

示例14: response

 protected function response($url, $message = null, $redirect = true, $type = SPC::INFO_MSG, $data = array(), $request = 'post')
 {
     if (is_array($message)) {
         $type = $message['type'];
         $message = $message['text'];
     }
     if (SPRequest::cmd('method', null, $request) == 'xhr') {
         if ($redirect && $message) {
             SPFactory::message()->setMessage($message, false, $type);
         }
         $url = str_replace('&amp;', '&', $url);
         SPFactory::mainframe()->cleanBuffer()->customHeader();
         echo json_encode(array('message' => array('text' => $message, 'type' => $type), 'redirect' => array('url' => $url, 'execute' => (bool) $redirect), 'data' => $data));
         exit;
     } else {
         if ($message) {
             if (strstr($url, 'com_sobipro')) {
                 SPFactory::message()->setMessage($message, false, $type);
                 $message = null;
             }
         }
         Sobi::Redirect($url, $message, null, $redirect);
     }
 }
开发者ID:pelloq1,项目名称:SobiPro,代码行数:24,代码来源:controller.php

示例15: getState

 protected function getState()
 {
     $state = SPFactory::cache()->getVar('system_state');
     if (!$state) {
         SPLang::load('com_sobipro.messages');
         $state = array();
         $state['accelerator'] = array('type' => Sobi::Cfg('cache.l3_enabled', true) ? 'success' : 'error', 'label' => Sobi::Cfg('cache.l3_enabled', true) ? Sobi::Txt('ACCELERATOR_ENABLED') : Sobi::Txt('ACCELERATOR_DISABLED'));
         $state['xml-optimiser'] = array('type' => Sobi::Cfg('cache.xml_enabled', true) ? 'success' : 'error', 'label' => Sobi::Cfg('cache.xml_enabled', true) ? Sobi::Txt('XML_CACHE_ENABLED') : Sobi::Txt('XML_CACHE_DISABLED'));
         $state['javascript-cache'] = array('type' => Sobi::Cfg('cache.include_js_files', false) ? 'success' : 'warning', 'label' => Sobi::Cfg('cache.include_js_files', false) ? Sobi::Txt('JS_CACHE_ENABLED') : Sobi::Txt('JS_CACHE_DISABLED'));
         $state['css-cache'] = array('type' => Sobi::Cfg('cache.include_css_files', false) ? 'success' : 'warning', 'label' => Sobi::Cfg('cache.include_css_files', false) ? Sobi::Txt('CSS_CACHE_ENABLED') : Sobi::Txt('CSS_CACHE_DISABLED'));
         $state['display-errors'] = array('type' => Sobi::Cfg('debug.display_errors', false) ? 'error' : 'success', 'label' => Sobi::Cfg('debug.display_errors', false) ? Sobi::Txt('DISPLAY_ERRORS_ENABLED') : Sobi::Txt('DISPLAY_ERRORS_DISABLED'));
         $state['debug-level'] = array('type' => Sobi::Cfg('debug.level', 0) > 2 ? 'warning' : 'success', 'label' => Sobi::Cfg('debug.level', 0) > 2 ? Sobi::Txt('DEBUG_LEVEL_TOO_HIGH') : Sobi::Txt('DEBUG_LEVEL_OK'));
         $state['debug-xml'] = array('type' => Sobi::Cfg('debug.xml_raw', false) ? 'error' : 'success', 'label' => Sobi::Cfg('debug.xml_raw', false) ? Sobi::Txt('DEBUG_XML_ENABLED') : Sobi::Txt('DEBUG_XML_DISABLED'));
         //			uasort( $state, array( $this, 'sortMessages' ) );
         $messages = SPFactory::message()->getSystemMessages();
         $content = null;
         if (count($messages)) {
             foreach ($messages as $message) {
                 $url = Sobi::Url(array('sid' => $message['section']['id']));
                 $url = "<a href=\"{$url}\">{$message['section']['name']}</a> ";
                 $message['section']['link'] = $url;
                 $message['type-text'] = ucfirst(Sobi::Txt($message['type']));
                 $state['messages'][] = $message;
             }
         }
         SPFactory::cache()->addVar($state, 'system_state');
     }
     return $state;
 }
开发者ID:pelloq1,项目名称:SobiPro,代码行数:29,代码来源:front.php


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