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


PHP JTable::getProperties方法代码示例

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


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

示例1: unserialize

 /**
  * Get a connection table object
  *
  * @param   int  $id  connection id
  *
  * @return  object  connection tables
  */
 public function &getConnection($id = null)
 {
     if (!is_null($id)) {
         $this->setId($id);
     }
     if (!is_object($this->_connection)) {
         $session = JFactory::getSession();
         $key = 'fabrik.connection.' . $this->_id;
         if ($session->has($key)) {
             $connProperties = unserialize($session->get($key));
             // $$$ rob since J1.6 - connection properties stored as an array (in f2 it was an object)
             if (is_a($connProperties, '__PHP_Incomplete_Class') || JArrayHelper::getValue($connProperties, 'id') == '') {
                 $session->clear($key);
             } else {
                 $this->_connection = FabTable::getInstance('connection', 'FabrikTable');
                 $this->_connection->bind($connProperties);
                 return $this->_connection;
             }
         }
         if ($this->_id == -1 || $this->_id == '') {
             $this->_connection = $this->loadDefaultConnection();
         } else {
             $this->_connection = FabTable::getInstance('Connection', 'FabrikTable');
             $this->_connection->load($this->_id);
         }
         // $$$ rob store the connection for later use as it may be required by modules/plugins
         $session->set($key, serialize($this->_connection->getProperties()));
     }
     return $this->_connection;
 }
开发者ID:rogeriocc,项目名称:fabrik,代码行数:37,代码来源:connection.php

示例2: onContentAfterSave

 /**
  * This method will be executed once the content is save
  *
  * @param   string $context Save context
  * @param   JTable $content JTable class of the content
  * @param   bool   $isNew   If the record is new or not
  *
  * @return void
  */
 public function onContentAfterSave($context, $content, $isNew)
 {
     //  If the user has create a new menu item, let's create it.
     if ($context == 'com_menus.item' && $isNew) {
         NenoHelper::createMenuStructure();
     } elseif ($content instanceof JTable) {
         /* @var $db NenoDatabaseDriverMysqlx */
         $db = JFactory::getDbo();
         $tableName = $content->getTableName();
         /* @var $table NenoContentElementTable */
         $table = NenoContentElementTable::load(array('table_name' => $tableName), false);
         if (!empty($table)) {
             // If the record has changed the state to 'Trashed'
             if (isset($content->state) && $content->state == -2) {
                 $primaryKeys = $content->getPrimaryKey();
                 $this->trashTranslations($table, array($content->{$primaryKeys[0]}));
             } else {
                 $fields = $table->getFields(false, true);
                 /* @var $field NenoContentElementField */
                 foreach ($fields as $field) {
                     if ($field->isTranslatable()) {
                         $primaryKeyData = array();
                         foreach ($content->getPrimaryKey() as $primaryKeyName => $primaryKeyValue) {
                             $primaryKeyData[$primaryKeyName] = $primaryKeyValue;
                         }
                         $field->persistTranslations($primaryKeyData);
                     }
                 }
                 $languages = NenoHelper::getLanguages(false);
                 $defaultLanguage = NenoSettings::get('source_language');
                 foreach ($languages as $language) {
                     if ($language->lang_code != $defaultLanguage) {
                         $shadowTable = $db->generateShadowTableName($tableName, $language->lang_code);
                         $properties = $content->getProperties();
                         $query = 'REPLACE INTO ' . $db->quoteName($shadowTable) . ' (' . implode(',', $db->quoteName(array_keys($properties))) . ') VALUES(' . implode(',', $db->quote($properties)) . ')';
                         $db->setQuery($query);
                         $db->execute();
                     }
                 }
             }
         }
     }
 }
开发者ID:andresmaeso,项目名称:neno,代码行数:52,代码来源:neno.php


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