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


PHP JTable::generateAlias方法代码示例

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


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

示例1: prepareTable

 /**
  * Prepare and sanitise the table data prior to saving.
  *
  * @param   JTable  $table  A JTable object.
  *
  * @return  void
  *
  * @since   1.6
  */
 protected function prepareTable($table)
 {
     $date = JFactory::getDate();
     $user = JFactory::getUser();
     if (isset($table->name)) {
         $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES);
     }
     if (isset($table->alias) && empty($table->alias)) {
         $table->generateAlias();
     }
     if (empty($table->id)) {
         $table->created = $date->toSql();
         // set the user
         if ($table->created_by == 0 || empty($table->created_by)) {
             $table->created_by = $user->id;
         }
         // Set ordering to the last item if not set
         if (empty($table->ordering)) {
             $db = JFactory::getDbo();
             $query = $db->getQuery(true)->select('MAX(ordering)')->from($db->quoteName('#__demo_look'));
             $db->setQuery($query);
             $max = $db->loadResult();
             $table->ordering = $max + 1;
         }
     } else {
         $table->modified = $date->toSql();
         $table->modified_by = $user->id;
     }
     if (!empty($table->id)) {
         // Increment the items version number.
         $table->version++;
     }
 }
开发者ID:namibia,项目名称:demo-joomla-3-component,代码行数:42,代码来源:look.php

示例2: prepareTable

 /**
  * Prepare and sanitise the table prior to saving.
  *
  * @param   JTable  $table  The JTable object
  *
  * @return  void
  *
  * @since   1.6
  */
 protected function prepareTable($table)
 {
     $date = JFactory::getDate()->toSql();
     $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES);
     $table->generateAlias();
     if (empty($table->id)) {
         // Set the values
         $table->created = $date;
         // Set ordering to the last item if not set
         if (empty($table->ordering)) {
             $db = $this->getDbo();
             $query = $db->getQuery(true)->select('MAX(ordering)')->from($db->quoteName('#__contact_details'));
             $db->setQuery($query);
             $max = $db->loadResult();
             $table->ordering = $max + 1;
         }
     } else {
         // Set the values
         $table->modified = $date;
         $table->modified_by = JFactory::getUser()->id;
     }
     // Increment the content version number.
     $table->version++;
 }
开发者ID:Rai-Ka,项目名称:joomla-cms,代码行数:33,代码来源:contact.php


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