18 require_once SQ_CORE_PACKAGE_PATH.
'/page_templates/page_standard/page_standard_edit_fns.inc';
19 require_once SQ_CORE_PACKAGE_PATH.
'/paint_layout/paint_layout_page/paint_layout_page.inc';
42 parent::__construct();
60 $folder = $asset->
getFolder(
'type_formats');
62 $types = $asset->
attr(
'types');
63 if (empty($types) || !is_array($types)) {
64 echo
'There are no types defined';
67 $type_names = $GLOBALS[
'SQ_SYSTEM']->am->getTypeInfo(array_keys($types),
'name');
69 <table
class=
"sq-backend-table">
71 <td
class=
"sq-backend-table-header"><?php echo translate(
'asset_type'); ?></td>
72 <td
class=
"sq-backend-table-header"><?php echo translate(
'inherit_types'); ?></td>
76 <td
class=
"sq-backend-table-header"><?php echo translate(
'remove_question'); ?></td>
82 foreach ($types as $type => $inherit) {
85 <td
class=
"sq-backend-table-cell">
87 echo $type_names[$type];
90 <td
class=
"sq-backend-table-cell">
93 check_box($prefix.
'_inherit_types[]', $type, $inherit);
95 echo ($inherit) ? translate(
'yes') : translate(
'no');
102 <td
class=
"sq-backend-table-cell">
104 check_box($prefix.
'_remove[]', $type, FALSE);
133 $types = $asset->
attr(
'types');
134 $folder = $asset->
getFolder(
'type_formats');
135 $formats = $asset->
getFormats(
'type_formats');
138 $removed = array_get_index($_POST, $prefix.
'_remove', Array());
139 foreach ($removed as $type) {
140 if (isset($types[$type])) {
141 unset($types[$type]);
143 if (in_array($type, $formats)) {
145 $link = $GLOBALS[
'SQ_SYSTEM']->am->getLink($folder->id, SQ_LINK_TYPE_2, SQ_PAINT_LAYOUT_FORMAT_ASSET_TYPE, TRUE, $type);
147 trigger_localised_error(
'CORE0216', E_USER_WARNING);
150 $folder->deleteLink($link[
'linkid']);
157 if (!isset($_POST[$prefix.
'_inherit_types'])) {
158 $_POST[$prefix.
'_inherit_types'] = Array();
161 for (reset($types); NULL !== ($k = key($types)); next($types)) {
162 $types[$k] = (in_array($k, $_POST[$prefix.
'_inherit_types'])) ? TRUE : FALSE;
185 $types = $GLOBALS[
'SQ_SYSTEM']->am->getTypeList();
186 $types = array_diff($types, $asset->
attr(
'types'));
188 $type_options = $GLOBALS[
'SQ_SYSTEM']->am->getTypeInfo($types,
'name');
189 asort($type_options);
190 $type_options = Array(
'' =>
'- Select asset type -') + $type_options;
191 combo_box($prefix.
'_new_type', $type_options, FALSE,
'');
210 if (isset($_POST[$prefix.
'_new_type'])) {
212 $type = trim($_POST[$prefix.
'_new_type']);
216 $types = $asset->
attr(
'types');
217 if (!isset($types[$type])) {
218 $types[$type] = TRUE;
246 echo
'<p><i>'.translate(
'design_usage_explanation').
'</i></p>';
247 echo
'<div style="line-height: 160%">';
248 $res = $GLOBALS[
'SQ_SYSTEM']->am->getAssetidsByLookupValue(
'paint_layout::%', $asset->id, TRUE);
250 $singular = strtolower(translate(
'child'));
251 $plural = strtolower(translate(
'children'));
252 $paginate = (count($res) > 20);
254 $current_page_no = array_get_index($_REQUEST,
'usage_page_no', 0);
255 $total_pages = ceil(count($res) / 20);
256 $res = array_slice($res, $current_page_no * 20, 20);
258 foreach ($res as $entry) {
259 $count = $entry[
'child_count'];
260 echo get_asset_tag_line($entry[
'assetid'],
'lookupValues');
261 if (!empty($count)) {
262 echo
' and '.$count.
' '.(($count > 1) ? $plural : $singular);
269 if ($current_page_no > 0) {
270 echo
'<a href="'.htmlspecialchars(replace_query_string_vars(Array(
'usage_page_no' => $current_page_no-1))).
'">'.translate(
'previous_page').
'</a> ';
272 echo translate(
'page_number', $current_page_no + 1, $total_pages);
273 if ($current_page_no < ($total_pages-1)) {
274 echo
' <a href="'.htmlspecialchars(replace_query_string_vars(Array(
'usage_page_no' => $current_page_no+1))).
'">'.translate(
'next_page').
'</a> ';
301 $all_treeids = Array();
302 foreach ($treeids as $assetid => $asset_treeids) {
303 foreach ($asset_treeids[0] as $asset_treeid) {
304 if (($asset_treeid ===
'override') || ($asset_treeid ===
'not_override')) {
307 $all_treeids[$asset_treeid] = $assetid;
310 uksort($all_treeids, Array($this,
'_strlenCmp'));
312 foreach ($all_treeids as $treeid => $assetid) {
313 $treeid_copy = $treeid;
314 while (!empty($treeid_copy)) {
315 if (isset($res[$treeid_copy])) {
316 $res[$treeid_copy][
'child_count']++;
319 $treeid_copy = substr($treeid_copy, 0, -SQ_CONF_ASSET_TREE_SIZE);
321 $res[$treeid][
'assetid'] = $assetid;
322 $res[$treeid][
'child_count'] = 0;
341 return strlen($a) > strlen($b);