protected function _completeTable(&$table, &$data, &$config) { if (!$table->{self::$key}) { $table->modified_user_id = 0; $table->extension = !$table->extension ? 'com_content' : $table->extension; } $table->path = $table->parent_id > 1 ? self::_getTable($table->parent_id)->path . '/' : ''; $table->path .= $table->alias; if (empty($table->language)) { $table->language = '*'; } parent::g_completeTable($table, self::$custom, $config); }
protected function _completeTable(&$table, &$data, &$config) { if ($table->state == 1 && intval($table->publish_up) == 0) { $table->publish_up = JFactory::getDate()->toSql(); } if (!$table->{self::$key}) { $table->modified_by = 0; if (isset($config['params'])) { $ordering = isset($config['params']['ordering']) ? $config['params']['ordering'] : 0; } else { $ordering = $this->params->get('ordering', 0); } if ($ordering == 1) { $max = JCckDatabase::loadResult('SELECT MAX(ordering) FROM #__content WHERE catid = ' . (int) $table->catid); $table->ordering = (int) $max + 1; } elseif ($ordering == -1) { if (!isset($config['tasks']['reorder'])) { $config['tasks']['reorder'] = array(); } $idx = (int) $table->catid; if (!isset($config['tasks']['reorder'][$idx])) { $config['tasks']['reorder'][$idx] = 'catid = ' . (int) $table->catid . ' AND state >= 0'; } } elseif ($ordering > -1) { $table->reorder('catid = ' . (int) $table->catid . ' AND state >= 0'); } } if (!$table->title) { $table->title = JFactory::getDate()->format('Y-m-d-H-i-s'); $table->alias = $table->title; } $table->version++; // Readmore if (isset($config['type_fields_intro'])) { $intro = (int) $config['type_fields_intro']; } else { $query = 'SELECT COUNT(a.fieldid) FROM #__cck_core_type_field AS a LEFT JOIN #__cck_core_types AS b ON b.id = a.typeid' . ' WHERE b.name="' . (string) $config['type'] . '" AND a.client="intro"'; $intro = (int) JCckDatabase::loadResult($query); } if ($intro > 0) { if (isset($config['params'])) { $auto_readmore = isset($config['params']['auto_readmore']) ? $config['params']['auto_readmore'] : 1; } else { $auto_readmore = $this->params->get('auto_readmore', 1); } $table->fulltext = ''; if ($auto_readmore == 1) { $table->fulltext = '::cck::' . $config['id'] . '::/cck::'; } elseif ($auto_readmore == 2) { // Legacy if (strlen(strstr($data['introtext'], '::fulltext::')) > 0) { $fulltext_exists = true; if (strlen(strstr($data['introtext'], '::fulltext::::/fulltext::')) > 0) { $fulltext_exists = false; } } else { $fulltext_exists = false; } if ($fulltext_exists) { $table->fulltext = '::cck::' . $config['id'] . '::/cck::'; } } } if (empty($table->language)) { $table->language = '*'; } parent::g_completeTable($table, self::$custom, $config); }