18 require_once SQ_CORE_PACKAGE_PATH.
'/content_type/content_type.inc';
43 parent::__construct($assetid);
58 SQ_LINK_NOTICE => Array(
78 $bc_container_link = $GLOBALS[
'SQ_SYSTEM']->am->getLinks($this->
id, SQ_LINK_TYPE_2,
'bodycopy_container', FALSE,
'minor');
79 if (!empty($bc_container_link)) {
80 $container = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($bc_container_link[0][
'majorid']);
81 $edit_fns = $container->getEditFns();
82 $edit_fns->generateContentFile($container);
96 $link = $GLOBALS[
'SQ_SYSTEM']->am->getLink($this->
id, SQ_LINK_NOTICE,
'', TRUE,
'snippet_asset');
110 $rootid = $GLOBALS[
'SQ_SYSTEM']->getUserPrefs($this->
type(),
'SQ_SNIPPET_ROOT');
111 if (empty($rootid)) {
116 $containers = $GLOBALS[
'SQ_SYSTEM']->am->getChildren($rootid,
'bodycopy_container', FALSE);
117 if (empty($containers)) {
124 foreach ($containers as $id => $type_code) {
126 $container = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($id);
127 if (is_null($container))
continue;
130 if ($container->readAccess()) {
131 if (method_exists($container,
'getContentType')) {
132 $content_type = $container->getContentType();
134 if (!isset($content_type->id) || $content_type->id == $this->id)
continue;
135 $content_type_type = $content_type->type();
136 if (($content_type_type == $this->
type()) && $content_type->isEmpty()) {
142 if($content_type_type ==
'content_type_nest_content') {
143 $content = $content_type->getSnippetInterface();
146 $content = $content_type->attr(
'html');
149 $results[$id] = Array(
150 'name' => $container->name,
151 'content' => $content,
152 'type' => $content_type_type,
155 unset($content_type);
158 $GLOBALS[
'SQ_SYSTEM']->am->forgetAsset($container);
174 $snippet_asset = NULL;
175 $snippet_link = $GLOBALS[
'SQ_SYSTEM']->am->getLink($this->
id, SQ_LINK_NOTICE,
'', TRUE,
'snippet_asset');
176 if (!empty($snippet_link)) {
177 $snippet_asset = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($snippet_link[
'minorid'], $snippet_link[
'minor_type_code'], TRUE);
180 return $snippet_asset;
196 $link = $GLOBALS[
'SQ_SYSTEM']->am->getLinkById($linkid);
197 if ($link[
'link_type'] == SQ_LINK_NOTICE && $link[
'value'] ==
'snippet_asset') {
198 return translate(
'cms_ct_snippet_link_desc');
200 return parent::describeLink($linkid);
256 $bc_container_link = $GLOBALS[
'SQ_SYSTEM']->am->getLinks($clone->id, SQ_LINK_TYPE_2,
'bodycopy_container', FALSE,
'minor');
257 if (!empty($bc_container_link)) {
258 $container = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($bc_container_link[0][
'majorid']);
259 $edit_fns = $container->getEditFns();
260 $edit_fns->generateContentFile($container);
263 return parent::cloneComponentsAdditional($clone, $components);