本文整理匯總了PHP中DevblocksPlatform::getTemplates方法的典型用法代碼示例。如果您正苦於以下問題:PHP DevblocksPlatform::getTemplates方法的具體用法?PHP DevblocksPlatform::getTemplates怎麽用?PHP DevblocksPlatform::getTemplates使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類DevblocksPlatform
的用法示例。
在下文中一共展示了DevblocksPlatform::getTemplates方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: showAddTemplatePeekAction
function showAddTemplatePeekAction()
{
@($view_id = DevblocksPlatform::importGPC($_REQUEST['view_id'], 'string', ''));
@($portal = DevblocksPlatform::importGPC($_REQUEST['portal'], 'string', ''));
$tpl = DevblocksPlatform::getTemplateService();
$tpl->assign('path', $this->_TPL_PATH);
$tpl->assign('view_id', $view_id);
$tpl->assign('portal', $portal);
if (null == ($tool = DAO_CommunityTool::getByCode($portal))) {
return;
}
if (null == ($tool_ext = DevblocksPlatform::getExtension($tool->extension_id, false))) {
return;
}
if (null == ($template_set = @$tool_ext->params['template_set'])) {
$template_set = '';
}
// not null
$templates = DevblocksPlatform::getTemplates($template_set);
$existing_templates = DAO_DevblocksTemplate::getWhere(sprintf("%s = %s", DAO_DevblocksTemplate::TAG, C4_ORMHelper::qstr('portal_' . $portal)));
// Sort templates
uasort($templates, create_function('$a, $b', "return strcasecmp(\$a->plugin_id.' '.\$a->path,\$b->plugin_id.' '.\$b->path);\n"));
// Filter out templates implemented by this portal already
if (is_array($templates)) {
foreach ($templates as $idx => $template) {
/* @var $template DevblocksTemplate */
if (is_array($existing_templates)) {
foreach ($existing_templates as $existing) {
/* @var $existing Model_DevblocksTemplate */
if (0 == strcasecmp($template->plugin_id, $existing->plugin_id) && 0 == strcasecmp($template->path, $existing->path)) {
unset($templates[$idx]);
}
}
}
}
}
$tpl->assign('templates', $templates);
$tpl->display('file:' . $this->_TPL_PATH . 'community/display/tabs/templates/add.tpl');
}