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


PHP Sobi::Lang方法代码示例

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


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

示例1: menu

 protected function menu(&$data)
 {
     if (Sobi::Cfg('general.top_menu', true)) {
         $data['menu'] = array('front' => array('_complex' => 1, '_data' => Sobi::Reg('current_section_name'), '_attributes' => array('lang' => Sobi::Lang(false), 'url' => Sobi::Url(array('sid' => Sobi::Section())))));
         if (Sobi::Can('section.search')) {
             $data['menu']['search'] = array('_complex' => 1, '_data' => Sobi::Txt('MN.SEARCH'), '_attributes' => array('lang' => Sobi::Lang(false), 'url' => Sobi::Url(array('task' => 'search', 'sid' => Sobi::Section()))));
         }
         if (Sobi::Can('entry', 'add', 'own', Sobi::Section())) {
             $data['menu']['add'] = array('_complex' => 1, '_data' => Sobi::Txt('MN.ADD_ENTRY'), '_attributes' => array('lang' => Sobi::Lang(false), 'url' => Sobi::Url(array('task' => 'entry.add', 'sid' => SPRequest::sid()))));
         }
     }
 }
开发者ID:vstorm83,项目名称:propertease,代码行数:12,代码来源:view.php

示例2: array

 /**
  * @param $action
  * @param int $sid
  * @param array $changes
  * @param $message
  * @return SPMessage
  */
 public function &logAction($action, $sid = 0, $changes = array(), $message = null)
 {
     if (Sobi::Cfg('entry.versioning', true)) {
         $log = array('revision' => microtime(true) . '.' . $sid . '.' . Sobi::My('id'), 'changedAt' => 'FUNCTION:NOW()', 'uid' => Sobi::My('id'), 'userName' => Sobi::My('name'), 'userEmail' => Sobi::My('mail'), 'change' => $action, 'site' => defined('SOBIPRO_ADM') ? 'adm' : 'site', 'sid' => $sid, 'changes' => SPConfig::serialize($changes), 'params' => null, 'reason' => $message, 'language' => Sobi::Lang());
         SPFactory::db()->insert('spdb_history', $log);
     }
     return $this;
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:15,代码来源:message.php

示例3: loadData

 /**
  * Get field specific values if these are in an other table
  * @param $sid - id of the entry
  * @param $fullData - the database row form the spdb_field_data table
  * @param $rawData - raw data of the field content
  * @param $fData - full formated data of the field content
  * @return void
  */
 public function loadData($sid, &$fullData, &$rawData, &$fData)
 {
     /* @var SPdb $db */
     $db =& SPFactory::db();
     static $lang = null;
     if (!$lang) {
         $lang = Sobi::Lang(false);
     }
     $table = $db->join(array(array('table' => 'spdb_field_option_selected', 'as' => 'sdata', 'key' => 'fid'), array('table' => 'spdb_field_data', 'as' => 'fdata', 'key' => 'fid'), array('table' => 'spdb_language', 'as' => 'ldata', 'key' => array('sdata.optValue', 'ldata.sKey'))));
     try {
         $db->select('*, sdata.copy as scopy', $table, array('sdata.fid' => $this->id, 'sdata.sid' => $sid, 'fdata.sid' => $sid, 'ldata.oType' => 'field_option', 'ldata.fid' => $this->id), 'scopy', 0, 0, true);
         $data = $db->loadObjectList();
         $order = SPFactory::cache()->getVar('order_' . $this->nid);
         if (!$order) {
             $db->select('optValue', 'spdb_field_option', array('fid' => $this->id), 'optPos');
             $order = $db->loadResultArray();
             SPFactory::cache()->addVar($order, 'order_' . $this->nid);
         }
         // check which version the user may see
         $copy = $this->checkCopy();
         if ($data && count($data)) {
             $rawData = array();
             $sRawData = array();
             $copied = false;
             foreach ($data as $selected) {
                 // if there was at least once copy
                 if ($selected->scopy) {
                     $copied = true;
                 }
             }
             // check what we should show
             $remove = (int) $copied && $copy;
             foreach ($data as $selected) {
                 if ($selected->scopy == $remove) {
                     // if not already set or the language fits better
                     if (!isset($rawData[$selected->optValue]) || $selected->language == $lang) {
                         $rawData[$selected->optValue] = $selected->sValue;
                     }
                 }
             }
             foreach ($order as $id => $opt) {
                 if (isset($rawData[$opt])) {
                     $sRawData[] = $rawData[$opt];
                     $this->_selected[$id] = $opt;
                 }
             }
             $fData = implode("</li>\n\t<li>", $sRawData);
             $fData = "<ul id=\"{$this->nid}\" class=\"{$this->cssClass}\">\n\t<li>{$fData}</li>\n</ul>\n";
             $fullData->baseData = $fData;
         }
     } catch (SPException $x) {
         Sobi::Error($this->name(), SPLang::e('CANNOT_GET_SELECTED_OPTIONS', $x->getMessage()), SPC::WARNING, 0, __LINE__, __FILE__);
     }
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:62,代码来源:multiselect.php

示例4: view

 private function view()
 {
     $type = $this->key('template_type', 'xslt');
     if ($type != 'php' && Sobi::Cfg('global.disable_xslt', false)) {
         $type = 'php';
     }
     if ($type == 'xslt') {
         $visitor = $this->get('visitor');
         $current = $this->get('section');
         $categories = $this->get('categories');
         $entries = $this->get('entries');
         $data = array();
         $data['id'] = $current->get('id');
         $data['section'] = array('_complex' => 1, '_data' => Sobi::Section(true), '_attributes' => array('id' => Sobi::Section(), 'lang' => Sobi::Lang(false)));
         $data['name'] = array('_complex' => 1, '_data' => $this->get('listing_name'), '_attributes' => array('lang' => Sobi::Lang(false)));
         if (Sobi::Cfg('category.show_desc')) {
             $desc = $current->get('description');
             if (Sobi::Cfg('category.parse_desc')) {
                 Sobi::Trigger('prepare', 'Content', array(&$desc, $current));
             }
             $data['description'] = array('_complex' => 1, '_cdata' => 1, '_data' => $desc, '_attributes' => array('lang' => Sobi::Lang(false)));
         }
         $data['meta'] = array('description' => $current->get('metaDesc'), 'keys' => $this->metaKeys($current), 'author' => $current->get('metaAuthor'), 'robots' => $current->get('metaRobots'));
         $data['entries_in_line'] = $this->get('$eInLine');
         $data['categories_in_line'] = $this->get('$cInLine');
         $this->menu($data);
         $this->alphaMenu($data);
         $data['visitor'] = $this->visitorArray($visitor);
         if (count($categories)) {
             foreach ($categories as $category) {
                 if (is_numeric($category)) {
                     $category = SPFactory::Category($category);
                 }
                 $data['categories'][] = array('_complex' => 1, '_attributes' => array('id' => $category->get('id'), 'nid' => $category->get('nid')), '_data' => $this->category($category));
                 unset($category);
             }
         }
         if (count($entries)) {
             $this->loadNonStaticData($entries);
             $manager = Sobi::Can('entry', 'edit', '*', Sobi::Section()) ? true : false;
             foreach ($entries as $eid) {
                 $en = $this->entry($eid, $manager);
                 $data['entries'][] = array('_complex' => 1, '_attributes' => array('id' => $en['id']), '_data' => $en);
             }
             $this->navigation($data);
         }
         $this->_attr = $data;
     }
     // general listing trigger
     Sobi::Trigger('Listing', ucfirst(__FUNCTION__), array(&$this->_attr));
     // specific lisitng trigger
     Sobi::Trigger($this->_type, ucfirst(__FUNCTION__), array(&$this->_attr));
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:53,代码来源:listing.php

示例5: struct

 /**
  * @return array
  * Ausgabe des Feldes in DV and vCard
  */
 public function struct()
 {
     $data = SPLang::getValue($this->nid . '-viewInfo', 'field_information', Sobi::Section());
     $attributes = array();
     if (strlen($data)) {
         $this->cssClass = strlen($this->cssClass) ? $this->cssClass : 'spFieldsData';
         $this->cssClass = $this->cssClass . ' ' . $this->nid;
         $this->cleanCss();
         $attributes = array('lang' => Sobi::Lang(), 'class' => $this->cssClass);
     } else {
         $this->cssClass = strlen($this->cssClass) ? $this->cssClass : 'spField';
     }
     return array('_complex' => 1, '_data' => $data, '_attributes' => $attributes);
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:18,代码来源:info.php

示例6: display

 /**
  *
  */
 public function display()
 {
     $this->_type = 'frontpage';
     $type = $this->key('template_type', 'xslt');
     if ($type != 'php' && Sobi::Cfg('global.disable_xslt', false)) {
         $type = 'php';
     }
     if ($type == 'xslt') {
         $sections = $this->get('sections');
         $data = array();
         if (count($sections)) {
             foreach ($sections as $section) {
                 $s = array('name' => array('_complex' => 1, '_data' => $section->get('name'), '_attributes' => array('lang' => Sobi::Lang(false))), 'description' => array('_complex' => 1, '_cdata' => 1, '_data' => $section->get('description'), '_attributes' => array('lang' => Sobi::Lang(false))), 'createdTime' => $section->get('createdTime'), 'meta' => array('description' => $section->get('metaDesc'), 'keys' => $this->metaKeys($section), 'author' => $section->get('metaAuthor'), 'robots' => $section->get('metaRobots')), 'owner' => $section->get('owner'), 'version' => $section->get('version'), 'validSince' => $section->get('validSince'), 'validUntil' => $section->get('validUntil'), 'url' => Sobi::Url(array('sid' => $section->get('id'))));
                 $data[] = array('_complex' => 1, '_data' => $s, '_attributes' => array('id' => $section->get('id'), 'nid' => $section->get('nid')));
             }
         }
         $this->assign($data, 'sections');
         Sobi::Trigger($this->_type, ucfirst(__FUNCTION__), array(&$this->_attr));
     }
     parent::display();
 }
开发者ID:pelloq1,项目名称:SobiPro,代码行数:24,代码来源:front.php

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

示例8: saveData

 /**
  * Gets the data for a field and save it in the database
  * @param SPEntry $entry
  * @param string $request
  * @throws SPException
  * @return bool
  */
 public function saveData(&$entry, $request = 'POST')
 {
     if (!$this->enabled) {
         return false;
     }
     if ($this->method == 'fixed') {
         $fixed = $this->fixedCid;
         $fixed = explode(',', $fixed);
         $data = array();
         if (count($fixed)) {
             foreach ($fixed as $cid) {
                 $data[] = trim($cid);
             }
         }
         if (!count($data)) {
             throw new SPException(SPLang::e('FIELD_CC_FIXED_CID_NOT_SELECTED', $this->name));
         }
     } else {
         $data = $this->verify($entry, $request);
     }
     $time = SPRequest::now();
     $IP = SPRequest::ip('REMOTE_ADDR', 0, 'SERVER');
     $uid = Sobi::My('id');
     /* if we are here, we can save these data */
     /* @var SPdb $db */
     $db = SPFactory::db();
     /* collect the needed params */
     $params = array();
     $params['publishUp'] = $entry->get('publishUp');
     $params['publishDown'] = $entry->get('publishDown');
     $params['fid'] = $this->fid;
     $params['sid'] = $entry->get('id');
     $params['section'] = Sobi::Reg('current_section');
     $params['lang'] = Sobi::Lang();
     $params['enabled'] = $entry->get('state');
     $params['params'] = null;
     $params['options'] = null;
     $params['baseData'] = SPConfig::serialize($data);
     $params['approved'] = $entry->get('approved');
     $params['confirmed'] = $entry->get('confirmed');
     /* if it is the first version, it is new entry */
     if ($entry->get('version') == 1) {
         $params['createdTime'] = $time;
         $params['createdBy'] = $uid;
         $params['createdIP'] = $IP;
     }
     $params['updatedTime'] = $time;
     $params['updatedBy'] = $uid;
     $params['updatedIP'] = $IP;
     $params['copy'] = !$entry->get('approved');
     if (Sobi::My('id') == $entry->get('owner')) {
         --$this->editLimit;
     }
     $params['editLimit'] = $this->editLimit;
     /* save it */
     try {
         /* Notices:
          * If it was new entry - insert
          * If it was an edit and the field wasn't filled before - insert
          * If it was an edit and the field was filled before - update
          *     " ... " and changes are not autopublish it should be insert of the copy .... but
          * " ... " if a copy already exist it is update again
          * */
         $db->insertUpdate('spdb_field_data', $params);
     } catch (SPException $x) {
         Sobi::Error(__CLASS__, SPLang::e('CANNOT_SAVE_DATA', $x->getMessage()), SPC::WARNING, 0, __LINE__, __FILE__);
     }
     /* if it wasn't edited in the default language, we have to try to insert it also for def lang */
     if (Sobi::Lang() != Sobi::DefLang()) {
         $params['lang'] = Sobi::DefLang();
         try {
             $db->insert('spdb_field_data', $params, true, true);
         } catch (SPException $x) {
             Sobi::Error(__CLASS__, SPLang::e('CANNOT_SAVE_DATA', $x->getMessage()), SPC::WARNING, 0, __LINE__, __FILE__);
         }
     }
     /** Last important thing - join selected categories  */
     $cats = SPFactory::registry()->get('request_categories', array());
     $cats = array_unique(array_merge($cats, $data));
     SPFactory::registry()->set('request_categories', $cats);
     if ($this->method == 'select' && $this->isPrimary) {
         $db->update('spdb_object', array('parent' => $data[0]), array('id' => $params['sid']));
     }
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:91,代码来源:category.php

示例9: createLangFile

 private static function createLangFile()
 {
     static $loaded = false;
     if (!$loaded) {
         $lang = array('months' => Sobi::Txt('JS_CALENDAR_MONTHS'), 'monthsShort' => Sobi::Txt('JS_CALENDAR_MONTHS_SHORT'), 'days' => Sobi::Txt('JS_CALENDAR_DAYS'), 'daysShort' => Sobi::Txt('JS_CALENDAR_DAYS_SHORT'), 'daysMin' => Sobi::Txt('JS_CALENDAR_DAYS_MINI'), 'today' => Sobi::Txt('JS_CALENDAR_TODAY'));
         $check = md5(serialize($lang));
         if (!SPLoader::JsFile('locale.' . Sobi::Lang(false) . '_date_picker', false, true, false) || !stripos(SPFs::read(SPLoader::JsFile('locale.' . Sobi::Lang(false) . '_date_picker', false, false, false)), $check)) {
             foreach ($lang as $k => $v) {
                 $lang[$k] = explode(',', $v);
             }
             $lang = json_encode($lang);
             $c = "\nvar spDatePickerLang={$lang}";
             $c .= "\n//{$check}";
             SPFs::write(SPLoader::JsFile('locale.' . Sobi::Lang(false) . '_date_picker', false, false, false), $c);
         }
     }
     $loaded = true;
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:18,代码来源:input.php

示例10: searchForm

 /**
  * Shows the field in the search form
  * @param bool $return return or display directly
  * @return string
  */
 public function searchForm($return = false)
 {
     if ($this->searchMethod == 'general') {
         return false;
     }
     if ($this->searchMethod == 'range') {
         return $this->rangeSearch($this->searchRangeValues, $this->freeRange);
     }
     $fdata = array();
     try {
         $data = SPFactory::db()->dselect(array('baseData', 'sid', 'lang'), 'spdb_field_data', array('fid' => $this->fid, 'copy' => '0', 'enabled' => 1), 'field( lang, \'' . Sobi::Lang() . '\'), baseData', 0, 0, 'baseData')->loadAssocList();
         $languages = array();
         $output = array();
         $lang = Sobi::Lang(false);
         $defLang = Sobi::DefLang();
         if (count($data)) {
             foreach ($data as $row) {
                 $languages[$row['lang']][$row['sid']] = $row['baseData'];
             }
         }
         if (isset($languages[$lang])) {
             foreach ($languages[$lang] as $sid => $fieldData) {
                 $output[$sid] = $fieldData;
             }
             unset($languages[$lang]);
         }
         if (isset($languages[$defLang])) {
             foreach ($languages[$defLang] as $sid => $fieldData) {
                 if (!isset($output[$sid])) {
                     $output[$sid] = $fieldData;
                 }
             }
             unset($languages[$defLang]);
         }
         if (count($languages)) {
             foreach ($languages as $language => $langData) {
                 foreach ($langData as $sid => $fieldData) {
                     if (!isset($output[$sid])) {
                         $output[$sid] = $fieldData;
                     }
                 }
                 unset($languages[$language]);
             }
         }
     } catch (SPException $x) {
         Sobi::Error($this->name(), SPLang::e('CANNOT_GET_FIELDS_DATA_DB_ERR', $x->getMessage()), SPC::WARNING, 0, __LINE__, __FILE__);
     }
     $data = (array) $output;
     if (count($data)) {
         $fdata[''] = Sobi::Txt('FD.INBOX_SEARCH_SELECT', array('name' => $this->name));
         foreach ($data as $i => $d) {
             if (strlen($d)) {
                 $fdata[strip_tags($d)] = strip_tags($d);
             }
         }
     }
     return SPHtml_Input::select($this->nid, $fdata, $this->_selected, false, array('class' => $this->cssClass . ' ' . Sobi::Cfg('search.form_list_def_css', 'SPSearchSelect'), 'size' => '1', 'id' => $this->nid));
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:63,代码来源:inbox.php

示例11: sortBy

 /**
  * Static function to create the right SQL-Query if a entries list should be sorted by this field
  * @param string $tables - table or tables join
  * @param array $conditions - array with conditions
  * @param string $oPrefix
  * @param string $eOrder
  * @param string $eDir
  * @return void
  */
 public static function sortBy(&$tables, &$conditions, &$oPrefix, &$eOrder, $eDir)
 {
     /* @var SPdb $db */
     $db =& SPFactory::db();
     $tables = $db->join(array(array('table' => 'spdb_field_option_selected', 'as' => 'sdata', 'key' => 'fid'), array('table' => 'spdb_object', 'as' => 'spo', 'key' => array('sdata.sid', 'spo.id')), array('table' => 'spdb_field_data', 'as' => 'fdata', 'key' => array('fdata.fid', 'sdata.fid')), array('table' => 'spdb_field', 'as' => 'fdef', 'key' => array('fdef.fid', 'sdata.fid')), array('table' => 'spdb_language', 'as' => 'ldata', 'key' => array('sdata.optValue', 'ldata.sKey')), array('table' => 'spdb_relations', 'as' => 'sprl', 'key' => array('spo.id', 'sprl.id'))));
     $oPrefix = 'spo.';
     $conditions['spo.oType'] = 'entry';
     if (!isset($conditions['sprl.pid'])) {
         $conditions['sprl.pid'] = SPRequest::sid();
     }
     $conditions['ldata.oType'] = 'field_option';
     $conditions['fdef.nid'] = $eOrder;
     $eOrder = 'sValue.' . $eDir . ", field( language, '" . Sobi::Lang(false) . "', '" . Sobi::DefLang() . "' )";
     return true;
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:24,代码来源:select.php

示例12: view

 private function view()
 {
     $type = $this->key('template_type', 'xslt');
     if ($type != 'php' && Sobi::Cfg('global.disable_xslt', false)) {
         $type = 'php';
     }
     if ($type == 'xslt') {
         $visitor = $this->get('visitor');
         $current = $this->get($this->_type);
         $orderings = $this->get('orderings');
         $categories = $this->get('categories');
         $entries = $this->get('entries');
         $cUrl = array('title' => Sobi::Cfg('sef.alias', true) ? $current->get('nid') : $current->get('name'), 'sid' => $current->get('id'));
         if (SPRequest::int('site', 0)) {
             $cUrl['site'] = SPRequest::int('site', 0);
         }
         SPFactory::header()->addCanonical(Sobi::Url($cUrl, true, true, true));
         $data = array();
         $data['id'] = $current->get('id');
         $data['counter'] = $current->get('counter');
         $data['section'] = array('_complex' => 1, '_data' => Sobi::Section(true), '_attributes' => array('id' => Sobi::Section(), 'lang' => Sobi::Lang(false)));
         $data['name'] = array('_complex' => 1, '_data' => $current->get('name'), '_attributes' => array('lang' => Sobi::Lang(false)));
         if (Sobi::Cfg('category.show_desc') || $current->get('oType') == 'section') {
             $desc = $current->get('description');
             if (Sobi::Cfg('category.parse_desc')) {
                 Sobi::Trigger('prepare', 'Content', array(&$desc, $current));
             }
             $data['description'] = array('_complex' => 1, '_cdata' => 1, '_data' => $desc, '_attributes' => array('lang' => Sobi::Lang(false)));
         }
         $showIcon = $current->get('showIcon');
         if ($showIcon == SPC::GLOBAL_SETTING) {
             $showIcon = Sobi::Cfg('category.show_icon', true);
         }
         if ($showIcon && $current->get('icon')) {
             if (SPFs::exists(Sobi::Cfg('images.category_icons') . '/' . $current->get('icon'))) {
                 $data['icon'] = Sobi::FixPath(Sobi::Cfg('images.category_icons_live') . $current->get('icon'));
             }
         }
         $data['meta'] = array('description' => $current->get('metaDesc'), 'keys' => $this->metaKeys($current), 'author' => $current->get('metaAuthor'), 'robots' => $current->get('metaRobots'));
         $data['entries_in_line'] = $this->get('$eInLine');
         $data['categories_in_line'] = $this->get('$cInLine');
         $data['number_of_subcats'] = Sobi::Cfg('list.num_subcats');
         $this->menu($data);
         $this->alphaMenu($data);
         $data['visitor'] = $this->visitorArray($visitor);
         if (count($categories)) {
             $this->loadNonStaticData($categories);
             foreach ($categories as $category) {
                 $cat = $this->category($category);
                 $data['categories'][] = array('_complex' => 1, '_attributes' => array('id' => $cat['id'], 'nid' => $cat['nid']), '_data' => $cat);
             }
             if (strstr($orderings['categories'], 'name') && Sobi::Cfg('lang.multimode', false)) {
                 usort($data['categories'], 'self::orderByName');
                 if ($orderings['categories'] == 'name.desc') {
                     $data['categories'] = array_reverse($data['categories']);
                 }
             }
         }
         if (count($entries)) {
             $this->loadNonStaticData($entries);
             $manager = Sobi::Can('entry', 'edit', '*', Sobi::Section()) ? true : false;
             foreach ($entries as $eid) {
                 $en = $this->entry($eid, $manager);
                 $data['entries'][] = array('_complex' => 1, '_attributes' => array('id' => $en['id'], 'nid' => $en['nid']), '_data' => $en);
             }
             if (strstr($orderings['entries'], 'name') && Sobi::Cfg('lang.multimode', false)) {
                 usort($data['entries'], 'self::orderByName');
                 if ($orderings['entries'] == 'name.desc') {
                     $data['entries'] = array_reverse($data['entries']);
                 }
             }
             $this->navigation($data);
         }
         $this->fixTimes($data);
         $this->_attr = $data;
     }
     Sobi::Trigger($this->_type, ucfirst(__FUNCTION__), array(&$this->_attr));
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:78,代码来源:section.php

示例13: loadFields

 /**
  * @param int $sid
  * @param bool $enabled
  * @return void
  */
 public function loadFields($sid = 0, $enabled = false)
 {
     $sid = $sid ? $sid : $this->section;
     /* @var SPdb $db */
     $db = SPFactory::db();
     static $fields = array();
     static $lang = null;
     $lang = $lang ? $lang : Sobi::Lang(false);
     if (!isset($fields[$sid])) {
         /* get fields */
         try {
             if ($enabled) {
                 $db->select('*', 'spdb_field', array('section' => $sid, 'enabled' => 1), 'position');
             } else {
                 $db->select('*', 'spdb_field', array('section' => $sid), 'position');
             }
             $fields[$sid] = $db->loadObjectList();
             Sobi::Trigger($this->name(), ucfirst(__FUNCTION__), array(&$fields));
         } catch (SPException $x) {
             Sobi::Error($this->name(), SPLang::e('CANNOT_GET_FIELDS_DB_ERR', $x->getMessage()), SPC::ERROR, 500, __LINE__, __FILE__);
         }
     }
     $nameField = $this->nameField();
     if (!$this->_loaded || !count($fields[$sid])) {
         if (count($fields[$sid])) {
             /* if it is an entry - prefetch the basic fields data */
             if ($this->id) {
                 $noCopy = $this->checkCopy();
                 /* in case the entry is approved, or we are editing an entry, or the user can see unapproved changes */
                 if ($this->approved || $noCopy) {
                     $ordering = 'copy.desc';
                 } else {
                     $ordering = 'copy.asc';
                 }
                 try {
                     $fdata = $db->select('*', 'spdb_field_data', array('sid' => $this->id), $ordering)->loadObjectList();
                     $db->getQuery();
                     $fieldsdata = array();
                     if (count($fdata)) {
                         foreach ($fdata as $data) {
                             /* if it has been already set - check if it is not better language choose */
                             if (isset($fieldsdata[$data->fid])) {
                                 /*
                                  * I know - the whole thing could be shorter
                                  * but it is better to understand and debug this way
                                  */
                                 if ($data->lang == $lang) {
                                     if ($noCopy) {
                                         if (!$data->copy) {
                                             $fieldsdata[$data->fid] = $data;
                                         }
                                     } else {
                                         $fieldsdata[$data->fid] = $data;
                                     }
                                 } else {
                                     $fieldsdata['langs'][$data->lang][$data->fid] = $data;
                                 }
                             } else {
                                 if ($noCopy) {
                                     if (!$data->copy) {
                                         $fieldsdata[$data->fid] = $data;
                                     }
                                 } else {
                                     $fieldsdata[$data->fid] = $data;
                                 }
                             }
                         }
                     }
                     unset($fdata);
                     SPFactory::registry()->set('fields_data_' . $this->id, $fieldsdata);
                 } catch (SPException $x) {
                     Sobi::Error($this->name(), SPLang::e('DB_REPORTS_ERR', $x->getMessage()), SPC::WARNING, 0, __LINE__, __FILE__);
                 }
             }
             foreach ($fields[$sid] as $f) {
                 /* @var SPField $field */
                 $field = SPFactory::Model('field', defined('SOBIPRO_ADM'));
                 $field->extend($f);
                 if (isset($fieldsdata[$f->fid])) {
                     $field->loadData($this->id);
                 }
                 $this->fields[] = $field;
                 $this->fieldsNids[$field->get('nid')] = $this->fields[count($this->fields) - 1];
                 $this->fieldsIds[$field->get('fid')] = $this->fields[count($this->fields) - 1];
                 /* case it was the name field */
                 if ($field->get('fid') == $nameField) {
                     /* get the entry name */
                     $this->name = $field->getRaw();
                     /* save the nid (name id) of the field where the entry name is saved */
                     $this->nameField = $field->get('nid');
                 }
             }
             $this->_loaded = true;
         }
     }
//.........这里部分代码省略.........
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:101,代码来源:entry.php

示例14: storeData

 /**
  * @param $entry
  * @param $request
  * @param $files
  * @return SPdb
  * @throws SPException
  */
 protected function storeData(&$entry, $request, $files)
 {
     /* @var SPdb $db */
     $db =& SPFactory::db();
     $this->verify($entry, $request);
     $time = SPRequest::now();
     $IP = SPRequest::ip('REMOTE_ADDR', 0, 'SERVER');
     $uid = Sobi::My('id');
     /* if we are here, we can save these data */
     /* collect the needed params */
     $save = count($files) ? SPConfig::serialize($files) : null;
     $params = array();
     $params['publishUp'] = $entry->get('publishUp');
     $params['publishDown'] = $entry->get('publishDown');
     $params['fid'] = $this->fid;
     $params['sid'] = $entry->get('id');
     $params['section'] = Sobi::Reg('current_section');
     $params['lang'] = Sobi::Lang();
     $params['enabled'] = $entry->get('state');
     $params['baseData'] = $db->escape($save);
     $params['approved'] = $entry->get('approved');
     $params['confirmed'] = $entry->get('confirmed');
     /* if it is the first version, it is new entry */
     if ($entry->get('version') == 1) {
         $params['createdTime'] = $time;
         $params['createdBy'] = $uid;
         $params['createdIP'] = $IP;
     }
     $params['updatedTime'] = $time;
     $params['updatedBy'] = $uid;
     $params['updatedIP'] = $IP;
     $params['copy'] = !$entry->get('approved');
     if (Sobi::My('id') == $entry->get('owner')) {
         --$this->editLimit;
     }
     $params['editLimit'] = $this->editLimit;
     /* save it */
     try {
         $db->insertUpdate('spdb_field_data', $params);
         return $db;
     } catch (SPException $x) {
         Sobi::Error($this->name(), SPLang::e('CANNOT_SAVE_FIELDS_DATA_DB_ERR', $x->getMessage()), SPC::WARNING, 0, __LINE__, __FILE__);
         return $db;
     }
     return $db;
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:53,代码来源:image.php

示例15: display

 public function display()
 {
     $this->_type = 'search';
     $type = $this->key('template_type', 'xslt');
     if ($type != 'php' && Sobi::Cfg('global.disable_xslt', false)) {
         $type = 'php';
     }
     if ($type == 'xslt') {
         $searchData = array();
         $fields = $this->get('fields');
         $visitor = $this->get('visitor');
         $p = $this->get('priorities');
         $priorities = array();
         if (is_array($p) && count($p)) {
             foreach ($p as $priority => $eids) {
                 if (is_array($eids) && count($eids)) {
                     foreach ($eids as $sid) {
                         $priorities[$sid] = $priority;
                     }
                 }
             }
         }
         $entries = $this->get('entries');
         $searchData['section'] = array('_complex' => 1, '_data' => Sobi::Section(true), '_attributes' => array('id' => Sobi::Section(), 'lang' => Sobi::Lang(false)));
         $searchPhrase = $this->get('search_for');
         $phrase = $this->get('search_phrase');
         $searchPhrase = strlen($searchPhrase) ? $searchPhrase : Sobi::Txt('SH.SEARCH_FOR_BOX');
         SPFactory::header()->addJsCode('var spSearchDefStr = "' . Sobi::Txt('SH.SEARCH_FOR_BOX') . '"');
         if ($this->get('$eInLine')) {
             $searchData['entries_in_line'] = $this->get('$eInLine');
         }
         if ($this->get('$eCount') >= 0) {
             $searchData['message'] = Sobi::Txt('SH.SEARCH_FOUND_RESULTS', array('count' => $this->get('$eCount')));
         }
         $this->menu($searchData);
         $this->alphaMenu($searchData);
         $fData = array();
         if (Sobi::Cfg('search.show_searchbox', true)) {
             $fData['searchbox'] = array('_complex' => 1, '_data' => array('label' => array('_complex' => 1, '_data' => Sobi::Txt('SH.SEARCH_FOR'), '_attributes' => array('lang' => Sobi::Lang(false))), 'data' => array('_complex' => 1, '_xml' => 1, '_data' => SPHtml_Input::text('sp_search_for', $searchPhrase, array('class' => Sobi::Cfg('search.form_box_def_css', 'SPSearchBox'), 'id' => 'SPSearchBox')))), '_attributes' => array('position' => 1, 'css_class' => 'SPSearchBox'));
         }
         if (Sobi::Cfg('search.top_button', true)) {
             $fData['top_button'] = array('_complex' => 1, '_data' => array('label' => array('_complex' => 1, '_data' => Sobi::Txt('SH.SEARCH_START'), '_attributes' => array('lang' => Sobi::Lang())), 'data' => array('_complex' => 1, '_xml' => 1, '_data' => SPHtml_Input::submit('search', Sobi::Txt('SH.START'), array('id' => 'top_button')))), '_attributes' => array('position' => 1, 'css_class' => 'SPSearchButton'));
         }
         if (Sobi::Cfg('search.show_phrase', true)) {
             $fData['phrase'] = array('_complex' => 1, '_data' => array('label' => array('_complex' => 1, '_data' => Sobi::Txt('SH.FIND_ENTRIES_THAT_HAVE'), '_attributes' => array('lang' => Sobi::Lang(false))), 'data' => array('_complex' => 1, '_xml' => 1, '_data' => SPHtml_Input::radioList('spsearchphrase', array('all' => Sobi::Txt('SH.FIND_ENTRIES_THAT_HAVE_ALL_WORDS'), 'any' => Sobi::Txt('SH.FIND_ENTRIES_THAT_HAVE_ANY_WORDS'), 'exact' => Sobi::Txt('SH.FIND_ENTRIES_THAT_HAVE_EXACT_PHRASE')), 'spsearchphrase', strlen($phrase) ? $phrase : Sobi::Cfg('search.form_searchphrase_def', 'all'), null, 'right'))), '_attributes' => array('position' => 1, 'css_class' => 'SPSearchPhrase'));
         }
         if (count($fields)) {
             foreach ($fields as $field) {
                 $data = $field->searchForm();
                 $suffix = $field->get('searchMethod') != 'range' ? $field->get('suffix') : null;
                 if (strlen($data)) {
                     $fData[$field->get('nid')] = array('_complex' => 1, '_data' => array('label' => array('_complex' => 1, '_data' => $field->get('name'), '_attributes' => array('lang' => Sobi::Lang())), 'data' => array('_complex' => 1, '_xml' => 1, '_data' => $data)), '_attributes' => array('id' => $field->get('id'), 'type' => $field->get('type'), 'suffix' => $suffix, 'position' => $field->get('position'), 'css_class' => strlen($field->get('cssClass')) ? $field->get('cssClass') : 'spField'));
                 }
             }
         }
         if (Sobi::Cfg('search.bottom_button', false)) {
             $fData['bottom_button'] = array('_complex' => 1, '_data' => array('label' => array('_complex' => 1, '_data' => Sobi::Txt('SH.SEARCH_START'), '_attributes' => array('lang' => Sobi::Lang(false))), 'data' => array('_complex' => 1, '_xml' => 1, '_data' => SPHtml_Input::submit('search', Sobi::Txt('SH.START')))), '_attributes' => array('position' => 1, 'css_class' => 'SPSearchButton'));
         }
         $searchData['fields'] = $fData;
         if (count($entries)) {
             $this->loadNonStaticData($entries);
             $manager = Sobi::Can('entry', 'edit', '*', Sobi::Section()) ? true : false;
             foreach ($entries as $entry) {
                 $en = $this->entry($entry, $manager);
                 $searchData['entries'][] = array('_complex' => 1, '_attributes' => array('id' => $en['id'], 'search-priority' => isset($priorities[$en['id']]) ? $priorities[$en['id']] : 'undefined'), '_data' => $en);
             }
             $this->navigation($searchData);
         }
         $searchData['visitor'] = $this->visitorArray($visitor);
         $this->_attr = $searchData;
     }
     Sobi::Trigger($this->_type, ucfirst(__FUNCTION__), array(&$this->_attr));
     parent::display($this->_type);
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:74,代码来源:search.php


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