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


PHP JTableNested类代码示例

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


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

示例1: check

 /**
  * Assert that the nested set data is valid.
  *
  * @return  boolean  True if the instance is sane and able to be stored in the database.
  *
  * @since   11.1
  */
 public function check()
 {
     try {
         parent::check();
     } catch (\Exception $e) {
         $this->setError($e->getMessage());
         return false;
     }
     $this->parent_id = (int) $this->parent_id;
     if (empty($this->rules)) {
         $this->rules = '{}';
     }
     // JTableNested does not allow parent_id = 0, override this.
     if ($this->parent_id > 0) {
         // Get the JDatabaseQuery object
         $query = $this->_db->getQuery(true)->select('COUNT(id)')->from($this->_db->quoteName($this->_tbl))->where($this->_db->quoteName('id') . ' = ' . $this->parent_id);
         $this->_db->setQuery($query);
         if ($this->_db->loadResult()) {
             return true;
         } else {
             $this->setError('Invalid Parent ID');
             return false;
         }
     }
     return true;
 }
开发者ID:Rai-Ka,项目名称:joomla-cms,代码行数:33,代码来源:asset.php

示例2: mosCategory

 function mosCategory(&$db)
 {
     ///parent::__construct( $db );
     // for 1.6
     JTableNested::__construct('#__booklibrary_legacy_categories', 'id', $db);
     $this->access = (int) JFactory::getConfig()->get('access');
     // --
 }
开发者ID:rdegennaro,项目名称:Check-It,代码行数:8,代码来源:category.php

示例3: __construct

 public function __construct($table, $key = 'id', $alias = null, $db = null)
 {
     $this->_alias = $alias;
     if (!isset($db)) {
         $db = JFactory::getDbo();
     }
     parent::__construct($table, $key, $db);
 }
开发者ID:Knuckle-ORM,项目名称:knorm,代码行数:8,代码来源:nestedbase.php

