public function renderItem($pk, $params = array()) { $doc = CCK_Document::getInstance('html'); $doc->fields = $this->list[$pk]->fields; $doc->finalize('content', $this->type, 'item', $this->i_positions, $this->i_positions_more, $this->i_infos, $this->list[$pk]->pid); return $doc->render(false, $this->i_params); }
if (!$templateStyleItem) { $app->enqueueMessage('Oops! Template not found.. ; (', 'error'); return; } // Template Override $tpl['home'] = $app->getTemplate(); if (file_exists(JPATH_ADMINISTRATOR . '/templates/' . $tpl['home'] . '/html/tpl_' . $templateStyleItem->name)) { $pathI = JPATH_ADMINISTRATOR . '/templates/' . $tpl['home'] . '/html/tpl_' . $templateStyleItem->name; $path_rootI = JPATH_ADMINISTRATOR . '/templates/' . $tpl['home'] . '/html'; $tmplI = 'tpl_' . $templateStyleItem->name; } else { $pathI = JPATH_SITE . '/templates/' . $templateStyleItem->name; $path_rootI = JPATH_SITE . '/templates'; $tmplI = $templateStyleItem->name; } $docI = CCK_Document::getInstance('html'); $rparamsI = array('template' => $tmplI, 'file' => 'index.php', 'directory' => $path_rootI); include JPATH_LIBRARIES_CCK . '/base/list/list_inc_list_items.php'; $infos = array('context' => '', 'params' => $templateStyleItem->params, 'path' => $pathI, 'root' => JURI::root(true), 'template' => $templateStyleItem->name, 'theme' => $tpl['home']); $doc->i_infos = $infos; $doc->i_params = $rparamsI; $doc->i_positions = $positions; $doc->i_positions_more = $positions_p; if (isset($positions2)) { $positions = $positions2; $positions_p = $positions2_p; } } else { $fields = CCK_List::getFields_Items($search->name, $client, $access); $target_f = 'fields_list'; $positions = array();
protected function _render($context, &$article, $tpl, $contentType, $fields, $property, $client, $cck, $parent_type) { $app = JFactory::getApplication(); $dispatcher = JDispatcher::getInstance(); $user = JFactory::getUser(); $params = array('template' => $tpl['folder'], 'file' => 'index.php', 'directory' => $tpl['root']); $lang = JFactory::getLanguage(); $lang->load('com_cck_default', JPATH_SITE); JPluginHelper::importPlugin('cck_field'); JPluginHelper::importPlugin('cck_field_link'); JPluginHelper::importPlugin('cck_field_restriction'); $p_sef = isset($this->loaded[$contentType . '_' . $client . '_options']['sef']) ? $this->loaded[$contentType . '_' . $client . '_options']['sef'] : JCck::getConfig_Param('sef', '2'); $p_title = isset($this->loaded[$contentType . '_' . $client . '_options']['title']) ? $this->loaded[$contentType . '_' . $client . '_options']['title'] : ''; $p_typo = isset($this->loaded[$contentType . '_' . $client . '_options']['typo']) ? $this->loaded[$contentType . '_' . $client . '_options']['typo'] : 1; if ($p_typo) { JPluginHelper::importPlugin('cck_field_typo'); } jimport('cck.rendering.document.document'); $doc = CCK_Document::getInstance('html'); $positions = array(); if ($parent_type != '') { $w_type = '(b.name = "' . $contentType . '" OR b.name = "' . $parent_type . '")'; } else { $w_type = 'b.name = "' . $contentType . '"'; } if ($client == 'intro') { $positions_more = JCckDatabaseCache::loadObjectList('SELECT * FROM #__cck_core_type_position AS a LEFT JOIN #__cck_core_types AS b ON b.id = a.typeid' . ' WHERE ' . $w_type . ' AND a.client ="' . $client . '"', 'position'); // todo::improve } else { $positions_more = JCckDatabase::loadObjectList('SELECT * FROM #__cck_core_type_position AS a LEFT JOIN #__cck_core_types AS b ON b.id = a.typeid' . ' WHERE ' . $w_type . ' AND a.client ="' . $client . '"', 'position'); // todo::improve } // Fields if (count($fields)) { JPluginHelper::importPlugin('cck_storage'); $config = array('author' => 0, 'client' => $client, 'doSEF' => $p_sef, 'doTranslation' => JCck::getConfig_Param('language_jtext', 0), 'doTypo' => $p_typo, 'error' => 0, 'fields' => array(), 'id' => $cck->id, 'isNew' => 0, 'Itemid' => $app->input->getInt('Itemid', 0), 'location' => $cck->storage_location, 'pk' => $article->id, 'pkb' => $cck->pkb, 'storages' => array(), 'store_id' => (int) $cck->store_id, 'type' => $cck->cck, 'type_id' => (int) $cck->type_id, 'type_alias' => $cck->type_alias ? $cck->type_alias : $cck->cck); foreach ($fields as $field) { $field->typo_target = 'value'; $fieldName = $field->name; $value = ''; $name = !empty($field->storage_field2) ? $field->storage_field2 : $fieldName; //- if ($fieldName) { $Pt = $field->storage_table; if ($Pt && !isset($config['storages'][$Pt])) { $config['storages'][$Pt] = ''; $dispatcher->trigger('onCCK_Storage_LocationPrepareContent', array(&$field, &$config['storages'][$Pt], $config['pk'], &$config, &$article)); } $dispatcher->trigger('onCCK_StoragePrepareContent', array(&$field, &$value, &$config['storages'][$Pt])); if (is_string($value)) { $value = trim($value); } if ($p_title != '' && $p_title == $field->name) { $this->title = $value; } $hasLink = $field->link != '' ? 1 : 0; $dispatcher->trigger('onCCK_FieldPrepareContent', array(&$field, $value, &$config)); $target = $field->typo_target; if ($hasLink) { $dispatcher->trigger('onCCK_Field_LinkPrepareContent', array(&$field, &$config)); if ($field->link) { JCckPluginLink::g_setHtml($field, $target); } } if (@$field->typo && ($field->{$target} !== '' || $field->typo_label == -2) && $p_typo) { $dispatcher->trigger('onCCK_Field_TypoPrepareContent', array(&$field, $field->typo_target, &$config)); } else { $field->typo = ''; } $position = $field->position; $positions[$position][] = $fieldName; // Was it the last one? if ($config['error']) { break; } } } // Merge if (count($config['fields'])) { $fields = array_merge($fields, $config['fields']); // Test: a loop may be faster. $config['fields'] = NULL; unset($config['fields']); } } // BeforeRender if (isset($config['process']['beforeRenderContent']) && count($config['process']['beforeRenderContent'])) { foreach ($config['process']['beforeRenderContent'] as $process) { if ($process->type) { JCck::callFunc_Array('plg' . $process->group . $process->type, 'on' . $process->group . 'BeforeRenderContent', array($process->params, &$fields, &$config['storages'], &$config)); } } } // Finalize $doc->fields =& $fields; $infos = array('context' => $context, 'params' => $tpl['params'], 'path' => $tpl['path'], 'root' => JURI::root(true), 'template' => $tpl['folder'], 'theme' => $tpl['home']); $doc->finalize('content', $contentType, $client, $positions, $positions_more, $infos, $cck->id); $data = $doc->render(false, $params); $article->{$property} = str_replace($article->{$property}, $data, $article->{$property}); }