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


PHP JUcmType::getTypeByTable方法代码示例

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


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

示例1: onCCK_Storage_LocationSaveOrder

 public static function onCCK_Storage_LocationSaveOrder($pks = array(), $order = array())
 {
     $table = static::_getTable();
     $tableClassName = get_class($table);
     $contentType = new JUcmType();
     $type = $contentType->getTypeByTable($tableClassName);
     $tagsObserver = $table->getObserverOfClass('JTableObserverTags');
     $conditions = array();
     if (empty($pks)) {
         return;
     }
     foreach ($pks as $i => $pk) {
         $table->load((int) $pk);
         /*
         			if ( !$this->canEditState( $table ) ) {
         				unset( $pks[$i] );
         			} else*/
         if ($table->ordering != $order[$i]) {
             $table->ordering = $order[$i];
             if ($type) {
                 if (!empty($tagsObserver) && !empty($type)) {
                     $table->tagsHelper = new JHelperTags();
                     $table->tagsHelper->typeAlias = $type->type_alias;
                     $table->tagsHelper->tags = explode(',', $table->tagsHelper->getTagIds($pk, $type->type_alias));
                 }
             }
             if (!$table->store()) {
                 JFactory::getApplication()->enqueueMessage($table->getError(), 'error');
                 return false;
             }
             // Remember to reorder within position and client_id
             $condition = static::_getReorderConditions($table);
             $found = false;
             foreach ($conditions as $cond) {
                 if ($cond[1] == $condition) {
                     $found = true;
                     break;
                 }
             }
             if (!$found) {
                 $key = $table->getKeyName();
                 $conditions[] = array($table->{$key}, $condition);
             }
         }
     }
     // Execute reorder for each condition
     foreach ($conditions as $cond) {
         $table->load($cond[0]);
         $table->reorder($cond[1]);
     }
     return true;
 }
开发者ID:codigoaberto,项目名称:SEBLOD,代码行数:52,代码来源:location.php

示例2: saveorder

 /**
  * Saves the manually set order of records.
  *
  * @param   array    $pks    An array of primary key ids.
  * @param   integer  $order  +1 or -1
  *
  * @return  mixed
  *
  * @since   12.2
  */
 public function saveorder($pks = null, $order = null)
 {
     $table = $this->getTable();
     $tableClassName = get_class($table);
     $contentType = new JUcmType();
     $type = $contentType->getTypeByTable($tableClassName);
     $tagsObserver = $table->getObserverOfClass('JTableObserverTags');
     $conditions = array();
     if (empty($pks)) {
         return JError::raiseWarning(500, JText::_($this->text_prefix . '_ERROR_NO_ITEMS_SELECTED'));
     }
     // Update ordering values
     foreach ($pks as $i => $pk) {
         $table->load((int) $pk);
         // Access checks.
         if (!$this->canEditState($table)) {
             // Prune items that you can't change.
             unset($pks[$i]);
             JLog::add(JText::_('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED'), JLog::WARNING, 'jerror');
         } elseif ($table->ordering != $order[$i]) {
             $table->ordering = $order[$i];
             if ($type) {
                 $this->createTagsHelper($tagsObserver, $type, $pk, $type->type_alias, $table);
             }
             if (!$table->store()) {
                 $this->setError($table->getError());
                 return false;
             }
             // Remember to reorder within position and client_id
             $condition = $this->getReorderConditions($table);
             $found = false;
             foreach ($conditions as $cond) {
                 if ($cond[1] == $condition) {
                     $found = true;
                     break;
                 }
             }
             if (!$found) {
                 $key = $table->getKeyName();
                 $conditions[] = array($table->{$key}, $condition);
             }
         }
     }
     // Execute reorder for each category.
     foreach ($conditions as $cond) {
         $table->load($cond[0]);
         $table->reorder($cond[1]);
     }
     // Clear the component's cache
     $this->cleanCache();
     return true;
 }
开发者ID:educakanchay,项目名称:kanchay,代码行数:62,代码来源:admin.php

示例3: reorder

 /**
  * Saves the manually set order of records.
  *
  * @param   array    $pks    An array of primary key ids.
  * @param   array    $order  THe new ordering list.
  *
  * @return  mixed
  */
 public function reorder($pks = null, $order = array())
 {
     $table = $this->getTable();
     $tableClassName = get_class($table);
     $contentType = new \JUcmType();
     $type = $contentType->getTypeByTable($tableClassName);
     $typeAlias = $type ? $type->type_alias : null;
     $tagsObserver = $table->getObserverOfClass('JTableObserverTags');
     $conditions = array();
     $errors = array();
     $orderCol = $this->state->get('reorder.column', 'ordering');
     // Update ordering values
     foreach ($pks as $i => $pk) {
         $table->load($pk);
         $table->{$orderCol} = $order[$i];
         $this->createTagsHelper($tagsObserver, $type, $pk, $typeAlias, $table);
         if (!$table->store()) {
             $errors[] = $table->getError();
             continue;
         }
         // Remember to reorder within position and client_id
         $condition = $this->getReorderConditions($table);
         $found = false;
         // Found reorder condition if is cached.
         foreach ($conditions as $cond) {
             if ($cond['cond'] == $condition) {
                 $found = true;
                 break;
             }
         }
         // If not found, we add this condition to cache.
         if (!$found) {
             $key = $table->getKeyName();
             $conditions[] = array('pk' => $table->{$key}, 'cond' => $condition);
         }
     }
     // Execute all reorder for each condition caches.
     foreach ($conditions as $cond) {
         $table->load($cond['pk']);
         $table->reorder($cond['cond']);
     }
     $this->state->set('error.message', $errors);
     // Clear the component's cache
     $this->cleanCache();
     return true;
 }
开发者ID:beingsane,项目名称:quickcontent,代码行数:54,代码来源:AdminModel.php


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