示例4: delete

 /**
  * Delete category record
  *
  * @author RickG
  * @return boolean True on success
  * @todo Add check for store and products assinged to category before allowing delete
  */
 public function delete($pk = null, $children = true)
 {
     if (parent::delete($pk, $children)) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:srbsnkr,项目名称:sellingonlinemadesimple,代码行数:15,代码来源:xmlconfig.php

示例5: bind

 /**
  * Overloaded bind function
  *
  * @param	array $hash		named array
  * @return	mixed			null is operation was satisfactory, otherwise returns an error
  * @see		JTable:bind
  * @since	1.5
  */
 public function bind($array, $ignore = '')
 {
     if (is_array($array['params'])) {
         $registry = new JRegistry();
         $registry->loadArray($array['params']);
         $array['params'] = $registry->toString();
     }
     return parent::bind($array, $ignore);
 }
开发者ID:joebushi,项目名称:joomla,代码行数:17,代码来源:menu.php

示例6: getTree

 public function getTree($pk = null, $diagnostic = false)
 {
     $k = $this->_tbl_key;
     $pk = is_null($pk) ? $this->{$k} : $pk;
     if (!isset(self::$getTree[$pk][(int) $diagnostic])) {
         self::$getTree[$pk][(int) $diagnostic] = parent::getTree($pk, $diagnostic);
     }
     return self::$getTree[$pk][(int) $diagnostic];
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:9,代码来源:address.php

示例7: store

 public function store($updateNulls = false)
 {
     // Verify that the alias is unique
     $table = JTable::getInstance('Category', 'Table', array('dbo' => $this->getDbo()));
     if ($table->load(array('alias' => $this->alias, 'parent_id' => $this->parent_id)) && ($table->id != $this->id || $this->id == 0)) {
         $this->setError(JText::_('JLIB_DATABASE_ERROR_CATEGORY_UNIQUE_ALIAS'));
         return false;
     }
     return parent::store($updateNulls);
 }
开发者ID:hixbotay,项目名称:executivetransport,代码行数:10,代码来源:category.php

示例8: delete

 public function delete($pk = null, $children = true)
 {
     JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_judirectory/tables');
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $query->select('id');
     $query->from('#__judirectory_template_styles');
     $query->where('template_id =' . $pk);
     $db->setQuery($query);
     $styleIds = $db->loadColumn();
     if ($styleIds) {
         $styleTable = JTable::getInstance("Style", "JUDirectoryTable");
         foreach ($styleIds as $styleId) {
             if (!$styleTable->delete($styleId)) {
                 return false;
             }
         }
     }
     return parent::delete($pk);
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:20,代码来源:template.php

示例9: store

 /**
  * Overloaded store function
  *
  * @param   boolean  $updateNulls  True to update fields even if they are null.
  *
  * @return  mixed    False on failure, positive integer on success.
  *
  * @see     JTable::store
  * @since   11.1
  */
 public function store($updateNulls = false)
 {
     $updated = parent::store($updateNulls);
     // Verify that the alias is unique
     $table = JTable::getInstance('Addon', 'oseMscTable');
     $table->load($this->getRootId());
     $table->rebuild($this->getRootId(), $table->lft, $table->level);
     return $updated;
     /*if($this->id != $this->getRootId())
     		{
     			$table->load($this->parent_id);
     			// Rebuild the paths of the category's children:
     			//oseExit($table);
     			if (!$table->rebuild($table->id, $table->lft, $table->level) && $updated) {
     				return false;
     			}
     		}
     		return $updated;*/
     //$table->load($table->getRootId());
     // Use new path for partial rebuild of table
     // Rebuild will return positive integer on success, false on failure
     //return ($table->rebuild());
     //return ($this->rebuild($this->{$this->_tbl_key}, $this->lft, $this->level) > 0);
 }
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:34,代码来源:addon.php

示例10: __construct

 /**
  * Constructor
  *
  * @param   JDatabaseDriver  $db  Database driver object.
  *
  * @since   11.1
  */
 public function __construct($db)
 {
     parent::__construct('#__assets', 'id', $db);
 }
开发者ID:GitIPFire,项目名称:Homeworks,代码行数:11,代码来源:asset.php

示例11: hasPrimaryKey

 /**
  * Validate that the primary key has been set.
  *
  * @return  boolean  True if the primary key(s) have been set.
  *
  * @since   1.5.2
  */
 public function hasPrimaryKey()
 {
     // For Joomla 3.2+ a native method has been provided
     if (method_exists(get_parent_class(), 'hasPrimaryKey')) {
         return parent::hasPrimaryKey();
     }
     // Otherwise, it checks if the only key field compatible for older Joomla versions is set or not
     if (isset($this->_tbl_key) && !empty($this->_tbl_key) && empty($this->{$this->_tbl_key})) {
         return false;
     }
     return true;
 }
开发者ID:810,项目名称:redCORE,代码行数:19,代码来源:nested.php

示例12: store

 /**
  * Overloaded store function
  *
  * @param   boolean  $updateNulls  True to update fields even if they are null.
  *
  * @return  mixed  False on failure, positive integer on success.
  *
  * @see     JTable::store()
  * @since   11.1
  */
 public function store($updateNulls = false)
 {
     $db = JFactory::getDbo();
     // Verify that the alias is unique
     $table = JTable::getInstance('Menu', 'JTable', array('dbo' => $this->getDbo()));
     if ($table->load(array('alias' => $this->alias, 'parent_id' => $this->parent_id, 'client_id' => (int) $this->client_id, 'language' => $this->language)) && ($table->id != $this->id || $this->id == 0)) {
         if ($this->menutype == $table->menutype) {
             $this->setError(JText::_('JLIB_DATABASE_ERROR_MENU_UNIQUE_ALIAS'));
         } else {
             $this->setError(JText::_('JLIB_DATABASE_ERROR_MENU_UNIQUE_ALIAS_ROOT'));
         }
         return false;
     }
     // Verify that the home page for this language is unique
     if ($this->home == '1') {
         $table = JTable::getInstance('Menu', 'JTable', array('dbo' => $this->getDbo()));
         if ($table->load(array('home' => '1', 'language' => $this->language))) {
             if ($table->checked_out && $table->checked_out != $this->checked_out) {
                 $this->setError(JText::_('JLIB_DATABASE_ERROR_MENU_DEFAULT_CHECKIN_USER_MISMATCH'));
                 return false;
             }
             $table->home = 0;
             $table->checked_out = 0;
             $table->checked_out_time = $db->getNullDate();
             $table->store();
         }
         // Verify that the home page for this menu is unique.
         if ($table->load(array('home' => '1', 'menutype' => $this->menutype)) && ($table->id != $this->id || $this->id == 0)) {
             $this->setError(JText::_('JLIB_DATABASE_ERROR_MENU_HOME_NOT_UNIQUE_IN_MENU'));
             return false;
         }
     }
     if (!parent::store($updateNulls)) {
         return false;
     }
     // Get the new path in case the node was moved
     $pathNodes = $this->getPath();
     $segments = array();
     foreach ($pathNodes as $node) {
         // Don't include root in path
         if ($node->alias != 'root') {
             $segments[] = $node->alias;
         }
     }
     $newPath = trim(implode('/', $segments), ' /\\');
     // Use new path for partial rebuild of table
     // Rebuild will return positive integer on success, false on failure
     return $this->rebuild($this->{$this->_tbl_key}, $this->lft, $this->level, $newPath) > 0;
 }
开发者ID:shoffmann52,项目名称:install-from-web-server,代码行数:59,代码来源:menu.php

示例13:

 function __construct(&$db)
 {
     parent::__construct('ins_level', 'id', $db);
 }
开发者ID:phucdnict,项目名称:cbcc_05062015,代码行数:4,代码来源:InsLevel.php

示例14: store

 /**
  * Method to store a node in the database table.
  *
  * @param   boolean  $updateNulls  True to update null values as well.
  *
  * @return  boolean  True on success.
  */
 public function store($updateNulls = false)
 {
     // Before store
     if (!$this->beforeStore($updateNulls)) {
         return false;
     }
     // Store
     if (!parent::store($updateNulls)) {
         return false;
     }
     // After store
     if (!$this->afterStore($updateNulls)) {
         return false;
     }
     return true;
 }
开发者ID:prox91,项目名称:joomla-dev,代码行数:23,代码来源:nested.php

示例15: store

 /**
  * Overloaded store function
  *
  * @param   boolean   $updateNulls  True to update null values as well.
  * @return  boolean   True on success, false otherwise
  * @since   1.5.7
  */
 public function store($updateNulls = false)
 {
     if (!parent::store($updateNulls)) {
         return false;
     }
     // If there aren't any sub categories there isn't anything to do anymore
     $cats = JoomHelper::getAllSubCategories($this->cid, false, true, true, false);
     if (!count($cats)) {
         return true;
     }
     // Set state of all sub-categories
     // according to the settings of this category
     $query = $this->_db->getQuery(true)->update(_JOOM_TABLE_CATEGORIES)->set('published = ' . (int) $this->published)->where('cid IN (' . implode(',', $cats) . ')');
     $this->_db->setQuery($query);
     if (!$this->_db->query()) {
         $this->setError($this->_db->getErrorMsg());
         return false;
     }
     // Set 'in_hidden' of all sub-categories
     // according to hidden state of this category
     // (but only if there was a change of this state)
     if ($this->_hidden != $this->hidden && !$this->in_hidden || $this->_in_hidden != $this->in_hidden) {
         if ($this->hidden == 0 && $this->in_hidden == 0) {
             // If 'hidden' is 0 only the categories
             // which aren't set to hidden must be changed
             // because they form a hidden group themselves
             // anyway and have to stay hidden
             $cats = JoomHelper::getAllSubCategories($this->cid, false, true, true, true);
         }
         $query = $this->_db->getQuery(true)->update(_JOOM_TABLE_CATEGORIES)->set('in_hidden = ' . (int) ($this->hidden || $this->in_hidden))->where('cid IN (' . implode(',', $cats) . ')');
         $this->_db->setQuery($query);
         if (!$this->_db->query()) {
             $this->setError($this->_db->getErrorMsg());
             return false;
         }
     }
     return true;
 }
开发者ID:naka211,项目名称:kkvn,代码行数:45,代码来源:joomgallerycategories.php


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