Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F1245663
cat_tag_processor.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, Nov 21, 8:12 AM
Size
2 KB
Mime Type
text/x-php
Expires
Sun, Nov 23, 8:12 AM (1 d, 21 h)
Engine
blob
Format
Raw Data
Handle
809934
Attached To
rINP In-Portal
cat_tag_processor.php
View Options
<?php
class
kCatDBTagProcessor
extends
kDBTagProcessor
{
function
ItemIcon
(
$params
)
{
$object
=&
$this
->
Application
->
recallObject
(
$this
->
getPrefixSpecial
(),
$this
->
Prefix
,
$params
);
$grids
=
$this
->
Application
->
getUnitOption
(
$this
->
Prefix
,
'Grids'
);
$icons
=&
$grids
[
$params
[
'grid'
]
][
'Icons'
];
$status_fields
=
$this
->
Application
->
getUnitOption
(
$this
->
Prefix
,
'StatusField'
);
if
(!
$status_fields
)
return
$icons
[
'default'
];
$value
=
$object
->
GetDBField
(
$status_fields
[
0
]);
// sets base status icon
if
(
$value
==
STATUS_ACTIVE
)
{
if
(
$object
->
GetDBField
(
'IsPop'
)
)
$value
=
'POP'
;
if
(
$object
->
GetDBField
(
'IsHot'
)
)
$value
=
'HOT'
;
if
(
$object
->
GetDBField
(
'IsNew'
)
)
$value
=
'NEW'
;
if
(
$object
->
GetDBField
(
'EditorsPick'
)
)
$value
=
'PICK'
;
}
return
isset
(
$icons
[
$value
])
?
$icons
[
$value
]
:
$icons
[
'default'
];
}
/**
* Returns path where exported category items should be saved
*
* @param Array $params
*/
function
ExportPath
(
$params
)
{
$ret
=
EXPORT_PATH
.
'/'
;
if
(
getArrayValue
(
$params
,
'as_url'
)
)
{
$ret
=
str_replace
(
FULL_PATH
.
'/'
,
$this
->
Application
->
BaseURL
(),
$ret
);
}
$export_options
=
unserialize
(
$this
->
Application
->
RecallVar
(
$this
->
getPrefixSpecial
().
'_options'
));
$ret
.=
$export_options
[
'ExportFilename'
].
'.'
.(
$export_options
[
'ExportFormat'
]
==
1
?
'csv'
:
'xml'
);
return
$ret
;
}
function
CategoryPath
(
$params
)
{
if
(!
isset
(
$params
[
'cat_id'
]))
{
$params
[
'cat_id'
]
=
$this
->
Application
->
RecallVar
(
$params
[
'session_var'
],
0
);
}
$block_params
[
'separator'
]
=
$params
[
'separator'
];
if
(
$params
[
'cat_id'
]
==
0
)
{
$block_params
[
'name'
]
=
$params
[
'rootcatblock'
];
return
$this
->
Application
->
ParseBlock
(
$block_params
);
}
else
{
$cat_object
=&
$this
->
Application
->
recallObject
(
'c'
,
'c_List'
);
$sql
=
'SELECT CategoryId, ParentId, Name FROM '
.
$cat_object
->
TableName
.
' WHERE CategoryId = '
.
$params
[
'cat_id'
];
$res
=
$this
->
Conn
->
GetRow
(
$sql
);
$block_params
[
'name'
]
=
$params
[
'block'
];
$block_params
[
'cat_name'
]
=
$res
[
'Name'
];
$block_params
[
'cat_id'
]
=
$res
[
'CategoryId'
];
$next_params
[
'separator'
]
=
$params
[
'separator'
];
$next_params
[
'rootcatblock'
]
=
$params
[
'rootcatblock'
];
$next_params
[
'block'
]
=
$params
[
'block'
];
$next_params
[
'cat_id'
]
=
$res
[
'ParentId'
];
return
$this
->
CategoryPath
(
$next_params
).
$this
->
Application
->
ParseBlock
(
$block_params
);
}
}
}
?>
Event Timeline
Log In to Comment